synopsis-0.12/0000775000076400007640000000000011172123233012652 5ustar stefanstefansynopsis-0.12/README0000644000076400007640000001165711150772544013555 0ustar stefanstefanInstallation guide ================== Requirements ------------ Synopsis uses features found in Python 2.2 and up. The build system requires a posix environment with GNU make and GNU autoconf installed. However, it is possible to build Synopsis for a native windows platform, running with the win32 python installation and emulating a MSVC compiler. Configuring ----------- * If the sources are checked out from svn, run './autogen.sh' to generate the configure scripts. This step requires autoconf to be installed. * Run 'python setup.py config' to configure the subprojects. * Be careful to pass the same '--prefix' option you are going to pass to the 'install' command, if you plan to install synopsis. See the section about installing for details. * Synopsis provides an alternative Cpp parser based on boost.wave. It overcomes certain limitations with the old ucpp-based parser, but incures a dependency on various boost libraries. Thus it's disabled by default. To build with this new Cpp parser, configure with --with-boost, and these optional boost-related flags: --with-boost-prefix= --with-boost-version= (e.g. 1.35) --with-boost-lib-suffix= (e.g. -gcc41-mt) Building -------- * Run 'python setup.py build' to compile everything. This will place all files that are going to be installed under build/ This step requires GNU make to be installed. If the executable 'make' is not GNU make, you have to set the 'MAKE' environment variable to GNU make. If you do not want to install, but rather try synopsis out from within the source directory, you may consider 'python setup.py build_ext --inplace' as an alternative, which will only compile the C/C++ extensions and put them right into the source tree. If you have checked out the source code from the repository, you will find a 'setup.cfg' file containing convenient default parameters during development. However, if you plan to install synopsis, you have to remove (or at least rename) this file or else distutils will get confused and not install extensions. * To build for windows native, just use the appropriate python interpreter to run the build script. You will need a mingw-compatible version of the python library (libpythonxx.a), which you have to build first. Instructions for this are at http://www.python.org/doc/current/inst/index.html. * If you want to use an external garbage collector for the Cxx parser instead of the built in one, run 'python setup.py config --with-gc-prefix=/your/gc/prefix' * To build within the source tree, it might be best to set up a setup.cfg file containing these options:: [build_ext] inplace=1 [build_clib] build_clib=. As a result, libSynopsis.so will be built into lib/, and the parser modules will be built right into Synopsis/, so set your LD_LIBRARY_PATH and PYTHONPATH variables accordingly. Testing ------- * The tests require version 2.2 of qmtest (http://www.qmtest.com), as well as tidy (http://www.w3.org/People/Raggett/tidy/) * run 'python setup.py test [--suite=]' where the optional argument --suite specifies a test suite to run. The default is to run all tests. Building documentation ---------------------- * 'python setup.py build_doc' will compile printable and html versions of the Tutorial as well as the Manual, and put them under share/doc/Synopsis * All four targets require xsltproc, and the printable Tutorial requires additionally fop (from http://xml.apache.org) * If you only want to build the html versions, run 'python setup.py build_doc --html' * If you only want the Tutorial, run 'python setup.py build_doc --tutorial' * etc. Installing ---------- * To install synopsis in , run 'python setup.py install --prefix=' The default prefix is the one from the python interpreter used during the build. If you chose a different prefix, make sure to set the PYTHONPATH appropriately so the package can be found by the python interpreter. * If documentation was built before, it will be installed into /share/doc/Synopsis Packaging --------- Source package: * 'python setup.py sdist' creates a source package (compressed tarball). For it to include documentation, you need to have run 'python setup.py build_doc' first (see above). Binary packages: * 'python setup.py bdist' creates a binary package (compressed tarball). Other binary packages may be supported, but may involve more complex setups. * rpms: An rpm spec file is provided ('synopsis.spec') which is used to generate fedora rpms, and possibly others. * windows installer: 'python setup.py bdist_wininst' generates a windows MSI package. Using Synopsis -------------- * Remember to set the PYTHONPATH variable if necessary, as well as LD_LIBRARY_PATH. * Read the tutorial to learn how to get started using synopsis. Reporting Bugs -------------- Please report bugs to http://synopsis.fresco.org/issues synopsis-0.12/PKG-INFO0000664000076400007640000000206011172123233013745 0ustar stefanstefanMetadata-Version: 1.0 Name: synopsis Version: 0.12 Summary: Source-code Introspection Tool Home-page: http://synopsis.fresco.org Author: Stefan Seefeld Author-email: stefan@fresco.org License: LGPL / GPL Download-URL: http://synopsis.fresco.org/download Description: Synopsis is a multi-language source code introspection tool that provides a variety of representations for the parsed code, to enable further processing such as documentation extraction, reverse engineering, and source-to-source translation. Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Console Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) Classifier: License :: OSI Approved :: GNU General Public License (GPL) Classifier: Operating System :: POSIX Classifier: Programming Language :: Python Classifier: Programming Language :: C++ Classifier: Topic :: Software Development :: Documentation synopsis-0.12/COPYING0000664000076400007640000006347611104703257013732 0ustar stefanstefan GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 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. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, 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 and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, 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 library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete 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 distribute a copy of this License along with the Library. 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 Library or any portion of it, thus forming a work based on the Library, 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) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, 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 Library, 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 Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you 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. If distribution of 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 satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be 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. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library 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. 9. 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 Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library 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 with this License. 11. 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 Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library 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 Library. 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. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library 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. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser 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 Library 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 Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, 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 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "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 LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. 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 LIBRARY 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 LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. 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 library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; 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. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! synopsis-0.12/MANIFEST.in0000644000076400007640000000201511104702322014401 0ustar stefanstefan# # MANIFEST template for source distribution generation # include COPYING README NEWS MANIFEST.in setup.py autogen.sh revision synopsis.spec include config/* exclude setup.cfg # python modules recursive-include Synopsis *.py # Synopsis C++ API recursive-include src * # C/C++ extensions recursive-include Synopsis/Parsers/Cpp * recursive-include Synopsis/Parsers/IDL * recursive-include Synopsis/Parsers/C * recursive-include Synopsis/Parsers/Cxx * # data files (compiled documentation etc.) recursive-include share * # documentation (source) recursive-include doc * # scripts include scripts/* # unit tests recursive-include tests * # experimental code recursive-include sandbox * # suppress svn bookkeeping stuff ... global-exclude .svn global-exclude .svn/* global-exclude .svn/*/* global-exclude .svn/*/*/* # ... and other local waste global-exclude autom4te.cache global-exclude autom4te.cache/* global-exclude *~ global-exclude *.pyc global-exclude *.pyo global-exclude *.so synopsis-0.12/setup.py0000664000076400007640000000756311171623435014407 0ustar stefanstefan#!/usr/bin/env python # # Copyright (C) 2004 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # # Setup script for synopsis # # Usage: python setup.py install # from Synopsis.dist.distribution import Distribution from distutils.core import setup from distutils import sysconfig import os, sys, re, glob, shutil module_ext = sysconfig.get_config_var('SO') def prefix(list, pref): return [pref + x for x in list] version = '0.12' revision = open('revision').read()[:-1] py_packages = ["Synopsis", "Synopsis.Parsers", "Synopsis.Parsers.IDL", "Synopsis.Parsers.Python", "Synopsis.Parsers.Cpp", "Synopsis.Parsers.C", "Synopsis.Parsers.Cxx", "Synopsis.Processors", "Synopsis.Processors.Comments", "Synopsis.Formatters", "Synopsis.Formatters.DocBook", "Synopsis.Formatters.DocBook.Markup", "Synopsis.Formatters.HTML", "Synopsis.Formatters.HTML.Views", "Synopsis.Formatters.HTML.Parts", "Synopsis.Formatters.HTML.Markup", "Synopsis.Formatters.HTML.Fragments"] ext_modules = [('Synopsis/Parsers/Cpp/ucpp', 'ParserImpl' + module_ext), ('Synopsis/Parsers/IDL', '_omniidl' + module_ext), ('Synopsis/Parsers/C', 'ParserImpl' + module_ext), ('Synopsis/Parsers/Cxx', 'ParserImpl' + module_ext)] scripts = ['synopsis', 'sxr-server'] if sys.platform == "win32": for script in scripts: filename = os.path.join('scripts', script) shutil.copyfile(filename, filename + '.py') scripts = [s + '.py' for s in scripts] data_files = [('share/doc/synopsis-%s'%version, ('README', 'COPYING', 'NEWS'))] data_files.append(('share/man/man1', glob.glob('share/man/man1/*.*'))) data_files.append(('share/synopsis-%s'%version, glob.glob('share/synopsis/*.*'))) #### add documentation documentation = [] for root, dirs, files in os.walk('share/doc/synopsis'): dest = root.replace('share/doc/synopsis', 'share/doc/synopsis-%s'%version) documentation.append((dest, [os.path.join(root, file) for file in files if os.path.isfile(os.path.join(root, file))])) if '.svn' in dirs: dirs.remove('.svn') data_files.extend(documentation) setup(distclass=Distribution, name="synopsis", version=version, revision=revision, author="Stefan Seefeld", maintainer="Stefan Seefeld", author_email="stefan@fresco.org", maintainer_email="stefan@fresco.org", description="Source-code Introspection Tool", long_description="""Synopsis is a multi-language source code introspection tool that provides a variety of representations for the parsed code, to enable further processing such as documentation extraction, reverse engineering, and source-to-source translation.""", url="http://synopsis.fresco.org", download_url = 'http://synopsis.fresco.org/download', license = 'LGPL / GPL', classifiers = ['Development Status :: 5 - Production/Stable', 'Environment :: Console', 'Environment :: Web Environment', 'Intended Audience :: Developers', 'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)', 'License :: OSI Approved :: GNU General Public License (GPL)', 'Operating System :: POSIX', 'Programming Language :: Python', 'Programming Language :: C++', 'Topic :: Software Development :: Documentation'], packages=py_packages, ext_modules=ext_modules, scripts=prefix(scripts, "scripts/"), data_files=data_files) synopsis-0.12/synopsis.spec0000664000076400007640000000710411171617546015435 0ustar stefanstefan%define name synopsis %define version 0.12 %define release 1 %define py_sitedir %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()") %define py_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)") %define url http://synopsis.fresco.org Summary: Source-code Introspection Tool Name: %{name} Version: %{version} Release: %{release}%{?dist} Source0: %{url}/download/%{name}-%{version}.tar.gz License: LGPLv2+ Group: Development/Tools BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Url: %{url} BuildRequires: python-devel BuildRequires: pkgconfig BuildRequires: libgc-devel BuildRequires: flex BuildRequires: bison Requires: python-docutils Requires: graphviz %description Synopsis is a multi-language source code introspection tool that provides a variety of representations for the parsed code, to enable further processing such as documentation extraction, reverse engineering, and source-to-source translation. %package devel Summary: The Synopsis development environment Group: Development/Libraries Requires: synopsis = %{version}-%{release} Requires: pkgconfig %description devel Headers and libraries for developing software that uses Synopsis APIs. %package doc Summary: The Synopsis documentation Group: Documentation Requires: synopsis = %{version}-%{release} %description doc Synopsis documentation %package idl Summary: The Synopsis IDL Parser License: GPLv2+ Group: Development/Tools Requires: synopsis = %{version}-%{release} %description idl Synopsis IDL Parser module to parse CORBA IDL. %prep %setup -q env CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" \ python setup.py config --with-gc-prefix=%{_prefix} --libdir=%{_libdir} %build env CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" python setup.py build %install rm -rf $RPM_BUILD_ROOT python setup.py install --root=$RPM_BUILD_ROOT %clean rm -rf $RPM_BUILD_ROOT %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files %defattr(-, root, root, -) %{_bindir}/* %{_libdir}/*.so.* %{py_sitearch}/*.egg-info %dir %{py_sitearch}/Synopsis/ %{py_sitearch}/Synopsis/*.py %{py_sitearch}/Synopsis/*.pyc %{py_sitearch}/Synopsis/*.pyo %dir %{py_sitearch}/Synopsis/Parsers/ %{py_sitearch}/Synopsis/Parsers/*.py %{py_sitearch}/Synopsis/Parsers/*.pyc %{py_sitearch}/Synopsis/Parsers/*.pyo %{py_sitearch}/Synopsis/Parsers/Cpp %{py_sitearch}/Synopsis/Parsers/C %{py_sitearch}/Synopsis/Parsers/Cxx %{py_sitearch}/Synopsis/Parsers/Python %{py_sitearch}/Synopsis/Processors %{py_sitearch}/Synopsis/Formatters %{_datadir}/synopsis-%{version} %dir %{_docdir}/synopsis-%{version} %{_docdir}/synopsis-%{version}/README %{_docdir}/synopsis-%{version}/COPYING %{_docdir}/synopsis-%{version}/NEWS %{_mandir}/man1/* %files devel %defattr(-, root, root, -) %{_includedir}/Synopsis %{_libdir}/*.so %{_libdir}/pkgconfig/synopsis.pc %{_docdir}/synopsis-%{version}/README %{_docdir}/synopsis-%{version}/COPYING %{_docdir}/synopsis-%{version}/NEWS %files doc %defattr(-, root, root, -) %{_docdir}/synopsis-%{version}/README %{_docdir}/synopsis-%{version}/COPYING %{_docdir}/synopsis-%{version}/NEWS %{_docdir}/synopsis-%{version}/html %{_docdir}/synopsis-%{version}/print %{_docdir}/synopsis-%{version}/examples %files idl %defattr(-, root, root, -) %{py_sitearch}/Synopsis/Parsers/IDL %{_docdir}/synopsis-%{version}/README %{_docdir}/synopsis-%{version}/COPYING %{_docdir}/synopsis-%{version}/NEWS %changelog * Thu Apr 16 2009 Stefan Seefeld 0.12-1 - Bump version number. * Fri Dec 26 2008 Stefan Seefeld 0.11-1 - initial package. synopsis-0.12/src/0000775000076400007640000000000011172123233013441 5ustar stefanstefansynopsis-0.12/src/configure0000775000076400007640000045325611126175472015402 0ustar stefanstefan#! /bin/sh # From configure.ac Revision: 1.9 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for libSynopsis 1.0. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='libSynopsis' PACKAGE_TARNAME='libsynopsis' PACKAGE_VERSION='1.0' PACKAGE_STRING='libSynopsis 1.0' PACKAGE_BUGREPORT='synopsis-devel@fresco.org' ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP CXX CXXFLAGS ac_ct_CXX RANLIB AR LD LN_S INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA MAJOR MINOR PYTHON GC_CPP GC_LIB PLATFORM LIBEXT LDSHARED LDSONAME LIBOBJS LTLIBOBJS' ac_subst_files='GC_BRIDGE' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP CXX CXXFLAGS CCC' # 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. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_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 ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_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'` 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 ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_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'` 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; }; } 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 directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $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 test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures libSynopsis 1.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/libsynopsis] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of libSynopsis 1.0:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-version=VERSION specify the Synopsis version to build --disable-threads disable threading support --disable-gc don't use garbage collector (default is enabled) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-python=PATH specify the Python interpreter --with-gc-prefix=PATH specify the prefix to the garbage collector Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF libSynopsis configure 1.0 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by libSynopsis $as_me 1.0, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file 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 $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { 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 # Check whether --enable-version was given. if test "${enable_version+set}" = set; then enableval=$enable_version; version=$enableval else version="1.0" fi # Check whether --with-python was given. if test "${with_python+set}" = set; then withval=$with_python; PYTHON="$with_python" else PYTHON="python" fi # Check whether --enable-threads was given. if test "${enable_threads+set}" = set; then enableval=$enable_threads; else enable_threads=yes fi # Check whether --enable-gc was given. if test "${enable_gc+set}" = set; then enableval=$enable_gc; ac_cv_enable_gc=no else ac_cv_enable_gc=yes fi # Check whether --with-gc_prefix was given. if test "${with_gc_prefix+set}" = set; then withval=$with_gc_prefix; ac_cv_with_gc_prefix="$with_gc_prefix" else ac_cv_with_gc_prefix="" 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { 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` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then 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 # Check that 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' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 that 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 { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { 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 ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { 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` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { 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 ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { 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 g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { 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 if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { 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 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}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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { 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 if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi for ac_prog in ar aal xiar 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_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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS 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 test -n "$AR" && break done test -n "$AR" || AR="ar" for ac_prog in ld xild 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_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LD"; then ac_cv_prog_LD="$LD" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LD="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LD=$ac_cv_prog_LD if test -n "$LD"; then { echo "$as_me:$LINENO: result: $LD" >&5 echo "${ECHO_T}$LD" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$LD" && break done test -n "$LD" || LD="ld" { 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 ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # 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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done IFS=$as_save_IFS fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { 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' # Determine major, minor, and bugfix version if echo "$version" | grep -q '\.'; then # there's one or more '.'s in release (e.g. 0.8 or 0.9.1) major=$(echo "$version" | sed -e 's/\.[0-9.]*$//') minor=$(echo "$version" | sed -e 's/^[0-9]*\.//') else # there's no '.' in release (e.g. 9) major=$version fi MAJOR=$major MINOR=$minor if test -n "$PYTHON" -a "$PYTHON" != yes; then # Extract the first word of "", so it can be a program name with args. set dummy ; 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_PYTHON+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$PYTHON"; then ac_cv_prog_PYTHON="$PYTHON" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PYTHON="{ { echo "$as_me:$LINENO: error: Cannot find Python interpreter" >&5 echo "$as_me: error: Cannot find Python interpreter" >&2;} { (exit 1); exit 1; }; }" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PYTHON=$ac_cv_prog_PYTHON if test -n "$PYTHON"; then { echo "$as_me:$LINENO: result: $PYTHON" >&5 echo "${ECHO_T}$PYTHON" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi else # Extract the first word of "python2 python", so it can be a program name with args. set dummy python2 python; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_PYTHON+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $PYTHON in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_PYTHON" && ac_cv_path_PYTHON="python" ;; esac fi PYTHON=$ac_cv_path_PYTHON if test -n "$PYTHON"; then { echo "$as_me:$LINENO: result: $PYTHON" >&5 echo "${ECHO_T}$PYTHON" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test "$ac_cv_enable_gc" == "yes"; then GC_BRIDGE=$srcdir/Synopsis/PTree/GC-enabled.tmpl if test -n "$ac_cv_with_gc_prefix"; then CPPFLAGS="$CPPFLAGS -I$ac_cv_with_gc_prefix/include/gc" LIBS="-L$ac_cv_with_gc_prefix/lib -lgc $LIBS" else GC_CPP="-I\${includedir}/Synopsis/gc/include" GC_LIB="Synopsis/gc/.libs/libgc.a" if test $enable_threads != no then { echo "$as_me:$LINENO: checking for flags needed for threading" >&5 echo $ECHO_N "checking for flags needed for threading... $ECHO_C" >&6; } if test "${ac_cv_search_pthread_create+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_pthread_create=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 GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_create (); int main () { return pthread_create (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_search_pthread_create="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_pthread_create" = no; then for ac_lib in -lpthread -Kpthread -Kthread -pthread; do LIBS="$ac_lib $ac_func_search_save_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 GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_create (); int main () { return pthread_create (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_search_pthread_create="$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_search_pthread_create" >&5 echo "${ECHO_T}$ac_cv_search_pthread_create" >&6; } if test "$ac_cv_search_pthread_create" != no; then test "$ac_cv_search_pthread_create" = "none required" || LIBS="$ac_cv_search_pthread_create $LIBS" fi fi fi else GC_BRIDGE=$srcdir/Synopsis/PTree/GC-disabled.tmpl fi PLATFORM=`$PYTHON -c "import os; print os.name" | tr -d "\r"` case `uname -s` in CYGWIN*) LIBEXT=".dll" LDSHARED="$CXX -shared" LDSONAME="-Wl,--soname," CXXFLAGS="-D_REENTRANT $CXXFLAGS" if test "$PLATFORM" == "nt"; then if test "$CXX" == "g++"; then CPPFLAGS="$CPPFLAGS -D PARSE_MSVC" CFLAGS="-mno-cygwin $CFLAGS" CXXFLAGS="-mno-cygwin $CXXFLAGS" LDFLAGS="-mno-cygwin $LDFLAGS" fi else PLATFORM="cygwin" fi ;; Darwin) LIBEXT=".dylib" LDSHARED="$CXX -dynamiclib" LDSONAME="-Wl,-install_name," CXXFLAGS="-D_REENTRANT $CXXFLAGS -fPIC" ;; *) LIBEXT=".so" LDSHARED="$CXX -shared" LDSONAME="-Wl,--soname," CXXFLAGS="-D_REENTRANT $CXXFLAGS -fPIC" ;; esac ac_config_files="$ac_config_files Synopsis/PTree/GC.hh Makefile synopsis.py synopsis-uninstalled.pc synopsis.pc" mkdir -p lib mkdir -p bin mkdir -p Synopsis/gc mkdir -p Synopsis/PTree mkdir -p Synopsis/SymbolLookup mkdir -p Synopsis/TypeAnalysis mkdir -p Support mkdir -p tools cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${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 more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by libSynopsis $as_me 1.0, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" _ACEOF 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 and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ libSynopsis config.status 1.0 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' _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 ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "Synopsis/PTree/GC.hh") CONFIG_FILES="$CONFIG_FILES Synopsis/PTree/GC.hh" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "synopsis.py") CONFIG_FILES="$CONFIG_FILES synopsis.py" ;; "synopsis-uninstalled.pc") CONFIG_FILES="$CONFIG_FILES synopsis-uninstalled.pc" ;; "synopsis.pc") CONFIG_FILES="$CONFIG_FILES synopsis.pc" ;; *) { { 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 fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for 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 _ACEOF # Create sed commands to just substitute file output variables. # Remaining file output variables are in a fragment that also has non-file # output varibles. ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim CPP!$CPP$ac_delim CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim ac_ct_CXX!$ac_ct_CXX$ac_delim RANLIB!$RANLIB$ac_delim AR!$AR$ac_delim LD!$LD$ac_delim LN_S!$LN_S$ac_delim INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim INSTALL_DATA!$INSTALL_DATA$ac_delim MAJOR!$MAJOR$ac_delim MINOR!$MINOR$ac_delim PYTHON!$PYTHON$ac_delim GC_CPP!$GC_CPP$ac_delim GC_LIB!$GC_LIB$ac_delim PLATFORM!$PLATFORM$ac_delim LIBEXT!$LIBEXT$ac_delim LDSHARED!$LDSHARED$ac_delim LDSONAME!$LDSONAME$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 66; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end /^[ ]*@GC_BRIDGE@[ ]*$/{ r $GC_BRIDGE d } _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF 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&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; esac done # for ac_tag { (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 synopsis-0.12/src/tools/0000775000076400007640000000000011172123233014601 5ustar stefanstefansynopsis-0.12/src/tools/display-symbols.cc0000664000076400007640000000271411104702322020244 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include #include #include #include #include #include using namespace Synopsis; int usage(const char *command) { std::cerr << "Usage: " << command << " " << std::endl; return -1; } int main(int argc, char **argv) { bool debug = false; const char *input = argv[1]; if (argc == 1) return usage(argv[0]); for (int i = 1; i < argc - 1; ++i) { if (argv[i] == std::string("-d")) debug = true; else return usage(argv[0]); } input = argv[argc - 1]; try { if (debug) Trace::enable(Trace::SYMBOLLOOKUP); std::ifstream ifs(input); Buffer buffer(ifs.rdbuf(), input); Lexer lexer(&buffer); SymbolFactory symbols; Parser parser(lexer, symbols); PTree::Node *node = parser.parse(); const Parser::ErrorList &errors = parser.errors(); for (Parser::ErrorList::const_iterator i = errors.begin(); i != errors.end(); ++i) (*i)->write(std::cerr); SymbolLookup::display(symbols.current_scope(), std::cout); } catch (const std::exception &e) { std::cerr << "Caught exception : " << e.what() << std::endl; } } synopsis-0.12/src/tools/display-ptree.cc0000664000076400007640000000511511164417441017704 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include #include #include #include #include #include using namespace Synopsis; int usage(const char *command) { std::cerr << "Usage: " << command << " [-c] [-g ] [-d] [-r] [-s] [-e] " << std::endl; return -1; } int main(int argc, char **argv) { bool encoding = false; bool typeinfo = false; bool debug = false; SymbolFactory::Language language = SymbolFactory::NONE; int tokenset = Lexer::CXX | Lexer::GCC; int ruleset = Parser::CXX | Parser::GCC; std::string dotfile; const char *input = argv[1]; if (argc == 1) return usage(argv[0]); for (int i = 1; i < argc - 1; ++i) { if (argv[i] == std::string("-g")) { // make sure an argument is provided if (++i == argc - 1 || argv[i][0] == '-') { usage(argv[0]); return -1; } dotfile = argv[i]; } else if (argv[i] == std::string("-c")) { tokenset = Lexer::C | Lexer::GCC; if (language != SymbolFactory::NONE) language = SymbolFactory::CXX; ruleset = Parser::GCC; } else if (argv[i] == std::string("-s")) { language = tokenset & Lexer::CXX ? SymbolFactory::CXX : SymbolFactory::C99; } else if (argv[i] == std::string("-e")) encoding = true; else if (argv[i] == std::string("-r")) typeinfo = true; else if (argv[i] == std::string("-d")) debug = true; else return usage(argv[0]); } input = argv[argc - 1]; try { if (debug) Trace::enable(Trace::ALL); PTree::Encoding::do_init_static(); std::ifstream ifs(input); Buffer buffer(ifs.rdbuf(), input); Lexer lexer(&buffer, tokenset); SymbolFactory symbols(language); Parser parser(lexer, symbols, ruleset); PTree::Node *node = parser.parse(); const Parser::ErrorList &errors = parser.errors(); for (Parser::ErrorList::const_iterator i = errors.begin(); i != errors.end(); ++i) (*i)->write(std::cerr); if (!node) return -1; if (dotfile.empty()) { PTree::display(node, std::cout, encoding, typeinfo); } else { std::ofstream os(dotfile.c_str()); PTree::generate_dot_file(node, os); } } catch (const std::exception &e) { std::cerr << "Caught exception : " << e.what() << std::endl; } } synopsis-0.12/src/synopsis.pc.in0000664000076400007640000000040211104702314016253 0ustar stefanstefanprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: Synopsis Description: C/C++ source code introspection tool Version: @PACKAGE_VERSION@ Requires: Libs: -L${libdir} -lSynopsis Cflags: -I${includedir} @GC_CPP@ @CPPFLAGS@ synopsis-0.12/src/Synopsis/0000775000076400007640000000000011172123233015270 5ustar stefanstefansynopsis-0.12/src/Synopsis/Parser.hh0000664000076400007640000003265711104702322017057 0ustar stefanstefan// // Copyright (C) 1997 Shigeru Chiba // Copyright (C) 2000 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_Parser_hh_ #define Synopsis_Parser_hh_ #include #include #include namespace Synopsis { class Lexer; struct Token; //. C++ Parser //. //. This parser is a LL(k) parser with ad hoc rules such as //. backtracking. //. //. () is the grammer rule for a non-terminal . //. opt_() is the grammer rule for an optional non-terminal . //. is_() looks ahead and returns true if the next symbol is . class Parser { public: //. RuleSet defines non-standard optional rules that can be chosen at runtime. enum RuleSet { CXX = 0x01, GCC = 0x02, MSVC = 0x04}; //. Error is used to cache parse errors encountered during the execution //. of the parse method. class Error { public: virtual ~Error() {} virtual void write(std::ostream &) const = 0; }; typedef std::vector ErrorList; Parser(Lexer &lexer, SymbolFactory &symbols, int ruleset = CXX|GCC); ~Parser(); ErrorList const &errors() const { return my_errors;} //. Return the origin of the given pointer //. (filename and line number) unsigned long origin(const char *, std::string &) const; PTree::Node *parse(); private: enum DeclKind { kDeclarator, kArgDeclarator, kCastDeclarator }; enum TemplateDeclKind { tdk_unknown, tdk_decl, tdk_instantiation, tdk_specialization, num_tdks }; struct ScopeGuard; friend struct ScopeGuard; //. A StatusGuard manages a tentative parse. //. All actions invoked after its instantiation //. will be rolled back in the destructor unless //. 'commit' has been called before. class StatusGuard { public: StatusGuard(Parser &); ~StatusGuard(); void commit() { my_committed = true;} private: Lexer & my_lexer; char const * my_token_mark; ErrorList my_errors; Parser::ErrorList::size_type my_error_mark; bool my_committed; }; friend class StatusGuard; bool mark_error(); template bool declare(T *); void show_message_head(const char*); bool definition(PTree::Node *&); bool null_declaration(PTree::Node *&); bool typedef_(PTree::Typedef *&); bool type_specifier(PTree::Node *&, bool, PTree::Encoding&); bool is_type_specifier(); bool metaclass_decl(PTree::Node *&); bool meta_arguments(PTree::Node *&); bool linkage_spec(PTree::Node *&); bool namespace_spec(PTree::NamespaceSpec *&); bool namespace_alias(PTree::NamespaceAlias *&); bool using_directive(PTree::UsingDirective *&); bool using_declaration(PTree::UsingDeclaration *&); bool linkage_body(PTree::Node *&); bool template_decl(PTree::Node *&); bool template_decl2(PTree::TemplateDecl *&, TemplateDeclKind &kind); //. template-parameter-list: //. //. - template-parameter //. - template-parameter-list `,` template-parameter bool template_parameter_list(PTree::List *&); //. template-parameter: //. //. - type-parameter //. - parameter-declaration bool template_parameter(PTree::Node *&); //. type-parameter: //. //. - class identifier [opt] //. - class identifier [opt] `=` type-id //. - typename identifier [opt] //. - typename identifier [opt] `=` type-id //. - template `<` template-parameter-list `>` class identifier [opt] //. - template `<` template-parameter-list `>` class identifier [opt] `=` id-expression bool type_parameter(PTree::Node *&); //. GNU extension: //. extern-template-decl: //. //. - extern template declaration bool extern_template_decl(PTree::Node *&); bool declaration(PTree::Declaration *&); bool integral_declaration(PTree::Declaration *&, PTree::Encoding&, PTree::Node *, PTree::Node *, PTree::Node *); bool const_declaration(PTree::Declaration *&, PTree::Encoding&, PTree::Node *, PTree::Node *); bool other_declaration(PTree::Declaration *&, PTree::Encoding&, PTree::Node *, PTree::Node *, PTree::Node *); //. condition: //. //. - expression //. - type-specifier-seq declarator `=` assignment-expression bool condition(PTree::Node *&); bool is_constructor_decl(); bool is_ptr_to_member(int); bool opt_member_spec(PTree::Node *&); //. storage-spec: //. //. - empty //. - static //. - extern //. - auto //. - register //. - mutable bool opt_storage_spec(PTree::Node *&); //. cv-qualifier: //. //. - empty //. - const //. - volatile bool opt_cv_qualifier(PTree::Node *&); bool opt_integral_type_or_class_spec(PTree::Node *&, PTree::Encoding&); bool constructor_decl(PTree::Node *&, PTree::Encoding&); bool opt_throw_decl(PTree::Node *&); //. [gram.dcl.decl] bool init_declarator_list(PTree::Node *&, PTree::Encoding&, bool, bool = false); bool init_declarator(PTree::Node *&, PTree::Encoding&, bool, bool); bool declarator(PTree::Node *&, DeclKind, bool, PTree::Encoding&, PTree::Encoding&, bool, bool = false); bool declarator2(PTree::Node *&, DeclKind, bool, PTree::Encoding&, PTree::Encoding&, bool, bool, PTree::Node **); bool opt_ptr_operator(PTree::Node *&, PTree::Encoding&); bool member_initializers(PTree::Node *&); bool member_init(PTree::Node *&); bool name(PTree::Node *&, PTree::Encoding&); bool operator_name(PTree::Node *&, PTree::Encoding&); bool cast_operator_name(PTree::Node *&, PTree::Encoding&); bool ptr_to_member(PTree::Node *&, PTree::Encoding&); bool template_args(PTree::Node *&, PTree::Encoding&); bool parameter_declaration_list_or_init(PTree::Node *&, bool&, PTree::Encoding&, bool); bool parameter_declaration_list(PTree::Node *&, PTree::Encoding&); //. parameter-declaration: //. //. - decl-specifier-seq declarator //. - decl-specifier-seq declarator `=` assignment-expression //. - decl-specifier-seq abstract-declarator [opt] //. - decl-specifier-seq abstract-declarator [opt] `=` assignment-expression bool parameter_declaration(PTree::ParameterDeclaration *&, PTree::Encoding&); bool function_arguments(PTree::Node *&); bool designation(PTree::Node *&); bool initialize_expr(PTree::Node *&); bool enum_spec(PTree::EnumSpec *&, PTree::Encoding&); bool enum_body(PTree::Node *&); bool class_spec(PTree::ClassSpec *&, PTree::Encoding&); //. base-clause: //. //. - `:` base-specifier-list //. //. base-specifier-list: //. //. - base-specifier //. - base-specifier-list `,` base-specifier //. //. base-specifier: //. //. - virtual access-specifier [opt] `::` [opt] nested-name-specifier [opt] class-name //. - access-specifier virtual [opt] `::` [opt] nested-name-specifier [opt] class-name bool base_clause(PTree::Node *&); bool class_body(PTree::ClassBody *&); bool class_member(PTree::Node *&); bool access_decl(PTree::Node *&); bool user_access_spec(PTree::Node *&); //. expression: //. //. - assignment-expression //. - expression `,` assignment-expression bool expression(PTree::Node *&); //. assignment-expression: //. //. - conditional-expression //. - logical-or-expression assignment-operator assignment-expression //. - throw-expression bool assign_expr(PTree::Node *&); //. conditional-expression: //. //. - logical-or-expression //. - logical-or-expression `?` expression `:` assignment-expression bool conditional_expr(PTree::Node *&); //. logical-or-expression: //. //. - logical-and-expression //. - logical-or-expression `||` logical-and-expression bool logical_or_expr(PTree::Node *&); //. logical-and-expression: //. //. - inclusive-or-expression //. - logical-and-expr `&&` inclusive-or-expression bool logical_and_expr(PTree::Node *&); //. inclusive-or-expression: //. //. - exclusive-or-expression //. - inclusive-or-expression `|` exclusive-or-expression bool inclusive_or_expr(PTree::Node *&); //. exclusive-or-expression: //. //. - and-expression //. - exclusive-or-expression `^` and-expression bool exclusive_or_expr(PTree::Node *&); //. and-expression: //. //. - equality-expression //. - and-expression `&` equality-expression bool and_expr(PTree::Node *&); //. equality-expression: //. //. - relational-expression //. - equality-expression `==` relational-expression //. - equality-expression `!=` relational-expression bool equality_expr(PTree::Node *&); //. relational-expression: //. //. - shift-expression //. - relational-expression `<` shift-expression //. - relational-expression `>` shift-expression //. - relational-expression `<=` shift-expression //. - relational-expression `>=` shift-expression bool relational_expr(PTree::Node *&); //. shift-expression: //. //. - additive-expression //. - shift-expression `<<` additive-expression //. - shift-expression `>>` additive-expression bool shift_expr(PTree::Node *&); //. additive-expression: //. //. - multiplicative-expression //. - additive-expression `+` multiplicative-expression //. - additive-expression `-` multiplicative-expression bool additive_expr(PTree::Node *&); //. multiplicative-expression: //. //. - pm-expression //. - multiplicative-expression `*` pm-expression //. - multiplicative-expression `/` pm-expression //. - multiplicative-expression `%` pm-expression bool multiplicative_expr(PTree::Node *&); //. pm-expression: //. //. - cast-expression //. - pm-expression `.*` cast-expression //. - pm-expression `->*` cast-expression bool pm_expr(PTree::Node *&); //. cast-expression: //. //. - unary-expression //. - `(` type-id `)` cast-expression bool cast_expr(PTree::Node *&); //. type-id: //. //. - type-specifier-seq abstract-declarator [opt] bool type_id(PTree::Node *&); bool type_id(PTree::Node *&, PTree::Encoding&); //. unary-expression: //. //. - postfix-expression //. - `++` cast-expression //. - `--` cast-expression //. - unary-operator cast-expression //. - `sizeof` unary-expression //. - `sizeof` `(` unary-expression `)` //. - new-expression //. - delete-expression //. //. unary-operator: //. //. - `*` //. - `&` //. - `+` //. - `-` //. - `!` //. - `~` bool unary_expr(PTree::Node *&); //. throw-expression: //. //. - `throw` assignment-expression bool throw_expr(PTree::Node *&); //. sizeof-expression: //. //. - `sizeof` unary-expression //. - `sizeof` `(` type-id `)` bool sizeof_expr(PTree::Node *&); bool offsetof_expr(PTree::Node *&); //. typeid-expression: //. //. - typeid `(` type-id `)` //. - typeid `(` expression `)` bool typeid_expr(PTree::Node *&); bool is_allocate_expr(Token::Type); bool allocate_expr(PTree::Node *&); bool userdef_keyword(PTree::Node *&); bool allocate_type(PTree::Node *&); bool new_declarator(PTree::Declarator *&, PTree::Encoding&); bool allocate_initializer(PTree::Node *&); bool postfix_expr(PTree::Node *&); bool primary_expr(PTree::Node *&); bool typeof_expr(PTree::Node *&); bool userdef_statement(PTree::Node *&); bool var_name(PTree::Node *&); bool var_name_core(PTree::Node *&, PTree::Encoding&); bool is_template_args(); //. function-body: //. //. - compound-statement bool function_body(PTree::Block *&); //. compound-statement: //. //. - `{` statement [opt] `}` bool compound_statement(PTree::Block *&, bool create_scope = false); bool statement(PTree::Node *&); //. if-statement: //. //. - `if` `(` condition `)` statement //. - `if` `(` condition `)` statement else statement bool if_statement(PTree::Node *&); //. switch-statement: //. //. - `switch` `(` condition `)` statement bool switch_statement(PTree::Node *&); //. while-statement: //. //. - `while` `(` condition `)` statement bool while_statement(PTree::Node *&); //. do-statement: //. //. - `do` statement `while` `(` condition `)` `;` bool do_statement(PTree::Node *&); bool for_statement(PTree::Node *&); //. try-block: //. //. - `try` compound-statement handler-seq //. //. handler-seq: //. //. - handler handler-seq [opt] //. //. handler: //. //. - `catch` `(` exception-declaration `)` compound-statement //. //. exception-declaration: //. //. - type-specifier-seq declarator //. - type-specifier-seq abstract-declarator //. - type-specifier-seq //. - `...` bool try_block(PTree::Node *&); bool expr_statement(PTree::Node *&); bool declaration_statement(PTree::Declaration *&); bool integral_decl_statement(PTree::Declaration *&, PTree::Encoding&, PTree::Node *, PTree::Node *, PTree::Node *); bool other_decl_statement(PTree::Declaration *&, PTree::Encoding&, PTree::Node *, PTree::Node *); bool maybe_typename_or_class_template(Token&); void skip_to(Token::Type token); private: bool more_var_name(); Lexer & my_lexer; int my_ruleset; SymbolFactory & my_symbols; //. Record whether the current scope is valid. //. This allows the parser to continue parsing even after //. it was unable to enter a scope (such as in a function definition //. with a qualified name that wasn't declared before). bool my_scope_is_valid; ErrorList my_errors; PTree::Node * my_comments; //. If true, `>` is interpreted as ther greater-than operator. //. If false, it marks the end of a template-id or template-parameter-list. bool my_gt_is_operator; bool my_in_template_decl; }; } #endif synopsis-0.12/src/Synopsis/SymbolFactory.hh0000664000076400007640000000537111104702314020412 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_SymbolFactory_hh_ #define Synopsis_SymbolFactory_hh_ #include #include namespace Synopsis { namespace SymbolLookup { class PrototypeScope; class TemplateParameterScope; } //. SymbolFactory populates a symbol table. class SymbolFactory { public: //. enum Language { NONE = 0x00, C99 = 0x01, CXX = 0x02}; //. Create a symbol lookup table for the given language. //. Right now only CXX is supported. SymbolFactory(Language = CXX); SymbolLookup::Scope *current_scope() { return my_scopes.top();} void enter_scope(PTree::NamespaceSpec const *); void enter_scope(PTree::ClassSpec const *); void enter_scope(PTree::Node const *); void enter_scope(PTree::FunctionDefinition const *); void enter_scope(PTree::TemplateDecl const *); void enter_scope(PTree::Block const *); void leave_scope(); void declare(PTree::Declaration const *); void declare(PTree::Typedef const *); //. declare the enumeration as a new TYPE as well as all the enumerators as CONST void declare(PTree::EnumSpec const *); //. declare the namespace as a new NAMESPACE void declare(PTree::NamespaceSpec const *); //. declare the class as a new TYPE void declare(PTree::ClassSpec const *); void declare(PTree::TemplateDecl const *); void declare(PTree::TypeParameter const *); void declare(PTree::UsingDirective const *); void declare(PTree::ParameterDeclaration const *); void declare(PTree::UsingDeclaration const *); private: typedef std::stack Scopes; //. Lookup the scope of a qualified name. //. The encoded name is modified in place to //. refer to the unqualified name. SymbolLookup::Scope *lookup_scope_of_qname(PTree::Encoding &, PTree::Node const *); Language my_language; Scopes my_scopes; //. When parsing a function definition the declarator is seen first, //. and thus a prototype is created to hold the parameters. //. Later, when the function definition proper is seen, the symbols //. are transfered and the prototype is deleted. SymbolLookup::PrototypeScope *my_prototype; //. When parsing a class or function template the template-parameter-list //. is seen first. Since ClassSpec and Declarator don't know they are part //. of a template declaration, we cache it here so it gets consumed when //. the Class or PrototypeScope are created. // FIXME: Should ClassSpec get a flag so it knows it's a template, similar // to Encodings helt in Declarators ? SymbolLookup::TemplateParameterScope *my_template_parameters; }; } #endif synopsis-0.12/src/Synopsis/SymbolLookup/0000775000076400007640000000000011172123233017727 5ustar stefanstefansynopsis-0.12/src/Synopsis/SymbolLookup/Symbol.cc0000664000076400007640000000221211104702322021475 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include using namespace Synopsis; using namespace PTree; using namespace SymbolLookup; Class *ClassName::as_scope() const { Scope *outer = scope(); Scope *nested = outer->find_scope(ptree()); return dynamic_cast(nested); } Class *ClassTemplateName::as_scope() const { Scope *outer = scope(); Scope *nested = outer->find_scope(ptree()); return dynamic_cast(nested); } FunctionScope *FunctionName::as_scope() const { Scope *outer = scope(); Scope *nested = outer->find_scope(ptree()); return dynamic_cast(nested); } FunctionScope *FunctionTemplateName::as_scope() const { Scope *outer = scope(); Scope *nested = outer->find_scope(ptree()); return dynamic_cast(nested); } Namespace *NamespaceName::as_scope() const { Scope *outer = scope(); Scope *nested = outer->find_scope(ptree()); return dynamic_cast(nested); } synopsis-0.12/src/Synopsis/SymbolLookup/Scopes.hh0000664000076400007640000001321011104702322021476 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_SymbolLookup_Scopes_hh_ #define Synopsis_SymbolLookup_Scopes_hh_ #include #include #include #include namespace Synopsis { namespace SymbolLookup { class TemplateParameterScope; class LocalScope; class PrototypeScope; class FunctionScope; class Class; class Namespace; //. A Visitor for Scopes. //. The default implementation does nothing, so //. users only need to implement the ones they need. class ScopeVisitor { public: virtual ~ScopeVisitor() {} virtual void visit(TemplateParameterScope *) {} virtual void visit(LocalScope *) {} virtual void visit(PrototypeScope *) {} virtual void visit(FunctionScope *) {} virtual void visit(Class *) {} virtual void visit(Namespace *) {} }; class TemplateParameterScope : public Scope { public: TemplateParameterScope(PTree::List const *node, Scope const *outer) : my_node(node), my_outer(outer->ref()) {} virtual SymbolSet unqualified_lookup(PTree::Encoding const &, LookupContext) const; virtual Scope const *outer_scope() const { return my_outer;} virtual void accept(ScopeVisitor *v) { v->visit(this);} protected: ~TemplateParameterScope() { my_outer->unref();} private: PTree::List const *my_node; Scope const *my_outer; }; class LocalScope : public Scope { public: LocalScope(PTree::List const *node, Scope const *outer) : my_node(node), my_outer(outer->ref()) {} virtual Scope const *outer_scope() const { return my_outer;} virtual SymbolSet unqualified_lookup(PTree::Encoding const &, LookupContext) const; virtual void accept(ScopeVisitor *v) { v->visit(this);} protected: ~LocalScope() { my_outer->unref();} private: PTree::List const *my_node; Scope const *my_outer; }; class FunctionScope : public Scope { public: FunctionScope(PTree::Declaration const *, PrototypeScope *, Scope const *); virtual void use(PTree::UsingDirective const *); virtual Scope const *outer_scope() const { return my_outer;} virtual SymbolSet unqualified_lookup(PTree::Encoding const &, LookupContext) const; virtual SymbolSet qualified_lookup(PTree::Encoding const &, LookupContext) const; // FIXME: what is 'name' ? (template parameters...) std::string name() const; virtual void accept(ScopeVisitor *v) { v->visit(this);} protected: ~FunctionScope() { my_outer->unref();} private: typedef std::set Using; PTree::Declaration const * my_decl; Scope const * my_outer; Class const * my_class; TemplateParameterScope const *my_parameters; Using my_using; }; class PrototypeScope : public Scope { friend class FunctionScope; public: PrototypeScope(PTree::Node const *decl, Scope const *outer, TemplateParameterScope const *params) : my_decl(decl), my_outer(outer->ref()), my_parameters(params) {} virtual Scope const *outer_scope() const { return my_outer;} virtual SymbolSet unqualified_lookup(PTree::Encoding const &, LookupContext) const; PTree::Node const *declaration() const { return my_decl;} TemplateParameterScope const *parameters() const { return my_parameters;} std::string name() const; virtual void accept(ScopeVisitor *v) { v->visit(this);} protected: ~PrototypeScope() { my_outer->unref();} private: PTree::Node const * my_decl; Scope const * my_outer; TemplateParameterScope const *my_parameters; }; class Class : public Scope { public: typedef std::vector Bases; Class(PTree::ClassSpec const *spec, Scope const *outer, Bases const &bases, TemplateParameterScope const *params) : my_spec(spec), my_outer(outer->ref()), my_bases(bases), my_parameters(params) { } virtual Scope const *outer_scope() const { return my_outer;} virtual SymbolSet unqualified_lookup(PTree::Encoding const &, LookupContext) const; // FIXME: what is 'name' ? (template parameters...) std::string name() const; virtual void accept(ScopeVisitor *v) { v->visit(this);} protected: ~Class() { my_outer->unref();} private: PTree::ClassSpec const *my_spec; Scope const *my_outer; Bases my_bases; TemplateParameterScope const *my_parameters; }; class Namespace : public Scope { public: Namespace(PTree::NamespaceSpec const *spec, Namespace const *outer) : my_spec(spec), my_outer(outer ? static_cast(outer->ref()) : 0) { } //. Find a nested namespace. Namespace *find_namespace(PTree::NamespaceSpec const *name) const; virtual void use(PTree::UsingDirective const *); virtual Scope const *outer_scope() const { return my_outer;} virtual SymbolSet unqualified_lookup(PTree::Encoding const &, LookupContext) const; virtual SymbolSet qualified_lookup(PTree::Encoding const &, LookupContext) const; // FIXME: should that really be a string ? It may be better to be conform with // Class::name, which, if the class is a template, can't be a string (or can it ?) std::string name() const; virtual void accept(ScopeVisitor *v) { v->visit(this);} protected: ~Namespace() { if (my_outer) my_outer->unref();} private: typedef std::set Using; SymbolSet unqualified_lookup(PTree::Encoding const &, LookupContext, Using &) const; SymbolSet qualified_lookup(PTree::Encoding const &, LookupContext, Using &) const; PTree::NamespaceSpec const *my_spec; Namespace const * my_outer; Using my_using; }; } } #endif synopsis-0.12/src/Synopsis/SymbolLookup/Scope.hh0000664000076400007640000001267111104702322021325 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_SymbolLookup_Scope_hh_ #define Synopsis_SymbolLookup_Scope_hh_ #include #include #include namespace Synopsis { namespace SymbolLookup { struct TypeError : std::exception { TypeError(PTree::Encoding const &n, PTree::Encoding const &t) : name(n), type(t) {} virtual ~TypeError() throw() {} virtual char const * what() const throw() { return "TypeError";} PTree::Encoding name; PTree::Encoding type; }; struct Undefined : std::exception { Undefined(PTree::Encoding const &n, PTree::Node const *ref = 0) : name(n), ptree(ref) {} virtual ~Undefined() throw() {} virtual char const * what() const throw() { return "Undefined";} PTree::Encoding name; PTree::Node const * ptree; }; struct MultiplyDefined : std::exception { MultiplyDefined(PTree::Encoding const &n, PTree::Node const *decl, PTree::Node const *orig) : name(n), declaration(decl), original(orig) {} virtual ~MultiplyDefined() throw() {} virtual char const * what() const throw() { return "MultiplyDefined";} PTree::Encoding name; PTree::Node const * declaration; PTree::Node const * original; }; class InternalError : public std::exception { public: InternalError(std::string const &what) : my_what(what) {} virtual ~InternalError() throw() {} virtual char const * what() const throw() { return my_what.c_str();} private: std::string my_what; }; typedef std::set SymbolSet; class ScopeVisitor; //. A Scope contains symbol definitions. class Scope { protected: //. SymbolTable provides a mapping from (encoded) names to Symbols declared //. in this scope. typedef std::multimap SymbolTable; //. ScopeTable provides a mapping from scope nodes to Scopes, //. which can be used to traverse the scope tree in parallel with //. the associated parse tree. As this traversal is also done //. during the parsing, the scopes can not be const. typedef std::map ScopeTable; public: typedef SymbolTable::const_iterator symbol_iterator; typedef ScopeTable::const_iterator scope_iterator; typedef unsigned int LookupContext; static LookupContext const DEFAULT = 0x0; static LookupContext const SCOPE = 0x1; // lookup a scope, see [basic.lookup.qual] static LookupContext const USING = 0x2; // lookup in the context of a using directive static LookupContext const ELABORATE = 0x4; // elaborate name lookup static LookupContext const DECLARATION = 0x8; // see 3.4.3.2/6 [namespace.qual] Scope() : my_refcount(1) {} Scope *ref() { ++my_refcount; return this;} Scope const *ref() const { ++my_refcount; return this;} void unref() const { if (!--my_refcount) delete this;} virtual Scope const *outer_scope() const = 0; Scope const *global_scope() const; virtual void accept(ScopeVisitor *v) = 0; symbol_iterator symbols_begin() const { return my_symbols.begin();} symbol_iterator symbols_end() const { return my_symbols.end();} scope_iterator scopes_begin() const { return my_scopes.begin();} scope_iterator scopes_end() const { return my_scopes.end();} //. declare the given symbol in the local scope //. using the given encoded name. void declare(PTree::Encoding const &name, Symbol const *symbol); //. declare a nested scope void declare_scope(PTree::Node const *, Scope *); //. declare a 'using' directive. //. The default implementation raises an exception, //. as it is only well-formed when the current scope //. is a function scope or a namespace. virtual void use(PTree::UsingDirective const *); //. find a nested scope by declaration Scope *find_scope(PTree::Node const *) const; //. find a nested scope by symbol. //. The encoded name is provided for diagnostic purposes only. Scope *find_scope(PTree::Encoding const &, Symbol const *) const; //. Remove the given nested scope from the scope. void remove_scope(PTree::Node const*); //. find a nested scope by name //Scope *find_scope(PTree::Encoding const &) const; //. find the encoded name declared in this scope and //. return a set of matching symbols. SymbolSet find(PTree::Encoding const &, LookupContext) const throw(); //. Remove the given symbol from the scope. //. s shall not be used after its removal. void remove(Symbol const *s); //. look up the encoded name and return a set of matching symbols. SymbolSet lookup(PTree::Encoding const &, LookupContext = DEFAULT) const; virtual SymbolSet unqualified_lookup(PTree::Encoding const &, LookupContext = DEFAULT) const = 0; virtual SymbolSet qualified_lookup(PTree::Encoding const &, LookupContext = DEFAULT) const; protected: //. Scopes are ref counted, and thus are deleted only by 'unref()' virtual ~Scope(); SymbolTable my_symbols; ScopeTable my_scopes; mutable size_t my_refcount; }; inline void Scope::declare_scope(PTree::Node const *node, Scope *scope) { my_scopes[node] = scope->ref(); } inline Scope *Scope::find_scope(PTree::Node const *node) const { ScopeTable::const_iterator i = my_scopes.find(node); return i == my_scopes.end() ? 0 : i->second; } inline Scope const *Scope::global_scope() const { Scope const *scope = this; while (Scope const *outer = scope->outer_scope()) scope = outer; return scope; } } } #endif synopsis-0.12/src/Synopsis/SymbolLookup/Scopes.cc0000664000076400007640000002374711104702322021504 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include #include #include using namespace Synopsis; using namespace PTree; using namespace SymbolLookup; SymbolSet TemplateParameterScope::unqualified_lookup(Encoding const &name, LookupContext context) const { Trace trace("TemplateParameterScope::unqualified_lookup", Trace::SYMBOLLOOKUP); trace << name; SymbolSet symbols = find(name, context == SCOPE); return symbols.size() ? symbols : my_outer->unqualified_lookup(name, context); } SymbolSet LocalScope::unqualified_lookup(Encoding const &name, LookupContext context) const { Trace trace("LocalScope::unqualified_lookup", Trace::SYMBOLLOOKUP); trace << name; SymbolSet symbols = find(name, context == SCOPE); return symbols.size() ? symbols : my_outer->unqualified_lookup(name, context); } FunctionScope::FunctionScope(PTree::Declaration const *decl, PrototypeScope *proto, Scope const *outer) : my_decl(decl), my_outer(outer->ref()), my_parameters(proto->parameters()) { for (SymbolTable::iterator i = proto->my_symbols.begin(); i != proto->my_symbols.end(); ++i) { Symbol const *symbol = i->second; my_symbols.insert(std::make_pair(i->first, new VariableName(symbol->type(), symbol->ptree(), true, this))); } proto->unref(); } void FunctionScope::use(PTree::UsingDirective const *udecl) { if (*PTree::second(udecl) == "namespace") // using.dir { PTree::Encoding name = PTree::third(udecl)->encoded_name(); SymbolSet symbols = lookup(name); // now get the namespace associated with that symbol: Symbol const *symbol = *symbols.begin(); // FIXME: may this symbol-to-scope conversion be implemented // by the appropriate Symbol subclass(es) ? Scope const *scope = symbol->scope()->find_scope(name, symbol); Namespace const *ns = dynamic_cast(scope); if (ns) my_using.insert(ns); } else { std::cout << "sorry, using declaration not supported yet" << std::endl; } } SymbolSet FunctionScope::unqualified_lookup(Encoding const &name, LookupContext context) const { Trace trace("FunctionScope::unqualified_lookup", Trace::SYMBOLLOOKUP); trace << name; SymbolSet symbols = find(name, context); if (my_parameters) { SymbolSet more = my_parameters->find(name, context); symbols.insert(more.begin(), more.end()); } if (symbols.size()) return symbols; // see 7.3.4 [namespace.udir] for (Using::const_iterator i = my_using.begin(); i != my_using.end(); ++i) { SymbolSet more = (*i)->unqualified_lookup(name, context | USING); symbols.insert(more.begin(), more.end()); } if (symbols.size() || !my_outer) return symbols; else return my_outer->unqualified_lookup(name, context); } std::string FunctionScope::name() const { std::ostringstream oss; oss << PTree::reify(PTree::third(my_decl)); return oss.str(); } SymbolSet FunctionScope::qualified_lookup(PTree::Encoding const &name, LookupContext context) const { Trace trace("FunctionScope::qualified_lookup", Trace::SYMBOLLOOKUP); trace << name; PTree::Encoding symbol_name = name.get_scope(); PTree::Encoding remainder = name.get_symbol(); if (symbol_name.empty()) { symbol_name = name; remainder.clear(); } // find symbol locally SymbolSet symbols = find(symbol_name, context); // see 7.3.4 [namespace.udir] if (symbols.empty()) for (Using::const_iterator i = my_using.begin(); i != my_using.end(); ++i) { SymbolSet more = (*i)->qualified_lookup(name, context); symbols.insert(more.begin(), more.end()); } if (symbols.empty()) return symbols; // nothing found // If the remainder is empty, just return the found symbol(s). else if (remainder.empty()) return symbols; // Having multiple symbols implies they are all overloaded functions. // That's a type error if the reminder is non-empty, as we are looking // for a scope. else if (symbols.size() > 1) throw TypeError(symbol_name, (*symbols.begin())->ptree()->encoded_type()); // Find the scope the symbol refers to // and look up the remainder there. // move into inner scope and start over the lookup Scope const *nested = find_scope(symbol_name, *symbols.begin()); if (!nested) throw InternalError("undeclared scope !"); return nested->qualified_lookup(remainder, context); } SymbolSet PrototypeScope::unqualified_lookup(PTree::Encoding const &, LookupContext) const { Trace trace("PrototypeScope::unqualified_lookup", Trace::SYMBOLLOOKUP); return SymbolSet(); } std::string PrototypeScope::name() const { std::ostringstream oss; oss << PTree::reify(my_decl); return oss.str(); } SymbolSet Class::unqualified_lookup(Encoding const &name, LookupContext context) const { Trace trace("Class::unqualified_lookup", Trace::SYMBOLLOOKUP); trace << name; SymbolSet symbols = find(name, context); for (Bases::const_iterator i = my_bases.begin(); i != my_bases.end(); ++i) { SymbolSet more = (*i)->find(name, context); symbols.insert(more.begin(), more.end()); } if (my_parameters) { SymbolSet more = my_parameters->find(name, context); symbols.insert(more.begin(), more.end()); } return symbols.size() ? symbols : my_outer->unqualified_lookup(name, context); } std::string Class::name() const { PTree::Node const *name_spec = PTree::second(my_spec); // FIXME: why is name_spec for anonumous classes 'list(0, 0)' ? // see Parser::class_spec()... if (name_spec && name_spec->is_atom()) return std::string(name_spec->position(), name_spec->length()); return ""; } Namespace *Namespace::find_namespace(PTree::NamespaceSpec const *spec) const { std::string name = ""; PTree::Node const *ns_name = PTree::second(spec); if (ns_name) name.assign(ns_name->position(), ns_name->length()); for (ScopeTable::const_iterator i = my_scopes.begin(); i != my_scopes.end(); ++i) { Namespace *ns = dynamic_cast(i->second); if (ns && name == ns->name()) return ns; } return 0; } void Namespace::use(PTree::UsingDirective const *udecl) { if (*PTree::second(udecl) == "namespace") // using.dir { PTree::Encoding name = PTree::third(udecl)->encoded_name(); SymbolSet symbols = lookup(name); // now get the namespace associated with that symbol: Symbol const *symbol = *symbols.begin(); // FIXME: may this symbol-to-scope conversion be implemented // by the appropriate Symbol subclass(es) ? Scope const *scope = symbol->scope()->find_scope(name, symbol); Namespace const *ns = dynamic_cast(scope); if (ns) my_using.insert(ns); } else { std::cout << "sorry, using declaration not supported yet" << std::endl; } } SymbolSet Namespace::unqualified_lookup(Encoding const &name, LookupContext context) const { Using searched; return unqualified_lookup(name, context, searched); } SymbolSet Namespace::qualified_lookup(PTree::Encoding const &name, LookupContext context) const { Using searched; return qualified_lookup(name, context, searched); } std::string Namespace::name() const { if (!my_spec) return ""; PTree::Node const *name_spec = PTree::second(my_spec); if (name_spec) return std::string(name_spec->position(), name_spec->length()); else return ""; } SymbolSet Namespace::unqualified_lookup(Encoding const &name, LookupContext context, Using &searched) const { Trace trace("Namespace::unqualified_lookup", Trace::SYMBOLLOOKUP, this->name()); trace << name; searched.insert(this); SymbolSet symbols = find(name, context); if (symbols.size()) return symbols; // see 7.3.4 [namespace.udir] for (Using::const_iterator i = my_using.begin(); i != my_using.end(); ++i) if (searched.find(*i) == searched.end()) { SymbolSet more = (*i)->unqualified_lookup(name, context | USING, searched); symbols.insert(more.begin(), more.end()); } if (symbols.size() || context & USING || !my_outer || searched.find(my_outer) != searched.end()) return symbols; else return my_outer->unqualified_lookup(name, context, searched); } SymbolSet Namespace::qualified_lookup(PTree::Encoding const &name, LookupContext context, Using &searched) const { Trace trace("Namespace::qualified_lookup", Trace::SYMBOLLOOKUP, this->name()); trace << name; PTree::Encoding symbol_name = name.get_scope(); PTree::Encoding remainder = name.get_symbol(); if (symbol_name.empty()) { symbol_name = name; remainder.clear(); } // find symbol locally SymbolSet symbols = find(symbol_name, context); // see 3.4.3.2/2 and 3.4.3.2/6 if (!symbols.size() && (context ^ DECLARATION || name.is_qualified())) for (Using::const_iterator i = my_using.begin(); i != my_using.end(); ++i) if (searched.find(*i) == searched.end()) { SymbolSet more = (*i)->qualified_lookup(name, context, searched); symbols.insert(more.begin(), more.end()); } if (symbols.empty()) return symbols; // nothing found // If the remainder is empty, just return the found symbol(s). else if (remainder.empty()) return symbols; // Having multiple symbols implies they are all overloaded functions. // That's a type error if the reminder is non-empty, as we are looking // for a scope. else if (symbols.size() > 1) throw TypeError(symbol_name, (*symbols.begin())->ptree()->encoded_type()); // Find the scope the symbol refers to // and look up the remainder there. // move into inner scope and start over the lookup Scope const *nested = find_scope(symbol_name, *symbols.begin()); if (!nested) throw InternalError("undeclared scope !"); return nested->qualified_lookup(remainder, context); } synopsis-0.12/src/Synopsis/SymbolLookup/Display.hh0000664000076400007640000000437211104702322021660 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_SymbolLookup_Display_hh_ #define Synopsis_SymbolLookup_Display_hh_ #include namespace Synopsis { namespace SymbolLookup { class SymbolDisplay : private SymbolVisitor { public: SymbolDisplay(std::ostream &os, size_t indent) : my_os(os), my_indent(indent, ' ') {} void display(PTree::Encoding const &, SymbolLookup::Symbol const *); private: std::ostream &prefix(std::string const &type) { return my_os << my_indent << type;} virtual void visit(SymbolLookup::Symbol const *); virtual void visit(SymbolLookup::VariableName const *); virtual void visit(SymbolLookup::ConstName const *); virtual void visit(SymbolLookup::TypeName const *); virtual void visit(SymbolLookup::TypedefName const *); virtual void visit(SymbolLookup::ClassName const *); virtual void visit(SymbolLookup::EnumName const *); virtual void visit(SymbolLookup::ClassTemplateName const *); virtual void visit(SymbolLookup::FunctionName const *); virtual void visit(SymbolLookup::FunctionTemplateName const *); virtual void visit(SymbolLookup::NamespaceName const *); std::ostream &my_os; std::string my_indent; std::string my_name; }; //. The ScopeDisplay class provides an annotated view of the symbol table, //. for debugging purposes. class ScopeDisplay : private SymbolLookup::ScopeVisitor { public: ScopeDisplay(std::ostream &os) : my_os(os), my_indent(0) {} virtual ~ScopeDisplay() {} void display(SymbolLookup::Scope const *s) { const_cast(s)->accept(this);} private: virtual void visit(SymbolLookup::TemplateParameterScope *); virtual void visit(SymbolLookup::LocalScope *); virtual void visit(SymbolLookup::PrototypeScope *); virtual void visit(SymbolLookup::FunctionScope *); virtual void visit(SymbolLookup::Class *); virtual void visit(SymbolLookup::Namespace *); void dump(SymbolLookup::Scope const *); std::ostream &indent(); std::ostream &my_os; size_t my_indent; }; inline void display(SymbolLookup::Scope const *s, std::ostream &os) { ScopeDisplay sd(os); sd.display(s); } } } #endif synopsis-0.12/src/Synopsis/SymbolLookup/Walker.cc0000664000076400007640000001142111104702322021457 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include #include #include using namespace Synopsis; using namespace SymbolLookup; Walker::Walker(Scope *scope) { Trace trace("Walker::Walker", Trace::SYMBOLLOOKUP); my_scopes.push(scope->ref()); } Walker::~Walker() { Trace trace("Walker::~Walker", Trace::SYMBOLLOOKUP); Scope *scope = my_scopes.top(); scope->unref(); my_scopes.pop(); } void Walker::visit(PTree::List *node) { Trace trace("Walker::visit(List)", Trace::SYMBOLLOOKUP); if (node->car()) node->car()->accept(this); if (node->cdr()) node->cdr()->accept(this); } void Walker::visit(PTree::Block *node) { Trace trace("Walker::visit(Block)", Trace::SYMBOLLOOKUP); Scope *scope = my_scopes.top()->find_scope(node); if (!scope) { // Not all Blocks represent a scope... visit_block(node); } else { scope->ref(); my_scopes.push(scope); visit_block(node); leave_scope(); } } void Walker::visit(PTree::TemplateDecl *tdecl) { Trace trace("Walker::visit(TemplateDecl)", Trace::SYMBOLLOOKUP); traverse_parameters(tdecl); // If we are in a template template parameter, the following // is just the 'class' keyword. // Else it is a Declaration, which we want to traverse. PTree::Node *decl = PTree::nth(tdecl, 4); if (!decl->is_atom()) decl->accept(this); else { std::cout << "length " << PTree::length(tdecl) << std::endl; } } void Walker::visit(PTree::NamespaceSpec *spec) { Trace trace("Walker::visit(NamespaceSpec)", Trace::SYMBOLLOOKUP); traverse_body(spec); } void Walker::visit(PTree::FunctionDefinition *def) { Trace trace("Walker::visit(FunctionDefinition)", Trace::SYMBOLLOOKUP); PTree::Node *decl = PTree::third(def); visit(static_cast(decl)); // visit the declarator traverse_body(def); } void Walker::visit(PTree::ClassSpec *spec) { Trace trace("Walker::visit(ClassSpec)", Trace::SYMBOLLOOKUP); traverse_body(spec); } void Walker::visit(PTree::DotMemberExpr *) { Trace trace("Walker::visit(DotMemberExpr)", Trace::SYMBOLLOOKUP); std::cout << "Sorry: dot member expression (.) not yet supported" << std::endl; } void Walker::visit(PTree::ArrowMemberExpr *) { Trace trace("Walker::visit(ArrowMemberExpr)", Trace::SYMBOLLOOKUP); std::cout << "Sorry: arrow member expression (->) not yet supported" << std::endl; } void Walker::traverse_body(PTree::NamespaceSpec *spec) { Trace trace("Walker::traverse_body(NamespaceSpec)", Trace::SYMBOLLOOKUP); Scope *scope = my_scopes.top()->find_scope(spec); assert(scope); scope->ref(); my_scopes.push(scope); PTree::tail(spec, 2)->car()->accept(this); leave_scope(); } void Walker::traverse_body(PTree::ClassSpec *spec) { Trace trace("Walker::traverse_body(ClassSpec)", Trace::SYMBOLLOOKUP); if (PTree::ClassBody *body = spec->body()) { Scope *scope = my_scopes.top()->find_scope(spec); assert(scope); scope->ref(); my_scopes.push(scope); body->accept(this); leave_scope(); } } void Walker::traverse_parameters(PTree::TemplateDecl *decl) { Trace trace("Walker::traverse_body(TemplateDecl)", Trace::SYMBOLLOOKUP); Scope *scope = my_scopes.top()->find_scope(decl); scope->ref(); my_scopes.push(scope); // list of template parameters (TypeParameter or ParameterDeclaration) PTree::third(decl)->accept(this); leave_scope(); } void Walker::traverse_body(PTree::FunctionDefinition *def) { Trace trace("Walker::traverse_body(FunctionDefinition)", Trace::SYMBOLLOOKUP); PTree::Node *decl = PTree::third(def); Scope *scope = my_scopes.top(); PTree::Encoding name = decl->encoded_name(); if (name.is_qualified()) { SymbolSet symbols = scope->lookup(name, Scope::DECLARATION); assert(!symbols.empty()); // FIXME: We need type analysis / overload resolution // here to take the right symbol / scope. FunctionName const *symbol = dynamic_cast(*symbols.begin()); assert(symbol); scope = symbol->as_scope(); } else scope = my_scopes.top()->find_scope(def); assert(scope); scope->ref(); my_scopes.push(scope); visit_block(static_cast(PTree::nth(def, 3))); leave_scope(); } void Walker::visit_block(PTree::Block *node) { Trace trace("Walker::visit_block(Block)", Trace::SYMBOLLOOKUP); visit(static_cast(node)); } void Walker::leave_scope() { Trace trace("Walker::leave_scope", Trace::SYMBOLLOOKUP); Scope *top = my_scopes.top(); my_scopes.pop(); top->unref(); } synopsis-0.12/src/Synopsis/SymbolLookup/Symbol.hh0000664000076400007640000001253111104702322021514 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_SymbolLookup_Symbol_hh_ #define Synopsis_SymbolLookup_Symbol_hh_ #include #include namespace Synopsis { namespace SymbolLookup { class Symbol; class VariableName; class ConstName; class TypeName; class TypedefName; class ClassName; class EnumName; class ClassTemplateName; class FunctionName; class FunctionTemplateName; class NamespaceName; class SymbolVisitor { public: virtual ~SymbolVisitor() {} virtual void visit(Symbol const *) = 0; virtual void visit(VariableName const *) = 0; virtual void visit(ConstName const *) = 0; virtual void visit(TypeName const *) = 0; virtual void visit(TypedefName const *) = 0; virtual void visit(ClassName const *) = 0; virtual void visit(EnumName const *) = 0; virtual void visit(ClassTemplateName const *) = 0; virtual void visit(FunctionName const *) = 0; virtual void visit(FunctionTemplateName const *) = 0; virtual void visit(NamespaceName const *) = 0; }; class Scope; class Class; class Namespace; class FunctionScope; class Symbol { public: Symbol(PTree::Encoding const &t, PTree::Node const *p, bool def, Scope *s) : my_type(t), my_ptree(p), my_definition(def), my_scope(s) {} virtual ~Symbol(){} virtual void accept(SymbolVisitor *v) const { v->visit(this);} PTree::Encoding const & type() const { return my_type;} PTree::Node const * ptree() const { return my_ptree;} bool is_definition() const { return my_definition;} Scope * scope() const { return my_scope;} private: PTree::Encoding my_type; PTree::Node const * my_ptree; bool my_definition; Scope * my_scope; }; class VariableName : public Symbol { public: VariableName(PTree::Encoding const &type, PTree::Node const *ptree, bool def, Scope *s) : Symbol(type, ptree, def, s) {} virtual void accept(SymbolVisitor *v) const { v->visit(this);} }; class ConstName : public VariableName { public: ConstName(PTree::Encoding const &type, long v, PTree::Node const *ptree, bool def, Scope *s) : VariableName(type, ptree, def, s), my_defined(true), my_value(v) {} ConstName(PTree::Encoding const &type, PTree::Node const *ptree, bool def, Scope *s) : VariableName(type, ptree, def, s), my_defined(false) {} virtual void accept(SymbolVisitor *v) const { v->visit(this);} bool defined() const { return my_defined;} long value() const { return my_value;} private: bool my_defined; long my_value; }; class TypeName : public Symbol { public: TypeName(PTree::Encoding const &type, PTree::Node const *ptree, bool def, Scope *s) : Symbol(type, ptree, def, s) {} virtual void accept(SymbolVisitor *v) const { v->visit(this);} }; class TypedefName : public TypeName { public: TypedefName(PTree::Encoding const &type, PTree::Node const *ptree, Scope *scope) : TypeName(type, ptree, false, scope) {} virtual void accept(SymbolVisitor *v) const { v->visit(this);} }; class ClassName : public TypeName { public: ClassName(PTree::Encoding const &type, PTree::Node const *ptree, bool def, Scope *s) : TypeName(type, ptree, def, s) {} virtual void accept(SymbolVisitor *v) const { v->visit(this);} //. Return the class scope associated with this symbol. //. This will return 0 if the class definition hasn't been seen yet. Class *as_scope() const; }; class EnumName : public TypeName { public: EnumName(PTree::Encoding const &type, PTree::Node const *ptree, Scope *scope) : TypeName(type, ptree, true, scope) {} virtual void accept(SymbolVisitor *v) const { v->visit(this);} }; class ClassTemplateName : public Symbol { public: ClassTemplateName(PTree::Encoding const &type, PTree::Node const *ptree, bool def, Scope *s) : Symbol(type, ptree, def, s) {} virtual void accept(SymbolVisitor *v) const { v->visit(this);} //. Return the class scope associated with this symbol. //. This will return 0 if the class definition hasn't been seen yet. Class *as_scope() const; }; class FunctionName : public Symbol { public: FunctionName(PTree::Encoding const &type, PTree::Node const *ptree, bool def, Scope *s) : Symbol(type, ptree, def, s) {} virtual void accept(SymbolVisitor *v) const { v->visit(this);} //. Return the function scope associated with this symbol. //. This will return 0 if the function definition hasn't been seen yet. FunctionScope *as_scope() const; }; class FunctionTemplateName : public Symbol { public: FunctionTemplateName(PTree::Encoding const &type, PTree::Node const *ptree, Scope *s) : Symbol(type, ptree, true, s) {} virtual void accept(SymbolVisitor *v) const { v->visit(this);} //. Return the function scope associated with this symbol. //. This will return 0 if the function definition hasn't been seen yet. FunctionScope *as_scope() const; }; class NamespaceName : public Symbol { public: NamespaceName(PTree::Encoding const &type, PTree::Node const *ptree, bool def, Scope *s) : Symbol(type, ptree, def, s) {} virtual void accept(SymbolVisitor *v) const { v->visit(this);} //. Return the namespace scope associated with this symbol. //. This will return 0 if the namespace definition hasn't been seen yet. Namespace *as_scope() const; }; } } #endif synopsis-0.12/src/Synopsis/SymbolLookup/Walker.hh0000664000076400007640000000353611104702322021501 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_SymbolLookup_Walker_hh_ #define Synopsis_SymbolLookup_Walker_hh_ #include #include #include namespace Synopsis { namespace SymbolLookup { //. This Walker adjusts the symbol lookup table while the parse tree //. is being traversed such that symbols in the parse tree can be //. looked up correctly in the right context. class Walker : public PTree::Visitor { public: Walker(Scope *); virtual ~Walker(); using PTree::Visitor::visit; virtual void visit(PTree::List *); virtual void visit(PTree::Block *); virtual void visit(PTree::TemplateDecl *); virtual void visit(PTree::NamespaceSpec *); virtual void visit(PTree::FunctionDefinition *); virtual void visit(PTree::ClassSpec *); virtual void visit(PTree::DotMemberExpr *); virtual void visit(PTree::ArrowMemberExpr *); //. Traverse the body of a namespace definition. void traverse_body(PTree::NamespaceSpec *); //. Traverse the body of the class definition. void traverse_body(PTree::ClassSpec *); //. Traverse the template parameter list of a template declaration. void traverse_parameters(PTree::TemplateDecl *); //. Traverse the body of the function definition. void traverse_body(PTree::FunctionDefinition *); protected: Scope const *current_scope() { return my_scopes.top();} void leave_scope(); private: typedef std::stack Scopes; //. the virtual visit(Block) version above does scoping, //. which isn't what we want if traversing a function (FIXME: or is it ?) //. so the following factors out the common code. void visit_block(PTree::Block *); //. The symbol lookup table. Scopes my_scopes; }; } } #endif synopsis-0.12/src/Synopsis/SymbolLookup/Display.cc0000664000076400007640000000636111104702322021646 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include "Display.hh" using namespace Synopsis; using namespace SymbolLookup; void SymbolDisplay::display(PTree::Encoding const &name, SymbolLookup::Symbol const *symbol) { my_name = name.unmangled(); symbol->accept(this); my_os << std::endl; } void SymbolDisplay::visit(SymbolLookup::Symbol const *) {} void SymbolDisplay::visit(SymbolLookup::VariableName const *name) { prefix("Variable: ") << my_name << ' ' << name->type().unmangled(); } void SymbolDisplay::visit(SymbolLookup::ConstName const *name) { prefix("Const: ") << my_name << ' ' << name->type().unmangled(); if (name->defined()) my_os << " (" << name->value() << ')'; } void SymbolDisplay::visit(SymbolLookup::TypeName const *name) { prefix("Type: ") << my_name << ' ' << name->type().unmangled(); } void SymbolDisplay::visit(SymbolLookup::TypedefName const *name) { prefix("Typedef: ") << my_name << ' ' << name->type().unmangled(); } void SymbolDisplay::visit(SymbolLookup::ClassName const *name) { prefix("Class: ") << my_name << ' ' << name->type().unmangled(); } void SymbolDisplay::visit(SymbolLookup::EnumName const *name) { prefix("Enum: ") << my_name << ' ' << name->type().unmangled(); } void SymbolDisplay::visit(SymbolLookup::ClassTemplateName const *name) { prefix("Class template: ") << my_name << ' ' << name->type().unmangled(); } void SymbolDisplay::visit(SymbolLookup::FunctionName const *name) { prefix("Function: ") << my_name << ' ' << name->type().unmangled(); } void SymbolDisplay::visit(SymbolLookup::FunctionTemplateName const *name) { prefix("Function template: ") << my_name << ' ' << name->type().unmangled(); } void SymbolDisplay::visit(SymbolLookup::NamespaceName const *name) { prefix("Namespace: ") << my_name << ' ' << name->type().unmangled(); } void ScopeDisplay::visit(SymbolLookup::TemplateParameterScope *s) { indent() << "TemplateParameterScope:\n"; dump(s); } void ScopeDisplay::visit(SymbolLookup::LocalScope *s) { indent() << "LocalScope:\n"; dump(s); } void ScopeDisplay::visit(SymbolLookup::PrototypeScope *s) { indent() << "PrototypeScope '" << s->name() << "':\n"; dump(s); } void ScopeDisplay::visit(SymbolLookup::FunctionScope *s) { indent() << "FunctionScope '" << s->name() << "':\n"; dump(s); } void ScopeDisplay::visit(SymbolLookup::Class *s) { indent() << "Class '" << s->name() << "':\n"; dump(s); } void ScopeDisplay::visit(SymbolLookup::Namespace *s) { indent() << "Namespace '" << s->name() << "':\n"; dump(s); } void ScopeDisplay::dump(SymbolLookup::Scope const *s) { ++my_indent; for (SymbolLookup::Scope::symbol_iterator i = s->symbols_begin(); i != s->symbols_end(); ++i) { SymbolDisplay display(my_os, my_indent); display.display(i->first, i->second); } for (SymbolLookup::Scope::scope_iterator i = s->scopes_begin(); i != s->scopes_end(); ++i) i->second->accept(this); --my_indent; } std::ostream &ScopeDisplay::indent() { size_t i = my_indent; while (i--) my_os.put(' '); return my_os; } synopsis-0.12/src/Synopsis/SymbolLookup/Scope.cc0000664000076400007640000001363311104702322021312 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include #include using namespace Synopsis; using namespace PTree; using namespace SymbolLookup; Scope::~Scope() { } void Scope::declare(Encoding const &name, Symbol const *symbol) { Trace trace("Scope::declare", Trace::SYMBOLLOOKUP); trace << name; my_symbols.insert(std::make_pair(name, symbol)); } void Scope::use(PTree::UsingDirective const *) { throw InternalError("Invalid use of using directive in this scope."); } Scope *Scope::find_scope(PTree::Encoding const &name, Symbol const *symbol) const { PTree::Node const *decl = 0; if (NamespaceName const *ns = dynamic_cast(symbol)) decl = ns->ptree(); else if (TypeName const *tn = dynamic_cast(symbol)) { decl = tn->ptree(); // test that 'decl' is a ClassSpec } // TODO: test for ClassTemplateName ... if (!decl) { // the symbol was found but doesn't refer to a scope std::cerr << name << " neither refers to a namespace nor a type" << std::endl; throw TypeError(name, symbol->ptree()->encoded_type()); } return find_scope(decl); } void Scope::remove_scope(PTree::Node const *decl) { ScopeTable::iterator i = my_scopes.find(decl); if (i == my_scopes.end()) throw InternalError("Attempt to remove unknown scope !"); my_scopes.erase(i); } SymbolSet Scope::find(Encoding const &name, LookupContext context) const throw() { Trace trace("Scope::find", Trace::SYMBOLLOOKUP); trace << name; SymbolTable::const_iterator l = my_symbols.lower_bound(name); SymbolTable::const_iterator u = my_symbols.upper_bound(name); SymbolSet symbols; // [basic.lookup.qual] // During the lookup for a name preceding the :: scope resolution operator, // object, function, and enumerator names are ignored. if (context & SCOPE) for (; l != u; ++l) { if ((!dynamic_cast(l->second)) && (!dynamic_cast(l->second))) symbols.insert(l->second); } // [basic.lookup.elab] else if (context & ELABORATE) for (; l != u; ++l) { if ((dynamic_cast(l->second)) || (dynamic_cast(l->second))) symbols.insert(l->second); } // [basic.scope.hiding] else { // There is at most one type-name, which needs to be // hidden if any other symbol was found. TypeName const *type_name = 0; for (; l != u; ++l) { TypeName const *type = dynamic_cast(l->second); if (!type) symbols.insert(l->second); else type_name = type; } if (!symbols.size() && type_name) symbols.insert(type_name); } return symbols; } void Scope::remove(Symbol const *symbol) { Trace trace("Scope::remove", Trace::SYMBOLLOOKUP); for (SymbolTable::iterator i = my_symbols.begin(); i != my_symbols.end(); ++i) if (i->second == symbol) { my_symbols.erase(i); delete symbol; return; } // FIXME: Calling 'remove' with an unknown symbol is an error. // Should we throw here ? } SymbolSet Scope::lookup(PTree::Encoding const &name, LookupContext context) const { Trace trace("Scope::lookup", Trace::SYMBOLLOOKUP); trace << name; // If the name is not qualified, start an unqualified lookup. if (!name.is_qualified()) return unqualified_lookup(name, context); PTree::Encoding symbol_name = name.get_scope(); PTree::Encoding remainder = name.get_symbol(); // If the scope is the global scope, do a qualified lookup there. if (symbol_name.is_global_scope()) return global_scope()->qualified_lookup(remainder, context); // Else do an unqualified lookup for the scope, followed by a // qualified lookup of the remainder in that scope. SymbolSet symbols = unqualified_lookup(symbol_name, context | SCOPE); if (symbols.empty()) throw Undefined(symbol_name); else if (symbols.size() > 1) // If the name was found multiple times, it must refer to a function, // so throw a TypeError. throw TypeError(symbol_name, (*symbols.begin())->ptree()->encoded_type()); // As scopes contain a table of nested scopes, accessible through their respective // declaration objects, we find the scope using the symbol's declaration as key // within its scope. Symbol const *symbol = *symbols.begin(); Scope const *scope = symbol->scope()->find_scope(symbol->ptree()); if (!scope) throw InternalError("undeclared scope !"); // Now do a qualified lookup of the remainder in the given scope. return scope->qualified_lookup(remainder, context); } SymbolSet Scope::qualified_lookup(PTree::Encoding const &name, LookupContext context) const { Trace trace("Scope::qualified_lookup", Trace::SYMBOLLOOKUP); trace << name; PTree::Encoding symbol_name = name.get_scope(); PTree::Encoding remainder = name.get_symbol(); if (symbol_name.empty()) { symbol_name = name; remainder.clear(); } // find symbol locally SymbolSet symbols = find(symbol_name, context); if (symbols.empty()) return symbols; // nothing found // If the remainder is empty, just return the found symbol(s). else if (remainder.empty()) return symbols; // Having multiple symbols implies they are all overloaded functions. // That's a type error if the reminder is non-empty, as we are looking // for a scope. else if (symbols.size() > 1) throw TypeError(symbol_name, (*symbols.begin())->ptree()->encoded_type()); // Find the scope the symbol refers to // and look up the remainder there. // move into inner scope and start over the lookup Scope const *nested = find_scope(symbol_name, *symbols.begin()); if (!nested) throw InternalError("undeclared scope !"); return nested->qualified_lookup(remainder, context); } synopsis-0.12/src/Synopsis/Buffer.hh0000664000076400007640000000563211104702314017026 0ustar stefanstefan// // Copyright (C) 1997-2000 Shigeru Chiba // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_Buffer_hh_ #define Synopsis_Buffer_hh_ #include #include namespace Synopsis { //. Buffer holds the memory on top of which a parse tree / syntax tree is //. constructed. Besides giving access to individual characters, it provides //. the means to register replacements for buffer chunks, such that when //. the Buffer's write method is executed the new file will contain the //. modified source. class Buffer { public: Buffer(std::streambuf *, const std::string & = std::string("unknown")); //. return the size of the buffer unsigned long size() const { return my_buffer.size();} //. report the character at the current position and advance one character char get() { return my_cursor < my_buffer.size() ? my_buffer[my_cursor++] : '\0';} //. undo the last get void unget() { --my_cursor;} //. reset the current position to position c void reset(unsigned long c = 0) { my_cursor = c;} //. report the current position unsigned long position() const { return my_cursor - 1;} //. report the character at position p char at(unsigned long p) const { return my_buffer[p];} //. report the pointer at position p const char *ptr(unsigned long p = 0) const { return my_buffer.c_str() + p;} //. replace the text between from and to by the text between //. begin and begin + length void replace(const char *from, const char *to, const char *begin, unsigned long length); //. Return the origin of the given pointer (filename and line number) unsigned long origin(const char *, std::string &) const; //. Write the buffer into the given output stream //. The first line contains a line directive issuing the input file name; //. if filename is non-empty, use this to fake another one. void write(std::ostream &, const std::string &) const; private: struct Replacement { Replacement(const char *from, const char *to, const char *begin, unsigned long length); static bool smaller(Replacement const &r1, Replacement const &r2) { return r1.from < r2.from;} const char *from; const char *to; const char *begin; unsigned long length; }; typedef std::vector Replacements; //. read a line directive starting at position pos, and return //. the line number found. Also report the begin and end of the filename //. (with respect to the internal buffer). //. line is the default line number that gets reported on error (in //. which case begin and end remain unchanged) long read_line_directive(unsigned long cursor, long line, unsigned long &begin, unsigned long &end) const; std::string my_filename; std::string my_buffer; unsigned long my_cursor; Replacements my_replacements; }; } #endif synopsis-0.12/src/Synopsis/TypeAnalysis/0000775000076400007640000000000011172123233017715 5ustar stefanstefansynopsis-0.12/src/Synopsis/TypeAnalysis/ConstEvaluator.hh0000664000076400007640000000276111104702314023213 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_TypeAnalysis_ConstEvaluator_hh_ #define Synopsis_TypeAnalysis_ConstEvaluator_hh_ #include #include #include #include #include namespace Synopsis { namespace TypeAnalysis { //. Evaluate the value of a constant expression. class ConstEvaluator : private PTree::Visitor { public: ConstEvaluator(SymbolLookup::Scope const *s) : my_valid(false), my_scope(s) {} bool evaluate(PTree::Node const *node, long &value); private: virtual void visit(PTree::Literal *); virtual void visit(PTree::Identifier *); virtual void visit(PTree::FstyleCastExpr *); virtual void visit(PTree::InfixExpr *); virtual void visit(PTree::SizeofExpr *); virtual void visit(PTree::UnaryExpr *); virtual void visit(PTree::CondExpr *); virtual void visit(PTree::ParenExpr *); bool my_valid; long my_value; SymbolLookup::Scope const *my_scope; }; //. Evaluate the value of a constant expression. //. TODO: This may also return the type of the expression... inline bool evaluate_const(SymbolLookup::Scope const *scope, PTree::Node const *node, long &value) { if (!node) return false; ConstEvaluator e(scope); return e.evaluate(node, value); } } } #endif synopsis-0.12/src/Synopsis/TypeAnalysis/Visitor.hh0000664000076400007640000000173411104702314021700 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_TypeAnalysis_Visitor_hh_ #define Synopsis_TypeAnalysis_Visitor_hh_ namespace Synopsis { namespace TypeAnalysis { class Type; class BuiltinType; class Enum; class Class; class Union; class CVType; class Pointer; class Reference; class Array; class Function; class PointerToMember; class Visitor { public: virtual ~Visitor() {} // FIXME: may these use const arguments ? virtual void visit(Type *) = 0; virtual void visit(BuiltinType *) = 0; virtual void visit(Enum *) = 0; virtual void visit(Class *) = 0; virtual void visit(Union *) = 0; virtual void visit(CVType *) = 0; virtual void visit(Pointer *) = 0; virtual void visit(Reference *) = 0; virtual void visit(Array *) = 0; virtual void visit(Function *) = 0; virtual void visit(PointerToMember *) = 0; }; } } #endif synopsis-0.12/src/Synopsis/TypeAnalysis/Kit.hh0000664000076400007640000000146411104702314020770 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_TypeAnalysis_Kit_hh_ #define Synopsis_TypeAnalysis_Kit_hh_ #include namespace Synopsis { namespace TypeAnalysis { //. creates and remembers declared types. class Kit { public: Kit(); Type const *builtin(std::string const &name); Type const *enum_(std::string const &name); Type const *class_(std::string const &name); Type const *union_(std::string const &name); Type const *pointer(Type const *type); Type const *reference(Type const *type); Type const *array(Type const *type); Type const *pointer_to_member(Type const *container, Type const *member); private: }; } } #endif synopsis-0.12/src/Synopsis/TypeAnalysis/TypeEvaluator.cc0000664000076400007640000001664011104702314023035 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include "TypeEvaluator.hh" #include #include using namespace Synopsis; using namespace PTree; using namespace TypeAnalysis; namespace { std::string const TRUE = "true"; std::string const FALSE = "false"; Type const *numeric_type(char const *position, size_t length) { // TODO: If there is no explicit specifier for signedness or long, // simply assume 'int'. Implement 2.13.1 [lex.icon] if (length > 2 && *position == '0' && (*(position + 1) == 'x' || *(position + 1) == 'X')) // hexadecimal literal return &UINT; else if (length > 1 && *position == '0' && *(position + 1) != '.') // octal literal return &UINT; else if (TRUE.compare(0, 4, position, length) == 0 || FALSE.compare(0, 5, position, length) == 0) return &BOOL; char const *c = position; for (size_t i = 0; i != length; ++i, ++c) { if (*c == '.' || *c == 'E' || *c == 'e') // floating-point literal return (*(position + length - 1) == 'l' || *(position + length - 1) == 'L' ? &DOUBLE : &FLOAT); } // integral literal if (*(position + length - 1) == 'l' || *(position + length - 1) == 'L') return (*(position + length - 2) == 'u' || *(position + length - 2) == 'U' ? &ULONG : &LONG); return (*(position + length - 1) == 'u' || *(position + length - 1) == 'U' ? &UINT : &INT); } } Type const *TypeEvaluator::evaluate(Node const *node) { my_type = 0; if (node) const_cast(node)->accept(this); return my_type; } void TypeEvaluator::visit(Literal *node) { switch (node->type()) { case Token::CharConst: my_type = &CHAR; break; case Token::WideCharConst: my_type = &WCHAR; break; case Token::StringL: my_type = new Pointer(new CVType(&CHAR, CVType::CONST)); break; case Token::WideStringL: my_type = new Pointer(new CVType(&WCHAR, CVType::CONST)); break; case Token::Constant: my_type = numeric_type(node->position(), node->length()); break; default: std::cerr << "unmatched type for literal " << std::string(node->position(), node->length()) << ' ' << node->type() << std::endl; my_type = &CHAR; break; } } void TypeEvaluator::visit(Identifier *node) { Encoding name = Encoding::simple_name(node); SymbolLookup::SymbolSet symbols = my_scope->lookup(name); if (symbols.size() == 1) { // Symbol const *symbol = *symbols.begin(); // VariableName const *variable = dynamic_cast(symbol); // if (variable) my_type.set(variable->type(), variable->scope()); // else throw TypeError(name, symbol->ptree()->encoded_type()); } else { // ??? } } void TypeEvaluator::visit(PTree::Kwd::This *) { // FIXME: TBD // * find the current scope (object) // * find its type } void TypeEvaluator::visit(PTree::Name *node) { // SymbolSet symbols = my_scope->lookup(node->encoded_name()); // if (symbols.size() == 1) // { // Symbol const *symbol = *symbols.begin(); // VariableName const *variable = dynamic_cast(symbol); // if (variable) my_type.set(variable->type(), variable->scope()); // else throw TypeError(node->encoded_name(), symbol->ptree()->encoded_type()); // } // else { // ??? } } void TypeEvaluator::visit(PTree::FstyleCastExpr *node) { // my_type.set(node->encoded_type(), my_scope); } void TypeEvaluator::visit(PTree::AssignExpr *node) { PTree::first(node)->accept(this); } void TypeEvaluator::visit(CondExpr *node) { my_type = &BOOL; // type_of(PTree::third(node)); } void TypeEvaluator::visit(InfixExpr *node) { Type const *lhs = evaluate(first(node)); Type const *rhs = evaluate(third(node)); Node *op = second(node); assert(op->is_atom() && op->length() <= 2); // FIXME: TBD // my_type = lhs; /* if (op->length() == 1) switch (*op->position()) { case '+': my_value = left + right; break; case '-': my_value = left - right; break; case '>': my_value = left > right; break; case '<': my_value = left < right; break; case '&': my_value = left & right; break; case '|': my_value = left | right; break; case '^': my_value = left ^ right; break; case '*': my_value = left * right; break; case '/': my_value = left / right; break; case '%': my_value = left % right; break; default: my_valid = false; break; } else if (*op->position() == '=' && op->position()[1] == '=') my_value = left == right; else if (*op->position() == '!' && op->position()[1] == '=') my_value = left != right; else if (*op->position() == '<' && op->position()[1] == '<') my_value = left << right; else if (*op->position() == '>' && op->position()[1] == '>') my_value = left >> right; else if (*op->position() == '&' && op->position()[1] == '&') my_value = left && right; else if (*op->position() == '|' && op->position()[1] == '|') my_value = left || right; else my_valid = false; */ } void TypeEvaluator::visit(PTree::PmExpr *node) { PTree::third(node)->accept(this); // my_type.dereference(); } void TypeEvaluator::visit(PTree::CastExpr *node) { // my_type.set(PTree::second(PTree::second(node))->encoded_type(), my_scope); } void TypeEvaluator::visit(PTree::UnaryExpr *node) { PTree::second(node)->accept(this); PTree::Node *op = PTree::first(node); // if(*op == '*') my_type.dereference(); // else if(*op == '&') my_type.reference(); } void TypeEvaluator::visit(PTree::ThrowExpr *) { // my_type.set_void(); } void TypeEvaluator::visit(SizeofExpr *) { // my_type.set_int(); } void TypeEvaluator::visit(PTree::TypeidExpr *) { // FIXME: Should be type (node->third()->second()->encoded_type(), my_scope); // my_type.set_int(); } void TypeEvaluator::visit(PTree::TypeofExpr *) { // FIXME: Should be type (node->third()->second()->encoded_type(), my_scope); // my_type.set_int(); } void TypeEvaluator::visit(PTree::NewExpr *node) { PTree::Node *p = node; PTree::Node *userkey = p->car(); if(!userkey || !userkey->is_atom()) p = node->cdr(); // user keyword if(*p->car() == "::") p = p->cdr(); PTree::Node *type = PTree::third(p); // if(*type->car() == '(') // my_type.set(PTree::second(PTree::second(type))->encoded_type(), my_scope); // else // my_type.set(PTree::second(type)->encoded_type(), my_scope); // my_type.reference(); } void TypeEvaluator::visit(PTree::DeleteExpr *) { // my_type.set_void(); } void TypeEvaluator::visit(PTree::ArrayExpr *node) { node->car()->accept(this); // my_type.dereference(); } void TypeEvaluator::visit(PTree::FuncallExpr *node) { node->car()->accept(this); // if(!my_type.is_function()) // my_type.dereference(); // maybe a pointer to a function // my_type.dereference(); } void TypeEvaluator::visit(PTree::PostfixExpr *node) { node->car()->accept(this); } void TypeEvaluator::visit(PTree::DotMemberExpr *node) { node->car()->accept(this); // my_type.set_member(PTree::third(node)); } void TypeEvaluator::visit(PTree::ArrowMemberExpr *node) { node->car()->accept(this); // my_type.dereference(); // my_type.set_member(PTree::third(node)); } void TypeEvaluator::visit(ParenExpr *node) { Node *body = second(node); // if (!body) my_type.set("v"); // else body->accept(this); } synopsis-0.12/src/Synopsis/TypeAnalysis/Type.cc0000664000076400007640000000152611104702314021147 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include "Type.hh" namespace Synopsis { namespace TypeAnalysis { BuiltinType BOOL("bool"); BuiltinType CHAR("char"); BuiltinType WCHAR("wchar_t"); BuiltinType SHORT("short"); BuiltinType INT("int"); BuiltinType LONG("long"); BuiltinType FLOAT("float"); BuiltinType DOUBLE("double"); BuiltinType UCHAR("unsigned char"); BuiltinType USHORT("unsigned short"); BuiltinType UINT("unsigned int"); BuiltinType ULONG("unsigned long"); BuiltinType SCHAR("signed char"); BuiltinType SSHORT("signed short"); BuiltinType SINT("signed int"); BuiltinType SLONG("signed long"); std::string const CVType::names[4] = {"", "const", "volatile", "const volatile"}; } } synopsis-0.12/src/Synopsis/TypeAnalysis/TypeEvaluator.hh0000664000076400007640000000364311104702314023046 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_TypeAnalysis_TypeEvaluator_hh_ #define Synopsis_TypeAnalysis_TypeEvaluator_hh_ #include #include #include #include #include namespace Synopsis { namespace TypeAnalysis { //. evaluate the type of an expression class TypeEvaluator : private PTree::Visitor { public: TypeEvaluator(SymbolLookup::Scope const *s) : my_scope(s) {} Type const *evaluate(PTree::Node const *node); private: virtual void visit(PTree::Literal *); virtual void visit(PTree::Identifier *); virtual void visit(PTree::Kwd::This *); virtual void visit(PTree::Name *); virtual void visit(PTree::FstyleCastExpr *); virtual void visit(PTree::AssignExpr *); virtual void visit(PTree::CondExpr *); virtual void visit(PTree::InfixExpr *); virtual void visit(PTree::PmExpr *); virtual void visit(PTree::CastExpr *); virtual void visit(PTree::UnaryExpr *); virtual void visit(PTree::ThrowExpr *); virtual void visit(PTree::SizeofExpr *); virtual void visit(PTree::TypeidExpr *); virtual void visit(PTree::TypeofExpr *); virtual void visit(PTree::NewExpr *); virtual void visit(PTree::DeleteExpr *); virtual void visit(PTree::ArrayExpr *); virtual void visit(PTree::FuncallExpr *); virtual void visit(PTree::PostfixExpr *); virtual void visit(PTree::DotMemberExpr *); virtual void visit(PTree::ArrowMemberExpr *); virtual void visit(PTree::ParenExpr *); SymbolLookup::Scope const *my_scope; Type const * my_type; }; inline Type const *type_of(PTree::Node const *node, SymbolLookup::Scope const *s) { TypeEvaluator evaluator(s); return evaluator.evaluate(node); } } } #endif synopsis-0.12/src/Synopsis/TypeAnalysis/OverloadResolver.hh0000664000076400007640000000110511104702314023526 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_TypeAnalysis_OverloadResolver_hh_ #define Synopsis_TypeAnalysis_OverloadResolver_hh_ #include #include namespace Synopsis { namespace TypeAnalysis { //. Resolve a function call in the context of the given scope. SymbolLookup::Symbol const *resolve_funcall(PTree::FuncallExpr const *funcall, SymbolLookup::Scope const *); } } #endif synopsis-0.12/src/Synopsis/TypeAnalysis/ConstEvaluator.cc0000664000076400007640000001376011104702314023202 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include #include #undef TRUE #undef FALSE using namespace Synopsis; using namespace PTree; using namespace SymbolLookup; using namespace TypeAnalysis; namespace { const std::string TRUE = "true"; const std::string FALSE = "false"; //. FIXME: this is only a quick hack that serves //. as a proof of concept to allow const expressions //. to include sizeof() expressions. //. An elaborate system will probably use a Visitor //. to calculate the size of compound types //. //. returns a negative value in case it couldn't determine the size long size_of_builtin_type(Encoding::iterator e) { long size = -1; switch (*e) { case 'b': size = 1; break; case 'c': size = 1; break; case 'w': size = 2; break; case 's': size = 2; break; case 'i': size = 4; break; case 'l': size = 4; break; case 'j': size = 8; break; case 'f': size = 4; break; case 'd': size = 8; break; case 'P': size = 4; break; case 'A': { std::string s; while (*++e != '_') s.push_back(*e); std::istringstream iss(s); iss >> size; size *= size_of_builtin_type(++e); break; } default: return -1; } return size; } } bool ConstEvaluator::evaluate(Node const *node, long &value) { const_cast(node)->accept(this); if (my_valid) { value = my_value; return true; } else return false; } void ConstEvaluator::visit(Literal *node) { std::istringstream iss(std::string(node->position(), node->length())); switch (node->type()) { case Token::Constant: { if (*node->position() == '0' && (node->position()[1] == 'x' || node->position()[1] == 'X')) { iss.setf(std::ios::hex, std::ios::basefield); iss >> my_value; } else if (TRUE.compare(0, 4, node->position(), node->length()) == 0) my_value = 1; else if (FALSE.compare(0, 5, node->position(), node->length()) == 0) my_value = 0; else { double value; iss >> value; my_value = static_cast(value); } my_valid = true; break; } default: break; } } void ConstEvaluator::visit(Identifier *node) { try { Encoding name(node->position(), node->length()); SymbolSet symbols = my_scope->lookup(name); ConstName const *const_ = 0; if (symbols.size() == 1) const_ = dynamic_cast(*symbols.begin()); if (!const_ || !const_->defined()) my_valid = false; else { my_value = const_->value(); my_valid = true; } } catch (const TypeError &e) { std::cerr << "Error in ConstName lookup: type was " << e.type << std::endl; } } void ConstEvaluator::visit(FstyleCastExpr *node) { my_valid = evaluate(third(node)->car(), my_value); } void ConstEvaluator::visit(InfixExpr *node) { long left, right; if (!evaluate(first(node), left) || !evaluate(third(node), right)) return; Node *op = second(node); assert(op->is_atom() && op->length() <= 2); my_valid = true; if (op->length() == 1) switch (*op->position()) { case '+': my_value = left + right; break; case '-': my_value = left - right; break; case '>': my_value = left > right; break; case '<': my_value = left < right; break; case '&': my_value = left & right; break; case '|': my_value = left | right; break; case '^': my_value = left ^ right; break; case '*': my_value = left * right; break; case '/': my_value = left / right; break; case '%': my_value = left % right; break; default: my_valid = false; break; } else if (*op->position() == '=' && op->position()[1] == '=') my_value = left == right; else if (*op->position() == '!' && op->position()[1] == '=') my_value = left != right; else if (*op->position() == '<' && op->position()[1] == '<') my_value = left << right; else if (*op->position() == '>' && op->position()[1] == '>') my_value = left >> right; else if (*op->position() == '&' && op->position()[1] == '&') my_value = left && right; else if (*op->position() == '|' && op->position()[1] == '|') my_value = left || right; else my_valid = false; } void ConstEvaluator::visit(SizeofExpr *node) { if (length(node->cdr()) == 3) // '(' typename ')' { Node *type_decl = second(node->cdr()); Encoding type = second(type_decl)->encoded_type(); long size = size_of_builtin_type(type.begin()); if (size < 0) return; else my_value = static_cast(size); my_valid = true; } else // unary expr { } } void ConstEvaluator::visit(UnaryExpr *node) { Node *op = node->car(); Node *expr = node->cdr()->car(); assert(op->is_atom() && op->length() <=2); if (!evaluate(expr, my_value)) return; if (op->length() == 1) switch (*op->position()) // '*' and '&' do not apply to constant expressions { case '+': break; case '-': my_value = -my_value; break; case '!': my_value = !my_value; break; case '~': my_value = ~my_value; break; default: my_valid = false; } else if (*op->position() == '+' && op->position()[1] == '+') ++my_value; else if (*op->position() == '-' && op->position()[1] == '-') --my_value; else my_valid = false; } void ConstEvaluator::visit(CondExpr *node) { long condition; if (!evaluate(node->car(), condition)) return; if (condition) // interpret as bool my_valid = evaluate(PTree::tail(node->cdr(), 1)->car(), my_value); else my_valid = evaluate(PTree::tail(node->cdr(), 3)->car(), my_value); } void ConstEvaluator::visit(ParenExpr *node) { Node *body = node->cdr()->car(); if (!body) my_valid = false; else body->accept(this); } synopsis-0.12/src/Synopsis/TypeAnalysis/Type.hh0000664000076400007640000000677411104702314021173 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_TypeAnalysis_Type_hh_ #define Synopsis_TypeAnalysis_Type_hh_ #include #include #include #include namespace Synopsis { namespace TypeAnalysis { class Type { public: Type(std::string const &name) : my_name(name), my_refcounter(1) {} virtual ~Type() {} const std::string &name() const { return my_name;} virtual void accept(Visitor *visitor) = 0; virtual void ref() const { ++my_refcounter;} virtual void deref() const { if (--my_refcounter) delete this;} // TODO: add 'new' / 'delete' operators for optimization. private: const std::string my_name; mutable size_t my_refcounter; }; class BuiltinType : public Type { public: BuiltinType(std::string const &name) : Type(name) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} // BuiltinType is preallocated and thus is destructed at program termination. virtual void ref() const {} virtual void deref() const {} }; extern BuiltinType BOOL; extern BuiltinType CHAR; extern BuiltinType WCHAR; extern BuiltinType SHORT; extern BuiltinType INT; extern BuiltinType LONG; extern BuiltinType FLOAT; extern BuiltinType DOUBLE; extern BuiltinType UCHAR; extern BuiltinType USHORT; extern BuiltinType UINT; extern BuiltinType ULONG; extern BuiltinType SCHAR; extern BuiltinType SSHORT; extern BuiltinType SINT; extern BuiltinType SLONG; class Enum : public Type { public: Enum(std::string const &name) : Type(name) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class Compound : public Type { public: Compound(std::string const &name) : Type(name) {} }; class Class : public Compound { public: enum Kind { STRUCT, CLASS}; Class(Kind kind, std::string const &name) : Compound(name), my_kind(kind) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} private: Kind my_kind; }; class Union : public Compound { public: Union(std::string const &name) : Compound(name) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} private: }; class CVType : public Type { public: enum CVQualifier { NONE=0x0, CONST=0x1, VOLATILE=0x2}; CVType(Type const *type, CVQualifier q) : Type(names[q]), my_type(type), my_qual(q) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} private: static std::string const names[4]; Type const *my_type; CVQualifier my_qual; }; class Pointer : public Type { public: Pointer(Type const *type) : Type("*"), my_type(type) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} private: Type const *my_type; }; class Reference : public Type { public: Reference(Type const *type) : Type("&"), my_type(type) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} private: Type const *my_type; }; class Array : public Type { public: Array(Type const *type) : Type("[]"), my_type(type) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} private: Type const *my_type; }; class Function : public Type { public: Function() : Type("") {} virtual void accept(Visitor *visitor) { visitor->visit(this);} private: Type const *my_type; }; class PointerToMember : public Type { public: PointerToMember() : Type("") {} virtual void accept(Visitor *visitor) { visitor->visit(this);} private: Type const *my_container; Type const *my_member; }; } } #endif synopsis-0.12/src/Synopsis/TypeAnalysis/OverloadResolver.cc0000664000076400007640000000653111104702314023524 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include "OverloadResolver.hh" #include #include namespace Synopsis { using namespace SymbolLookup; namespace TypeAnalysis { // SymbolSet match_arguments(SymbolSet const &functions, std::vector const &types) // { // Trace trace("match_arguments"); // std::cout << "available functions:" << std::endl; // for (SymbolSet::iterator i = functions.begin(); i != functions.end(); ++i) // std::cout << (*i)->type() << std::endl; // std::cout << "provided argument types:" << std::endl; // for (std::vector::const_iterator i = types.begin(); i != types.end(); ++i) // std::cout << *i << std::endl; // SymbolSet viable; // // FIXME: for now ignore ellipses and default arguments // for (SymbolSet::iterator i = functions.begin(); i != functions.end(); ++i) // { // Type function((*i)->type(), (*i)->scope()); // if (function.num_of_arguments() == types.size()) // viable.insert(*i); // } // std::cout << "viable functions" << std::endl; // for (SymbolSet::iterator i = viable.begin(); i != viable.end(); ++i) // std::cout << (*i)->type() << std::endl; // SymbolSet matches; // return matches; // } // Symbol const *resolve_funcall(PTree::FuncallExpr const *funcall, Scope const *scope) // { // Trace trace("resolve_funcall"); // // overload resolution is done in multiple steps: // // // // o determine a set of symbols that match the name of the function being called, // // including objects // // o determine the types associated with the parameter expressions // // o determine the set of viable functions (13.3.2 [over.match.viable]) // // o rank the set of viable functions and select the best viable function // // (13.3.3 [over.match.best]) // PTree::Node const *function = PTree::first(funcall); // SymbolSet functions; // PTree::Encoding function_name; // // if this is an identifier or a name, we can look it up in the symbol table // // (possibly getting a set of overloaded functions) // if (function->is_atom()) // identifier // { // function_name = PTree::Encoding(function->position(), function->length()); // functions = scope->lookup(function_name); // } // else if (PTree::type_of(function) == Token::ntName) // { // function_name = function->encoded_name(); // functions = scope->lookup(function_name); // } // // else if it is a primary expression, we use type_of to determine the function // // signature. Here we can't get more than one matches (see [13.4]) // else // { // std::cout << "" << std::endl; // return 0; // } // // now find number and types of the arguments. // PTree::Node const *arguments = PTree::second(PTree::rest(funcall)); // std::vector types; // for (size_t i = 0; i < PTree::length(arguments); ++i) // { // types.push_back(type_of(PTree::nth(arguments, i), scope)); // ++i; // skip comma // } // SymbolSet matches = match_arguments(functions, types); // if (matches.size() == 1) // return *matches.begin(); // return 0; // } } } synopsis-0.12/src/Synopsis/TypeAnalysis/Kit.cc0000664000076400007640000000136611104702314020757 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include "Kit.hh" using namespace Synopsis; using namespace TypeAnalysis; Kit::Kit() { } Type const *Kit::builtin(std::string const &) { return 0; } Type const *Kit::enum_(std::string const &) { return 0; } Type const *Kit::class_(std::string const &) { return 0; } Type const *Kit::union_(std::string const &) { return 0; } Type const *Kit::pointer(Type const *) { return 0; } Type const *Kit::reference(Type const *) { return 0; } Type const *Kit::array(Type const *) { return 0; } Type const *Kit::pointer_to_member(Type const *, Type const *) { return 0; } synopsis-0.12/src/Synopsis/TypeAnalysis.hh0000664000076400007640000000101611104702322020231 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_TypeAnalysis_hh_ #define Synopsis_TypeAnalysis_hh_ #include #include #include #include #include #include #endif synopsis-0.12/src/Synopsis/ASG/0000775000076400007640000000000011172123233015702 5ustar stefanstefansynopsis-0.12/src/Synopsis/ASG/DeclaredTypeId.hh0000664000076400007640000000565211104702321021051 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef _Synopsis_ASG_DeclaredTypeId_hh #define _Synopsis_ASG_DeclaredTypeId_hh #include #include namespace Synopsis { namespace ASG { class DeclaredTypeId : public NamedTypeId { public: DeclaredTypeId() {} DeclaredTypeId(const Object &o, bool check = true) : NamedTypeId(o, false) { if (check) assert_type("DeclaredTypeId");} Declaration declaration() const { return attr("declaration")();} virtual void accept(TypeIdVisitor *v) { v->visit_declared_type_id(this);} }; //. Template types are declared template types. They have a name, a //. declaration (which is an AST::Class) and a vector of parameters //. declare this template. Each parameter (using AST::Parameter) should be //. either the correct type for non-type parameters, or a Dependent for type //. parameters. In either case, there may be default values. class TemplateId : public DeclaredTypeId { public: typedef Python::TypedList Parameters; TemplateId() {} TemplateId(const Python::Object &o, bool check = true) : DeclaredTypeId(o, false) { if (check) assert_type("TemplateId");} Parameters parameters() { return narrow(attr("parameters")());} // specializations() ??? virtual void accept(TypeIdVisitor *v) { v->visit_template_id(this);} }; class ParametrizedTypeId : public TypeId { public: ParametrizedTypeId() {} ParametrizedTypeId(const Python::Object &o, bool check = true) : TypeId(o, false) { if (check) assert_type("ParametrizedTypeId");} TemplateId template_() const { return narrow(attr("template")());} TypeIdList parameters() const { return narrow(attr("parameters")());} virtual void accept(TypeIdVisitor *v) { v->visit_parametrized_type_id(this);} }; //. Safely extracts typed Declarations from Named types. The type is first //. safely cast to Declared, then the declaration() safely cast to //. the template type. template T declared_type_id_cast(const TypeId &type) throw (Python::Object::TypeError) { if (DeclaredTypeId declared = Python::Object::try_narrow(type)) if (Declaration decl = declared.declaration()) if (T derived = Python::Object::try_narrow(decl)) return derived; throw Python::Object::TypeError(); } // //. Safely extracts typed Declarations from Type types. The type is first // //. safely cast to Declared, then the declaration() safely cast to // //. the template type. // template // T declared_cast(const Type &type) throw (Object::TypeError) // { // if (Declared declared = Object::try_narrow(type)) // if (Declaration decl = declared.declaration()) // if (T derived = Object::try_narrow(decl)) // return derived; // throw Object::TypeError(); // } } } #endif synopsis-0.12/src/Synopsis/ASG/IR.hh0000664000076400007640000000141611104702321016533 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef _Synopsis_ASG_IR_hh #define _Synopsis_ASG_IR_hh #include #include namespace Synopsis { class IR : public Python::Object { public: IR() {} IR(const Python::Object &o) throw(TypeError) : Python::Object(o) { assert_type();} Python::Dict files() { return Python::Dict(attr("files"));} Python::Object types() { return attr("asg").attr("types");} Python::List declarations() { return Python::List(attr("asg").attr("declarations"));} void assert_type() throw(TypeError) { Python::Object::assert_type("Synopsis.IR", "IR");} }; } #endif synopsis-0.12/src/Synopsis/ASG/Visitor.hh0000664000076400007640000000542311104702321017662 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef _Synopsis_ASG_Visitor_hh #define _Synopsis_ASG_Visitor_hh namespace Synopsis { namespace ASG { class Declaration; class Builtin; class Macro; class Scope; class Module; class Class; class Inheritance; class Forward; class Typedef; class Variable; class Const; class Enumerator; class Enum; class Parameter; class Function; class Operation; //. The Visitor for the AST hierarchy. This class is just an interface //. really. It is abstract, and you must reimplement any methods you want. //. The default implementations of the methods call the visit methods for //. the subclasses of the visited type, eg visit_namespace calls visit_scope //. which calls visit_declaration. class Visitor { public: // Abstract destructor makes the class abstract virtual ~Visitor() {} virtual void visit_declaration(const Declaration*) = 0; virtual void visit_builtin(const Builtin*) = 0; virtual void visit_macro(const Macro*) = 0; virtual void visit_scope(const Scope*) = 0; virtual void visit_module(const Module*) = 0; virtual void visit_class(const Class*) = 0; virtual void visit_inheritance(const Inheritance*) = 0; virtual void visit_forward(const Forward*) = 0; virtual void visit_typedef(const Typedef*) = 0; virtual void visit_variable(const Variable*) = 0; virtual void visit_const(const Const*) = 0; virtual void visit_enum(const Enum*) = 0; virtual void visit_enumerator(const Enumerator*) = 0; virtual void visit_parameter(const Parameter*) = 0; virtual void visit_function(const Function*) = 0; virtual void visit_operation(const Operation*) = 0; }; class TypeId; class UnknownTypeId; class ModifierTypeId; class ArrayTypeId; class NamedTypeId; class BuiltinTypeId; class DependentTypeId; class DeclaredTypeId; class TemplateId; class ParametrizedTypeId; class FunctionTypeId; //. The Type Visitor base class class TypeIdVisitor { public: // Virtual destructor makes abstract virtual ~TypeIdVisitor() {} virtual void visit_type_id(const TypeId*) = 0; virtual void visit_named_type_id(const NamedTypeId*) = 0; virtual void visit_builtin_type_id(const BuiltinTypeId*) = 0; virtual void visit_dependent_type_id(const DependentTypeId*) = 0; virtual void visit_unknown_type_id(const UnknownTypeId*) = 0; virtual void visit_modifier_type_id(const ModifierTypeId*) = 0; virtual void visit_array_type_id(const ArrayTypeId*) = 0; virtual void visit_declared_type_id(const DeclaredTypeId*) = 0; virtual void visit_template_id(const TemplateId*) = 0; virtual void visit_parametrized_type_id(const ParametrizedTypeId*) = 0; virtual void visit_function_type_id(const FunctionTypeId*) = 0; }; } } #endif synopsis-0.12/src/Synopsis/ASG/TypeId.hh0000664000076400007640000000677711104702321017436 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef _Synopsis_ASG_TypeId_hh #define _Synopsis_ASG_TypeId_hh #include #include #include namespace Synopsis { typedef Python::TypedList ScopedName; namespace ASG { typedef Python::TypedList Modifiers; class TypeId : public Python::Object { public: TypeId() {} TypeId(const Python::Object &o, bool check = true) : Python::Object(o) { if (check && o) assert_type("TypeId");} std::string language() const { return narrow(attr("language")());} virtual void accept(TypeIdVisitor *v) { v->visit_type_id(this);} void assert_type(const char *type_id) { Python::Object::assert_type("Synopsis.ASG", type_id);} }; typedef Python::TypedList TypeIdList; class NamedTypeId : public TypeId { public: NamedTypeId() {} NamedTypeId(const Python::Object &o, bool check = true) : TypeId(o, false) { if (check && o) assert_type("NamedTypeId");} ScopedName name() const { return attr("name")();} virtual void accept(TypeIdVisitor *v) { v->visit_named_type_id(this);} }; class BuiltinTypeId : public NamedTypeId { public: BuiltinTypeId() {} BuiltinTypeId(const Python::Object &o, bool check = true) : NamedTypeId(o, false) { if (check && o) assert_type("BuiltinTypeId");} virtual void accept(TypeIdVisitor *v) { v->visit_builtin_type_id(this);} }; class DependentTypeId : public NamedTypeId { public: DependentTypeId() {} DependentTypeId(const Python::Object &o, bool check = true) : NamedTypeId(o, false) { if (check && o) assert_type("DependentTypeId");} virtual void accept(TypeIdVisitor *v) { v->visit_dependent_type_id(this);} }; class UnknownTypeId : public NamedTypeId { public: UnknownTypeId() {} UnknownTypeId(const Python::Object &o, bool check = true) : NamedTypeId(o, false) { if (check && o) assert_type("UnknownTypeId");} virtual void accept(TypeIdVisitor *v) { v->visit_unknown_type_id(this);} }; class ModifierTypeId : public TypeId { public: ModifierTypeId() {} ModifierTypeId(const Python::Object &o, bool check = true) : TypeId(o, false) { if (check && o) assert_type("ModifierTypeId");} TypeId alias() const { return narrow(attr("alias")());} Modifiers pre() const { return narrow(attr("premod")());} Modifiers post() const { return narrow(attr("postmod")());} virtual void accept(TypeIdVisitor *v) { v->visit_modifier_type_id(this);} }; class ArrayTypeId : public TypeId { public: typedef Python::TypedList Sizes; ArrayTypeId() {} ArrayTypeId(const Python::Object &o, bool check = true) : TypeId(o, false) { if (check && o) assert_type("ArrayTypeId");} Sizes sizes() const { return narrow(attr("sizes")());} virtual void accept(TypeIdVisitor *v) { v->visit_array_type_id(this);} }; class FunctionTypeId : public TypeId { public: FunctionTypeId() {} FunctionTypeId(const Python::Object &o, bool check = true) : TypeId(o, false) { if (check && o) assert_type("FunctionTypeId");} TypeId return_type() const { return narrow(attr("return_type")());} Modifiers pre() const { return narrow(attr("premod")());} TypeIdList parameters() const { return narrow(attr("parameters")());} virtual void accept(TypeIdVisitor *v) { v->visit_function_type_id(this);} }; } } #endif synopsis-0.12/src/Synopsis/ASG/ASGKit.hh0000664000076400007640000002223611104702321017306 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef _Synopsis_ASG_ASGKit_hh #define _Synopsis_ASG_ASGKit_hh #include #include #include #include #include #include namespace Synopsis { class IRKit : public Python::Kit { public: IRKit() : Python::Kit("Synopsis.IR") {} IR create_ir() { return create("IR");} }; class QNameKit : public Python::Kit { public: QNameKit() : Python::Kit("Synopsis.QualifiedName") {} Object create_qname(ScopedName const &name) { return create("QualifiedCxxName", Python::Tuple(name));} }; namespace ASG { // basically a factory for all ASG types class ASGKit : public Python::Kit { public: ASGKit(std::string const &lang) : Python::Kit("Synopsis.ASG"), language_(lang) {} TypeId create_type_id() { return create("TypeId", Python::Tuple(language_));} NamedTypeId create_named_type_id(ScopedName const &name) { Python::Object qname = qname_kit_.create_qname(name); return create("NamedTypeId", Python::Tuple(language_, qname)); } BuiltinTypeId create_builtin_type_id(const ScopedName &name) { Python::Object qname = qname_kit_.create_qname(name); return create("BuiltinTypeId", Python::Tuple(language_, qname)); } DependentTypeId create_dependent_type_id(const ScopedName &name) { Python::Object qname = qname_kit_.create_qname(name); return create("DependentTypeId", Python::Tuple(language_, qname)); } UnknownTypeId create_unknown_type_id(const ScopedName &name) { Python::Object qname = qname_kit_.create_qname(name); return create("UnknownTypeId", Python::Tuple(language_, qname)); } DeclaredTypeId create_declared_type_id(ScopedName const &name, Declaration const &decl) { Python::Object qname = qname_kit_.create_qname(name); return create("DeclaredTypeId", Python::Tuple(language_, qname, decl)); } TemplateId create_template_id(const ScopedName &name, const Declaration &decl, const Python::List ¶ms) { Python::Object qname = qname_kit_.create_qname(name); return create("TemplateId", Python::Tuple(language_, qname, decl, params)); } ModifierTypeId create_modifier_type_id(const TypeId &alias, const Modifiers &pre, const Modifiers &post) { return create("ModifierTypeId", Python::Tuple(language_, alias, pre, post));} ArrayTypeId create_array_type_id(const TypeId &alias, const Python::TypedList &sizes) { return create("ArrayTypeId", Python::Tuple(language_, alias, sizes));} ParametrizedTypeId create_parametrized_id(const TemplateId &t, const Python::List ¶ms) { return create("ParametrizedTypeId", Python::Tuple(language_, t, params));} FunctionTypeId create_function_type_id(const TypeId &retn, const Modifiers &pre, const TypeIdList ¶ms) { return create("FunctionTypeId", Python::Tuple(language_, retn, pre, params));} Declaration create_declaration(const SourceFile &sf, long line, const char *type, const ScopedName &name) { Python::Object qname = qname_kit_.create_qname(name); return create("Declaration", Python::Tuple(sf, line, type, qname)); } Builtin create_builtin(const SourceFile &file, int line, const std::string &type, const ScopedName &name) { Python::Object qname = qname_kit_.create_qname(name); return create("Builtin", Python::Tuple(file, line, type, qname)); } Macro create_macro(SourceFile &sf, long line, const ScopedName &name, const Python::List ¶meters, const std::string &text) { Python::Object qname = qname_kit_.create_qname(name); return create("Macro", Python::Tuple(sf, line, "macro", qname, parameters, text)); } Forward create_forward(const SourceFile &file, int line, const std::string &type, const ScopedName &name) { Python::Object qname = qname_kit_.create_qname(name); return create("Forward", Python::Tuple(file, line, type, qname)); } Scope create_scope(const SourceFile &file, int line, const std::string &type, const ScopedName &name) { Python::Object qname = qname_kit_.create_qname(name); return create("Scope", Python::Tuple(file, line, type, qname)); } Synopsis::ASG::Module create_module(const SourceFile &file, int line, const std::string &type, const ScopedName &name) { Python::Object qname = qname_kit_.create_qname(name); return create("Module", Python::Tuple(file, line, type, qname)); } Inheritance create_inheritance(const TypeId &parent, const Python::List &attributes) { return create("Inheritance", Python::Tuple(parent, attributes));} Class create_class(const SourceFile &file, int line, const std::string &type, const ScopedName &name) { Python::Object qname = qname_kit_.create_qname(name); return create("Class", Python::Tuple(file, line, type, qname)); } Typedef create_typedef(const SourceFile &file, int line, const std::string &type, const ScopedName &name, const TypeId &alias, bool constr) { Python::Object qname = qname_kit_.create_qname(name); return create("Typedef", Python::Tuple(file, line, type, qname, alias, constr)); } Enumerator create_enumerator(const SourceFile &file, int line, const ScopedName &name, const std::string &value) { Python::Object qname = qname_kit_.create_qname(name); return create("Enumerator", Python::Tuple(file, line, qname, value)); } Enum create_enum(const SourceFile &file, int line, const ScopedName &name, const Enumerators &values) { Python::Object qname = qname_kit_.create_qname(name); return create("Enum", Python::Tuple(file, line, qname, values)); } Variable create_variable(const SourceFile &file, int line, const std::string &type, const ScopedName &name, const TypeId &vtype, bool constr) { Python::Object qname = qname_kit_.create_qname(name); return create("Variable", Python::Tuple(file, line, type, qname, vtype, constr)); } Const create_const(const SourceFile &file, int line, const std::string &type, const ScopedName &name, const TypeId &ctype, const std::string &value) { Python::Object qname = qname_kit_.create_qname(name); return create("Const", Python::Tuple(file, line, type, qname, ctype, value)); } Parameter create_parameter(const Modifiers &pre, const TypeId &type, const Modifiers &post, const std::string &name, const std::string &value) { return create("Parameter", Python::Tuple(pre, type, post, name, value));} Function create_function(const SourceFile &file, int line, const std::string &type, const Modifiers &pre, const TypeId &ret, const Modifiers &post, const ScopedName &name, const std::string &realname) { Python::Object qname = qname_kit_.create_qname(name); return create("Function", Python::Tuple(file, line, type, pre, ret, post, qname, realname)); } Operation create_operation(const SourceFile &file, int line, const std::string &type, const Modifiers &pre, const TypeId &ret, const Modifiers &post, const ScopedName &name, const std::string &realname) { Python::Object qname = qname_kit_.create_qname(name); return create("Operation", Python::Tuple(file, line, type, pre, ret, post, qname, realname)); } private: QNameKit qname_kit_; std::string language_; }; } class SourceFileKit : public Python::Kit { public: SourceFileKit(std::string const &lang) : Python::Kit("Synopsis.SourceFile"), lang_(lang) {} SourceFile create_source_file(const std::string &name, const std::string &longname) { return create("SourceFile", Python::Tuple(name, longname, lang_));} Include create_include(const SourceFile &sf, const std::string &name, bool is_macro, bool is_next) { return create("Include", Python::Tuple(sf, name, is_macro, is_next));} MacroCall create_macro_call(const std::string &name, int start_line, int start_col, int end_line, int end_col, int e_start_line, int e_start_col, int e_end_line, int e_end_col) { return create("MacroCall", Python::Tuple(name, Python::Tuple(start_line, start_col), Python::Tuple(end_line, end_col), Python::Tuple(e_start_line, e_start_col), Python::Tuple(e_end_line, e_end_col)));} private: std::string lang_; }; } #endif synopsis-0.12/src/Synopsis/ASG/SourceFile.hh0000664000076400007640000000333111104702321020257 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef _Synopsis_ASG_SourceFile_hh #define _Synopsis_ASG_SourceFile_hh #include #include namespace Synopsis { class Include : public Python::Object { public: Include(const Python::Object &o) throw(TypeError) : Python::Object(o) { assert_type();} SourceFile target() const { return narrow(attr("target")());} std::string name() const { return narrow(attr("name")());} bool is_macro() const { return narrow(attr("is_macro")());} bool is_next() const { return narrow(attr("is_next")());} void assert_type() throw(TypeError) { Python::Object::assert_type("Synopsis.SourceFile", "Include");} }; class MacroCall : public Python::Object { public: MacroCall(const Python::Object &o) throw(TypeError) : Python::Object(o) { assert_type();} void assert_type() throw(TypeError) { Python::Object::assert_type("Synopsis.SourceFile", "MacroCall");} std::string name() { return narrow(attr("name"));} long start_line() { return narrow(attr("start").get(0));} long start_col() { return narrow(attr("start").get(1));} long end_line() { return narrow(attr("end").get(0));} long end_col() { return narrow(attr("end").get(1));} long e_start_line() { return narrow(attr("expanded_start").get(0));} long e_start_col() { return narrow(attr("expanded_start").get(1));} long e_end_line() { return narrow(attr("expanded_end").get(0));} long e_end_col() { return narrow(attr("expanded_end").get(1));} }; } #endif synopsis-0.12/src/Synopsis/ASG/Declaration.hh0000664000076400007640000002517011104702321020451 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef _Synopsis_ASG_Declaration_hh #define _Synopsis_ASG_Declaration_hh #include #include #include namespace Synopsis { namespace ASG { enum Access { DEFAULT = 0, PUBLIC = 1, PROTECTED = 2, PRIVATE = 3 }; class Declaration; typedef Python::TypedList Declarations; } class SourceFile : public Python::Object { public: SourceFile() {} SourceFile(Python::Object const &o) : Python::Object(o) {} std::string name() const { return narrow(attr("name"));} std::string abs_name() const { return narrow(attr("abs_name"));} bool primary() const { return narrow(Python::Dict(attr("annotations")).get("primary"));} void set_primary(bool flag) { Python::Dict annotations(attr("annotations")); annotations.set("primary", flag); } Python::List includes() { return attr("includes");} Python::List macro_calls() { return attr("macro_calls");} ASG::Declarations declarations(); }; namespace ASG { class Declaration : public Python::Object { public: Declaration() {} Declaration(const Python::Object &o, bool check = true) : Python::Object(o) { if (check) assert_type("Declaration");} SourceFile file() const { return narrow(attr("file"));} long line() const { return narrow(attr("line"));} std::string language() const { return narrow(attr("language"));} std::string type() const { return narrow(attr("type"));} ScopedName name() const { return attr("name");} Python::Dict annotations() { return attr("annotations");} Access accessibility() const { return static_cast(narrow(attr("accessibility")));} void accessibility(Access a) const { attr("accessibility")(Python::Tuple(static_cast(a)));} virtual void accept(Visitor *v) { v->visit_declaration(this);} void assert_type(const char *type) { Python::Object::assert_type("Synopsis.ASG", type);} }; //. A Builtin is a node to be used internally. //. Right now it's being used to capture comments //. at the end of a scope. class Builtin : public Declaration { public: Builtin() {} Builtin(const Python::Object &o, bool check = true) : Declaration(o, false) { if (check) assert_type("Builtin");} virtual void accept(Visitor *v) { v->visit_builtin(this);} }; class Macro : public Declaration { public: Macro() {} Macro(const Python::Object &o, bool check = true) : Declaration(o, false) { if (check) assert_type("Macro");} Python::List parameters() { return attr("parameters");} std::string text() { return narrow(attr("text"));} virtual void accept(Visitor *v) { v->visit_macro(this);} }; //. Forward declaration. Currently this has no extra attributes. class Forward : public Declaration { public: Forward() {} Forward(const Python::Object &o, bool check = true) : Declaration(o, false) { if (check) assert_type("Forward");} // //. Returns the Template object if this is a template // Template template_type() {} // //. Sets the Template object for this class. NULL means not a template // void set_template_type(Types::Template* type); virtual void accept(Visitor *v) { v->visit_forward(this);} }; //. Base class for scopes with contained declarations. Each scope has its //. own Dictionary of names so far accumulated for this scope. Each scope //. also as a complete vector of scopes where name lookup is to proceed if //. unsuccessful in this scope. Name lookup is not recursive. class Scope : public Declaration { public: Scope() {} Scope(const Python::Object &o, bool check = true) : Declaration(o, false) { if (check) assert_type("Scope");} Python::List declarations() const { return attr("declarations");} virtual void accept(Visitor *v) { v->visit_scope(this);} }; //. Module class class Module : public Scope { public: Module() {} Module(const Python::Object &o, bool check = true) : Scope(o, false) { if (check) assert_type("Module");} virtual void accept(Visitor *v) { v->visit_module(this);} }; //. Inheritance class. This class encapsulates the information about an //. inheritance, namely its accessability. Note that classes inherit from //. types, not class declarations. As such it's possible to inherit from a //. parameterized type, or a declared typedef or class/struct. class Inheritance : public Python::Object { public: Inheritance() {} Inheritance(const Python::Object &o, bool check = true) : Python::Object(o) { if (check) assert_type("Synopsis.ASG", "Inheritance");} //. Returns the Class object this inheritance refers to. The method //. returns a Type since typedefs to classes are preserved to //. enhance readability of the generated docs. Note that the parent //. may also be a non-declaration type, such as vector TypeId parent() const { return attr("parent")();} //. Returns the attributes of this inheritance Python::List attributes() const { return attr("attributes")();} void accept(Visitor *v) { v->visit_inheritance(this);} }; //. Class class class Class : public Scope { public: Class() {} Class(const Python::Object &o, bool check = true) : Scope(o, false) { if (check) assert_type("Class");} //. Constant version of parents() Python::List parents() const { return attr("parents")();} //. Returns the Template object if this is a template Object template_() { return attr("template")();} //. Sets the Template object for this class. void set_template(Object type) { attr("set_template")(Python::Tuple(type));} virtual void accept(Visitor *v) { v->visit_class(this);} }; //. Typedef declaration class Typedef : public Declaration { public: Typedef() {} Typedef(const Python::Object &o, bool check = true) : Declaration(o, false) { if (check) assert_type("Typedef");} //. Returns the Type object this typedef aliases TypeId alias() const { return attr("alias");} //. Returns true if the Type object was constructed inside the typedef bool constructed() const { return narrow(attr("constr"));} virtual void accept(Visitor *v) { v->visit_typedef(this);} }; //. Enumerator declaration. This is a name with a value in the containing //. scope. Enumerators only appear inside Enums via their enumerators() //. attribute. class Enumerator : public Declaration { public: Enumerator() {} Enumerator(const Python::Object &o, bool check = true) : Declaration(o, false) { if (check) assert_type("Enumerator");} //. Returns the value of this enumerator std::string value() const { return narrow(attr("value"));} virtual void accept(Visitor *v) { v->visit_enumerator(this);} }; //. This needs to be flexible enough to hold Enumerators and Builtins. typedef Python::TypedList Enumerators; //. Enum declaration. An enum contains multiple enumerators. class Enum : public Declaration { public: Enum() {} Enum(const Python::Object &o, bool check = true) : Declaration(o, false) { if (check) assert_type("Enum");} //. Returns the vector of Enumerators Python::List enumerators() { return attr("enumerators");} virtual void accept(Visitor *v) { v->visit_enum(this);} }; //. Variable declaration class Variable : public Declaration { public: Variable() {} Variable(const Python::Object &o, bool check = true) : Declaration(o, false) { if (check) assert_type("Variable");} //. Returns the Type object of this variable TypeId vtype() const { return attr("vtype");} //. Returns true if the Type object was constructed inside the variable bool constructed() const { return attr("constr");} //. Returns the array sizes vector Python::List sizes() const { return attr("sizes");} virtual void accept(Visitor *v) { v->visit_variable(this);} }; //. A const is a name with a value and declared type. class Const : public Declaration { public: Const() {} Const(const Python::Object &o, bool check = true) : Declaration(o, false) { if (check) assert_type("Const");} //. Returns the TypeId object of this const TypeId ctype() const { return attr("ctype");} //. Returns the value of this enumerator std::string value() const { return narrow(attr("value"));} virtual void accept(Visitor *v) { v->visit_const(this);} }; class Parameter : public Python::Object { public: Parameter() {} Parameter(const Python::Object &o, bool check = true) : Python::Object(o) { if (check) assert_type("Synopsis.ASG", "Parameter");} Modifiers premodifiers() const { return narrow(attr("premodifiers"));} Modifiers postmodifiers() const { return narrow(attr("postmodifiers"));} TypeId type() const { return narrow(attr("type"));} std::string name() const { return narrow(attr("identifier"));} std::string value() const { return narrow(attr("value"));} virtual void accept(Visitor *v) { v->visit_parameter(this);} }; //. Function encapsulates a function declaration. Note that names may be //. stored in mangled form, and formatters should use real_name() to get //. the unmangled version. If this is a function template, use the //. template_type() method to get at the template type class Function : public Declaration { public: typedef Python::TypedList Parameters; Function() {} Function(const Python::Object &o, bool check = true) : Declaration(o, false) { if (check) assert_type("Function");} // //. The type of premodifiers // typedef std::vector Mods; //. Returns the return-type TypeId return_type() const { return attr("return_type");} //. Returns the real name of this function ScopedName real_name() const { return attr("real_name");} //. Returns the vector of parameters Parameters parameters() const { return attr("parameters");} //. Returns the Template object if this is a template // Types::Template* template_type() // { // return m_template; // } //. Sets the Template object for this class. NULL means not a template // void set_template_type(Types::Template* type) // { // m_template = type; // } //. Accept the given visitor virtual void accept(Visitor *v) { v->visit_function(this);} }; //. Operations are similar to functions but Not Quite Right class Operation : public Function { public: Operation() {} Operation(const Python::Object &o, bool check = true) : Function(o, false) { if (check) assert_type("Operation");} virtual void accept(Visitor *v) { v->visit_operation(this);} }; } inline ASG::Declarations SourceFile::declarations() { return narrow(attr("declarations"));} } #endif synopsis-0.12/src/Synopsis/Trace.hh0000664000076400007640000000424211104702322016646 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_Trace_hh_ #define Synopsis_Trace_hh_ #include #include namespace Synopsis { class Trace { public: // This category list is incomplete and needs to be filled in as // more code is being written. enum Category { NONE=0x0, PTREE=0x01, SYMBOLLOOKUP=0x02, PARSING=0x04, TRANSLATION=0x08, ALL=0xff}; struct Entry { Entry(bool e); Entry(Entry const &e) : enabled(e.enabled) { e.enabled = false;} ~Entry(); template Entry const &operator<<(T const &t) const; mutable bool enabled; }; friend struct Entry; Trace(std::string const &s, unsigned int c) : my_scope(s), my_visibility(my_mask & c) { if (!my_visibility) return; std::cout << indent() << "entering " << my_scope << std::endl; ++my_level; } template Trace(std::string const &s, unsigned int c, T const &t) : my_scope(s), my_visibility(my_mask & c) { if (!my_visibility) return; std::cout << indent() << "entering " << my_scope << ' ' << t << std::endl; ++my_level; } ~Trace() { if (!my_visibility) return; --my_level; std::cout << indent() << "leaving " << my_scope << std::endl; } template Entry operator<<(T const &t) const; static void enable(unsigned int mask = ALL) { my_mask = mask;} private: static std::string indent() { return std::string(my_level, ' ');} static unsigned int my_mask; static size_t my_level; std::string my_scope; bool my_visibility; }; inline Trace::Entry::Entry(bool e) : enabled(e) { if (enabled) std::cout << Trace::indent(); } inline Trace::Entry::~Entry() { if (enabled) std::cout << std::endl; } template inline Trace::Entry const &Trace::Entry::operator<<(T const &t) const { if (enabled) std::cout << t; return *this; } template inline Trace::Entry Trace::operator<<(T const &t) const { Entry entry(my_visibility); return entry << t; } } #endif synopsis-0.12/src/Synopsis/Buffer.cc0000664000076400007640000000750111104702314017011 0ustar stefanstefan// // Copyright (C) 1997-2000 Shigeru Chiba // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include "Synopsis/Buffer.hh" #include "Synopsis/Lexer.hh" #include #include #include #include #include #if defined(PARSE_MSVC) #define _MSC_VER 1100 #endif using namespace Synopsis; Buffer::Buffer(std::streambuf *sb, const std::string &filename) : my_filename(filename), my_cursor(0) { std::istreambuf_iterator begin(sb), end; my_buffer.append(begin, end); } void Buffer::replace(const char *from, const char *to, const char *begin, unsigned long length) { my_replacements.push_back(Replacement(from, to, begin, length)); } unsigned long Buffer::origin(const char *ptr, std::string &filename) const { // Determine pos in file unsigned long cursor = ptr - my_buffer.data(); if(cursor > my_buffer.size()) throw std::invalid_argument("pointer out of bound"); long lines = 0; while(cursor) { // move back to the last line directive and report // the line number read there plus the number of lines in between switch(at(--cursor)) { case '\n': ++lines; break; case '#': { unsigned long begin = 0, end = 0; long l = read_line_directive(cursor, -1, begin, end); if(l >= 0) { unsigned long line = static_cast(l) + lines; filename = std::string(my_buffer.data() + begin, end - begin); return line; } break; } } } // if we are here the input file wasn't preprocessed and // thus the first line doesn't start with a line directive filename = my_filename; return 1 + lines; } void Buffer::write(std::ostream &os, const std::string &/* filename */) const { // FIXME: what should we do with overlapping replacements ? Replacements replacements(my_replacements); std::sort(replacements.begin(), replacements.end(), Replacement::smaller); std::ostreambuf_iterator out(os); char const *b = my_buffer.data(); for (Replacements::iterator r = replacements.begin(); r != replacements.end(); ++r) { std::copy(b, r->from, out); std::copy(r->begin, r->begin + r->length, out); b = r->to; if (*b == '\0') break; } std::copy(b, my_buffer.data() + my_buffer.length(), out); } long Buffer::read_line_directive(unsigned long cursor, long line, unsigned long &begin, unsigned long &end) const { char c; // skip leading whitespace do { c = at(++cursor); } while(is_blank(c)); // gcc only generates '#' instead of '#line', so make the following check // optional. if(cursor + 4 <= my_buffer.size() && my_buffer.substr(cursor, 4) == "line") { // skip 'line' token and following whitespace cursor += 4; do { c = at(++cursor); } while(is_blank(c)); } if(is_digit(c)) { /* # */ // extract a decimal number unsigned long num = c - '0'; while(true) { c = at(++cursor); if(is_digit(c)) num = num * 10 + c - '0'; else break; } // as the line number reported reports for the *next* line, we set // it to one below as it gets incremented on the next newline long l = num - 1; // skip whitespace if(is_blank(c)) { do { c = at(++cursor); } while(is_blank(c)); // now get the filename if(c == '"') { unsigned long b = cursor; do { c = at(++cursor); } while(c != '"'); if(cursor > b + 2) { // the line is well-formed, let's set the out parameters begin = b + 1; end = cursor; line = l; } } } } return line; } Buffer::Replacement::Replacement(const char *f, const char *t, const char *b, unsigned long l) : from(f), to(t), begin(b), length(l) { } synopsis-0.12/src/Synopsis/SymbolLookup.hh0000664000076400007640000000064211104702321020246 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_SymbolLookup_hh_ #define Synopsis_SymbolLookup_hh_ #include #include #include #include #endif synopsis-0.12/src/Synopsis/Token.hh0000664000076400007640000001026211104702314016670 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_Token_hh_ #define Synopsis_Token_hh_ #include namespace Synopsis { //. A Token is what the Lexer splits an input stream into. //. It refers to a region in the underlaying buffer and it //. has a type. //. //. - line directive: `^"#"{blank}*{digit}+({blank}+.*)?\n` //. - pragma directive: `^"#"{blank}*"pragma".*\n` //. - Constant: //. //. - `{digit}+{int_suffix}*` //. - `"0"{xletter}{hexdigit}+{int_suffix}*` //. - `{digit}*\.{digit}+{float_suffix}*` //. - `{digit}+\.{float_suffix}*` //. - `{digit}*\.{digit}+"e"("+"|"-")*{digit}+{float_suffix}*` //. - `{digit}+\."e"("+"|"-")*{digit}+{float_suffix}*` //. - `{digit}+"e"("+"|"-")*{digit}+{float_suffix}*` //. //. - CharConst: `\'([^'\n]|\\[^\n])\'` //. - WideCharConst: `L\'([^'\n]|\\[^\n])\'` //. - StringL: `\"([^"\n]|\\["\n])*\"` //. - WideStringL: `L\"([^"\n]|\\["\n])*\"` //. - Identifier: `{letter}+({letter}|{digit})*` //. - AssignOp: `*= /= %= += -= &= ^= <<= >>=` //. - EqualOp: `== !=` //. - RelOp: `<= >=` //. - ShiftOp: `<< >>` //. - LogOrOp: `||` //. - LogAndOp: `&&` //. - IncOp: `++ --` //. - Scope: `::` //. - Ellipsis: `...` //. - PmOp: `.* ->*` //. - ArrowOp: `->` //. - others: `!%^&*()-+={}|~[];:<>?,./` //. - BadToken: `others` //. struct Token { typedef int Type; enum { Identifier = 258, //.< The first 256 are representing character literals. Constant, CharConst, StringL, AssignOp, EqualOp, RelOp, ShiftOp, LogOrOp, LogAndOp, IncOp, Scope, Ellipsis, PmOp, ArrowOp, BadToken, AUTO, CHAR, CLASS, CONST, DELETE, DOUBLE, ENUM, EXTERN, FLOAT, FRIEND, INLINE, INT, LONG, NEW, OPERATOR, PRIVATE, PROTECTED, PUBLIC, REGISTER, SHORT, SIGNED, STATIC, STRUCT, TYPEDEF, TYPENAME, UNION, UNSIGNED, VIRTUAL, VOID, VOLATILE, TEMPLATE, MUTABLE, BREAK, CASE, CONTINUE, DEFAULT, DO, ELSE, FOR, GOTO, IF, OFFSETOF, RETURN, SIZEOF, SWITCH, THIS, WHILE, ATTRIBUTE, //=g++, METACLASS, //=opencxx UserKeyword, UserKeyword2, UserKeyword3, UserKeyword4, BOOLEAN, EXTENSION, //=g++, TRY, CATCH, THROW, UserKeyword5, NAMESPACE, USING, TYPEID, TYPEOF, WideStringL, WideCharConst, WCHAR, //=non terminals, ntDeclarator = 400, ntName, ntFstyleCast, ntClassSpec, ntEnumSpec, ntDeclaration, ntTypedef, ntTemplateDecl, ntMetaclassDecl, ntParameterDecl, ntLinkageSpec, ntAccessSpec, ntUserAccessSpec, ntUserdefKeyword, ntExternTemplate, ntAccessDecl, ntNamespaceSpec, ntUsing, ntTemplateInstantiation, ntNamespaceAlias, ntIfStatement, ntSwitchStatement, ntWhileStatement, ntDoStatement, ntForStatement, ntBreakStatement, ntContinueStatement, ntReturnStatement, ntGotoStatement, ntCaseStatement, ntDefaultStatement, ntLabelStatement, ntExprStatement, ntTryStatement, ntCommaExpr, ntAssignExpr, ntCondExpr, ntInfixExpr, ntPmExpr, ntCastExpr, ntUnaryExpr, ntSizeofExpr, ntNewExpr, ntDeleteExpr, ntArrayExpr, ntFuncallExpr, ntPostfixExpr, ntUserStatementExpr, ntDotMemberExpr, ntArrowMemberExpr, ntParenExpr, ntStaticUserStatementExpr, ntThrowExpr, ntTypeidExpr, ntTypeofExpr, Ignore = 500, ASM, DECLSPEC, PRAGMA, INT64, Comment // This could eventually be used to report all comments. }; Token() : ptr(0), length(0), type(BadToken) {} Token(const char *s, size_t l, Type t) : ptr(s), length(l), type(t) {} bool operator == (char c) const { return *ptr == c && length == 1;} const char *ptr; size_t length; Type type; }; } #endif synopsis-0.12/src/Synopsis/Parser.cc0000664000076400007640000040244211171477643017061 0ustar stefanstefan// // Copyright (C) 1997 Shigeru Chiba // Copyright (C) 2000 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include #include "Synopsis/Parser.hh" #include "Synopsis/Lexer.hh" #include #include using namespace Synopsis; class SyntaxError : public Parser::Error { public: SyntaxError(const std::string &f, unsigned long l, const std::string &c) : my_filename(f), my_line(l), my_context(c) {} virtual void write(std::ostream &) const { std::cerr << "Syntax error : " << my_filename << ':' << my_line << ": Error before '" << my_context << '\'' << std::endl; } private: std::string my_filename; unsigned long my_line; std::string my_context; }; class UndefinedSymbol : public Parser::Error { public: UndefinedSymbol(PTree::Encoding const &name, std::string const &f, unsigned long l) : my_name(name), my_filename(f), my_line(l) {} virtual void write(std::ostream &os) const { os << "Undefined symbol : " << my_name.unmangled(); if (!my_filename.empty()) os << " at " << my_filename << ':' << my_line; os << std::endl; } private: PTree::Encoding my_name; std::string my_filename; unsigned long my_line; }; class SymbolAlreadyDefined : public Parser::Error { public: SymbolAlreadyDefined(PTree::Encoding const &name, std::string const & f1, unsigned long l1, std::string const & f2, unsigned long l2) : my_name(name), my_file1(f1), my_line1(l1), my_file2(f2), my_line2(l2) {} virtual void write(std::ostream &os) const { os << "Symbol already defined : definition of " << my_name.unmangled() << " at " << my_file1 << ':' << my_line1 << '\n' << "previously defined at " << my_file2 << ':' << my_line2 << std::endl; } private: PTree::Encoding my_name; std::string my_file1; unsigned long my_line1; std::string my_file2; unsigned long my_line2; }; class SymbolTypeMismatch : public Parser::Error { public: SymbolTypeMismatch(PTree::Encoding const &name, PTree::Encoding const &type) : my_name(name), my_type(type) {} virtual void write(std::ostream &os) const { os << "Symbol type mismatch : " << my_name.unmangled() << " has unexpected type " << my_type.unmangled() << std::endl; } private: PTree::Encoding my_name; PTree::Encoding my_type; }; namespace { template struct PGuard { PGuard(Parser &p, T Parser::*m) : parser(p), member(m), saved(p.*m) {} ~PGuard() { parser.*member = saved;} Parser & parser; T Parser::* member; T saved; }; const unsigned int max_errors = 10; PTree::Node *wrap_comments(const Lexer::Comments &c) { PTree::Node *head = 0; for (Lexer::Comments::const_iterator i = c.begin(); i != c.end(); ++i) head = PTree::snoc(head, new PTree::Atom(*i)); return head; } PTree::Node *nth_declarator(PTree::Node *decl, size_t n) { decl = PTree::third(decl); if(!decl || decl->is_atom()) return 0; if(PTree::is_a(decl, Token::ntDeclarator)) { // if it is a function if(n-- == 0) return decl; } else while(decl && !decl->is_atom()) { if(n-- == 0) return decl->car(); if((decl = decl->cdr())) decl = decl->cdr(); // skip , } return 0; } void set_declarator_comments(PTree::Declaration *decl, PTree::Node *comments) { if (!decl) return; PTree::Node *declarator; size_t n = 0; while (true) { size_t i = n++; declarator = nth_declarator(decl, i); if (!declarator) break; else if (PTree::is_a(declarator, Token::ntDeclarator)) ((PTree::Declarator*)declarator)->set_comments(comments); } } //. Helper function to recursively find the first left-most leaf node PTree::Node *leftmost_leaf(PTree::Node *node, PTree::Node *& parent) { if (!node || node->is_atom()) return node; // Non-leaf node. So find first leafy child PTree::Node *leaf; while (node) { if (node->car()) { // There is a child here.. if (node->car()->is_atom()) { // And this child is a leaf! return it and set parent parent = node; return node->car(); } if ((leaf = leftmost_leaf(node->car(), parent))) // Not a leaf so try recursing on it return leaf; } // No leaves from car of this node, so try next cdr node = node->cdr(); } return 0; } //. Node is never the leaf. Instead we traverse the left side of the tree //. until we find a leaf, and change the leaf to be a CommentedLeaf. void set_leaf_comments(PTree::Node *node, PTree::Node *comments) { PTree::Node *parent, *leaf; PTree::CommentedAtom* cleaf; // Find leaf leaf = leftmost_leaf(node, parent); // Sanity if (!leaf) { std::cerr << "Warning: Failed to find leaf when trying to add comments." << std::endl; PTree::display(parent, std::cerr, false); return; } if (!(cleaf = dynamic_cast(leaf))) { // Must change first child of parent to be a commented leaf Token tk(leaf->position(), leaf->length(), Token::Comment); cleaf = new (PTree::GC) PTree::CommentedAtom(tk, comments); parent->set_car(cleaf); } else { // Already is a commented leaf, so add the comments to it comments = PTree::snoc(cleaf->get_comments(), comments); cleaf->set_comments(comments); } } } struct Parser::ScopeGuard { template ScopeGuard(Parser &p, T const *s) : parser(p), noop(s == 0), scope_was_valid(p.my_scope_is_valid) { // If s contains a qualified name this may fail, as the name // has to be declared before. We record the error but continune // processing. try { if (!noop) parser.my_symbols.enter_scope(s);} catch (SymbolLookup::Undefined const &e) { std::string filename; unsigned long line = 0; if (e.ptree) line = parser.my_lexer.origin(e.ptree->begin(), filename); parser.my_errors.push_back(new UndefinedSymbol(e.name, filename, line)); parser.my_scope_is_valid = false; noop = true; } } ~ScopeGuard() { if (!noop) parser.my_symbols.leave_scope(); parser.my_scope_is_valid = scope_was_valid; } Parser & parser; bool noop; bool scope_was_valid; }; Parser::StatusGuard::StatusGuard(Parser &p) : my_lexer(p.my_lexer), my_token_mark(my_lexer.save()), my_errors(p.my_errors), my_error_mark(my_errors.size()), my_committed(false) { } Parser::StatusGuard::~StatusGuard() { if (!my_committed) { my_lexer.restore(my_token_mark); my_errors.resize(my_error_mark); } } Parser::Parser(Lexer &lexer, SymbolFactory &symbols, int ruleset) : my_lexer(lexer), my_ruleset(ruleset), my_symbols(symbols), my_scope_is_valid(true), my_comments(0), my_gt_is_operator(true), my_in_template_decl(false) { } Parser::~Parser() { } bool Parser::mark_error() { Trace trace("Parser::mark_error", Trace::PARSING); Token t1, t2; my_lexer.look_ahead(0, t1); my_lexer.look_ahead(1, t2); std::string filename; unsigned long line = my_lexer.origin(t1.ptr, filename); const char *end = t1.ptr; if(t2.type != '\0') end = t2.ptr + t2.length; else if(t1.type != '\0') end = t1.ptr + t1.length; my_errors.push_back(new SyntaxError(filename, line, std::string(t1.ptr, end - t1.ptr))); return my_errors.size() < max_errors; } template bool Parser::declare(T *t) { // If the scope isn't valid, do nothing. if (!my_scope_is_valid) return true; try { my_symbols.declare(t); } catch (SymbolLookup::Undefined const &e) { std::string filename; unsigned long line = 0; if (e.ptree) line = my_lexer.origin(e.ptree->begin(), filename); my_errors.push_back(new UndefinedSymbol(e.name, filename, line)); } catch (SymbolLookup::MultiplyDefined const &e) { std::string file1; unsigned long line1 = my_lexer.origin(e.declaration->begin(), file1); std::string file2; unsigned long line2 = my_lexer.origin(e.original->begin(), file2); my_errors.push_back(new SymbolAlreadyDefined(e.name, file1, line1, file2, line2)); } catch (SymbolLookup::TypeError const &e) { my_errors.push_back(new SymbolTypeMismatch(e.name, e.type)); } return my_errors.size() < max_errors; } unsigned long Parser::origin(const char *ptr, std::string &filename) const { return my_lexer.origin(ptr, filename); } void Parser::show_message_head(const char *pos) { std::string filename; unsigned long line = origin(pos, filename); std::cerr << filename << ':' << line << ": "; } PTree::Node *Parser::parse() { Trace trace("Parser::parse", Trace::PARSING); PTree::Node *statements = 0; while(my_lexer.look_ahead(0) != '\0') { PTree::Node *def; if(definition(def)) { statements = PTree::nconc(statements, PTree::list(def)); } else { if(!mark_error()) return 0; // too many errors skip_to(';'); Token tk; my_lexer.get_token(tk); // ignore ';' } } // Retrieve trailing comments PTree::Node *c = wrap_comments(my_lexer.get_comments()); if (c) { // Use zero-length CommentedAtom as special marker. // Should we define a 'PTree::Comment' atom for those comments that // don't clash with the grammar ? At least that seems less hackish than this: c = new PTree::CommentedAtom(c->begin(), 0, c); statements = PTree::nconc(statements, PTree::list(c)); } return statements; } /* definition : null.declaration | typedef | template.decl | metaclass.decl | linkage.spec | namespace.spec | namespace.alias | using.declaration | extern.template.decl | declaration */ bool Parser::definition(PTree::Node *&p) { Trace trace("Parser::definition", Trace::PARSING); bool res; int t = my_lexer.look_ahead(0); if(t == ';') res = null_declaration(p); else if(t == Token::TYPEDEF) { PTree::Typedef *td; res = typedef_(td); p = td; } else if(t == Token::TEMPLATE) res = template_decl(p); else if(t == Token::METACLASS) res = metaclass_decl(p); else if(t == Token::EXTERN && my_lexer.look_ahead(1) == Token::StringL) res = linkage_spec(p); else if(t == Token::EXTERN && my_lexer.look_ahead(1) == Token::TEMPLATE && my_ruleset & GCC) res = extern_template_decl(p); else if(t == Token::NAMESPACE && my_lexer.look_ahead(2) == '=') { PTree::NamespaceAlias *alias; res = namespace_alias(alias); p = alias; } else if(t == Token::NAMESPACE) { PTree::NamespaceSpec *spec; res = namespace_spec(spec); p = spec; } else if(t == Token::USING) { if (my_lexer.look_ahead(1) == Token::NAMESPACE) { PTree::UsingDirective *udir; res = using_directive(udir); if (res) { declare(udir); p = udir; } } else { PTree::UsingDeclaration *udecl; res = using_declaration(udecl); if (res) { declare(udecl); p = udecl; } } } else { PTree::Declaration *decl; if (!declaration(decl)) return false; PTree::Node *c = wrap_comments(my_lexer.get_comments()); if (c) set_declarator_comments(decl, c); p = decl; declare(decl); return true; } my_lexer.get_comments(); return res; } bool Parser::null_declaration(PTree::Node *&decl) { Trace trace("Parser::null_declaration", Trace::PARSING); Token tk; if(my_lexer.get_token(tk) != ';') return false; decl = new PTree::Declaration(0, PTree::list(0, new PTree::Atom(tk))); return true; } /* typedef : TYPEDEF type.specifier init_declarator_list ';' */ bool Parser::typedef_(PTree::Typedef *&def) { Trace trace("Parser::typedef_", Trace::PARSING); Token tk; PTree::Node *type_name, *decl; PTree::Encoding type_encode; if(my_lexer.get_token(tk) != Token::TYPEDEF) return false; def = new PTree::Typedef(new PTree::Kwd::Typedef(tk)); PTree::Node *comments = wrap_comments(my_lexer.get_comments()); def->set_comments(comments); if(!type_specifier(type_name, false, type_encode)) return false; def = PTree::snoc(def, type_name); if(!init_declarator_list(decl, type_encode, true)) return false; if(my_lexer.get_token(tk) != ';') return false; def = PTree::nconc(def, PTree::list(decl, new PTree::Atom(tk))); declare(def); return true; } /* type.specifier : {cv.qualify} (integral.or.class.spec | name) {cv.qualify} */ bool Parser::type_specifier(PTree::Node *&tspec, bool check, PTree::Encoding &encode) { Trace trace("Parser::type_specifier", Trace::PARSING); PTree::Node *cv_q, *cv_q2; // FIXME: Need to rewrite this to correctly reflect the grammar, in particular // 'typename' ... // Do we need a new node type ('Typename') ? if(!opt_cv_qualifier(cv_q) || !opt_integral_type_or_class_spec(tspec, encode)) return false; if(!tspec) { if(check) { Token tk; my_lexer.look_ahead(0, tk); if(!maybe_typename_or_class_template(tk)) return false; } if(!name(tspec, encode)) return false; } if(!opt_cv_qualifier(cv_q2)) return false; if(cv_q) { tspec = PTree::snoc(cv_q, tspec); if(cv_q2) tspec = PTree::nconc(tspec, cv_q2); } else if(cv_q2) tspec = PTree::cons(tspec, cv_q2); encode.cv_qualify(cv_q, cv_q2); return true; } // is_type_specifier() returns true if the next is probably a type specifier. bool Parser::is_type_specifier() { int t = my_lexer.look_ahead(0); if(t == Token::TYPENAME || t == Token::Identifier || t == Token::Scope || t == Token::CONST || t == Token::VOLATILE || t == Token::CHAR || t == Token::WCHAR || t == Token::INT || t == Token::SHORT || t == Token::LONG || t == Token::SIGNED || t == Token::UNSIGNED || t == Token::FLOAT || t == Token::DOUBLE || t == Token::VOID || t == Token::BOOLEAN || t == Token::CLASS || t == Token::STRUCT || t == Token::UNION || t == Token::ENUM) return true; else if (my_ruleset & MSVC && t == Token::INT64) return true; else return false; } /* metaclass.decl : METACLASS Identifier {{':'} Identifier {'(' meta.arguments ')'}} ';' We allow two kinds of syntax: metaclass (...); metaclass ; metaclass : (...); // for backward compatibility */ bool Parser::metaclass_decl(PTree::Node *&decl) { int t; Token tk1, tk2, tk3, tk4; PTree::Node *metaclass_name; if(my_lexer.get_token(tk1) != Token::METACLASS) return false; if(my_lexer.get_token(tk2) != Token::Identifier) return false; t = my_lexer.get_token(tk3); if(t == Token::Identifier) { metaclass_name = new PTree::Identifier(tk2); decl = new PTree::MetaclassDecl(new PTree::UserKeyword(tk1), PTree::list(metaclass_name, new PTree::Identifier(tk3))); } else if(t == ':') { if(my_lexer.get_token(tk4) != Token::Identifier) return false; metaclass_name = new PTree::Identifier(tk4); decl = new PTree::MetaclassDecl(new PTree::UserKeyword(tk1), PTree::list(metaclass_name, new PTree::Identifier(tk2))); } else if(t == ';') { metaclass_name = new PTree::Identifier(tk2); decl = new PTree::MetaclassDecl(new PTree::UserKeyword(tk1), PTree::list(metaclass_name, 0, new PTree::Atom(tk3))); return true; } else return false; t = my_lexer.get_token(tk1); if(t == '(') { PTree::Node *args; if(!meta_arguments(args)) return false; if(my_lexer.get_token(tk2) != ')') return false; decl = PTree::nconc(decl, PTree::list(new PTree::Atom(tk1), args, new PTree::Atom(tk2))); t = my_lexer.get_token(tk1); } if(t == ';') { decl = PTree::snoc(decl, new PTree::Atom(tk1)); return true; } else return false; } /* meta.arguments : (anything but ')')* */ bool Parser::meta_arguments(PTree::Node *&args) { int t; Token tk; int n = 1; args = 0; while(true) { t = my_lexer.look_ahead(0); if(t == '\0') return false; else if(t == '(') ++n; else if(t == ')') if(--n <= 0) return true; my_lexer.get_token(tk); args = PTree::snoc(args, new PTree::Atom(tk)); } } /* linkage.spec : EXTERN StringL definition | EXTERN StringL linkage.body */ bool Parser::linkage_spec(PTree::Node *&spec) { Trace trace("Parser::linkage_spec", Trace::PARSING); Token tk1, tk2; PTree::Node *body; if(my_lexer.get_token(tk1) != Token::EXTERN) return false; if(my_lexer.get_token(tk2) != Token::StringL) return false; spec = new PTree::LinkageSpec(new PTree::Kwd::Extern(tk1), PTree::list(new PTree::Atom(tk2))); if(my_lexer.look_ahead(0) == '{') { if(!linkage_body(body)) return false; } else if(!definition(body)) return false; spec = PTree::snoc(spec, body); return true; } /* namespace.spec : NAMESPACE Identifier definition | NAMESPACE { Identifier } linkage.body */ bool Parser::namespace_spec(PTree::NamespaceSpec *&spec) { Trace trace("Parser::namespace_spec", Trace::PARSING); Token tk; if(my_lexer.get_token(tk) != Token::NAMESPACE) return false; PTree::Kwd::Namespace *namespace_ = new PTree::Kwd::Namespace(tk); PTree::Node *comments = wrap_comments(my_lexer.get_comments()); PTree::Node *name; if(my_lexer.look_ahead(0) == '{') name = 0; else if(my_lexer.get_token(tk) == Token::Identifier) name = new PTree::Identifier(tk); else return false; spec = new PTree::NamespaceSpec(namespace_, PTree::list(name, 0)); spec->set_comments(comments); PTree::Node *body; if(my_lexer.look_ahead(0) == '{') { declare(spec); ScopeGuard guard(*this, spec); if(!linkage_body(body)) return false; } else if(!definition(body)) return false; PTree::tail(spec, 2)->set_car(body); return true; } /* namespace.alias : NAMESPACE Identifier '=' Identifier ';' */ bool Parser::namespace_alias(PTree::NamespaceAlias *&exp) { Trace trace("Parser::namespace_alias", Trace::PARSING); Token tk; if(my_lexer.get_token(tk) != Token::NAMESPACE) return false; PTree::Node *ns = new PTree::Kwd::Namespace(tk); if (my_lexer.get_token(tk) != Token::Identifier) return false; PTree::Node *alias = new PTree::Identifier(tk); if (my_lexer.get_token(tk) != '=') return false; PTree::Node *eq = new PTree::Atom(tk); PTree::Node *name; PTree::Encoding encode; int length = 0; if(my_lexer.look_ahead(0) == Token::Scope) { my_lexer.get_token(tk); name = PTree::list(new PTree::Atom(tk)); encode.global_scope(); ++length; } else name = 0; while (true) { if (my_lexer.get_token(tk) != Token::Identifier) return false; PTree::Node *n = new PTree::Identifier(tk); encode.simple_name(n); ++length; if(my_lexer.look_ahead(0) == Token::Scope) { my_lexer.get_token(tk); name = PTree::nconc(name, PTree::list(n, new PTree::Atom(tk))); } else { if(name == 0) name = n; else name = PTree::snoc(name, n); if(length > 1) encode.qualified(length); break; } } if (my_lexer.get_token(tk) != ';') return false; exp = new PTree::NamespaceAlias(ns, PTree::list(alias, eq, name, new PTree::Atom(tk))); return true; } /* using.directive : USING NAMESPACE name */ bool Parser::using_directive(PTree::UsingDirective *&udir) { Trace trace("Parser::using_directive", Trace::PARSING); Token tk; if(my_lexer.get_token(tk) != Token::USING) return false; udir = new PTree::UsingDirective(new PTree::Kwd::Using(tk)); if(my_lexer.get_token(tk) != Token::NAMESPACE) return false; udir = PTree::snoc(udir, new PTree::Kwd::Namespace(tk)); PTree::Node *id; PTree::Encoding name_encode; if (!name(id, name_encode)) return false; if (!id->is_atom()) id = new PTree::Name(id, name_encode); else id = new PTree::Name(PTree::list(id), name_encode); udir = PTree::snoc(udir, id); if (my_lexer.get_token(tk) != ';') return false; udir = PTree::snoc(udir, new PTree::Atom(tk)); return true; } /* using.declaration : USING name */ bool Parser::using_declaration(PTree::UsingDeclaration *&udecl) { Trace trace("Parser::user_declaration", Trace::PARSING); Token tk; if(my_lexer.get_token(tk) != Token::USING) return false; PTree::Node *id; PTree::Encoding name_encode; if (!name(id, name_encode)) return false; if (!id->is_atom()) id = new PTree::Name(id, name_encode); else id = new PTree::Name(PTree::list(id), name_encode); udecl = new PTree::UsingDeclaration(new PTree::Kwd::Using(tk), id); if (my_lexer.get_token(tk) != ';') return false; udecl = PTree::snoc(udecl, new PTree::Atom(tk)); return true; } /* linkage.body : '{' (definition)* '}' Note: this is also used to construct namespace.spec */ bool Parser::linkage_body(PTree::Node *&body) { Trace trace("Parser::linkage_body", Trace::PARSING); Token op, cp; PTree::Node *def; if(my_lexer.get_token(op) != '{') return false; body = 0; while(my_lexer.look_ahead(0) != '}') { if(!definition(def)) { if(!mark_error()) return false; // too many errors skip_to('}'); my_lexer.get_token(cp); body = PTree::list(new PTree::Atom(op), 0, new PTree::Atom(cp)); return true; // error recovery } body = PTree::snoc(body, def); } my_lexer.get_token(cp); body = new PTree::Brace(new PTree::Atom(op), body, new PTree::CommentedAtom(cp, wrap_comments(my_lexer.get_comments()))); return true; } /* template.decl : TEMPLATE '<' temp.arg.list '>' declaration | TEMPLATE declaration | TEMPLATE '<' '>' declaration The second case is an explicit template instantiation. declaration must be a class declaration. For example, template class Foo; explicitly instantiates the template Foo with int and char. The third case is a specialization of a template function. declaration must be a function template. For example, template <> int count(String x) { return x.length; } */ bool Parser::template_decl(PTree::Node *&decl) { Trace trace("Parser::template_decl", Trace::PARSING); PTree::Declaration *body; PTree::TemplateDecl *tdecl; TemplateDeclKind kind = tdk_unknown; // If there are comments, they are meant for the declaration, not for the // template parameter lists. PTree::Node *comments = wrap_comments(my_lexer.get_comments()); if(!template_decl2(tdecl, kind)) return false; if (kind == tdk_decl || kind == tdk_specialization) my_in_template_decl = true; my_comments = comments; bool success = declaration(body); my_in_template_decl = false; if (!success) return false; // Repackage the decl and body depending upon what kind of template // declaration was observed. switch (kind) { case tdk_instantiation: // Repackage the decl as a PtreeTemplateInstantiation decl = body; // assumes that decl has the form: [0 [class ...] ;] if (PTree::length(decl) != 3) return false; if (PTree::first(decl) != 0) return false; if (PTree::type_of(PTree::second(decl)) != Token::ntClassSpec) return false; if (*PTree::third(decl) != ';') return false; decl = new PTree::TemplateInstantiation(PTree::second(decl)); break; case tdk_decl: { tdecl = PTree::snoc(tdecl, body); declare(tdecl); decl = tdecl; break; } case tdk_specialization: { tdecl = PTree::snoc(tdecl, body); decl = tdecl; break; } default: throw std::runtime_error("Parser::template_decl(): fatal"); } return true; } bool Parser::template_decl2(PTree::TemplateDecl *&decl, TemplateDeclKind &kind) { Trace trace("Parser::template_decl2", Trace::PARSING); Token tk; PTree::List *params; if(my_lexer.get_token(tk) != Token::TEMPLATE) return false; if(my_lexer.look_ahead(0) != '<') { // template instantiation decl = 0; kind = tdk_instantiation; return true; // ignore TEMPLATE } decl = new PTree::TemplateDecl(new PTree::Kwd::Template(tk)); if(my_lexer.get_token(tk) != '<') return false; decl = PTree::snoc(decl, new PTree::Atom(tk)); { ScopeGuard guard(*this, decl); if(!template_parameter_list(params)) return false; } if(my_lexer.get_token(tk) != '>') return false; // FIXME: Flush any dangling comments, or else they will be attached to // the declared class / function template itself. my_lexer.get_comments(); decl = PTree::nconc(decl, PTree::list(params, new PTree::Atom(tk))); // FIXME: nested TEMPLATE is ignored while (my_lexer.look_ahead(0) == Token::TEMPLATE) { my_lexer.get_token(tk); if(my_lexer.look_ahead(0) != '<') break; my_lexer.get_token(tk); PTree::List *nested = PTree::list(0, 0); ScopeGuard guard(*this, nested); // template parameter list if(!template_parameter_list(params)) return false; if(my_lexer.get_token(tk) != '>') return false; } if (params == 0) kind = tdk_specialization; // template < > declaration else kind = tdk_decl; // template < ... > declaration return true; } //. template-parameter-list: //. template-parameter //. template-parameter-list , template-parameter bool Parser::template_parameter_list(PTree::List *¶ms) { Trace trace("Parser::template_parameter_list", Trace::PARSING); Token tk; PTree::Node *a; // FIXME: '<>' is invalid in this context. This probably belongs into // the production of an explicit specialization. if(my_lexer.look_ahead(0) == '>') { params = 0; return true; } if(!template_parameter(a)) return false; params = PTree::list(a); while(my_lexer.look_ahead(0) == ',') { my_lexer.get_token(tk); params = PTree::snoc(params, new PTree::Atom(tk)); if(!template_parameter(a)) return false; params = PTree::snoc(params, a); } return true; } //. template-parameter: //. type-parameter //. parameter-declaration bool Parser::template_parameter(PTree::Node *&decl) { Trace trace("Parser::template_parameter", Trace::PARSING); PGuard guard(*this, &Parser::my_gt_is_operator); my_gt_is_operator = false; Token::Type type = my_lexer.look_ahead(0); // template template parameter if (type == Token::TEMPLATE) return type_parameter(decl); // possibly a type parameter else if (type == Token::TYPENAME || type == Token::CLASS) { // If the next token is an identifier, and the following // one is ',', '=', or '>', it's a type parameter. type = my_lexer.look_ahead(1); if (type == Token::Identifier) type = my_lexer.look_ahead(2); if (type == ',' || type == '=' || type == '>') return type_parameter(decl); } // It's a non-type parameter. PTree::Encoding encoding; // unused PTree::ParameterDeclaration *pdecl; if (!parameter_declaration(pdecl, encoding)) return false; decl = pdecl; return true; } //. type-parameter: //. class identifier [opt] //. class identifier [opt] = type-id //. typename identifier [opt] //. typename identifier [opt] = type-id //. template < template-parameter-list > class identifier [opt] //. template < template-parameter-list > class identifier [opt] = id-expression bool Parser::type_parameter(PTree::Node *&decl) { Trace trace("Parser::type_parameter", Trace::PARSING); Token::Type type = my_lexer.look_ahead(0); if(type == Token::TYPENAME || type == Token::CLASS) { Token tk; my_lexer.get_token(tk); PTree::Keyword *kwd; if (type == Token::TYPENAME) kwd = new PTree::Kwd::Typename(tk); else kwd = new PTree::Kwd::Class(tk); PTree::Identifier *name = 0; if (my_lexer.look_ahead(0) == Token::Identifier) { my_lexer.get_token(tk); name = new PTree::Identifier(tk); } PTree::TypeParameter *tparam = new PTree::TypeParameter(kwd, PTree::list(name)); if (name) declare(tparam); decl = tparam; type = my_lexer.look_ahead(0); if (type == '=') { my_lexer.get_token(tk); PTree::Encoding name; PTree::Node *default_type; if(!type_id(default_type, name)) return false; default_type = new PTree::Name(default_type, name); decl = PTree::nconc(decl, PTree::list(new PTree::Atom(tk), default_type)); } } else if (type == Token::TEMPLATE) { TemplateDeclKind kind; PTree::TemplateDecl *tdecl; if(!template_decl2(tdecl, kind)) return false; Token tk; if (my_lexer.get_token(tk) != Token::CLASS) return false; PTree::Kwd::Class *class_ = new PTree::Kwd::Class(tk); PTree::Identifier *name = 0; if (my_lexer.look_ahead(0) == Token::Identifier) { my_lexer.get_token(tk); name = new PTree::Identifier(tk); } PTree::ClassSpec *cspec = new PTree::ClassSpec(class_, PTree::cons(name, 0), 0); tdecl = PTree::nconc(tdecl, cspec); PTree::TypeParameter *tparam = new PTree::TypeParameter(tdecl, 0); if (name) declare(tparam); decl = tparam; if(my_lexer.look_ahead(0) == '=') { my_lexer.get_token(tk); PTree::Encoding name; PTree::Node *default_type; if(!type_id(default_type, name)) return false; default_type = new PTree::Name(default_type, name); decl = PTree::nconc(decl, PTree::list(new PTree::Atom(tk), default_type)); } } return true; } //. extern-template-decl: //. extern template declaration bool Parser::extern_template_decl(PTree::Node *&decl) { Trace trace("Parser::extern_template_decl", Trace::PARSING); Token tk1, tk2; PTree::Declaration *body; if(my_lexer.get_token(tk1) != Token::EXTERN) return false; if(my_lexer.get_token(tk2) != Token::TEMPLATE) return false; if(!declaration(body)) return false; decl = new PTree::ExternTemplate(new PTree::Atom(tk1), PTree::list(new PTree::Atom(tk2), body)); return true; } /* declaration : integral.declaration | const.declaration | other.declaration decl.head : {member.spec} {storage.spec} {member.spec} {cv.qualify} integral.declaration : integral.decl.head init_declarator_list (';' | function.body) | integral.decl.head ';' | integral.decl.head ':' expression ';' integral.decl.head : decl.head integral.or.class.spec {cv.qualify} other.declaration : decl.head name {cv.qualify} init_declarator_list (';' | function.body) | decl.head name constructor.decl (';' | function.body) | FRIEND name ';' const.declaration : cv.qualify {'*'} Identifier '=' expression {',' init_declarator_list} ';' Note: if you modify this function, look at declaration.statement, too. Note: this regards a statement like "T (a);" as a constructor declaration. See is_constructor_decl(). */ bool Parser::declaration(PTree::Declaration *&statement) { Trace trace("Parser::declaration", Trace::PARSING); PTree::Node *mem_s, *storage_s, *cv_q, *integral, *head; PTree::Encoding type_encode; int res; if (!my_in_template_decl) my_comments = wrap_comments(my_lexer.get_comments()); PTree::Node *comments = my_comments; if(!opt_member_spec(mem_s) || !opt_storage_spec(storage_s)) return false; if(mem_s == 0) head = 0; else head = mem_s; // mem_s is a list. if(storage_s != 0) head = PTree::snoc(head, storage_s); if(mem_s == 0) { if(opt_member_spec(mem_s)) head = PTree::nconc(head, mem_s); else return false; } if(!opt_cv_qualifier(cv_q) || !opt_integral_type_or_class_spec(integral, type_encode)) return false; if(integral) res = integral_declaration(statement, type_encode, head, integral, cv_q); else { type_encode.clear(); int t = my_lexer.look_ahead(0); if(cv_q != 0 && ((t == Token::Identifier && my_lexer.look_ahead(1) == '=') || t == '*')) res = const_declaration(statement, type_encode, head, cv_q); else res = other_declaration(statement, type_encode, mem_s, cv_q, head); } if (res && statement) { statement->set_comments(comments); my_comments = 0; } return res; } bool Parser::integral_declaration(PTree::Declaration *&statement, PTree::Encoding &type_encode, PTree::Node *head, PTree::Node *integral, PTree::Node *cv_q) { Trace trace("Parser::integral_declaration", Trace::PARSING); Token tk; PTree::Node *cv_q2, *decl; if(!opt_cv_qualifier(cv_q2)) return false; if(cv_q) if(cv_q2 == 0) integral = PTree::snoc(cv_q, integral); else integral = PTree::nconc(cv_q, PTree::cons(integral, cv_q2)); else if(cv_q2 != 0) integral = PTree::cons(integral, cv_q2); type_encode.cv_qualify(cv_q, cv_q2); switch(my_lexer.look_ahead(0)) { case ';' : my_lexer.get_token(tk); statement = new PTree::Declaration(head, PTree::list(integral, new PTree::Atom(tk))); return true; case ':' : // bit field my_lexer.get_token(tk); if(!assign_expr(decl)) return false; decl = PTree::list(PTree::list(new PTree::Atom(tk), decl)); if(my_lexer.get_token(tk) != ';') return false; statement = new PTree::Declaration(head, PTree::list(integral, decl, new PTree::Atom(tk))); return true; default : if(!init_declarator_list(decl, type_encode, true)) return false; if(my_lexer.look_ahead(0) == ';') { my_lexer.get_token(tk); statement = new PTree::Declaration(head, PTree::list(integral, decl, new PTree::Atom(tk))); return true; } else { PTree::FunctionDefinition *def; def = new PTree::FunctionDefinition(head, PTree::list(integral, decl->car())); PTree::Node *comments = wrap_comments(my_lexer.get_comments()); if (comments) set_declarator_comments(def, comments); ScopeGuard guard(*this, def); PTree::Block *body; if(!function_body(body)) return false; if(PTree::length(decl) != 1) return false; statement = PTree::snoc(def, body); return true; } } } bool Parser::const_declaration(PTree::Declaration *&statement, PTree::Encoding&, PTree::Node *head, PTree::Node *cv_q) { Trace trace("Parser::const_declaration", Trace::PARSING); PTree::Node *decl; Token tk; PTree::Encoding type_encode; type_encode.simple_const(); if(!init_declarator_list(decl, type_encode, false)) return false; if(my_lexer.look_ahead(0) != ';') return false; my_lexer.get_token(tk); statement = new PTree::Declaration(head, PTree::list(cv_q, decl, new PTree::Atom(tk))); return true; } bool Parser::other_declaration(PTree::Declaration *&statement, PTree::Encoding &type_encode, PTree::Node *mem_s, PTree::Node *cv_q, PTree::Node *head) { Trace trace("Parser::other_declaration", Trace::PARSING); PTree::Node *type_name, *decl, *cv_q2; Token tk; if(!name(type_name, type_encode)) return false; if(cv_q == 0 && is_constructor_decl()) { ScopeGuard guard(*this, type_name); PTree::Encoding ftype_encode; if(!constructor_decl(decl, ftype_encode)) return false; decl = PTree::list(new PTree::Declarator(type_name, decl, ftype_encode, type_encode, type_name)); type_name = 0; } else if(mem_s != 0 && my_lexer.look_ahead(0) == ';') { // FRIEND name ';' if(PTree::length(mem_s) == 1 && PTree::type_of(mem_s->car()) == Token::FRIEND) { my_lexer.get_token(tk); statement = new PTree::Declaration(head, PTree::list(type_name, new PTree::Atom(tk))); return true; } else return false; } else { if(!opt_cv_qualifier(cv_q2)) return false; if(cv_q) if(cv_q2 == 0) type_name = PTree::snoc(cv_q, type_name); else type_name = PTree::nconc(cv_q, PTree::cons(type_name, cv_q2)); else if(cv_q2) type_name = PTree::cons(type_name, cv_q2); type_encode.cv_qualify(cv_q, cv_q2); if(!init_declarator_list(decl, type_encode, false)) return false; } if(my_lexer.look_ahead(0) == ';') { my_lexer.get_token(tk); statement = new PTree::Declaration(head, PTree::list(type_name, decl, new PTree::Atom(tk))); } else { PTree::FunctionDefinition *def; def = new PTree::FunctionDefinition(head, PTree::list(type_name, decl->car())); PTree::Node *comments = wrap_comments(my_lexer.get_comments()); if (comments) set_declarator_comments(def, comments); ScopeGuard guard(*this, def); PTree::Block *body; if(!function_body(body)) return false; if(PTree::length(decl) != 1) return false; statement = PTree::snoc(def, body); } return true; } /* This returns true for an declaration like: T (a); even if a is not a type name. This is a bug according to the ANSI specification, but I believe none says "T (a);" for a variable declaration. */ bool Parser::is_constructor_decl() { Trace trace("Parser::is_constructor_decl", Trace::PARSING); if(my_lexer.look_ahead(0) != '(') return false; else { int t = my_lexer.look_ahead(1); if(t == '*' || t == '&' || t == '(') return false; // declarator else if(t == Token::CONST || t == Token::VOLATILE) return true; // constructor or declarator else if(is_ptr_to_member(1)) return false; // declarator (::*) else return true; // maybe constructor } } /* ptr.to.member : {'::'} (identifier {'<' any* '>'} '::')+ '*' */ bool Parser::is_ptr_to_member(int i) { int t0 = my_lexer.look_ahead(i++); if(t0 == Token::Scope) t0 = my_lexer.look_ahead(i++); while(t0 == Token::Identifier) { int t = my_lexer.look_ahead(i++); if(t == '<') { int n = 1; while(n > 0) { int u = my_lexer.look_ahead(i++); if(u == '<') ++n; else if(u == '>') --n; else if(u == '(') { int m = 1; while(m > 0) { int v = my_lexer.look_ahead(i++); if(v == '(') ++m; else if(v == ')') --m; else if(v == '\0' || v == ';' || v == '}') return false; } } else if(u == '\0' || u == ';' || u == '}') return false; } t = my_lexer.look_ahead(i++); } if(t != Token::Scope) return false; t0 = my_lexer.look_ahead(i++); if(t0 == '*') return true; } return false; } /* member.spec : (FRIEND | INLINE | VIRTUAL | userdef.keyword)+ */ bool Parser::opt_member_spec(PTree::Node *&p) { Trace trace("Parser::opt_member_spec", Trace::PARSING); Token tk; PTree::Node *lf; int t = my_lexer.look_ahead(0); p = 0; while(t == Token::FRIEND || t == Token::INLINE || t == Token::VIRTUAL || t == Token::UserKeyword5) { if(t == Token::UserKeyword5) { if(!userdef_keyword(lf)) return false; } else { my_lexer.get_token(tk); if(t == Token::INLINE) lf = new PTree::Kwd::Inline(tk); else if(t == Token::VIRTUAL) lf = new PTree::Kwd::Virtual(tk); else lf = new PTree::Kwd::Friend(tk); } p = PTree::snoc(p, lf); t = my_lexer.look_ahead(0); } return true; } //. storage-spec: //. empty //. static //. extern //. auto //. register //. mutable bool Parser::opt_storage_spec(PTree::Node *&p) { Trace trace("Parser::opt_storage_spec", Trace::PARSING); int t = my_lexer.look_ahead(0); if(t == Token::STATIC || t == Token::EXTERN || t == Token::AUTO || t == Token::REGISTER || t == Token::MUTABLE) { Token tk; my_lexer.get_token(tk); switch(t) { case Token::STATIC : p = new PTree::Kwd::Static(tk); break; case Token::EXTERN : p = new PTree::Kwd::Extern(tk); break; case Token::AUTO : p = new PTree::Kwd::Auto(tk); break; case Token::REGISTER : p = new PTree::Kwd::Register(tk); break; case Token::MUTABLE : p = new PTree::Kwd::Mutable(tk); break; default : throw std::runtime_error("opt_storage_spec: fatal"); } } else p = 0; // no storage specifier return true; } //. cv-qualifier: //. empty //. const //. volatile bool Parser::opt_cv_qualifier(PTree::Node *&cv) { Trace trace("Parser::opt_cv_qualifier", Trace::PARSING); PTree::Node *p = 0; while(true) { int t = my_lexer.look_ahead(0); if(t == Token::CONST || t == Token::VOLATILE) { Token tk; my_lexer.get_token(tk); switch(t) { case Token::CONST : p = PTree::snoc(p, new PTree::Kwd::Const(tk)); break; case Token::VOLATILE : p = PTree::snoc(p, new PTree::Kwd::Volatile(tk)); break; default : throw std::runtime_error("opt_cv_qualifier: fatal"); } } else break; } cv = p; return true; } /* integral.or.class.spec : (CHAR | WCHAR | INT | SHORT | LONG | SIGNED | UNSIGNED | FLOAT | DOUBLE | VOID | BOOLEAN)+ | class.spec | enum.spec Note: if editing this, see also is_type_specifier(). */ bool Parser::opt_integral_type_or_class_spec(PTree::Node *&p, PTree::Encoding& encode) { Trace trace("Parser::opt_integral_type_or_class_spec", Trace::PARSING); bool is_integral; int t; char type = ' ', flag = ' '; is_integral = false; p = 0; while(true) { t = my_lexer.look_ahead(0); if(t == Token::CHAR || t == Token::WCHAR || t == Token::INT || t == Token::SHORT || t == Token::LONG || t == Token::SIGNED || t == Token::UNSIGNED || t == Token::FLOAT || t == Token::DOUBLE || t == Token::VOID || t == Token::BOOLEAN || (my_ruleset & MSVC && t == Token::INT64)) { Token tk; PTree::Node *kw; my_lexer.get_token(tk); switch(t) { case Token::CHAR: type = 'c'; kw = new PTree::Kwd::Char(tk); break; case Token::WCHAR: type = 'w'; kw = new PTree::Kwd::WChar(tk); break; case Token::INT: case Token::INT64: // an int64 is *NOT* an int but... if(type != 's' && type != 'l' && type != 'j' && type != 'r') type = 'i'; kw = new PTree::Kwd::Int(tk); break; case Token::SHORT: type = 's'; kw = new PTree::Kwd::Short(tk); break; case Token::LONG: if(type == 'l') type = 'j'; // long long else if(type == 'd') type = 'r'; // double long else type = 'l'; kw = new PTree::Kwd::Long(tk); break; case Token::SIGNED: flag = 'S'; kw = new PTree::Kwd::Signed(tk); break; case Token::UNSIGNED: flag = 'U'; kw = new PTree::Kwd::Unsigned(tk); break; case Token::FLOAT: type = 'f'; kw = new PTree::Kwd::Float(tk); break; case Token::DOUBLE: if(type == 'l') type = 'r'; // long double else type = 'd'; kw = new PTree::Kwd::Double(tk); break; case Token::VOID: type = 'v'; kw = new PTree::Kwd::Void(tk); break; case Token::BOOLEAN: type = 'b'; kw = new PTree::Kwd::Bool(tk); break; default : throw std::runtime_error("Parser::opt_integral_type_or_class_spec(): fatal"); } p = PTree::snoc(p, kw); is_integral = true; } else break; } if(is_integral) { if(flag == 'S' && type != 'c') flag = ' '; if(flag != ' ') encode.append(flag); if(type == ' ') type = 'i'; // signed, unsigned encode.append(type); return true; } if(t == Token::TYPENAME || // FIXME: 'typename' doesn't imply a class spec ! t == Token::CLASS || t == Token::STRUCT || t == Token::UNION || t == Token::UserKeyword) { PTree::ClassSpec *spec; bool success = class_spec(spec, encode); p = spec; return success; } else if(t == Token::ENUM) { PTree::EnumSpec *spec; bool success = enum_spec(spec, encode); p = spec; return success; } else { p = 0; return true; } } /* constructor.decl : '(' {arg.decl.list} ')' {cv.qualify} {throw.decl} {member.initializers} {'=' Constant} */ bool Parser::constructor_decl(PTree::Node *&constructor, PTree::Encoding& encode) { Trace trace("Parser::constructor_decl", Trace::PARSING); Token op, cp; PTree::Node *args, *cv, *throw_decl, *mi; if(my_lexer.get_token(op) != '(') return false; if(my_lexer.look_ahead(0) == ')') { args = 0; encode.start_func_args(); encode.void_(); encode.end_func_args(); } else if(!parameter_declaration_list(args, encode)) return false; my_lexer.get_token(cp); constructor = PTree::list(new PTree::Atom(op), args, new PTree::Atom(cp)); opt_cv_qualifier(cv); if(cv) { encode.cv_qualify(cv); constructor = PTree::nconc(constructor, cv); } opt_throw_decl(throw_decl); // ignore in this version if(my_lexer.look_ahead(0) == ':') { if(member_initializers(mi)) constructor = PTree::snoc(constructor, mi); else return false; } if(my_lexer.look_ahead(0) == '=') { Token eq, zero; my_lexer.get_token(eq); if(my_lexer.get_token(zero) != Token::Constant) return false; constructor = PTree::nconc(constructor, PTree::list(new PTree::Atom(eq), new PTree::Atom(zero))); } encode.no_return_type(); return true; } /* throw.decl : THROW '(' (name {','})* {name} ')' */ bool Parser::opt_throw_decl(PTree::Node *&throw_decl) { Trace trace("Parser::opt_throw_decl", Trace::PARSING); Token tk; int t; PTree::Node *p = 0; if(my_lexer.look_ahead(0) == Token::THROW) { my_lexer.get_token(tk); p = PTree::snoc(p, new PTree::Kwd::Throw(tk)); if(my_lexer.get_token(tk) != '(') return false; p = PTree::snoc(p, new PTree::Atom(tk)); while(true) { PTree::Node *q; PTree::Encoding encode; t = my_lexer.look_ahead(0); if(t == '\0') return false; else if(t == ')') break; else if(my_ruleset & MSVC && t == Token::Ellipsis) { // for MSVC compatibility we accept 'throw(...)' declarations my_lexer.get_token(tk); p = PTree::snoc(p, new PTree::Atom(tk)); } else if(name(q, encode)) p = PTree::snoc(p, q); else return false; if(my_lexer.look_ahead(0) == ','){ my_lexer.get_token(tk); p = PTree::snoc(p, new PTree::Atom(tk)); } else break; } if(my_lexer.get_token(tk) != ')') return false; p = PTree::snoc(p, new PTree::Atom(tk)); } throw_decl = p; return true; } /* init-declarator-list : init-declarator (',' init-declarator)* is_statement changes the behavior of rArgDeclListOrInit(). */ bool Parser::init_declarator_list(PTree::Node *&decls, PTree::Encoding& type_encode, bool should_be_declarator, bool is_statement) { Trace trace("Parser::init_declarator_list", Trace::PARSING); PTree::Node *d; Token tk; PTree::Encoding encode; decls = 0; while(true) { my_lexer.look_ahead(0); // force comment finding PTree::Node *comments = wrap_comments(my_lexer.get_comments()); encode = type_encode; if(!init_declarator(d, encode, should_be_declarator, is_statement)) return false; if (d && (PTree::type_of(d) == Token::ntDeclarator)) static_cast(d)->set_comments(comments); decls = PTree::snoc(decls, d); if(my_lexer.look_ahead(0) == ',') { my_lexer.get_token(tk); decls = PTree::snoc(decls, new PTree::Atom(tk)); } else return true; }; } /* init-declarator : ':' expression | declarator {'=' initialize.expr | ':' expression} */ bool Parser::init_declarator(PTree::Node *&dw, PTree::Encoding& type_encode, bool should_be_declarator, bool is_statement) { Trace trace("Parser::init_declarator", Trace::PARSING); Token tk; PTree::Encoding name_encode; // FIXME: This is only valid for a member-declarator. // Put it into a separate method. if(my_lexer.look_ahead(0) == ':') { // bit field my_lexer.get_token(tk); PTree::Node *expr; if(!assign_expr(expr)) return false; // FIXME: why is this a list and not a PTree::Declarator ? dw = PTree::list(new PTree::Atom(tk), expr); return true; } else { PTree::Node *decl; if(!declarator(decl, kDeclarator, false, type_encode, name_encode, should_be_declarator, is_statement)) return false; int t = my_lexer.look_ahead(0); if(t == '=') { my_lexer.get_token(tk); PTree::Node *expr; if(!initialize_expr(expr)) return false; dw = PTree::nconc(decl, PTree::list(new PTree::Atom(tk), expr)); return true; } else if(t == ':') { // bit field my_lexer.get_token(tk); PTree::Node *expr; if(!assign_expr(expr)) return false; dw = PTree::nconc(decl, PTree::list(new PTree::Atom(tk), expr)); return true; } else { dw = decl; return true; } } } /* declarator : (ptr.operator)* (name | '(' declarator ')') ('[' expression ']')* {func.args.or.init} func.args.or.init : '(' arg.decl.list.or.init ')' {cv.qualify} {throw.decl} {member.initializers} Note: We assume that '(' declarator ')' is followed by '(' or '['. This is to avoid accepting a function call F(x) as a pair of a type F and a declarator x. This assumption is ignored if should_be_declarator is true. Note: An argument declaration list and a function-style initializer take a different Ptree structure. e.g. int f(char) ==> .. [f ( [[[char] 0]] )] Point f(1) ==> .. [f [( [1] )]] Note: is_statement changes the behavior of rArgDeclListOrInit(). */ bool Parser::declarator(PTree::Node *&decl, DeclKind kind, bool recursive, PTree::Encoding& type_encode, PTree::Encoding& name_encode, bool should_be_declarator, bool is_statement) { Trace trace("Parser::declarator", Trace::PARSING); return declarator2(decl, kind, recursive, type_encode, name_encode, should_be_declarator, is_statement, 0); } bool Parser::declarator2(PTree::Node *&decl, DeclKind kind, bool recursive, PTree::Encoding& type_encode, PTree::Encoding& name_encode, bool should_be_declarator, bool is_statement, PTree::Node **declared_name) { Trace trace("Parser::declarator2", Trace::PARSING); PTree::Encoding recursive_encode; int t; bool recursive_decl = false; PTree::Node *declared_name0 = 0; if(declared_name == 0) declared_name = &declared_name0; PTree::Node *d; if(!opt_ptr_operator(d, type_encode)) return false; t = my_lexer.look_ahead(0); if(t == '(') { char const * lex_save = my_lexer.save(); Token op; my_lexer.get_token(op); recursive_decl = true; PTree::Node *decl2; if(!declarator2(decl2, kind, true, recursive_encode, name_encode, true, false, declared_name)) return false; Token cp; if(my_lexer.get_token(cp) != ')') { if (kind != kCastDeclarator) return false; my_lexer.restore(lex_save); name_encode.clear(); } else { if(!should_be_declarator) if(kind == kDeclarator && d == 0) { t = my_lexer.look_ahead(0); if(t != '[' && t != '(') return false; } d = PTree::snoc(d, PTree::list(new PTree::Atom(op), decl2, new PTree::Atom(cp))); } } else if(kind != kCastDeclarator) { if (t == Token::INLINE) { // TODO: store inline somehow Token i; my_lexer.get_token(i); t = my_lexer.look_ahead(0); } if (kind == kDeclarator || t == Token::Identifier || t == Token::Scope) { // if this is an argument declarator, "int (*)()" is valid. PTree::Node *id; if(name(id, name_encode)) d = PTree::snoc(d, id); else return false; *declared_name = id; } } else name_encode.clear(); // empty while(true) { t = my_lexer.look_ahead(0); if(t == '(') { // function PTree::Encoding args_encode; PTree::Node *args, *cv, *throw_decl, *mi; bool is_args = true; Token op; my_lexer.get_token(op); ScopeGuard guard(*this, d); if(my_lexer.look_ahead(0) == ')') { args = 0; args_encode.start_func_args(); args_encode.void_(); args_encode.end_func_args(); } else if(!parameter_declaration_list_or_init(args, is_args, args_encode, is_statement)) return false; Token cp; if(my_lexer.get_token(cp) != ')') return false; if(is_args) { d = PTree::nconc(d, PTree::list(new PTree::Atom(op), args, new PTree::Atom(cp))); opt_cv_qualifier(cv); if(cv) { args_encode.cv_qualify(cv); d = PTree::nconc(d, cv); } } else d = PTree::snoc(d, PTree::list(new PTree::Atom(op), args, new PTree::Atom(cp))); if(!args_encode.empty()) type_encode.function(args_encode); opt_throw_decl(throw_decl); // ignore in this version if(my_lexer.look_ahead(0) == ':') { if(member_initializers(mi)) d = PTree::snoc(d, mi); else return false; } break; // "T f(int)(char)" is invalid. } else if(t == '[') { // array Token ob, cb; PTree::Node *expr; my_lexer.get_token(ob); if(my_lexer.look_ahead(0) == ']') expr = 0; else if(!expression(expr)) return false; if(my_lexer.get_token(cb) != ']') return false; if (expr) { long size; if (TypeAnalysis::evaluate_const(my_symbols.current_scope(), expr, size)) type_encode.array(size); else type_encode.array(); } d = PTree::nconc(d, PTree::list(new PTree::Atom(ob), expr, new PTree::Atom(cb))); } else break; } if(recursive_decl) type_encode.recursion(recursive_encode); if(recursive) decl = d; else { if (name_encode.empty()) name_encode = PTree::Encoding(); if(d == 0) decl = new PTree::Declarator(type_encode, name_encode, *declared_name); else decl = new PTree::Declarator(d, type_encode, name_encode, *declared_name); } return true; } /* ptr.operator : (('*' | '&' | ptr.to.member) {cv.qualify})+ */ bool Parser::opt_ptr_operator(PTree::Node *&ptrs, PTree::Encoding& encode) { Trace trace("Parser::opt_ptr_operator", Trace::PARSING); ptrs = 0; while(true) { int t = my_lexer.look_ahead(0); if(t != '*' && t != '&' && !is_ptr_to_member(0)) break; else { PTree::Node *op, *cv; if(t == '*' || t == '&') { Token tk; my_lexer.get_token(tk); op = new PTree::Atom(tk); encode.ptr_operator(t); } else if(!ptr_to_member(op, encode)) return false; ptrs = PTree::snoc(ptrs, op); opt_cv_qualifier(cv); if(cv) { ptrs = PTree::nconc(ptrs, cv); encode.cv_qualify(cv); } } } return true; } /* member.initializers : ':' member.init (',' member.init)* */ bool Parser::member_initializers(PTree::Node *&init) { Trace trace("Parser::member_initializer", Trace::PARSING); Token tk; PTree::Node *m; if(my_lexer.get_token(tk) != ':') return false; init = PTree::list(new PTree::Atom(tk)); if(!member_init(m)) return false; init = PTree::snoc(init, m); while(my_lexer.look_ahead(0) == ',') { my_lexer.get_token(tk); init = PTree::snoc(init, new PTree::Atom(tk)); if(!member_init(m)) return false; init = PTree::snoc(init, m); } return true; } /* member.init : name '(' function.arguments ')' */ bool Parser::member_init(PTree::Node *&init) { Trace trace("Parser::member_init", Trace::PARSING); PTree::Node *name, *args; Token tk1, tk2; PTree::Encoding encode; if(!this->name(name, encode)) return false; if(!name->is_atom()) name = new PTree::Name(name, encode); if(my_lexer.get_token(tk1) != '(') return false; if(!function_arguments(args)) return false; if(my_lexer.get_token(tk2) != ')') return false; init = PTree::list(name, new PTree::Atom(tk1), args, new PTree::Atom(tk2)); return true; } /* name : {'::'} name2 ('::' name2)* name2 : Identifier {template.args} | '~' Identifier | OPERATOR operator.name {template.args} Don't use this function for parsing an expression It always regards '<' as the beginning of template arguments. */ bool Parser::name(PTree::Node *&id, PTree::Encoding& encode) { Trace trace("Parser::name", Trace::PARSING); Token tk, tk2; int t; int length = 0; if(my_lexer.look_ahead(0) == Token::Scope) { my_lexer.get_token(tk); id = PTree::list(new PTree::Atom(tk)); encode.global_scope(); ++length; } else { id = 0; // gcc keyword typeof(name) means type of the given name if(my_lexer.look_ahead(0) == Token::TYPEOF) { // TODO: Do proper type analysis. encode.anonymous(); return typeof_expr(id); } } while(true) { t = my_lexer.get_token(tk); if(t == Token::TEMPLATE) { // Skip template token, next will be identifier t = my_lexer.get_token(tk); } if(t == Token::Identifier) { PTree::Node *n = new PTree::Identifier(tk); t = my_lexer.look_ahead(0); if(t == '<') { PTree::Node *args; PTree::Encoding args_encode; if(!template_args(args, args_encode)) return false; encode.template_(n, args_encode); ++length; n = PTree::list(n, args); t = my_lexer.look_ahead(0); } else { encode.simple_name(n); ++length; } if(t == Token::Scope) { my_lexer.get_token(tk); id = PTree::nconc(id, PTree::list(n, new PTree::Atom(tk))); } else { id = id ? PTree::snoc(id, n) : n; if(length > 1) encode.qualified(length); return true; } } else if(t == '~') { if(my_lexer.look_ahead(0) != Token::Identifier) return false; my_lexer.get_token(tk2); PTree::Node *class_name = new PTree::Atom(tk2); PTree::Node *dt = PTree::list(new PTree::Atom(tk), class_name); id = id ? PTree::snoc(id, dt) : dt; encode.destructor(class_name); if(length > 0) encode.qualified(length + 1); return true; } else if(t == Token::OPERATOR) { PTree::Node *op; PTree::Node *opf; if(!operator_name(op, encode)) return false; t = my_lexer.look_ahead(0); if(t != '<') opf = PTree::list(new PTree::Kwd::Operator(tk), op); else { PTree::Node *args; PTree::Encoding args_encode; if(!template_args(args, args_encode)) return false; // here, I must merge args_encode into encode. // I'll do it in future. :p opf = PTree::list(new PTree::Kwd::Operator(tk), op, args); } id = id ? PTree::snoc(id, opf) : opf; if(length > 0) encode.qualified(length + 1); return true; } else return false; } } /* operator.name : '+' | '-' | '*' | '/' | '%' | '^' | '&' | '|' | '~' | '!' | '=' | '<' | '>' | AssignOp | ShiftOp | EqualOp | RelOp | LogAndOp | LogOrOp | IncOp | ',' | PmOp | ArrowOp | NEW {'[' ']'} | DELETE {'[' ']'} | '(' ')' | '[' ']' | cast.operator.name */ bool Parser::operator_name(PTree::Node *&name, PTree::Encoding &encode) { Trace trace("Parser::operator_name", Trace::PARSING); Token tk; int t = my_lexer.look_ahead(0); if(t == '+' || t == '-' || t == '*' || t == '/' || t == '%' || t == '^' || t == '&' || t == '|' || t == '~' || t == '!' || t == '=' || t == '<' || t == '>' || t == Token::AssignOp || t == Token::ShiftOp || t == Token::EqualOp || t == Token::RelOp || t == Token::LogAndOp || t == Token::LogOrOp || t == Token::IncOp || t == ',' || t == Token::PmOp || t == Token::ArrowOp) { my_lexer.get_token(tk); name = new PTree::Atom(tk); encode.simple_name(name); return true; } else if(t == Token::NEW || t == Token::DELETE) { my_lexer.get_token(tk); if(my_lexer.look_ahead(0) != '[') { if (t == Token::NEW) name = new PTree::Kwd::New(tk); else name = new PTree::Kwd::Delete(tk); encode.simple_name(name); return true; } else { if (t == Token::NEW) name = PTree::list(new PTree::Kwd::New(tk)); else name = PTree::list(new PTree::Kwd::Delete(tk)); my_lexer.get_token(tk); name = PTree::snoc(name, new PTree::Atom(tk)); if(my_lexer.get_token(tk) != ']') return false; name = PTree::snoc(name, new PTree::Atom(tk)); if(t == Token::NEW) encode.append_with_length("new[]", 5); else encode.append_with_length("delete[]", 8); return true; } } else if(t == '(') { my_lexer.get_token(tk); name = PTree::list(new PTree::Atom(tk)); if(my_lexer.get_token(tk) != ')') return false; encode.append_with_length("()", 2); name = PTree::snoc(name, new PTree::Atom(tk)); return true; } else if(t == '[') { my_lexer.get_token(tk); name = PTree::list(new PTree::Atom(tk)); if(my_lexer.get_token(tk) != ']') return false; encode.append_with_length("[]", 2); name = PTree::snoc(name, new PTree::Atom(tk)); return true; } else return cast_operator_name(name, encode); return false; } /* cast.operator.name : {cv.qualify} (integral.or.class.spec | name) {cv.qualify} {(ptr.operator)*} */ bool Parser::cast_operator_name(PTree::Node *&name, PTree::Encoding &encode) { Trace trace("Parser::cast_operator_name", Trace::PARSING); PTree::Node *cv1, *cv2, *type_name, *ptr; PTree::Encoding type_encode; if(!opt_cv_qualifier(cv1)) return false; if(!opt_integral_type_or_class_spec(type_name, type_encode)) return false; if(type_name == 0) { type_encode.clear(); if(!this->name(type_name, type_encode)) return false; } if(!opt_cv_qualifier(cv2)) return false; if(cv1) if(cv2 == 0) type_name = PTree::snoc(cv1, type_name); else type_name = PTree::nconc(cv1, PTree::cons(type_name, cv2)); else if(cv2) type_name = PTree::cons(type_name, cv2); type_encode.cv_qualify(cv1, cv2); if(!opt_ptr_operator(ptr, type_encode)) return false; encode.cast_operator(type_encode); if(ptr == 0) { name = type_name; return true; } else { name = PTree::list(type_name, ptr); return true; } } /* ptr.to.member : {'::'} (identifier {template.args} '::')+ '*' */ bool Parser::ptr_to_member(PTree::Node *&ptr_to_mem, PTree::Encoding &encode) { Trace trace("Parser::ptr_to_member", Trace::PARSING); Token tk; PTree::Node *p, *n; PTree::Encoding pm_encode; int length = 0; if(my_lexer.look_ahead(0) == Token::Scope) { my_lexer.get_token(tk); p = PTree::list(new PTree::Atom(tk)); pm_encode.global_scope(); ++length; } else p = 0; while(true) { if(my_lexer.get_token(tk) == Token::Identifier) n = new PTree::Atom(tk); else return false; int t = my_lexer.look_ahead(0); if(t == '<') { PTree::Node *args; PTree::Encoding args_encode; if(!template_args(args, args_encode)) return false; pm_encode.template_(n, args_encode); ++length; n = PTree::list(n, args); t = my_lexer.look_ahead(0); } else { pm_encode.simple_name(n); ++length; } if(my_lexer.get_token(tk) != Token::Scope) return false; p = PTree::nconc(p, PTree::list(n, new PTree::Atom(tk))); if(my_lexer.look_ahead(0) == '*') { my_lexer.get_token(tk); p = PTree::snoc(p, new PTree::Atom(tk)); break; } } ptr_to_mem = p; encode.ptr_to_member(pm_encode, length); return true; } /* template.args : '<' '>' | '<' template.argument {',' template.argument} '>' template.argument : type.name | conditional.expr */ bool Parser::template_args(PTree::Node *&temp_args, PTree::Encoding &encode) { Trace trace("Parser::template_args", Trace::PARSING); Token tk1, tk2; PTree::Encoding type_encode; if(my_lexer.get_token(tk1) != '<') return false; // in case of Foo<> if(my_lexer.look_ahead(0) == '>') { my_lexer.get_token(tk2); temp_args = PTree::list(new PTree::Atom(tk1), new PTree::Atom(tk2)); return true; } PTree::Node *args = 0; while(true) { PTree::Node *a; const char* pos = my_lexer.save(); type_encode.clear(); // Prefer type name, but if not ',' or '>' then must be expression if(type_id(a, type_encode) && (my_lexer.look_ahead(0) == ',' || my_lexer.look_ahead(0) == '>')) encode.append(type_encode); else { // FIXME: find the right place to put this. PGuard guard(*this, &Parser::my_gt_is_operator); my_gt_is_operator = false; my_lexer.restore(pos); if(!conditional_expr(a)) return false; encode.value_temp_param(); } args = PTree::snoc(args, a); switch(my_lexer.get_token(tk2)) { case '>' : temp_args = PTree::list(new PTree::Atom(tk1), args, new PTree::Atom(tk2)); return true; case ',' : args = PTree::snoc(args, new PTree::Atom(tk2)); break; case Token::ShiftOp : // parse error ! return false; default : return false; } } } /* arg.decl.list.or.init : para.decl.list | function.arguments This rule accepts function.arguments to parse declarations like: Point p(1, 3); "(1, 3)" is arg.decl.list.or.init. If maybe_init is true, we first examine whether tokens construct function.arguments. This ordering is significant if tokens are Point p(s, t); s and t can be type names or variable names. */ bool Parser::parameter_declaration_list_or_init(PTree::Node *&arglist, bool &is_args, PTree::Encoding &encode, bool maybe_init) { Trace trace("Parser::parameter_declaration_list_or_init", Trace::PARSING); const char* pos = my_lexer.save(); if(maybe_init) { if(function_arguments(arglist)) if(my_lexer.look_ahead(0) == ')') { is_args = false; encode.clear(); return true; } my_lexer.restore(pos); return(is_args = parameter_declaration_list(arglist, encode)); } else { if((is_args = parameter_declaration_list(arglist, encode))) return true; else { my_lexer.restore(pos); encode.clear(); return function_arguments(arglist); } } } /* para.decl.list : empty | arg.declaration ( ',' arg.declaration )* {{ ',' } Ellipses} */ bool Parser::parameter_declaration_list(PTree::Node *&arglist, PTree::Encoding& encode) { Trace trace("Parser::parameter_declaration_list", Trace::PARSING); PTree::Node *list = 0; PTree::Encoding arg_encode; encode.start_func_args(); while(true) { PTree::ParameterDeclaration *pdecl; arg_encode.clear(); int t = my_lexer.look_ahead(0); if(t == ')') { if(list == 0) encode.void_(); arglist = list; break; } else if(t == Token::Ellipsis) { Token tk; my_lexer.get_token(tk); encode.ellipsis_arg(); arglist = PTree::snoc(list, new PTree::Atom(tk)); break; } else if (my_lexer.look_ahead(0) == Token::VOID && my_lexer.look_ahead(1) == ')') { Token tk; my_lexer.get_token(tk); arglist = PTree::snoc(list, new PTree::Atom(tk)); break; } else if(parameter_declaration(pdecl, arg_encode)) { encode.append(arg_encode); list = PTree::snoc(list, pdecl); t = my_lexer.look_ahead(0); if(t == ',') { Token tk; my_lexer.get_token(tk); list = PTree::snoc(list, new PTree::Atom(tk)); } else if(t != ')' && t != Token::Ellipsis) return false; } else { arglist = 0; return false; } } encode.end_func_args(); return true; } //. parameter-declaration: //. decl-specifier-seq declarator //. decl-specifier-seq declarator = assignment-expression //. decl-specifier-seq abstract-declarator [opt] //. decl-specifier-seq abstract-declarator [opt] = assignment-expression bool Parser::parameter_declaration(PTree::ParameterDeclaration *¶, PTree::Encoding &encode) { Trace trace("Parser::parameter_declaration", Trace::PARSING); PTree::Node *header; Token tk; PTree::Encoding name_encode; switch(my_lexer.look_ahead(0)) { case Token::REGISTER: my_lexer.get_token(tk); header = new PTree::Kwd::Register(tk); break; case Token::UserKeyword: if(!userdef_keyword(header)) return false; break; default: header = 0; break; } PTree::Node *type_name; if(!type_specifier(type_name, true, encode)) return false; PTree::Node *decl; if(!declarator(decl, kArgDeclarator, false, encode, name_encode, true)) return false; para = new PTree::ParameterDeclaration(header, type_name, decl); declare(para); Token::Type type = my_lexer.look_ahead(0); if(type == '=') { my_lexer.get_token(tk); PTree::Node *init; if(!initialize_expr(init)) return false; decl = PTree::nconc(decl, PTree::list(new PTree::Atom(tk), init)); } return true; } // designation: // designator-list = // designator-list: // designator // designator-list designator // designator: // [ constant-expression ] // . identifier bool Parser::designation(PTree::Node *&d) { Trace trace("Parser::designation", Trace::PARSING); Token::Type token = my_lexer.look_ahead(0); while (token == '.' || token == '[') { Token tk; my_lexer.get_token(tk); if (token == '.') { // . identifier Token id; my_lexer.get_token(id); if(id.type != Token::Identifier) return false; d = PTree::nconc(d, PTree::list(new PTree::Atom(tk), new PTree::Identifier(id))); } else { // [ constant-expression ] // [ expression ... expression ] (GNU Extension) PTree::Node *e; if (!expression(e)) return false; d = PTree::nconc(d, PTree::list(new PTree::Atom(tk), e)); if (my_lexer.look_ahead(0) == Token::Ellipsis && my_ruleset & GCC) { Token ellipsis; my_lexer.get_token(ellipsis); PTree::Node *e2; if (!expression(e2)) return false; d = PTree::nconc(d, PTree::list(new PTree::Atom(ellipsis), e2)); } if (my_lexer.look_ahead(0) != ']') return false; Token cp; my_lexer.get_token(cp); d = PTree::nconc(d, PTree::list(new PTree::Atom(cp))); } token = my_lexer.look_ahead(0); } if (token != '=') return false; Token eq; my_lexer.get_token(eq); d = PTree::nconc(d, PTree::list(new PTree::Atom(eq))); return true; } /* initialize.expr : expression | '{' initialize.expr (',' initialize.expr)* {','} '}' */ bool Parser::initialize_expr(PTree::Node *&exp) { Trace trace("Parser::initialize_expr", Trace::PARSING); Token tk; PTree::Node *e, *elist; if(my_lexer.look_ahead(0) != '{') return assign_expr(exp); else { my_lexer.get_token(tk); PTree::Node *ob = new PTree::Atom(tk); elist = 0; int t = my_lexer.look_ahead(0); while(t != '}') { PTree::Node *d = 0; // as a GCC extension, this syntax is also permitted in C++ if ((!(my_ruleset & CXX) || my_ruleset & GCC) && (t == '.' || t == '[') && !designation(d)) return false; // else it might be an old GCC extension: 'fieldname: initializer' if ((!(my_ruleset & CXX) || my_ruleset & GCC) && !d && t == Token::Identifier && my_lexer.look_ahead(1) == ':') { Token id; my_lexer.get_token(id); Token colon; my_lexer.get_token(colon); d = PTree::nconc(d, PTree::list(new PTree::Identifier(id), new PTree::Atom(colon))); if (!assign_expr(e)) return false; } else if(!initialize_expr(e)) { if(!mark_error()) return false; // too many errors skip_to('}'); my_lexer.get_token(tk); exp = PTree::list(ob, 0, new PTree::Atom(tk)); return true; // error recovery } elist = PTree::snoc(elist, d ? PTree::nconc(d, PTree::list(e)) : e); t = my_lexer.look_ahead(0); if(t == '}') break; else if(t == ',') { my_lexer.get_token(tk); elist = PTree::snoc(elist, new PTree::Atom(tk)); t = my_lexer.look_ahead(0); } else { if(!mark_error()) return false; // too many errors skip_to('}'); my_lexer.get_token(tk); exp = PTree::list(ob, 0, new PTree::Atom(tk)); return true; // error recovery } } my_lexer.get_token(tk); exp = new PTree::Brace(ob, elist, new PTree::Atom(tk)); return true; } } /* function.arguments : empty | expression (',' expression)* This assumes that the next token following function.arguments is ')'. */ bool Parser::function_arguments(PTree::Node *&args) { Trace trace("Parser::function_arguments", Trace::PARSING); PTree::Node *exp; Token tk; args = 0; if(my_lexer.look_ahead(0) == ')') return true; while(true) { if(!assign_expr(exp)) return false; args = PTree::snoc(args, exp); if(my_lexer.look_ahead(0) != ',') return true; else { my_lexer.get_token(tk); args = PTree::snoc(args, new PTree::Atom(tk)); } } } /* enum.spec : ENUM Identifier | ENUM {Identifier} '{' {enum.body} '}' */ bool Parser::enum_spec(PTree::EnumSpec *&spec, PTree::Encoding &encode) { Trace trace("Parser::enum_spec", Trace::PARSING); Token tk, tk2; PTree::Node *body; if(my_lexer.get_token(tk) != Token::ENUM) return false; spec = new PTree::EnumSpec(new PTree::Kwd::Enum(tk)); int t = my_lexer.get_token(tk); if(t == Token::Identifier) { PTree::Identifier *name = new PTree::Identifier(tk); encode.simple_name((PTree::Node*)name); spec->set_encoded_name(encode); spec = PTree::snoc(spec, name); if(my_lexer.look_ahead(0) == '{') t = my_lexer.get_token(tk); else return true; } else { encode.anonymous(); spec->set_encoded_name(encode); spec = PTree::snoc(spec, 0); } if(t != '{') return false; if(my_lexer.look_ahead(0) == '}') body = 0; else if(!enum_body(body)) return false; if(my_lexer.get_token(tk2) != '}') return false; spec = PTree::snoc(spec, new PTree::Brace(new PTree::Atom(tk), body, new PTree::CommentedAtom(tk2, wrap_comments(my_lexer.get_comments())))); declare(spec); return true; } /* enum.body : Identifier {'=' expression} (',' Identifier {'=' expression})* {','} */ bool Parser::enum_body(PTree::Node *&body) { Trace trace("Parser::enum_body", Trace::PARSING); Token tk, tk2; PTree::Node *name, *exp; body = 0; while(true) { if(my_lexer.look_ahead(0) == '}') return true; if(my_lexer.get_token(tk) != Token::Identifier) return false; PTree::Node *comments = wrap_comments(my_lexer.get_comments()); if(my_lexer.look_ahead(0, tk2) != '=') name = new PTree::CommentedAtom(tk, comments); else { my_lexer.get_token(tk2); if(!assign_expr(exp)) { if(!mark_error()) return false; // too many errors skip_to('}'); body = 0; // empty return true; // error recovery } name = PTree::list(new PTree::CommentedAtom(tk, comments), new PTree::Atom(tk2), exp); } if(my_lexer.look_ahead(0) != ',') { body = PTree::snoc(body, name); return true; } else { my_lexer.get_token(tk); body = PTree::nconc(body, PTree::list(name, new PTree::Atom(tk))); } } } /* class.spec : {userdef.keyword} class.key class.body | {userdef.keyword} class.key name {class.body} | {userdef.keyword} class.key name ':' base.specifiers class.body class.key : CLASS | STRUCT | UNION */ bool Parser::class_spec(PTree::ClassSpec *&spec, PTree::Encoding &encode) { Trace trace("Parser::class_spec", Trace::PARSING); PTree::Node *head, *bases, *name; PTree::ClassBody *body; Token tk; head = 0; if(my_lexer.look_ahead(0) == Token::UserKeyword) if(!userdef_keyword(head)) return false; int t = my_lexer.get_token(tk); PTree::Keyword *kwd; switch (t) { case Token::CLASS: kwd = new PTree::Kwd::Class(tk); break; case Token::STRUCT: kwd = new PTree::Kwd::Struct(tk); break; case Token::UNION: kwd = new PTree::Kwd::Union(tk); break; // FIXME: The following shouldn't be here. // See opt_integral_type_or_class_spec for why this is needed. case Token::TYPENAME: kwd = new PTree::Kwd::Typename(tk); break; default: return false; } spec = new PTree::ClassSpec(kwd, 0, my_comments); my_comments = 0; if(head != 0) spec = new PTree::ClassSpec(head, spec, 0); if(my_lexer.look_ahead(0) == '{') // anonymous class { encode.anonymous(); // FIXME: why is the absense of a name marked by a list(0, 0) ? spec = PTree::snoc(spec, PTree::list(0, 0)); } else { if(!this->name(name, encode)) return false; spec = PTree::snoc(spec, name); t = my_lexer.look_ahead(0); if(t == ':') { if(!base_clause(bases)) return false; spec = PTree::snoc(spec, bases); } else if(t == '{') spec = PTree::snoc(spec, 0); else { spec->set_encoded_name(encode); if (!my_in_template_decl) declare(spec); return true; // class.key Identifier } } spec->set_encoded_name(encode); { ScopeGuard guard(*this, spec); if(!class_body(body)) return false; } spec = PTree::snoc(spec, body); if (!my_in_template_decl) declare(spec); return true; } //. base-clause: //. : base-specifier-list //. base-specifier-list: //. base-specifier //. base-specifier-list , base-specifier //. base-specifier: //. virtual access-specifier [opt] :: [opt] nested-name-specifier [opt] class-name //. access-specifier virtual [opt] :: [opt] nested-name-specifier [opt] class-name bool Parser::base_clause(PTree::Node *&bases) { Trace trace("Parser::base_clause", Trace::PARSING); Token tk; int t; PTree::Node *name; PTree::Encoding encode; if(my_lexer.get_token(tk) != ':') return false; bases = PTree::list(new PTree::Atom(tk)); while(true) { PTree::Node *super = 0; t = my_lexer.look_ahead(0); if(t == Token::VIRTUAL) { my_lexer.get_token(tk); super = PTree::snoc(super, new PTree::Kwd::Virtual(tk)); t = my_lexer.look_ahead(0); } if(t == Token::PUBLIC | t == Token::PROTECTED | t == Token::PRIVATE) { PTree::Node *lf; switch(my_lexer.get_token(tk)) { case Token::PUBLIC: lf = new PTree::Kwd::Public(tk); break; case Token::PROTECTED: lf = new PTree::Kwd::Protected(tk); break; case Token::PRIVATE: lf = new PTree::Kwd::Private(tk); break; default : throw std::runtime_error("Parser::base_clause(): fatal"); } super = PTree::snoc(super, lf); t = my_lexer.look_ahead(0); } // FIXME: test whether 'virtual' has already been encountered above. if(t == Token::VIRTUAL) { my_lexer.get_token(tk); super = PTree::snoc(super, new PTree::Kwd::Virtual(tk)); } encode.clear(); if(!this->name(name, encode)) return false; if(!name->is_atom()) name = new PTree::Name(name, encode); super = PTree::snoc(super, name); bases = PTree::snoc(bases, super); if(my_lexer.look_ahead(0) != ',') return true; else { my_lexer.get_token(tk); bases = PTree::snoc(bases, new PTree::Atom(tk)); } } } /* class.body : '{' (class.members)* '}' */ bool Parser::class_body(PTree::ClassBody *&body) { Trace trace("Parser::class_body", Trace::PARSING); Token tk; PTree::Node *mems, *m; if(my_lexer.get_token(tk) != '{') return false; PTree::Node *ob = new PTree::Atom(tk); mems = 0; while(my_lexer.look_ahead(0) != '}') { if(!class_member(m)) { if(!mark_error()) return false; // too many errors skip_to('}'); my_lexer.get_token(tk); body = new PTree::ClassBody(ob, 0, new PTree::Atom(tk)); return true; // error recovery } my_lexer.get_comments(); mems = PTree::snoc(mems, m); } my_lexer.get_token(tk); body = new PTree::ClassBody(ob, mems, new PTree::CommentedAtom(tk, wrap_comments(my_lexer.get_comments()))); return true; } /* class.member : (PUBLIC | PROTECTED | PRIVATE) ':' | user.access.spec | ';' | type.def | template.decl | using.declaration | metaclass.decl | declaration | access.decl Note: if you modify this function, see ClassWalker::TranslateClassSpec() as well. */ bool Parser::class_member(PTree::Node *&mem) { Trace trace("Parser::class_member", Trace::PARSING); Token tk1, tk2; int t = my_lexer.look_ahead(0); if(t == Token::PUBLIC || t == Token::PROTECTED || t == Token::PRIVATE) { PTree::Node *lf; switch(my_lexer.get_token(tk1)) { case Token::PUBLIC : lf = new PTree::Kwd::Public(tk1); break; case Token::PROTECTED : lf = new PTree::Kwd::Protected(tk1); break; case Token::PRIVATE : lf = new PTree::Kwd::Private(tk1); break; default : throw std::runtime_error("Parser::class_member(): fatal"); } PTree::Node *comments = wrap_comments(my_lexer.get_comments()); if(my_lexer.get_token(tk2) != ':') return false; mem = new PTree::AccessSpec(lf, PTree::list(new PTree::Atom(tk2)), comments); return true; } else if(t == Token::UserKeyword4) return user_access_spec(mem); else if(t == ';') return null_declaration(mem); else if(t == Token::TYPEDEF) { PTree::Typedef *td; bool result = typedef_(td); mem = td; return result; } else if(t == Token::TEMPLATE) return template_decl(mem); else if(t == Token::USING) { if (my_lexer.look_ahead(1) == Token::NAMESPACE) { PTree::UsingDirective *udir; bool result = using_directive(udir); declare(udir); mem = udir; return result; } else { PTree::UsingDeclaration *udecl; bool result = using_declaration(udecl); declare(udecl); mem = udecl; return result; } } else if(t == Token::METACLASS) return metaclass_decl(mem); else { const char *pos = my_lexer.save(); PTree::Declaration *decl; if(declaration(decl)) { PTree::Node *comments = wrap_comments(my_lexer.get_comments()); if (comments) set_declarator_comments(decl, comments); declare(decl); mem = decl; return true; } my_lexer.restore(pos); return access_decl(mem); } } /* access.decl : name ';' e.g. ::; */ bool Parser::access_decl(PTree::Node *&mem) { Trace trace("Parser::access_decl", Trace::PARSING); PTree::Node *name; PTree::Encoding encode; Token tk; if(!this->name(name, encode)) return false; if(my_lexer.get_token(tk) != ';') return false; mem = new PTree::AccessDecl(new PTree::Name(name, encode), PTree::list(new PTree::Atom(tk))); return true; } /* user.access.spec : UserKeyword4 ':' | UserKeyword4 '(' function.arguments ')' ':' */ bool Parser::user_access_spec(PTree::Node *&mem) { Trace trace("Parser::user_access_spec", Trace::PARSING); Token tk1, tk2, tk3, tk4; PTree::Node *args; if(my_lexer.get_token(tk1) != Token::UserKeyword4) return false; int t = my_lexer.get_token(tk2); if(t == ':') { mem = new PTree::UserAccessSpec(new PTree::Atom(tk1), PTree::list(new PTree::Atom(tk2))); return true; } else if(t == '(') { if(!function_arguments(args)) return false; if(my_lexer.get_token(tk3) != ')') return false; if(my_lexer.get_token(tk4) != ':') return false; mem = new PTree::UserAccessSpec(new PTree::Atom(tk1), PTree::list(new PTree::Atom(tk2), args, new PTree::Atom(tk3), new PTree::Atom(tk4))); return true; } else return false; } //. expression: //. assignment-expression //. expression , assignment-expression bool Parser::expression(PTree::Node *&exp) { Trace trace("Parser::expression", Trace::PARSING); if(!assign_expr(exp)) return false; while(my_lexer.look_ahead(0) == ',') { Token tk; my_lexer.get_token(tk); PTree::Node *right; if(!assign_expr(right)) return false; exp = new PTree::Expression(exp, PTree::list(new PTree::Atom(tk), right)); } return true; } //. assignment-expression: //. conditional-expression //. logical-or-expression assignment-operator assignment-expression //. throw-expression bool Parser::assign_expr(PTree::Node *&exp) { Trace trace("Parser::assign_expr", Trace::PARSING); Token::Type t = my_lexer.look_ahead(0); if (t == Token::THROW) return throw_expr(exp); PTree::Node *left; if(!conditional_expr(left)) return false; t = my_lexer.look_ahead(0); if(t != '=' && t != Token::AssignOp) exp = left; else { Token tk; my_lexer.get_token(tk); PTree::Node *right; if(!assign_expr(right)) return false; exp = new PTree::AssignExpr(left, PTree::list(new PTree::Atom(tk), right)); } return true; } //. conditional-expression: //. logical-or-expression //. logical-or-expression ? expression : assignment-expression bool Parser::conditional_expr(PTree::Node *&exp) { Trace trace("Parser::conditional_expr", Trace::PARSING); if(!logical_or_expr(exp)) return false; if(my_lexer.look_ahead(0) == '?') { Token tk1; my_lexer.get_token(tk1); PTree::Node *then = 0; if (my_lexer.look_ahead(0) != ':') { if(!expression(then)) return false; } else if (!(my_ruleset & GCC)) return false; Token tk2; if(my_lexer.get_token(tk2) != ':') return false; PTree::Node *otherwise; if(!assign_expr(otherwise)) return false; exp = new PTree::CondExpr(exp, PTree::list(new PTree::Atom(tk1), then, new PTree::Atom(tk2), otherwise)); } return true; } //. logical-or-expression: //. logical-and-expression //. logical-or-expression || logical-and-expression bool Parser::logical_or_expr(PTree::Node *&exp) { Trace trace("Parser::logical_or_expr", Trace::PARSING); if(!logical_and_expr(exp)) return false; while(my_lexer.look_ahead(0) == Token::LogOrOp) { Token tk; my_lexer.get_token(tk); PTree::Node *right; if(!logical_and_expr(right)) return false; exp = new PTree::InfixExpr(exp, PTree::list(new PTree::Atom(tk), right)); } return true; } //. logical-and-expression: //. inclusive-or-expression //. logical-and-expr && inclusive-or-expression bool Parser::logical_and_expr(PTree::Node *&exp) { Trace trace("Parser::logical_and_expr", Trace::PARSING); if(!inclusive_or_expr(exp)) return false; while(my_lexer.look_ahead(0) == Token::LogAndOp) { Token tk; my_lexer.get_token(tk); PTree::Node *right; if(!inclusive_or_expr(right)) return false; exp = new PTree::InfixExpr(exp, PTree::list(new PTree::Atom(tk), right)); } return true; } //. inclusive-or-expression: //. exclusive-or-expression //. inclusive-or-expression | exclusive-or-expression bool Parser::inclusive_or_expr(PTree::Node *&exp) { Trace trace("Parser::inclusive_or_expr", Trace::PARSING); if(!exclusive_or_expr(exp)) return false; while(my_lexer.look_ahead(0) == '|') { Token tk; my_lexer.get_token(tk); PTree::Node *right; if(!exclusive_or_expr(right)) return false; exp = new PTree::InfixExpr(exp, PTree::list(new PTree::Atom(tk), right)); } return true; } //. exclusive-or-expression: //. and-expression //. exclusive-or-expression ^ and-expression bool Parser::exclusive_or_expr(PTree::Node *&exp) { Trace trace("Parser::exclusive_or_expr", Trace::PARSING); if(!and_expr(exp)) return false; while(my_lexer.look_ahead(0) == '^') { Token tk; my_lexer.get_token(tk); PTree::Node *right; if(!and_expr(right)) return false; exp = new PTree::InfixExpr(exp, PTree::list(new PTree::Atom(tk), right)); } return true; } //. and-expression: //. equality-expression //. and-expression & equality-expression bool Parser::and_expr(PTree::Node *&exp) { Trace trace("Parser::and_expr", Trace::PARSING); if(!equality_expr(exp)) return false; while(my_lexer.look_ahead(0) == '&') { Token tk; my_lexer.get_token(tk); PTree::Node *right; if(!equality_expr(right)) return false; exp = new PTree::InfixExpr(exp, PTree::list(new PTree::Atom(tk), right)); } return true; } //. equality-expression: //. relational-expression //. equality-expression == relational-expression //. equality-expression != relational-expression bool Parser::equality_expr(PTree::Node *&exp) { Trace trace("Parser::equality_expr", Trace::PARSING); if(!relational_expr(exp)) return false; while(my_lexer.look_ahead(0) == Token::EqualOp) { Token tk; my_lexer.get_token(tk); PTree::Node *right; if(!relational_expr(right)) return false; exp = new PTree::InfixExpr(exp, PTree::list(new PTree::Atom(tk), right)); } return true; } //. relational-expression: //. shift-expression //. relational-expression < shift-expression //. relational-expression > shift-expression //. relational-expression <= shift-expression //. relational-expression >= shift-expression bool Parser::relational_expr(PTree::Node *&exp) { Trace trace("Parser::relational_expr", Trace::PARSING); if(!shift_expr(exp)) return false; Token::Type t; while(t = my_lexer.look_ahead(0), (t == Token::RelOp || t == '<' || (t == '>' && my_gt_is_operator))) { Token tk; my_lexer.get_token(tk); PTree::Node *right; if(!shift_expr(right)) return false; exp = new PTree::InfixExpr(exp, PTree::list(new PTree::Atom(tk), right)); } return true; } //. shift-expression: //. additive-expression //. shift-expression << additive-expression //. shift-expression >> additive-expression bool Parser::shift_expr(PTree::Node *&exp) { Trace trace("Parser::shift_expr", Trace::PARSING); if(!additive_expr(exp)) return false; while(my_lexer.look_ahead(0) == Token::ShiftOp) { Token tk; my_lexer.get_token(tk); PTree::Node *right; if(!additive_expr(right)) return false; exp = new PTree::InfixExpr(exp, PTree::list(new PTree::Atom(tk), right)); } return true; } //. additive-expression: //. multiplicative-expression //. additive-expression + multiplicative-expression //. additive-expression - multiplicative-expression bool Parser::additive_expr(PTree::Node *&exp) { Trace trace("Parser::additive_expr", Trace::PARSING); if(!multiplicative_expr(exp)) return false; Token::Type t; while(t = my_lexer.look_ahead(0), (t == '+' || t == '-')) { Token tk; my_lexer.get_token(tk); PTree::Node *right; if(!multiplicative_expr(right)) return false; exp = new PTree::InfixExpr(exp, PTree::list(new PTree::Atom(tk), right)); } return true; } //. multiplicative-expression: //. pm-expression //. multiplicative-expression * pm-expression //. multiplicative-expression / pm-expression //. multiplicative-expression % pm-expression bool Parser::multiplicative_expr(PTree::Node *&exp) { Trace trace("Parser::multiplicative_expr", Trace::PARSING); if(!pm_expr(exp)) return false; Token::Type t; while(t = my_lexer.look_ahead(0), (t == '*' || t == '/' || t == '%')) { Token tk; my_lexer.get_token(tk); PTree::Node *right; if(!pm_expr(right)) return false; exp = new PTree::InfixExpr(exp, PTree::list(new PTree::Atom(tk), right)); } return true; } //. pm-expression: //. cast-expression //. pm-expression .* cast-expression //. pm-expression ->* cast-expression bool Parser::pm_expr(PTree::Node *&exp) { Trace trace("Parser::pm_expr", Trace::PARSING); if(!cast_expr(exp)) return false; while(my_lexer.look_ahead(0) == Token::PmOp) { Token tk; my_lexer.get_token(tk); PTree::Node *right; if(!cast_expr(right)) return false; exp = new PTree::PmExpr(exp, PTree::list(new PTree::Atom(tk), right)); } return true; } //. cast-expression: //. unary-expression //. ( type-id ) cast-expression bool Parser::cast_expr(PTree::Node *&exp) { Trace trace("Parser::cast_expr", Trace::PARSING); if(my_lexer.look_ahead(0) != '(') return unary_expr(exp); else { Token tk1, tk2; PTree::Node *tname; const char* pos = my_lexer.save(); my_lexer.get_token(tk1); if(type_id(tname)) if(my_lexer.get_token(tk2) == ')') if(cast_expr(exp)) { exp = new PTree::CastExpr(new PTree::Atom(tk1), PTree::list(tname, new PTree::Atom(tk2), exp)); return true; } my_lexer.restore(pos); return unary_expr(exp); } } //. type-id: //. type-specifier-seq abstract-declarator [opt] bool Parser::type_id(PTree::Node *&tname) { PTree::Encoding type_encode; return type_id(tname, type_encode); } bool Parser::type_id(PTree::Node *&tname, PTree::Encoding &type_encode) { Trace trace("Parser::type_id", Trace::PARSING); PTree::Node *type_name, *arg; PTree::Encoding name_encode; if(!type_specifier(type_name, true, type_encode)) return false; if(!declarator(arg, kCastDeclarator, false, type_encode, name_encode, false)) return false; tname = PTree::list(type_name, arg); return true; } //. unary-expression: //. postfix-expression //. ++ cast-expression //. -- cast-expression //. unary-operator cast-expression //. sizeof unary-expression //. sizeof ( type-id ) //. new-expression //. delete-expression //. //. unary-operator: //. * //. & //. + //. - //. ! //. ~ bool Parser::unary_expr(PTree::Node *&exp) { Trace trace("Parser::unary_expr", Trace::PARSING); Token::Type t = my_lexer.look_ahead(0); if(t == '*' || t == '&' || t == '+' || t == '-' || t == '!' || t == '~' || t == Token::IncOp) { Token tk; my_lexer.get_token(tk); PTree::Node *right; if(!cast_expr(right)) return false; exp = new PTree::UnaryExpr(new PTree::Atom(tk), PTree::list(right)); return true; } else if(t == Token::SIZEOF) return sizeof_expr(exp); // FIXME: can this be removed ? // else if(t == Token::THROW) return throw_expr(exp); else if(is_allocate_expr(t)) return allocate_expr(exp); else return postfix_expr(exp); } //. throw-expression: //. throw assignment-expression bool Parser::throw_expr(PTree::Node *&exp) { Trace trace("Parser::throw_expr", Trace::PARSING); Token tk; if(my_lexer.get_token(tk) != Token::THROW) return false; int t = my_lexer.look_ahead(0); PTree::Node *e = 0; // FIXME: what is that ?? if(t == ':' || t == ';') e = 0; else if(!assign_expr(e)) return false; exp = new PTree::ThrowExpr(new PTree::Kwd::Throw(tk), PTree::list(e)); return true; } //. sizeof-expression: //. sizeof unary-expression //. sizeof ( type-id ) bool Parser::sizeof_expr(PTree::Node *&exp) { Trace trace("Parser::sizeof_expr", Trace::PARSING); Token tk; if(my_lexer.get_token(tk) != Token::SIZEOF) return false; if(my_lexer.look_ahead(0) == '(') { Token op, cp; PTree::Node *tname; char const *tag = my_lexer.save(); my_lexer.get_token(op); if(type_id(tname) && my_lexer.get_token(cp) == ')') { // success ! exp = new PTree::SizeofExpr(new PTree::Atom(tk), PTree::list(new PTree::Atom(op), tname, new PTree::Atom(cp))); return true; } else my_lexer.restore(tag); } PTree::Node *unary; if(!unary_expr(unary)) return false; exp = new PTree::SizeofExpr(new PTree::Atom(tk), PTree::list(unary)); return true; } bool Parser::offsetof_expr(PTree::Node *&exp) { Trace trace("Parser::offsetof_expr", Trace::PARSING); Token tk; if(my_lexer.get_token(tk) != Token::OFFSETOF) return false; if(my_lexer.look_ahead(0) != '(') return false; Token op; my_lexer.get_token(op); PTree::Node *type = 0; if(!type_id(type)) return false; if(my_lexer.look_ahead(0) != ',') return false; Token comma; my_lexer.get_token(comma); PTree::Node *member = 0; PTree::Encoding encoding; // allowed syntax is: // id-expression // offsetof-member-designator . id-expression // offsetof-member-designator [ expression ] // Quick hack: only look for expression. if(!expression(member)) return false; if(my_lexer.look_ahead(0) != ')') return false; Token cp; my_lexer.get_token(cp); exp = new PTree::OffsetofExpr(new PTree::Atom(tk), PTree::list(new PTree::Atom(op), type, new PTree::Atom(comma), member, new PTree::Atom(cp))); return true; } //. typeid-expression: //. typeid ( type-id ) //. typeid ( expression ) bool Parser::typeid_expr(PTree::Node *&exp) { Trace trace("Parser::typeid_expr", Trace::PARSING); Token tk; if(my_lexer.get_token(tk) != Token::TYPEID) return false; Token op; if(my_lexer.get_token(op) != '(') return false; char const *mark = my_lexer.save(); PTree::Node *arg; if(!type_id(arg)) { my_lexer.restore(mark); if (!expression(arg)) return false; } Token cp; if(my_lexer.get_token(cp) != ')') return false; exp = new PTree::TypeidExpr(new PTree::Atom(tk), PTree::list(new PTree::Atom(op), arg, new PTree::Atom(cp))); return true; } bool Parser::is_allocate_expr(Token::Type t) { if(t == Token::UserKeyword) return true; else { if(t == Token::Scope) t = my_lexer.look_ahead(1); if(t == Token::NEW || t == Token::DELETE) return true; else return false; } } /* allocate.expr : {Scope | userdef.keyword} NEW allocate.type | {Scope} DELETE {'[' ']'} cast.expr */ bool Parser::allocate_expr(PTree::Node *&exp) { Trace trace("Parser::allocate_expr", Trace::PARSING); Token tk; PTree::Node *head = 0; bool ukey = false; int t = my_lexer.look_ahead(0); if(t == Token::Scope) { my_lexer.get_token(tk); head = new PTree::Atom(tk); } else if(t == Token::UserKeyword) { if(!userdef_keyword(head)) return false; ukey = true; } t = my_lexer.get_token(tk); if(t == Token::DELETE) { PTree::Node *obj; if(ukey) return false; if(head == 0) exp = new PTree::DeleteExpr(new PTree::Kwd::Delete(tk), 0); else exp = new PTree::DeleteExpr(head, PTree::list(new PTree::Kwd::Delete(tk))); if(my_lexer.look_ahead(0) == '[') { my_lexer.get_token(tk); exp = PTree::snoc(exp, new PTree::Atom(tk)); if(my_lexer.get_token(tk) != ']') return false; exp = PTree::snoc(exp, new PTree::Atom(tk)); } if(!cast_expr(obj)) return false; exp = PTree::snoc(exp, obj); return true; } else if(t == Token::NEW) { PTree::Node *atype; if(head == 0) exp = new PTree::NewExpr(new PTree::Kwd::New(tk), 0); else exp = new PTree::NewExpr(head, PTree::list(new PTree::Kwd::New(tk))); if(!allocate_type(atype)) return false; exp = PTree::nconc(exp, atype); return true; } else return false; } /* userdef.keyword : [UserKeyword | UserKeyword5] {'(' function.arguments ')'} */ bool Parser::userdef_keyword(PTree::Node *&ukey) { Token tk; int t = my_lexer.get_token(tk); if(t != Token::UserKeyword && t != Token::UserKeyword5) return false; if(my_lexer.look_ahead(0) != '(') ukey = new PTree::UserdefKeyword(new PTree::Atom(tk), 0); else { PTree::Node *args; Token op, cp; my_lexer.get_token(op); if(!function_arguments(args)) return false; if(my_lexer.get_token(cp) != ')') return false; ukey = new PTree::UserdefKeyword(new PTree::Atom(tk), PTree::list(new PTree::Atom(op), args, new PTree::Atom(cp))); } return true; } /* allocate.type : {'(' function.arguments ')'} type.specifier new.declarator {allocate.initializer} | {'(' function.arguments ')'} '(' type.name ')' {allocate.initializer} */ bool Parser::allocate_type(PTree::Node *&atype) { Trace trace("Parser::allocate_type", Trace::PARSING); Token op, cp; PTree::Node *tname, *init, *exp; if(my_lexer.look_ahead(0) != '(') atype = PTree::list(0); else { my_lexer.get_token(op); const char* pos = my_lexer.save(); if(type_id(tname)) if(my_lexer.get_token(cp) == ')') { if(my_lexer.look_ahead(0) != '(') { atype = PTree::list(0, PTree::list(new PTree::Atom(op), tname, new PTree::Atom(cp))); if(!is_type_specifier()) return true; } else if(allocate_initializer(init)) { atype = PTree::list(0, PTree::list(new PTree::Atom(op), tname, new PTree::Atom(cp)), init); // the next token cannot be '(' if(my_lexer.look_ahead(0) != '(') return true; } } // if we reach here, we have to process '(' function.arguments ')'. my_lexer.restore(pos); if(!function_arguments(exp)) return false; if(my_lexer.get_token(cp) != ')') return false; atype = PTree::list(PTree::list(new PTree::Atom(op), exp, new PTree::Atom(cp))); } if(my_lexer.look_ahead(0) == '(') { my_lexer.get_token(op); if(!type_id(tname)) return false; if(my_lexer.get_token(cp) != ')') return false; atype = PTree::snoc(atype, PTree::list(new PTree::Atom(op), tname, new PTree::Atom(cp))); } else { PTree::Declarator *decl; PTree::Encoding type_encode; if(!type_specifier(tname, false, type_encode)) return false; if(!new_declarator(decl, type_encode)) return false; atype = PTree::snoc(atype, PTree::list(tname, decl)); } if(my_lexer.look_ahead(0) == '(') { if(!allocate_initializer(init)) return false; atype = PTree::snoc(atype, init); } return true; } /* new.declarator : empty | ptr.operator | {ptr.operator} ('[' expression ']')+ */ bool Parser::new_declarator(PTree::Declarator *&decl, PTree::Encoding& encode) { Trace trace("Parser::new_declarator", Trace::PARSING); PTree::Node *d = 0; if(my_lexer.look_ahead(0) != '[') if(!opt_ptr_operator(d, encode)) return false; decl = new PTree::Declarator(d); while(my_lexer.look_ahead(0) == '[') { Token ob, cb; PTree::Node *expr; my_lexer.get_token(ob); if(!expression(expr)) return false; if(my_lexer.get_token(cb) != ']') return false; if (expr) { long size; if (TypeAnalysis::evaluate_const(my_symbols.current_scope(), expr, size)) encode.array(size); else encode.array(); } decl = PTree::nconc(decl, PTree::list(new PTree::Atom(ob), expr, new PTree::Atom(cb))); } decl->set_encoded_type(encode); return true; } /* allocate.initializer : '(' {initialize.expr (',' initialize.expr)* } ')' */ bool Parser::allocate_initializer(PTree::Node *&init) { Trace trace("Parser::allocate_initializer", Trace::PARSING); Token op, cp; if(my_lexer.get_token(op) != '(') return false; if(my_lexer.look_ahead(0) == ')') { my_lexer.get_token(cp); init = PTree::list(new PTree::Atom(op), 0, new PTree::Atom(cp)); return true; } init = 0; while(true) { PTree::Node *exp; if(!initialize_expr(exp)) return false; init = PTree::snoc(init, exp); if(my_lexer.look_ahead(0) != ',') break; else { Token tk; my_lexer.get_token(tk); init = PTree::snoc(init, new PTree::Atom(tk)); } } my_lexer.get_token(cp); init = PTree::list(new PTree::Atom(op), init, new PTree::Atom(cp)); return true; } /* postfix.exp : primary.exp | postfix.expr '[' expression ']' | postfix.expr '(' function.arguments ')' | postfix.expr '.' var.name | postfix.expr ArrowOp var.name | postfix.expr IncOp | openc++.postfix.expr openc++.postfix.expr : postfix.expr '.' userdef.statement | postfix.expr ArrowOp userdef.statement Note: function-style casts are accepted as function calls. */ bool Parser::postfix_expr(PTree::Node *&exp) { Trace trace("Parser::postfix_expr", Trace::PARSING); PTree::Node *e; Token cp, op; int t, t2; exp = 0; // try compound-literal if (my_ruleset & GCC && my_lexer.look_ahead(0) == '(') { const char *save = my_lexer.save(); my_lexer.get_token(op); PTree::Node *type; PTree::Encoding name; PTree::Node *init = 0; if(type_id(type, name) && my_lexer.get_token(cp) == ')' && my_lexer.look_ahead(0) == '{' && initialize_expr(init)) { exp = new PTree::PostfixExpr(PTree::list(new PTree::Atom(op), type, new PTree::Atom(cp)), init); } else my_lexer.restore(save); } if(!exp && !primary_expr(exp)) return false; while(true) { switch(my_lexer.look_ahead(0)) { case '[' : my_lexer.get_token(op); if(!expression(e)) return false; if(my_lexer.get_token(cp) != ']') return false; exp = new PTree::ArrayExpr(exp, PTree::list(new PTree::Atom(op), e, new PTree::Atom(cp))); break; case '(' : my_lexer.get_token(op); if(!function_arguments(e)) return false; if(my_lexer.get_token(cp) != ')') return false; exp = new PTree::FuncallExpr(exp, PTree::list(new PTree::Atom(op), e, new PTree::Atom(cp))); break; case Token::IncOp : my_lexer.get_token(op); exp = new PTree::PostfixExpr(exp, PTree::list(new PTree::Atom(op))); break; case '.' : case Token::ArrowOp : t2 = my_lexer.get_token(op); t = my_lexer.look_ahead(0); if(t == Token::UserKeyword || t == Token::UserKeyword2 || t == Token::UserKeyword3) { if(!userdef_statement(e)) return false; exp = new PTree::UserStatementExpr(exp, PTree::cons(new PTree::Atom(op), e)); break; } else { if(!var_name(e)) return false; if(t2 == '.') exp = new PTree::DotMemberExpr(exp, PTree::list(new PTree::Atom(op), e)); else exp = new PTree::ArrowMemberExpr(exp, PTree::list(new PTree::Atom(op), e)); break; } default : return true; } } } /* primary.exp : Constant | CharConst | WideCharConst | StringL | WideStringL | THIS | var.name | '(' expression ')' | integral.or.class.spec '(' function.arguments ')' | openc++.primary.exp | typeid '(' typething ')' openc++.primary.exp : var.name '::' userdef.statement */ bool Parser::primary_expr(PTree::Node *&exp) { Trace trace("Parser::primary_expr", Trace::PARSING); Token tk, tk2; PTree::Node *exp2; PTree::Encoding cast_type_encode; switch(my_lexer.look_ahead(0)) { case Token::Constant: case Token::CharConst: case Token::WideCharConst: case Token::StringL: case Token::WideStringL: my_lexer.get_token(tk); exp = new PTree::Literal(tk); return true; case Token::THIS: my_lexer.get_token(tk); exp = new PTree::Kwd::This(tk); return true; case Token::TYPEID: return typeid_expr(exp); case '(': { my_lexer.get_token(tk); PGuard guard(*this, &Parser::my_gt_is_operator); my_gt_is_operator = true; if (my_lexer.look_ahead(0) == '{' && my_ruleset & GCC) { // GNU statement expression PTree::Block *block; if (!compound_statement(block)) return false; exp2 = block; } else { if(!expression(exp2)) return false; } if(my_lexer.get_token(tk2) != ')') return false; exp = new PTree::ParenExpr(new PTree::Atom(tk), PTree::list(exp2, new PTree::Atom(tk2))); return true; } case Token::OFFSETOF: { return offsetof_expr(exp); } default: // FIXME: We need symbol lookup here to figure out whether we // are looking at a type or a variable here ! if(!opt_integral_type_or_class_spec(exp, cast_type_encode)) return false; if(exp) { // if integral.or.class.spec if(my_lexer.get_token(tk) != '(') return false; if(!function_arguments(exp2)) return false; if(my_lexer.get_token(tk2) != ')') return false; exp = new PTree::FstyleCastExpr(cast_type_encode, exp, PTree::list(new PTree::Atom(tk), exp2, new PTree::Atom(tk2))); return true; } else { if(!var_name(exp)) return false; if(my_lexer.look_ahead(0) == Token::Scope) { my_lexer.get_token(tk); if(!userdef_statement(exp2)) return false; exp = new PTree::StaticUserStatementExpr(exp, PTree::cons(new PTree::Atom(tk), exp2)); } return true; } } } bool Parser::typeof_expr(PTree::Node *&node) { Trace trace("Parser::typeof_expr", Trace::PARSING); Token tk, tk2; Token::Type t = my_lexer.get_token(tk); if (t != Token::TYPEOF) return false; if ((t = my_lexer.get_token(tk2)) != '(') return false; PTree::Node *type = PTree::list(new PTree::Atom(tk2)); #if 1 if (!assign_expr(node)) return false; #else PTree::Encoding name_encode; if (!name(node, name_encode)) return false; if (!node->is_atom()) node = new PTree::Name(node, name_encode); else node = new PTree::Name(PTree::list(node), name_encode); #endif type = PTree::snoc(type, node); if ((t = my_lexer.get_token(tk2)) != ')') return false; type = PTree::snoc(type, new PTree::Atom(tk2)); node = new PTree::TypeofExpr(new PTree::Kwd::Typeof(tk), type); return true; } /* userdef.statement : UserKeyword '(' function.arguments ')' compound.statement | UserKeyword2 '(' arg.decl.list ')' compound.statement | UserKeyword3 '(' expr.statement {expression} ';' {expression} ')' compound.statement */ bool Parser::userdef_statement(PTree::Node *&st) { Token tk, tk2, tk3, tk4; PTree::Node *keyword, *exp, *exp2, *exp3; PTree::Encoding dummy_encode; int t = my_lexer.get_token(tk); if(my_lexer.get_token(tk2) != '(') return false; switch(t) { case Token::UserKeyword : keyword = new PTree::UserKeyword(tk); if(!function_arguments(exp)) return false; goto rest; case Token::UserKeyword2 : keyword = new PTree::UserKeyword(tk); if(!parameter_declaration_list(exp, dummy_encode)) return false; rest: { if(my_lexer.get_token(tk3) != ')') return false; PTree::Block *body; if(!compound_statement(body)) return false; st = PTree::list(keyword, new PTree::Atom(tk2), exp, new PTree::Atom(tk3), body); return true; } case Token::UserKeyword3 : { if(!expr_statement(exp)) return false; if(my_lexer.look_ahead(0) == ';') exp2 = 0; else if(!expression(exp2)) return false; if(my_lexer.get_token(tk3) != ';') return false; if(my_lexer.look_ahead(0) == ')') exp3 = 0; else if(!expression(exp3)) return false; if(my_lexer.get_token(tk4) != ')') return false; PTree::Block *body; if(!compound_statement(body)) return false; st = PTree::list(new PTree::Atom(tk), new PTree::Atom(tk2), exp, exp2, new PTree::Atom(tk3), exp3, new PTree::Atom(tk4), body); return true; } default : return false; } } /* var.name : {'::'} name2 ('::' name2)* name2 : Identifier {template.args} | '~' Identifier | OPERATOR operator.name if var.name ends with a template type, the next token must be '(' */ bool Parser::var_name(PTree::Node *&name) { Trace trace("Parser::var_name", Trace::PARSING); PTree::Encoding encode; if(var_name_core(name, encode)) { if(!name->is_atom()) name = new PTree::Name(name, encode); return true; } else return false; } bool Parser::var_name_core(PTree::Node *&name, PTree::Encoding &encode) { Trace trace("Parser::var_name_core", Trace::PARSING); Token tk; int length = 0; if(my_lexer.look_ahead(0) == Token::Scope) { my_lexer.get_token(tk); name = PTree::list(new PTree::Atom(tk)); encode.global_scope(); ++length; } else name = 0; while(true) { Token::Type t = my_lexer.get_token(tk); if(t == Token::TEMPLATE) { // Skip template token, next will be identifier t = my_lexer.get_token(tk); } if(t == Token::Identifier) { PTree::Node *n = new PTree::Identifier(tk.ptr, tk.length); if(is_template_args()) { PTree::Node *args; PTree::Encoding args_encode; if(!template_args(args, args_encode)) return false; encode.template_(n, args_encode); ++length; n = PTree::list(n, args); } else { encode.simple_name(n); ++length; } if(more_var_name()) { my_lexer.get_token(tk); name = PTree::nconc(name, PTree::list(n, new PTree::Atom(tk))); } else { if(name == 0) name = n; else name = PTree::snoc(name, n); if(length > 1) encode.qualified(length); return true; } } else if(t == '~') { Token tk2; if(my_lexer.look_ahead(0) != Token::Identifier) return false; my_lexer.get_token(tk2); PTree::Node *class_name = new PTree::Atom(tk2); PTree::Node *dt = PTree::list(new PTree::Atom(tk), class_name); if(name == 0) name = dt; else name = PTree::snoc(name, dt); encode.destructor(class_name); if(length > 0) encode.qualified(length + 1); return true; } else if(t == Token::OPERATOR) { PTree::Node *op; if(!operator_name(op, encode)) return false; PTree::Node *opf = PTree::list(new PTree::Kwd::Operator(tk), op); name = name ? PTree::snoc(name, opf) : opf; if(length > 0) encode.qualified(length + 1); return true; } else return false; } } bool Parser::more_var_name() { Trace trace("Parser::more_var_name", Trace::PARSING); if(my_lexer.look_ahead(0) == Token::Scope) { int t = my_lexer.look_ahead(1); if(t == Token::Identifier || t == '~' || t == Token::OPERATOR || t == Token::TEMPLATE) return true; } return false; } /* template.args : '<' any* '>' template.args must be followed by '(', '::', ';', or ',' */ bool Parser::is_template_args() { int i = 0; int t = my_lexer.look_ahead(i++); if(t == '<') { int n = 1; while(n > 0) { int u = my_lexer.look_ahead(i++); if(u == '<') ++n; else if(u == '>') --n; else if(u == '(') { int m = 1; while(m > 0) { int v = my_lexer.look_ahead(i++); if(v == '(') ++m; else if(v == ')') --m; else if(v == '\0' || v == ';' || v == '}') return false; } } else if(u == '\0' || u == ';' || u == '}') return false; } t = my_lexer.look_ahead(i); return bool(t == Token::Scope || t == '(' || t == ';' || t == ','); } return false; } //. condition: //. expression //. type-specifier-seq declarator = assignment-expression bool Parser::condition(PTree::Node *&exp) { Trace trace("Parser::condition", Trace::PARSING); PTree::Encoding type_encode; // Do declarator first, otherwise "T*foo = blah" gets matched as a // multiplication infix expression inside an assignment expression! const char *save = my_lexer.save(); do { PTree::Node *storage_s, *cv_q, *cv_q2, *integral, *head, *decl; if (!opt_storage_spec(storage_s)) break; head = storage_s; if (!opt_cv_qualifier(cv_q) || !opt_integral_type_or_class_spec(integral, type_encode)) break; if (integral) { // Integral Declaration // Find const after type if (!opt_cv_qualifier(cv_q2)) break; // Make type ptree with pre and post const ptrees if (cv_q) if (cv_q2 == 0) integral = PTree::snoc(cv_q, integral); else integral = PTree::nconc(cv_q, PTree::cons(integral, cv_q2)); else if (cv_q2) integral = PTree::cons(integral, cv_q2); // Store type of CV's type_encode.cv_qualify(cv_q, cv_q2); // Parse declarator if (!init_declarator(decl, type_encode, true, false)) break; // *must* be end of condition, condition is in a () pair if (my_lexer.look_ahead(0) != ')') break; exp = new PTree::Declaration(head, PTree::list(integral, decl)); } else { // Other Declaration PTree::Node *type_name; // Find name of type if (!name(type_name, type_encode)) break; // Find const after type if (!opt_cv_qualifier(cv_q2)) break; // Make type ptree with pre and post const ptrees if (cv_q) if (cv_q2 == 0) type_name = PTree::snoc(cv_q, type_name); else type_name = PTree::nconc(cv_q, PTree::cons(type_name, cv_q2)); else if (cv_q2) type_name = PTree::cons(type_name, cv_q2); // Store type of CV's type_encode.cv_qualify(cv_q, cv_q2); // Parse declarator if (!init_declarator(decl, type_encode, true, false)) break; // *must* be end of condition, condition is in a () pair if (my_lexer.look_ahead(0) != ')') break; exp = new PTree::Declaration(head, PTree::list(type_name, decl)); } return true; } while(false); // Must be a comma expression my_lexer.restore(save); return expression(exp); } //. function-body: //. compound-statement bool Parser::function_body(PTree::Block *&body) { Trace trace("Parser::function_body", Trace::PARSING); return compound_statement(body); } //. compound-statement: //. { statement [opt] } bool Parser::compound_statement(PTree::Block *&body, bool create_scope) { Trace trace("Parser::compound_statement", Trace::PARSING); Token ob; if(my_lexer.get_token(ob) != '{') return false; PTree::Node *ob_comments = wrap_comments(my_lexer.get_comments()); body = new PTree::Block(new PTree::CommentedAtom(ob, ob_comments), 0); ScopeGuard guard(*this, create_scope ? body : 0); PTree::Node *sts = 0; while(my_lexer.look_ahead(0) != '}') { PTree::Node *st; if(!statement(st)) { if(!mark_error()) return false; // too many errors skip_to('}'); Token cb; my_lexer.get_token(cb); body = new PTree::Block(new PTree::Atom(ob), 0, new PTree::Atom(cb)); return true; // error recovery } sts = PTree::snoc(sts, st); } Token cb; if(my_lexer.get_token(cb) != '}') return false; PTree::Node *cb_comments = wrap_comments(my_lexer.get_comments()); body = PTree::nconc(body, PTree::list(sts, new PTree::CommentedAtom(cb, cb_comments))); return true; } /* statement : compound.statement | typedef | if.statement | switch.statement | while.statement | do.statement | for.statement | try.statement | BREAK ';' | CONTINUE ';' | RETURN { expression } ';' | GOTO Identifier ';' | CASE expression ':' statement | DEFAULT ':' statement | Identifier ':' statement | expr.statement */ bool Parser::statement(PTree::Node *&st) { Trace trace("Parser::statement", Trace::PARSING); Token tk1, tk2, tk3; PTree::Node *st2, *exp, *comments; int k; // Get the comments - if we dont make it past the switch then it is a // parse error anyway! comments = wrap_comments(my_lexer.get_comments()); // Whichever case we get, it must succeed switch(k = my_lexer.look_ahead(0)) { case '{': { PTree::Block *block; if (!compound_statement(block, true)) return false; st = block; break; } case Token::USING: { if (my_lexer.look_ahead(1) == Token::NAMESPACE) { PTree::UsingDirective *udir; if (!using_directive(udir)) return false; declare(udir); st = udir; } else { PTree::UsingDeclaration *udecl; if (!using_declaration(udecl)) return false; declare(udecl); st = udecl; } break; } case Token::TYPEDEF: { PTree::Typedef *td; if (!typedef_(td)) return false; st = td; break; } case Token::IF: if (!if_statement(st)) return false; break; case Token::SWITCH: if (!switch_statement(st)) return false; break; case Token::WHILE: if (!while_statement(st)) return false; break; case Token::DO: if (!do_statement(st)) return false; break; case Token::FOR: if (!for_statement(st)) return false; break; case Token::TRY: if (!try_block(st)) return false; break; case Token::BREAK: case Token::CONTINUE: my_lexer.get_token(tk1); if(my_lexer.get_token(tk2) != ';') return false; if(k == Token::BREAK) st = new PTree::BreakStatement(new PTree::Kwd::Break(tk1), PTree::list(new PTree::Atom(tk2))); else st = new PTree::ContinueStatement(new PTree::Kwd::Continue(tk1), PTree::list(new PTree::Atom(tk2))); break; case Token::RETURN: my_lexer.get_token(tk1); if(my_lexer.look_ahead(0) == ';') { my_lexer.get_token(tk2); st = new PTree::ReturnStatement(new PTree::Kwd::Return(tk1), PTree::list(new PTree::Atom(tk2))); } else { if(!expression(exp)) return false; if(my_lexer.get_token(tk2) != ';') return false; st = new PTree::ReturnStatement(new PTree::Kwd::Return(tk1), PTree::list(exp, new PTree::Atom(tk2))); } break; case Token::GOTO: my_lexer.get_token(tk1); if(my_lexer.get_token(tk2) != Token::Identifier) return false; if(my_lexer.get_token(tk3) != ';') return false; st = new PTree::GotoStatement(new PTree::Kwd::Goto(tk1), PTree::list(new PTree::Atom(tk2), new PTree::Atom(tk3))); break; case Token::CASE: my_lexer.get_token(tk1); if(!assign_expr(exp)) return false; if(my_lexer.get_token(tk2) != ':') return false; if(!statement(st2)) return false; st = new PTree::CaseStatement(new PTree::Kwd::Case(tk1), PTree::list(exp, new PTree::Atom(tk2), st2)); break; case Token::DEFAULT: my_lexer.get_token(tk1); if(my_lexer.get_token(tk2) != ':') return false; if(!statement(st2)) return false; st = new PTree::DefaultStatement(new PTree::Kwd::Default(tk1), PTree::list(new PTree::Atom(tk2), st2)); break; case Token::Identifier: if(my_lexer.look_ahead(1) == ':') { // label statement my_lexer.get_token(tk1); my_lexer.get_token(tk2); if(!statement(st2)) return false; st = new PTree::LabelStatement(new PTree::Atom(tk1), PTree::list(new PTree::Atom(tk2), st2)); return true; } // don't break here! default: if (!expr_statement(st)) return false; } // No parse error, attach comment to whatever was returned set_leaf_comments(st, comments); return true; } //. if-statement: //. if ( condition ) statement //. if ( condition ) statement else statement bool Parser::if_statement(PTree::Node *&st) { Trace trace("Parser::if_statement", Trace::PARSING); Token tk1, tk2, tk3, tk4; PTree::Node *exp, *then, *otherwise; if(my_lexer.get_token(tk1) != Token::IF) return false; if(my_lexer.get_token(tk2) != '(') return false; if(!condition(exp)) return false; if(my_lexer.get_token(tk3) != ')') return false; if(!statement(then)) return false; st = new PTree::IfStatement(new PTree::Kwd::If(tk1), PTree::list(new PTree::Atom(tk2), exp, new PTree::Atom(tk3), then)); if(my_lexer.look_ahead(0) == Token::ELSE) { my_lexer.get_token(tk4); if(!statement(otherwise)) return false; st = PTree::nconc(st, PTree::list(new PTree::Kwd::Else(tk4), otherwise)); } return true; } //. switch-statement: //. switch ( condition ) statement bool Parser::switch_statement(PTree::Node *&st) { Trace trace("Parser::switch_statement", Trace::PARSING); Token tk1, tk2, tk3; PTree::Node *exp, *body; if(my_lexer.get_token(tk1) != Token::SWITCH) return false; if(my_lexer.get_token(tk2) != '(') return false; if(!condition(exp)) return false; if(my_lexer.get_token(tk3) != ')') return false; if(!statement(body)) return false; st = new PTree::SwitchStatement(new PTree::Kwd::Switch(tk1), PTree::list(new PTree::Atom(tk2), exp, new PTree::Atom(tk3), body)); return true; } //. while-statement: //. while ( condition ) statement bool Parser::while_statement(PTree::Node *&st) { Trace trace("Parser::while_statement", Trace::PARSING); Token tk1, tk2, tk3; PTree::Node *exp, *body; if(my_lexer.get_token(tk1) != Token::WHILE) return false; if(my_lexer.get_token(tk2) != '(') return false; if(!condition(exp)) return false; if(my_lexer.get_token(tk3) != ')') return false; if(!statement(body)) return false; st = new PTree::WhileStatement(new PTree::Kwd::While(tk1), PTree::list(new PTree::Atom(tk2), exp, new PTree::Atom(tk3), body)); return true; } //. do.statement: //. do statement while ( condition ) ; bool Parser::do_statement(PTree::Node *&st) { Trace trace("Parser::do_statement", Trace::PARSING); Token tk0, tk1, tk2, tk3, tk4; PTree::Node *exp, *body; if(my_lexer.get_token(tk0) != Token::DO) return false; if(!statement(body)) return false; if(my_lexer.get_token(tk1) != Token::WHILE) return false; if(my_lexer.get_token(tk2) != '(') return false; if(!condition(exp)) return false; if(my_lexer.get_token(tk3) != ')') return false; if(my_lexer.get_token(tk4) != ';') return false; st = new PTree::DoStatement(new PTree::Kwd::Do(tk0), PTree::list(body, new PTree::Kwd::While(tk1), new PTree::Atom(tk2), exp, new PTree::Atom(tk3), new PTree::Atom(tk4))); return true; } /* for.statement : FOR '(' expr.statement {expression} ';' {expression} ')' statement */ bool Parser::for_statement(PTree::Node *&st) { Trace trace("Parser::for_statement", Trace::PARSING); Token tk1, tk2, tk3, tk4; PTree::Node *exp1, *exp2, *exp3, *body; if(my_lexer.get_token(tk1) != Token::FOR) return false; if(my_lexer.get_token(tk2) != '(') return false; if(!expr_statement(exp1)) return false; if(my_lexer.look_ahead(0) == ';') exp2 = 0; else if(!expression(exp2)) return false; if(my_lexer.get_token(tk3) != ';') return false; if(my_lexer.look_ahead(0) == ')') exp3 = 0; else if(!expression(exp3)) return false; if(my_lexer.get_token(tk4) != ')') return false; if(!statement(body)) return false; st = new PTree::ForStatement(new PTree::Kwd::For(tk1), PTree::list(new PTree::Atom(tk2), exp1, exp2, new PTree::Atom(tk3), exp3, new PTree::Atom(tk4), body)); return true; } //. try-block: //. try compound-statement handler-seq //. //. handler-seq: //. handler handler-seq [opt] //. //. handler: //. catch ( exception-declaration ) compound-statement //. //. exception-declaration: //. type-specifier-seq declarator //. type-specifier-seq abstract-declarator //. type-specifier-seq //. ... bool Parser::try_block(PTree::Node *&st) { Trace trace("Parser::try_block", Trace::PARSING); Token tk, op, cp; if(my_lexer.get_token(tk) != Token::TRY) return false; PTree::Block *body; if(!compound_statement(body)) return false; st = new PTree::TryStatement(new PTree::Kwd::Try(tk), PTree::list(body)); do { if(my_lexer.get_token(tk) != Token::CATCH) return false; if(my_lexer.get_token(op) != '(') return false; // TODO: handler should become a ParameterDeclaration PTree::Node *handler; if(my_lexer.look_ahead(0) == Token::Ellipsis) { my_lexer.get_token(cp); handler = new PTree::Atom(cp); } else { PTree::Encoding encode; PTree::ParameterDeclaration *parameter; if(!parameter_declaration(parameter, encode)) return false; handler = parameter; } if(my_lexer.get_token(cp) != ')') return false; PTree::Block *body; if(!compound_statement(body)) return false; st = PTree::snoc(st, PTree::list(new PTree::Kwd::Catch(tk), new PTree::Atom(op), handler, new PTree::Atom(cp), body)); } while(my_lexer.look_ahead(0) == Token::CATCH); return true; } /* expr.statement : ';' | declaration.statement | expression ';' | openc++.postfix.expr | openc++.primary.exp */ bool Parser::expr_statement(PTree::Node *&st) { Trace trace("Parser::expr_statement", Trace::PARSING); Token tk; if(my_lexer.look_ahead(0) == ';') { my_lexer.get_token(tk); st = new PTree::ExprStatement(0, PTree::list(new PTree::Atom(tk))); return true; } else { const char *pos = my_lexer.save(); PTree::Declaration *decl; if(declaration_statement(decl)) { declare(decl); st = decl; return true; } else { PTree::Node *exp; my_lexer.restore(pos); if(!expression(exp)) return false; if(PTree::is_a(exp, Token::ntUserStatementExpr, Token::ntStaticUserStatementExpr)) { st = exp; return true; } if(my_lexer.get_token(tk) != ';') return false; st = new PTree::ExprStatement(exp, PTree::list(new PTree::Atom(tk))); return true; } } } /* declaration.statement : decl.head integral.or.class.spec {cv.qualify} {init-declarator-list} ';' | decl.head name {cv.qualify} init-declarator-list ';' | const.declaration decl.head : {storage.spec} {cv.qualify} const.declaration : cv.qualify {'*'} Identifier '=' expression {',' init-declarator-list} ';' Note: if you modify this function, take a look at rDeclaration(), too. */ bool Parser::declaration_statement(PTree::Declaration *&statement) { Trace trace("Parser::declaration_statement", Trace::PARSING); PTree::Node *storage_s, *cv_q, *integral; PTree::Encoding type_encode; Token::Type type = my_lexer.look_ahead(0); if (type == Token::NAMESPACE) { PTree::NamespaceAlias *alias; bool result = namespace_alias(alias); statement = alias; return result; } else if (type == Token::USING) { type = my_lexer.look_ahead(1); if (type == Token::NAMESPACE) { PTree::UsingDirective *udir; bool result = using_directive(udir); statement = udir; return result; } else { PTree::UsingDeclaration *udecl; bool result = using_declaration(udecl); statement = udecl; return result; } } if(!opt_storage_spec(storage_s) || !opt_cv_qualifier(cv_q) || !opt_integral_type_or_class_spec(integral, type_encode)) return false; PTree::Node *head = 0; if(storage_s) head = PTree::snoc(head, storage_s); if(integral) return integral_decl_statement(statement, type_encode, integral, cv_q, head); else { type_encode.clear(); int t = my_lexer.look_ahead(0); if(cv_q != 0 && ((t == Token::Identifier && my_lexer.look_ahead(1) == '=') || t == '*')) return const_declaration(statement, type_encode, head, cv_q); else return other_decl_statement(statement, type_encode, cv_q, head); } } /* integral.decl.statement : decl.head integral.or.class.spec {cv.qualify} {init-declarator-list} ';' */ bool Parser::integral_decl_statement(PTree::Declaration *&statement, PTree::Encoding& type_encode, PTree::Node *integral, PTree::Node *cv_q, PTree::Node *head) { Trace trace("Parser::integral_decl_statement", Trace::PARSING); PTree::Node *cv_q2, *decl; Token tk; if(!opt_cv_qualifier(cv_q2)) return false; if(cv_q) if(cv_q2 == 0) integral = PTree::snoc(cv_q, integral); else integral = PTree::nconc(cv_q, PTree::cons(integral, cv_q2)); else if(cv_q2) integral = PTree::cons(integral, cv_q2); type_encode.cv_qualify(cv_q, cv_q2); if(my_lexer.look_ahead(0) == ';') { my_lexer.get_token(tk); statement = new PTree::Declaration(head, PTree::list(integral, new PTree::Atom(tk))); return true; } else { if(!init_declarator_list(decl, type_encode, false, true)) return false; if(my_lexer.get_token(tk) != ';') return false; statement = new PTree::Declaration(head, PTree::list(integral, decl, new PTree::Atom(tk))); return true; } } /* other.decl.statement :decl.head name {cv.qualify} init_declarator_list ';' */ bool Parser::other_decl_statement(PTree::Declaration *&statement, PTree::Encoding& type_encode, PTree::Node *cv_q, PTree::Node *head) { Trace trace("Parser::other_decl_statement", Trace::PARSING); PTree::Node *type_name, *cv_q2, *decl; Token tk; if(!name(type_name, type_encode)) return false; if(!opt_cv_qualifier(cv_q2)) return false; if(cv_q) if(cv_q2 == 0) type_name = PTree::snoc(cv_q, type_name); else type_name = PTree::nconc(cv_q, PTree::cons(type_name, cv_q2)); else if(cv_q2) type_name = PTree::cons(type_name, cv_q2); type_encode.cv_qualify(cv_q, cv_q2); if(!init_declarator_list(decl, type_encode, false, true)) return false; if(my_lexer.get_token(tk) != ';') return false; statement = new PTree::Declaration(head, PTree::list(type_name, decl, new PTree::Atom(tk))); return true; } bool Parser::maybe_typename_or_class_template(Token&) { return true; } void Parser::skip_to(Token::Type token) { Token tk; while(true) { Token::Type t = my_lexer.look_ahead(0); if(t == token || t == '\0' || t == Token::BadToken) break; else my_lexer.get_token(tk); } } synopsis-0.12/src/Synopsis/gc/0000775000076400007640000000000011172123233015661 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/Mac_files/0000775000076400007640000000000011172123233017543 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/Mac_files/MacOS_Test_config.h0000664000076400007640000001004311104702320023173 0ustar stefanstefan/* MacOS_Test_config.h Configuration flags for Macintosh development systems. Test version. 11/16/95 pcb Updated compilation flags to reflect latest 4.6 Makefile. by Patrick C. Beard. */ /* Boehm, November 17, 1995 12:05 pm PST */ #ifdef __MWERKS__ // for CodeWarrior Pro with Metrowerks Standard Library (MSL). // #define MSL_USE_PRECOMPILED_HEADERS 0 #include #ifndef __STDC__ #define __STDC__ 0 #endif #endif // these are defined again in gc_priv.h. #undef TRUE #undef FALSE #define ALL_INTERIOR_POINTERS // follows interior pointers. //#define SILENT // want collection messages. //#define DONT_ADD_BYTE_AT_END // no padding. //#define SMALL_CONFIG // whether to a smaller heap. #define NO_SIGNALS // signals aren't real on the Macintosh. #define USE_TEMPORARY_MEMORY // use Macintosh temporary memory. // CFLAGS= -O -DNO_SIGNALS -DALL_INTERIOR_POINTERS -DSILENT // //LIBGC_CFLAGS= -O -DNO_SIGNALS -DSILENT \ // -DREDIRECT_MALLOC=GC_malloc_uncollectable \ // -DDONT_ADD_BYTE_AT_END -DALL_INTERIOR_POINTERS // Flags for building libgc.a -- the last two are required. // // Setjmp_test may yield overly optimistic results when compiled // without optimization. // -DSILENT disables statistics printing, and improves performance. // -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly // altered stubborn objects, at substantial performance cost. // Use only for incremental collector debugging. // -DFIND_LEAK causes the collector to assume that all inaccessible // objects should have been explicitly deallocated, and reports exceptions. // Finalization and the test program are not usable in this mode. // -DSOLARIS_THREADS enables support for Solaris (thr_) threads. // (Clients should also define SOLARIS_THREADS and then include // gc.h before performing thr_ or GC_ operations.) // This is broken on nonSPARC machines. // -DALL_INTERIOR_POINTERS allows all pointers to the interior // of objects to be recognized. (See gc_priv.h for consequences.) // -DSMALL_CONFIG tries to tune the collector for small heap sizes, // usually causing it to use less space in such situations. // Incremental collection no longer works in this case. // -DLARGE_CONFIG tunes the collector for unusually large heaps. // Necessary for heaps larger than about 500 MB on most machines. // Recommended for heaps larger than about 64 MB. // -DDONT_ADD_BYTE_AT_END is meaningful only with // -DALL_INTERIOR_POINTERS. Normally -DALL_INTERIOR_POINTERS // causes all objects to be padded so that pointers just past the end of // an object can be recognized. This can be expensive. (The padding // is normally more than one byte due to alignment constraints.) // -DDONT_ADD_BYTE_AT_END disables the padding. // -DNO_SIGNALS does not disable signals during critical parts of // the GC process. This is no less correct than many malloc // implementations, and it sometimes has a significant performance // impact. However, it is dangerous for many not-quite-ANSI C // programs that call things like printf in asynchronous signal handlers. // -DGC_OPERATOR_NEW_ARRAY declares that the C++ compiler supports the // new syntax "operator new[]" for allocating and deleting arrays. // See gc_cpp.h for details. No effect on the C part of the collector. // This is defined implicitly in a few environments. // -DREDIRECT_MALLOC=X causes malloc, realloc, and free to be defined // as aliases for X, GC_realloc, and GC_free, respectively. // Calloc is redefined in terms of the new malloc. X should // be either GC_malloc or GC_malloc_uncollectable. // The former is occasionally useful for working around leaks in code // you don't want to (or can't) look at. It may not work for // existing code, but it often does. Neither works on all platforms, // since some ports use malloc or calloc to obtain system memory. // (Probably works for UNIX, and win32.) // -DNO_DEBUG removes GC_dump and the debugging routines it calls. // Reduces code size slightly at the expense of debuggability. synopsis-0.12/src/Synopsis/gc/Mac_files/MacOS_config.h0000664000076400007640000001003411104702320022174 0ustar stefanstefan/* MacOS_config.h Configuration flags for Macintosh development systems. 11/16/95 pcb Updated compilation flags to reflect latest 4.6 Makefile. by Patrick C. Beard. */ /* Boehm, November 17, 1995 12:10 pm PST */ #ifdef __MWERKS__ // for CodeWarrior Pro with Metrowerks Standard Library (MSL). // #define MSL_USE_PRECOMPILED_HEADERS 0 #include #ifndef __STDC__ #define __STDC__ 0 #endif #endif /* __MWERKS__ */ // these are defined again in gc_priv.h. #undef TRUE #undef FALSE #define ALL_INTERIOR_POINTERS // follows interior pointers. #define SILENT // no collection messages. //#define DONT_ADD_BYTE_AT_END // no padding. //#define SMALL_CONFIG // whether to use a smaller heap. #define NO_SIGNALS // signals aren't real on the Macintosh. #define USE_TEMPORARY_MEMORY // use Macintosh temporary memory. // CFLAGS= -O -DNO_SIGNALS -DSILENT -DALL_INTERIOR_POINTERS // //LIBGC_CFLAGS= -O -DNO_SIGNALS -DSILENT \ // -DREDIRECT_MALLOC=GC_malloc_uncollectable \ // -DDONT_ADD_BYTE_AT_END -DALL_INTERIOR_POINTERS // Flags for building libgc.a -- the last two are required. // // Setjmp_test may yield overly optimistic results when compiled // without optimization. // -DSILENT disables statistics printing, and improves performance. // -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly // altered stubborn objects, at substantial performance cost. // Use only for incremental collector debugging. // -DFIND_LEAK causes the collector to assume that all inaccessible // objects should have been explicitly deallocated, and reports exceptions. // Finalization and the test program are not usable in this mode. // -DSOLARIS_THREADS enables support for Solaris (thr_) threads. // (Clients should also define SOLARIS_THREADS and then include // gc.h before performing thr_ or GC_ operations.) // This is broken on nonSPARC machines. // -DALL_INTERIOR_POINTERS allows all pointers to the interior // of objects to be recognized. (See gc_priv.h for consequences.) // -DSMALL_CONFIG tries to tune the collector for small heap sizes, // usually causing it to use less space in such situations. // Incremental collection no longer works in this case. // -DLARGE_CONFIG tunes the collector for unusually large heaps. // Necessary for heaps larger than about 500 MB on most machines. // Recommended for heaps larger than about 64 MB. // -DDONT_ADD_BYTE_AT_END is meaningful only with // -DALL_INTERIOR_POINTERS. Normally -DALL_INTERIOR_POINTERS // causes all objects to be padded so that pointers just past the end of // an object can be recognized. This can be expensive. (The padding // is normally more than one byte due to alignment constraints.) // -DDONT_ADD_BYTE_AT_END disables the padding. // -DNO_SIGNALS does not disable signals during critical parts of // the GC process. This is no less correct than many malloc // implementations, and it sometimes has a significant performance // impact. However, it is dangerous for many not-quite-ANSI C // programs that call things like printf in asynchronous signal handlers. // -DGC_OPERATOR_NEW_ARRAY declares that the C++ compiler supports the // new syntax "operator new[]" for allocating and deleting arrays. // See gc_cpp.h for details. No effect on the C part of the collector. // This is defined implicitly in a few environments. // -DREDIRECT_MALLOC=X causes malloc, realloc, and free to be defined // as aliases for X, GC_realloc, and GC_free, respectively. // Calloc is redefined in terms of the new malloc. X should // be either GC_malloc or GC_malloc_uncollectable. // The former is occasionally useful for working around leaks in code // you don't want to (or can't) look at. It may not work for // existing code, but it often does. Neither works on all platforms, // since some ports use malloc or calloc to obtain system memory. // (Probably works for UNIX, and win32.) // -DNO_DEBUG removes GC_dump and the debugging routines it calls. // Reduces code size slightly at the expense of debuggability. synopsis-0.12/src/Synopsis/gc/Mac_files/datastart.c0000664000076400007640000000017511104702320021674 0ustar stefanstefan/* datastart.c A hack to get the extent of global data for the Macintosh. by Patrick C. Beard. */ long __datastart; synopsis-0.12/src/Synopsis/gc/Mac_files/dataend.c0000664000076400007640000000017111104702320021301 0ustar stefanstefan/* dataend.c A hack to get the extent of global data for the Macintosh. by Patrick C. Beard. */ long __dataend; synopsis-0.12/src/Synopsis/gc/version.h0000664000076400007640000000202111104702316017512 0ustar stefanstefan/* The version here should match that in configure/configure.ac */ /* Eventually this one may become unnecessary. For now we need */ /* it to keep the old-style build process working. */ #define GC_TMP_VERSION_MAJOR 7 #define GC_TMP_VERSION_MINOR 0 #define GC_TMP_ALPHA_VERSION GC_NOT_ALPHA #ifndef GC_NOT_ALPHA # define GC_NOT_ALPHA 0xff #endif #if defined(GC_VERSION_MAJOR) # if GC_TMP_VERSION_MAJOR != GC_VERSION_MAJOR || \ GC_TMP_VERSION_MINOR != GC_VERSION_MINOR || \ defined(GC_ALPHA_VERSION) != (GC_TMP_ALPHA_VERSION != GC_NOT_ALPHA) || \ defined(GC_ALPHA_VERSION) && GC_TMP_ALPHA_VERSION != GC_ALPHA_VERSION # error Inconsistent version info. Check README, version.h, and configure.ac. # endif #else # define GC_VERSION_MAJOR GC_TMP_VERSION_MAJOR # define GC_VERSION_MINOR GC_TMP_VERSION_MINOR # define GC_ALPHA_VERSION GC_TMP_ALPHA_VERSION #endif #ifndef GC_NO_VERSION_VAR unsigned GC_version = ((GC_VERSION_MAJOR << 16) | (GC_VERSION_MINOR << 8) | GC_TMP_ALPHA_VERSION); #endif /* GC_NO_VERSION_VAR */ synopsis-0.12/src/Synopsis/gc/darwin_stop_world.c0000664000076400007640000004400011104702316021563 0ustar stefanstefan#include "private/pthread_support.h" /* This probably needs more porting work to ppc64. */ # if defined(GC_DARWIN_THREADS) /* From "Inside Mac OS X - Mach-O Runtime Architecture" published by Apple Page 49: "The space beneath the stack pointer, where a new stack frame would normally be allocated, is called the red zone. This area as shown in Figure 3-2 may be used for any purpose as long as a new stack frame does not need to be added to the stack." Page 50: "If a leaf procedure's red zone usage would exceed 224 bytes, then it must set up a stack frame just like routines that call other routines." */ #ifdef POWERPC # if CPP_WORDSZ == 32 # define PPC_RED_ZONE_SIZE 224 # elif CPP_WORDSZ == 64 # define PPC_RED_ZONE_SIZE 320 # endif #endif typedef struct StackFrame { unsigned long savedSP; unsigned long savedCR; unsigned long savedLR; unsigned long reserved[2]; unsigned long savedRTOC; } StackFrame; unsigned long FindTopOfStack(unsigned long stack_start) { StackFrame *frame; if (stack_start == 0) { # ifdef POWERPC # if CPP_WORDSZ == 32 __asm__ volatile("lwz %0,0(r1)" : "=r" (frame)); # else __asm__ volatile("ld %0,0(r1)" : "=r" (frame)); # endif # endif } else { frame = (StackFrame *)stack_start; } # ifdef DEBUG_THREADS /* GC_printf("FindTopOfStack start at sp = %p\n", frame); */ # endif do { if (frame->savedSP == 0) break; /* if there are no more stack frames, stop */ frame = (StackFrame*)frame->savedSP; /* we do these next two checks after going to the next frame because the LR for the first stack frame in the loop is not set up on purpose, so we shouldn't check it. */ if ((frame->savedLR & ~3) == 0) break; /* if the next LR is bogus, stop */ if ((~(frame->savedLR) & ~3) == 0) break; /* ditto */ } while (1); # ifdef DEBUG_THREADS /* GC_printf("FindTopOfStack finish at sp = %p\n", frame); */ # endif return (unsigned long)frame; } #ifdef DARWIN_DONT_PARSE_STACK void GC_push_all_stacks() { int i; kern_return_t r; GC_thread p; pthread_t me; ptr_t lo, hi; GC_THREAD_STATE_T state; /* MACHINE_THREAD_STATE_COUNT doesn't seem to be defined everywhere. */ /* Hence we use our own version. */ mach_msg_type_number_t thread_state_count = GC_MACH_THREAD_STATE_COUNT; me = pthread_self(); if (!GC_thr_initialized) GC_thr_init(); for(i = 0; i < THREAD_TABLE_SZ; i++) { for(p = GC_threads[i]; p != 0; p = p->next) { if(p->flags & FINISHED) continue; if(pthread_equal(p->id, me)) { lo = GC_approx_sp(); } else { /* Get the thread state (registers, etc) */ r = thread_get_state(p->stop_info.mach_thread, GC_MACH_THREAD_STATE, (natural_t*)&state, &thread_state_count); # ifdef DEBUG_THREADS GC_printf("thread_get_state return value = %d\n", r); # endif if(r != KERN_SUCCESS) ABORT("thread_get_state failed"); # if defined(I386) lo = (void*)state . THREAD_FLD (esp); GC_push_one(state . THREAD_FLD (eax)); GC_push_one(state . THREAD_FLD (ebx)); GC_push_one(state . THREAD_FLD (ecx)); GC_push_one(state . THREAD_FLD (edx)); GC_push_one(state . THREAD_FLD (edi)); GC_push_one(state . THREAD_FLD (esi)); GC_push_one(state . THREAD_FLD (ebp)); # elif defined(X86_64) lo = (void*)state . THREAD_FLD (rsp); GC_push_one(state . THREAD_FLD (rax)); GC_push_one(state . THREAD_FLD (rbx)); GC_push_one(state . THREAD_FLD (rcx)); GC_push_one(state . THREAD_FLD (rdx)); GC_push_one(state . THREAD_FLD (rdi)); GC_push_one(state . THREAD_FLD (rsi)); GC_push_one(state . THREAD_FLD (rbp)); GC_push_one(state . THREAD_FLD (rsp)); GC_push_one(state . THREAD_FLD (r8)); GC_push_one(state . THREAD_FLD (r9)); GC_push_one(state . THREAD_FLD (r10)); GC_push_one(state . THREAD_FLD (r11)); GC_push_one(state . THREAD_FLD (r12)); GC_push_one(state . THREAD_FLD (r13)); GC_push_one(state . THREAD_FLD (r14)); GC_push_one(state . THREAD_FLD (r15)); GC_push_one(state . THREAD_FLD (rip)); GC_push_one(state . THREAD_FLD (rflags)); GC_push_one(state . THREAD_FLD (cs)); GC_push_one(state . THREAD_FLD (fs)); GC_push_one(state . THREAD_FLD (gs)); # elif defined(POWERPC) lo = (void*)(state . THREAD_FLD (r1) - PPC_RED_ZONE_SIZE); GC_push_one(state . THREAD_FLD (r0)); GC_push_one(state . THREAD_FLD (r2)); GC_push_one(state . THREAD_FLD (r3)); GC_push_one(state . THREAD_FLD (r4)); GC_push_one(state . THREAD_FLD (r5)); GC_push_one(state . THREAD_FLD (r6)); GC_push_one(state . THREAD_FLD (r7)); GC_push_one(state . THREAD_FLD (r8)); GC_push_one(state . THREAD_FLD (r9)); GC_push_one(state . THREAD_FLD (r10)); GC_push_one(state . THREAD_FLD (r11)); GC_push_one(state . THREAD_FLD (r12)); GC_push_one(state . THREAD_FLD (r13)); GC_push_one(state . THREAD_FLD (r14)); GC_push_one(state . THREAD_FLD (r15)); GC_push_one(state . THREAD_FLD (r16)); GC_push_one(state . THREAD_FLD (r17)); GC_push_one(state . THREAD_FLD (r18)); GC_push_one(state . THREAD_FLD (r19)); GC_push_one(state . THREAD_FLD (r20)); GC_push_one(state . THREAD_FLD (r21)); GC_push_one(state . THREAD_FLD (r22)); GC_push_one(state . THREAD_FLD (r23)); GC_push_one(state . THREAD_FLD (r24)); GC_push_one(state . THREAD_FLD (r25)); GC_push_one(state . THREAD_FLD (r26)); GC_push_one(state . THREAD_FLD (r27)); GC_push_one(state . THREAD_FLD (r28)); GC_push_one(state . THREAD_FLD (r29)); GC_push_one(state . THREAD_FLD (r30)); GC_push_one(state . THREAD_FLD (r31)); # else # error FIXME for non-x86 || ppc architectures # endif } /* p != me */ if(p->flags & MAIN_THREAD) hi = GC_stackbottom; else hi = p->stack_end; # if DEBUG_THREADS GC_printf("Darwin: Stack for thread 0x%lx = [%lx,%lx)\n", (unsigned long) p -> id, (unsigned long) lo, (unsigned long) hi); # endif GC_push_all_stack(lo, hi); } /* for(p=GC_threads[i]...) */ } /* for(i=0;i */ /* * Linux_threads.c now also includes some code to support HPUX and * OSF1 (Compaq Tru64 Unix, really). The OSF1 support is based on Eric Benson's * patch. * * Eric also suggested an alternate basis for a lock implementation in * his code: * + #elif defined(OSF1) * + unsigned long GC_allocate_lock = 0; * + msemaphore GC_allocate_semaphore; * + # define GC_TRY_LOCK() \ * + ((msem_lock(&GC_allocate_semaphore, MSEM_IF_NOWAIT) == 0) \ * + ? (GC_allocate_lock = 1) \ * + : 0) * + # define GC_LOCK_TAKEN GC_allocate_lock */ /*#define DEBUG_THREADS 1*/ # include "private/pthread_support.h" # if defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS) # if defined(GC_DGUX386_THREADS) && !defined(_POSIX4A_DRAFT10_SOURCE) # define _POSIX4A_DRAFT10_SOURCE 1 # endif # if defined(GC_DGUX386_THREADS) && !defined(_USING_POSIX4A_DRAFT10) # define _USING_POSIX4A_DRAFT10 1 # endif # include # include # include # include # include # include # include # include # include # include # include # include # include "gc_inline.h" #if defined(GC_DARWIN_THREADS) # include "private/darwin_semaphore.h" #else # include #endif /* !GC_DARWIN_THREADS */ #if defined(GC_DARWIN_THREADS) || defined(GC_FREEBSD_THREADS) # include #endif /* GC_DARWIN_THREADS */ #if defined(GC_NETBSD_THREADS) # include # include #endif /* GC_NETBSD_THREADS */ /* Allocator lock definitions. */ #if !defined(USE_SPIN_LOCK) pthread_mutex_t GC_allocate_ml = PTHREAD_MUTEX_INITIALIZER; #endif unsigned long GC_lock_holder = NO_THREAD; /* Used only for assertions, and to prevent */ /* recursive reentry in the system call wrapper. */ #if defined(GC_DGUX386_THREADS) # include # include /* sem_t is an uint in DG/UX */ typedef unsigned int sem_t; #endif /* GC_DGUX386_THREADS */ #ifndef __GNUC__ # define __inline__ #endif /* Undefine macros used to redirect pthread primitives. */ # undef pthread_create # if !defined(GC_DARWIN_THREADS) # undef pthread_sigmask # endif # undef pthread_join # undef pthread_detach # if defined(GC_OSF1_THREADS) && defined(_PTHREAD_USE_MANGLED_NAMES_) \ && !defined(_PTHREAD_USE_PTDNAM_) /* Restore the original mangled names on Tru64 UNIX. */ # define pthread_create __pthread_create # define pthread_join __pthread_join # define pthread_detach __pthread_detach # endif #ifdef GC_USE_LD_WRAP # define WRAP_FUNC(f) __wrap_##f # define REAL_FUNC(f) __real_##f #else # ifdef GC_USE_DLOPEN_WRAP # include # define WRAP_FUNC(f) f # define REAL_FUNC(f) GC_real_##f /* We define both GC_f and plain f to be the wrapped function. */ /* In that way plain calls work, as do calls from files that */ /* included gc.h, wich redefined f to GC_f. */ /* FIXME: Needs work for DARWIN and True64 (OSF1) */ typedef int (* GC_pthread_create_t)(pthread_t *, const pthread_attr_t *, void * (*)(void *), void *); static GC_pthread_create_t GC_real_pthread_create; typedef int (* GC_pthread_sigmask_t)(int, const sigset_t *, sigset_t *); static GC_pthread_sigmask_t GC_real_pthread_sigmask; typedef int (* GC_pthread_join_t)(pthread_t, void **); static GC_pthread_join_t GC_real_pthread_join; typedef int (* GC_pthread_detach_t)(pthread_t); static GC_pthread_detach_t GC_real_pthread_detach; # else # define WRAP_FUNC(f) GC_##f # if !defined(GC_DGUX386_THREADS) # define REAL_FUNC(f) f # else /* GC_DGUX386_THREADS */ # define REAL_FUNC(f) __d10_##f # endif /* GC_DGUX386_THREADS */ # endif #endif #if defined(GC_USE_DL_WRAP) || defined(GC_USE_DLOPEN_WRAP) /* Define GC_ functions as aliases for the plain ones, which will */ /* be intercepted. This allows files which include gc.h, and hence */ /* generate referemces to the GC_ symbols, to see the right symbols. */ int GC_pthread_create(pthread_t * t, const pthread_attr_t * a, void * (* fn)(void *), void * arg) { return pthread_create(t, a, fn, arg); } int GC_pthread_sigmask(int how, const sigset_t *mask, sigset_t *old) { return pthread_sigmask(how, mask, old); } int GC_pthread_join(pthread_t t, void **res) { return pthread_join(t, res); } int GC_pthread_detach(pthread_t t) { return pthread_detach(t); } #endif /* Linker-based interception. */ #ifdef GC_USE_DLOPEN_WRAP static GC_bool GC_syms_initialized = FALSE; void GC_init_real_syms(void) { void *dl_handle; # define LIBPTHREAD_NAME "libpthread.so.0" # define LIBPTHREAD_NAME_LEN 16 /* incl. trailing 0 */ size_t len = LIBPTHREAD_NAME_LEN - 1; char namebuf[LIBPTHREAD_NAME_LEN]; static char *libpthread_name = LIBPTHREAD_NAME; if (GC_syms_initialized) return; # ifdef RTLD_NEXT dl_handle = RTLD_NEXT; # else dl_handle = dlopen(libpthread_name, RTLD_LAZY); if (NULL == dl_handle) { while (isdigit(libpthread_name[len-1])) --len; if (libpthread_name[len-1] == '.') --len; memcpy(namebuf, libpthread_name, len); namebuf[len] = '\0'; dl_handle = dlopen(namebuf, RTLD_LAZY); } if (NULL == dl_handle) ABORT("Couldn't open libpthread\n"); # endif GC_real_pthread_create = (GC_pthread_create_t) dlsym(dl_handle, "pthread_create"); GC_real_pthread_sigmask = (GC_pthread_sigmask_t) dlsym(dl_handle, "pthread_sigmask"); GC_real_pthread_join = (GC_pthread_join_t) dlsym(dl_handle, "pthread_join"); GC_real_pthread_detach = (GC_pthread_detach_t) dlsym(dl_handle, "pthread_detach"); GC_syms_initialized = TRUE; } # define INIT_REAL_SYMS() if (!GC_syms_initialized) GC_init_real_syms(); #else # define INIT_REAL_SYMS() #endif void GC_thr_init(void); static GC_bool parallel_initialized = FALSE; GC_bool GC_need_to_lock = FALSE; void GC_init_parallel(void); long GC_nprocs = 1; /* Number of processors. We may not have */ /* access to all of them, but this is as good */ /* a guess as any ... */ #ifdef THREAD_LOCAL_ALLOC /* We must explicitly mark ptrfree and gcj free lists, since the free */ /* list links wouldn't otherwise be found. We also set them in the */ /* normal free lists, since that involves touching less memory than if */ /* we scanned them normally. */ void GC_mark_thread_local_free_lists(void) { int i; GC_thread p; for (i = 0; i < THREAD_TABLE_SZ; ++i) { for (p = GC_threads[i]; 0 != p; p = p -> next) { GC_mark_thread_local_fls_for(&(p->tlfs)); } } } #if defined(GC_ASSERTIONS) /* Check that all thread-local free-lists are completely marked. */ /* also check that thread-specific-data structures are marked. */ void GC_check_tls(void) { int i; GC_thread p; for (i = 0; i < THREAD_TABLE_SZ; ++i) { for (p = GC_threads[i]; 0 != p; p = p -> next) { GC_check_tls_for(&(p->tlfs)); } } # if defined(USE_CUSTOM_SPECIFIC) if (GC_thread_key != 0) GC_check_tsd_marks(GC_thread_key); # endif } #endif /* GC_ASSERTIONS */ #endif /* Thread_local_alloc */ #ifdef PARALLEL_MARK # ifndef MAX_MARKERS # define MAX_MARKERS 16 # endif static ptr_t marker_sp[MAX_MARKERS] = {0}; #ifdef IA64 static ptr_t marker_bsp[MAX_MARKERS] = {0}; #endif void * GC_mark_thread(void * id) { word my_mark_no = 0; marker_sp[(word)id] = GC_approx_sp(); # ifdef IA64 marker_bsp[(word)id] = GC_save_regs_in_stack(); # endif for (;; ++my_mark_no) { /* GC_mark_no is passed only to allow GC_help_marker to terminate */ /* promptly. This is important if it were called from the signal */ /* handler or from the GC lock acquisition code. Under Linux, it's */ /* not safe to call it from a signal handler, since it uses mutexes */ /* and condition variables. Since it is called only here, the */ /* argument is unnecessary. */ if (my_mark_no < GC_mark_no || my_mark_no > GC_mark_no + 2) { /* resynchronize if we get far off, e.g. because GC_mark_no */ /* wrapped. */ my_mark_no = GC_mark_no; } # ifdef DEBUG_THREADS GC_printf("Starting mark helper for mark number %lu\n", my_mark_no); # endif GC_help_marker(my_mark_no); } } extern long GC_markers; /* Number of mark threads we would */ /* like to have. Includes the */ /* initiating thread. */ pthread_t GC_mark_threads[MAX_MARKERS]; #define PTHREAD_CREATE REAL_FUNC(pthread_create) static void start_mark_threads(void) { unsigned i; pthread_attr_t attr; if (GC_markers > MAX_MARKERS) { WARN("Limiting number of mark threads\n", 0); GC_markers = MAX_MARKERS; } if (0 != pthread_attr_init(&attr)) ABORT("pthread_attr_init failed"); if (0 != pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)) ABORT("pthread_attr_setdetachstate failed"); # if defined(HPUX) || defined(GC_DGUX386_THREADS) /* Default stack size is usually too small: fix it. */ /* Otherwise marker threads or GC may run out of */ /* space. */ # define MIN_STACK_SIZE (8*HBLKSIZE*sizeof(word)) { size_t old_size; int code; if (pthread_attr_getstacksize(&attr, &old_size) != 0) ABORT("pthread_attr_getstacksize failed\n"); if (old_size < MIN_STACK_SIZE) { if (pthread_attr_setstacksize(&attr, MIN_STACK_SIZE) != 0) ABORT("pthread_attr_setstacksize failed\n"); } } # endif /* HPUX || GC_DGUX386_THREADS */ if (GC_print_stats) { GC_log_printf("Starting %ld marker threads\n", GC_markers - 1); } for (i = 0; i < GC_markers - 1; ++i) { if (0 != PTHREAD_CREATE(GC_mark_threads + i, &attr, GC_mark_thread, (void *)(word)i)) { WARN("Marker thread creation failed, errno = %ld.\n", errno); } } } #endif /* PARALLEL_MARK */ GC_bool GC_thr_initialized = FALSE; volatile GC_thread GC_threads[THREAD_TABLE_SZ]; void GC_push_thread_structures(void) { GC_ASSERT(I_HOLD_LOCK()); GC_push_all((ptr_t)(GC_threads), (ptr_t)(GC_threads)+sizeof(GC_threads)); # if defined(THREAD_LOCAL_ALLOC) GC_push_all((ptr_t)(&GC_thread_key), (ptr_t)(&GC_thread_key)+sizeof(&GC_thread_key)); # endif } /* It may not be safe to allocate when we register the first thread. */ static struct GC_Thread_Rep first_thread; /* Add a thread to GC_threads. We assume it wasn't already there. */ /* Caller holds allocation lock. */ GC_thread GC_new_thread(pthread_t id) { int hv = NUMERIC_THREAD_ID(id) % THREAD_TABLE_SZ; GC_thread result; static GC_bool first_thread_used = FALSE; GC_ASSERT(I_HOLD_LOCK()); if (!first_thread_used) { result = &first_thread; first_thread_used = TRUE; } else { result = (struct GC_Thread_Rep *) GC_INTERNAL_MALLOC(sizeof(struct GC_Thread_Rep), NORMAL); GC_ASSERT(result -> flags == 0); } if (result == 0) return(0); result -> id = id; result -> next = GC_threads[hv]; GC_threads[hv] = result; GC_ASSERT(result -> flags == 0 && result -> thread_blocked == 0); return(result); } /* Delete a thread from GC_threads. We assume it is there. */ /* (The code intentionally traps if it wasn't.) */ void GC_delete_thread(pthread_t id) { int hv = NUMERIC_THREAD_ID(id) % THREAD_TABLE_SZ; register GC_thread p = GC_threads[hv]; register GC_thread prev = 0; GC_ASSERT(I_HOLD_LOCK()); while (!THREAD_EQUAL(p -> id, id)) { prev = p; p = p -> next; } if (prev == 0) { GC_threads[hv] = p -> next; } else { prev -> next = p -> next; } # ifdef GC_DARWIN_THREADS mach_port_deallocate(mach_task_self(), p->stop_info.mach_thread); # endif GC_INTERNAL_FREE(p); } /* If a thread has been joined, but we have not yet */ /* been notified, then there may be more than one thread */ /* in the table with the same pthread id. */ /* This is OK, but we need a way to delete a specific one. */ void GC_delete_gc_thread(GC_thread gc_id) { pthread_t id = gc_id -> id; int hv = NUMERIC_THREAD_ID(id) % THREAD_TABLE_SZ; register GC_thread p = GC_threads[hv]; register GC_thread prev = 0; GC_ASSERT(I_HOLD_LOCK()); while (p != gc_id) { prev = p; p = p -> next; } if (prev == 0) { GC_threads[hv] = p -> next; } else { prev -> next = p -> next; } # ifdef GC_DARWIN_THREADS mach_port_deallocate(mach_task_self(), p->stop_info.mach_thread); # endif GC_INTERNAL_FREE(p); } /* Return a GC_thread corresponding to a given pthread_t. */ /* Returns 0 if it's not there. */ /* Caller holds allocation lock or otherwise inhibits */ /* updates. */ /* If there is more than one thread with the given id we */ /* return the most recent one. */ GC_thread GC_lookup_thread(pthread_t id) { int hv = NUMERIC_THREAD_ID(id) % THREAD_TABLE_SZ; register GC_thread p = GC_threads[hv]; while (p != 0 && !THREAD_EQUAL(p -> id, id)) p = p -> next; return(p); } #ifdef HANDLE_FORK /* Remove all entries from the GC_threads table, except the */ /* one for the current thread. We need to do this in the child */ /* process after a fork(), since only the current thread */ /* survives in the child. */ void GC_remove_all_threads_but_me(void) { pthread_t self = pthread_self(); int hv; GC_thread p, next, me; for (hv = 0; hv < THREAD_TABLE_SZ; ++hv) { me = 0; for (p = GC_threads[hv]; 0 != p; p = next) { next = p -> next; if (THREAD_EQUAL(p -> id, self)) { me = p; p -> next = 0; } else { # ifdef THREAD_LOCAL_ALLOC if (!(p -> flags & FINISHED)) { GC_destroy_thread_local(&(p->tlfs)); } # endif /* THREAD_LOCAL_ALLOC */ if (p != &first_thread) GC_INTERNAL_FREE(p); } } GC_threads[hv] = me; } } #endif /* HANDLE_FORK */ #ifdef USE_PROC_FOR_LIBRARIES GC_bool GC_segment_is_thread_stack(ptr_t lo, ptr_t hi) { int i; GC_thread p; GC_ASSERT(I_HOLD_LOCK()); # ifdef PARALLEL_MARK for (i = 0; i < GC_markers; ++i) { if (marker_sp[i] > lo & marker_sp[i] < hi) return TRUE; # ifdef IA64 if (marker_bsp[i] > lo & marker_bsp[i] < hi) return TRUE; # endif } # endif for (i = 0; i < THREAD_TABLE_SZ; i++) { for (p = GC_threads[i]; p != 0; p = p -> next) { if (0 != p -> stack_end) { # ifdef STACK_GROWS_UP if (p -> stack_end >= lo && p -> stack_end < hi) return TRUE; # else /* STACK_GROWS_DOWN */ if (p -> stack_end > lo && p -> stack_end <= hi) return TRUE; # endif } } } return FALSE; } #endif /* USE_PROC_FOR_LIBRARIES */ #ifdef IA64 /* Find the largest stack_base smaller than bound. May be used */ /* to find the boundary between a register stack and adjacent */ /* immediately preceding memory stack. */ ptr_t GC_greatest_stack_base_below(ptr_t bound) { int i; GC_thread p; ptr_t result = 0; GC_ASSERT(I_HOLD_LOCK()); # ifdef PARALLEL_MARK for (i = 0; i < GC_markers; ++i) { if (marker_sp[i] > result && marker_sp[i] < bound) result = marker_sp[i]; } # endif for (i = 0; i < THREAD_TABLE_SZ; i++) { for (p = GC_threads[i]; p != 0; p = p -> next) { if (p -> stack_end > result && p -> stack_end < bound) { result = p -> stack_end; } } } return result; } #endif /* IA64 */ #ifdef GC_LINUX_THREADS /* Return the number of processors, or i<= 0 if it can't be determined. */ int GC_get_nprocs(void) { /* Should be "return sysconf(_SC_NPROCESSORS_ONLN);" but that */ /* appears to be buggy in many cases. */ /* We look for lines "cpu" in /proc/stat. */ # define STAT_BUF_SIZE 4096 # define STAT_READ read /* If read is wrapped, this may need to be redefined to call */ /* the real one. */ char stat_buf[STAT_BUF_SIZE]; int f; word result = 1; /* Some old kernels only have a single "cpu nnnn ..." */ /* entry in /proc/stat. We identify those as */ /* uniprocessors. */ size_t i, len = 0; f = open("/proc/stat", O_RDONLY); if (f < 0 || (len = STAT_READ(f, stat_buf, STAT_BUF_SIZE)) < 100) { WARN("Couldn't read /proc/stat\n", 0); return -1; } for (i = 0; i < len - 100; ++i) { if (stat_buf[i] == '\n' && stat_buf[i+1] == 'c' && stat_buf[i+2] == 'p' && stat_buf[i+3] == 'u') { int cpu_no = atoi(stat_buf + i + 4); if (cpu_no >= result) result = cpu_no + 1; } } close(f); return result; } #endif /* GC_LINUX_THREADS */ /* We hold the GC lock. Wait until an in-progress GC has finished. */ /* Repeatedly RELEASES GC LOCK in order to wait. */ /* If wait_for_all is true, then we exit with the GC lock held and no */ /* collection in progress; otherwise we just wait for the current GC */ /* to finish. */ extern GC_bool GC_collection_in_progress(void); void GC_wait_for_gc_completion(GC_bool wait_for_all) { GC_ASSERT(I_HOLD_LOCK()); if (GC_incremental && GC_collection_in_progress()) { int old_gc_no = GC_gc_no; /* Make sure that no part of our stack is still on the mark stack, */ /* since it's about to be unmapped. */ while (GC_incremental && GC_collection_in_progress() && (wait_for_all || old_gc_no == GC_gc_no)) { ENTER_GC(); GC_in_thread_creation = TRUE; GC_collect_a_little_inner(1); GC_in_thread_creation = FALSE; EXIT_GC(); UNLOCK(); sched_yield(); LOCK(); } } } #ifdef HANDLE_FORK /* Procedures called before and after a fork. The goal here is to make */ /* it safe to call GC_malloc() in a forked child. It's unclear that is */ /* attainable, since the single UNIX spec seems to imply that one */ /* should only call async-signal-safe functions, and we probably can't */ /* quite guarantee that. But we give it our best shot. (That same */ /* spec also implies that it's not safe to call the system malloc */ /* between fork() and exec(). Thus we're doing no worse than it. */ /* Called before a fork() */ void GC_fork_prepare_proc(void) { /* Acquire all relevant locks, so that after releasing the locks */ /* the child will see a consistent state in which monitor */ /* invariants hold. Unfortunately, we can't acquire libc locks */ /* we might need, and there seems to be no guarantee that libc */ /* must install a suitable fork handler. */ /* Wait for an ongoing GC to finish, since we can't finish it in */ /* the (one remaining thread in) the child. */ LOCK(); # if defined(PARALLEL_MARK) || defined(THREAD_LOCAL_ALLOC) GC_wait_for_reclaim(); # endif GC_wait_for_gc_completion(TRUE); # if defined(PARALLEL_MARK) || defined(THREAD_LOCAL_ALLOC) GC_acquire_mark_lock(); # endif } /* Called in parent after a fork() */ void GC_fork_parent_proc(void) { # if defined(PARALLEL_MARK) || defined(THREAD_LOCAL_ALLOC) GC_release_mark_lock(); # endif UNLOCK(); } /* Called in child after a fork() */ void GC_fork_child_proc(void) { /* Clean up the thread table, so that just our thread is left. */ # if defined(PARALLEL_MARK) || defined(THREAD_LOCAL_ALLOC) GC_release_mark_lock(); # endif GC_remove_all_threads_but_me(); # ifdef PARALLEL_MARK /* Turn off parallel marking in the child, since we are probably */ /* just going to exec, and we would have to restart mark threads. */ GC_markers = 1; GC_parallel = FALSE; # endif /* PARALLEL_MARK */ UNLOCK(); } #endif /* HANDLE_FORK */ #if defined(GC_DGUX386_THREADS) /* Return the number of processors, or i<= 0 if it can't be determined. */ int GC_get_nprocs(void) { /* */ int numCpus; struct dg_sys_info_pm_info pm_sysinfo; int status =0; status = dg_sys_info((long int *) &pm_sysinfo, DG_SYS_INFO_PM_INFO_TYPE, DG_SYS_INFO_PM_CURRENT_VERSION); if (status < 0) /* set -1 for error */ numCpus = -1; else /* Active CPUs */ numCpus = pm_sysinfo.idle_vp_count; # ifdef DEBUG_THREADS GC_printf("Number of active CPUs in this system: %d\n", numCpus); # endif return(numCpus); } #endif /* GC_DGUX386_THREADS */ #if defined(GC_NETBSD_THREADS) static int get_ncpu(void) { int mib[] = {CTL_HW,HW_NCPU}; int res; size_t len = sizeof(res); sysctl(mib, sizeof(mib)/sizeof(int), &res, &len, NULL, 0); return res; } #endif /* GC_NETBSD_THREADS */ # if defined(GC_LINUX_THREADS) && defined(INCLUDE_LINUX_THREAD_DESCR) __thread int dummy_thread_local; # endif /* We hold the allocation lock. */ void GC_thr_init(void) { # ifndef GC_DARWIN_THREADS int dummy; # endif GC_thread t; if (GC_thr_initialized) return; GC_thr_initialized = TRUE; # ifdef HANDLE_FORK /* Prepare for a possible fork. */ pthread_atfork(GC_fork_prepare_proc, GC_fork_parent_proc, GC_fork_child_proc); # endif /* HANDLE_FORK */ # if defined(INCLUDE_LINUX_THREAD_DESCR) /* Explicitly register the region including the address */ /* of a thread local variable. This should included thread */ /* locals for the main thread, except for those allocated */ /* in response to dlopen calls. */ { ptr_t thread_local_addr = (ptr_t)(&dummy_thread_local); ptr_t main_thread_start, main_thread_end; if (!GC_enclosing_mapping(thread_local_addr, &main_thread_start, &main_thread_end)) { ABORT("Failed to find mapping for main thread thread locals"); } GC_add_roots_inner(main_thread_start, main_thread_end, FALSE); } # endif /* Add the initial thread, so we can stop it. */ t = GC_new_thread(pthread_self()); # ifdef GC_DARWIN_THREADS t -> stop_info.mach_thread = mach_thread_self(); # else t -> stop_info.stack_ptr = (ptr_t)(&dummy); # endif t -> flags = DETACHED | MAIN_THREAD; GC_stop_init(); /* Set GC_nprocs. */ { char * nprocs_string = GETENV("GC_NPROCS"); GC_nprocs = -1; if (nprocs_string != NULL) GC_nprocs = atoi(nprocs_string); } if (GC_nprocs <= 0) { # if defined(GC_HPUX_THREADS) GC_nprocs = pthread_num_processors_np(); # endif # if defined(GC_OSF1_THREADS) || defined(GC_AIX_THREADS) \ || defined(GC_SOLARIS_THREADS) GC_nprocs = sysconf(_SC_NPROCESSORS_ONLN); if (GC_nprocs <= 0) GC_nprocs = 1; # endif # if defined(GC_IRIX_THREADS) GC_nprocs = sysconf(_SC_NPROC_ONLN); if (GC_nprocs <= 0) GC_nprocs = 1; # endif # if defined(GC_NETBSD_THREADS) GC_nprocs = get_ncpu(); # endif # if defined(GC_DARWIN_THREADS) || defined(GC_FREEBSD_THREADS) int ncpus = 1; size_t len = sizeof(ncpus); sysctl((int[2]) {CTL_HW, HW_NCPU}, 2, &ncpus, &len, NULL, 0); GC_nprocs = ncpus; # endif # if defined(GC_LINUX_THREADS) || defined(GC_DGUX386_THREADS) GC_nprocs = GC_get_nprocs(); # endif # if defined(GC_GNU_THREADS) if (GC_nprocs <= 0) GC_nprocs = 1; # endif } if (GC_nprocs <= 0) { WARN("GC_get_nprocs() returned %ld\n", GC_nprocs); GC_nprocs = 2; # ifdef PARALLEL_MARK GC_markers = 1; # endif } else { # ifdef PARALLEL_MARK { char * markers_string = GETENV("GC_MARKERS"); if (markers_string != NULL) { GC_markers = atoi(markers_string); } else { GC_markers = GC_nprocs; } } # endif } # ifdef PARALLEL_MARK if (GC_print_stats) { GC_log_printf("Number of processors = %ld, " "number of marker threads = %ld\n", GC_nprocs, GC_markers); } if (GC_markers == 1) { GC_parallel = FALSE; if (GC_print_stats) { GC_log_printf( "Single marker thread, turning off parallel marking\n"); } } else { GC_parallel = TRUE; /* Disable true incremental collection, but generational is OK. */ GC_time_limit = GC_TIME_UNLIMITED; } /* If we are using a parallel marker, actually start helper threads. */ if (GC_parallel) start_mark_threads(); # endif } /* Perform all initializations, including those that */ /* may require allocation. */ /* Called without allocation lock. */ /* Must be called before a second thread is created. */ /* Did we say it's called without the allocation lock? */ void GC_init_parallel(void) { if (parallel_initialized) return; parallel_initialized = TRUE; /* GC_init() calls us back, so set flag first. */ if (!GC_is_initialized) GC_init(); /* Initialize thread local free lists if used. */ # if defined(THREAD_LOCAL_ALLOC) LOCK(); GC_init_thread_local(&(GC_lookup_thread(pthread_self())->tlfs)); UNLOCK(); # endif } #if !defined(GC_DARWIN_THREADS) int WRAP_FUNC(pthread_sigmask)(int how, const sigset_t *set, sigset_t *oset) { sigset_t fudged_set; INIT_REAL_SYMS(); if (set != NULL && (how == SIG_BLOCK || how == SIG_SETMASK)) { fudged_set = *set; sigdelset(&fudged_set, SIG_SUSPEND); set = &fudged_set; } return(REAL_FUNC(pthread_sigmask)(how, set, oset)); } #endif /* !GC_DARWIN_THREADS */ /* Wrapper for functions that are likely to block for an appreciable */ /* length of time. */ struct blocking_data { void (*fn)(void *); void *arg; }; static void GC_do_blocking_inner(ptr_t data, void * context) { struct blocking_data * d = (struct blocking_data *) data; GC_thread me; LOCK(); me = GC_lookup_thread(pthread_self()); GC_ASSERT(!(me -> thread_blocked)); # ifdef SPARC me -> stop_info.stack_ptr = GC_save_regs_in_stack(); # elif !defined(GC_DARWIN_THREADS) me -> stop_info.stack_ptr = GC_approx_sp(); # endif # ifdef IA64 me -> backing_store_ptr = GC_save_regs_in_stack(); # endif me -> thread_blocked = TRUE; /* Save context here if we want to support precise stack marking */ UNLOCK(); (d -> fn)(d -> arg); LOCK(); /* This will block if the world is stopped. */ me -> thread_blocked = FALSE; UNLOCK(); } void GC_do_blocking(void (*fn)(void *), void *arg) { struct blocking_data my_data; my_data.fn = fn; my_data.arg = arg; GC_with_callee_saves_pushed(GC_do_blocking_inner, (ptr_t)(&my_data)); } struct start_info { void *(*start_routine)(void *); void *arg; word flags; sem_t registered; /* 1 ==> in our thread table, but */ /* parent hasn't yet noticed. */ }; int GC_unregister_my_thread(void) { GC_thread me; LOCK(); /* Wait for any GC that may be marking from our stack to */ /* complete before we remove this thread. */ GC_wait_for_gc_completion(FALSE); me = GC_lookup_thread(pthread_self()); # if defined(THREAD_LOCAL_ALLOC) GC_destroy_thread_local(&(me->tlfs)); # endif if (me -> flags & DETACHED) { GC_delete_thread(pthread_self()); } else { me -> flags |= FINISHED; } # if defined(THREAD_LOCAL_ALLOC) GC_remove_specific(GC_thread_key); # endif UNLOCK(); return GC_SUCCESS; } /* Called at thread exit. */ /* Never called for main thread. That's OK, since it */ /* results in at most a tiny one-time leak. And */ /* linuxthreads doesn't reclaim the main threads */ /* resources or id anyway. */ void GC_thread_exit_proc(void *arg) { GC_unregister_my_thread(); } int WRAP_FUNC(pthread_join)(pthread_t thread, void **retval) { int result; GC_thread thread_gc_id; INIT_REAL_SYMS(); LOCK(); thread_gc_id = GC_lookup_thread(thread); /* This is guaranteed to be the intended one, since the thread id */ /* cant have been recycled by pthreads. */ UNLOCK(); result = REAL_FUNC(pthread_join)(thread, retval); # if defined (GC_FREEBSD_THREADS) /* On FreeBSD, the wrapped pthread_join() sometimes returns (what appears to be) a spurious EINTR which caused the test and real code to gratuitously fail. Having looked at system pthread library source code, I see how this return code may be generated. In one path of code, pthread_join() just returns the errno setting of the thread being joined. This does not match the POSIX specification or the local man pages thus I have taken the liberty to catch this one spurious return value properly conditionalized on GC_FREEBSD_THREADS. */ if (result == EINTR) result = 0; # endif if (result == 0) { LOCK(); /* Here the pthread thread id may have been recycled. */ GC_delete_gc_thread(thread_gc_id); UNLOCK(); } return result; } int WRAP_FUNC(pthread_detach)(pthread_t thread) { int result; GC_thread thread_gc_id; INIT_REAL_SYMS(); LOCK(); thread_gc_id = GC_lookup_thread(thread); UNLOCK(); result = REAL_FUNC(pthread_detach)(thread); if (result == 0) { LOCK(); thread_gc_id -> flags |= DETACHED; /* Here the pthread thread id may have been recycled. */ if (thread_gc_id -> flags & FINISHED) { GC_delete_gc_thread(thread_gc_id); } UNLOCK(); } return result; } GC_bool GC_in_thread_creation = FALSE; /* Protected by allocation lock. */ GC_thread GC_register_my_thread_inner(struct GC_stack_base *sb, pthread_t my_pthread) { GC_thread me; GC_in_thread_creation = TRUE; /* OK to collect from unknown thread. */ me = GC_new_thread(my_pthread); GC_in_thread_creation = FALSE; # ifdef GC_DARWIN_THREADS me -> stop_info.mach_thread = mach_thread_self(); # else me -> stop_info.stack_ptr = sb -> mem_base; # endif me -> stack_end = sb -> mem_base; # ifdef IA64 me -> backing_store_end = sb -> reg_base; # endif /* IA64 */ return me; } int GC_register_my_thread(struct GC_stack_base *sb) { pthread_t my_pthread = pthread_self(); GC_thread me; LOCK(); me = GC_lookup_thread(my_pthread); if (0 == me) { me = GC_register_my_thread_inner(sb, my_pthread); me -> flags |= DETACHED; /* Treat as detached, since we do not need to worry about */ /* pointer results. */ UNLOCK(); return GC_SUCCESS; } else { UNLOCK(); return GC_DUPLICATE; } } void * GC_inner_start_routine(struct GC_stack_base *sb, void * arg) { struct start_info * si = arg; void * result; GC_thread me; pthread_t my_pthread; void *(*start)(void *); void *start_arg; my_pthread = pthread_self(); # ifdef DEBUG_THREADS GC_printf("Starting thread 0x%x\n", (unsigned)my_pthread); GC_printf("pid = %ld\n", (long) getpid()); GC_printf("sp = 0x%lx\n", (long) &arg); # endif LOCK(); me = GC_register_my_thread_inner(sb, my_pthread); me -> flags = si -> flags; UNLOCK(); start = si -> start_routine; # ifdef DEBUG_THREADS GC_printf("start_routine = %p\n", (void *)start); # endif start_arg = si -> arg; sem_post(&(si -> registered)); /* Last action on si. */ /* OK to deallocate. */ pthread_cleanup_push(GC_thread_exit_proc, 0); # if defined(THREAD_LOCAL_ALLOC) LOCK(); GC_init_thread_local(&(me->tlfs)); UNLOCK(); # endif result = (*start)(start_arg); # if DEBUG_THREADS GC_printf("Finishing thread 0x%x\n", (unsigned)pthread_self()); # endif me -> status = result; pthread_cleanup_pop(1); /* Cleanup acquires lock, ensuring that we can't exit */ /* while a collection that thinks we're alive is trying to stop */ /* us. */ return(result); } void * GC_start_routine(void * arg) { # ifdef INCLUDE_LINUX_THREAD_DESCR struct GC_stack_base sb; # ifdef REDIRECT_MALLOC /* GC_get_stack_base may call pthread_getattr_np, which can */ /* unfortunately call realloc, which may allocate from an */ /* unregistered thread. This is unpleasant, since it might */ /* force heap growth. */ GC_disable(); # endif if (GC_get_stack_base(&sb) != GC_SUCCESS) ABORT("Failed to get thread stack base."); # ifdef REDIRECT_MALLOC GC_enable(); # endif return GC_inner_start_routine(&sb, arg); # else return GC_call_with_stack_base(GC_inner_start_routine, arg); # endif } int WRAP_FUNC(pthread_create)(pthread_t *new_thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg) { int result; int detachstate; word my_flags = 0; struct start_info * si; /* This is otherwise saved only in an area mmapped by the thread */ /* library, which isn't visible to the collector. */ /* We resist the temptation to muck with the stack size here, */ /* even if the default is unreasonably small. That's the client's */ /* responsibility. */ INIT_REAL_SYMS(); LOCK(); si = (struct start_info *)GC_INTERNAL_MALLOC(sizeof(struct start_info), NORMAL); UNLOCK(); if (!parallel_initialized) GC_init_parallel(); if (0 == si) return(ENOMEM); sem_init(&(si -> registered), 0, 0); si -> start_routine = start_routine; si -> arg = arg; LOCK(); if (!GC_thr_initialized) GC_thr_init(); # ifdef GC_ASSERTIONS { size_t stack_size = 0; if (NULL != attr) { pthread_attr_getstacksize(attr, &stack_size); } if (0 == stack_size) { pthread_attr_t my_attr; pthread_attr_init(&my_attr); pthread_attr_getstacksize(&my_attr, &stack_size); } /* On Solaris 10, with default attr initialization, */ /* stack_size remains 0. Fudge it. */ if (0 == stack_size) { # ifndef SOLARIS WARN("Failed to get stack size for assertion checking\n", 0); # endif stack_size = 1000000; } # ifdef PARALLEL_MARK GC_ASSERT(stack_size >= (8*HBLKSIZE*sizeof(word))); # else /* FreeBSD-5.3/Alpha: default pthread stack is 64K, */ /* HBLKSIZE=8192, sizeof(word)=8 */ GC_ASSERT(stack_size >= 65536); # endif /* Our threads may need to do some work for the GC. */ /* Ridiculously small threads won't work, and they */ /* probably wouldn't work anyway. */ } # endif if (NULL == attr) { detachstate = PTHREAD_CREATE_JOINABLE; } else { pthread_attr_getdetachstate(attr, &detachstate); } if (PTHREAD_CREATE_DETACHED == detachstate) my_flags |= DETACHED; si -> flags = my_flags; UNLOCK(); # ifdef DEBUG_THREADS GC_printf("About to start new thread from thread 0x%x\n", (unsigned)pthread_self()); # endif GC_need_to_lock = TRUE; result = REAL_FUNC(pthread_create)(new_thread, attr, GC_start_routine, si); # ifdef DEBUG_THREADS GC_printf("Started thread 0x%x\n", (unsigned)(*new_thread)); # endif /* Wait until child has been added to the thread table. */ /* This also ensures that we hold onto si until the child is done */ /* with it. Thus it doesn't matter whether it is otherwise */ /* visible to the collector. */ if (0 == result) { while (0 != sem_wait(&(si -> registered))) { if (EINTR != errno) ABORT("sem_wait failed"); } } sem_destroy(&(si -> registered)); LOCK(); GC_INTERNAL_FREE(si); UNLOCK(); return(result); } /* Spend a few cycles in a way that can't introduce contention with */ /* othre threads. */ void GC_pause(void) { int i; # if !defined(__GNUC__) || defined(__INTEL_COMPILER) volatile word dummy = 0; # endif for (i = 0; i < 10; ++i) { # if defined(__GNUC__) && !defined(__INTEL_COMPILER) __asm__ __volatile__ (" " : : : "memory"); # else /* Something that's unlikely to be optimized away. */ GC_noop(++dummy); # endif } } #define SPIN_MAX 128 /* Maximum number of calls to GC_pause before */ /* give up. */ volatile GC_bool GC_collecting = 0; /* A hint that we're in the collector and */ /* holding the allocation lock for an */ /* extended period. */ #if !defined(USE_SPIN_LOCK) || defined(PARALLEL_MARK) /* If we don't want to use the below spinlock implementation, either */ /* because we don't have a GC_test_and_set implementation, or because */ /* we don't want to risk sleeping, we can still try spinning on */ /* pthread_mutex_trylock for a while. This appears to be very */ /* beneficial in many cases. */ /* I suspect that under high contention this is nearly always better */ /* than the spin lock. But it's a bit slower on a uniprocessor. */ /* Hence we still default to the spin lock. */ /* This is also used to acquire the mark lock for the parallel */ /* marker. */ /* Here we use a strict exponential backoff scheme. I don't know */ /* whether that's better or worse than the above. We eventually */ /* yield by calling pthread_mutex_lock(); it never makes sense to */ /* explicitly sleep. */ #define LOCK_STATS #ifdef LOCK_STATS unsigned long GC_spin_count = 0; unsigned long GC_block_count = 0; unsigned long GC_unlocked_count = 0; #endif void GC_generic_lock(pthread_mutex_t * lock) { #ifndef NO_PTHREAD_TRYLOCK unsigned pause_length = 1; unsigned i; if (0 == pthread_mutex_trylock(lock)) { # ifdef LOCK_STATS ++GC_unlocked_count; # endif return; } for (; pause_length <= SPIN_MAX; pause_length <<= 1) { for (i = 0; i < pause_length; ++i) { GC_pause(); } switch(pthread_mutex_trylock(lock)) { case 0: # ifdef LOCK_STATS ++GC_spin_count; # endif return; case EBUSY: break; default: ABORT("Unexpected error from pthread_mutex_trylock"); } } #endif /* !NO_PTHREAD_TRYLOCK */ # ifdef LOCK_STATS ++GC_block_count; # endif pthread_mutex_lock(lock); } #endif /* !USE_SPIN_LOCK || PARALLEL_MARK */ #if defined(USE_SPIN_LOCK) /* Reasonably fast spin locks. Basically the same implementation */ /* as STL alloc.h. This isn't really the right way to do this. */ /* but until the POSIX scheduling mess gets straightened out ... */ volatile AO_TS_t GC_allocate_lock = 0; void GC_lock(void) { # define low_spin_max 30 /* spin cycles if we suspect uniprocessor */ # define high_spin_max SPIN_MAX /* spin cycles for multiprocessor */ static unsigned spin_max = low_spin_max; unsigned my_spin_max; static unsigned last_spins = 0; unsigned my_last_spins; int i; if (AO_test_and_set_acquire(&GC_allocate_lock) == AO_TS_CLEAR) { return; } my_spin_max = spin_max; my_last_spins = last_spins; for (i = 0; i < my_spin_max; i++) { if (GC_collecting || GC_nprocs == 1) goto yield; if (i < my_last_spins/2) { GC_pause(); continue; } if (AO_test_and_set_acquire(&GC_allocate_lock) == AO_TS_CLEAR) { /* * got it! * Spinning worked. Thus we're probably not being scheduled * against the other process with which we were contending. * Thus it makes sense to spin longer the next time. */ last_spins = i; spin_max = high_spin_max; return; } } /* We are probably being scheduled against the other process. Sleep. */ spin_max = low_spin_max; yield: for (i = 0;; ++i) { if (AO_test_and_set_acquire(&GC_allocate_lock) == AO_TS_CLEAR) { return; } # define SLEEP_THRESHOLD 12 /* Under Linux very short sleeps tend to wait until */ /* the current time quantum expires. On old Linux */ /* kernels nanosleep(<= 2ms) just spins under Linux. */ /* (Under 2.4, this happens only for real-time */ /* processes.) We want to minimize both behaviors */ /* here. */ if (i < SLEEP_THRESHOLD) { sched_yield(); } else { struct timespec ts; if (i > 24) i = 24; /* Don't wait for more than about 15msecs, even */ /* under extreme contention. */ ts.tv_sec = 0; ts.tv_nsec = 1 << i; nanosleep(&ts, 0); } } } #else /* !USE_SPINLOCK */ void GC_lock(void) { #ifndef NO_PTHREAD_TRYLOCK if (1 == GC_nprocs || GC_collecting) { pthread_mutex_lock(&GC_allocate_ml); } else { GC_generic_lock(&GC_allocate_ml); } #else /* !NO_PTHREAD_TRYLOCK */ pthread_mutex_lock(&GC_allocate_ml); #endif /* !NO_PTHREAD_TRYLOCK */ } #endif /* !USE_SPINLOCK */ #if defined(PARALLEL_MARK) || defined(THREAD_LOCAL_ALLOC) #ifdef GC_ASSERTIONS unsigned long GC_mark_lock_holder = NO_THREAD; #endif #if 0 /* Ugly workaround for a linux threads bug in the final versions */ /* of glibc2.1. Pthread_mutex_trylock sets the mutex owner */ /* field even when it fails to acquire the mutex. This causes */ /* pthread_cond_wait to die. Remove for glibc2.2. */ /* According to the man page, we should use */ /* PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP, but that isn't actually */ /* defined. */ static pthread_mutex_t mark_mutex = {0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, {0, 0}}; #else static pthread_mutex_t mark_mutex = PTHREAD_MUTEX_INITIALIZER; #endif static pthread_cond_t builder_cv = PTHREAD_COND_INITIALIZER; void GC_acquire_mark_lock(void) { /* if (pthread_mutex_lock(&mark_mutex) != 0) { ABORT("pthread_mutex_lock failed"); } */ GC_generic_lock(&mark_mutex); # ifdef GC_ASSERTIONS GC_mark_lock_holder = NUMERIC_THREAD_ID(pthread_self()); # endif } void GC_release_mark_lock(void) { GC_ASSERT(GC_mark_lock_holder == NUMERIC_THREAD_ID(pthread_self())); # ifdef GC_ASSERTIONS GC_mark_lock_holder = NO_THREAD; # endif if (pthread_mutex_unlock(&mark_mutex) != 0) { ABORT("pthread_mutex_unlock failed"); } } /* Collector must wait for a freelist builders for 2 reasons: */ /* 1) Mark bits may still be getting examined without lock. */ /* 2) Partial free lists referenced only by locals may not be scanned */ /* correctly, e.g. if they contain "pointer-free" objects, since the */ /* free-list link may be ignored. */ void GC_wait_builder(void) { GC_ASSERT(GC_mark_lock_holder == NUMERIC_THREAD_ID(pthread_self())); # ifdef GC_ASSERTIONS GC_mark_lock_holder = NO_THREAD; # endif if (pthread_cond_wait(&builder_cv, &mark_mutex) != 0) { ABORT("pthread_cond_wait failed"); } GC_ASSERT(GC_mark_lock_holder == NO_THREAD); # ifdef GC_ASSERTIONS GC_mark_lock_holder = NUMERIC_THREAD_ID(pthread_self()); # endif } void GC_wait_for_reclaim(void) { GC_acquire_mark_lock(); while (GC_fl_builder_count > 0) { GC_wait_builder(); } GC_release_mark_lock(); } void GC_notify_all_builder(void) { GC_ASSERT(GC_mark_lock_holder == NUMERIC_THREAD_ID(pthread_self())); if (pthread_cond_broadcast(&builder_cv) != 0) { ABORT("pthread_cond_broadcast failed"); } } #endif /* PARALLEL_MARK || THREAD_LOCAL_ALLOC */ #ifdef PARALLEL_MARK static pthread_cond_t mark_cv = PTHREAD_COND_INITIALIZER; void GC_wait_marker(void) { GC_ASSERT(GC_mark_lock_holder == NUMERIC_THREAD_ID(pthread_self())); # ifdef GC_ASSERTIONS GC_mark_lock_holder = NO_THREAD; # endif if (pthread_cond_wait(&mark_cv, &mark_mutex) != 0) { ABORT("pthread_cond_wait failed"); } GC_ASSERT(GC_mark_lock_holder == NO_THREAD); # ifdef GC_ASSERTIONS GC_mark_lock_holder = NUMERIC_THREAD_ID(pthread_self()); # endif } void GC_notify_all_marker(void) { if (pthread_cond_broadcast(&mark_cv) != 0) { ABORT("pthread_cond_broadcast failed"); } } #endif /* PARALLEL_MARK */ # endif /* GC_LINUX_THREADS and friends */ synopsis-0.12/src/Synopsis/gc/NT_X64_STATIC_THREADS_MAKEFILE0000664000076400007640000000665011104702316022253 0ustar stefanstefan# Makefile for Windows NT. Assumes Microsoft compiler. # DLLs are included in the root set under NT, but not under win32S. # Use "nmake nodebug=1 all" for optimized versions of library, gctest and editor. MY_CPU=AMD64 CPU=$(MY_CPU) !include # Make sure that .cc is not viewed as a suffix. It is for VC++2005, but # not earlier versions. We can deal with either, but not inconsistency. .SUFFIXES: .SUFFIXES: .obj .cpp .c # Atomic_ops installation directory. For win32, the source directory # should do, since we only need the headers. # We assume this was manually unpacked, since I'm not sure there is # a Windows standard command line tool to do this. AO_VERSION=1.2 AO_SRC_DIR=libatomic_ops-$(AO_VERSION)/src AO_INCLUDE_DIR=$(AO_SRC_DIR) OBJS= alloc.obj reclaim.obj allchblk.obj misc.obj mach_dep.obj os_dep.obj mark_rts.obj headers.obj mark.obj obj_map.obj blacklst.obj finalize.obj new_hblk.obj dbg_mlc.obj malloc.obj stubborn.obj dyn_load.obj typd_mlc.obj ptr_chck.obj gc_cpp.obj mallocx.obj win32_threads.obj msvc_dbg.obj thread_local_alloc.obj all: gctest.exe cord\de.exe test_cpp.exe .c.obj: $(cc) $(cdebug) $(cflags) $(cvarsmt) -Iinclude -I$(AO_INCLUDE_DIR) -DALL_INTERIOR_POINTERS -D__STDC__ -DGC_NOT_DLL -DGC_WIN32_THREADS -DTHREAD_LOCAL_ALLOC $*.c /Fo$*.obj /wd4701 -D_CRT_SECURE_NO_DEPRECATE # Disable "may not be initialized" warnings. They're too approximate. # Disable crt security warnings, since unfortunately they warn about all sorts # of safe uses of strncpy. It would be nice to leave the rest enabled. .cpp.obj: $(cc) $(cdebug) $(cflags) $(cvarsmt) -Iinclude -I$(AO_INCLUDE_DIR) -DALL_INTERIOR_POINTERS -DGC_NOT_DLL $*.CPP -DGC_WIN32_THREADS -DTHREAD_LOCAL_ALLOC /Fo$*.obj -D_CRT_SECURE_NO_DEPRECATE $(OBJS) tests\test.obj: include\private\gc_priv.h include\private\gc_hdrs.h include\gc.h include\private\gcconfig.h include\private\gc_locks.h include\private\gc_pmark.h include\gc_mark.h include\private\msvc_dbg.h gc.lib: $(OBJS) lib /MACHINE:X64 /out:gc.lib $(OBJS) gctest.exe: tests\test.obj gc.lib # This produces a "GUI" applications that opens no windows and writes to the log file # "gc.log". This was done to make the result runnable under win32s and # should be fixed. $(link) $(ldebug) $(guiflags) -stack:131072 -out:$*.exe tests\test.obj $(guilibs) gc.lib cord\de_win.rbj: cord\de_win.res cvtres /MACHINE:$(MY_CPU) /OUT:cord\de_win.rbj cord\de_win.res cord\de.obj cord\de_win.obj: include\cord.h include\private\cord_pos.h cord\de_win.h cord\de_cmds.h cord\de_win.res: cord\de_win.rc cord\de_win.h cord\de_cmds.h $(rc) $(rcvars) -r -fo cord\de_win.res cord\de_win.rc # Cord/de is a real win32 gui application. cord\de.exe: cord\cordbscs.obj cord\cordxtra.obj cord\de.obj cord\de_win.obj cord\de_win.rbj gc.lib $(link) $(ldebug) $(guiflags) -stack:16384 -out:cord\de.exe cord\cordbscs.obj cord\cordxtra.obj cord\de.obj cord\de_win.obj cord\de_win.rbj gc.lib $(guilibs) gc_cpp.obj: include\gc_cpp.h include\gc.h gc_cpp.cpp: gc_cpp.cc copy gc_cpp.cc gc_cpp.cpp test_cpp.cpp: tests\test_cpp.cc copy tests\test_cpp.cc test_cpp.cpp # This generates the C++ test executable. The executable expects # a single numeric argument, which is the number of iterations. # The output appears in the file "gc.log". test_cpp.exe: test_cpp.obj include\gc_cpp.h include\gc.h gc.lib $(link) $(ldebug) $(guiflags) -stack:16384 -out:test_cpp.exe test_cpp.obj gc.lib $(guilibs) AO_SCR_DIR: tar xvfz $(AO_SRC_DIR).tar.gz; synopsis-0.12/src/Synopsis/gc/libatomic_ops/0000775000076400007640000000000011172123233020505 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops/install-sh0000775000076400007640000002202111104702315022505 0ustar stefanstefan#!/bin/sh # install - install a program, script, or datafile scriptversion=2005-05-14.22 # 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: synopsis-0.12/src/Synopsis/gc/libatomic_ops/ChangeLog0000664000076400007640000001415211104702316022262 0ustar stefanstefan2007-06-26 Hans Boehm (really Luca Barbato) * src/atomic_ops/sysdeps/gcc/powerpc.h (AO_load_acquire): Add 64-bit version. 2007-06-13 Hans Boehm * src/atomic_ops.h: include stddef.h 2007-06-06 Hans Boehm * src/atomic_ops/sysdeps/msftc/x86_64.h: New file. * src/atomic_ops.h: Add test for msftc/x86_64.h. * src/atomic_ops/sysdeps/msftc/x86.h: Complain for _WIN64. * src/atomic_ops/sysdeps/Makefile.am: Add x86_64.h. * src/atomic_ops/sysdeps/Makefile.in: Regenerate. * src/atomic_ops/sysdeps/aligned_atomic_load_store.h, src/atomic_ops/sysdeps/int_aligned_atomic_load_store.h, src/atomic_ops/sysdeps/short_aligned_atomic_load_store.h: Replace unsigned long cast with size_t. 2007-05-17 Hans Boehm * src/atomic_ops/sysdeps/gcc/hppa.h (AO_test_and_set_full): Add cast for return. 2007-05-14 Hans Boehm doc/README.txt: Update to reflect C++0x effort. 2007-05-07 Hans Boehm (with help from Philipp Zambelli) * src/atomic_ops/sysdeps/msftc/x86.h: Don't just assume that mfence is present. * src/atomic_ops/sysdeps/gcc/arm.h (AO_test_and_set_full): Correct oldval type. 2006-11-09 Earl Chew (Agilent) * msftc/x86.h: Follow Microsoft documentation and include windows.h. [1.2 release] 2006-07-11 Hans Boehm * src/atomic_ops/sysdeps/hpc/ia64.h: Fix typos. 2006-03-28 Earl Chew (Agilent) * src/atomic_ops/sysdeps/gcc/powerpc.h: Remove unused variable cr. * src/atomic_ops/sysdeps/msftc/x86.h: Use new intrinsics available in MSVC 2003 and MSVC 2005. Use inline assembler to generate mfence and byte sized xchg Use correct prototype for InterlockedCompareExchange. * src/atomic_ops.h: Add test for __PPC__ . * tests/run_parallel.inc: Add simple VxWorks support. * tests/test_atomic.c, tests/test_atomic_include.h: Add prototypes to silence compiler warnings. 2006-1-13 Hans Boehm *src/atomic_ops/sysdeps/gcc/powerpc.h: Beginnings of 64 bit support. *src/atomic_ops/sysdeps/gcc/x86.h: Use "=q" for AO_test_and_set_full. 2005-11-4 Hans Boehm *src/atomic_ops/sysdeps/gcc/ia64.h: Include all_acquire_release_volatile.h, instead of just the pointer-sized version. *src/atomic_ops/sysdeps/gcc/ia64.h: Include all_acquire_release_volatile.h and all_atomic_load_store.h, instead of just the pointer-sized versions. [1.1 release] 2005-09-27 Hans Boehm *src/atomic_ops.h: Define AO_CAN_EMUL_CAS for arm. *src/atomic_ops/sysdeps/read_ordered.h: New file, extracted from ordered_except_wr.h. *src/atomic_ops/sysdeps/ordered_except_wr.h: include read_ordered.h instead of duplicating it. *src/atomic_ops/sysdeps/gcc/arm.h: Include read_ordered.h. 2005-09-16 Hans Boehm *src/atomic_ops/sysdeps/gcc/arm.h: Replace the AO_test_and_set definition with one that might actually work. (Thanks to Kazu Hirata and Paul Brook.) 2005-08-01 Hans Boehm *src/atomic_ops/Makefile.am: Change function naming from "byte" to "char" (again). [1.0 release] 2005-03-21 Hans Boehm Fix various acquire_release_volatile.h files to reflect the fact that both icc and gcc seem to reorder ordinary memory accesses around volatile accesses early in the compilation. Modify the acquire release test to catch this problem (with high probablity, and only on a multiprocessor). 2005-03 Hans Boehm Fixes for recently introduced bugs. Update x86 and x86-64 assembly syntax to deal with complaints by some recent gcc versions. 2005-02 Hans Boehm Added libatomic_ops_gpl library with support for mostly lock-free stack and malloc(). 2005-01 Ian Wienand , Al Stone , Hans Boehm Use autoconf, automake, starting with code from Debian package. Don't use libtool. 2005-01 Hans Boehm * test_and_set_t_is_ao_t.h, test_and_set_t_is_char.h, others: Change most platforms to use byte-wide test-and-set locations. 2005-01 Hans Boehm * ao_t_is_int.h: Add to trivially support int-wide operations on platforms with int-sized pointers. 2004-12 Hans Boehm * gcc/powerpc.h: First serious attempt to support PowerPC (with help from Maged Michael and others). 2004-12 Hans Boehm * sunc/sparc.[hS]: Added minimal supprt for the Sun SPARC compiler. * atomic_ops_sysdeps.S: Add support for platforms that require out-of-line assmebly code. 2004-10 Hans Boehm More work on char, short, int sized data. Add both compare_double_and_swap_double and compare_and_swap_double. Typically each platform will provide at most one of these. 2004-07-02 Ranko Zivojnovic Replace both instances of AO_HAVE_NOP_FULL with AO_HAVE_nop_full. 2004-06 Hans Boehm Start to add atomic_ops primitives for different sized data. 2003-12-18 Hans Boehm * atomic_ops/sysdeps/acquire_release_volatile.h, atomic_ops.h: Fix support for ecc on IA64. Remove compiler_barrier workaround for gcc 3.4 and later. 2003-12-17 Hans Boehm * atomic_ops/sysdeps/hpc/{ia64.h,hppa.h}, atomic_ops/sysdeps/msftc/x86.h, Makefile, Makefile.atomic_ops, Makefile.atomic_ops.msft, atomic_ops.h: Add initial support for atomic_ops for VC++/Windows/X86 and HP/UX with the HP compiler on PA_RISC and IA64. 2003-12-09 Hans Boehm * many: Install under "atomic_ops" instead of "ao". Change atomic_ops include file structure. Auxiliary include files are all under include/atomic_ops. Fix (hopefully) "make dist" in atomic_ops distribution. Renamed various types to end in _t, though the old versions are still defined for backward compatibility. 2003-12-08 Carlos O'Donell * ao_sysdeps/gcc/hppa.h: Define AO_CLEAR macro. Change AO_pa_clearable_loc type. Add __ldcw, and __ldcw_align helper macros. AO_test_and_set_full uses helper macros. Started sometime after version 0.4 release. Currently the format is informal. Eventually should become more GNU-like. synopsis-0.12/src/Synopsis/gc/libatomic_ops/README0000664000076400007640000000122411104702315021363 0ustar stefanstefanThis package provides semi-portable access to hardware provided atomic memory operations. These might allow you to write code: - That does more interesting things in signal handlers. - Makes more effective use of multiprocessors by allowing you to write clever lock-free code. Note that such code is very difficult to get right, and will unavoidably be less portable than lock-based code. It ia also not always faster than lock-based code. But it may occasionally be a large performance win. - To experiment with new and much better thread programming paradigms, etc. For details and licensing restrictions see the files in the doc subdirectory. synopsis-0.12/src/Synopsis/gc/libatomic_ops/config.guess0000775000076400007640000012625711104702315023041 0ustar stefanstefan#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2006-06-06' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerppc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[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 ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; x86:Interix*:[345]*) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T:Interix*:[345]*) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; 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 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: synopsis-0.12/src/Synopsis/gc/libatomic_ops/configure0000775000076400007640000054502511104702315022426 0ustar stefanstefan#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for libatomic_ops 1.2. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='libatomic_ops' PACKAGE_TARNAME='libatomic_ops' PACKAGE_VERSION='1.2' PACKAGE_STRING='libatomic_ops 1.2' PACKAGE_BUGREPORT='' ac_unique_file="src/atomic_ops.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA am__isrc CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar RANLIB CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CCAS CCASFLAGS CCASDEPMODE am__fastdepCCAS_TRUE am__fastdepCCAS_FALSE CPP GREP EGREP PICFLAG NEED_ASM_TRUE NEED_ASM_FALSE LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CCAS CCASFLAGS CPP' # 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. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_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 ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_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'` 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 ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_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'` 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; }; } 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 directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $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 test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures libatomic_ops 1.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 \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/libatomic_ops] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of libatomic_ops 1.2:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CCAS assembler compiler command (defaults to CC) CCASFLAGS assembler compiler flags (defaults to CFLAGS) CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF libatomic_ops configure 1.2 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by libatomic_ops $as_me 1.2, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file 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 $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { 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 "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 echo "$as_me: error: cannot run $SHELL $ac_aux_dir/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_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && { { 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=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_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; } case $ac_cv_build in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 echo "$as_me: error: invalid value of canonical build" >&2;} { (exit 1); exit 1; }; };; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { 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 if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 echo "$as_me: error: invalid value of canonical host" >&2;} { (exit 1); exit 1; }; };; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { echo "$as_me:$LINENO: checking target system type" >&5 echo $ECHO_N "checking target system type... $ECHO_C" >&6; } if test "${ac_cv_target+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_target" >&5 echo "${ECHO_T}$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5 echo "$as_me: error: invalid value of canonical target" >&2;} { (exit 1); exit 1; }; };; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- am__api_version='1.10' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. { 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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done IFS=$as_save_IFS fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { 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 -f 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 { echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } if test -z "$MKDIR_P"; then if test "${ac_cv_path_mkdir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. test -d ./--version && rmdir ./--version MKDIR_P="$ac_install_sh -d" fi fi { echo "$as_me:$LINENO: result: $MKDIR_P" >&5 echo "${ECHO_T}$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { 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 x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { 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 if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then { { 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 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='libatomic_ops' VERSION='1.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-"\$(SHELL) $am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { 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 if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { 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 if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi ac_config_headers="$ac_config_headers src/config.h" # Checks for programs. 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { 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` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then 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 # Check that 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' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 that 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 { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { 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 ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu 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 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="$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/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { 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 # By default we simply use the C compiler to build assembly code. test "${CCAS+set}" = set || CCAS=$CC test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS depcc="$CCAS" 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_CCAS_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_CCAS_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CCAS_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CCAS_dependencies_compiler_type=none fi fi { echo "$as_me:$LINENO: result: $am_cv_CCAS_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CCAS_dependencies_compiler_type" >&6; } CCASDEPMODE=depmode=$am_cv_CCAS_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CCAS_dependencies_compiler_type" = gcc3; then am__fastdepCCAS_TRUE= am__fastdepCCAS_FALSE='#' else am__fastdepCCAS_TRUE='#' am__fastdepCCAS_FALSE= fi # Checks for functions. 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else 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 grep that handles long lines and -e" >&5 echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Extract the first word of "grep ggrep" to use in msg output if test -z "$GREP"; then set dummy grep ggrep; ac_prog_name=$2 if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS fi GREP="$ac_cv_path_GREP" if test -z "$GREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 echo "${ECHO_T}$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } if test "${ac_cv_path_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_path_EGREP="$GREP -E" else # Extract the first word of "egrep" to use in msg output if test -z "$EGREP"; then set dummy egrep; ac_prog_name=$2 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS fi EGREP="$ac_cv_path_EGREP" if test -z "$EGREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* 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 { as_var=$as_ac_Header; eval "test \"\${$as_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. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&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 stdlib.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else 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;} ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in getpagesize 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 { as_var=$as_ac_var; eval "test \"\${$as_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 GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { echo "$as_me:$LINENO: checking for working mmap" >&5 echo $ECHO_N "checking for working mmap... $ECHO_C" >&6; } if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_mmap_fixed_mapped=no else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default /* malloc might have been renamed as rpl_malloc. */ #undef malloc /* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: mmap private not fixed mmap private fixed at somewhere currently unmapped mmap private fixed at somewhere already mapped mmap shared not fixed mmap shared fixed at somewhere currently unmapped mmap shared fixed at somewhere already mapped For private mappings, we should verify that changes cannot be read() back from the file, nor mmap's back from the file at a different address. (There have been systems where private was not correctly implemented like the infamous i386 svr4.0, and systems where the VM page cache was not coherent with the file system buffer cache like early versions of FreeBSD and possibly contemporary NetBSD.) For shared mappings, we should conversely verify that changes get propagated back to all the places they're supposed to be. Grep wants private fixed already mapped. The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ #include #include #if !defined STDC_HEADERS && !defined HAVE_STDLIB_H char *malloc (); #endif /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE /* Assume that all systems that can run configure have sys/param.h. */ # ifndef HAVE_SYS_PARAM_H # define HAVE_SYS_PARAM_H 1 # endif # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ # ifdef HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE # else /* no EXEC_PAGESIZE */ # ifdef NBPG # define getpagesize() NBPG * CLSIZE # ifndef CLSIZE # define CLSIZE 1 # endif /* no CLSIZE */ # else /* no NBPG */ # ifdef NBPC # define getpagesize() NBPC # else /* no NBPC */ # ifdef PAGESIZE # define getpagesize() PAGESIZE # endif /* PAGESIZE */ # endif /* no NBPC */ # endif /* no NBPG */ # endif /* no EXEC_PAGESIZE */ # else /* no HAVE_SYS_PARAM_H */ # define getpagesize() 8192 /* punt totally */ # endif /* no HAVE_SYS_PARAM_H */ # endif /* no _SC_PAGESIZE */ #endif /* no HAVE_GETPAGESIZE */ int main () { char *data, *data2, *data3; int i, pagesize; int fd; pagesize = getpagesize (); /* First, make a file with some known garbage in it. */ data = (char *) malloc (pagesize); if (!data) return 1; for (i = 0; i < pagesize; ++i) *(data + i) = rand (); umask (0); fd = creat ("conftest.mmap", 0600); if (fd < 0) return 1; if (write (fd, data, pagesize) != pagesize) return 1; close (fd); /* Next, try to mmap the file at a fixed address which already has something else allocated at it. If we can, also make sure that we see the same garbage. */ fd = open ("conftest.mmap", O_RDWR); if (fd < 0) return 1; data2 = (char *) malloc (2 * pagesize); if (!data2) return 1; data2 += (pagesize - ((long int) data2 & (pagesize - 1))) & (pagesize - 1); if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, 0L)) return 1; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data2 + i)) return 1; /* Finally, make sure that changes to the mapped area do not percolate back to the file as seen by read(). (This is a bug on some variants of i386 svr4.0.) */ for (i = 0; i < pagesize; ++i) *(data2 + i) = *(data2 + i) + 1; data3 = (char *) malloc (pagesize); if (!data3) return 1; if (read (fd, data3, pagesize) != pagesize) return 1; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data3 + i)) return 1; close (fd); return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_mmap_fixed_mapped=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_mmap_fixed_mapped=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5 echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6; } if test $ac_cv_func_mmap_fixed_mapped = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_MMAP 1 _ACEOF fi rm -f conftest.mmap # 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* 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 # AC_CHECK_HEADERS([ ]) # Determine PIC flag, adjust default CFLAGS need_asm=false PICFLAG= { echo "$as_me:$LINENO: checking Determining PIC compiler flag" >&5 echo $ECHO_N "checking Determining PIC compiler flag... $ECHO_C" >&6; } if test "$GCC" = yes; then { echo "$as_me:$LINENO: result: -fPIC" >&5 echo "${ECHO_T}-fPIC" >&6; } PICFLAG=-fPIC else case "$host" in *-*-hpux*) { echo "$as_me:$LINENO: result: \"+Z\"" >&5 echo "${ECHO_T}\"+Z\"" >&6; } PICFLAG="+Z" if test "$GCC" != yes; then CFLAGS="$CFLAGS +O2 -mt" fi ;; *-*-solaris*) { echo "$as_me:$LINENO: result: -Kpic" >&5 echo "${ECHO_T}-Kpic" >&6; } PICFLAG=-Kpic if test "$GCC" != yes; then CFLAGS="$CFLAGS -O" need_asm=true fi ;; *-*-linux*) { echo "$as_me:$LINENO: result: -fPIC" >&5 echo "${ECHO_T}-fPIC" >&6; } PICFLAG=-fPIC # Any Linux compiler had better be gcc compatible. ;; *) { echo "$as_me:$LINENO: result: \"\"" >&5 echo "${ECHO_T}\"\"" >&6; } ;; esac fi CFLAGS="$CFLAGS -DNDEBUG" if test x$need_asm = xtrue; then NEED_ASM_TRUE= NEED_ASM_FALSE='#' else NEED_ASM_TRUE='#' NEED_ASM_FALSE= fi ac_config_files="$ac_config_files Makefile src/Makefile src/atomic_ops/Makefile src/atomic_ops/sysdeps/Makefile doc/Makefile tests/Makefile" ac_config_commands="$ac_config_commands default" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCCAS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCCAS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${NEED_ASM_TRUE}" && test -z "${NEED_ASM_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"NEED_ASM\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"NEED_ASM\" 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 more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by libatomic_ops $as_me 1.2, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF 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 and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ libatomic_ops config.status 1.2 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' _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 ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --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;; --he | --h) # Conflict between --help and --header { 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 ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" PICFLAG=${PICFLAG} CC=${CC} DEFS=${DEFS} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/atomic_ops/Makefile") CONFIG_FILES="$CONFIG_FILES src/atomic_ops/Makefile" ;; "src/atomic_ops/sysdeps/Makefile") CONFIG_FILES="$CONFIG_FILES src/atomic_ops/sysdeps/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; *) { { 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 against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for 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 _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim build!$build$ac_delim build_cpu!$build_cpu$ac_delim build_vendor!$build_vendor$ac_delim build_os!$build_os$ac_delim host!$host$ac_delim host_cpu!$host_cpu$ac_delim host_vendor!$host_vendor$ac_delim host_os!$host_os$ac_delim target!$target$ac_delim target_cpu!$target_cpu$ac_delim target_vendor!$target_vendor$ac_delim target_os!$target_os$ac_delim INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim INSTALL_DATA!$INSTALL_DATA$ac_delim am__isrc!$am__isrc$ac_delim CYGPATH_W!$CYGPATH_W$ac_delim PACKAGE!$PACKAGE$ac_delim VERSION!$VERSION$ac_delim ACLOCAL!$ACLOCAL$ac_delim AUTOCONF!$AUTOCONF$ac_delim AUTOMAKE!$AUTOMAKE$ac_delim AUTOHEADER!$AUTOHEADER$ac_delim MAKEINFO!$MAKEINFO$ac_delim install_sh!$install_sh$ac_delim STRIP!$STRIP$ac_delim INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim mkdir_p!$mkdir_p$ac_delim AWK!$AWK$ac_delim SET_MAKE!$SET_MAKE$ac_delim am__leading_dot!$am__leading_dot$ac_delim AMTAR!$AMTAR$ac_delim am__tar!$am__tar$ac_delim am__untar!$am__untar$ac_delim RANLIB!$RANLIB$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim DEPDIR!$DEPDIR$ac_delim am__include!$am__include$ac_delim am__quote!$am__quote$ac_delim AMDEP_TRUE!$AMDEP_TRUE$ac_delim AMDEP_FALSE!$AMDEP_FALSE$ac_delim AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim CCDEPMODE!$CCDEPMODE$ac_delim am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim CCAS!$CCAS$ac_delim CCASFLAGS!$CCASFLAGS$ac_delim CCASDEPMODE!$CCASDEPMODE$ac_delim am__fastdepCCAS_TRUE!$am__fastdepCCAS_TRUE$ac_delim am__fastdepCCAS_FALSE!$am__fastdepCCAS_FALSE$ac_delim CPP!$CPP$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim PICFLAG!$PICFLAG$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF CEOF$ac_eof _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF NEED_ASM_TRUE!$NEED_ASM_TRUE$ac_delim NEED_ASM_FALSE!$NEED_ASM_FALSE$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 4; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF 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&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; :H) # # CONFIG_HEADER # _ACEOF # Transform confdefs.h into a sed script `conftest.defines', that # substitutes the proper values into config.h.in to produce config.h. rm -f conftest.defines conftest.tail # First, append a space to every undef/define line, to ease matching. echo 's/$/ /' >conftest.defines # Then, protect against being on the right side of a sed subst, or in # an unquoted here document, in config.status. If some macros were # called several times there might be several #defines for the same # symbol, which is useless. But do not sort them, since the last # AC_DEFINE must be honored. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* # These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where # NAME is the cpp macro being defined, VALUE is the value it is being given. # PARAMS is the parameter list in the macro definition--in most cases, it's # just an empty string. ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' ac_dB='\\)[ (].*,\\1define\\2' ac_dC=' ' ac_dD=' ,' uniq confdefs.h | sed -n ' t rset :rset s/^[ ]*#[ ]*define[ ][ ]*// t ok d :ok s/[\\&,]/\\&/g s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p ' >>conftest.defines # Remove the space that was appended to ease matching. # Then replace #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. # (The regexp can be short, since the line contains either #define or #undef.) echo 's/ $// s,^[ #]*u.*,/* & */,' >>conftest.defines # Break up conftest.defines: ac_max_sed_lines=50 # First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" # Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" # Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" # et cetera. ac_in='$ac_file_inputs' ac_out='"$tmp/out1"' ac_nxt='"$tmp/out2"' while : do # Write a here document: cat >>$CONFIG_STATUS <<_ACEOF # First, check the format of the line: cat >"\$tmp/defines.sed" <<\\CEOF /^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def /^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def b :def _ACEOF sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail grep . conftest.tail >/dev/null || break rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines conftest.tail echo "ac_result=$ac_in" >>$CONFIG_STATUS cat >>$CONFIG_STATUS <<\_ACEOF if test x"$ac_file" != x-; then echo "/* $configure_input */" >"$tmp/config.h" cat "$ac_result" >>"$tmp/config.h" 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 rm -f $ac_file mv "$tmp/config.h" $ac_file fi else echo "/* $configure_input */" cat "$ac_result" fi rm -f "$tmp/out12" # 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" >`$as_dirname -- $ac_file || $as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X$ac_file : 'X\(//\)[^/]' \| \ X$ac_file : 'X\(//\)$' \| \ X$ac_file : 'X\(/\)' \| . 2>/dev/null || 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 ;; :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir=$dirpart/$fdir case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; "default":C) ;; esac done # for ac_tag { (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 synopsis-0.12/src/Synopsis/gc/libatomic_ops/COPYING0000664000076400007640000004311011104702315021536 0ustar stefanstefan 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. synopsis-0.12/src/Synopsis/gc/libatomic_ops/mkinstalldirs0000775000076400007640000000662211104702315023320 0ustar stefanstefan#! /bin/sh # mkinstalldirs --- make directory hierarchy scriptversion=2005-06-29.22 # Original author: Noah Friedman # Created: 1993-05-16 # Public domain. # # This file is maintained in Automake, please report # bugs to or send patches to # . errstatus=0 dirmode= usage="\ Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... Create each directory DIR (with mode MODE, if specified), including all leading file name components. Report bugs to ." # process command line arguments while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help echo "$usage" exit $? ;; -m) # -m PERM arg shift test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } dirmode=$1 shift ;; --version) echo "$0 $scriptversion" exit $? ;; --) # stop option processing shift break ;; -*) # unknown option echo "$usage" 1>&2 exit 1 ;; *) # first non-opt arg break ;; esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac # Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and # mkdir -p a/c at the same time, both will detect that a is missing, # one will create a, then the other will try to create a and die with # a "File exists" error. This is a problem when calling mkinstalldirs # from a parallel make. We use --version in the probe to restrict # ourselves to GNU mkdir, which is thread-safe. case $dirmode in '') if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -p -- $*" exec 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. test -d ./-p && rmdir ./-p test -d ./--version && rmdir ./--version fi ;; *) if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" else # Clean up after NextStep and OpenStep mkdir. for d in ./-m ./-p ./--version "./$dirmode"; do test -d $d && rmdir $d done fi ;; esac for file do case $file in /*) pathcomp=/ ;; *) pathcomp= ;; esac oIFS=$IFS IFS=/ set fnord $file shift IFS=$oIFS for d do test "x$d" = x && continue pathcomp=$pathcomp$d case $pathcomp in -*) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" lasterr= chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then errstatus=$lasterr fi fi fi fi pathcomp=$pathcomp/ done done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/0000775000076400007640000000000011172123233021274 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops_malloc.c0000664000076400007640000001614511104702315025132 0ustar stefanstefan/* * Copyright (c) 2005 Hewlett-Packard Development Company, L.P. * Original Author: Hans Boehm * * This file may be redistributed and/or modified 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. * * It is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License in the * file doc/COPYING for more details. */ #if defined(HAVE_CONFIG_H) # include "config.h" #endif #define AO_REQUIRE_CAS #include "atomic_ops_stack.h" #include /* for ffs, which is assumed reentrant. */ #include #ifdef AO_TRACE_MALLOC # include # include #endif /* * We round up each allocation request to the next power of two * minus one word. * We keep one stack of free objects for each size. Each object * has an initial word (offset -sizeof(AO_t) from the visible pointer) * which contains either * The binary log of the object size in bytes (small objects) * The object size (a multiple of CHUNK_SIZE) for large objects. * The second case only arises if mmap-based allocation is supported. * We align the user-visible part of each object on a GRANULARITY * byte boundary. That means that the actual (hidden) start of * the object starts a word before this boundary. */ #ifndef LOG_MAX_SIZE # define LOG_MAX_SIZE 16 /* We assume that 2**LOG_MAX_SIZE is a multiple of page size. */ #endif #ifndef ALIGNMENT # define ALIGNMENT 16 /* Assumed to be at least sizeof(AO_t). */ #endif #define CHUNK_SIZE (1 << LOG_MAX_SIZE) #ifndef AO_INITIAL_HEAP_SIZE # define AO_INITIAL_HEAP_SIZE (2*(LOG_MAX_SIZE+1)*CHUNK_SIZE) #endif char AO_initial_heap[AO_INITIAL_HEAP_SIZE]; static volatile AO_t initial_heap_ptr = (AO_t)AO_initial_heap; static volatile char *initial_heap_lim = AO_initial_heap + AO_INITIAL_HEAP_SIZE; #if defined(HAVE_MMAP) #include #include #include #include static volatile AO_t mmap_enabled = 0; void AO_malloc_enable_mmap(void) { AO_store(&mmap_enabled, 1); } static char *get_mmaped(size_t sz) { char * result; assert(!(sz & (CHUNK_SIZE - 1))); if (!mmap_enabled) return 0; # if defined(MAP_ANONYMOUS) result = mmap(0, sz, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); # elif defined(MAP_ANON) result = mmap(0, sz, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); # else { int zero_fd = open("/dev/zero", O_RDONLY); result = mmap(0, sz, PROT_READ | PROT_WRITE, MAP_PRIVATE, zero_fd, 0); close(zero_fd); } # endif if (result == MAP_FAILED) result = 0; return result; } /* Allocate an object of size (incl. header) of size > CHUNK_SIZE. */ /* sz includes space for an AO_t-sized header. */ static char * AO_malloc_large(size_t sz) { char * result; /* The header will force us to waste ALIGNMENT bytes, incl. header. */ sz += ALIGNMENT; /* Round to multiple of CHUNK_SIZE. */ sz = (sz + CHUNK_SIZE - 1) & ~(CHUNK_SIZE - 1); result = get_mmaped(sz); if (result == 0) return 0; result += ALIGNMENT; ((AO_t *)result)[-1] = (AO_t)sz; return result; } static void AO_free_large(char * p) { AO_t sz = ((AO_t *)p)[-1]; if (munmap(p - ALIGNMENT, (size_t)sz) != 0) abort(); /* Programmer error. Not really async-signal-safe, but ... */ } #else /* No MMAP */ void AO_malloc_enable_mmap(void) { } static char *get_mmaped(size_t sz) { return 0; } static char * AO_malloc_large(size_t sz) { return 0; } static void AO_free_large(char * p) { abort(); /* Programmer error. Not really async-signal-safe, but ... */ } #endif /* No MMAP */ static char * get_chunk(void) { char *initial_ptr; char *my_chunk_ptr; char * my_lim; retry: initial_ptr = (char *)AO_load(&initial_heap_ptr); my_chunk_ptr = (char *)(((AO_t)initial_ptr + (ALIGNMENT - 1)) & ~(ALIGNMENT - 1)); if (initial_ptr != my_chunk_ptr) { /* Align correctly. If this fails, someone else did it for us. */ AO_compare_and_swap_acquire(&initial_heap_ptr, (AO_t)initial_ptr, (AO_t)my_chunk_ptr); } my_lim = my_chunk_ptr + CHUNK_SIZE; if (my_lim <= initial_heap_lim) { if (!AO_compare_and_swap(&initial_heap_ptr, (AO_t)my_chunk_ptr, (AO_t)my_lim)) goto retry; return my_chunk_ptr; } /* We failed. The initial heap is used up. */ my_chunk_ptr = get_mmaped(CHUNK_SIZE); assert (!((AO_t)my_chunk_ptr & (ALIGNMENT-1))); return my_chunk_ptr; } /* Object free lists. Ith entry corresponds to objects */ /* of total size 2**i bytes. */ AO_stack_t AO_free_list[LOG_MAX_SIZE+1]; /* Chunk free list, linked through first word in chunks. */ /* All entries of size CHUNK_SIZE. */ AO_stack_t AO_chunk_free_list; /* Break up the chunk, and add it to the object free list for */ /* the given size. Sz must be a power of two. */ /* We have exclusive access to chunk. */ static void add_chunk_as(void * chunk, size_t sz, unsigned log_sz) { char *first = (char *)chunk + ALIGNMENT - sizeof(AO_t); char *limit = (char *)chunk + CHUNK_SIZE - sz; char *next, *p; for (p = first; p <= limit; p = next) { next = p + sz; AO_stack_push(AO_free_list+log_sz, (AO_t *)p); } } static int msbs[16] = {0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4}; /* Return the position of the most significant set bit in the */ /* argument. */ /* We follow the conventions of ffs(), i.e. the least */ /* significant bit is number one. */ int msb(size_t s) { int result = 0; if ((s & 0xff) != s) { /* The following shift often generates warnings on 32-bit arch's */ /* That's OK, because it will never be executed there. */ if (sizeof(size_t) > 4 && (s >> 32) != 0) { s >>= 32; result += 32; } if ((s >> 16) != 0) { s >>= 16; result += 16; } if ((s >> 8) != 0) { s >>= 8; result += 8; } } if (s > 15) { s >>= 4; result += 4; } result += msbs[s]; return result; } void * AO_malloc(size_t sz) { AO_t *result; size_t adj_sz = sz + sizeof(AO_t); int log_sz; if (sz > CHUNK_SIZE) return AO_malloc_large(sz); log_sz = msb(adj_sz-1); result = AO_stack_pop(AO_free_list+log_sz); while (0 == result) { void * chunk = get_chunk(); if (0 == chunk) return 0; adj_sz = 1 << log_sz; add_chunk_as(chunk, adj_sz, log_sz); result = AO_stack_pop(AO_free_list+log_sz); } *result = log_sz; # ifdef AO_TRACE_MALLOC fprintf(stderr, "%x: AO_malloc(%lu) = %p\n", (int)pthread_self(), (unsigned long)sz, result+1); # endif return result + 1; } void AO_free(void *p) { char *base = (char *)p - sizeof(AO_t); int log_sz; if (0 == p) return; log_sz = *(AO_t *)base; # ifdef AO_TRACE_MALLOC fprintf(stderr, "%x: AO_free(%p sz:%lu)\n", (int)pthread_self(), p, (unsigned long) (log_sz > LOG_MAX_SIZE? log_sz : (1 << log_sz))); # endif if (log_sz > LOG_MAX_SIZE) AO_free_large(p); else AO_stack_push(AO_free_list+log_sz, (AO_t *)base); } synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops.c0000664000076400007640000001415711104702315023604 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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. */ /* * Initialized data and out-of-line functions to support atomic_ops.h * go here. Currently this is needed only for pthread-based atomics * emulation, or for compare-and-swap emulation. * Pthreads emulation isn't useful on a native Windows platform, and * cas emulation is not needed. Thus we skip this on Windows. */ #if defined(HAVE_CONFIG_H) # include "config.h" #endif #if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__BORLANDC__) #undef AO_REQUIRE_CAS #include #include #ifdef _HPUX_SOURCE # include #else # include #endif #include "atomic_ops.h" /* Without cas emulation! */ #ifndef AO_HAVE_double_t # include "atomic_ops/sysdeps/standard_ao_double_t.h" #endif /* * Lock for pthreads-based implementation. */ pthread_mutex_t AO_pt_lock = PTHREAD_MUTEX_INITIALIZER; /* * Out of line compare-and-swap emulation based on test and set. * * We use a small table of locks for different compare_and_swap locations. * Before we update perform a compare-and-swap, we grap the corresponding * lock. Different locations may hash to the same lock, but since we * never acquire more than one lock at a time, this can't deadlock. * We explicitly disable signals while we perform this operation. * * FIXME: We should probably also suppport emulation based on Lamport * locks, since we may not have test_and_set either. */ #define AO_HASH_SIZE 16 #define AO_HASH(x) (((unsigned long)(x) >> 12) & (AO_HASH_SIZE-1)) AO_TS_t AO_locks[AO_HASH_SIZE] = { AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, }; static AO_T dummy = 1; /* Spin for 2**n units. */ void AO_spin(int n) { int i; AO_T j = AO_load(&dummy); for (i = 0; i < (2 << n); ++i) { j *= 5; j -= 4; } AO_store(&dummy, j); } void AO_pause(int n) { if (n < 12) AO_spin(n); else { struct timeval tv; /* Short async-signal-safe sleep. */ tv.tv_sec = 0; tv.tv_usec = (n > 28? 100000 : (1 << (n - 12))); select(0, 0, 0, 0, &tv); } } static void lock_ool(volatile AO_TS_t *l) { int i = 0; while (AO_test_and_set_acquire(l) == AO_TS_SET) AO_pause(++i); } AO_INLINE void lock(volatile AO_TS_t *l) { if (AO_test_and_set_acquire(l) == AO_TS_SET) lock_ool(l); } AO_INLINE void unlock(volatile AO_TS_t *l) { AO_CLEAR(l); } static sigset_t all_sigs; static volatile AO_t initialized = 0; static volatile AO_TS_t init_lock = AO_TS_INITIALIZER; int AO_compare_and_swap_emulation(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_TS_t *my_lock = AO_locks + AO_HASH(addr); sigset_t old_sigs; int result; if (!AO_load_acquire(&initialized)) { lock(&init_lock); if (!initialized) sigfillset(&all_sigs); unlock(&init_lock); AO_store_release(&initialized, 1); } sigprocmask(SIG_BLOCK, &all_sigs, &old_sigs); /* Neither sigprocmask nor pthread_sigmask is 100% */ /* guaranteed to work here. Sigprocmask is not */ /* guaranteed be thread safe, and pthread_sigmask */ /* is not async-signal-safe. Under linuxthreads, */ /* sigprocmask may block some pthreads-internal */ /* signals. So long as we do that for short periods, */ /* we should be OK. */ lock(my_lock); if (*addr == old) { *addr = new_val; result = 1; } else result = 0; unlock(my_lock); sigprocmask(SIG_SETMASK, &old_sigs, NULL); return result; } int AO_compare_double_and_swap_double_emulation(volatile AO_double_t *addr, AO_t old_val1, AO_t old_val2, AO_t new_val1, AO_t new_val2) { AO_TS_t *my_lock = AO_locks + AO_HASH(addr); sigset_t old_sigs; int result; if (!AO_load_acquire(&initialized)) { lock(&init_lock); if (!initialized) sigfillset(&all_sigs); unlock(&init_lock); AO_store_release(&initialized, 1); } sigprocmask(SIG_BLOCK, &all_sigs, &old_sigs); /* Neither sigprocmask nor pthread_sigmask is 100% */ /* guaranteed to work here. Sigprocmask is not */ /* guaranteed be thread safe, and pthread_sigmask */ /* is not async-signal-safe. Under linuxthreads, */ /* sigprocmask may block some pthreads-internal */ /* signals. So long as we do that for short periods, */ /* we should be OK. */ lock(my_lock); if (addr -> AO_val1 == old_val1 && addr -> AO_val2 == old_val2) { addr -> AO_val1 = new_val1; addr -> AO_val2 = new_val2; result = 1; } else result = 0; unlock(my_lock); sigprocmask(SIG_SETMASK, &old_sigs, NULL); return result; } void AO_store_full_emulation(volatile AO_t *addr, AO_t val) { AO_TS_t *my_lock = AO_locks + AO_HASH(addr); lock(my_lock); *addr = val; unlock(my_lock); } #else /* Non-posix platform */ int AO_non_posix_implementation_is_entirely_in_headers; #endif synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/config.h.in0000664000076400007640000000277611104702315023332 0ustar stefanstefan/* src/config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_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 /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/0000775000076400007640000000000011172123233023431 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/generalize-small.template0000664000076400007640000005073211104702315030427 0ustar stefanstefan/* XSIZE_load */ #if defined(AO_HAVE_XSIZE_load_acquire) && !defined(AO_HAVE_XSIZE_load) # define AO_XSIZE_load(addr) AO_XSIZE_load_acquire(addr) # define AO_HAVE_XSIZE_load #endif #if defined(AO_HAVE_XSIZE_load_full) && !defined(AO_HAVE_XSIZE_load_acquire) # define AO_XSIZE_load_acquire(addr) AO_XSIZE_load_full(addr) # define AO_HAVE_XSIZE_load_acquire #endif #if defined(AO_HAVE_XSIZE_load_full) && !defined(AO_HAVE_XSIZE_load_read) # define AO_XSIZE_load_read(addr) AO_XSIZE_load_full(addr) # define AO_HAVE_XSIZE_load_read #endif #if !defined(AO_HAVE_XSIZE_load_acquire_read) && defined(AO_HAVE_XSIZE_load_acquire) # define AO_XSIZE_load_acquire_read(addr) AO_XSIZE_load_acquire(addr) # define AO_HAVE_XSIZE_load_acquire_read #endif #if defined(AO_HAVE_XSIZE_load) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_XSIZE_load_acquire) AO_INLINE unsigned XCTYPE AO_XSIZE_load_acquire(volatile unsigned XCTYPE *addr) { unsigned XCTYPE result = AO_XSIZE_load(addr); /* Acquire barrier would be useless, since the load could be delayed */ /* beyond it. */ AO_nop_full(); return result; } # define AO_HAVE_XSIZE_load_acquire #endif #if defined(AO_HAVE_XSIZE_load) && defined(AO_HAVE_nop_read) && \ !defined(AO_HAVE_XSIZE_load_read) AO_INLINE unsigned XCTYPE AO_XSIZE_load_read(volatile unsigned XCTYPE *addr) { unsigned XCTYPE result = AO_XSIZE_load(addr); /* Acquire barrier would be useless, since the load could be delayed */ /* beyond it. */ AO_nop_read(); return result; } # define AO_HAVE_XSIZE_load_read #endif #if defined(AO_HAVE_XSIZE_load_acquire) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_XSIZE_load_full) # define AO_XSIZE_load_full(addr) (AO_nop_full(), AO_XSIZE_load_acquire(addr)) # define AO_HAVE_XSIZE_load_full #endif #if !defined(AO_HAVE_XSIZE_load_acquire_read) && defined(AO_HAVE_XSIZE_load_read) # define AO_XSIZE_load_acquire_read(addr) AO_XSIZE_load_read(addr) # define AO_HAVE_XSIZE_load_acquire_read #endif #if defined(AO_HAVE_XSIZE_load_acquire_read) && !defined(AO_HAVE_XSIZE_load) # define AO_XSIZE_load(addr) AO_XSIZE_load_acquire_read(addr) # define AO_HAVE_XSIZE_load #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_XSIZE_load_acquire_read) # define AO_XSIZE_load_dd_acquire_read(addr) \ AO_XSIZE_load_acquire_read(addr) # define AO_HAVE_XSIZE_load_dd_acquire_read # endif #else # if defined(AO_HAVE_XSIZE_load) # define AO_XSIZE_load_dd_acquire_read(addr) \ AO_XSIZE_load(addr) # define AO_HAVE_XSIZE_load_dd_acquire_read # endif #endif /* XSIZE_store */ #if defined(AO_HAVE_XSIZE_store_release) && !defined(AO_HAVE_XSIZE_store) # define AO_XSIZE_store(addr, val) AO_XSIZE_store_release(addr,val) # define AO_HAVE_XSIZE_store #endif #if defined(AO_HAVE_XSIZE_store_full) && !defined(AO_HAVE_XSIZE_store_release) # define AO_XSIZE_store_release(addr,val) AO_XSIZE_store_full(addr,val) # define AO_HAVE_XSIZE_store_release #endif #if defined(AO_HAVE_XSIZE_store_full) && !defined(AO_HAVE_XSIZE_store_write) # define AO_XSIZE_store_write(addr,val) AO_XSIZE_store_full(addr,val) # define AO_HAVE_XSIZE_store_write #endif #if defined(AO_HAVE_XSIZE_store_release) && \ !defined(AO_HAVE_XSIZE_store_release_write) # define AO_XSIZE_store_release_write(addr, val) \ AO_XSIZE_store_release(addr,val) # define AO_HAVE_XSIZE_store_release_write #endif #if defined(AO_HAVE_XSIZE_store_write) && !defined(AO_HAVE_XSIZE_store) # define AO_XSIZE_store(addr, val) AO_XSIZE_store_write(addr,val) # define AO_HAVE_XSIZE_store #endif #if defined(AO_HAVE_XSIZE_store) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_XSIZE_store_release) # define AO_XSIZE_store_release(addr,val) \ (AO_nop_full(), AO_XSIZE_store(addr,val)) # define AO_HAVE_XSIZE_store_release #endif #if defined(AO_HAVE_nop_write) && defined(AO_HAVE_XSIZE_store) && \ !defined(AO_HAVE_XSIZE_store_write) # define AO_XSIZE_store_write(addr, val) \ (AO_nop_write(), AO_XSIZE_store(addr,val)) # define AO_HAVE_XSIZE_store_write #endif #if defined(AO_HAVE_XSIZE_store_write) && \ !defined(AO_HAVE_XSIZE_store_release_write) # define AO_XSIZE_store_release_write(addr, val) AO_XSIZE_store_write(addr,val) # define AO_HAVE_XSIZE_store_release_write #endif #if defined(AO_HAVE_XSIZE_store_release) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_XSIZE_store_full) # define AO_XSIZE_store_full(addr, val) \ (AO_XSIZE_store_release(addr, val), AO_nop_full()) # define AO_HAVE_XSIZE_store_full #endif /* XSIZE_fetch_and_add */ #if defined(AO_HAVE_XSIZE_compare_and_swap_full) && \ !defined(AO_HAVE_XSIZE_fetch_and_add_full) AO_INLINE AO_t AO_XSIZE_fetch_and_add_full(volatile unsigned XCTYPE *addr, unsigned XCTYPE incr) { unsigned XCTYPE old; do { old = *addr; } while (!AO_XSIZE_compare_and_swap_full(addr, old, old+incr)); return old; } # define AO_HAVE_XSIZE_fetch_and_add_full #endif #if defined(AO_HAVE_XSIZE_compare_and_swap_acquire) && \ !defined(AO_HAVE_XSIZE_fetch_and_add_acquire) AO_INLINE AO_t AO_XSIZE_fetch_and_add_acquire(volatile unsigned XCTYPE *addr, unsigned XCTYPE incr) { unsigned XCTYPE old; do { old = *addr; } while (!AO_XSIZE_compare_and_swap_acquire(addr, old, old+incr)); return old; } # define AO_HAVE_XSIZE_fetch_and_add_acquire #endif #if defined(AO_HAVE_XSIZE_compare_and_swap_release) && \ !defined(AO_HAVE_XSIZE_fetch_and_add_release) AO_INLINE AO_t AO_XSIZE_fetch_and_add_release(volatile unsigned XCTYPE *addr, unsigned XCTYPE incr) { unsigned XCTYPE old; do { old = *addr; } while (!AO_XSIZE_compare_and_swap_release(addr, old, old+incr)); return old; } # define AO_HAVE_XSIZE_fetch_and_add_release #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_full) # if !defined(AO_HAVE_XSIZE_fetch_and_add_release) # define AO_XSIZE_fetch_and_add_release(addr, val) \ AO_XSIZE_fetch_and_add_full(addr, val) # define AO_HAVE_XSIZE_fetch_and_add_release # endif # if !defined(AO_HAVE_XSIZE_fetch_and_add_acquire) # define AO_XSIZE_fetch_and_add_acquire(addr, val) \ AO_XSIZE_fetch_and_add_full(addr, val) # define AO_HAVE_XSIZE_fetch_and_add_acquire # endif # if !defined(AO_HAVE_XSIZE_fetch_and_add_write) # define AO_XSIZE_fetch_and_add_write(addr, val) \ AO_XSIZE_fetch_and_add_full(addr, val) # define AO_HAVE_XSIZE_fetch_and_add_write # endif # if !defined(AO_HAVE_XSIZE_fetch_and_add_read) # define AO_XSIZE_fetch_and_add_read(addr, val) \ AO_XSIZE_fetch_and_add_full(addr, val) # define AO_HAVE_XSIZE_fetch_and_add_read # endif #endif /* AO_HAVE_XSIZE_fetch_and_add_full */ #if !defined(AO_HAVE_XSIZE_fetch_and_add) && \ defined(AO_HAVE_XSIZE_fetch_and_add_release) # define AO_XSIZE_fetch_and_add(addr, val) \ AO_XSIZE_fetch_and_add_release(addr, val) # define AO_HAVE_XSIZE_fetch_and_add #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add) && \ defined(AO_HAVE_XSIZE_fetch_and_add_acquire) # define AO_XSIZE_fetch_and_add(addr, val) \ AO_XSIZE_fetch_and_add_acquire(addr, val) # define AO_HAVE_XSIZE_fetch_and_add #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add) && \ defined(AO_HAVE_XSIZE_fetch_and_add_write) # define AO_XSIZE_fetch_and_add(addr, val) \ AO_XSIZE_fetch_and_add_write(addr, val) # define AO_HAVE_XSIZE_fetch_and_add #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add) && \ defined(AO_HAVE_XSIZE_fetch_and_add_read) # define AO_XSIZE_fetch_and_add(addr, val) \ AO_XSIZE_fetch_and_add_read(addr, val) # define AO_HAVE_XSIZE_fetch_and_add #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_XSIZE_fetch_and_add_full) # define AO_XSIZE_fetch_and_add_full(addr, val) \ (AO_nop_full(), AO_XSIZE_fetch_and_add_acquire(addr, val)) #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add_release_write) && \ defined(AO_HAVE_XSIZE_fetch_and_add_write) # define AO_XSIZE_fetch_and_add_release_write(addr, val) \ AO_XSIZE_fetch_and_add_write(addr, val) # define AO_HAVE_XSIZE_fetch_and_add_release_write #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add_release_write) && \ defined(AO_HAVE_XSIZE_fetch_and_add_release) # define AO_XSIZE_fetch_and_add_release_write(addr, val) \ AO_XSIZE_fetch_and_add_release(addr, val) # define AO_HAVE_XSIZE_fetch_and_add_release_write #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add_acquire_read) && \ defined(AO_HAVE_XSIZE_fetch_and_add_read) # define AO_XSIZE_fetch_and_add_acquire_read(addr, val) \ AO_XSIZE_fetch_and_add_read(addr, val) # define AO_HAVE_XSIZE_fetch_and_add_acquire_read #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add_acquire_read) && \ defined(AO_HAVE_XSIZE_fetch_and_add_acquire) # define AO_XSIZE_fetch_and_add_acquire_read(addr, val) \ AO_XSIZE_fetch_and_add_acquire(addr, val) # define AO_HAVE_XSIZE_fetch_and_add_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_XSIZE_fetch_and_add_acquire_read) # define AO_XSIZE_fetch_and_add_dd_acquire_read(addr, val) \ AO_XSIZE_fetch_and_add_acquire_read(addr, val) # define AO_HAVE_XSIZE_fetch_and_add_dd_acquire_read # endif #else # if defined(AO_HAVE_XSIZE_fetch_and_add) # define AO_XSIZE_fetch_and_add_dd_acquire_read(addr, val) \ AO_XSIZE_fetch_and_add(addr, val) # define AO_HAVE_XSIZE_fetch_and_add_dd_acquire_read # endif #endif /* XSIZE_fetch_and_add1 */ #if defined(AO_HAVE_XSIZE_fetch_and_add_full) &&\ !defined(AO_HAVE_XSIZE_fetch_and_add1_full) # define AO_XSIZE_fetch_and_add1_full(addr) \ AO_XSIZE_fetch_and_add_full(addr,1) # define AO_HAVE_XSIZE_fetch_and_add1_full #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_release) &&\ !defined(AO_HAVE_XSIZE_fetch_and_add1_release) # define AO_XSIZE_fetch_and_add1_release(addr) \ AO_XSIZE_fetch_and_add_release(addr,1) # define AO_HAVE_XSIZE_fetch_and_add1_release #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_acquire) &&\ !defined(AO_HAVE_XSIZE_fetch_and_add1_acquire) # define AO_XSIZE_fetch_and_add1_acquire(addr) \ AO_XSIZE_fetch_and_add_acquire(addr,1) # define AO_HAVE_XSIZE_fetch_and_add1_acquire #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_write) &&\ !defined(AO_HAVE_XSIZE_fetch_and_add1_write) # define AO_XSIZE_fetch_and_add1_write(addr) \ AO_XSIZE_fetch_and_add_write(addr,1) # define AO_HAVE_XSIZE_fetch_and_add1_write #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_read) &&\ !defined(AO_HAVE_XSIZE_fetch_and_add1_read) # define AO_XSIZE_fetch_and_add1_read(addr) \ AO_XSIZE_fetch_and_add_read(addr,1) # define AO_HAVE_XSIZE_fetch_and_add1_read #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_release_write) &&\ !defined(AO_HAVE_XSIZE_fetch_and_add1_release_write) # define AO_XSIZE_fetch_and_add1_release_write(addr) \ AO_XSIZE_fetch_and_add_release_write(addr,1) # define AO_HAVE_XSIZE_fetch_and_add1_release_write #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_acquire_read) &&\ !defined(AO_HAVE_XSIZE_fetch_and_add1_acquire_read) # define AO_XSIZE_fetch_and_add1_acquire_read(addr) \ AO_XSIZE_fetch_and_add_acquire_read(addr,1) # define AO_HAVE_XSIZE_fetch_and_add1_acquire_read #endif #if defined(AO_HAVE_XSIZE_fetch_and_add) &&\ !defined(AO_HAVE_XSIZE_fetch_and_add1) # define AO_XSIZE_fetch_and_add1(addr) \ AO_XSIZE_fetch_and_add(addr,1) # define AO_HAVE_XSIZE_fetch_and_add1 #endif #if defined(AO_HAVE_XSIZE_fetch_and_add1_full) # if !defined(AO_HAVE_XSIZE_fetch_and_add1_release) # define AO_XSIZE_fetch_and_add1_release(addr) \ AO_XSIZE_fetch_and_add1_full(addr) # define AO_HAVE_XSIZE_fetch_and_add1_release # endif # if !defined(AO_HAVE_XSIZE_fetch_and_add1_acquire) # define AO_XSIZE_fetch_and_add1_acquire(addr) \ AO_XSIZE_fetch_and_add1_full(addr) # define AO_HAVE_XSIZE_fetch_and_add1_acquire # endif # if !defined(AO_HAVE_XSIZE_fetch_and_add1_write) # define AO_XSIZE_fetch_and_add1_write(addr) \ AO_XSIZE_fetch_and_add1_full(addr) # define AO_HAVE_XSIZE_fetch_and_add1_write # endif # if !defined(AO_HAVE_XSIZE_fetch_and_add1_read) # define AO_XSIZE_fetch_and_add1_read(addr) \ AO_XSIZE_fetch_and_add1_full(addr) # define AO_HAVE_XSIZE_fetch_and_add1_read # endif #endif /* AO_HAVE_XSIZE_fetch_and_add1_full */ #if !defined(AO_HAVE_XSIZE_fetch_and_add1) && \ defined(AO_HAVE_XSIZE_fetch_and_add1_release) # define AO_XSIZE_fetch_and_add1(addr) \ AO_XSIZE_fetch_and_add1_release(addr) # define AO_HAVE_XSIZE_fetch_and_add1 #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add1) && \ defined(AO_HAVE_XSIZE_fetch_and_add1_acquire) # define AO_XSIZE_fetch_and_add1(addr) \ AO_XSIZE_fetch_and_add1_acquire(addr) # define AO_HAVE_XSIZE_fetch_and_add1 #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add1) && \ defined(AO_HAVE_XSIZE_fetch_and_add1_write) # define AO_XSIZE_fetch_and_add1(addr) \ AO_XSIZE_fetch_and_add1_write(addr) # define AO_HAVE_XSIZE_fetch_and_add1 #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add1) && \ defined(AO_HAVE_XSIZE_fetch_and_add1_read) # define AO_XSIZE_fetch_and_add1(addr) \ AO_XSIZE_fetch_and_add1_read(addr) # define AO_HAVE_XSIZE_fetch_and_add1 #endif #if defined(AO_HAVE_XSIZE_fetch_and_add1_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_XSIZE_fetch_and_add1_full) # define AO_XSIZE_fetch_and_add1_full(addr) \ (AO_nop_full(), AO_XSIZE_fetch_and_add1_acquire(addr)) # define AO_HAVE_XSIZE_fetch_and_add1_full #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add1_release_write) && \ defined(AO_HAVE_XSIZE_fetch_and_add1_write) # define AO_XSIZE_fetch_and_add1_release_write(addr) \ AO_XSIZE_fetch_and_add1_write(addr) # define AO_HAVE_XSIZE_fetch_and_add1_release_write #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add1_release_write) && \ defined(AO_HAVE_XSIZE_fetch_and_add1_release) # define AO_XSIZE_fetch_and_add1_release_write(addr) \ AO_XSIZE_fetch_and_add1_release(addr) # define AO_HAVE_XSIZE_fetch_and_add1_release_write #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add1_acquire_read) && \ defined(AO_HAVE_XSIZE_fetch_and_add1_read) # define AO_XSIZE_fetch_and_add1_acquire_read(addr) \ AO_XSIZE_fetch_and_add1_read(addr) # define AO_HAVE_XSIZE_fetch_and_add1_acquire_read #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add1_acquire_read) && \ defined(AO_HAVE_XSIZE_fetch_and_add1_acquire) # define AO_XSIZE_fetch_and_add1_acquire_read(addr) \ AO_XSIZE_fetch_and_add1_acquire(addr) # define AO_HAVE_XSIZE_fetch_and_add1_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_XSIZE_fetch_and_add1_acquire_read) # define AO_XSIZE_fetch_and_add1_dd_acquire_read(addr) \ AO_XSIZE_fetch_and_add1_acquire_read(addr) # define AO_HAVE_XSIZE_fetch_and_add1_dd_acquire_read # endif #else # if defined(AO_HAVE_XSIZE_fetch_and_add1) # define AO_XSIZE_fetch_and_add1_dd_acquire_read(addr) \ AO_XSIZE_fetch_and_add1(addr) # define AO_HAVE_XSIZE_fetch_and_add1_dd_acquire_read # endif #endif /* XSIZE_fetch_and_sub1 */ #if defined(AO_HAVE_XSIZE_fetch_and_add_full) &&\ !defined(AO_HAVE_XSIZE_fetch_and_sub1_full) # define AO_XSIZE_fetch_and_sub1_full(addr) \ AO_XSIZE_fetch_and_add_full(addr,(unsigned XCTYPE)(-1)) # define AO_HAVE_XSIZE_fetch_and_sub1_full #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_release) &&\ !defined(AO_HAVE_XSIZE_fetch_and_sub1_release) # define AO_XSIZE_fetch_and_sub1_release(addr) \ AO_XSIZE_fetch_and_add_release(addr,(unsigned XCTYPE)(-1)) # define AO_HAVE_XSIZE_fetch_and_sub1_release #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_acquire) &&\ !defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire) # define AO_XSIZE_fetch_and_sub1_acquire(addr) \ AO_XSIZE_fetch_and_add_acquire(addr,(unsigned XCTYPE)(-1)) # define AO_HAVE_XSIZE_fetch_and_sub1_acquire #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_write) &&\ !defined(AO_HAVE_XSIZE_fetch_and_sub1_write) # define AO_XSIZE_fetch_and_sub1_write(addr) \ AO_XSIZE_fetch_and_add_write(addr,(unsigned XCTYPE)(-1)) # define AO_HAVE_XSIZE_fetch_and_sub1_write #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_read) &&\ !defined(AO_HAVE_XSIZE_fetch_and_sub1_read) # define AO_XSIZE_fetch_and_sub1_read(addr) \ AO_XSIZE_fetch_and_add_read(addr,(unsigned XCTYPE)(-1)) # define AO_HAVE_XSIZE_fetch_and_sub1_read #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_release_write) &&\ !defined(AO_HAVE_XSIZE_fetch_and_sub1_release_write) # define AO_XSIZE_fetch_and_sub1_release_write(addr) \ AO_XSIZE_fetch_and_add_release_write(addr,(unsigned XCTYPE)(-1)) # define AO_HAVE_XSIZE_fetch_and_sub1_release_write #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_acquire_read) &&\ !defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire_read) # define AO_XSIZE_fetch_and_sub1_acquire_read(addr) \ AO_XSIZE_fetch_and_add_acquire_read(addr,(unsigned XCTYPE)(-1)) # define AO_HAVE_XSIZE_fetch_and_sub1_acquire_read #endif #if defined(AO_HAVE_XSIZE_fetch_and_add) &&\ !defined(AO_HAVE_XSIZE_fetch_and_sub1) # define AO_XSIZE_fetch_and_sub1(addr) \ AO_XSIZE_fetch_and_add(addr,(unsigned XCTYPE)(-1)) # define AO_HAVE_XSIZE_fetch_and_sub1 #endif #if defined(AO_HAVE_XSIZE_fetch_and_sub1_full) # if !defined(AO_HAVE_XSIZE_fetch_and_sub1_release) # define AO_XSIZE_fetch_and_sub1_release(addr) \ AO_XSIZE_fetch_and_sub1_full(addr) # define AO_HAVE_XSIZE_fetch_and_sub1_release # endif # if !defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire) # define AO_XSIZE_fetch_and_sub1_acquire(addr) \ AO_XSIZE_fetch_and_sub1_full(addr) # define AO_HAVE_XSIZE_fetch_and_sub1_acquire # endif # if !defined(AO_HAVE_XSIZE_fetch_and_sub1_write) # define AO_XSIZE_fetch_and_sub1_write(addr) \ AO_XSIZE_fetch_and_sub1_full(addr) # define AO_HAVE_XSIZE_fetch_and_sub1_write # endif # if !defined(AO_HAVE_XSIZE_fetch_and_sub1_read) # define AO_XSIZE_fetch_and_sub1_read(addr) \ AO_XSIZE_fetch_and_sub1_full(addr) # define AO_HAVE_XSIZE_fetch_and_sub1_read # endif #endif /* AO_HAVE_XSIZE_fetch_and_sub1_full */ #if !defined(AO_HAVE_XSIZE_fetch_and_sub1) && \ defined(AO_HAVE_XSIZE_fetch_and_sub1_release) # define AO_XSIZE_fetch_and_sub1(addr) \ AO_XSIZE_fetch_and_sub1_release(addr) # define AO_HAVE_XSIZE_fetch_and_sub1 #endif #if !defined(AO_HAVE_XSIZE_fetch_and_sub1) && \ defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire) # define AO_XSIZE_fetch_and_sub1(addr) \ AO_XSIZE_fetch_and_sub1_acquire(addr) # define AO_HAVE_XSIZE_fetch_and_sub1 #endif #if !defined(AO_HAVE_XSIZE_fetch_and_sub1) && \ defined(AO_HAVE_XSIZE_fetch_and_sub1_write) # define AO_XSIZE_fetch_and_sub1(addr) \ AO_XSIZE_fetch_and_sub1_write(addr) # define AO_HAVE_XSIZE_fetch_and_sub1 #endif #if !defined(AO_HAVE_XSIZE_fetch_and_sub1) && \ defined(AO_HAVE_XSIZE_fetch_and_sub1_read) # define AO_XSIZE_fetch_and_sub1(addr) \ AO_XSIZE_fetch_and_sub1_read(addr) # define AO_HAVE_XSIZE_fetch_and_sub1 #endif #if defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_XSIZE_fetch_and_sub1_full) # define AO_XSIZE_fetch_and_sub1_full(addr) \ (AO_nop_full(), AO_XSIZE_fetch_and_sub1_acquire(addr)) # define AO_HAVE_XSIZE_fetch_and_sub1_full #endif #if !defined(AO_HAVE_XSIZE_fetch_and_sub1_release_write) && \ defined(AO_HAVE_XSIZE_fetch_and_sub1_write) # define AO_XSIZE_fetch_and_sub1_release_write(addr) \ AO_XSIZE_fetch_and_sub1_write(addr) # define AO_HAVE_XSIZE_fetch_and_sub1_release_write #endif #if !defined(AO_HAVE_XSIZE_fetch_and_sub1_release_write) && \ defined(AO_HAVE_XSIZE_fetch_and_sub1_release) # define AO_XSIZE_fetch_and_sub1_release_write(addr) \ AO_XSIZE_fetch_and_sub1_release(addr) # define AO_HAVE_XSIZE_fetch_and_sub1_release_write #endif #if !defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire_read) && \ defined(AO_HAVE_XSIZE_fetch_and_sub1_read) # define AO_XSIZE_fetch_and_sub1_acquire_read(addr) \ AO_XSIZE_fetch_and_sub1_read(addr) # define AO_HAVE_XSIZE_fetch_and_sub1_acquire_read #endif #if !defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire_read) && \ defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire) # define AO_XSIZE_fetch_and_sub1_acquire_read(addr) \ AO_XSIZE_fetch_and_sub1_acquire(addr) # define AO_HAVE_XSIZE_fetch_and_sub1_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire_read) # define AO_XSIZE_fetch_and_sub1_dd_acquire_read(addr) \ AO_XSIZE_fetch_and_sub1_acquire_read(addr) # define AO_HAVE_XSIZE_fetch_and_sub1_dd_acquire_read # endif #else # if defined(AO_HAVE_XSIZE_fetch_and_sub1) # define AO_XSIZE_fetch_and_sub1_dd_acquire_read(addr) \ AO_XSIZE_fetch_and_sub1(addr) # define AO_HAVE_XSIZE_fetch_and_sub1_dd_acquire_read # endif #endif synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/generalize-small.h0000664000076400007640000017006611104702315027046 0ustar stefanstefan/* char_load */ #if defined(AO_HAVE_char_load_acquire) && !defined(AO_HAVE_char_load) # define AO_char_load(addr) AO_char_load_acquire(addr) # define AO_HAVE_char_load #endif #if defined(AO_HAVE_char_load_full) && !defined(AO_HAVE_char_load_acquire) # define AO_char_load_acquire(addr) AO_char_load_full(addr) # define AO_HAVE_char_load_acquire #endif #if defined(AO_HAVE_char_load_full) && !defined(AO_HAVE_char_load_read) # define AO_char_load_read(addr) AO_char_load_full(addr) # define AO_HAVE_char_load_read #endif #if !defined(AO_HAVE_char_load_acquire_read) && defined(AO_HAVE_char_load_acquire) # define AO_char_load_acquire_read(addr) AO_char_load_acquire(addr) # define AO_HAVE_char_load_acquire_read #endif #if defined(AO_HAVE_char_load) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_char_load_acquire) AO_INLINE unsigned char AO_char_load_acquire(volatile unsigned char *addr) { unsigned char result = AO_char_load(addr); /* Acquire barrier would be useless, since the load could be delayed */ /* beyond it. */ AO_nop_full(); return result; } # define AO_HAVE_char_load_acquire #endif #if defined(AO_HAVE_char_load) && defined(AO_HAVE_nop_read) && \ !defined(AO_HAVE_char_load_read) AO_INLINE unsigned char AO_char_load_read(volatile unsigned char *addr) { unsigned char result = AO_char_load(addr); /* Acquire barrier would be useless, since the load could be delayed */ /* beyond it. */ AO_nop_read(); return result; } # define AO_HAVE_char_load_read #endif #if defined(AO_HAVE_char_load_acquire) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_char_load_full) # define AO_char_load_full(addr) (AO_nop_full(), AO_char_load_acquire(addr)) # define AO_HAVE_char_load_full #endif #if !defined(AO_HAVE_char_load_acquire_read) && defined(AO_HAVE_char_load_read) # define AO_char_load_acquire_read(addr) AO_char_load_read(addr) # define AO_HAVE_char_load_acquire_read #endif #if defined(AO_HAVE_char_load_acquire_read) && !defined(AO_HAVE_char_load) # define AO_char_load(addr) AO_char_load_acquire_read(addr) # define AO_HAVE_char_load #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_char_load_acquire_read) # define AO_char_load_dd_acquire_read(addr) \ AO_char_load_acquire_read(addr) # define AO_HAVE_char_load_dd_acquire_read # endif #else # if defined(AO_HAVE_char_load) # define AO_char_load_dd_acquire_read(addr) \ AO_char_load(addr) # define AO_HAVE_char_load_dd_acquire_read # endif #endif /* char_store */ #if defined(AO_HAVE_char_store_release) && !defined(AO_HAVE_char_store) # define AO_char_store(addr, val) AO_char_store_release(addr,val) # define AO_HAVE_char_store #endif #if defined(AO_HAVE_char_store_full) && !defined(AO_HAVE_char_store_release) # define AO_char_store_release(addr,val) AO_char_store_full(addr,val) # define AO_HAVE_char_store_release #endif #if defined(AO_HAVE_char_store_full) && !defined(AO_HAVE_char_store_write) # define AO_char_store_write(addr,val) AO_char_store_full(addr,val) # define AO_HAVE_char_store_write #endif #if defined(AO_HAVE_char_store_release) && \ !defined(AO_HAVE_char_store_release_write) # define AO_char_store_release_write(addr, val) \ AO_char_store_release(addr,val) # define AO_HAVE_char_store_release_write #endif #if defined(AO_HAVE_char_store_write) && !defined(AO_HAVE_char_store) # define AO_char_store(addr, val) AO_char_store_write(addr,val) # define AO_HAVE_char_store #endif #if defined(AO_HAVE_char_store) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_char_store_release) # define AO_char_store_release(addr,val) \ (AO_nop_full(), AO_char_store(addr,val)) # define AO_HAVE_char_store_release #endif #if defined(AO_HAVE_nop_write) && defined(AO_HAVE_char_store) && \ !defined(AO_HAVE_char_store_write) # define AO_char_store_write(addr, val) \ (AO_nop_write(), AO_char_store(addr,val)) # define AO_HAVE_char_store_write #endif #if defined(AO_HAVE_char_store_write) && \ !defined(AO_HAVE_char_store_release_write) # define AO_char_store_release_write(addr, val) AO_char_store_write(addr,val) # define AO_HAVE_char_store_release_write #endif #if defined(AO_HAVE_char_store_release) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_char_store_full) # define AO_char_store_full(addr, val) \ (AO_char_store_release(addr, val), AO_nop_full()) # define AO_HAVE_char_store_full #endif /* char_fetch_and_add */ #if defined(AO_HAVE_char_compare_and_swap_full) && \ !defined(AO_HAVE_char_fetch_and_add_full) AO_INLINE AO_t AO_char_fetch_and_add_full(volatile unsigned char *addr, unsigned char incr) { unsigned char old; do { old = *addr; } while (!AO_char_compare_and_swap_full(addr, old, old+incr)); return old; } # define AO_HAVE_char_fetch_and_add_full #endif #if defined(AO_HAVE_char_compare_and_swap_acquire) && \ !defined(AO_HAVE_char_fetch_and_add_acquire) AO_INLINE AO_t AO_char_fetch_and_add_acquire(volatile unsigned char *addr, unsigned char incr) { unsigned char old; do { old = *addr; } while (!AO_char_compare_and_swap_acquire(addr, old, old+incr)); return old; } # define AO_HAVE_char_fetch_and_add_acquire #endif #if defined(AO_HAVE_char_compare_and_swap_release) && \ !defined(AO_HAVE_char_fetch_and_add_release) AO_INLINE AO_t AO_char_fetch_and_add_release(volatile unsigned char *addr, unsigned char incr) { unsigned char old; do { old = *addr; } while (!AO_char_compare_and_swap_release(addr, old, old+incr)); return old; } # define AO_HAVE_char_fetch_and_add_release #endif #if defined(AO_HAVE_char_fetch_and_add_full) # if !defined(AO_HAVE_char_fetch_and_add_release) # define AO_char_fetch_and_add_release(addr, val) \ AO_char_fetch_and_add_full(addr, val) # define AO_HAVE_char_fetch_and_add_release # endif # if !defined(AO_HAVE_char_fetch_and_add_acquire) # define AO_char_fetch_and_add_acquire(addr, val) \ AO_char_fetch_and_add_full(addr, val) # define AO_HAVE_char_fetch_and_add_acquire # endif # if !defined(AO_HAVE_char_fetch_and_add_write) # define AO_char_fetch_and_add_write(addr, val) \ AO_char_fetch_and_add_full(addr, val) # define AO_HAVE_char_fetch_and_add_write # endif # if !defined(AO_HAVE_char_fetch_and_add_read) # define AO_char_fetch_and_add_read(addr, val) \ AO_char_fetch_and_add_full(addr, val) # define AO_HAVE_char_fetch_and_add_read # endif #endif /* AO_HAVE_char_fetch_and_add_full */ #if !defined(AO_HAVE_char_fetch_and_add) && \ defined(AO_HAVE_char_fetch_and_add_release) # define AO_char_fetch_and_add(addr, val) \ AO_char_fetch_and_add_release(addr, val) # define AO_HAVE_char_fetch_and_add #endif #if !defined(AO_HAVE_char_fetch_and_add) && \ defined(AO_HAVE_char_fetch_and_add_acquire) # define AO_char_fetch_and_add(addr, val) \ AO_char_fetch_and_add_acquire(addr, val) # define AO_HAVE_char_fetch_and_add #endif #if !defined(AO_HAVE_char_fetch_and_add) && \ defined(AO_HAVE_char_fetch_and_add_write) # define AO_char_fetch_and_add(addr, val) \ AO_char_fetch_and_add_write(addr, val) # define AO_HAVE_char_fetch_and_add #endif #if !defined(AO_HAVE_char_fetch_and_add) && \ defined(AO_HAVE_char_fetch_and_add_read) # define AO_char_fetch_and_add(addr, val) \ AO_char_fetch_and_add_read(addr, val) # define AO_HAVE_char_fetch_and_add #endif #if defined(AO_HAVE_char_fetch_and_add_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_char_fetch_and_add_full) # define AO_char_fetch_and_add_full(addr, val) \ (AO_nop_full(), AO_char_fetch_and_add_acquire(addr, val)) #endif #if !defined(AO_HAVE_char_fetch_and_add_release_write) && \ defined(AO_HAVE_char_fetch_and_add_write) # define AO_char_fetch_and_add_release_write(addr, val) \ AO_char_fetch_and_add_write(addr, val) # define AO_HAVE_char_fetch_and_add_release_write #endif #if !defined(AO_HAVE_char_fetch_and_add_release_write) && \ defined(AO_HAVE_char_fetch_and_add_release) # define AO_char_fetch_and_add_release_write(addr, val) \ AO_char_fetch_and_add_release(addr, val) # define AO_HAVE_char_fetch_and_add_release_write #endif #if !defined(AO_HAVE_char_fetch_and_add_acquire_read) && \ defined(AO_HAVE_char_fetch_and_add_read) # define AO_char_fetch_and_add_acquire_read(addr, val) \ AO_char_fetch_and_add_read(addr, val) # define AO_HAVE_char_fetch_and_add_acquire_read #endif #if !defined(AO_HAVE_char_fetch_and_add_acquire_read) && \ defined(AO_HAVE_char_fetch_and_add_acquire) # define AO_char_fetch_and_add_acquire_read(addr, val) \ AO_char_fetch_and_add_acquire(addr, val) # define AO_HAVE_char_fetch_and_add_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_char_fetch_and_add_acquire_read) # define AO_char_fetch_and_add_dd_acquire_read(addr, val) \ AO_char_fetch_and_add_acquire_read(addr, val) # define AO_HAVE_char_fetch_and_add_dd_acquire_read # endif #else # if defined(AO_HAVE_char_fetch_and_add) # define AO_char_fetch_and_add_dd_acquire_read(addr, val) \ AO_char_fetch_and_add(addr, val) # define AO_HAVE_char_fetch_and_add_dd_acquire_read # endif #endif /* char_fetch_and_add1 */ #if defined(AO_HAVE_char_fetch_and_add_full) &&\ !defined(AO_HAVE_char_fetch_and_add1_full) # define AO_char_fetch_and_add1_full(addr) \ AO_char_fetch_and_add_full(addr,1) # define AO_HAVE_char_fetch_and_add1_full #endif #if defined(AO_HAVE_char_fetch_and_add_release) &&\ !defined(AO_HAVE_char_fetch_and_add1_release) # define AO_char_fetch_and_add1_release(addr) \ AO_char_fetch_and_add_release(addr,1) # define AO_HAVE_char_fetch_and_add1_release #endif #if defined(AO_HAVE_char_fetch_and_add_acquire) &&\ !defined(AO_HAVE_char_fetch_and_add1_acquire) # define AO_char_fetch_and_add1_acquire(addr) \ AO_char_fetch_and_add_acquire(addr,1) # define AO_HAVE_char_fetch_and_add1_acquire #endif #if defined(AO_HAVE_char_fetch_and_add_write) &&\ !defined(AO_HAVE_char_fetch_and_add1_write) # define AO_char_fetch_and_add1_write(addr) \ AO_char_fetch_and_add_write(addr,1) # define AO_HAVE_char_fetch_and_add1_write #endif #if defined(AO_HAVE_char_fetch_and_add_read) &&\ !defined(AO_HAVE_char_fetch_and_add1_read) # define AO_char_fetch_and_add1_read(addr) \ AO_char_fetch_and_add_read(addr,1) # define AO_HAVE_char_fetch_and_add1_read #endif #if defined(AO_HAVE_char_fetch_and_add_release_write) &&\ !defined(AO_HAVE_char_fetch_and_add1_release_write) # define AO_char_fetch_and_add1_release_write(addr) \ AO_char_fetch_and_add_release_write(addr,1) # define AO_HAVE_char_fetch_and_add1_release_write #endif #if defined(AO_HAVE_char_fetch_and_add_acquire_read) &&\ !defined(AO_HAVE_char_fetch_and_add1_acquire_read) # define AO_char_fetch_and_add1_acquire_read(addr) \ AO_char_fetch_and_add_acquire_read(addr,1) # define AO_HAVE_char_fetch_and_add1_acquire_read #endif #if defined(AO_HAVE_char_fetch_and_add) &&\ !defined(AO_HAVE_char_fetch_and_add1) # define AO_char_fetch_and_add1(addr) \ AO_char_fetch_and_add(addr,1) # define AO_HAVE_char_fetch_and_add1 #endif #if defined(AO_HAVE_char_fetch_and_add1_full) # if !defined(AO_HAVE_char_fetch_and_add1_release) # define AO_char_fetch_and_add1_release(addr) \ AO_char_fetch_and_add1_full(addr) # define AO_HAVE_char_fetch_and_add1_release # endif # if !defined(AO_HAVE_char_fetch_and_add1_acquire) # define AO_char_fetch_and_add1_acquire(addr) \ AO_char_fetch_and_add1_full(addr) # define AO_HAVE_char_fetch_and_add1_acquire # endif # if !defined(AO_HAVE_char_fetch_and_add1_write) # define AO_char_fetch_and_add1_write(addr) \ AO_char_fetch_and_add1_full(addr) # define AO_HAVE_char_fetch_and_add1_write # endif # if !defined(AO_HAVE_char_fetch_and_add1_read) # define AO_char_fetch_and_add1_read(addr) \ AO_char_fetch_and_add1_full(addr) # define AO_HAVE_char_fetch_and_add1_read # endif #endif /* AO_HAVE_char_fetch_and_add1_full */ #if !defined(AO_HAVE_char_fetch_and_add1) && \ defined(AO_HAVE_char_fetch_and_add1_release) # define AO_char_fetch_and_add1(addr) \ AO_char_fetch_and_add1_release(addr) # define AO_HAVE_char_fetch_and_add1 #endif #if !defined(AO_HAVE_char_fetch_and_add1) && \ defined(AO_HAVE_char_fetch_and_add1_acquire) # define AO_char_fetch_and_add1(addr) \ AO_char_fetch_and_add1_acquire(addr) # define AO_HAVE_char_fetch_and_add1 #endif #if !defined(AO_HAVE_char_fetch_and_add1) && \ defined(AO_HAVE_char_fetch_and_add1_write) # define AO_char_fetch_and_add1(addr) \ AO_char_fetch_and_add1_write(addr) # define AO_HAVE_char_fetch_and_add1 #endif #if !defined(AO_HAVE_char_fetch_and_add1) && \ defined(AO_HAVE_char_fetch_and_add1_read) # define AO_char_fetch_and_add1(addr) \ AO_char_fetch_and_add1_read(addr) # define AO_HAVE_char_fetch_and_add1 #endif #if defined(AO_HAVE_char_fetch_and_add1_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_char_fetch_and_add1_full) # define AO_char_fetch_and_add1_full(addr) \ (AO_nop_full(), AO_char_fetch_and_add1_acquire(addr)) # define AO_HAVE_char_fetch_and_add1_full #endif #if !defined(AO_HAVE_char_fetch_and_add1_release_write) && \ defined(AO_HAVE_char_fetch_and_add1_write) # define AO_char_fetch_and_add1_release_write(addr) \ AO_char_fetch_and_add1_write(addr) # define AO_HAVE_char_fetch_and_add1_release_write #endif #if !defined(AO_HAVE_char_fetch_and_add1_release_write) && \ defined(AO_HAVE_char_fetch_and_add1_release) # define AO_char_fetch_and_add1_release_write(addr) \ AO_char_fetch_and_add1_release(addr) # define AO_HAVE_char_fetch_and_add1_release_write #endif #if !defined(AO_HAVE_char_fetch_and_add1_acquire_read) && \ defined(AO_HAVE_char_fetch_and_add1_read) # define AO_char_fetch_and_add1_acquire_read(addr) \ AO_char_fetch_and_add1_read(addr) # define AO_HAVE_char_fetch_and_add1_acquire_read #endif #if !defined(AO_HAVE_char_fetch_and_add1_acquire_read) && \ defined(AO_HAVE_char_fetch_and_add1_acquire) # define AO_char_fetch_and_add1_acquire_read(addr) \ AO_char_fetch_and_add1_acquire(addr) # define AO_HAVE_char_fetch_and_add1_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_char_fetch_and_add1_acquire_read) # define AO_char_fetch_and_add1_dd_acquire_read(addr) \ AO_char_fetch_and_add1_acquire_read(addr) # define AO_HAVE_char_fetch_and_add1_dd_acquire_read # endif #else # if defined(AO_HAVE_char_fetch_and_add1) # define AO_char_fetch_and_add1_dd_acquire_read(addr) \ AO_char_fetch_and_add1(addr) # define AO_HAVE_char_fetch_and_add1_dd_acquire_read # endif #endif /* char_fetch_and_sub1 */ #if defined(AO_HAVE_char_fetch_and_add_full) &&\ !defined(AO_HAVE_char_fetch_and_sub1_full) # define AO_char_fetch_and_sub1_full(addr) \ AO_char_fetch_and_add_full(addr,(unsigned char)(-1)) # define AO_HAVE_char_fetch_and_sub1_full #endif #if defined(AO_HAVE_char_fetch_and_add_release) &&\ !defined(AO_HAVE_char_fetch_and_sub1_release) # define AO_char_fetch_and_sub1_release(addr) \ AO_char_fetch_and_add_release(addr,(unsigned char)(-1)) # define AO_HAVE_char_fetch_and_sub1_release #endif #if defined(AO_HAVE_char_fetch_and_add_acquire) &&\ !defined(AO_HAVE_char_fetch_and_sub1_acquire) # define AO_char_fetch_and_sub1_acquire(addr) \ AO_char_fetch_and_add_acquire(addr,(unsigned char)(-1)) # define AO_HAVE_char_fetch_and_sub1_acquire #endif #if defined(AO_HAVE_char_fetch_and_add_write) &&\ !defined(AO_HAVE_char_fetch_and_sub1_write) # define AO_char_fetch_and_sub1_write(addr) \ AO_char_fetch_and_add_write(addr,(unsigned char)(-1)) # define AO_HAVE_char_fetch_and_sub1_write #endif #if defined(AO_HAVE_char_fetch_and_add_read) &&\ !defined(AO_HAVE_char_fetch_and_sub1_read) # define AO_char_fetch_and_sub1_read(addr) \ AO_char_fetch_and_add_read(addr,(unsigned char)(-1)) # define AO_HAVE_char_fetch_and_sub1_read #endif #if defined(AO_HAVE_char_fetch_and_add_release_write) &&\ !defined(AO_HAVE_char_fetch_and_sub1_release_write) # define AO_char_fetch_and_sub1_release_write(addr) \ AO_char_fetch_and_add_release_write(addr,(unsigned char)(-1)) # define AO_HAVE_char_fetch_and_sub1_release_write #endif #if defined(AO_HAVE_char_fetch_and_add_acquire_read) &&\ !defined(AO_HAVE_char_fetch_and_sub1_acquire_read) # define AO_char_fetch_and_sub1_acquire_read(addr) \ AO_char_fetch_and_add_acquire_read(addr,(unsigned char)(-1)) # define AO_HAVE_char_fetch_and_sub1_acquire_read #endif #if defined(AO_HAVE_char_fetch_and_add) &&\ !defined(AO_HAVE_char_fetch_and_sub1) # define AO_char_fetch_and_sub1(addr) \ AO_char_fetch_and_add(addr,(unsigned char)(-1)) # define AO_HAVE_char_fetch_and_sub1 #endif #if defined(AO_HAVE_char_fetch_and_sub1_full) # if !defined(AO_HAVE_char_fetch_and_sub1_release) # define AO_char_fetch_and_sub1_release(addr) \ AO_char_fetch_and_sub1_full(addr) # define AO_HAVE_char_fetch_and_sub1_release # endif # if !defined(AO_HAVE_char_fetch_and_sub1_acquire) # define AO_char_fetch_and_sub1_acquire(addr) \ AO_char_fetch_and_sub1_full(addr) # define AO_HAVE_char_fetch_and_sub1_acquire # endif # if !defined(AO_HAVE_char_fetch_and_sub1_write) # define AO_char_fetch_and_sub1_write(addr) \ AO_char_fetch_and_sub1_full(addr) # define AO_HAVE_char_fetch_and_sub1_write # endif # if !defined(AO_HAVE_char_fetch_and_sub1_read) # define AO_char_fetch_and_sub1_read(addr) \ AO_char_fetch_and_sub1_full(addr) # define AO_HAVE_char_fetch_and_sub1_read # endif #endif /* AO_HAVE_char_fetch_and_sub1_full */ #if !defined(AO_HAVE_char_fetch_and_sub1) && \ defined(AO_HAVE_char_fetch_and_sub1_release) # define AO_char_fetch_and_sub1(addr) \ AO_char_fetch_and_sub1_release(addr) # define AO_HAVE_char_fetch_and_sub1 #endif #if !defined(AO_HAVE_char_fetch_and_sub1) && \ defined(AO_HAVE_char_fetch_and_sub1_acquire) # define AO_char_fetch_and_sub1(addr) \ AO_char_fetch_and_sub1_acquire(addr) # define AO_HAVE_char_fetch_and_sub1 #endif #if !defined(AO_HAVE_char_fetch_and_sub1) && \ defined(AO_HAVE_char_fetch_and_sub1_write) # define AO_char_fetch_and_sub1(addr) \ AO_char_fetch_and_sub1_write(addr) # define AO_HAVE_char_fetch_and_sub1 #endif #if !defined(AO_HAVE_char_fetch_and_sub1) && \ defined(AO_HAVE_char_fetch_and_sub1_read) # define AO_char_fetch_and_sub1(addr) \ AO_char_fetch_and_sub1_read(addr) # define AO_HAVE_char_fetch_and_sub1 #endif #if defined(AO_HAVE_char_fetch_and_sub1_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_char_fetch_and_sub1_full) # define AO_char_fetch_and_sub1_full(addr) \ (AO_nop_full(), AO_char_fetch_and_sub1_acquire(addr)) # define AO_HAVE_char_fetch_and_sub1_full #endif #if !defined(AO_HAVE_char_fetch_and_sub1_release_write) && \ defined(AO_HAVE_char_fetch_and_sub1_write) # define AO_char_fetch_and_sub1_release_write(addr) \ AO_char_fetch_and_sub1_write(addr) # define AO_HAVE_char_fetch_and_sub1_release_write #endif #if !defined(AO_HAVE_char_fetch_and_sub1_release_write) && \ defined(AO_HAVE_char_fetch_and_sub1_release) # define AO_char_fetch_and_sub1_release_write(addr) \ AO_char_fetch_and_sub1_release(addr) # define AO_HAVE_char_fetch_and_sub1_release_write #endif #if !defined(AO_HAVE_char_fetch_and_sub1_acquire_read) && \ defined(AO_HAVE_char_fetch_and_sub1_read) # define AO_char_fetch_and_sub1_acquire_read(addr) \ AO_char_fetch_and_sub1_read(addr) # define AO_HAVE_char_fetch_and_sub1_acquire_read #endif #if !defined(AO_HAVE_char_fetch_and_sub1_acquire_read) && \ defined(AO_HAVE_char_fetch_and_sub1_acquire) # define AO_char_fetch_and_sub1_acquire_read(addr) \ AO_char_fetch_and_sub1_acquire(addr) # define AO_HAVE_char_fetch_and_sub1_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_char_fetch_and_sub1_acquire_read) # define AO_char_fetch_and_sub1_dd_acquire_read(addr) \ AO_char_fetch_and_sub1_acquire_read(addr) # define AO_HAVE_char_fetch_and_sub1_dd_acquire_read # endif #else # if defined(AO_HAVE_char_fetch_and_sub1) # define AO_char_fetch_and_sub1_dd_acquire_read(addr) \ AO_char_fetch_and_sub1(addr) # define AO_HAVE_char_fetch_and_sub1_dd_acquire_read # endif #endif /* short_load */ #if defined(AO_HAVE_short_load_acquire) && !defined(AO_HAVE_short_load) # define AO_short_load(addr) AO_short_load_acquire(addr) # define AO_HAVE_short_load #endif #if defined(AO_HAVE_short_load_full) && !defined(AO_HAVE_short_load_acquire) # define AO_short_load_acquire(addr) AO_short_load_full(addr) # define AO_HAVE_short_load_acquire #endif #if defined(AO_HAVE_short_load_full) && !defined(AO_HAVE_short_load_read) # define AO_short_load_read(addr) AO_short_load_full(addr) # define AO_HAVE_short_load_read #endif #if !defined(AO_HAVE_short_load_acquire_read) && defined(AO_HAVE_short_load_acquire) # define AO_short_load_acquire_read(addr) AO_short_load_acquire(addr) # define AO_HAVE_short_load_acquire_read #endif #if defined(AO_HAVE_short_load) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_short_load_acquire) AO_INLINE unsigned short AO_short_load_acquire(volatile unsigned short *addr) { unsigned short result = AO_short_load(addr); /* Acquire barrier would be useless, since the load could be delayed */ /* beyond it. */ AO_nop_full(); return result; } # define AO_HAVE_short_load_acquire #endif #if defined(AO_HAVE_short_load) && defined(AO_HAVE_nop_read) && \ !defined(AO_HAVE_short_load_read) AO_INLINE unsigned short AO_short_load_read(volatile unsigned short *addr) { unsigned short result = AO_short_load(addr); /* Acquire barrier would be useless, since the load could be delayed */ /* beyond it. */ AO_nop_read(); return result; } # define AO_HAVE_short_load_read #endif #if defined(AO_HAVE_short_load_acquire) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_short_load_full) # define AO_short_load_full(addr) (AO_nop_full(), AO_short_load_acquire(addr)) # define AO_HAVE_short_load_full #endif #if !defined(AO_HAVE_short_load_acquire_read) && defined(AO_HAVE_short_load_read) # define AO_short_load_acquire_read(addr) AO_short_load_read(addr) # define AO_HAVE_short_load_acquire_read #endif #if defined(AO_HAVE_short_load_acquire_read) && !defined(AO_HAVE_short_load) # define AO_short_load(addr) AO_short_load_acquire_read(addr) # define AO_HAVE_short_load #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_short_load_acquire_read) # define AO_short_load_dd_acquire_read(addr) \ AO_short_load_acquire_read(addr) # define AO_HAVE_short_load_dd_acquire_read # endif #else # if defined(AO_HAVE_short_load) # define AO_short_load_dd_acquire_read(addr) \ AO_short_load(addr) # define AO_HAVE_short_load_dd_acquire_read # endif #endif /* short_store */ #if defined(AO_HAVE_short_store_release) && !defined(AO_HAVE_short_store) # define AO_short_store(addr, val) AO_short_store_release(addr,val) # define AO_HAVE_short_store #endif #if defined(AO_HAVE_short_store_full) && !defined(AO_HAVE_short_store_release) # define AO_short_store_release(addr,val) AO_short_store_full(addr,val) # define AO_HAVE_short_store_release #endif #if defined(AO_HAVE_short_store_full) && !defined(AO_HAVE_short_store_write) # define AO_short_store_write(addr,val) AO_short_store_full(addr,val) # define AO_HAVE_short_store_write #endif #if defined(AO_HAVE_short_store_release) && \ !defined(AO_HAVE_short_store_release_write) # define AO_short_store_release_write(addr, val) \ AO_short_store_release(addr,val) # define AO_HAVE_short_store_release_write #endif #if defined(AO_HAVE_short_store_write) && !defined(AO_HAVE_short_store) # define AO_short_store(addr, val) AO_short_store_write(addr,val) # define AO_HAVE_short_store #endif #if defined(AO_HAVE_short_store) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_short_store_release) # define AO_short_store_release(addr,val) \ (AO_nop_full(), AO_short_store(addr,val)) # define AO_HAVE_short_store_release #endif #if defined(AO_HAVE_nop_write) && defined(AO_HAVE_short_store) && \ !defined(AO_HAVE_short_store_write) # define AO_short_store_write(addr, val) \ (AO_nop_write(), AO_short_store(addr,val)) # define AO_HAVE_short_store_write #endif #if defined(AO_HAVE_short_store_write) && \ !defined(AO_HAVE_short_store_release_write) # define AO_short_store_release_write(addr, val) AO_short_store_write(addr,val) # define AO_HAVE_short_store_release_write #endif #if defined(AO_HAVE_short_store_release) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_short_store_full) # define AO_short_store_full(addr, val) \ (AO_short_store_release(addr, val), AO_nop_full()) # define AO_HAVE_short_store_full #endif /* short_fetch_and_add */ #if defined(AO_HAVE_short_compare_and_swap_full) && \ !defined(AO_HAVE_short_fetch_and_add_full) AO_INLINE AO_t AO_short_fetch_and_add_full(volatile unsigned short *addr, unsigned short incr) { unsigned short old; do { old = *addr; } while (!AO_short_compare_and_swap_full(addr, old, old+incr)); return old; } # define AO_HAVE_short_fetch_and_add_full #endif #if defined(AO_HAVE_short_compare_and_swap_acquire) && \ !defined(AO_HAVE_short_fetch_and_add_acquire) AO_INLINE AO_t AO_short_fetch_and_add_acquire(volatile unsigned short *addr, unsigned short incr) { unsigned short old; do { old = *addr; } while (!AO_short_compare_and_swap_acquire(addr, old, old+incr)); return old; } # define AO_HAVE_short_fetch_and_add_acquire #endif #if defined(AO_HAVE_short_compare_and_swap_release) && \ !defined(AO_HAVE_short_fetch_and_add_release) AO_INLINE AO_t AO_short_fetch_and_add_release(volatile unsigned short *addr, unsigned short incr) { unsigned short old; do { old = *addr; } while (!AO_short_compare_and_swap_release(addr, old, old+incr)); return old; } # define AO_HAVE_short_fetch_and_add_release #endif #if defined(AO_HAVE_short_fetch_and_add_full) # if !defined(AO_HAVE_short_fetch_and_add_release) # define AO_short_fetch_and_add_release(addr, val) \ AO_short_fetch_and_add_full(addr, val) # define AO_HAVE_short_fetch_and_add_release # endif # if !defined(AO_HAVE_short_fetch_and_add_acquire) # define AO_short_fetch_and_add_acquire(addr, val) \ AO_short_fetch_and_add_full(addr, val) # define AO_HAVE_short_fetch_and_add_acquire # endif # if !defined(AO_HAVE_short_fetch_and_add_write) # define AO_short_fetch_and_add_write(addr, val) \ AO_short_fetch_and_add_full(addr, val) # define AO_HAVE_short_fetch_and_add_write # endif # if !defined(AO_HAVE_short_fetch_and_add_read) # define AO_short_fetch_and_add_read(addr, val) \ AO_short_fetch_and_add_full(addr, val) # define AO_HAVE_short_fetch_and_add_read # endif #endif /* AO_HAVE_short_fetch_and_add_full */ #if !defined(AO_HAVE_short_fetch_and_add) && \ defined(AO_HAVE_short_fetch_and_add_release) # define AO_short_fetch_and_add(addr, val) \ AO_short_fetch_and_add_release(addr, val) # define AO_HAVE_short_fetch_and_add #endif #if !defined(AO_HAVE_short_fetch_and_add) && \ defined(AO_HAVE_short_fetch_and_add_acquire) # define AO_short_fetch_and_add(addr, val) \ AO_short_fetch_and_add_acquire(addr, val) # define AO_HAVE_short_fetch_and_add #endif #if !defined(AO_HAVE_short_fetch_and_add) && \ defined(AO_HAVE_short_fetch_and_add_write) # define AO_short_fetch_and_add(addr, val) \ AO_short_fetch_and_add_write(addr, val) # define AO_HAVE_short_fetch_and_add #endif #if !defined(AO_HAVE_short_fetch_and_add) && \ defined(AO_HAVE_short_fetch_and_add_read) # define AO_short_fetch_and_add(addr, val) \ AO_short_fetch_and_add_read(addr, val) # define AO_HAVE_short_fetch_and_add #endif #if defined(AO_HAVE_short_fetch_and_add_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_short_fetch_and_add_full) # define AO_short_fetch_and_add_full(addr, val) \ (AO_nop_full(), AO_short_fetch_and_add_acquire(addr, val)) #endif #if !defined(AO_HAVE_short_fetch_and_add_release_write) && \ defined(AO_HAVE_short_fetch_and_add_write) # define AO_short_fetch_and_add_release_write(addr, val) \ AO_short_fetch_and_add_write(addr, val) # define AO_HAVE_short_fetch_and_add_release_write #endif #if !defined(AO_HAVE_short_fetch_and_add_release_write) && \ defined(AO_HAVE_short_fetch_and_add_release) # define AO_short_fetch_and_add_release_write(addr, val) \ AO_short_fetch_and_add_release(addr, val) # define AO_HAVE_short_fetch_and_add_release_write #endif #if !defined(AO_HAVE_short_fetch_and_add_acquire_read) && \ defined(AO_HAVE_short_fetch_and_add_read) # define AO_short_fetch_and_add_acquire_read(addr, val) \ AO_short_fetch_and_add_read(addr, val) # define AO_HAVE_short_fetch_and_add_acquire_read #endif #if !defined(AO_HAVE_short_fetch_and_add_acquire_read) && \ defined(AO_HAVE_short_fetch_and_add_acquire) # define AO_short_fetch_and_add_acquire_read(addr, val) \ AO_short_fetch_and_add_acquire(addr, val) # define AO_HAVE_short_fetch_and_add_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_short_fetch_and_add_acquire_read) # define AO_short_fetch_and_add_dd_acquire_read(addr, val) \ AO_short_fetch_and_add_acquire_read(addr, val) # define AO_HAVE_short_fetch_and_add_dd_acquire_read # endif #else # if defined(AO_HAVE_short_fetch_and_add) # define AO_short_fetch_and_add_dd_acquire_read(addr, val) \ AO_short_fetch_and_add(addr, val) # define AO_HAVE_short_fetch_and_add_dd_acquire_read # endif #endif /* short_fetch_and_add1 */ #if defined(AO_HAVE_short_fetch_and_add_full) &&\ !defined(AO_HAVE_short_fetch_and_add1_full) # define AO_short_fetch_and_add1_full(addr) \ AO_short_fetch_and_add_full(addr,1) # define AO_HAVE_short_fetch_and_add1_full #endif #if defined(AO_HAVE_short_fetch_and_add_release) &&\ !defined(AO_HAVE_short_fetch_and_add1_release) # define AO_short_fetch_and_add1_release(addr) \ AO_short_fetch_and_add_release(addr,1) # define AO_HAVE_short_fetch_and_add1_release #endif #if defined(AO_HAVE_short_fetch_and_add_acquire) &&\ !defined(AO_HAVE_short_fetch_and_add1_acquire) # define AO_short_fetch_and_add1_acquire(addr) \ AO_short_fetch_and_add_acquire(addr,1) # define AO_HAVE_short_fetch_and_add1_acquire #endif #if defined(AO_HAVE_short_fetch_and_add_write) &&\ !defined(AO_HAVE_short_fetch_and_add1_write) # define AO_short_fetch_and_add1_write(addr) \ AO_short_fetch_and_add_write(addr,1) # define AO_HAVE_short_fetch_and_add1_write #endif #if defined(AO_HAVE_short_fetch_and_add_read) &&\ !defined(AO_HAVE_short_fetch_and_add1_read) # define AO_short_fetch_and_add1_read(addr) \ AO_short_fetch_and_add_read(addr,1) # define AO_HAVE_short_fetch_and_add1_read #endif #if defined(AO_HAVE_short_fetch_and_add_release_write) &&\ !defined(AO_HAVE_short_fetch_and_add1_release_write) # define AO_short_fetch_and_add1_release_write(addr) \ AO_short_fetch_and_add_release_write(addr,1) # define AO_HAVE_short_fetch_and_add1_release_write #endif #if defined(AO_HAVE_short_fetch_and_add_acquire_read) &&\ !defined(AO_HAVE_short_fetch_and_add1_acquire_read) # define AO_short_fetch_and_add1_acquire_read(addr) \ AO_short_fetch_and_add_acquire_read(addr,1) # define AO_HAVE_short_fetch_and_add1_acquire_read #endif #if defined(AO_HAVE_short_fetch_and_add) &&\ !defined(AO_HAVE_short_fetch_and_add1) # define AO_short_fetch_and_add1(addr) \ AO_short_fetch_and_add(addr,1) # define AO_HAVE_short_fetch_and_add1 #endif #if defined(AO_HAVE_short_fetch_and_add1_full) # if !defined(AO_HAVE_short_fetch_and_add1_release) # define AO_short_fetch_and_add1_release(addr) \ AO_short_fetch_and_add1_full(addr) # define AO_HAVE_short_fetch_and_add1_release # endif # if !defined(AO_HAVE_short_fetch_and_add1_acquire) # define AO_short_fetch_and_add1_acquire(addr) \ AO_short_fetch_and_add1_full(addr) # define AO_HAVE_short_fetch_and_add1_acquire # endif # if !defined(AO_HAVE_short_fetch_and_add1_write) # define AO_short_fetch_and_add1_write(addr) \ AO_short_fetch_and_add1_full(addr) # define AO_HAVE_short_fetch_and_add1_write # endif # if !defined(AO_HAVE_short_fetch_and_add1_read) # define AO_short_fetch_and_add1_read(addr) \ AO_short_fetch_and_add1_full(addr) # define AO_HAVE_short_fetch_and_add1_read # endif #endif /* AO_HAVE_short_fetch_and_add1_full */ #if !defined(AO_HAVE_short_fetch_and_add1) && \ defined(AO_HAVE_short_fetch_and_add1_release) # define AO_short_fetch_and_add1(addr) \ AO_short_fetch_and_add1_release(addr) # define AO_HAVE_short_fetch_and_add1 #endif #if !defined(AO_HAVE_short_fetch_and_add1) && \ defined(AO_HAVE_short_fetch_and_add1_acquire) # define AO_short_fetch_and_add1(addr) \ AO_short_fetch_and_add1_acquire(addr) # define AO_HAVE_short_fetch_and_add1 #endif #if !defined(AO_HAVE_short_fetch_and_add1) && \ defined(AO_HAVE_short_fetch_and_add1_write) # define AO_short_fetch_and_add1(addr) \ AO_short_fetch_and_add1_write(addr) # define AO_HAVE_short_fetch_and_add1 #endif #if !defined(AO_HAVE_short_fetch_and_add1) && \ defined(AO_HAVE_short_fetch_and_add1_read) # define AO_short_fetch_and_add1(addr) \ AO_short_fetch_and_add1_read(addr) # define AO_HAVE_short_fetch_and_add1 #endif #if defined(AO_HAVE_short_fetch_and_add1_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_short_fetch_and_add1_full) # define AO_short_fetch_and_add1_full(addr) \ (AO_nop_full(), AO_short_fetch_and_add1_acquire(addr)) # define AO_HAVE_short_fetch_and_add1_full #endif #if !defined(AO_HAVE_short_fetch_and_add1_release_write) && \ defined(AO_HAVE_short_fetch_and_add1_write) # define AO_short_fetch_and_add1_release_write(addr) \ AO_short_fetch_and_add1_write(addr) # define AO_HAVE_short_fetch_and_add1_release_write #endif #if !defined(AO_HAVE_short_fetch_and_add1_release_write) && \ defined(AO_HAVE_short_fetch_and_add1_release) # define AO_short_fetch_and_add1_release_write(addr) \ AO_short_fetch_and_add1_release(addr) # define AO_HAVE_short_fetch_and_add1_release_write #endif #if !defined(AO_HAVE_short_fetch_and_add1_acquire_read) && \ defined(AO_HAVE_short_fetch_and_add1_read) # define AO_short_fetch_and_add1_acquire_read(addr) \ AO_short_fetch_and_add1_read(addr) # define AO_HAVE_short_fetch_and_add1_acquire_read #endif #if !defined(AO_HAVE_short_fetch_and_add1_acquire_read) && \ defined(AO_HAVE_short_fetch_and_add1_acquire) # define AO_short_fetch_and_add1_acquire_read(addr) \ AO_short_fetch_and_add1_acquire(addr) # define AO_HAVE_short_fetch_and_add1_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_short_fetch_and_add1_acquire_read) # define AO_short_fetch_and_add1_dd_acquire_read(addr) \ AO_short_fetch_and_add1_acquire_read(addr) # define AO_HAVE_short_fetch_and_add1_dd_acquire_read # endif #else # if defined(AO_HAVE_short_fetch_and_add1) # define AO_short_fetch_and_add1_dd_acquire_read(addr) \ AO_short_fetch_and_add1(addr) # define AO_HAVE_short_fetch_and_add1_dd_acquire_read # endif #endif /* short_fetch_and_sub1 */ #if defined(AO_HAVE_short_fetch_and_add_full) &&\ !defined(AO_HAVE_short_fetch_and_sub1_full) # define AO_short_fetch_and_sub1_full(addr) \ AO_short_fetch_and_add_full(addr,(unsigned short)(-1)) # define AO_HAVE_short_fetch_and_sub1_full #endif #if defined(AO_HAVE_short_fetch_and_add_release) &&\ !defined(AO_HAVE_short_fetch_and_sub1_release) # define AO_short_fetch_and_sub1_release(addr) \ AO_short_fetch_and_add_release(addr,(unsigned short)(-1)) # define AO_HAVE_short_fetch_and_sub1_release #endif #if defined(AO_HAVE_short_fetch_and_add_acquire) &&\ !defined(AO_HAVE_short_fetch_and_sub1_acquire) # define AO_short_fetch_and_sub1_acquire(addr) \ AO_short_fetch_and_add_acquire(addr,(unsigned short)(-1)) # define AO_HAVE_short_fetch_and_sub1_acquire #endif #if defined(AO_HAVE_short_fetch_and_add_write) &&\ !defined(AO_HAVE_short_fetch_and_sub1_write) # define AO_short_fetch_and_sub1_write(addr) \ AO_short_fetch_and_add_write(addr,(unsigned short)(-1)) # define AO_HAVE_short_fetch_and_sub1_write #endif #if defined(AO_HAVE_short_fetch_and_add_read) &&\ !defined(AO_HAVE_short_fetch_and_sub1_read) # define AO_short_fetch_and_sub1_read(addr) \ AO_short_fetch_and_add_read(addr,(unsigned short)(-1)) # define AO_HAVE_short_fetch_and_sub1_read #endif #if defined(AO_HAVE_short_fetch_and_add_release_write) &&\ !defined(AO_HAVE_short_fetch_and_sub1_release_write) # define AO_short_fetch_and_sub1_release_write(addr) \ AO_short_fetch_and_add_release_write(addr,(unsigned short)(-1)) # define AO_HAVE_short_fetch_and_sub1_release_write #endif #if defined(AO_HAVE_short_fetch_and_add_acquire_read) &&\ !defined(AO_HAVE_short_fetch_and_sub1_acquire_read) # define AO_short_fetch_and_sub1_acquire_read(addr) \ AO_short_fetch_and_add_acquire_read(addr,(unsigned short)(-1)) # define AO_HAVE_short_fetch_and_sub1_acquire_read #endif #if defined(AO_HAVE_short_fetch_and_add) &&\ !defined(AO_HAVE_short_fetch_and_sub1) # define AO_short_fetch_and_sub1(addr) \ AO_short_fetch_and_add(addr,(unsigned short)(-1)) # define AO_HAVE_short_fetch_and_sub1 #endif #if defined(AO_HAVE_short_fetch_and_sub1_full) # if !defined(AO_HAVE_short_fetch_and_sub1_release) # define AO_short_fetch_and_sub1_release(addr) \ AO_short_fetch_and_sub1_full(addr) # define AO_HAVE_short_fetch_and_sub1_release # endif # if !defined(AO_HAVE_short_fetch_and_sub1_acquire) # define AO_short_fetch_and_sub1_acquire(addr) \ AO_short_fetch_and_sub1_full(addr) # define AO_HAVE_short_fetch_and_sub1_acquire # endif # if !defined(AO_HAVE_short_fetch_and_sub1_write) # define AO_short_fetch_and_sub1_write(addr) \ AO_short_fetch_and_sub1_full(addr) # define AO_HAVE_short_fetch_and_sub1_write # endif # if !defined(AO_HAVE_short_fetch_and_sub1_read) # define AO_short_fetch_and_sub1_read(addr) \ AO_short_fetch_and_sub1_full(addr) # define AO_HAVE_short_fetch_and_sub1_read # endif #endif /* AO_HAVE_short_fetch_and_sub1_full */ #if !defined(AO_HAVE_short_fetch_and_sub1) && \ defined(AO_HAVE_short_fetch_and_sub1_release) # define AO_short_fetch_and_sub1(addr) \ AO_short_fetch_and_sub1_release(addr) # define AO_HAVE_short_fetch_and_sub1 #endif #if !defined(AO_HAVE_short_fetch_and_sub1) && \ defined(AO_HAVE_short_fetch_and_sub1_acquire) # define AO_short_fetch_and_sub1(addr) \ AO_short_fetch_and_sub1_acquire(addr) # define AO_HAVE_short_fetch_and_sub1 #endif #if !defined(AO_HAVE_short_fetch_and_sub1) && \ defined(AO_HAVE_short_fetch_and_sub1_write) # define AO_short_fetch_and_sub1(addr) \ AO_short_fetch_and_sub1_write(addr) # define AO_HAVE_short_fetch_and_sub1 #endif #if !defined(AO_HAVE_short_fetch_and_sub1) && \ defined(AO_HAVE_short_fetch_and_sub1_read) # define AO_short_fetch_and_sub1(addr) \ AO_short_fetch_and_sub1_read(addr) # define AO_HAVE_short_fetch_and_sub1 #endif #if defined(AO_HAVE_short_fetch_and_sub1_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_short_fetch_and_sub1_full) # define AO_short_fetch_and_sub1_full(addr) \ (AO_nop_full(), AO_short_fetch_and_sub1_acquire(addr)) # define AO_HAVE_short_fetch_and_sub1_full #endif #if !defined(AO_HAVE_short_fetch_and_sub1_release_write) && \ defined(AO_HAVE_short_fetch_and_sub1_write) # define AO_short_fetch_and_sub1_release_write(addr) \ AO_short_fetch_and_sub1_write(addr) # define AO_HAVE_short_fetch_and_sub1_release_write #endif #if !defined(AO_HAVE_short_fetch_and_sub1_release_write) && \ defined(AO_HAVE_short_fetch_and_sub1_release) # define AO_short_fetch_and_sub1_release_write(addr) \ AO_short_fetch_and_sub1_release(addr) # define AO_HAVE_short_fetch_and_sub1_release_write #endif #if !defined(AO_HAVE_short_fetch_and_sub1_acquire_read) && \ defined(AO_HAVE_short_fetch_and_sub1_read) # define AO_short_fetch_and_sub1_acquire_read(addr) \ AO_short_fetch_and_sub1_read(addr) # define AO_HAVE_short_fetch_and_sub1_acquire_read #endif #if !defined(AO_HAVE_short_fetch_and_sub1_acquire_read) && \ defined(AO_HAVE_short_fetch_and_sub1_acquire) # define AO_short_fetch_and_sub1_acquire_read(addr) \ AO_short_fetch_and_sub1_acquire(addr) # define AO_HAVE_short_fetch_and_sub1_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_short_fetch_and_sub1_acquire_read) # define AO_short_fetch_and_sub1_dd_acquire_read(addr) \ AO_short_fetch_and_sub1_acquire_read(addr) # define AO_HAVE_short_fetch_and_sub1_dd_acquire_read # endif #else # if defined(AO_HAVE_short_fetch_and_sub1) # define AO_short_fetch_and_sub1_dd_acquire_read(addr) \ AO_short_fetch_and_sub1(addr) # define AO_HAVE_short_fetch_and_sub1_dd_acquire_read # endif #endif /* int_load */ #if defined(AO_HAVE_int_load_acquire) && !defined(AO_HAVE_int_load) # define AO_int_load(addr) AO_int_load_acquire(addr) # define AO_HAVE_int_load #endif #if defined(AO_HAVE_int_load_full) && !defined(AO_HAVE_int_load_acquire) # define AO_int_load_acquire(addr) AO_int_load_full(addr) # define AO_HAVE_int_load_acquire #endif #if defined(AO_HAVE_int_load_full) && !defined(AO_HAVE_int_load_read) # define AO_int_load_read(addr) AO_int_load_full(addr) # define AO_HAVE_int_load_read #endif #if !defined(AO_HAVE_int_load_acquire_read) && defined(AO_HAVE_int_load_acquire) # define AO_int_load_acquire_read(addr) AO_int_load_acquire(addr) # define AO_HAVE_int_load_acquire_read #endif #if defined(AO_HAVE_int_load) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_int_load_acquire) AO_INLINE unsigned int AO_int_load_acquire(volatile unsigned int *addr) { unsigned int result = AO_int_load(addr); /* Acquire barrier would be useless, since the load could be delayed */ /* beyond it. */ AO_nop_full(); return result; } # define AO_HAVE_int_load_acquire #endif #if defined(AO_HAVE_int_load) && defined(AO_HAVE_nop_read) && \ !defined(AO_HAVE_int_load_read) AO_INLINE unsigned int AO_int_load_read(volatile unsigned int *addr) { unsigned int result = AO_int_load(addr); /* Acquire barrier would be useless, since the load could be delayed */ /* beyond it. */ AO_nop_read(); return result; } # define AO_HAVE_int_load_read #endif #if defined(AO_HAVE_int_load_acquire) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_int_load_full) # define AO_int_load_full(addr) (AO_nop_full(), AO_int_load_acquire(addr)) # define AO_HAVE_int_load_full #endif #if !defined(AO_HAVE_int_load_acquire_read) && defined(AO_HAVE_int_load_read) # define AO_int_load_acquire_read(addr) AO_int_load_read(addr) # define AO_HAVE_int_load_acquire_read #endif #if defined(AO_HAVE_int_load_acquire_read) && !defined(AO_HAVE_int_load) # define AO_int_load(addr) AO_int_load_acquire_read(addr) # define AO_HAVE_int_load #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_int_load_acquire_read) # define AO_int_load_dd_acquire_read(addr) \ AO_int_load_acquire_read(addr) # define AO_HAVE_int_load_dd_acquire_read # endif #else # if defined(AO_HAVE_int_load) # define AO_int_load_dd_acquire_read(addr) \ AO_int_load(addr) # define AO_HAVE_int_load_dd_acquire_read # endif #endif /* int_store */ #if defined(AO_HAVE_int_store_release) && !defined(AO_HAVE_int_store) # define AO_int_store(addr, val) AO_int_store_release(addr,val) # define AO_HAVE_int_store #endif #if defined(AO_HAVE_int_store_full) && !defined(AO_HAVE_int_store_release) # define AO_int_store_release(addr,val) AO_int_store_full(addr,val) # define AO_HAVE_int_store_release #endif #if defined(AO_HAVE_int_store_full) && !defined(AO_HAVE_int_store_write) # define AO_int_store_write(addr,val) AO_int_store_full(addr,val) # define AO_HAVE_int_store_write #endif #if defined(AO_HAVE_int_store_release) && \ !defined(AO_HAVE_int_store_release_write) # define AO_int_store_release_write(addr, val) \ AO_int_store_release(addr,val) # define AO_HAVE_int_store_release_write #endif #if defined(AO_HAVE_int_store_write) && !defined(AO_HAVE_int_store) # define AO_int_store(addr, val) AO_int_store_write(addr,val) # define AO_HAVE_int_store #endif #if defined(AO_HAVE_int_store) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_int_store_release) # define AO_int_store_release(addr,val) \ (AO_nop_full(), AO_int_store(addr,val)) # define AO_HAVE_int_store_release #endif #if defined(AO_HAVE_nop_write) && defined(AO_HAVE_int_store) && \ !defined(AO_HAVE_int_store_write) # define AO_int_store_write(addr, val) \ (AO_nop_write(), AO_int_store(addr,val)) # define AO_HAVE_int_store_write #endif #if defined(AO_HAVE_int_store_write) && \ !defined(AO_HAVE_int_store_release_write) # define AO_int_store_release_write(addr, val) AO_int_store_write(addr,val) # define AO_HAVE_int_store_release_write #endif #if defined(AO_HAVE_int_store_release) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_int_store_full) # define AO_int_store_full(addr, val) \ (AO_int_store_release(addr, val), AO_nop_full()) # define AO_HAVE_int_store_full #endif /* int_fetch_and_add */ #if defined(AO_HAVE_int_compare_and_swap_full) && \ !defined(AO_HAVE_int_fetch_and_add_full) AO_INLINE AO_t AO_int_fetch_and_add_full(volatile unsigned int *addr, unsigned int incr) { unsigned int old; do { old = *addr; } while (!AO_int_compare_and_swap_full(addr, old, old+incr)); return old; } # define AO_HAVE_int_fetch_and_add_full #endif #if defined(AO_HAVE_int_compare_and_swap_acquire) && \ !defined(AO_HAVE_int_fetch_and_add_acquire) AO_INLINE AO_t AO_int_fetch_and_add_acquire(volatile unsigned int *addr, unsigned int incr) { unsigned int old; do { old = *addr; } while (!AO_int_compare_and_swap_acquire(addr, old, old+incr)); return old; } # define AO_HAVE_int_fetch_and_add_acquire #endif #if defined(AO_HAVE_int_compare_and_swap_release) && \ !defined(AO_HAVE_int_fetch_and_add_release) AO_INLINE AO_t AO_int_fetch_and_add_release(volatile unsigned int *addr, unsigned int incr) { unsigned int old; do { old = *addr; } while (!AO_int_compare_and_swap_release(addr, old, old+incr)); return old; } # define AO_HAVE_int_fetch_and_add_release #endif #if defined(AO_HAVE_int_fetch_and_add_full) # if !defined(AO_HAVE_int_fetch_and_add_release) # define AO_int_fetch_and_add_release(addr, val) \ AO_int_fetch_and_add_full(addr, val) # define AO_HAVE_int_fetch_and_add_release # endif # if !defined(AO_HAVE_int_fetch_and_add_acquire) # define AO_int_fetch_and_add_acquire(addr, val) \ AO_int_fetch_and_add_full(addr, val) # define AO_HAVE_int_fetch_and_add_acquire # endif # if !defined(AO_HAVE_int_fetch_and_add_write) # define AO_int_fetch_and_add_write(addr, val) \ AO_int_fetch_and_add_full(addr, val) # define AO_HAVE_int_fetch_and_add_write # endif # if !defined(AO_HAVE_int_fetch_and_add_read) # define AO_int_fetch_and_add_read(addr, val) \ AO_int_fetch_and_add_full(addr, val) # define AO_HAVE_int_fetch_and_add_read # endif #endif /* AO_HAVE_int_fetch_and_add_full */ #if !defined(AO_HAVE_int_fetch_and_add) && \ defined(AO_HAVE_int_fetch_and_add_release) # define AO_int_fetch_and_add(addr, val) \ AO_int_fetch_and_add_release(addr, val) # define AO_HAVE_int_fetch_and_add #endif #if !defined(AO_HAVE_int_fetch_and_add) && \ defined(AO_HAVE_int_fetch_and_add_acquire) # define AO_int_fetch_and_add(addr, val) \ AO_int_fetch_and_add_acquire(addr, val) # define AO_HAVE_int_fetch_and_add #endif #if !defined(AO_HAVE_int_fetch_and_add) && \ defined(AO_HAVE_int_fetch_and_add_write) # define AO_int_fetch_and_add(addr, val) \ AO_int_fetch_and_add_write(addr, val) # define AO_HAVE_int_fetch_and_add #endif #if !defined(AO_HAVE_int_fetch_and_add) && \ defined(AO_HAVE_int_fetch_and_add_read) # define AO_int_fetch_and_add(addr, val) \ AO_int_fetch_and_add_read(addr, val) # define AO_HAVE_int_fetch_and_add #endif #if defined(AO_HAVE_int_fetch_and_add_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_int_fetch_and_add_full) # define AO_int_fetch_and_add_full(addr, val) \ (AO_nop_full(), AO_int_fetch_and_add_acquire(addr, val)) #endif #if !defined(AO_HAVE_int_fetch_and_add_release_write) && \ defined(AO_HAVE_int_fetch_and_add_write) # define AO_int_fetch_and_add_release_write(addr, val) \ AO_int_fetch_and_add_write(addr, val) # define AO_HAVE_int_fetch_and_add_release_write #endif #if !defined(AO_HAVE_int_fetch_and_add_release_write) && \ defined(AO_HAVE_int_fetch_and_add_release) # define AO_int_fetch_and_add_release_write(addr, val) \ AO_int_fetch_and_add_release(addr, val) # define AO_HAVE_int_fetch_and_add_release_write #endif #if !defined(AO_HAVE_int_fetch_and_add_acquire_read) && \ defined(AO_HAVE_int_fetch_and_add_read) # define AO_int_fetch_and_add_acquire_read(addr, val) \ AO_int_fetch_and_add_read(addr, val) # define AO_HAVE_int_fetch_and_add_acquire_read #endif #if !defined(AO_HAVE_int_fetch_and_add_acquire_read) && \ defined(AO_HAVE_int_fetch_and_add_acquire) # define AO_int_fetch_and_add_acquire_read(addr, val) \ AO_int_fetch_and_add_acquire(addr, val) # define AO_HAVE_int_fetch_and_add_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_int_fetch_and_add_acquire_read) # define AO_int_fetch_and_add_dd_acquire_read(addr, val) \ AO_int_fetch_and_add_acquire_read(addr, val) # define AO_HAVE_int_fetch_and_add_dd_acquire_read # endif #else # if defined(AO_HAVE_int_fetch_and_add) # define AO_int_fetch_and_add_dd_acquire_read(addr, val) \ AO_int_fetch_and_add(addr, val) # define AO_HAVE_int_fetch_and_add_dd_acquire_read # endif #endif /* int_fetch_and_add1 */ #if defined(AO_HAVE_int_fetch_and_add_full) &&\ !defined(AO_HAVE_int_fetch_and_add1_full) # define AO_int_fetch_and_add1_full(addr) \ AO_int_fetch_and_add_full(addr,1) # define AO_HAVE_int_fetch_and_add1_full #endif #if defined(AO_HAVE_int_fetch_and_add_release) &&\ !defined(AO_HAVE_int_fetch_and_add1_release) # define AO_int_fetch_and_add1_release(addr) \ AO_int_fetch_and_add_release(addr,1) # define AO_HAVE_int_fetch_and_add1_release #endif #if defined(AO_HAVE_int_fetch_and_add_acquire) &&\ !defined(AO_HAVE_int_fetch_and_add1_acquire) # define AO_int_fetch_and_add1_acquire(addr) \ AO_int_fetch_and_add_acquire(addr,1) # define AO_HAVE_int_fetch_and_add1_acquire #endif #if defined(AO_HAVE_int_fetch_and_add_write) &&\ !defined(AO_HAVE_int_fetch_and_add1_write) # define AO_int_fetch_and_add1_write(addr) \ AO_int_fetch_and_add_write(addr,1) # define AO_HAVE_int_fetch_and_add1_write #endif #if defined(AO_HAVE_int_fetch_and_add_read) &&\ !defined(AO_HAVE_int_fetch_and_add1_read) # define AO_int_fetch_and_add1_read(addr) \ AO_int_fetch_and_add_read(addr,1) # define AO_HAVE_int_fetch_and_add1_read #endif #if defined(AO_HAVE_int_fetch_and_add_release_write) &&\ !defined(AO_HAVE_int_fetch_and_add1_release_write) # define AO_int_fetch_and_add1_release_write(addr) \ AO_int_fetch_and_add_release_write(addr,1) # define AO_HAVE_int_fetch_and_add1_release_write #endif #if defined(AO_HAVE_int_fetch_and_add_acquire_read) &&\ !defined(AO_HAVE_int_fetch_and_add1_acquire_read) # define AO_int_fetch_and_add1_acquire_read(addr) \ AO_int_fetch_and_add_acquire_read(addr,1) # define AO_HAVE_int_fetch_and_add1_acquire_read #endif #if defined(AO_HAVE_int_fetch_and_add) &&\ !defined(AO_HAVE_int_fetch_and_add1) # define AO_int_fetch_and_add1(addr) \ AO_int_fetch_and_add(addr,1) # define AO_HAVE_int_fetch_and_add1 #endif #if defined(AO_HAVE_int_fetch_and_add1_full) # if !defined(AO_HAVE_int_fetch_and_add1_release) # define AO_int_fetch_and_add1_release(addr) \ AO_int_fetch_and_add1_full(addr) # define AO_HAVE_int_fetch_and_add1_release # endif # if !defined(AO_HAVE_int_fetch_and_add1_acquire) # define AO_int_fetch_and_add1_acquire(addr) \ AO_int_fetch_and_add1_full(addr) # define AO_HAVE_int_fetch_and_add1_acquire # endif # if !defined(AO_HAVE_int_fetch_and_add1_write) # define AO_int_fetch_and_add1_write(addr) \ AO_int_fetch_and_add1_full(addr) # define AO_HAVE_int_fetch_and_add1_write # endif # if !defined(AO_HAVE_int_fetch_and_add1_read) # define AO_int_fetch_and_add1_read(addr) \ AO_int_fetch_and_add1_full(addr) # define AO_HAVE_int_fetch_and_add1_read # endif #endif /* AO_HAVE_int_fetch_and_add1_full */ #if !defined(AO_HAVE_int_fetch_and_add1) && \ defined(AO_HAVE_int_fetch_and_add1_release) # define AO_int_fetch_and_add1(addr) \ AO_int_fetch_and_add1_release(addr) # define AO_HAVE_int_fetch_and_add1 #endif #if !defined(AO_HAVE_int_fetch_and_add1) && \ defined(AO_HAVE_int_fetch_and_add1_acquire) # define AO_int_fetch_and_add1(addr) \ AO_int_fetch_and_add1_acquire(addr) # define AO_HAVE_int_fetch_and_add1 #endif #if !defined(AO_HAVE_int_fetch_and_add1) && \ defined(AO_HAVE_int_fetch_and_add1_write) # define AO_int_fetch_and_add1(addr) \ AO_int_fetch_and_add1_write(addr) # define AO_HAVE_int_fetch_and_add1 #endif #if !defined(AO_HAVE_int_fetch_and_add1) && \ defined(AO_HAVE_int_fetch_and_add1_read) # define AO_int_fetch_and_add1(addr) \ AO_int_fetch_and_add1_read(addr) # define AO_HAVE_int_fetch_and_add1 #endif #if defined(AO_HAVE_int_fetch_and_add1_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_int_fetch_and_add1_full) # define AO_int_fetch_and_add1_full(addr) \ (AO_nop_full(), AO_int_fetch_and_add1_acquire(addr)) # define AO_HAVE_int_fetch_and_add1_full #endif #if !defined(AO_HAVE_int_fetch_and_add1_release_write) && \ defined(AO_HAVE_int_fetch_and_add1_write) # define AO_int_fetch_and_add1_release_write(addr) \ AO_int_fetch_and_add1_write(addr) # define AO_HAVE_int_fetch_and_add1_release_write #endif #if !defined(AO_HAVE_int_fetch_and_add1_release_write) && \ defined(AO_HAVE_int_fetch_and_add1_release) # define AO_int_fetch_and_add1_release_write(addr) \ AO_int_fetch_and_add1_release(addr) # define AO_HAVE_int_fetch_and_add1_release_write #endif #if !defined(AO_HAVE_int_fetch_and_add1_acquire_read) && \ defined(AO_HAVE_int_fetch_and_add1_read) # define AO_int_fetch_and_add1_acquire_read(addr) \ AO_int_fetch_and_add1_read(addr) # define AO_HAVE_int_fetch_and_add1_acquire_read #endif #if !defined(AO_HAVE_int_fetch_and_add1_acquire_read) && \ defined(AO_HAVE_int_fetch_and_add1_acquire) # define AO_int_fetch_and_add1_acquire_read(addr) \ AO_int_fetch_and_add1_acquire(addr) # define AO_HAVE_int_fetch_and_add1_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_int_fetch_and_add1_acquire_read) # define AO_int_fetch_and_add1_dd_acquire_read(addr) \ AO_int_fetch_and_add1_acquire_read(addr) # define AO_HAVE_int_fetch_and_add1_dd_acquire_read # endif #else # if defined(AO_HAVE_int_fetch_and_add1) # define AO_int_fetch_and_add1_dd_acquire_read(addr) \ AO_int_fetch_and_add1(addr) # define AO_HAVE_int_fetch_and_add1_dd_acquire_read # endif #endif /* int_fetch_and_sub1 */ #if defined(AO_HAVE_int_fetch_and_add_full) &&\ !defined(AO_HAVE_int_fetch_and_sub1_full) # define AO_int_fetch_and_sub1_full(addr) \ AO_int_fetch_and_add_full(addr,(unsigned int)(-1)) # define AO_HAVE_int_fetch_and_sub1_full #endif #if defined(AO_HAVE_int_fetch_and_add_release) &&\ !defined(AO_HAVE_int_fetch_and_sub1_release) # define AO_int_fetch_and_sub1_release(addr) \ AO_int_fetch_and_add_release(addr,(unsigned int)(-1)) # define AO_HAVE_int_fetch_and_sub1_release #endif #if defined(AO_HAVE_int_fetch_and_add_acquire) &&\ !defined(AO_HAVE_int_fetch_and_sub1_acquire) # define AO_int_fetch_and_sub1_acquire(addr) \ AO_int_fetch_and_add_acquire(addr,(unsigned int)(-1)) # define AO_HAVE_int_fetch_and_sub1_acquire #endif #if defined(AO_HAVE_int_fetch_and_add_write) &&\ !defined(AO_HAVE_int_fetch_and_sub1_write) # define AO_int_fetch_and_sub1_write(addr) \ AO_int_fetch_and_add_write(addr,(unsigned int)(-1)) # define AO_HAVE_int_fetch_and_sub1_write #endif #if defined(AO_HAVE_int_fetch_and_add_read) &&\ !defined(AO_HAVE_int_fetch_and_sub1_read) # define AO_int_fetch_and_sub1_read(addr) \ AO_int_fetch_and_add_read(addr,(unsigned int)(-1)) # define AO_HAVE_int_fetch_and_sub1_read #endif #if defined(AO_HAVE_int_fetch_and_add_release_write) &&\ !defined(AO_HAVE_int_fetch_and_sub1_release_write) # define AO_int_fetch_and_sub1_release_write(addr) \ AO_int_fetch_and_add_release_write(addr,(unsigned int)(-1)) # define AO_HAVE_int_fetch_and_sub1_release_write #endif #if defined(AO_HAVE_int_fetch_and_add_acquire_read) &&\ !defined(AO_HAVE_int_fetch_and_sub1_acquire_read) # define AO_int_fetch_and_sub1_acquire_read(addr) \ AO_int_fetch_and_add_acquire_read(addr,(unsigned int)(-1)) # define AO_HAVE_int_fetch_and_sub1_acquire_read #endif #if defined(AO_HAVE_int_fetch_and_add) &&\ !defined(AO_HAVE_int_fetch_and_sub1) # define AO_int_fetch_and_sub1(addr) \ AO_int_fetch_and_add(addr,(unsigned int)(-1)) # define AO_HAVE_int_fetch_and_sub1 #endif #if defined(AO_HAVE_int_fetch_and_sub1_full) # if !defined(AO_HAVE_int_fetch_and_sub1_release) # define AO_int_fetch_and_sub1_release(addr) \ AO_int_fetch_and_sub1_full(addr) # define AO_HAVE_int_fetch_and_sub1_release # endif # if !defined(AO_HAVE_int_fetch_and_sub1_acquire) # define AO_int_fetch_and_sub1_acquire(addr) \ AO_int_fetch_and_sub1_full(addr) # define AO_HAVE_int_fetch_and_sub1_acquire # endif # if !defined(AO_HAVE_int_fetch_and_sub1_write) # define AO_int_fetch_and_sub1_write(addr) \ AO_int_fetch_and_sub1_full(addr) # define AO_HAVE_int_fetch_and_sub1_write # endif # if !defined(AO_HAVE_int_fetch_and_sub1_read) # define AO_int_fetch_and_sub1_read(addr) \ AO_int_fetch_and_sub1_full(addr) # define AO_HAVE_int_fetch_and_sub1_read # endif #endif /* AO_HAVE_int_fetch_and_sub1_full */ #if !defined(AO_HAVE_int_fetch_and_sub1) && \ defined(AO_HAVE_int_fetch_and_sub1_release) # define AO_int_fetch_and_sub1(addr) \ AO_int_fetch_and_sub1_release(addr) # define AO_HAVE_int_fetch_and_sub1 #endif #if !defined(AO_HAVE_int_fetch_and_sub1) && \ defined(AO_HAVE_int_fetch_and_sub1_acquire) # define AO_int_fetch_and_sub1(addr) \ AO_int_fetch_and_sub1_acquire(addr) # define AO_HAVE_int_fetch_and_sub1 #endif #if !defined(AO_HAVE_int_fetch_and_sub1) && \ defined(AO_HAVE_int_fetch_and_sub1_write) # define AO_int_fetch_and_sub1(addr) \ AO_int_fetch_and_sub1_write(addr) # define AO_HAVE_int_fetch_and_sub1 #endif #if !defined(AO_HAVE_int_fetch_and_sub1) && \ defined(AO_HAVE_int_fetch_and_sub1_read) # define AO_int_fetch_and_sub1(addr) \ AO_int_fetch_and_sub1_read(addr) # define AO_HAVE_int_fetch_and_sub1 #endif #if defined(AO_HAVE_int_fetch_and_sub1_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_int_fetch_and_sub1_full) # define AO_int_fetch_and_sub1_full(addr) \ (AO_nop_full(), AO_int_fetch_and_sub1_acquire(addr)) # define AO_HAVE_int_fetch_and_sub1_full #endif #if !defined(AO_HAVE_int_fetch_and_sub1_release_write) && \ defined(AO_HAVE_int_fetch_and_sub1_write) # define AO_int_fetch_and_sub1_release_write(addr) \ AO_int_fetch_and_sub1_write(addr) # define AO_HAVE_int_fetch_and_sub1_release_write #endif #if !defined(AO_HAVE_int_fetch_and_sub1_release_write) && \ defined(AO_HAVE_int_fetch_and_sub1_release) # define AO_int_fetch_and_sub1_release_write(addr) \ AO_int_fetch_and_sub1_release(addr) # define AO_HAVE_int_fetch_and_sub1_release_write #endif #if !defined(AO_HAVE_int_fetch_and_sub1_acquire_read) && \ defined(AO_HAVE_int_fetch_and_sub1_read) # define AO_int_fetch_and_sub1_acquire_read(addr) \ AO_int_fetch_and_sub1_read(addr) # define AO_HAVE_int_fetch_and_sub1_acquire_read #endif #if !defined(AO_HAVE_int_fetch_and_sub1_acquire_read) && \ defined(AO_HAVE_int_fetch_and_sub1_acquire) # define AO_int_fetch_and_sub1_acquire_read(addr) \ AO_int_fetch_and_sub1_acquire(addr) # define AO_HAVE_int_fetch_and_sub1_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_int_fetch_and_sub1_acquire_read) # define AO_int_fetch_and_sub1_dd_acquire_read(addr) \ AO_int_fetch_and_sub1_acquire_read(addr) # define AO_HAVE_int_fetch_and_sub1_dd_acquire_read # endif #else # if defined(AO_HAVE_int_fetch_and_sub1) # define AO_int_fetch_and_sub1_dd_acquire_read(addr) \ AO_int_fetch_and_sub1(addr) # define AO_HAVE_int_fetch_and_sub1_dd_acquire_read # endif #endif synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/0000775000076400007640000000000011172123233025123 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/int_aligned_atomic_load_store.h0000664000076400007640000000336411104702315033325 0ustar stefanstefan/* * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * Definitions for architecturs on which loads and stores of unsigned int are * atomic fo all legal alignments. */ AO_INLINE unsigned int AO_int_load(volatile unsigned int *addr) { assert(((size_t)addr & (sizeof(unsigned int) - 1)) == 0); /* Cast away the volatile for architectures like IA64 where */ /* volatile adds barrier semantics. */ return (*(unsigned int *)addr); } #define AO_HAVE_int_load AO_INLINE void AO_int_store(volatile unsigned int *addr, unsigned int new_val) { assert(((size_t)addr & (sizeof(unsigned int) - 1)) == 0); (*(unsigned int *)addr) = new_val; } #define AO_HAVE_int_store synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/short_atomic_load_store.h0000664000076400007640000000323311104702315032202 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * 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. */ /* * Definitions for architecturs on which loads and stores of unsigned short are * atomic for all legal alignments. */ AO_INLINE unsigned short AO_short_load(volatile unsigned short *addr) { /* Cast away the volatile for architectures like IA64 where */ /* volatile adds barrier semantics. */ return (*(unsigned short *)addr); } #define AO_HAVE_short_load AO_INLINE void AO_short_store(volatile unsigned short *addr, unsigned short new_val) { (*(unsigned short *)addr) = new_val; } #define AO_HAVE_short_store synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/sunc/0000775000076400007640000000000011172123233026073 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/sunc/sparc.S0000664000076400007640000000013311104702315027323 0ustar stefanstefan .seg "text" .globl AO_test_and_set_full AO_test_and_set_full: retl ldstub [%o0],%o0 synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/sunc/sparc.h0000664000076400007640000000311011104702315027346 0ustar stefanstefan/* * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. * * 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 "../all_atomic_load_store.h" /* Real SPARC code uses TSO: */ #include "../ordered_except_wr.h" /* Test_and_set location is just a byte. */ #include "../test_and_set_t_is_char.h" extern AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr); /* Implemented in separate .S file, for now. */ #define AO_HAVE_test_and_set_full /* FIXME: Like the gcc version, this needs to be extended for V8 */ /* and V9. */ synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/atomic_load_store.h0000664000076400007640000000306411104702315030765 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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. */ /* * Definitions for architecturs on which loads and stores of AO_t are * atomic fo all legal alignments. */ AO_INLINE AO_t AO_load(volatile AO_t *addr) { /* Cast away the volatile for architectures like IA64 where */ /* volatile adds barrier semantics. */ return (*(AO_t *)addr); } #define AO_HAVE_load AO_INLINE void AO_store(volatile AO_t *addr, AO_t new_val) { (*(AO_t *)addr) = new_val; } #define AO_HAVE_store synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/test_and_set_t_is_char.h0000664000076400007640000000306411104702315031765 0ustar stefanstefan/* * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * These are common definitions for architectures on which test_and_set * operates on byte sized quantities, the "clear" value contains * all zeroes, and the "set" value contains all ones. */ #define AO_TS_t unsigned char typedef enum {AO_BYTE_TS_clear = 0, AO_BYTE_TS_set = 0xff} AO_BYTE_TS_val; #define AO_TS_VAL_t AO_BYTE_TS_val #define AO_TS_CLEAR AO_BYTE_TS_clear #define AO_TS_SET AO_BYTE_TS_set #define AO_CHAR_TS_T 1 synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/int_atomic_load_store.h0000664000076400007640000000320511104702315031634 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * 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. */ /* * Definitions for architecturs on which loads and stores of unsigned int are * atomic for all legal alignments. */ AO_INLINE unsigned int AO_int_load(volatile unsigned int *addr) { /* Cast away the volatile for architectures like IA64 where */ /* volatile adds barrier semantics. */ return (*(unsigned int *)addr); } #define AO_HAVE_int_load AO_INLINE void AO_int_store(volatile unsigned int *addr, unsigned int new_val) { (*(unsigned int *)addr) = new_val; } #define AO_HAVE_int_store synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/README0000664000076400007640000000054111104702315026002 0ustar stefanstefanThere are two kinds of entities in this directory: - Subdirectories corresponding to specific compilers (or compiler/OS combinations). Each of these includes one or more architecture-specific headers. - More generic header files corresponding to a particular ordering and/or atomicity property that might be shared by multiple hardware platforms. synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/int_acquire_release_volatile.h0000664000076400007640000000367511104702315033210 0ustar stefanstefan/* * Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * This file adds definitions appropriate for environments in which an unsigned * int volatile load has acquire semantics, and an unsigned short volatile * store has release semantics. This is true with the standard Itanium ABI. */ #if !defined(AO_GCC_BARRIER) # if defined(__GNUC__) # define AO_GCC_BARRIER() AO_compiler_barrier() # else # define AO_GCC_BARRIER() # endif #endif AO_INLINE unsigned int AO_int_load_acquire(volatile unsigned int *p) { unsigned int result = *p; /* A normal volatile load generates an ld.acq */ AO_GCC_BARRIER(); return result; } #define AO_HAVE_int_load_acquire AO_INLINE void AO_int_store_release(volatile unsigned int *p, unsigned int val) { AO_GCC_BARRIER(); /* A normal volatile store generates an st.rel */ *p = val; } #define AO_HAVE_int_store_release synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/emul_cas.h0000664000076400007640000000576011104702315027073 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * 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. */ /* * Ensure, if at all possible, that AO_compare_and_swap_full() is * available. The emulation should be brute-force signal-safe, even * though it actually blocks. * Including this file will generate an error if AO_compare_and_swap_full() * cannot be made available. * This will be included from platform-specific atomic_ops files * id appropriate, and if AO_FORCE_CAS is defined. It should not be * included directly, especially since it affects the implementation * of other atomic update primitives. * The implementation assumes that only AO_store_XXX and AO_test_and_set_XXX * variants are defined, and that AO_test_and_set_XXX is not used to * operate on compare_and_swap locations. */ #if !defined(ATOMIC_OPS_H) # error This file should not be included directly. #endif #ifndef AO_HAVE_double_t # include "standard_ao_double_t.h" #endif int AO_compare_and_swap_emulation(volatile AO_t *addr, AO_t old, AO_t new_val); int AO_compare_double_and_swap_double_emulation(volatile AO_double_t *addr, AO_t old_val1, AO_t old_val2, AO_t new_val1, AO_t new_val2); void AO_store_full_emulation(volatile AO_t *addr, AO_t val); #define AO_compare_and_swap_full(addr, old, newval) \ AO_compare_and_swap_emulation(addr, old, newval) #define AO_HAVE_compare_and_swap_full #ifndef AO_HAVE_compare_double_and_swap_double # define AO_compare_double_and_swap_double_full(addr, old1, old2, \ newval1, newval2) \ AO_compare_double_and_swap_double_emulation(addr, old1, old2, \ newval1, newval2) # define AO_HAVE_compare_double_and_swap_double_full #endif #undef AO_store #undef AO_HAVE_store #undef AO_store_write #undef AO_HAVE_store_write #undef AO_store_release #undef AO_HAVE_store_release #undef AO_store_full #undef AO_HAVE_store_full #define AO_store_full(addr, val) AO_store_full_emulation(addr, val) #define AO_HAVE_store_full synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/ibmc/0000775000076400007640000000000011172123233026035 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/ibmc/powerpc.h0000664000076400007640000000647211104702315027675 0ustar stefanstefan/* FIXME. This is only a placeholder for the AIX compiler. */ /* It doesn't work. Please send a patch. */ /* Memory model documented at http://www-106.ibm.com/developerworks/ */ /* eserver/articles/archguide.html and (clearer) */ /* http://www-106.ibm.com/developerworks/eserver/articles/powerpc.html. */ /* There appears to be no implicit ordering between any kind of */ /* independent memory references. */ /* Architecture enforces some ordering based on control dependence. */ /* I don't know if that could help. */ /* Data-dependent loads are always ordered. */ /* Based on the above references, eieio is intended for use on */ /* uncached memory, which we don't support. It does not order loads */ /* from cached memory. */ /* Thanks to Maged Michael, Doug Lea, and Roger Hoover for helping to */ /* track some of this down and correcting my misunderstandings. -HB */ #include "../all_aligned_atomic_load_store.h" void AO_sync(void); #pragma mc_func AO_sync { "7c0004ac" } void AO_lwsync(void); #pragma mc_func AO_lwsync { "7c2004ac" } #define AO_nop_write() AO_lwsync() #define AO_HAVE_nop_write #define AO_nop_read() AO_lwsync() #define AO_HAVE_nop_read /* We explicitly specify load_acquire and store_release, since these */ /* rely on the fact that lwsync is also a LoadStore barrier. */ AO_INLINE AO_t AO_load_acquire(volatile AO_t *addr) { AO_t result = *addr; AO_lwsync(); return result; } #define AO_HAVE_load_acquire AO_INLINE void AO_store_release(volatile AO_t *addr, AO_t value) { AO_lwsync(); *addr = value; } #define AO_HAVE_load_acquire /* This is similar to the code in the garbage collector. Deleting */ /* this and having it synthesized from compare_and_swap would probably */ /* only cost us a load immediate instruction. */ AO_INLINE AO_TS_VAL_t AO_test_and_set(volatile AO_TS_t *addr) { # error Implement me } #define AO_have_test_and_set AO_INLINE AO_TS_VAL_t AO_test_and_set_acquire(volatile AO_TS_t *addr) { AO_TS_VAL_t result = AO_test_and_set(addr); AO_lwsync(); return result; } #define AO_HAVE_test_and_set_acquire AO_INLINE AO_TS_VAL_t AO_test_and_set_release(volatile AO_TS_t *addr) { AO_lwsync(); return AO_test_and_set(addr); } #define AO_HAVE_test_and_set_release AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { AO_TS_VAL_t result; AO_lwsync(); result = AO_test_and_set(addr); AO_lwsync(); return result; } #define AO_HAVE_test_and_set_full AO_INLINE AO_t AO_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val) { # error Implement me } #define AO_HAVE_compare_and_swap AO_INLINE AO_t AO_compare_and_swap_acquire(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t result = AO_compare_and_swap(addr, old, new_val); AO_lwsync(); return result; } #define AO_HAVE_compare_and_swap_acquire AO_INLINE AO_t AO_compare_and_swap_release(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_lwsync(); return AO_compare_and_swap(addr, old, new_val); } #define AO_HAVE_compare_and_swap_release AO_INLINE AO_t AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t result; AO_lwsync(); result = AO_compare_and_swap(addr, old, new_val); AO_lwsync(); return result; } #define AO_HAVE_compare_and_swap_full /* FIXME: We should also implement fetch_and_add and or primitives */ /* directly. */ synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/read_ordered.h0000664000076400007640000000535211104702315027717 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * 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. */ /* * These are common definitions for architectures that provide processor * ordered memory operations except that a later read may pass an * earlier write. Real x86 implementations seem to be in this category, * except apparently for some IDT WinChips, which we ignore. */ AO_INLINE void AO_nop_read() { AO_compiler_barrier(); } #define AO_HAVE_NOP_READ #ifdef AO_HAVE_load AO_INLINE AO_t AO_load_read(volatile AO_t *addr) { AO_t result = AO_load(addr); AO_compiler_barrier(); return result; } #define AO_HAVE_load_read #define AO_load_acquire(addr) AO_load_read(addr) #define AO_HAVE_load_acquire #endif /* AO_HAVE_load */ #ifdef AO_HAVE_char_load AO_INLINE AO_t AO_char_load_read(volatile unsigned char *addr) { AO_t result = AO_char_load(addr); AO_compiler_barrier(); return result; } #define AO_HAVE_char_load_read #define AO_char_load_acquire(addr) AO_char_load_read(addr) #define AO_HAVE_char_load_acquire #endif /* AO_HAVE_char_load */ #ifdef AO_HAVE_short_load AO_INLINE AO_t AO_short_load_read(volatile unsigned short *addr) { AO_t result = AO_short_load(addr); AO_compiler_barrier(); return result; } #define AO_HAVE_short_load_read #define AO_short_load_acquire(addr) AO_short_load_read(addr) #define AO_HAVE_short_load_acquire #endif /* AO_HAVE_short_load */ #ifdef AO_HAVE_int_load AO_INLINE AO_t AO_int_load_read(volatile unsigned int *addr) { AO_t result = AO_int_load(addr); AO_compiler_barrier(); return result; } #define AO_HAVE_int_load_read #define AO_int_load_acquire(addr) AO_int_load_read(addr) #define AO_HAVE_int_load_acquire #endif /* AO_HAVE_int_load */ synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/generic_pthread.h0000664000076400007640000001545411104702315030427 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * 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. */ /* The following is useful primarily for debugging and documentation. */ /* We define various atomic operations by acquiring a global pthread */ /* lock. The resulting implementation will perform poorly, but should */ /* be correct unless it is used from signal handlers. */ /* We assume that all pthread operations act like full memory barriers. */ /* (We believe that is the intent of the specification.) */ #include #include "test_and_set_t_is_ao_t.h" /* This is not necessarily compatible with the native */ /* implementation. But those can't be safely mixed anyway. */ /* We define only the full barrier variants, and count on the */ /* generalization section below to fill in the rest. */ extern pthread_mutex_t AO_pt_lock; AO_INLINE void AO_nop_full() { pthread_mutex_lock(&AO_pt_lock); pthread_mutex_unlock(&AO_pt_lock); } #define AO_HAVE_nop_full AO_INLINE AO_t AO_load_full(volatile AO_t *addr) { AO_t result; pthread_mutex_lock(&AO_pt_lock); result = *addr; pthread_mutex_unlock(&AO_pt_lock); return result; } #define AO_HAVE_load_full AO_INLINE void AO_store_full(volatile AO_t *addr, AO_t val) { pthread_mutex_lock(&AO_pt_lock); *addr = val; pthread_mutex_unlock(&AO_pt_lock); } #define AO_HAVE_store_full AO_INLINE unsigned char AO_char_load_full(volatile unsigned char *addr) { unsigned char result; pthread_mutex_lock(&AO_pt_lock); result = *addr; pthread_mutex_unlock(&AO_pt_lock); return result; } #define AO_HAVE_char_load_full AO_INLINE void AO_char_store_full(volatile unsigned char *addr, unsigned char val) { pthread_mutex_lock(&AO_pt_lock); *addr = val; pthread_mutex_unlock(&AO_pt_lock); } #define AO_HAVE_char_store_full AO_INLINE unsigned short AO_short_load_full(volatile unsigned short *addr) { unsigned short result; pthread_mutex_lock(&AO_pt_lock); result = *addr; pthread_mutex_unlock(&AO_pt_lock); return result; } #define AO_HAVE_short_load_full AO_INLINE void AO_short_store_full(volatile unsigned short *addr, unsigned short val) { pthread_mutex_lock(&AO_pt_lock); *addr = val; pthread_mutex_unlock(&AO_pt_lock); } #define AO_HAVE_short_store_full AO_INLINE unsigned int AO_int_load_full(volatile unsigned int *addr) { unsigned int result; pthread_mutex_lock(&AO_pt_lock); result = *addr; pthread_mutex_unlock(&AO_pt_lock); return result; } #define AO_HAVE_int_load_full AO_INLINE void AO_int_store_full(volatile unsigned int *addr, unsigned int val) { pthread_mutex_lock(&AO_pt_lock); *addr = val; pthread_mutex_unlock(&AO_pt_lock); } #define AO_HAVE_int_store_full AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { AO_TS_VAL_t result; pthread_mutex_lock(&AO_pt_lock); result = (AO_TS_VAL_t)(*addr); *addr = AO_TS_SET; pthread_mutex_unlock(&AO_pt_lock); assert(result == AO_TS_SET || result == AO_TS_CLEAR); return result; } #define AO_HAVE_test_and_set_full AO_INLINE AO_t AO_fetch_and_add_full(volatile AO_t *p, AO_t incr) { AO_t tmp; pthread_mutex_lock(&AO_pt_lock); tmp = *p; *p = tmp + incr; pthread_mutex_unlock(&AO_pt_lock); return tmp; } #define AO_HAVE_fetch_and_add_full AO_INLINE unsigned char AO_char_fetch_and_add_full(volatile unsigned char *p, unsigned char incr) { unsigned char tmp; pthread_mutex_lock(&AO_pt_lock); tmp = *p; *p = tmp + incr; pthread_mutex_unlock(&AO_pt_lock); return tmp; } #define AO_HAVE_char_fetch_and_add_full AO_INLINE unsigned short AO_short_fetch_and_add_full(volatile unsigned short *p, unsigned short incr) { unsigned short tmp; pthread_mutex_lock(&AO_pt_lock); tmp = *p; *p = tmp + incr; pthread_mutex_unlock(&AO_pt_lock); return tmp; } #define AO_HAVE_short_fetch_and_add_full AO_INLINE unsigned int AO_int_fetch_and_add_full(volatile unsigned int *p, unsigned int incr) { unsigned int tmp; pthread_mutex_lock(&AO_pt_lock); tmp = *p; *p = tmp + incr; pthread_mutex_unlock(&AO_pt_lock); return tmp; } #define AO_HAVE_int_fetch_and_add_full AO_INLINE void AO_or_full(volatile AO_t *p, AO_t incr) { AO_t tmp; pthread_mutex_lock(&AO_pt_lock); tmp = *p; *p = (tmp | incr); pthread_mutex_unlock(&AO_pt_lock); } #define AO_HAVE_or_full AO_INLINE int AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) { pthread_mutex_lock(&AO_pt_lock); if (*addr == old) { *addr = new_val; pthread_mutex_unlock(&AO_pt_lock); return 1; } else pthread_mutex_unlock(&AO_pt_lock); return 0; } #define AO_HAVE_compare_and_swap_full /* Unlike real architectures, we define both double-width CAS variants. */ typedef struct { AO_t AO_val1; AO_t AO_val2; } AO_double_t; #define AO_HAVE_double_t AO_INLINE int AO_compare_double_and_swap_double_full(volatile AO_double_t *addr, AO_t old1, AO_t old2, AO_t new1, AO_t new2) { pthread_mutex_lock(&AO_pt_lock); if (addr -> AO_val1 == old1 && addr -> AO_val2 == old2) { addr -> AO_val1 = new1; addr -> AO_val2 = new2; pthread_mutex_unlock(&AO_pt_lock); return 1; } else pthread_mutex_unlock(&AO_pt_lock); return 0; } #define AO_HAVE_compare_double_and_swap_double_full AO_INLINE int AO_compare_and_swap_double_full(volatile AO_double_t *addr, AO_t old1, AO_t new1, AO_t new2) { pthread_mutex_lock(&AO_pt_lock); if (addr -> AO_val1 == old1) { addr -> AO_val1 = new1; addr -> AO_val2 = new2; pthread_mutex_unlock(&AO_pt_lock); return 1; } else pthread_mutex_unlock(&AO_pt_lock); return 0; } #define AO_HAVE_compare_and_swap_double_full /* We can't use hardware loads and stores, since they don't */ /* interact correctly with atomic updates. */ synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/ordered.h0000664000076400007640000000254511104702315026725 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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. */ /* * These are common definitions for architectures that provide processor * ordered memory operations. */ #include "ordered_except_wr.h" AO_INLINE void AO_nop_full() { AO_compiler_barrier(); } #define AO_HAVE_nop_full synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/hpc/0000775000076400007640000000000011172123233025675 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/hpc/ia64.h0000664000076400007640000001153211104702315026612 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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. */ /* * This file specifies Itanimum primitives for use with the HP compiler * unde HP/UX. We use intrinsics instead of the inline assembly code in the * gcc file. */ #include "../all_atomic_load_store.h" #include "../all_acquire_release_volatile.h" #include "../test_and_set_t_is_char.h" #include #ifdef __LP64__ # define AO_T_FASIZE _FASZ_D # define AO_T_SIZE _SZ_D #else # define AO_T_FASIZE _FASZ_W # define AO_T_SIZE _SZ_W #endif AO_INLINE void AO_nop_full() { _Asm_mf(); } #define AO_HAVE_nop_full AO_INLINE AO_t AO_fetch_and_add1_acquire (volatile AO_t *p) { return _Asm_fetchadd(AO_T_FASIZE, _SEM_ACQ, p, 1, _LDHINT_NONE, _DOWN_MEM_FENCE); } #define AO_HAVE_fetch_and_add1_acquire AO_INLINE AO_t AO_fetch_and_add1_release (volatile AO_t *p) { return _Asm_fetchadd(AO_T_FASIZE, _SEM_REL, p, 1, _LDHINT_NONE, _UP_MEM_FENCE); } #define AO_HAVE_fetch_and_add1_release AO_INLINE AO_t AO_fetch_and_sub1_acquire (volatile AO_t *p) { return _Asm_fetchadd(AO_T_FASIZE, _SEM_ACQ, p, -1, _LDHINT_NONE, _DOWN_MEM_FENCE); } #define AO_HAVE_fetch_and_sub1_acquire AO_INLINE AO_t AO_fetch_and_sub1_release (volatile AO_t *p) { return _Asm_fetchadd(AO_T_FASIZE, _SEM_REL, p, -1, _LDHINT_NONE, _UP_MEM_FENCE); } #define AO_HAVE_fetch_and_sub1_release AO_INLINE int AO_compare_and_swap_acquire(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t oldval; _Asm_mov_to_ar(_AREG_CCV, old, _DOWN_MEM_FENCE); oldval = _Asm_cmpxchg(AO_T_SIZE, _SEM_ACQ, addr, new_val, _LDHINT_NONE, _DOWN_MEM_FENCE); return (oldval == old); } #define AO_HAVE_compare_and_swap_acquire AO_INLINE int AO_compare_and_swap_release(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t oldval; _Asm_mov_to_ar(_AREG_CCV, old, _UP_MEM_FENCE); oldval = _Asm_cmpxchg(AO_T_SIZE, _SEM_REL, addr, new_val, _LDHINT_NONE, _UP_MEM_FENCE); /* Hopefully the compiler knows not to reorder the above two? */ return (oldval == old); } #define AO_HAVE_compare_and_swap_release AO_INLINE int AO_char_compare_and_swap_acquire(volatile unsigned char *addr, unsigned char old, unsigned char new_val) { unsigned char oldval; _Asm_mov_to_ar(_AREG_CCV, old, _DOWN_MEM_FENCE); oldval = _Asm_cmpxchg(_SZ_B, _SEM_ACQ, addr, new_val, _LDHINT_NONE, _DOWN_MEM_FENCE); return (oldval == old); } #define AO_HAVE_char_compare_and_swap_acquire AO_INLINE int AO_char_compare_and_swap_release(volatile unsigned char *addr, unsigned char old, unsigned char new_val) { unsigned char oldval; _Asm_mov_to_ar(_AREG_CCV, old, _UP_MEM_FENCE); oldval = _Asm_cmpxchg(_SZ_B, _SEM_REL, addr, new_val, _LDHINT_NONE, _UP_MEM_FENCE); /* Hopefully the compiler knows not to reorder the above two? */ return (oldval == old); } #define AO_HAVE_char_compare_and_swap_release AO_INLINE int AO_short_compare_and_swap_acquire(volatile unsigned short *addr, unsigned short old, unsigned short new_val) { unsigned short oldval; _Asm_mov_to_ar(_AREG_CCV, old, _DOWN_MEM_FENCE); oldval = _Asm_cmpxchg(_SZ_B, _SEM_ACQ, addr, new_val, _LDHINT_NONE, _DOWN_MEM_FENCE); return (oldval == old); } #define AO_HAVE_short_compare_and_swap_acquire AO_INLINE int AO_short_compare_and_swap_release(volatile unsigned short *addr, unsigned short old, unsigned short new_val) { unsigned short oldval; _Asm_mov_to_ar(_AREG_CCV, old, _UP_MEM_FENCE); oldval = _Asm_cmpxchg(_SZ_B, _SEM_REL, addr, new_val, _LDHINT_NONE, _UP_MEM_FENCE); /* Hopefully the compiler knows not to reorder the above two? */ return (oldval == old); } #define AO_HAVE_short_compare_and_swap_release #ifndef __LP64__ # include "../ao_t_is_int.h" #endif synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/hpc/hppa.h0000664000076400007640000000732011104702315026777 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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. * * Derived from the corresponsing header file for gcc. * */ #include "../atomic_load_store.h" /* Some architecture set descriptions include special "ordered" memory */ /* operations. As far as we can tell, no existing processors actually */ /* require those. Nor does it appear likely that future processors */ /* will. */ /* FIXME: */ /* The PA emulator on Itanium may obey weaker restrictions. */ /* There should be a mode in which we don't assume sequential */ /* consistency here. */ #include "../ordered.h" #include /* GCC will not guarantee the alignment we need, use four lock words */ /* and select the correctly aligned datum. See the glibc 2.3.2 */ /* linuxthread port for the original implementation. */ struct AO_pa_clearable_loc { int data[4]; }; #undef AO_TS_INITIALIZER #define AO_TS_t struct AO_pa_clearable_loc #define AO_TS_INITIALIZER {1,1,1,1} /* Switch meaning of set and clear, since we only have an atomic clear */ /* instruction. */ typedef enum {AO_PA_TS_set = 0, AO_PA_TS_clear = 1} AO_PA_TS_val; #define AO_TS_VAL_t AO_PA_TS_val #define AO_TS_CLEAR AO_PA_TS_clear #define AO_TS_SET AO_PA_TS_set /* The hppa only has one atomic read and modify memory operation, */ /* load and clear, so hppa spinlocks must use zero to signify that */ /* someone is holding the lock. The address used for the ldcw */ /* semaphore must be 16-byte aligned. */ #define __ldcw(a, ret) \ _LDCWX(0 /* index */, 0 /* s */, a /* base */, ret); /* Because malloc only guarantees 8-byte alignment for malloc'd data, */ /* and GCC only guarantees 8-byte alignment for stack locals, we can't */ /* be assured of 16-byte alignment for atomic lock data even if we */ /* specify "__attribute ((aligned(16)))" in the type declaration. So, */ /* we use a struct containing an array of four ints for the atomic lock */ /* type and dynamically select the 16-byte aligned int from the array */ /* for the semaphore. */ #define __PA_LDCW_ALIGNMENT 16 #define __ldcw_align(a, ret) { \ ret = (unsigned long) a; \ ret += __PA_LDCW_ALIGNMENT - 1; \ ret &= ~(__PA_LDCW_ALIGNMENT - 1); \ } /* Works on PA 1.1 and PA 2.0 systems */ AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t * addr) { register unsigned int ret; register unsigned long a; __ldcw_align (addr, a); __ldcw (a, ret); return ret; } AO_INLINE void AO_pa_clear(volatile AO_TS_t * addr) { unsigned long a; __ldcw_align (addr,a); AO_compiler_barrier(); *(volatile unsigned int *)a = 1; } #define AO_CLEAR(addr) AO_pa_clear(addr) #define AO_HAVE_test_and_set_full synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/all_aligned_atomic_load_store.h0000664000076400007640000000270611104702315033302 0ustar stefanstefan/* * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * Describes architectures on which AO_t, unsigned char, unsigned short, * and unsigned int loads and strores are atomic for all normally legal alignments. */ #include "aligned_atomic_load_store.h" #include "char_atomic_load_store.h" #include "short_aligned_atomic_load_store.h" #include "int_aligned_atomic_load_store.h" synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/short_acquire_release_volatile.h0000664000076400007640000000372111104702315033545 0ustar stefanstefan/* * Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * This file adds definitions appropriate for environments in which an unsigned short * volatile load has acquire semantics, and an unsigned short volatile store has release * semantics. This is true with the standard Itanium ABI. */ #if !defined(AO_GCC_BARRIER) # if defined(__GNUC__) # define AO_GCC_BARRIER() AO_compiler_barrier() # else # define AO_GCC_BARRIER() # endif #endif AO_INLINE unsigned short AO_short_load_acquire(volatile unsigned short *p) { unsigned short result = *p; /* A normal volatile load generates an ld.acq */ AO_GCC_BARRIER(); return result; } #define AO_HAVE_short_load_acquire AO_INLINE void AO_short_store_release(volatile unsigned short *p, unsigned short val) { AO_GCC_BARRIER(); /* A normal volatile store generates an st.rel */ *p = val; } #define AO_HAVE_short_store_release synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/all_atomic_load_store.h0000664000076400007640000000266111104702315031617 0ustar stefanstefan/* * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * Describes architectures on which AO_t, unsigned char, unsigned short, * and unsigned int loads and strores are atomic for all normally legal * alignments. */ #include "atomic_load_store.h" #include "char_atomic_load_store.h" #include "short_atomic_load_store.h" #include "int_atomic_load_store.h" synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/msftc/0000775000076400007640000000000011172123233026237 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/msftc/x86_64.h0000664000076400007640000001071411104702315027350 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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. */ /* The following really assume we have a 486 or better. */ /* If ASSUME_WINDOWS98 is defined, we assume Windows 98 or newer. */ #include "../all_aligned_atomic_load_store.h" /* Real X86 implementations, except for some old WinChips, appear */ /* to enforce ordering between memory operations, EXCEPT that a later */ /* read can pass earlier writes, presumably due to the visible */ /* presence of store buffers. */ /* We ignore both the WinChips, and the fact that the official specs */ /* seem to be much weaker (and arguably too weak to be usable). */ #include "../ordered_except_wr.h" #if 0 FIXME: Need to reimplement testandset #include "../test_and_set_t_is_char.h" #else #include "../test_and_set_t_is_ao_t.h" #endif #include /* Seems like over-kill, but that's what MSDN recommends. */ /* And apparently winbase.h is not always self-contained. */ #include #pragma intrinsic (_ReadWriteBarrier) #ifdef __cplusplus extern "C" { #endif LONGLONG __cdecl _InterlockedIncrement64(LONGLONG volatile *Addend); LONGLONG __cdecl _InterlockedDecrement64(LONGLONG volatile *Addend); LONGLONG __cdecl _InterlockedExchangeAdd64(LONGLONG volatile* Target, LONGLONG Addend); LONGLONG __cdecl _InterlockedExchange64(LONGLONG volatile* Target, LONGLONG Value); LONGLONG __cdecl _InterlockedCompareExchange64(LONGLONG volatile* Dest, LONGLONG Exchange, LONGLONG Comp); #ifdef __cplusplus } #endif #pragma intrinsic (_InterlockedIncrement64) #pragma intrinsic (_InterlockedDecrement64) #pragma intrinsic (_InterlockedExchange64) #pragma intrinsic (_InterlockedExchangeAdd64) #pragma intrinsic (_InterlockedCompareExchange64) /* As far as we can tell, the lfence and sfence instructions are not */ /* currently needed or useful for cached memory accesses. */ /* Unfortunately mfence doesn't exist everywhere. */ /* IsProcessorFeaturePresent(PF_COMPARE_EXCHANGE128) is */ /* probably a conservative test for it? */ #if defined(AO_USE_PENTIUM4_INSTRS) AO_INLINE void AO_nop_full() { __asm { mfence } } #define AO_HAVE_nop_full #else /* We could use the cpuid instruction. But that seems to be slower */ /* than the default implementation based on test_and_set_full. Thus */ /* we omit that bit of misinformation here. */ #endif AO_INLINE AO_t AO_fetch_and_add_full (volatile AO_t *p, AO_t incr) { return _InterlockedExchangeAdd64((LONGLONG volatile *)p, (LONGLONG)incr); } #define AO_HAVE_fetch_and_add_full AO_INLINE AO_t AO_fetch_and_add1_full (volatile AO_t *p) { return _InterlockedIncrement64((LONGLONG volatile *)p) - 1; } #define AO_HAVE_fetch_and_add1_full AO_INLINE AO_t AO_fetch_and_sub1_full (volatile AO_t *p) { return _InterlockedDecrement64((LONGLONG volatile *)p) + 1; } #define AO_HAVE_fetch_and_sub1_full AO_INLINE int AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) { return _InterlockedCompareExchange64((LONGLONG volatile *)addr, (LONGLONG)new_val, (LONGLONG)old) == (LONGLONG)old; } #define AO_HAVE_compare_and_swap_full #if 0 FIXME: (__asm not supported) AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { __asm { mov eax,AO_TS_SET ; mov ebx,addr ; xchg byte ptr [ebx],al ; } } #define AO_HAVE_test_and_set_full #endif synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/msftc/x86.h0000664000076400007640000001127011104702315027035 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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. */ /* The following really assume we have a 486 or better. */ /* If ASSUME_WINDOWS98 is defined, we assume Windows 98 or newer. */ #include "../all_aligned_atomic_load_store.h" /* Real X86 implementations, except for some old WinChips, appear */ /* to enforce ordering between memory operations, EXCEPT that a later */ /* read can pass earlier writes, presumably due to the visible */ /* presence of store buffers. */ /* We ignore both the WinChips, and the fact that the official specs */ /* seem to be much weaker (and arguably too weak to be usable). */ #include "../ordered_except_wr.h" #include "../test_and_set_t_is_char.h" #include /* Seems like over-kill, but that's what MSDN recommends. */ /* And apparently winbase.h is not always self-contained. */ #if _MSC_VER < 1310 #define _InterlockedIncrement InterlockedIncrement #define _InterlockedDecrement InterlockedDecrement #define _InterlockedExchange InterlockedExchange #define _InterlockedCompareExchange InterlockedCompareExchange #else #if _MSC_VER >= 1400 #include #pragma intrinsic (_ReadWriteBarrier) #else #ifdef __cplusplus extern "C" { #endif LONG __cdecl _InterlockedIncrement(LONG volatile *Addend); LONG __cdecl _InterlockedDecrement(LONG volatile *Addend); LONG __cdecl _InterlockedExchangeAdd(LONG volatile* Target, LONG Addend); LONG __cdecl _InterlockedExchange(LONG volatile* Target, LONG Value); LONG __cdecl _InterlockedCompareExchange(LONG volatile* Dest, LONG Exchange, LONG Comp); #ifdef __cplusplus } #endif #endif /* _MSC_VER >= 1400 */ #pragma intrinsic (_InterlockedIncrement) #pragma intrinsic (_InterlockedDecrement) #pragma intrinsic (_InterlockedExchange) #pragma intrinsic (_InterlockedExchangeAdd) #pragma intrinsic (_InterlockedCompareExchange) #endif /* _MSC_VER < 1310 */ /* As far as we can tell, the lfence and sfence instructions are not */ /* currently needed or useful for cached memory accesses. */ /* Unfortunately mfence doesn't exist everywhere. */ /* IsProcessorFeaturePresent(PF_COMPARE_EXCHANGE128) is */ /* probably a conservative test for it? */ #if defined(AO_USE_PENTIUM4_INSTRS) AO_INLINE void AO_nop_full() { __asm { mfence } } #define AO_HAVE_nop_full #else /* We could use the cpuid instruction. But that seems to be slower */ /* than the default implementation based on test_and_set_full. Thus */ /* we omit that bit of misinformation here. */ #endif AO_INLINE AO_t AO_fetch_and_add_full (volatile AO_t *p, AO_t incr) { return _InterlockedExchangeAdd((LONG volatile*)p, (LONG)incr); } #define AO_HAVE_fetch_and_add_full AO_INLINE AO_t AO_fetch_and_add1_full (volatile AO_t *p) { return _InterlockedIncrement((LONG volatile *)p) - 1; } #define AO_HAVE_fetch_and_add1_full AO_INLINE AO_t AO_fetch_and_sub1_full (volatile AO_t *p) { return _InterlockedDecrement((LONG volatile *)p) + 1; } #define AO_HAVE_fetch_and_sub1_full AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { __asm { mov eax,AO_TS_SET ; mov ebx,addr ; xchg byte ptr [ebx],al ; } } #define AO_HAVE_test_and_set_full #ifdef AO_ASSUME_WINDOWS98 /* Returns nonzero if the comparison succeeded. */ AO_INLINE int AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) { return _InterlockedCompareExchange((LONG volatile *)addr, (LONG)new_val, (LONG)old) == (LONG)old; } #define AO_HAVE_compare_and_swap_full #endif /* ASSUME_WINDOWS98 */ #ifdef _WIN64 # error wrong architecture #endif #include "../ao_t_is_int.h" synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/gcc/0000775000076400007640000000000011172123233025657 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/gcc/m68k.h0000664000076400007640000000263511104702315026622 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved. * * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */ /* FIXME. Very incomplete. */ #include "../all_aligned_atomic_load_store.h" /* Are there any m68k multiprocessors still around? */ /* AFAIK, Alliants were sequentially consistent. */ #include "../ordered.h" #include "../test_and_set_t_is_ao_t.h" /* Contributed by Tony Mantler or new. Should be changed to MIT license? */ AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { int oldval; /* The return value is semi-phony. */ /* 'tas' sets bit 7 while the return */ /* value pretends bit 0 was set */ __asm__ __volatile__( "tas %1@; sne %0; negb %0" : "=d" (oldval) : "a" (addr) : "memory"); return oldval; } #define AO_HAVE_test_and_set_full synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/gcc/x86_64.h0000664000076400007640000001015311104702315026765 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved. * * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * * Some of the machine specific code was borrowed from our GC distribution. */ /* The following really assume we have a 486 or better. Unfortunately */ /* gcc doesn't define a suitable feature test macro based on command */ /* line options. */ /* We should perhaps test dynamically. */ #include "../all_aligned_atomic_load_store.h" /* Real X86 implementations, except for some old WinChips, appear */ /* to enforce ordering between memory operations, EXCEPT that a later */ /* read can pass earlier writes, presumably due to the visible */ /* presence of store buffers. */ /* We ignore both the WinChips, and the fact that the official specs */ /* seem to be much weaker (and arguably too weak to be usable). */ #include "../ordered_except_wr.h" #include "../test_and_set_t_is_char.h" #if defined(AO_USE_PENTIUM4_INSTRS) AO_INLINE void AO_nop_full() { __asm__ __volatile__("mfence" : : : "memory"); } #define AO_HAVE_nop_full #else /* We could use the cpuid instruction. But that seems to be slower */ /* than the default implementation based on test_and_set_full. Thus */ /* we omit that bit of misinformation here. */ #endif /* As far as we can tell, the lfence and sfence instructions are not */ /* currently needed or useful for cached memory accesses. */ /* Really only works for 486 and later */ AO_INLINE AO_t AO_fetch_and_add_full (volatile AO_t *p, AO_t incr) { AO_t result; __asm__ __volatile__ ("lock; xaddq %0, %1" : "=r" (result), "=m" (*p) : "0" (incr), "m" (*p) : "memory"); return result; } #define AO_HAVE_fetch_and_add_full AO_INLINE unsigned char AO_char_fetch_and_add_full (volatile unsigned char *p, unsigned char incr) { unsigned char result; __asm__ __volatile__ ("lock; xaddb %0, %1" : "=q" (result), "=m" (*p) : "0" (incr), "m" (*p) : "memory"); return result; } #define AO_HAVE_char_fetch_and_add_full AO_INLINE unsigned short AO_short_fetch_and_add_full (volatile unsigned short *p, unsigned short incr) { unsigned short result; __asm__ __volatile__ ("lock; xaddw %0, %1" : "=r" (result), "=m" (*p) : "0" (incr), "m" (*p) : "memory"); return result; } #define AO_HAVE_short_fetch_and_add_full AO_INLINE unsigned short AO_int_fetch_and_add_full (volatile unsigned int *p, unsigned int incr) { unsigned int result; __asm__ __volatile__ ("lock; xaddl %0, %1" : "=r" (result), "=m" (*p) : "0" (incr), "m" (*p) : "memory"); return result; } #define AO_HAVE_int_fetch_and_add_full /* Really only works for 486 and later */ AO_INLINE void AO_or_full (volatile AO_t *p, AO_t incr) { __asm__ __volatile__ ("lock; orq %1, %0" : "=m" (*p) : "r" (incr), "m" (*p) : "memory"); } #define AO_HAVE_or_full AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { unsigned char oldval; /* Note: the "xchg" instruction does not need a "lock" prefix */ __asm__ __volatile__("xchgb %0, %1" : "=q"(oldval), "=m"(*addr) : "0"(0xff), "m"(*addr) : "memory"); return (AO_TS_VAL_t)oldval; } #define AO_HAVE_test_and_set_full /* Returns nonzero if the comparison succeeded. */ AO_INLINE int AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) { char result; __asm__ __volatile__("lock; cmpxchgq %3, %0; setz %1" : "=m"(*addr), "=q"(result) : "m"(*addr), "r" (new_val), "a"(old) : "memory"); return (int) result; } #define AO_HAVE_compare_and_swap_full /* FIXME: The Intel version has a 16byte CAS instruction. */ synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/gcc/alpha.h0000664000076400007640000000355311104702315027122 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved. * * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */ #include "../atomic_load_store.h" #include "../test_and_set_t_is_ao_t.h" #define AO_NO_DD_ORDERING /* Data dependence does not imply read ordering. */ AO_INLINE void AO_nop_full() { __asm__ __volatile__("mb" : : : "memory"); } #define AO_HAVE_nop_full AO_INLINE void AO_nop_write() { __asm__ __volatile__("wmb" : : : "memory"); } #define AO_HAVE_nop_write /* mb should be used for AO_nop_read(). That's the default. */ /* We believe that ldq_l ... stq_c does not imply any memory barrier. */ /* We should add an explicit fetch_and_add definition. */ AO_INLINE int AO_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val) { unsigned long was_equal; unsigned long temp; __asm__ __volatile__( "1: ldq_l %0,%1\n" " cmpeq %0,%4,%2\n" " mov %3,%0\n" " beq %2,2f\n" " stq_c %0,%1\n" " beq %0,1b\n" "2:\n" :"=&r" (temp), "=m" (*addr), "=&r" (was_equal) : "r" (new_val), "Ir" (old) :"memory"); return was_equal; } #define AO_HAVE_compare_and_swap synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/gcc/arm.h0000664000076400007640000000366111104702315026614 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved. * * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */ /* There exist multiprocessor SoC ARM processors, so this matters. */ /* This needs to be augmented for later ARM (e.g. V7) procesors. */ /* I found a slide set that, if I read it correctly, claims that */ /* Loads followed by either a Load or Store are ordered, but nothing */ /* else is. */ /* It appears that SWP is the only simple memory barrier. */ #include "../all_atomic_load_store.h" #include "../read_ordered.h" #include "../test_and_set_t_is_ao_t.h" /* Probably suboptimal */ AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { AO_TS_VAL_t oldval; /* SWP on ARM is very similar to XCHG on x86. */ /* The first operand is the result, the second the value */ /* to be stored. Both registers must be different from addr. */ /* Make the address operand an early clobber output so it */ /* doesn't overlap with the other operands. The early clobber*/ /* on oldval is neccessary to prevent the compiler allocating */ /* them to the same register if they are both unused. */ __asm__ __volatile__("swp %0, %2, [%3]" : "=&r"(oldval), "=&r"(addr) : "r"(1), "1"(addr) : "memory"); return oldval; } #define AO_HAVE_test_and_set_full synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/gcc/powerpc.h0000664000076400007640000002045111104702315027510 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P. * * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */ /* FIXME. Incomplete. No support for 64 bits. */ /* Memory model documented at http://www-106.ibm.com/developerworks/ */ /* eserver/articles/archguide.html and (clearer) */ /* http://www-106.ibm.com/developerworks/eserver/articles/powerpc.html. */ /* There appears to be no implicit ordering between any kind of */ /* independent memory references. */ /* Architecture enforces some ordering based on control dependence. */ /* I don't know if that could help. */ /* Data-dependent loads are always ordered. */ /* Based on the above references, eieio is intended for use on */ /* uncached memory, which we don't support. It does not order loads */ /* from cached memory. */ /* Thanks to Maged Michael, Doug Lea, and Roger Hoover for helping to */ /* track some of this down and correcting my misunderstandings. -HB */ #include "../all_aligned_atomic_load_store.h" #include "../test_and_set_t_is_ao_t.h" /* There seems to be no byte equivalent of lwarx, so this */ /* may really be what we want, at least in the 32-bit case. */ AO_INLINE void AO_nop_full() { __asm__ __volatile__("sync" : : : "memory"); } #define AO_HAVE_nop_full /* lwsync apparently works for everything but a StoreLoad barrier. */ AO_INLINE void AO_lwsync() { __asm__ __volatile__("lwsync" : : : "memory"); } #define AO_nop_write() AO_lwsync() #define AO_HAVE_nop_write #define AO_nop_read() AO_lwsync() #define AO_HAVE_nop_read /* We explicitly specify load_acquire, since it is important, and can */ /* be implemented relatively cheaply. It could be implemented */ /* with an ordinary load followed by a lwsync. But the general wisdom */ /* seems to be that a data dependent branch followed by an isync is */ /* cheaper. And the documentation is fairly explicit that this also */ /* has acquire semantics. */ /* ppc64 uses ld not lwz */ #if defined(__powerpc64__) || defined(__ppc64__) || defined(__64BIT__) AO_INLINE AO_t AO_load_acquire(volatile AO_t *addr) { AO_t result; /* FIXME: We should get gcc to allocate one of the condition */ /* registers. I always got "impossible constraint" when I */ /* tried the "y" constraint. */ __asm__ __volatile__ ( "ld %0,%1\n" "cmpw cr7,%0,%0\n" "bne- cr7,1f\n" "1: isync\n" : "=r" (result) : "m"(*addr) : "memory", "cc"); return result; } #else AO_INLINE AO_t AO_load_acquire(volatile AO_t *addr) { AO_t result; /* FIXME: We should get gcc to allocate one of the condition */ /* registers. I always got "impossible constraint" when I */ /* tried the "y" constraint. */ __asm__ __volatile__ ( "lwz %0,%1\n" "cmpw cr7,%0,%0\n" "bne- cr7,1f\n" "1: isync\n" : "=r" (result) : "m"(*addr) : "memory", "cc"); return result; } #endif #define AO_HAVE_load_acquire /* We explicitly specify store_release, since it relies */ /* on the fact that lwsync is also a LoadStore barrier. */ AO_INLINE void AO_store_release(volatile AO_t *addr, AO_t value) { AO_lwsync(); *addr = value; } #define AO_HAVE_load_acquire /* This is similar to the code in the garbage collector. Deleting */ /* this and having it synthesized from compare_and_swap would probably */ /* only cost us a load immediate instruction. */ #if defined(__powerpc64__) || defined(__ppc64__) || defined(__64BIT__) /* Completely untested. And we should be using smaller objects anyway. */ AO_INLINE AO_TS_VAL_t AO_test_and_set(volatile AO_TS_t *addr) { unsigned long oldval; unsigned long temp = 1; /* locked value */ __asm__ __volatile__( "1:ldarx %0,0,%1\n" /* load and reserve */ "cmpdi %0, 0\n" /* if load is */ "bne 2f\n" /* non-zero, return already set */ "stdcx. %2,0,%1\n" /* else store conditional */ "bne- 1b\n" /* retry if lost reservation */ "2:\n" /* oldval is zero if we set */ : "=&r"(oldval) : "r"(addr), "r"(temp) : "memory", "cc"); return (AO_TS_VAL_t)oldval; } #else AO_INLINE AO_TS_VAL_t AO_test_and_set(volatile AO_TS_t *addr) { int oldval; int temp = 1; /* locked value */ __asm__ __volatile__( "1:lwarx %0,0,%1\n" /* load and reserve */ "cmpwi %0, 0\n" /* if load is */ "bne 2f\n" /* non-zero, return already set */ "stwcx. %2,0,%1\n" /* else store conditional */ "bne- 1b\n" /* retry if lost reservation */ "2:\n" /* oldval is zero if we set */ : "=&r"(oldval) : "r"(addr), "r"(temp) : "memory", "cc"); return (AO_TS_VAL_t)oldval; } #endif #define AO_have_test_and_set AO_INLINE AO_TS_VAL_t AO_test_and_set_acquire(volatile AO_TS_t *addr) { AO_TS_VAL_t result = AO_test_and_set(addr); AO_lwsync(); return result; } #define AO_HAVE_test_and_set_acquire AO_INLINE AO_TS_VAL_t AO_test_and_set_release(volatile AO_TS_t *addr) { AO_lwsync(); return AO_test_and_set(addr); } #define AO_HAVE_test_and_set_release AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { AO_TS_VAL_t result; AO_lwsync(); result = AO_test_and_set(addr); AO_lwsync(); return result; } #define AO_HAVE_test_and_set_full #if defined(__powerpc64__) || defined(__ppc64__) || defined(__64BIT__) /* FIXME: Completely untested. */ AO_INLINE int AO_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t oldval; int result = 0; __asm__ __volatile__( "1:ldarx %0,0,%2\n" /* load and reserve */ "cmpd %0, %4\n" /* if load is not equal to */ "bne 2f\n" /* old, fail */ "stdcx. %3,0,%2\n" /* else store conditional */ "bne- 1b\n" /* retry if lost reservation */ "li %1,1\n" /* result = 1; */ "2:\n" : "=&r"(oldval), "=&r"(result) : "r"(addr), "r"(new_val), "r"(old), "1"(result) : "memory", "cc"); return result; } #else AO_INLINE int AO_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t oldval; int result = 0; __asm__ __volatile__( "1:lwarx %0,0,%2\n" /* load and reserve */ "cmpw %0, %4\n" /* if load is not equal to */ "bne 2f\n" /* old, fail */ "stwcx. %3,0,%2\n" /* else store conditional */ "bne- 1b\n" /* retry if lost reservation */ "li %1,1\n" /* result = 1; */ "2:\n" : "=&r"(oldval), "=&r"(result) : "r"(addr), "r"(new_val), "r"(old), "1"(result) : "memory", "cc"); return result; } #endif #define AO_HAVE_compare_and_swap AO_INLINE int AO_compare_and_swap_acquire(volatile AO_t *addr, AO_t old, AO_t new_val) { int result = AO_compare_and_swap(addr, old, new_val); AO_lwsync(); return result; } #define AO_HAVE_compare_and_swap_acquire AO_INLINE int AO_compare_and_swap_release(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_lwsync(); return AO_compare_and_swap(addr, old, new_val); } #define AO_HAVE_compare_and_swap_release AO_INLINE int AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t result; AO_lwsync(); result = AO_compare_and_swap(addr, old, new_val); AO_lwsync(); return result; } #define AO_HAVE_compare_and_swap_full /* FIXME: We should also implement fetch_and_add and or primitives */ /* directly. */ synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/gcc/ia64.h0000664000076400007640000002055011104702315026574 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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 "../all_atomic_load_store.h" #include "../all_acquire_release_volatile.h" #include "../test_and_set_t_is_char.h" #ifdef _ILP32 /* 32-bit HP/UX code. */ /* This requires pointer "swizzling". Pointers need to be expanded */ /* to 64 bits using the addp4 instruction before use. This makes it */ /* hard to share code, but we try anyway. */ # define AO_LEN "4" /* We assume that addr always appears in argument position 1 in asm */ /* code. If it is clobbered due to swizzling, we also need it in */ /* second position. Any later arguments are referenced symbolically, */ /* so that we don't have to worry about their position. This requires*/ /* gcc 3.1, but you shouldn't be using anything older than that on */ /* IA64 anyway. */ /* The AO_MASK macro is a workaround for the fact that HP/UX gcc */ /* appears to otherwise store 64-bit pointers in ar.ccv, i.e. it */ /* doesn't appear to clear high bits in a pointer value we pass into */ /* assembly code, even if it is supposedly of type AO_t. */ # define AO_IN_ADDR "1"(addr) # define AO_OUT_ADDR , "=r"(addr) # define AO_SWIZZLE "addp4 %1=0,%1;;\n" # define AO_MASK(ptr) __asm__("zxt4 %1=%1": "=r"(ptr) : "0"(ptr)); #else # define AO_LEN "8" # define AO_IN_ADDR "r"(addr) # define AO_OUT_ADDR # define AO_SWIZZLE # define AO_MASK(ptr) #endif AO_INLINE void AO_nop_full() { __asm__ __volatile__("mf" : : : "memory"); } #define AO_HAVE_nop_full AO_INLINE AO_t AO_fetch_and_add1_acquire (volatile AO_t *addr) { AO_t result; __asm__ __volatile__ (AO_SWIZZLE "fetchadd" AO_LEN ".acq %0=[%1],1": "=r" (result) AO_OUT_ADDR: AO_IN_ADDR :"memory"); return result; } #define AO_HAVE_fetch_and_add1_acquire AO_INLINE AO_t AO_fetch_and_add1_release (volatile AO_t *addr) { AO_t result; __asm__ __volatile__ (AO_SWIZZLE "fetchadd" AO_LEN ".rel %0=[%1],1": "=r" (result) AO_OUT_ADDR: AO_IN_ADDR :"memory"); return result; } #define AO_HAVE_fetch_and_add1_release AO_INLINE AO_t AO_fetch_and_sub1_acquire (volatile AO_t *addr) { AO_t result; __asm__ __volatile__ (AO_SWIZZLE "fetchadd" AO_LEN ".acq %0=[%1],-1": "=r" (result) AO_OUT_ADDR: AO_IN_ADDR :"memory"); return result; } #define AO_HAVE_fetch_and_sub1_acquire AO_INLINE AO_t AO_fetch_and_sub1_release (volatile AO_t *addr) { AO_t result; __asm__ __volatile__ (AO_SWIZZLE "fetchadd" AO_LEN ".rel %0=[%1],-1": "=r" (result) AO_OUT_ADDR: AO_IN_ADDR :"memory"); return result; } #define AO_HAVE_fetch_and_sub1_release #ifndef _ILP32 AO_INLINE unsigned int AO_int_fetch_and_add1_acquire (volatile unsigned int *addr) { unsigned int result; __asm__ __volatile__ ("fetchadd4.acq %0=[%1],1": "=r" (result): AO_IN_ADDR :"memory"); return result; } #define AO_HAVE_int_fetch_and_add1_acquire AO_INLINE unsigned int AO_int_fetch_and_add1_release (volatile unsigned int *addr) { unsigned int result; __asm__ __volatile__ ("fetchadd4.rel %0=[%1],1": "=r" (result): AO_IN_ADDR :"memory"); return result; } #define AO_HAVE_int_fetch_and_add1_release AO_INLINE unsigned int AO_int_fetch_and_sub1_acquire (volatile unsigned int *addr) { unsigned int result; __asm__ __volatile__ ("fetchadd4.acq %0=[%1],-1": "=r" (result): AO_IN_ADDR :"memory"); return result; } #define AO_HAVE_int_fetch_and_sub1_acquire AO_INLINE unsigned int AO_int_fetch_and_sub1_release (volatile unsigned int *addr) { unsigned int result; __asm__ __volatile__ ("fetchadd4.rel %0=[%1],-1": "=r" (result): AO_IN_ADDR :"memory"); return result; } #define AO_HAVE_int_fetch_and_sub1_release #endif /* !_ILP32 */ AO_INLINE int AO_compare_and_swap_acquire(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t oldval; AO_MASK(old); __asm__ __volatile__(AO_SWIZZLE "mov ar.ccv=%[old] ;; cmpxchg" AO_LEN ".acq %0=[%1],%[new_val],ar.ccv" : "=r"(oldval) AO_OUT_ADDR : AO_IN_ADDR, [new_val]"r"(new_val), [old]"r"(old) : "memory"); return (oldval == old); } #define AO_HAVE_compare_and_swap_acquire AO_INLINE int AO_compare_and_swap_release(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t oldval; AO_MASK(old); __asm__ __volatile__(AO_SWIZZLE "mov ar.ccv=%[old] ;; cmpxchg" AO_LEN ".rel %0=[%1],%[new_val],ar.ccv" : "=r"(oldval) AO_OUT_ADDR : AO_IN_ADDR, [new_val]"r"(new_val), [old]"r"(old) : "memory"); return (oldval == old); } #define AO_HAVE_compare_and_swap_release AO_INLINE int AO_char_compare_and_swap_acquire(volatile unsigned char *addr, unsigned char old, unsigned char new_val) { unsigned char oldval; __asm__ __volatile__(AO_SWIZZLE "mov ar.ccv=%[old] ;; cmpxchg1.acq %0=[%1],%[new_val],ar.ccv" : "=r"(oldval) AO_OUT_ADDR : AO_IN_ADDR, [new_val]"r"(new_val), [old]"r"((AO_t)old) : "memory"); return (oldval == old); } #define AO_HAVE_char_compare_and_swap_acquire AO_INLINE int AO_char_compare_and_swap_release(volatile unsigned char *addr, unsigned char old, unsigned char new_val) { unsigned char oldval; __asm__ __volatile__(AO_SWIZZLE "mov ar.ccv=%[old] ;; cmpxchg1.rel %0=[%1],%[new_val],ar.ccv" : "=r"(oldval) AO_OUT_ADDR : AO_IN_ADDR, [new_val]"r"(new_val), [old]"r"((AO_t)old) : "memory"); return (oldval == old); } #define AO_HAVE_char_compare_and_swap_release AO_INLINE int AO_short_compare_and_swap_acquire(volatile unsigned short *addr, unsigned short old, unsigned short new_val) { unsigned short oldval; __asm__ __volatile__(AO_SWIZZLE "mov ar.ccv=%[old] ;; cmpxchg2.acq %0=[%1],%[new_val],ar.ccv" : "=r"(oldval) AO_OUT_ADDR : AO_IN_ADDR, [new_val]"r"(new_val), [old]"r"((AO_t)old) : "memory"); return (oldval == old); } #define AO_HAVE_short_compare_and_swap_acquire AO_INLINE int AO_short_compare_and_swap_release(volatile unsigned short *addr, unsigned short old, unsigned short new_val) { unsigned short oldval; __asm__ __volatile__(AO_SWIZZLE "mov ar.ccv=%[old] ;; cmpxchg2.rel %0=[%1],%[new_val],ar.ccv" : "=r"(oldval) AO_OUT_ADDR : AO_IN_ADDR, [new_val]"r"(new_val), [old]"r"((AO_t)old) : "memory"); return (oldval == old); } #define AO_HAVE_short_compare_and_swap_release #ifndef _ILP32 AO_INLINE int AO_int_compare_and_swap_acquire(volatile unsigned int *addr, unsigned int old, unsigned int new_val) { unsigned int oldval; __asm__ __volatile__("mov ar.ccv=%3 ;; cmpxchg4.acq %0=[%1],%2,ar.ccv" : "=r"(oldval) : AO_IN_ADDR, "r"(new_val), "r"((AO_t)old) : "memory"); return (oldval == old); } #define AO_HAVE_int_compare_and_swap_acquire AO_INLINE int AO_int_compare_and_swap_release(volatile unsigned int *addr, unsigned int old, unsigned int new_val) { unsigned int oldval; __asm__ __volatile__("mov ar.ccv=%3 ;; cmpxchg4.rel %0=[%1],%2,ar.ccv" : "=r"(oldval) : AO_IN_ADDR, "r"(new_val), "r"((AO_t)old) : "memory"); return (oldval == old); } #define AO_HAVE_int_compare_and_swap_release #endif /* !_ILP32 */ /* FIXME: Add compare_and_swap_double as soon as there is widely */ /* available hardware that implements it. */ /* FIXME: Add compare_double_and_swap_double for the _ILP32 case. */ #ifdef _ILP32 # include "../ao_t_is_int.h" #endif synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/gcc/s390.h0000664000076400007640000000444311104702315026532 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved. * * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */ /* FIXME: untested. */ /* The relevant documentation appears to be at */ /* http://publibz.boulder.ibm.com/epubs/pdf/dz9zr003.pdf */ /* around page 5-96. Apparently: */ /* - Memory references in general are atomic only for a single */ /* byte. But it appears that the most common load/store */ /* instructions also guarantee atomicity for aligned */ /* operands of standard types. WE FOOLISHLY ASSUME that */ /* compilers only generate those. If that turns out to be */ /* wrong, we need inline assembly code for AO_load and */ /* AO_store. */ /* - A store followed by a load is unordered since the store */ /* may be delayed. Otherwise everything is ordered. */ /* - There is a hardware compare-and-swap (CS) instruction. */ #include "ordered_except_wr.h" #include "all_aligned_atomic_load_store.h" #include "../test_and_set_t_is_ao_t.h" /* FIXME: Is there a way to do byte-sized test-and-set? */ /* FIXME: AO_nop_full should probably be implemented directly. */ /* It appears that certain BCR instructions have that effect. */ /* Presumably they're cheaper than CS? */ AO_INLINE AO_t AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) { int retval; __asm__ __volatile__ ( # ifndef __s390x__ " cs %1,%2,0(%3)\n" # else " csg %1,%2,0(%3)\n" # endif " ipm %0\n" " srl %0,28\n" : "=&d" (retval), "+d" (old) : "d" (new_val), "a" (addr) : "cc", "memory"); return retval == 0; } #define AO_HAVE_compare_and_swap_full /* FIXME: Add double-wide compare-and-swap for 32-bit executables. */ synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/gcc/x86.h0000664000076400007640000001057611104702315026465 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved. * * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * * Some of the machine specific code was borrowed from our GC distribution. */ /* The following really assume we have a 486 or better. Unfortunately */ /* gcc doesn't define a suitable feature test macro based on command */ /* line options. */ /* We should perhaps test dynamically. */ #include "../all_aligned_atomic_load_store.h" /* Real X86 implementations, except for some old WinChips, appear */ /* to enforce ordering between memory operations, EXCEPT that a later */ /* read can pass earlier writes, presumably due to the visible */ /* presence of store buffers. */ /* We ignore both the WinChips, and the fact that the official specs */ /* seem to be much weaker (and arguably too weak to be usable). */ #include "../ordered_except_wr.h" #include "../test_and_set_t_is_char.h" #include "../standard_ao_double_t.h" #if defined(AO_USE_PENTIUM4_INSTRS) AO_INLINE void AO_nop_full() { __asm__ __volatile__("mfence" : : : "memory"); } #define AO_HAVE_nop_full #else /* We could use the cpuid instruction. But that seems to be slower */ /* than the default implementation based on test_and_set_full. Thus */ /* we omit that bit of misinformation here. */ #endif /* As far as we can tell, the lfence and sfence instructions are not */ /* currently needed or useful for cached memory accesses. */ /* Really only works for 486 and later */ AO_INLINE AO_t AO_fetch_and_add_full (volatile AO_t *p, AO_t incr) { AO_t result; __asm__ __volatile__ ("lock; xaddl %0, %1" : "=r" (result), "=m" (*p) : "0" (incr), "m" (*p) : "memory"); return result; } #define AO_HAVE_fetch_and_add_full AO_INLINE unsigned char AO_char_fetch_and_add_full (volatile unsigned char *p, unsigned char incr) { unsigned char result; __asm__ __volatile__ ("lock; xaddb %0, %1" : "=q" (result), "=m" (*p) : "0" (incr), "m" (*p) : "memory"); return result; } #define AO_HAVE_char_fetch_and_add_full AO_INLINE unsigned short AO_short_fetch_and_add_full (volatile unsigned short *p, unsigned short incr) { unsigned short result; __asm__ __volatile__ ("lock; xaddw %0, %1" : "=r" (result), "=m" (*p) : "0" (incr), "m" (*p) : "memory"); return result; } #define AO_HAVE_short_fetch_and_add_full /* Really only works for 486 and later */ AO_INLINE void AO_or_full (volatile AO_t *p, AO_t incr) { __asm__ __volatile__ ("lock; orl %1, %0" : "=m" (*p) : "r" (incr), "m" (*p) : "memory"); } #define AO_HAVE_or_full AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { unsigned char oldval; /* Note: the "xchg" instruction does not need a "lock" prefix */ __asm__ __volatile__("xchgb %0, %1" : "=q"(oldval), "=m"(*addr) : "0"(0xff), "m"(*addr) : "memory"); return (AO_TS_VAL_t)oldval; } #define AO_HAVE_test_and_set_full /* Returns nonzero if the comparison succeeded. */ AO_INLINE int AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) { char result; __asm__ __volatile__("lock; cmpxchgl %3, %0; setz %1" : "=m"(*addr), "=q"(result) : "m"(*addr), "r" (new_val), "a"(old) : "memory"); return (int) result; } #define AO_HAVE_compare_and_swap_full /* Returns nonzero if the comparison succeeded. */ /* Really requires at least a Pentium. */ AO_INLINE int AO_compare_double_and_swap_double_full(volatile AO_double_t *addr, AO_t old_val1, AO_t old_val2, AO_t new_val1, AO_t new_val2) { char result; __asm__ __volatile__("lock; cmpxchg8b %0; setz %1" : "=m"(*addr), "=q"(result) : "m"(*addr), "d" (old_val1), "a" (old_val2), "c" (new_val1), "b" (new_val2) : "memory"); return (int) result; } #define AO_HAVE_double_compare_and_swap_full #include "../ao_t_is_int.h" synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/gcc/cris.h0000664000076400007640000000547411104702315027001 0ustar stefanstefan/* * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. * * 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. * * Most of this code originally comes from Hans-Peter Nilsson. It is included * here with his permission. * * This version has not been tested. It was coped here from a GC * patch so that we wouldn't lose the code in the upgrade to gc7. */ #include "../all_atomic_load_store.h" #include "../ordered.h" /* There are no multiprocessor implementations. */ #include "../test_and_set_t_is_ao_t.h" /* * The architecture apparently supports an "f" flag which is * set on preemption. This essentially gives us load-locked, * store-conditional primitives, though I'm not quite sure how * this would work on a hypothetical multiprocessor. -HB * * For details, see * http://developer.axis.com/doc/hardware/etrax100lx/prog_man/ * 1_architectural_description.pdf * * Presumably many other primitives (notably CAS, including the double- * width versions) could be implemented in this manner, if someone got * around to it. */ AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { /* Ripped from linuxthreads/sysdeps/cris/pt-machine.h */ register unsigned long int ret; /* Note the use of a dummy output of *addr to expose the write. The memory barrier is to stop *other* writes being moved past this code. */ __asm__ __volatile__("clearf\n" "0:\n\t" "movu.b [%2],%0\n\t" "ax\n\t" "move.b %3,[%2]\n\t" "bwf 0b\n\t" "clearf" : "=&r" (ret), "=m" (*addr) : "r" (addr), "r" ((int) 1), "m" (*addr) : "memory"); return ret; } #define AO_HAVE_test_and_set_full synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/gcc/hppa.h0000664000076400007640000000723211104702315026763 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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. * * Modified by Carlos O'Donell , 2003 * - Added self-aligning lock. * */ #include "../all_atomic_load_store.h" /* Some architecture set descriptions include special "ordered" memory */ /* operations. As far as we can tell, no existing processors actually */ /* require those. Nor does it appear likely that future processors */ /* will. */ #include "../ordered.h" /* GCC will not guarantee the alignment we need, use four lock words */ /* and select the correctly aligned datum. See the glibc 2.3.2 */ /* linuxthread port for the original implementation. */ struct AO_pa_clearable_loc { int data[4]; }; #undef AO_TS_INITIALIZER #define AO_TS_t struct AO_pa_clearable_loc #define AO_TS_INITIALIZER {1,1,1,1} /* Switch meaning of set and clear, since we only have an atomic clear */ /* instruction. */ typedef enum {AO_PA_TS_set = 0, AO_PA_TS_clear = 1} AO_PA_TS_val; #define AO_TS_VAL_t AO_PA_TS_val #define AO_TS_CLEAR AO_PA_TS_clear #define AO_TS_SET AO_PA_TS_set /* The hppa only has one atomic read and modify memory operation, */ /* load and clear, so hppa spinlocks must use zero to signify that */ /* someone is holding the lock. The address used for the ldcw */ /* semaphore must be 16-byte aligned. */ #define __ldcw(a) ({ \ volatile unsigned int __ret; \ __asm__ __volatile__("ldcw 0(%2),%0" \ : "=r" (__ret), "=m" (*(a)) : "r" (a)); \ __ret; \ }) /* Because malloc only guarantees 8-byte alignment for malloc'd data, */ /* and GCC only guarantees 8-byte alignment for stack locals, we can't */ /* be assured of 16-byte alignment for atomic lock data even if we */ /* specify "__attribute ((aligned(16)))" in the type declaration. So, */ /* we use a struct containing an array of four ints for the atomic lock */ /* type and dynamically select the 16-byte aligned int from the array */ /* for the semaphore. */ #define __PA_LDCW_ALIGNMENT 16 #define __ldcw_align(a) ({ \ unsigned long __ret = (unsigned long) a; \ __ret += __PA_LDCW_ALIGNMENT - 1; \ __ret &= ~(__PA_LDCW_ALIGNMENT - 1); \ (volatile unsigned int *) __ret; \ }) /* Works on PA 1.1 and PA 2.0 systems */ AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t * addr) { volatile unsigned int *a = __ldcw_align (addr); return (AO_TS_VAL_t) __ldcw (a); } AO_INLINE void AO_pa_clear(volatile AO_TS_t * addr) { volatile unsigned int *a = __ldcw_align (addr); AO_compiler_barrier(); *a = 1; } #define AO_CLEAR(addr) AO_pa_clear(addr) #define AO_HAVE_test_and_set_full synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/gcc/sparc.h0000664000076400007640000000304211104702315027136 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved. * * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */ /* FIXME. Very incomplete. No support for sparc64. */ /* Non-ancient SPARCs provide compare-and-swap (casa). */ /* We should make that available. */ #include "../all_atomic_load_store.h" /* Real SPARC code uses TSO: */ #include "../ordered_except_wr.h" /* Test_and_set location is just a byte. */ #include "../test_and_set_t_is_char.h" AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { int oldval; __asm__ __volatile__("ldstub %1,%0" : "=r"(oldval), "=m"(*addr) : "m"(*addr) : "memory"); return oldval; } #define AO_HAVE_test_and_set_full /* FIXME: This needs to be extended for SPARC v8 and v9. */ /* SPARC V8 also has swap. V9 has CAS. */ /* There are barriers like membar #LoadStore. */ /* CASA (32-bit) and CASXA(64-bit) instructions were */ /* added in V9. */ synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/char_acquire_release_volatile.h0000664000076400007640000000370611104702315033326 0ustar stefanstefan/* * Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * This file adds definitions appropriate for environments in which an unsigned char * volatile load has acquire semantics, and an unsigned char volatile store has release * semantics. This is true with the standard Itanium ABI. */ #if !defined(AO_GCC_BARRIER) # if defined(__GNUC__) # define AO_GCC_BARRIER() AO_compiler_barrier() # else # define AO_GCC_BARRIER() # endif #endif AO_INLINE unsigned char AO_char_load_acquire(volatile unsigned char *p) { unsigned char result = *p; /* A normal volatile load generates an ld.acq */ AO_GCC_BARRIER(); return result; } #define AO_HAVE_char_load_acquire AO_INLINE void AO_char_store_release(volatile unsigned char *p, unsigned char val) { AO_GCC_BARRIER(); /* A normal volatile store generates an st.rel */ *p = val; } #define AO_HAVE_char_store_release synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/standard_ao_double_t.h0000664000076400007640000000030711104702315031427 0ustar stefanstefantypedef union { unsigned long long AO_whole; struct {AO_t AO_v1; AO_t AO_v2;} AO_parts; } AO_double_t; #define AO_HAVE_double_t #define AO_val1 AO_parts.AO_v1 #define AO_val2 AO_parts.AO_v2 synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/short_aligned_atomic_load_store.h0000664000076400007640000000341611104702315033670 0ustar stefanstefan/* * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * Definitions for architecturs on which loads and stores of unsigned short are * atomic fo all legal alignments. */ AO_INLINE unsigned short AO_short_load(volatile unsigned short *addr) { assert(((size_t)addr & (sizeof(unsigned short) - 1)) == 0); /* Cast away the volatile for architectures like IA64 where */ /* volatile adds barrier semantics. */ return (*(unsigned short *)addr); } #define AO_HAVE_short_load AO_INLINE void AO_short_store(volatile unsigned short *addr, unsigned short new_val) { assert(((size_t)addr & (sizeof(unsigned short) - 1)) == 0); (*(unsigned short *)addr) = new_val; } #define AO_HAVE_short_store synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h0000664000076400007640000000312311104702315031766 0ustar stefanstefan/* * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * These are common definitions for architectures on which test_and_set * operates on pointer-sized quantities, the "clear" value contains * all zeroes, and the "set" value contains all ones. * This can be used if test_and_set is synthesized from compare_and_swap. */ typedef enum {AO_TS_clear = 0, AO_TS_set = 1} AO_TS_val; #define AO_TS_VAL_t AO_TS_val #define AO_TS_CLEAR AO_TS_clear #define AO_TS_SET AO_TS_set #define AO_TS_t AO_t #define AO_AO_TS_T 1 synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/ao_t_is_int.h0000664000076400007640000001160411104702315027564 0ustar stefanstefan/* * Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * Inclusion of this file signifies that AO_t is in fact int. Hence * any AO_... operations can also server as AO_int_... operations. * We currently define only the more important ones here, and allow for * the normal generalization process to define the others. * We should probably add others in the future. */ #if defined(AO_HAVE_compare_and_swap_full) && \ !defined(AO_HAVE_int_compare_and_swap_full) # define AO_int_compare_and_swap_full(addr, old, new_val) \ AO_compare_and_swap_full((volatile AO_t *)addr, \ (AO_t) old, (AO_t)new_val) # define AO_HAVE_int_compare_and_swap_full # endif #if defined(AO_HAVE_compare_and_swap_acquire) && \ !defined(AO_HAVE_int_compare_and_swap_acquire) # define AO_int_compare_and_swap_acquire(addr, old, new_val) \ AO_compare_and_swap_acquire((volatile AO_t *)addr, \ (AO_t) old, (AO_t)new_val) # define AO_HAVE_int_compare_and_swap_acquire # endif #if defined(AO_HAVE_compare_and_swap_release) && \ !defined(AO_HAVE_int_compare_and_swap_release) # define AO_int_compare_and_swap_release(addr, old, new_val) \ AO_compare_and_swap_release((volatile AO_t *)addr, \ (AO_t) old, (AO_t)new_val) # define AO_HAVE_int_compare_and_swap_release # endif #if defined(AO_HAVE_compare_and_swap_write) && \ !defined(AO_HAVE_int_compare_and_swap_write) # define AO_int_compare_and_swap_write(addr, old, new_val) \ AO_compare_and_swap_write((volatile AO_t *)addr, \ (AO_t) old, (AO_t)new_val) # define AO_HAVE_int_compare_and_swap_write # endif #if defined(AO_HAVE_compare_and_swap_read) && \ !defined(AO_HAVE_int_compare_and_swap_read) # define AO_int_compare_and_swap_read(addr, old, new_val) \ AO_compare_and_swap_read((volatile AO_t *)addr, \ (AO_t) old, (AO_t)new_val) # define AO_HAVE_int_compare_and_swap_read # endif #if defined(AO_HAVE_compare_and_swap) && \ !defined(AO_HAVE_int_compare_and_swap) # define AO_int_compare_and_swap(addr, old, new_val) \ AO_compare_and_swap((volatile AO_t *)addr, \ (AO_t) old, (AO_t)new_val) # define AO_HAVE_int_compare_and_swap # endif #if defined(AO_HAVE_load_acquire) && \ !defined(AO_HAVE_int_load_acquire) # define AO_int_load_acquire(addr) (int)AO_load_acquire((volatile AO_t *)addr) # define AO_HAVE_int_load_acquire # endif #if defined(AO_HAVE_store_release) && \ !defined(AO_HAVE_int_store_release) # define AO_int_store_release(addr, val) \ AO_store_release((volatile AO_t *)addr, (AO_t)val) # define AO_HAVE_int_store_release # endif #if defined(AO_HAVE_fetch_and_add_full) && \ !defined(AO_HAVE_int_fetch_and_add_full) # define AO_int_fetch_and_add_full(addr, incr) \ (int)AO_fetch_and_add_full((volatile AO_t *)addr, (AO_t)incr) # define AO_HAVE_int_fetch_and_add_full # endif #if defined(AO_HAVE_fetch_and_add1_acquire) && \ !defined(AO_HAVE_int_fetch_and_add1_acquire) # define AO_int_fetch_and_add1_acquire(addr) \ (int)AO_fetch_and_add1_acquire((volatile AO_t *)addr) # define AO_HAVE_int_fetch_and_add1_acquire # endif #if defined(AO_HAVE_fetch_and_add1_release) && \ !defined(AO_HAVE_int_fetch_and_add1_release) # define AO_int_fetch_and_add1_release(addr) \ (int)AO_fetch_and_add1_release((volatile AO_t *)addr) # define AO_HAVE_int_fetch_and_add1_release # endif #if defined(AO_HAVE_fetch_and_sub1_acquire) && \ !defined(AO_HAVE_int_fetch_and_sub1_acquire) # define AO_int_fetch_and_sub1_acquire(addr) \ (int)AO_fetch_and_sub1_acquire((volatile AO_t *)addr) # define AO_HAVE_int_fetch_and_sub1_acquire # endif #if defined(AO_HAVE_fetch_and_sub1_release) && \ !defined(AO_HAVE_int_fetch_and_sub1_release) # define AO_int_fetch_and_sub1_release(addr) \ (int)AO_fetch_and_sub1_release((volatile AO_t *)addr) # define AO_HAVE_int_fetch_and_sub1_release # endif synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/Makefile.in0000664000076400007640000003032611104702315027173 0ustar stefanstefan# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = src/atomic_ops/sysdeps DIST_COMMON = README $(nobase_sysdep_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(sysdepdir)" nobase_sysdepHEADERS_INSTALL = $(install_sh_DATA) HEADERS = $(nobase_sysdep_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@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ NEED_ASM_FALSE = @NEED_ASM_FALSE@ NEED_ASM_TRUE = @NEED_ASM_TRUE@ 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@ PICFLAG = @PICFLAG@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_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@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ #General sysdep utility headers, followed by the arch-specific ones nobase_sysdep_HEADERS = generic_pthread.h \ atomic_load_store.h \ aligned_atomic_load_store.h \ acquire_release_volatile.h \ char_acquire_release_volatile.h \ char_atomic_load_store.h \ short_acquire_release_volatile.h \ short_aligned_atomic_load_store.h \ short_atomic_load_store.h \ int_acquire_release_volatile.h \ int_aligned_atomic_load_store.h \ int_atomic_load_store.h \ all_acquire_release_volatile.h \ all_aligned_atomic_load_store.h \ all_atomic_load_store.h \ read_ordered.h \ ordered_except_wr.h \ ordered.h \ ao_t_is_int.h \ test_and_set_t_is_ao_t.h \ test_and_set_t_is_char.h \ emul_cas.h \ standard_ao_double_t.h \ README \ \ gcc/alpha.h gcc/arm.h gcc/x86.h \ gcc/hppa.h gcc/ia64.h \ gcc/powerpc.h gcc/sparc.h \ gcc/hppa.h gcc/m68k.h gcc/s390.h \ gcc/ia64.h gcc/x86_64.h gcc/cris.h \ \ icc/ia64.h \ \ msftc/x86.h \ msftc/x86_64.h \ \ hpc/ia64.h hpc/hppa.h \ \ sunc/sparc.h \ \ ibmc/powerpc.h sysdepdir = ${includedir}/atomic_ops/sysdeps # A few architectures require special .S files EXTRA_DIST = sunc/sparc.S all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/atomic_ops/sysdeps/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/atomic_ops/sysdeps/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-nobase_sysdepHEADERS: $(nobase_sysdep_HEADERS) @$(NORMAL_INSTALL) test -z "$(sysdepdir)" || $(mkdir_p) "$(DESTDIR)$(sysdepdir)" @$(am__vpath_adj_setup) \ list='$(nobase_sysdep_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ $(am__vpath_adj) \ echo " $(nobase_sysdepHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sysdepdir)/$$f'"; \ $(nobase_sysdepHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sysdepdir)/$$f"; \ done uninstall-nobase_sysdepHEADERS: @$(NORMAL_UNINSTALL) @$(am__vpath_adj_setup) \ list='$(nobase_sysdep_HEADERS)'; for p in $$list; do \ $(am__vpath_adj) \ echo " rm -f '$(DESTDIR)$(sysdepdir)/$$f'"; \ rm -f "$(DESTDIR)$(sysdepdir)/$$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) $(mkdir_p) $(distdir)/gcc $(distdir)/hpc $(distdir)/ibmc $(distdir)/icc $(distdir)/msftc $(distdir)/sunc @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 $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sysdepdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-nobase_sysdepHEADERS install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am uninstall-nobase_sysdepHEADERS .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ ctags distclean distclean-generic distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-exec install-exec-am \ install-info install-info-am install-man \ install-nobase_sysdepHEADERS install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am \ uninstall-nobase_sysdepHEADERS # 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: synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/icc/0000775000076400007640000000000011172123233025661 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/icc/ia64.h0000664000076400007640000001363611104702315026605 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * 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. */ /* * This file specifies Itanimum primitives for use with the Intel (ecc) * compiler. We use intrinsics instead of the inline assembly code in the * gcc file. */ #include "../all_atomic_load_store.h" #include "../test_and_set_t_is_char.h" #include /* The acquire release semantics of volatile can be turned off. And volatile */ /* operations in icc9 don't imply ordering with respect to other nonvolatile */ /* operations. */ #define AO_INTEL_PTR_t void * AO_INLINE AO_t AO_load_acquire(volatile AO_t *p) { return (AO_t)(__ld8_acq((AO_INTEL_PTR_t)p)); } #define AO_HAVE_load_acquire AO_INLINE void AO_store_release(volatile AO_t *p, AO_t val) { __st8_rel((AO_INTEL_PTR_t)p, (__int64)val); } #define AO_HAVE_store_release AO_INLINE unsigned char AO_char_load_acquire(volatile unsigned char *p) { /* A normal volatile load generates an ld.acq */ return (__ld1_acq((AO_INTEL_PTR_t)p)); } #define AO_HAVE_char_load_acquire AO_INLINE void AO_char_store_release(volatile unsigned char *p, unsigned char val) { __st1_rel((AO_INTEL_PTR_t)p, val); } #define AO_HAVE_char_store_release AO_INLINE unsigned short AO_short_load_acquire(volatile unsigned short *p) { /* A normal volatile load generates an ld.acq */ return (__ld2_acq((AO_INTEL_PTR_t)p)); } #define AO_HAVE_short_load_acquire AO_INLINE void AO_short_store_release(volatile unsigned short *p, unsigned short val) { __st2_rel((AO_INTEL_PTR_t)p, val); } #define AO_HAVE_short_store_release AO_INLINE unsigned int AO_int_load_acquire(volatile unsigned int *p) { /* A normal volatile load generates an ld.acq */ return (__ld4_acq((AO_INTEL_PTR_t)p)); } #define AO_HAVE_int_load_acquire AO_INLINE void AO_int_store_release(volatile unsigned int *p, unsigned int val) { __st4_rel((AO_INTEL_PTR_t)p, val); } #define AO_HAVE_int_store_release AO_INLINE void AO_nop_full() { __mf(); } #define AO_HAVE_nop_full AO_INLINE AO_t AO_fetch_and_add1_acquire (volatile AO_t *p) { return __fetchadd8_acq((unsigned __int64 *)p, 1); } #define AO_HAVE_fetch_and_add1_acquire AO_INLINE AO_t AO_fetch_and_add1_release (volatile AO_t *p) { return __fetchadd8_rel((unsigned __int64 *)p, 1); } #define AO_HAVE_fetch_and_add1_release AO_INLINE AO_t AO_fetch_and_sub1_acquire (volatile AO_t *p) { return __fetchadd8_acq((unsigned __int64 *)p, -1); } #define AO_HAVE_fetch_and_sub1_acquire AO_INLINE AO_t AO_fetch_and_sub1_release (volatile AO_t *p) { return __fetchadd8_rel((unsigned __int64 *)p, -1); } #define AO_HAVE_fetch_and_sub1_release AO_INLINE int AO_compare_and_swap_acquire(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t oldval; oldval = _InterlockedCompareExchange64_acq(addr, new_val, old); return (oldval == old); } #define AO_HAVE_compare_and_swap_acquire AO_INLINE int AO_compare_and_swap_release(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t oldval; oldval = _InterlockedCompareExchange64_rel(addr, new_val, old); return (oldval == old); } #define AO_HAVE_compare_and_swap_release AO_INLINE int AO_char_compare_and_swap_acquire(volatile unsigned char *addr, unsigned char old, unsigned char new_val) { unsigned char oldval; oldval = _InterlockedCompareExchange8_acq(addr, new_val, old); return (oldval == old); } #define AO_HAVE_char_compare_and_swap_acquire AO_INLINE int AO_char_compare_and_swap_release(volatile unsigned char *addr, unsigned char old, unsigned char new_val) { unsigned char oldval; oldval = _InterlockedCompareExchange8_rel(addr, new_val, old); return (oldval == old); } #define AO_HAVE_char_compare_and_swap_release AO_INLINE int AO_short_compare_and_swap_acquire(volatile unsigned short *addr, unsigned short old, unsigned short new_val) { unsigned short oldval; oldval = _InterlockedCompareExchange16_acq(addr, new_val, old); return (oldval == old); } #define AO_HAVE_short_compare_and_swap_acquire AO_INLINE int AO_short_compare_and_swap_release(volatile unsigned short *addr, unsigned short old, unsigned short new_val) { unsigned short oldval; oldval = _InterlockedCompareExchange16_rel(addr, new_val, old); return (oldval == old); } #define AO_HAVE_short_compare_and_swap_release AO_INLINE int AO_int_compare_and_swap_acquire(volatile unsigned int *addr, unsigned int old, unsigned int new_val) { unsigned int oldval; oldval = _InterlockedCompareExchange_acq(addr, new_val, old); return (oldval == old); } #define AO_HAVE_int_compare_and_swap_acquire AO_INLINE int AO_int_compare_and_swap_release(volatile unsigned int *addr, unsigned int old, unsigned int new_val) { unsigned int oldval; oldval = _InterlockedCompareExchange_rel(addr, new_val, old); return (oldval == old); } #define AO_HAVE_int_compare_and_swap_release synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/all_acquire_release_volatile.h0000664000076400007640000000275111104702315033160 0ustar stefanstefan/* * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * Describes architectures on which volatile AO_t, unsigned char, unsigned * short, and unsigned int loads and stores have acquire/release semantics for * all normally legal alignments. */ #include "acquire_release_volatile.h" #include "char_acquire_release_volatile.h" #include "short_acquire_release_volatile.h" #include "int_acquire_release_volatile.h" synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/acquire_release_volatile.h0000664000076400007640000000437611104702315032335 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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. */ /* * This file adds definitions appropriate for environments in which an AO_t * volatile load has acquire semantics, and an AO_t volatile store has release * semantics. This is arguably supposed to be true with the standard Itanium * software conventions. */ /* * Empirically gcc/ia64 does some reordering of ordinary operations around volatiles * even when we think it shouldn't. Gcc 3.3 and earlier could reorder a volatile store * with another store. As of March 2005, gcc pre-4 reused previously computed * common subexpressions across a volatile load. * Hence we now add compiler barriers for gcc. */ #if !defined(AO_GCC_BARRIER) # if defined(__GNUC__) # define AO_GCC_BARRIER() AO_compiler_barrier() # else # define AO_GCC_BARRIER() # endif #endif AO_INLINE AO_t AO_load_acquire(volatile AO_t *p) { AO_t result = *p; /* A normal volatile load generates an ld.acq */ AO_GCC_BARRIER(); return result; } #define AO_HAVE_load_acquire AO_INLINE void AO_store_release(volatile AO_t *p, AO_t val) { AO_GCC_BARRIER(); /* A normal volatile store generates an st.rel */ *p = val; } #define AO_HAVE_store_release synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/char_atomic_load_store.h0000664000076400007640000000322011104702315031754 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * 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. */ /* * Definitions for architecturs on which loads and stores of unsigned char are * atomic for all legal alignments. */ AO_INLINE unsigned char AO_char_load(volatile unsigned char *addr) { /* Cast away the volatile for architectures like IA64 where */ /* volatile adds barrier semantics. */ return (*(unsigned char *)addr); } #define AO_HAVE_char_load AO_INLINE void AO_char_store(volatile unsigned char *addr, unsigned char new_val) { (*(unsigned char *)addr) = new_val; } #define AO_HAVE_char_store synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/Makefile.am0000664000076400007640000000226111104702315027157 0ustar stefanstefan#General sysdep utility headers, followed by the arch-specific ones nobase_sysdep_HEADERS= generic_pthread.h \ atomic_load_store.h \ aligned_atomic_load_store.h \ acquire_release_volatile.h \ char_acquire_release_volatile.h \ char_atomic_load_store.h \ short_acquire_release_volatile.h \ short_aligned_atomic_load_store.h \ short_atomic_load_store.h \ int_acquire_release_volatile.h \ int_aligned_atomic_load_store.h \ int_atomic_load_store.h \ all_acquire_release_volatile.h \ all_aligned_atomic_load_store.h \ all_atomic_load_store.h \ read_ordered.h \ ordered_except_wr.h \ ordered.h \ ao_t_is_int.h \ test_and_set_t_is_ao_t.h \ test_and_set_t_is_char.h \ emul_cas.h \ standard_ao_double_t.h \ README \ \ gcc/alpha.h gcc/arm.h gcc/x86.h \ gcc/hppa.h gcc/ia64.h \ gcc/powerpc.h gcc/sparc.h \ gcc/hppa.h gcc/m68k.h gcc/s390.h \ gcc/ia64.h gcc/x86_64.h gcc/cris.h \ \ icc/ia64.h \ \ msftc/x86.h \ msftc/x86_64.h \ \ hpc/ia64.h hpc/hppa.h \ \ sunc/sparc.h \ \ ibmc/powerpc.h sysdepdir= ${includedir}/atomic_ops/sysdeps # A few architectures require special .S files EXTRA_DIST = sunc/sparc.S synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/aligned_atomic_load_store.h0000664000076400007640000000322111104702315032443 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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. */ /* * Definitions for architecturs on which loads and stores of AO_t are * atomic fo all legal alignments. */ AO_INLINE AO_t AO_load(volatile AO_t *addr) { assert(((size_t)addr & (sizeof(AO_t) - 1)) == 0); /* Cast away the volatile for architectures where */ /* volatile adds barrier semantics. */ return *(AO_t *)addr; } #define AO_HAVE_load AO_INLINE void AO_store(volatile AO_t *addr, AO_t new_val) { assert(((size_t)addr & (sizeof(AO_t) - 1)) == 0); (*(AO_t *)addr) = new_val; } #define AO_HAVE_store synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/sysdeps/ordered_except_wr.h0000664000076400007640000000567711104702315031016 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * 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. */ /* * These are common definitions for architectures that provide processor * ordered memory operations except that a later read may pass an * earlier write. Real x86 implementations seem to be in this category, * except apparently for some IDT WinChips, which we ignore. */ #include "read_ordered.h" AO_INLINE void AO_nop_write() { AO_compiler_barrier(); /* sfence according to Intel docs. Pentium 3 and up. */ /* Unnecessary for cached accesses? */ } #define AO_HAVE_NOP_WRITE #if defined(AO_HAVE_store) AO_INLINE void AO_store_write(volatile AO_t *addr, AO_t val) { AO_compiler_barrier(); AO_store(addr, val); } # define AO_HAVE_store_write # define AO_store_release(addr, val) AO_store_write(addr, val) # define AO_HAVE_store_release #endif /* AO_HAVE_store */ #if defined(AO_HAVE_char_store) AO_INLINE void AO_char_store_write(volatile unsigned char *addr, unsigned char val) { AO_compiler_barrier(); AO_char_store(addr, val); } # define AO_HAVE_char_store_write # define AO_char_store_release(addr, val) AO_char_store_write(addr, val) # define AO_HAVE_char_store_release #endif /* AO_HAVE_char_store */ #if defined(AO_HAVE_short_store) AO_INLINE void AO_short_store_write(volatile unsigned short *addr, unsigned short val) { AO_compiler_barrier(); AO_short_store(addr, val); } # define AO_HAVE_short_store_write # define AO_short_store_release(addr, val) AO_short_store_write(addr, val) # define AO_HAVE_short_store_release #endif /* AO_HAVE_short_store */ #if defined(AO_HAVE_int_store) AO_INLINE void AO_int_store_write(volatile unsigned int *addr, unsigned int val) { AO_compiler_barrier(); AO_int_store(addr, val); } # define AO_HAVE_int_store_write # define AO_int_store_release(addr, val) AO_int_store_write(addr, val) # define AO_HAVE_int_store_release #endif /* AO_HAVE_int_store */ synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/Makefile.in0000664000076400007640000003523011104702315025500 0ustar stefanstefan# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 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@ target_triplet = @target@ subdir = src/atomic_ops DIST_COMMON = $(private_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(privatedir)" privateHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(private_HEADERS) ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ NEED_ASM_FALSE = @NEED_ASM_FALSE@ NEED_ASM_TRUE = @NEED_ASM_TRUE@ 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@ PICFLAG = @PICFLAG@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ 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__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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ SUBDIRS = sysdeps EXTRA_DIST = generalize-small.template #Private Headers private_HEADERS = generalize.h generalize-small.h privatedir = ${includedir}/atomic_ops/ all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/atomic_ops/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/atomic_ops/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-privateHEADERS: $(private_HEADERS) @$(NORMAL_INSTALL) test -z "$(privatedir)" || $(mkdir_p) "$(DESTDIR)$(privatedir)" @list='$(private_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(privateHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(privatedir)/$$f'"; \ $(privateHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(privatedir)/$$f"; \ done uninstall-privateHEADERS: @$(NORMAL_UNINSTALL) @list='$(private_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(privatedir)/$$f'"; \ rm -f "$(DESTDIR)$(privatedir)/$$f"; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done 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) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ 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) $(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 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 check-am: all-am check: check-recursive all-am: Makefile $(HEADERS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(privatedir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-privateHEADERS install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-info-am uninstall-privateHEADERS uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ clean clean-generic clean-recursive ctags ctags-recursive \ distclean distclean-generic distclean-recursive 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-privateHEADERS install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic maintainer-clean-recursive \ mostlyclean mostlyclean-generic mostlyclean-recursive pdf \ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ uninstall-info-am uninstall-privateHEADERS generalize-small.h: generalize-small.template sed -e s:XSIZE:char:g -e s:XCTYPE:char:g $? > $@ sed -e s:XSIZE:short:g -e s:XCTYPE:short:g $? >> $@ sed -e s:XSIZE:int:g -e s:XCTYPE:int:g $? >> $@ # 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: synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/Makefile.am0000664000076400007640000000054411104702315025467 0ustar stefanstefanSUBDIRS=sysdeps EXTRA_DIST=generalize-small.template #Private Headers private_HEADERS=generalize.h generalize-small.h privatedir=${includedir}/atomic_ops/ generalize-small.h: generalize-small.template sed -e s:XSIZE:char:g -e s:XCTYPE:char:g $? > $@ sed -e s:XSIZE:short:g -e s:XCTYPE:short:g $? >> $@ sed -e s:XSIZE:int:g -e s:XCTYPE:int:g $? >> $@ synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops/generalize.h0000664000076400007640000013056011104702315025733 0ustar stefanstefan/* * Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * Generalize atomic operations for atomic_ops.h. * Should not be included directly. * * We make no attempt to define useless operations, such as * AO_nop_acquire * AO_nop_release * * We have also so far neglected to define some others, which * do not appear likely to be useful, e.g. stores with acquire * or read barriers. * * This file is sometimes included twice by atomic_ops.h. * All definitions include explicit checks that we are not replacing * an earlier definition. In general, more desirable expansions * appear earlier so that we are more likely to use them. * * We only make safe generalizations, except that by default we define * the ...dd_acquire_read operations to be equivalent to those without * a barrier. On platforms for which this is unsafe, the platform-specific * file must define AO_NO_DD_ORDERING. */ #ifndef ATOMIC_OPS_H # error Atomic_ops_generalize.h should not be included directly. #endif #if AO_CHAR_TS_T # define AO_TS_COMPARE_AND_SWAP_FULL(a,o,n) \ AO_char_compare_and_swap_full(a,o,n) # define AO_TS_COMPARE_AND_SWAP_ACQUIRE(a,o,n) \ AO_char_compare_and_swap_acquire(a,o,n) # define AO_TS_COMPARE_AND_SWAP_RELEASE(a,o,n) \ AO_char_compare_and_swap_release(a,o,n) # define AO_TS_COMPARE_AND_SWAP(a,o,n) \ AO_char_compare_and_swap(a,o,n) #endif #if AO_AO_TS_T # define AO_TS_COMPARE_AND_SWAP_FULL(a,o,n) \ AO_compare_and_swap_full(a,o,n) # define AO_TS_COMPARE_AND_SWAP_ACQUIRE(a,o,n) \ AO_compare_and_swap_acquire(a,o,n) # define AO_TS_COMPARE_AND_SWAP_RELEASE(a,o,n) \ AO_compare_and_swap_release(a,o,n) # define AO_TS_COMPARE_AND_SWAP(a,o,n) \ AO_compare_and_swap(a,o,n) #endif /* Generate test_and_set_full, if necessary and possible. */ #if !defined(AO_HAVE_test_and_set) && \ !defined(AO_HAVE_test_and_set_release) && \ !defined(AO_HAVE_test_and_set_acquire) && \ !defined(AO_HAVE_test_and_set_read) && \ !defined(AO_HAVE_test_and_set_full) # if AO_AO_TS_T && defined(AO_HAVE_compare_and_swap_full) || \ AO_CHAR_TS_T && defined(AO_HAVE_char_compare_and_swap_full) AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { if (AO_TS_COMPARE_AND_SWAP_FULL(addr, AO_TS_CLEAR, AO_TS_SET)) return AO_TS_CLEAR; else return AO_TS_SET; } # define AO_HAVE_test_and_set_full # endif /* AO_HAVE_compare_and_swap_full */ # if AO_AO_TS_T && defined(AO_HAVE_compare_and_swap_acquire) || \ AO_CHAR_TS_T && defined(AO_HAVE_char_compare_and_swap_acquire) AO_INLINE AO_TS_VAL_t AO_test_and_set_acquire(volatile AO_TS_t *addr) { if (AO_TS_COMPARE_AND_SWAP_ACQUIRE(addr, AO_TS_CLEAR, AO_TS_SET)) return AO_TS_CLEAR; else return AO_TS_SET; } # define AO_HAVE_test_and_set_acquire # endif /* AO_HAVE_compare_and_swap_acquire */ # if AO_AO_TS_T && defined(AO_HAVE_compare_and_swap_release) || \ AO_CHAR_TS_T && defined(AO_HAVE_char_compare_and_swap_release) AO_INLINE AO_TS_VAL_t AO_test_and_set_release(volatile AO_TS_t *addr) { if (AO_TS_COMPARE_AND_SWAP_RELEASE(addr, AO_TS_CLEAR, AO_TS_SET)) return AO_TS_CLEAR; else return AO_TS_SET; } # define AO_HAVE_test_and_set_release # endif /* AO_HAVE_compare_and_swap_release */ # if AO_AO_TS_T && defined(AO_HAVE_compare_and_swap) || \ AO_CHAR_TS_T && defined(AO_HAVE_char_compare_and_swap) AO_INLINE AO_TS_VAL_t AO_test_and_set(volatile AO_TS_t *addr) { if (AO_TS_COMPARE_AND_SWAP(addr, AO_TS_CLEAR, AO_TS_SET)) return AO_TS_CLEAR; else return AO_TS_SET; } # define AO_HAVE_test_and_set # endif /* AO_HAVE_compare_and_swap */ # if defined(AO_HAVE_test_and_set) && defined(AO_HAVE_nop_full) \ && !defined(AO_HAVE_test_and_set_acquire) AO_INLINE AO_TS_VAL_t AO_test_and_set_acquire(volatile AO_TS_t *addr) { AO_TS_VAL_t result = AO_test_and_set(addr); AO_nop_full(); return result; } # define AO_HAVE_test_and_set_acquire # endif #endif /* No prior test and set */ /* Nop */ #if !defined(AO_HAVE_nop) AO_INLINE void AO_nop(void) {} # define AO_HAVE_nop #endif #if defined(AO_HAVE_test_and_set_full) && !defined(AO_HAVE_nop_full) AO_INLINE void AO_nop_full() { AO_TS_t dummy = AO_TS_INITIALIZER; AO_test_and_set_full(&dummy); } # define AO_HAVE_nop_full #endif #if defined(AO_HAVE_nop_acquire) # error AO_nop_acquire is useless: dont define. #endif #if defined(AO_HAVE_nop_release) # error AO_nop_release is useless: dont define. #endif #if defined(AO_HAVE_nop_full) && !defined(AO_HAVE_nop_read) # define AO_nop_read() AO_nop_full() # define AO_HAVE_nop_read #endif #if defined(AO_HAVE_nop_full) && !defined(AO_HAVE_nop_write) # define AO_nop_write() AO_nop_full() # define AO_HAVE_nop_write #endif /* Load */ #if defined(AO_HAVE_load_full) && !defined(AO_HAVE_load_acquire) # define AO_load_acquire(addr) AO_load_full(addr) # define AO_HAVE_load_acquire #endif #if defined(AO_HAVE_load_acquire) && !defined(AO_HAVE_load) # define AO_load(addr) AO_load_acquire(addr) # define AO_HAVE_load #endif #if defined(AO_HAVE_load_full) && !defined(AO_HAVE_load_read) # define AO_load_read(addr) AO_load_full(addr) # define AO_HAVE_load_read #endif #if !defined(AO_HAVE_load_acquire_read) && defined(AO_HAVE_load_acquire) # define AO_load_acquire_read(addr) AO_load_acquire(addr) # define AO_HAVE_load_acquire_read #endif #if defined(AO_HAVE_load) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_load_acquire) AO_INLINE AO_t AO_load_acquire(volatile AO_t *addr) { AO_t result = AO_load(addr); /* Acquire barrier would be useless, since the load could be delayed */ /* beyond it. */ AO_nop_full(); return result; } # define AO_HAVE_load_acquire #endif #if defined(AO_HAVE_load) && defined(AO_HAVE_nop_read) && \ !defined(AO_HAVE_load_read) AO_INLINE AO_t AO_load_read(volatile AO_t *addr) { AO_t result = AO_load(addr); /* Acquire barrier would be useless, since the load could be delayed */ /* beyond it. */ AO_nop_read(); return result; } # define AO_HAVE_load_read #endif #if defined(AO_HAVE_load_acquire) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_load_full) # define AO_load_full(addr) (AO_nop_full(), AO_load_acquire(addr)) # define AO_HAVE_load_full #endif #if !defined(AO_HAVE_load_acquire_read) && defined(AO_HAVE_load_read) # define AO_load_acquire_read(addr) AO_load_read(addr) # define AO_HAVE_load_acquire_read #endif #if defined(AO_HAVE_load_acquire_read) && !defined(AO_HAVE_load) # define AO_load(addr) AO_load_acquire_read(addr) # define AO_HAVE_load #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_load_acquire_read) # define AO_load_dd_acquire_read(addr) AO_load_acquire_read(addr) # define AO_HAVE_load_dd_acquire_read # endif #else # if defined(AO_HAVE_load) # define AO_load_dd_acquire_read(addr) AO_load(addr) # define AO_HAVE_load_dd_acquire_read # endif #endif /* Store */ #if defined(AO_HAVE_store_full) && !defined(AO_HAVE_store_release) # define AO_store_release(addr,val) AO_store_full(addr,val) # define AO_HAVE_store_release #endif #if defined(AO_HAVE_store_release) && !defined(AO_HAVE_store) # define AO_store(addr, val) AO_store_release(addr,val) # define AO_HAVE_store #endif #if defined(AO_HAVE_store_full) && !defined(AO_HAVE_store_write) # define AO_store_write(addr,val) AO_store_full(addr,val) # define AO_HAVE_store_write #endif #if defined(AO_HAVE_store_release) && !defined(AO_HAVE_store_release_write) # define AO_store_release_write(addr, val) AO_store_release(addr,val) # define AO_HAVE_store_release_write #endif #if defined(AO_HAVE_store_write) && !defined(AO_HAVE_store) # define AO_store(addr, val) AO_store_write(addr,val) # define AO_HAVE_store #endif #if defined(AO_HAVE_store) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_store_release) # define AO_store_release(addr,val) (AO_nop_full(), AO_store(addr,val)) # define AO_HAVE_store_release #endif #if defined(AO_HAVE_nop_write) && defined(AO_HAVE_store) && \ !defined(AO_HAVE_store_write) # define AO_store_write(addr, val) (AO_nop_write(), AO_store(addr,val)) # define AO_HAVE_store_write #endif #if defined(AO_HAVE_store_write) && !defined(AO_HAVE_store_release_write) # define AO_store_release_write(addr, val) AO_store_write(addr,val) # define AO_HAVE_store_release_write #endif #if defined(AO_HAVE_store_release) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_store_full) # define AO_store_full(addr, val) (AO_store_release(addr, val), AO_nop_full()) # define AO_HAVE_store_full #endif /* Fetch_and_add */ /* We first try to implement fetch_and_add variants in terms */ /* of the corresponding compare_and_swap variants to minimize */ /* adding barriers. */ #if defined(AO_HAVE_compare_and_swap_full) && \ !defined(AO_HAVE_fetch_and_add_full) AO_INLINE AO_t AO_fetch_and_add_full(volatile AO_t *addr, AO_t incr) { AO_t old; do { old = *addr; } while (!AO_compare_and_swap_full(addr, old, old+incr)); return old; } # define AO_HAVE_fetch_and_add_full #endif #if defined(AO_HAVE_compare_and_swap_acquire) && \ !defined(AO_HAVE_fetch_and_add_acquire) AO_INLINE AO_t AO_fetch_and_add_acquire(volatile AO_t *addr, AO_t incr) { AO_t old; do { old = *addr; } while (!AO_compare_and_swap_acquire(addr, old, old+incr)); return old; } # define AO_HAVE_fetch_and_add_acquire #endif #if defined(AO_HAVE_compare_and_swap_release) && \ !defined(AO_HAVE_fetch_and_add_release) AO_INLINE AO_t AO_fetch_and_add_release(volatile AO_t *addr, AO_t incr) { AO_t old; do { old = *addr; } while (!AO_compare_and_swap_release(addr, old, old+incr)); return old; } # define AO_HAVE_fetch_and_add_release #endif #if defined(AO_HAVE_compare_and_swap) && \ !defined(AO_HAVE_fetch_and_add) AO_INLINE AO_t AO_fetch_and_add(volatile AO_t *addr, AO_t incr) { AO_t old; do { old = *addr; } while (!AO_compare_and_swap(addr, old, old+incr)); return old; } # define AO_HAVE_fetch_and_add #endif #if defined(AO_HAVE_fetch_and_add_full) # if !defined(AO_HAVE_fetch_and_add_release) # define AO_fetch_and_add_release(addr, val) \ AO_fetch_and_add_full(addr, val) # define AO_HAVE_fetch_and_add_release # endif # if !defined(AO_HAVE_fetch_and_add_acquire) # define AO_fetch_and_add_acquire(addr, val) \ AO_fetch_and_add_full(addr, val) # define AO_HAVE_fetch_and_add_acquire # endif # if !defined(AO_HAVE_fetch_and_add_write) # define AO_fetch_and_add_write(addr, val) \ AO_fetch_and_add_full(addr, val) # define AO_HAVE_fetch_and_add_write # endif # if !defined(AO_HAVE_fetch_and_add_read) # define AO_fetch_and_add_read(addr, val) \ AO_fetch_and_add_full(addr, val) # define AO_HAVE_fetch_and_add_read # endif #endif /* AO_HAVE_fetch_and_add_full */ #if !defined(AO_HAVE_fetch_and_add) && \ defined(AO_HAVE_fetch_and_add_release) # define AO_fetch_and_add(addr, val) \ AO_fetch_and_add_release(addr, val) # define AO_HAVE_fetch_and_add #endif #if !defined(AO_HAVE_fetch_and_add) && \ defined(AO_HAVE_fetch_and_add_acquire) # define AO_fetch_and_add(addr, val) \ AO_fetch_and_add_acquire(addr, val) # define AO_HAVE_fetch_and_add #endif #if !defined(AO_HAVE_fetch_and_add) && \ defined(AO_HAVE_fetch_and_add_write) # define AO_fetch_and_add(addr, val) \ AO_fetch_and_add_write(addr, val) # define AO_HAVE_fetch_and_add #endif #if !defined(AO_HAVE_fetch_and_add) && \ defined(AO_HAVE_fetch_and_add_read) # define AO_fetch_and_add(addr, val) \ AO_fetch_and_add_read(addr, val) # define AO_HAVE_fetch_and_add #endif #if defined(AO_HAVE_fetch_and_add_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_fetch_and_add_full) # define AO_fetch_and_add_full(addr, val) \ (AO_nop_full(), AO_fetch_and_add_acquire(addr, val)) # define AO_HAVE_fetch_and_add_full #endif #if !defined(AO_HAVE_fetch_and_add_release_write) && \ defined(AO_HAVE_fetch_and_add_write) # define AO_fetch_and_add_release_write(addr, val) \ AO_fetch_and_add_write(addr, val) # define AO_HAVE_fetch_and_add_release_write #endif #if !defined(AO_HAVE_fetch_and_add_release_write) && \ defined(AO_HAVE_fetch_and_add_release) # define AO_fetch_and_add_release_write(addr, val) \ AO_fetch_and_add_release(addr, val) # define AO_HAVE_fetch_and_add_release_write #endif #if !defined(AO_HAVE_fetch_and_add_acquire_read) && \ defined(AO_HAVE_fetch_and_add_read) # define AO_fetch_and_add_acquire_read(addr, val) \ AO_fetch_and_add_read(addr, val) # define AO_HAVE_fetch_and_add_acquire_read #endif #if !defined(AO_HAVE_fetch_and_add_acquire_read) && \ defined(AO_HAVE_fetch_and_add_acquire) # define AO_fetch_and_add_acquire_read(addr, val) \ AO_fetch_and_add_acquire(addr, val) # define AO_HAVE_fetch_and_add_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_fetch_and_add_acquire_read) # define AO_fetch_and_add_dd_acquire_read(addr, val) \ AO_fetch_and_add_acquire_read(addr, val) # define AO_HAVE_fetch_and_add_dd_acquire_read # endif #else # if defined(AO_HAVE_fetch_and_add) # define AO_fetch_and_add_dd_acquire_read(addr, val) \ AO_fetch_and_add(addr, val) # define AO_HAVE_fetch_and_add_dd_acquire_read # endif #endif /* Fetch_and_add1 */ #if defined(AO_HAVE_fetch_and_add_full) &&\ !defined(AO_HAVE_fetch_and_add1_full) # define AO_fetch_and_add1_full(addr) AO_fetch_and_add_full(addr,1) # define AO_HAVE_fetch_and_add1_full #endif #if defined(AO_HAVE_fetch_and_add_release) &&\ !defined(AO_HAVE_fetch_and_add1_release) # define AO_fetch_and_add1_release(addr) AO_fetch_and_add_release(addr,1) # define AO_HAVE_fetch_and_add1_release #endif #if defined(AO_HAVE_fetch_and_add_acquire) &&\ !defined(AO_HAVE_fetch_and_add1_acquire) # define AO_fetch_and_add1_acquire(addr) AO_fetch_and_add_acquire(addr,1) # define AO_HAVE_fetch_and_add1_acquire #endif #if defined(AO_HAVE_fetch_and_add_write) &&\ !defined(AO_HAVE_fetch_and_add1_write) # define AO_fetch_and_add1_write(addr) AO_fetch_and_add_write(addr,1) # define AO_HAVE_fetch_and_add1_write #endif #if defined(AO_HAVE_fetch_and_add_read) &&\ !defined(AO_HAVE_fetch_and_add1_read) # define AO_fetch_and_add1_read(addr) AO_fetch_and_add_read(addr,1) # define AO_HAVE_fetch_and_add1_read #endif #if defined(AO_HAVE_fetch_and_add_release_write) &&\ !defined(AO_HAVE_fetch_and_add1_release_write) # define AO_fetch_and_add1_release_write(addr) \ AO_fetch_and_add_release_write(addr,1) # define AO_HAVE_fetch_and_add1_release_write #endif #if defined(AO_HAVE_fetch_and_add_acquire_read) &&\ !defined(AO_HAVE_fetch_and_add1_acquire_read) # define AO_fetch_and_add1_acquire_read(addr) \ AO_fetch_and_add_acquire_read(addr,1) # define AO_HAVE_fetch_and_add1_acquire_read #endif #if defined(AO_HAVE_fetch_and_add) &&\ !defined(AO_HAVE_fetch_and_add1) # define AO_fetch_and_add1(addr) \ AO_fetch_and_add(addr,1) # define AO_HAVE_fetch_and_add1 #endif #if defined(AO_HAVE_fetch_and_add1_full) # if !defined(AO_HAVE_fetch_and_add1_release) # define AO_fetch_and_add1_release(addr) \ AO_fetch_and_add1_full(addr) # define AO_HAVE_fetch_and_add1_release # endif # if !defined(AO_HAVE_fetch_and_add1_acquire) # define AO_fetch_and_add1_acquire(addr) \ AO_fetch_and_add1_full(addr) # define AO_HAVE_fetch_and_add1_acquire # endif # if !defined(AO_HAVE_fetch_and_add1_write) # define AO_fetch_and_add1_write(addr) \ AO_fetch_and_add1_full(addr) # define AO_HAVE_fetch_and_add1_write # endif # if !defined(AO_HAVE_fetch_and_add1_read) # define AO_fetch_and_add1_read(addr) \ AO_fetch_and_add1_full(addr) # define AO_HAVE_fetch_and_add1_read # endif #endif /* AO_HAVE_fetch_and_add1_full */ #if !defined(AO_HAVE_fetch_and_add1) && \ defined(AO_HAVE_fetch_and_add1_release) # define AO_fetch_and_add1(addr) \ AO_fetch_and_add1_release(addr) # define AO_HAVE_fetch_and_add1 #endif #if !defined(AO_HAVE_fetch_and_add1) && \ defined(AO_HAVE_fetch_and_add1_acquire) # define AO_fetch_and_add1(addr) \ AO_fetch_and_add1_acquire(addr) # define AO_HAVE_fetch_and_add1 #endif #if !defined(AO_HAVE_fetch_and_add1) && \ defined(AO_HAVE_fetch_and_add1_write) # define AO_fetch_and_add1(addr) \ AO_fetch_and_add1_write(addr) # define AO_HAVE_fetch_and_add1 #endif #if !defined(AO_HAVE_fetch_and_add1) && \ defined(AO_HAVE_fetch_and_add1_read) # define AO_fetch_and_add1(addr) \ AO_fetch_and_add1_read(addr) # define AO_HAVE_fetch_and_add1 #endif #if defined(AO_HAVE_fetch_and_add1_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_fetch_and_add1_full) # define AO_fetch_and_add1_full(addr) \ (AO_nop_full(), AO_fetch_and_add1_acquire(addr)) # define AO_HAVE_fetch_and_add1_full #endif #if !defined(AO_HAVE_fetch_and_add1_release_write) && \ defined(AO_HAVE_fetch_and_add1_write) # define AO_fetch_and_add1_release_write(addr) \ AO_fetch_and_add1_write(addr) # define AO_HAVE_fetch_and_add1_release_write #endif #if !defined(AO_HAVE_fetch_and_add1_release_write) && \ defined(AO_HAVE_fetch_and_add1_release) # define AO_fetch_and_add1_release_write(addr) \ AO_fetch_and_add1_release(addr) # define AO_HAVE_fetch_and_add1_release_write #endif #if !defined(AO_HAVE_fetch_and_add1_acquire_read) && \ defined(AO_HAVE_fetch_and_add1_read) # define AO_fetch_and_add1_acquire_read(addr) \ AO_fetch_and_add1_read(addr) # define AO_HAVE_fetch_and_add1_acquire_read #endif #if !defined(AO_HAVE_fetch_and_add1_acquire_read) && \ defined(AO_HAVE_fetch_and_add1_acquire) # define AO_fetch_and_add1_acquire_read(addr) \ AO_fetch_and_add1_acquire(addr) # define AO_HAVE_fetch_and_add1_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_fetch_and_add1_acquire_read) # define AO_fetch_and_add1_dd_acquire_read(addr) \ AO_fetch_and_add1_acquire_read(addr) # define AO_HAVE_fetch_and_add1_dd_acquire_read # endif #else # if defined(AO_HAVE_fetch_and_add1) # define AO_fetch_and_add1_dd_acquire_read(addr) AO_fetch_and_add1(addr) # define AO_HAVE_fetch_and_add1_dd_acquire_read # endif #endif /* Fetch_and_sub1 */ #if defined(AO_HAVE_fetch_and_add_full) &&\ !defined(AO_HAVE_fetch_and_sub1_full) # define AO_fetch_and_sub1_full(addr) AO_fetch_and_add_full(addr,(AO_t)(-1)) # define AO_HAVE_fetch_and_sub1_full #endif #if defined(AO_HAVE_fetch_and_add_release) &&\ !defined(AO_HAVE_fetch_and_sub1_release) # define AO_fetch_and_sub1_release(addr) \ AO_fetch_and_add_release(addr,(AO_t)(-1)) # define AO_HAVE_fetch_and_sub1_release #endif #if defined(AO_HAVE_fetch_and_add_acquire) &&\ !defined(AO_HAVE_fetch_and_sub1_acquire) # define AO_fetch_and_sub1_acquire(addr) \ AO_fetch_and_add_acquire(addr,(AO_t)(-1)) # define AO_HAVE_fetch_and_sub1_acquire #endif #if defined(AO_HAVE_fetch_and_add_write) &&\ !defined(AO_HAVE_fetch_and_sub1_write) # define AO_fetch_and_sub1_write(addr) \ AO_fetch_and_add_write(addr,(AO_t)(-1)) # define AO_HAVE_fetch_and_sub1_write #endif #if defined(AO_HAVE_fetch_and_add_read) &&\ !defined(AO_HAVE_fetch_and_sub1_read) # define AO_fetch_and_sub1_read(addr) \ AO_fetch_and_add_read(addr,(AO_t)(-1)) # define AO_HAVE_fetch_and_sub1_read #endif #if defined(AO_HAVE_fetch_and_add_release_write) &&\ !defined(AO_HAVE_fetch_and_sub1_release_write) # define AO_fetch_and_sub1_release_write(addr) \ AO_fetch_and_add_release_write(addr,(AO_t)(-1)) # define AO_HAVE_fetch_and_sub1_release_write #endif #if defined(AO_HAVE_fetch_and_add_acquire_read) &&\ !defined(AO_HAVE_fetch_and_sub1_acquire_read) # define AO_fetch_and_sub1_acquire_read(addr) \ AO_fetch_and_add_acquire_read(addr,(AO_t)(-1)) # define AO_HAVE_fetch_and_sub1_acquire_read #endif #if defined(AO_HAVE_fetch_and_add) &&\ !defined(AO_HAVE_fetch_and_sub1) # define AO_fetch_and_sub1(addr) \ AO_fetch_and_add(addr,(AO_t)(-1)) # define AO_HAVE_fetch_and_sub1 #endif #if defined(AO_HAVE_fetch_and_sub1_full) # if !defined(AO_HAVE_fetch_and_sub1_release) # define AO_fetch_and_sub1_release(addr) \ AO_fetch_and_sub1_full(addr) # define AO_HAVE_fetch_and_sub1_release # endif # if !defined(AO_HAVE_fetch_and_sub1_acquire) # define AO_fetch_and_sub1_acquire(addr) \ AO_fetch_and_sub1_full(addr) # define AO_HAVE_fetch_and_sub1_acquire # endif # if !defined(AO_HAVE_fetch_and_sub1_write) # define AO_fetch_and_sub1_write(addr) \ AO_fetch_and_sub1_full(addr) # define AO_HAVE_fetch_and_sub1_write # endif # if !defined(AO_HAVE_fetch_and_sub1_read) # define AO_fetch_and_sub1_read(addr) \ AO_fetch_and_sub1_full(addr) # define AO_HAVE_fetch_and_sub1_read # endif #endif /* AO_HAVE_fetch_and_sub1_full */ #if !defined(AO_HAVE_fetch_and_sub1) && \ defined(AO_HAVE_fetch_and_sub1_release) # define AO_fetch_and_sub1(addr) \ AO_fetch_and_sub1_release(addr) # define AO_HAVE_fetch_and_sub1 #endif #if !defined(AO_HAVE_fetch_and_sub1) && \ defined(AO_HAVE_fetch_and_sub1_acquire) # define AO_fetch_and_sub1(addr) \ AO_fetch_and_sub1_acquire(addr) # define AO_HAVE_fetch_and_sub1 #endif #if !defined(AO_HAVE_fetch_and_sub1) && \ defined(AO_HAVE_fetch_and_sub1_write) # define AO_fetch_and_sub1(addr) \ AO_fetch_and_sub1_write(addr) # define AO_HAVE_fetch_and_sub1 #endif #if !defined(AO_HAVE_fetch_and_sub1) && \ defined(AO_HAVE_fetch_and_sub1_read) # define AO_fetch_and_sub1(addr) \ AO_fetch_and_sub1_read(addr) # define AO_HAVE_fetch_and_sub1 #endif #if defined(AO_HAVE_fetch_and_sub1_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_fetch_and_sub1_full) # define AO_fetch_and_sub1_full(addr) \ (AO_nop_full(), AO_fetch_and_sub1_acquire(addr)) # define AO_HAVE_fetch_and_sub1_full #endif #if !defined(AO_HAVE_fetch_and_sub1_release_write) && \ defined(AO_HAVE_fetch_and_sub1_write) # define AO_fetch_and_sub1_release_write(addr) \ AO_fetch_and_sub1_write(addr) # define AO_HAVE_fetch_and_sub1_release_write #endif #if !defined(AO_HAVE_fetch_and_sub1_release_write) && \ defined(AO_HAVE_fetch_and_sub1_release) # define AO_fetch_and_sub1_release_write(addr) \ AO_fetch_and_sub1_release(addr) # define AO_HAVE_fetch_and_sub1_release_write #endif #if !defined(AO_HAVE_fetch_and_sub1_acquire_read) && \ defined(AO_HAVE_fetch_and_sub1_read) # define AO_fetch_and_sub1_acquire_read(addr) \ AO_fetch_and_sub1_read(addr) # define AO_HAVE_fetch_and_sub1_acquire_read #endif #if !defined(AO_HAVE_fetch_and_sub1_acquire_read) && \ defined(AO_HAVE_fetch_and_sub1_acquire) # define AO_fetch_and_sub1_acquire_read(addr) \ AO_fetch_and_sub1_acquire(addr) # define AO_HAVE_fetch_and_sub1_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_fetch_and_sub1_acquire_read) # define AO_fetch_and_sub1_dd_acquire_read(addr) \ AO_fetch_and_sub1_acquire_read(addr) # define AO_HAVE_fetch_and_sub1_dd_acquire_read # endif #else # if defined(AO_HAVE_fetch_and_sub1) # define AO_fetch_and_sub1_dd_acquire_read(addr) AO_fetch_and_sub1(addr) # define AO_HAVE_fetch_and_sub1_dd_acquire_read # endif #endif /* Atomic or */ #if defined(AO_HAVE_compare_and_swap_full) && \ !defined(AO_HAVE_or_full) AO_INLINE void AO_or_full(volatile AO_t *addr, AO_t incr) { AO_t old; do { old = *addr; } while (!AO_compare_and_swap_full(addr, old, (old | incr))); } # define AO_HAVE_or_full #endif #if defined(AO_HAVE_or_full) # if !defined(AO_HAVE_or_release) # define AO_or_release(addr, val) \ AO_or_full(addr, val) # define AO_HAVE_or_release # endif # if !defined(AO_HAVE_or_acquire) # define AO_or_acquire(addr, val) \ AO_or_full(addr, val) # define AO_HAVE_or_acquire # endif # if !defined(AO_HAVE_or_write) # define AO_or_write(addr, val) \ AO_or_full(addr, val) # define AO_HAVE_or_write # endif # if !defined(AO_HAVE_or_read) # define AO_or_read(addr, val) \ AO_or_full(addr, val) # define AO_HAVE_or_read # endif #endif /* AO_HAVE_or_full */ #if !defined(AO_HAVE_or) && \ defined(AO_HAVE_or_release) # define AO_or(addr, val) \ AO_or_release(addr, val) # define AO_HAVE_or #endif #if !defined(AO_HAVE_or) && \ defined(AO_HAVE_or_acquire) # define AO_or(addr, val) \ AO_or_acquire(addr, val) # define AO_HAVE_or #endif #if !defined(AO_HAVE_or) && \ defined(AO_HAVE_or_write) # define AO_or(addr, val) \ AO_or_write(addr, val) # define AO_HAVE_or #endif #if !defined(AO_HAVE_or) && \ defined(AO_HAVE_or_read) # define AO_or(addr, val) \ AO_or_read(addr, val) # define AO_HAVE_or #endif #if defined(AO_HAVE_or_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_or_full) # define AO_or_full(addr, val) \ (AO_nop_full(), AO_or_acquire(addr, val)) #endif #if !defined(AO_HAVE_or_release_write) && \ defined(AO_HAVE_or_write) # define AO_or_release_write(addr, val) \ AO_or_write(addr, val) # define AO_HAVE_or_release_write #endif #if !defined(AO_HAVE_or_release_write) && \ defined(AO_HAVE_or_release) # define AO_or_release_write(addr, val) \ AO_or_release(addr, val) # define AO_HAVE_or_release_write #endif #if !defined(AO_HAVE_or_acquire_read) && \ defined(AO_HAVE_or_read) # define AO_or_acquire_read(addr, val) \ AO_or_read(addr, val) # define AO_HAVE_or_acquire_read #endif #if !defined(AO_HAVE_or_acquire_read) && \ defined(AO_HAVE_or_acquire) # define AO_or_acquire_read(addr, val) \ AO_or_acquire(addr, val) # define AO_HAVE_or_acquire_read #endif /* dd_aquire_read is meaningless. */ /* Test_and_set */ #if defined(AO_HAVE_test_and_set_full) # if !defined(AO_HAVE_test_and_set_release) # define AO_test_and_set_release(addr) \ AO_test_and_set_full(addr) # define AO_HAVE_test_and_set_release # endif # if !defined(AO_HAVE_test_and_set_acquire) # define AO_test_and_set_acquire(addr) \ AO_test_and_set_full(addr) # define AO_HAVE_test_and_set_acquire # endif # if !defined(AO_HAVE_test_and_set_write) # define AO_test_and_set_write(addr) \ AO_test_and_set_full(addr) # define AO_HAVE_test_and_set_write # endif # if !defined(AO_HAVE_test_and_set_read) # define AO_test_and_set_read(addr) \ AO_test_and_set_full(addr) # define AO_HAVE_test_and_set_read # endif #endif /* AO_HAVE_test_and_set_full */ #if !defined(AO_HAVE_test_and_set) && \ defined(AO_HAVE_test_and_set_release) # define AO_test_and_set(addr) \ AO_test_and_set_release(addr) # define AO_HAVE_test_and_set #endif #if !defined(AO_HAVE_test_and_set) && \ defined(AO_HAVE_test_and_set_acquire) # define AO_test_and_set(addr) \ AO_test_and_set_acquire(addr) # define AO_HAVE_test_and_set #endif #if !defined(AO_HAVE_test_and_set) && \ defined(AO_HAVE_test_and_set_write) # define AO_test_and_set(addr) \ AO_test_and_set_write(addr) # define AO_HAVE_test_and_set #endif #if !defined(AO_HAVE_test_and_set) && \ defined(AO_HAVE_test_and_set_read) # define AO_test_and_set(addr) \ AO_test_and_set_read(addr) # define AO_HAVE_test_and_set #endif #if defined(AO_HAVE_test_and_set_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_test_and_set_full) # define AO_test_and_set_full(addr) \ (AO_nop_full(), AO_test_and_set_acquire(addr)) # define AO_HAVE_test_and_set_full #endif #if !defined(AO_HAVE_test_and_set_release_write) && \ defined(AO_HAVE_test_and_set_write) # define AO_test_and_set_release_write(addr) \ AO_test_and_set_write(addr) # define AO_HAVE_test_and_set_release_write #endif #if !defined(AO_HAVE_test_and_set_release_write) && \ defined(AO_HAVE_test_and_set_release) # define AO_test_and_set_release_write(addr) \ AO_test_and_set_release(addr) # define AO_HAVE_test_and_set_release_write #endif #if !defined(AO_HAVE_test_and_set_acquire_read) && \ defined(AO_HAVE_test_and_set_read) # define AO_test_and_set_acquire_read(addr) \ AO_test_and_set_read(addr) # define AO_HAVE_test_and_set_acquire_read #endif #if !defined(AO_HAVE_test_and_set_acquire_read) && \ defined(AO_HAVE_test_and_set_acquire) # define AO_test_and_set_acquire_read(addr) \ AO_test_and_set_acquire(addr) # define AO_HAVE_test_and_set_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_test_and_set_acquire_read) # define AO_test_and_set_dd_acquire_read(addr) \ AO_test_and_set_acquire_read(addr) # define AO_HAVE_test_and_set_dd_acquire_read # endif #else # if defined(AO_HAVE_test_and_set) # define AO_test_and_set_dd_acquire_read(addr) AO_test_and_set(addr) # define AO_HAVE_test_and_set_dd_acquire_read # endif #endif /* Compare_and_swap */ #if defined(AO_HAVE_compare_and_swap) && defined(AO_HAVE_nop_full)\ && !defined(AO_HAVE_compare_and_swap_acquire) AO_INLINE int AO_compare_and_swap_acquire(volatile AO_t *addr, AO_t old, AO_t new_val) { int result = AO_compare_and_swap(addr, old, new_val); AO_nop_full(); return result; } # define AO_HAVE_compare_and_swap_acquire #endif #if defined(AO_HAVE_compare_and_swap) && defined(AO_HAVE_nop_full)\ && !defined(AO_HAVE_compare_and_swap_release) # define AO_compare_and_swap_release(addr, old, new_val) \ (AO_nop_full(), AO_compare_and_swap(addr, old, new_val)) # define AO_HAVE_compare_and_swap_release #endif #if defined(AO_HAVE_compare_and_swap_full) # if !defined(AO_HAVE_compare_and_swap_release) # define AO_compare_and_swap_release(addr, old, new_val) \ AO_compare_and_swap_full(addr, old, new_val) # define AO_HAVE_compare_and_swap_release # endif # if !defined(AO_HAVE_compare_and_swap_acquire) # define AO_compare_and_swap_acquire(addr, old, new_val) \ AO_compare_and_swap_full(addr, old, new_val) # define AO_HAVE_compare_and_swap_acquire # endif # if !defined(AO_HAVE_compare_and_swap_write) # define AO_compare_and_swap_write(addr, old, new_val) \ AO_compare_and_swap_full(addr, old, new_val) # define AO_HAVE_compare_and_swap_write # endif # if !defined(AO_HAVE_compare_and_swap_read) # define AO_compare_and_swap_read(addr, old, new_val) \ AO_compare_and_swap_full(addr, old, new_val) # define AO_HAVE_compare_and_swap_read # endif #endif /* AO_HAVE_compare_and_swap_full */ #if !defined(AO_HAVE_compare_and_swap) && \ defined(AO_HAVE_compare_and_swap_release) # define AO_compare_and_swap(addr, old, new_val) \ AO_compare_and_swap_release(addr, old, new_val) # define AO_HAVE_compare_and_swap #endif #if !defined(AO_HAVE_compare_and_swap) && \ defined(AO_HAVE_compare_and_swap_acquire) # define AO_compare_and_swap(addr, old, new_val) \ AO_compare_and_swap_acquire(addr, old, new_val) # define AO_HAVE_compare_and_swap #endif #if !defined(AO_HAVE_compare_and_swap) && \ defined(AO_HAVE_compare_and_swap_write) # define AO_compare_and_swap(addr, old, new_val) \ AO_compare_and_swap_write(addr, old, new_val) # define AO_HAVE_compare_and_swap #endif #if !defined(AO_HAVE_compare_and_swap) && \ defined(AO_HAVE_compare_and_swap_read) # define AO_compare_and_swap(addr, old, new_val) \ AO_compare_and_swap_read(addr, old, new_val) # define AO_HAVE_compare_and_swap #endif #if defined(AO_HAVE_compare_and_swap_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_compare_and_swap_full) # define AO_compare_and_swap_full(addr, old, new_val) \ (AO_nop_full(), AO_compare_and_swap_acquire(addr, old, new_val)) # define AO_HAVE_compare_and_swap_full #endif #if !defined(AO_HAVE_compare_and_swap_release_write) && \ defined(AO_HAVE_compare_and_swap_write) # define AO_compare_and_swap_release_write(addr, old, new_val) \ AO_compare_and_swap_write(addr, old, new_val) # define AO_HAVE_compare_and_swap_release_write #endif #if !defined(AO_HAVE_compare_and_swap_release_write) && \ defined(AO_HAVE_compare_and_swap_release) # define AO_compare_and_swap_release_write(addr, old, new_val) \ AO_compare_and_swap_release(addr, old, new_val) # define AO_HAVE_compare_and_swap_release_write #endif #if !defined(AO_HAVE_compare_and_swap_acquire_read) && \ defined(AO_HAVE_compare_and_swap_read) # define AO_compare_and_swap_acquire_read(addr, old, new_val) \ AO_compare_and_swap_read(addr, old, new_val) # define AO_HAVE_compare_and_swap_acquire_read #endif #if !defined(AO_HAVE_compare_and_swap_acquire_read) && \ defined(AO_HAVE_compare_and_swap_acquire) # define AO_compare_and_swap_acquire_read(addr, old, new_val) \ AO_compare_and_swap_acquire(addr, old, new_val) # define AO_HAVE_compare_and_swap_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_compare_and_swap_acquire_read) # define AO_compare_and_swap_dd_acquire_read(addr, old, new_val) \ AO_compare_and_swap_acquire_read(addr, old, new_val) # define AO_HAVE_compare_and_swap_dd_acquire_read # endif #else # if defined(AO_HAVE_compare_and_swap) # define AO_compare_and_swap_dd_acquire_read(addr, old, new_val) \ AO_compare_and_swap(addr, old, new_val) # define AO_HAVE_compare_and_swap_dd_acquire_read # endif #endif #include "generalize-small.h" /* Compare_double_and_swap_double */ #if defined(AO_HAVE_compare_double_and_swap_double) && defined(AO_HAVE_nop_full)\ && !defined(AO_HAVE_compare_double_and_swap_double_acquire) AO_INLINE int AO_compare_double_and_swap_double_acquire(volatile AO_double_t *addr, AO_t o1, AO_t o2, AO_t n1, AO_t n2) { int result = AO_compare_double_and_swap_double(addr, o1, o2, n1, n2); AO_nop_full(); return result; } # define AO_HAVE_compare_double_and_swap_double_acquire #endif #if defined(AO_HAVE_compare_double_and_swap_double) \ && defined(AO_HAVE_nop_full)\ && !defined(AO_HAVE_compare_double_and_swap_double_release) # define AO_compare_double_and_swap_double_release(addr, o1, o2, n1, n2) \ (AO_nop_full(), AO_compare_double_and_swap_double(addr, o1, o2, n1, n2)) # define AO_HAVE_compare_double_and_swap_double_release #endif #if defined(AO_HAVE_compare_double_and_swap_double_full) # if !defined(AO_HAVE_compare_double_and_swap_double_release) # define AO_compare_double_and_swap_double_release(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_full(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double_release # endif # if !defined(AO_HAVE_compare_double_and_swap_double_acquire) # define AO_compare_double_and_swap_double_acquire(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_full(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double_acquire # endif # if !defined(AO_HAVE_compare_double_and_swap_double_write) # define AO_compare_double_and_swap_double_write(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_full(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double_write # endif # if !defined(AO_HAVE_compare_double_and_swap_double_read) # define AO_compare_double_and_swap_double_read(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_full(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double_read # endif #endif /* AO_HAVE_compare_double_and_swap_double_full */ #if !defined(AO_HAVE_compare_double_and_swap_double) && \ defined(AO_HAVE_compare_double_and_swap_double_release) # define AO_compare_double_and_swap_double(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_release(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double #endif #if !defined(AO_HAVE_compare_double_and_swap_double) && \ defined(AO_HAVE_compare_double_and_swap_double_acquire) # define AO_compare_double_and_swap_double(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_acquire(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double #endif #if !defined(AO_HAVE_compare_double_and_swap_double) && \ defined(AO_HAVE_compare_double_and_swap_double_write) # define AO_compare_double_and_swap_double(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_write(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double #endif #if !defined(AO_HAVE_compare_double_and_swap_double) && \ defined(AO_HAVE_compare_double_and_swap_double_read) # define AO_compare_double_and_swap_double(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_read(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double #endif #if defined(AO_HAVE_compare_double_and_swap_double_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_compare_double_and_swap_double_full) # define AO_compare_double_and_swap_double_full(addr, o1, o2, n1, n2) \ (AO_nop_full(), AO_compare_double_and_swap_double_acquire(addr, o1, o2, n1, n2)) # define AO_HAVE_compare_double_and_swap_double_full #endif #if !defined(AO_HAVE_compare_double_and_swap_double_release_write) && \ defined(AO_HAVE_compare_double_and_swap_double_write) # define AO_compare_double_and_swap_double_release_write(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_write(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double_release_write #endif #if !defined(AO_HAVE_compare_double_and_swap_double_release_write) && \ defined(AO_HAVE_compare_double_and_swap_double_release) # define AO_compare_double_and_swap_double_release_write(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_release(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double_release_write #endif #if !defined(AO_HAVE_compare_double_and_swap_double_acquire_read) && \ defined(AO_HAVE_compare_double_and_swap_double_read) # define AO_compare_double_and_swap_double_acquire_read(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_read(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double_acquire_read #endif #if !defined(AO_HAVE_compare_double_and_swap_double_acquire_read) && \ defined(AO_HAVE_compare_double_and_swap_double_acquire) # define AO_compare_double_and_swap_double_acquire_read(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_acquire(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_compare_double_and_swap_double_acquire_read) # define AO_compare_double_and_swap_double_dd_acquire_read(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_acquire_read(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double_dd_acquire_read # endif #else # if defined(AO_HAVE_compare_double_and_swap_double) # define AO_compare_double_and_swap_double_dd_acquire_read(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double_dd_acquire_read # endif #endif /* Compare_and_swap_double */ #if defined(AO_HAVE_compare_and_swap_double) && defined(AO_HAVE_nop_full)\ && !defined(AO_HAVE_compare_and_swap_double_acquire) AO_INLINE int AO_compare_and_swap_double_acquire(volatile AO_double_t *addr, AO_t o1, AO_t o2, AO_t n1, AO_t n2) { int result = AO_compare_and_swap_double(addr, o1, n1, n2); AO_nop_full(); return result; } # define AO_HAVE_compare_and_swap_double_acquire #endif #if defined(AO_HAVE_compare_and_swap_double) \ && defined(AO_HAVE_nop_full)\ && !defined(AO_HAVE_compare_and_swap_double_release) # define AO_compare_and_swap_double_release(addr, o1, n1, n2) \ (AO_nop_full(), AO_compare_and_swap_double(addr, o1, n1, n2)) # define AO_HAVE_compare_and_swap_double_release #endif #if defined(AO_HAVE_compare_and_swap_double_full) # if !defined(AO_HAVE_compare_and_swap_double_release) # define AO_compare_and_swap_double_release(addr, o1, n1, n2) \ AO_compare_and_swap_double_full(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double_release # endif # if !defined(AO_HAVE_compare_and_swap_double_acquire) # define AO_compare_and_swap_double_acquire(addr, o1, n1, n2) \ AO_compare_and_swap_double_full(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double_acquire # endif # if !defined(AO_HAVE_compare_and_swap_double_write) # define AO_compare_and_swap_double_write(addr, o1, n1, n2) \ AO_compare_and_swap_double_full(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double_write # endif # if !defined(AO_HAVE_compare_and_swap_double_read) # define AO_compare_and_swap_double_read(addr, o1, n1, n2) \ AO_compare_and_swap_double_full(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double_read # endif #endif /* AO_HAVE_compare_and_swap_double_full */ #if !defined(AO_HAVE_compare_and_swap_double) && \ defined(AO_HAVE_compare_and_swap_double_release) # define AO_compare_and_swap_double(addr, o1, n1, n2) \ AO_compare_and_swap_double_release(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double #endif #if !defined(AO_HAVE_compare_and_swap_double) && \ defined(AO_HAVE_compare_and_swap_double_acquire) # define AO_compare_and_swap_double(addr, o1, n1, n2) \ AO_compare_and_swap_double_acquire(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double #endif #if !defined(AO_HAVE_compare_and_swap_double) && \ defined(AO_HAVE_compare_and_swap_double_write) # define AO_compare_and_swap_double(addr, o1, n1, n2) \ AO_compare_and_swap_double_write(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double #endif #if !defined(AO_HAVE_compare_and_swap_double) && \ defined(AO_HAVE_compare_and_swap_double_read) # define AO_compare_and_swap_double(addr, o1, n1, n2) \ AO_compare_and_swap_double_read(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double #endif #if defined(AO_HAVE_compare_and_swap_double_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_compare_and_swap_double_full) # define AO_compare_and_swap_double_full(addr, o1, n1, n2) \ (AO_nop_full(), AO_compare_and_swap_double_acquire(addr, o1, n1, n2)) # define AO_HAVE_compare_and_swap_double_full #endif #if !defined(AO_HAVE_compare_and_swap_double_release_write) && \ defined(AO_HAVE_compare_and_swap_double_write) # define AO_compare_and_swap_double_release_write(addr, o1, n1, n2) \ AO_compare_and_swap_double_write(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double_release_write #endif #if !defined(AO_HAVE_compare_and_swap_double_release_write) && \ defined(AO_HAVE_compare_and_swap_double_release) # define AO_compare_and_swap_double_release_write(addr, o1, n1, n2) \ AO_compare_and_swap_double_release(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double_release_write #endif #if !defined(AO_HAVE_compare_and_swap_double_acquire_read) && \ defined(AO_HAVE_compare_and_swap_double_read) # define AO_compare_and_swap_double_acquire_read(addr, o1, n1, n2) \ AO_compare_and_swap_double_read(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double_acquire_read #endif #if !defined(AO_HAVE_compare_and_swap_double_acquire_read) && \ defined(AO_HAVE_compare_and_swap_double_acquire) # define AO_compare_and_swap_double_acquire_read(addr, o1, n1, n2) \ AO_compare_and_swap_double_acquire(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_compare_and_swap_double_acquire_read) # define AO_compare_and_swap_double_dd_acquire_read(addr, o1, n1, n2) \ AO_compare_and_swap_double_acquire_read(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double_dd_acquire_read # endif #else # if defined(AO_HAVE_compare_and_swap_double) # define AO_compare_and_swap_double_dd_acquire_read(addr, o1, n1, n2) \ AO_compare_and_swap_double(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double_dd_acquire_read # endif #endif synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops_malloc.h0000664000076400007640000000315411104702315025133 0ustar stefanstefan/* * Copyright (c) 2005 Hewlett-Packard Development Company, L.P. * * 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. */ /* Almost lock-free malloc implementation based on stack implementation. */ /* See README.malloc file for detailed usage rules. */ #ifndef AO_ATOMIC_H #define AO_ATOMIC_H #include /* For size_t */ #include "atomic_ops_stack.h" #ifdef AO_STACK_IS_LOCK_FREE # define AO_MALLOC_IS_LOCK_FREE #endif void AO_free(void *); void * AO_malloc(size_t); /* Allow use of mmpa to grow the heap. No-op on some platforms. */ void AO_malloc_enable_mmap(void); #endif /* !AO_ATOMIC_H */ synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops_stack.h0000664000076400007640000001427411104702315024776 0ustar stefanstefan/* * The implementation of the routines described here is covered by the GPL. * This header file is covered by the following license: */ /* * Copyright (c) 2005 Hewlett-Packard Development Company, L.P. * * 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. */ /* Almost lock-free LIFO linked lists (linked stacks). */ #ifndef AO_STACK_H #define AO_STACK_H #include "atomic_ops.h" #if !defined(AO_HAVE_compare_double_and_swap_double) \ && !defined(AO_HAVE_compare_double_and_swap) \ && defined(AO_HAVE_compare_and_swap) # define AO_USE_ALMOST_LOCK_FREE #else /* If we have no compare-and-swap operation defined, we assume */ /* that we will actually be using CAS emulation. If we do that, */ /* it's cheaper to use the version-based implementation. */ # define AO_STACK_IS_LOCK_FREE #endif /* * These are not guaranteed to be completely lock-free. * List insertion may spin under extremely unlikely conditions. * It cannot deadlock due to recursive reentry unless AO_list_remove * is called while at least AO_BL_SIZE activations of * AO_list_remove are currently active in the same thread, i.e. * we must have at least AO_BL_SIZE recursive signal handler * invocations. * * All operations take an AO_list_aux argument. It is safe to * share a single AO_list_aux structure among all lists, but that * may increase contention. Any given list must always be accessed * with the same AO_list_aux structure. * * We make some machine-dependent assumptions: * - We have a compare-and-swap operation. * - At least _AO_N_BITS low order bits in pointers are * zero and normally unused. * - size_t and pointers have the same size. * * We do use a fully lock-free implementation if double-width * compare-and-swap operations are available. */ #ifdef AO_USE_ALMOST_LOCK_FREE /* The number of low order pointer bits we can use for a small */ /* version number. */ # if defined(__LP64__) || defined(_LP64) || defined(_WIN64) /* WIN64 isn't really supported yet. */ # define AO_N_BITS 3 # else # define AO_N_BITS 2 # endif # define AO_BIT_MASK ((1 << AO_N_BITS) - 1) /* * AO_stack_aux should be treated as opaque. * It is fully defined here, so it can be allocated, and to facilitate * debugging. */ #ifndef AO_BL_SIZE # define AO_BL_SIZE 2 #endif #if AO_BL_SIZE > (1 << AO_N_BITS) # error AO_BL_SIZE too big #endif typedef struct AO__stack_aux { volatile AO_t AO_stack_bl[AO_BL_SIZE]; } AO_stack_aux; /* The stack implementation knows only about the lecation of */ /* link fields in nodes, and nothing about the rest of the */ /* stack elements. Link fields hold an AO_t, which is not */ /* necessarily a real pointer. This converts the AO_t to a */ /* real (AO_t *) which is either o, or points at the link */ /* field in the next node. */ #define AO_REAL_NEXT_PTR(x) (AO_t *)((x) & ~AO_BIT_MASK) /* The following two routines should not normally be used directly. */ /* We make them visible here for the rare cases in which it makes sense */ /* to share the an AO_stack_aux between stacks. */ void AO_stack_push_explicit_aux_release(volatile AO_t *list, AO_t *x, AO_stack_aux *); AO_t * AO_stack_pop_explicit_aux_acquire(volatile AO_t *list, AO_stack_aux *); /* And now AO_stack_t for the real interface: */ typedef struct AO__stack { volatile AO_t AO_ptr; AO_stack_aux AO_aux; } AO_stack_t; #define AO_STACK_INITIALIZER {0} AO_INLINE void AO_stack_init(AO_stack_t *list) { # if AO_BL_SIZE == 2 list -> AO_aux.AO_stack_bl[0] = 0; list -> AO_aux.AO_stack_bl[1] = 0; # else int i; for (i = 0; i < AO_BL_SIZE; ++i) list -> AO_aux.AO_stack_bl[i] = 0; # endif list -> AO_ptr = 0; } /* Convert an AO_stack_t to a pointer to the link field in */ /* the first element. */ #define AO_REAL_HEAD_PTR(x) AO_REAL_NEXT_PTR((x).AO_ptr) #define AO_stack_push_release(l, e) \ AO_stack_push_explicit_aux_release(&((l)->AO_ptr), e, &((l)->AO_aux)) #define AO_HAVE_stack_push_release #define AO_stack_pop_acquire(l) \ AO_stack_pop_explicit_aux_acquire(&((l)->AO_ptr), &((l)->AO_aux)) #define AO_HAVE_stack_pop_acquire # else /* Use fully non-blocking data structure, wide CAS */ #ifndef AO_HAVE_double_t /* Can happen if we're using CAS emulation, since we don't want to */ /* force that here, in case other atomic_ops clients don't want it. */ # include "atomic_ops/sysdeps/standard_ao_double_t.h" #endif typedef volatile AO_double_t AO_stack_t; /* AO_val1 is version, AO_val2 is pointer. */ #define AO_STACK_INITIALIZER {0} AO_INLINE void AO_stack_init(AO_stack_t *list) { list -> AO_val1 = 0; list -> AO_val2 = 0; } #define AO_REAL_HEAD_PTR(x) (AO_t *)((x).AO_val2) #define AO_REAL_NEXT_PTR(x) (AO_t *)(x) void AO_stack_push_release(AO_stack_t *list, AO_t *new_element); #define AO_HAVE_stack_push_release AO_t * AO_stack_pop_acquire(AO_stack_t *list); #define AO_HAVE_stack_pop_acquire #endif /* Wide CAS case */ #if defined(AO_HAVE_stack_push_release) && !defined(AO_HAVE_stack_push) # define AO_stack_push(l, e) AO_stack_push_release(l, e) # define AO_HAVE_stack_push #endif #if defined(AO_HAVE_stack_pop_acquire) && !defined(AO_HAVE_stack_pop) # define AO_stack_pop(l) AO_stack_pop_acquire(l) # define AO_HAVE_stack_pop #endif #endif /* !AO_STACK_H */ synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/Makefile.msft0000664000076400007640000000265711104702315023715 0ustar stefanstefan# # Copyright (c) 2003-2005 Hewlett-Packard Developlment Company, L.P. # # The really trivial win32/VC++ Makefile. Note that atomic_ops.c isn't useful. # And we rely on a pre-built test_atomic_include.h and generalize-small.h, # since we can't rely on sed. # Win32 clients only need to include the header files. # To install, copy atomic_ops.h and the atomic_ops/... tree to your favorite # include directory. #MY_CPU=X86 #CPU=$(MY_CPU) #!include LIB_OBJS=atomic_ops_stack.obj atomic_ops_malloc.obj all: check atomic_ops_stack.obj: cl -O2 -c -DAO_ASSUME_WINDOWS98 atomic_ops_stack.c atomic_ops_malloc.obj: cl -O2 -c -DAO_ASSUME_WINDOWS98 atomic_ops_malloc.c test_atomic: ..\tests\test_atomic.c ..\tests\test_atomic_include.h cl -O2 -I. -DAO_ASSUME_WINDOWS98 ..\tests\test_atomic.c -o test_atomic test_atomic_w95: ..\tests\test_atomic.c ..\tests\test_atomic_include.h cl -O2 -I. ..\tests\test_atomic.c -o test_atomic_w95 test_malloc: ..\tests\test_malloc.c ..\tests\test_atomic_include.h \ libatomic_ops_gpl.lib cl -O2 -DAO_ASSUME_WINDOWS98 -I. ..\tests\test_malloc.c -o test_malloc libatomic_ops_gpl.lib libatomic_ops_gpl.lib: $(LIB_OBJS) lib /MACHINE:i386 /out:libatomic_ops_gpl.lib $(LIB_OBJS) check: test_atomic test_atomic_w95 test_malloc echo The following will print lots of \"Missing ...\" messages. test_atomic_w95 echo The following will print some \"Missing ...\" messages. test_atomic test_malloc synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops_stack.c0000664000076400007640000002167411104702315024773 0ustar stefanstefan/* * Copyright (c) 2005 Hewlett-Packard Development Company, L.P. * Original Author: Hans Boehm * * This file may be redistributed and/or modified 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. * * It is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License in the * file doc/COPYING for more details. */ #if defined(HAVE_CONFIG_H) # include "config.h" #endif #include #include #include #define AO_REQUIRE_CAS #include "atomic_ops_stack.h" #if defined(_MSC_VER) \ || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__) /* AO_pause not defined elsewhere */ /* FIXME: At least AO_spin should be factored out. */ #include AO_t dummy; /* Spin for 2**n units. */ static void AO_spin(int n) { int i; AO_T j = AO_load(&dummy); for (i = 0; i < (2 << n); ++i) { j *= 5; j -= 4; } AO_store(&dummy, j); } void AO_pause(int n) { if (n < 12) AO_spin(n); else { DWORD msecs; /* Short async-signal-safe sleep. */ msecs = (n > 18? 100 : (1 << (n - 12))); Sleep(msecs); } } #else /* AO_pause is available elsewhere */ extern void AO_pause(int); #endif #ifdef AO_USE_ALMOST_LOCK_FREE /* LIFO linked lists based on compare-and-swap. We need to avoid */ /* the case of a node deleton and reinsertion while I'm deleting */ /* it, since that may cause my CAS to succeed eventhough the next */ /* pointer is now wrong. Our solution is not fully lock-free, but it */ /* is good enough for signal handlers, provided we have a suitably low */ /* bound on the number of recursive signal handler reentries. */ /* A list consists of a first pointer and a blacklist */ /* of pointer values that are currently being removed. No list element */ /* on the blacklist may be inserted. If we would otherwise do so, we */ /* are allowed to insert a variant that differs only in the least */ /* significant, ignored, bits. If the list is full, we wait. */ /* Crucial observation: A particular padded pointer x (i.e. pointer */ /* plus arbitrary low order bits) can never be newly inserted into */ /* a list while it's in the corresponding auxiliary data structure. */ /* The second argument is a pointer to the link field of the element */ /* to be inserted. */ /* Both list headers and link fields contain "perturbed" pointers, i.e. */ /* pointers with extra bits "or"ed into the low order bits. */ void AO_stack_push_explicit_aux_release(volatile AO_t *list, AO_t *x, AO_stack_aux *a) { int i; AO_t x_bits = (AO_t)x; AO_t next; /* No deletions of x can start here, since x is not currently in the */ /* list. */ retry: # if AO_BL_SIZE == 2 { /* Start all loads as close to concurrently as possible. */ AO_t entry1 = AO_load(a -> AO_stack_bl); AO_t entry2 = AO_load(a -> AO_stack_bl + 1); if (entry1 == x_bits || entry2 == x_bits) { /* Entry is currently being removed. Change it a little. */ ++x_bits; if ((x_bits & AO_BIT_MASK) == 0) /* Version count overflowed; */ /* EXTREMELY unlikely, but possible. */ x_bits = (AO_t)x; goto retry; } } # else for (i = 0; i < AO_BL_SIZE; ++i) { if (AO_load(a -> AO_stack_bl + i) == x_bits) { /* Entry is currently being removed. Change it a little. */ ++x_bits; if ((x_bits & AO_BIT_MASK) == 0) /* Version count overflowed; */ /* EXTREMELY unlikely, but possible. */ x_bits = (AO_t)x; goto retry; } } # endif /* x_bits is not currently being deleted */ do { next = AO_load(list); *x = next; } while(!AO_compare_and_swap_release(list, next, x_bits)); } /* * I concluded experimentally that checking a value first before * performing a compare-and-swap is usually beneficial on X86, but * slows things down appreciably with contention on Itanium. * ince the Itanium behavior makes more sense to me (more cache line * movement unless we're mostly reading, but back-off should guard * against that), we take Itanium as the default. Measurements on * other multiprocessor architectures would be useful. (On a uniprocessor, * the initial check is almost certainly a very small loss.) - HB */ #ifdef __i386__ # define PRECHECK(a) (a) == 0 && #else # define PRECHECK(a) #endif AO_t * AO_stack_pop_explicit_aux_acquire(volatile AO_t *list, AO_stack_aux * a) { unsigned i; int j = 0; AO_t first; AO_t * first_ptr; AO_t next; retry: first = AO_load(list); if (0 == first) return 0; /* Insert first into aux black list. */ /* This may spin if more than AO_BL_SIZE removals using auxiliary */ /* structure a are currently in progress. */ for (i = 0; ; ) { if (PRECHECK(a -> AO_stack_bl[i]) AO_compare_and_swap_acquire(a->AO_stack_bl+i, 0, first)) break; ++i; if ( i >= AO_BL_SIZE ) { i = 0; AO_pause(++j); } } assert(i >= 0 && i < AO_BL_SIZE); assert(a -> AO_stack_bl[i] == first); /* First is on the auxiliary black list. It may be removed by */ /* another thread before we get to it, but a new insertion of x */ /* cannot be started here. */ /* Only we can remove it from the black list. */ /* We need to make sure that first is still the first entry on the */ /* list. Otherwise it's possible that a reinsertion of it was */ /* already started before we added the black list entry. */ if (first != AO_load(list)) { AO_store_release(a->AO_stack_bl+i, 0); goto retry; } first_ptr = AO_REAL_NEXT_PTR(first); next = AO_load(first_ptr); if (!AO_compare_and_swap_release(list, first, next)) { AO_store_release(a->AO_stack_bl+i, 0); goto retry; } assert(*list != first); /* Since we never insert an entry on the black list, this cannot have */ /* succeeded unless first remained on the list while we were running. */ /* Thus its next link cannot have changed out from under us, and we */ /* removed exactly one entry and preserved the rest of the list. */ /* Note that it is quite possible that an additional entry was */ /* inserted and removed while we were running; this is OK since the */ /* part of the list following first must have remained unchanged, and */ /* first must again have been at the head of the list when the */ /* compare_and_swap succeeded. */ AO_store_release(a->AO_stack_bl+i, 0); return first_ptr; } #else /* ! USE_ALMOST_LOCK_FREE */ /* Better names for fields in AO_stack_t */ #define ptr AO_val2 #define version AO_val1 #if defined(AO_HAVE_compare_double_and_swap_double) void AO_stack_push_release(AO_stack_t *list, AO_t *element) { AO_t next; do { next = AO_load(&(list -> ptr)); *element = next; } while (!AO_compare_and_swap_release ( &(list -> ptr), next, (AO_t) element)); /* This uses a narrow CAS here, an old optimization suggested */ /* by Treiber. Pop is still safe, since we run into the ABA */ /* problem only if there were both interveining "pop"s and "push"es.*/ /* Inthat case we still see a change inthe version number. */ } AO_t *AO_stack_pop_acquire(AO_stack_t *list) { AO_t *cptr; AO_t next; AO_t cversion; do { /* Version must be loaded first. */ cversion = AO_load_acquire(&(list -> version)); cptr = (AO_t *)AO_load(&(list -> ptr)); if (cptr == 0) return 0; next = *cptr; } while (!AO_compare_double_and_swap_double_release (list, cversion, (AO_t) cptr, cversion+1, (AO_t) next)); return cptr; } #elif defined(AO_HAVE_compare_and_swap_double) /* Needed for future IA64 processors. No current clients? */ #error Untested! Probably doesnt work. /* We have a wide CAS, but only does an AO_t-wide comparison. */ /* We can't use the Treiber optimization, since we only check */ /* for an unchanged version number, not an unchanged pointer. */ void AO_stack_push_release(AO_stack_t *list, AO_t *element) { AO_t version; AO_t next_ptr; do { /* Again version must be loaded first, for different reason. */ version = AO_load_acquire(&(list -> version)); next_ptr = AO_load(&(list -> ptr)); *element = next_ptr; } while (!AO_compare_and_swap_double_release( list, version, version+1, (AO_t) element)); } AO_t *AO_stack_pop_acquire(AO_stack_t *list) { AO_t *cptr; AO_t next; AO_t cversion; do { cversion = AO_load_acquire(&(list -> version)); cptr = (AO_t *)AO_load(&(list -> ptr)); if (cptr == 0) return 0; next = *cptr; } while (!AO_compare_double_and_swap_double_release (list, cversion, (AO_t) cptr, cversion+1, next)); return cptr; } #endif /* AO_HAVE_compare_and_swap_double */ #endif /* ! USE_ALMOST_LOCK_FREE */ synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops.h0000644000076400007640000002672211104702315023610 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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 ATOMIC_OPS_H #define ATOMIC_OPS_H #include #include /* We define various atomic operations on memory in a */ /* machine-specific way. Unfortunately, this is complicated */ /* by the fact that these may or may not be combined with */ /* various memory barriers. Thus the actual operations we */ /* define have the form AO__, for all */ /* plausible combinations of and . */ /* This of course results in a mild combinatorial explosion. */ /* To deal with it, we try to generate derived */ /* definitions for as many of the combinations as we can, as */ /* automatically as possible. */ /* */ /* Our assumption throughout is that the programmer will */ /* specify the least demanding operation and memory barrier */ /* that will guarantee correctness for the implementation. */ /* Our job is to find the least expensive way to implement it */ /* on the applicable hardware. In many cases that will */ /* involve, for example, a stronger memory barrier, or a */ /* combination of hardware primitives. */ /* */ /* Conventions: */ /* "plain" atomic operations are not guaranteed to include */ /* a barrier. The suffix in the name specifies the barrier */ /* type. Suffixes are: */ /* _release: Earlier operations may not be delayed past it. */ /* _acquire: Later operations may not move ahead of it. */ /* _read: Subsequent reads must follow this operation and */ /* preceding reads. */ /* _write: Earlier writes precede both this operation and */ /* later writes. */ /* _full: Ordered with respect to both earlier and later memops.*/ /* _release_write: Ordered with respect to earlier writes. */ /* _acquire_read: Ordered with repsect to later reads. */ /* */ /* Currently we try to define the following atomic memory */ /* operations, in combination with the above barriers: */ /* AO_nop */ /* AO_load */ /* AO_store */ /* AO_test_and_set (binary) */ /* AO_fetch_and_add */ /* AO_fetch_and_add1 */ /* AO_fetch_and_sub1 */ /* AO_or */ /* AO_compare_and_swap */ /* */ /* Note that atomicity guarantees are valid only if both */ /* readers and writers use AO_ operations to access the */ /* shared value, while ordering constraints are intended to */ /* apply all memory operations. If a location can potentially */ /* be accessed simultaneously from multiple threads, and one of */ /* those accesses may be a write access, then all such */ /* accesses to that location should be through AO_ primitives. */ /* However if AO_ operations enforce sufficient ordering to */ /* ensure that a location x cannot be accessed concurrently, */ /* or can only be read concurrently, then x can be accessed */ /* via ordinary references and assignments. */ /* */ /* Compare_and_exchange takes an address and an expected old */ /* value and a new value, and returns an int. Nonzero */ /* indicates that it succeeded. */ /* Test_and_set takes an address, atomically replaces it by */ /* AO_TS_SET, and returns the prior value. */ /* An AO_TS_t location can be reset with the */ /* AO_CLEAR macro, which normally uses AO_store_release. */ /* AO_fetch_and_add takes an address and an AO_t increment */ /* value. The AO_fetch_and_add1 and AO_fetch_and_sub1 variants */ /* are provided, since they allow faster implementations on */ /* some hardware. AO_or atomically ors an AO_t value into a */ /* memory location, but does not provide access to the original.*/ /* */ /* We expect this list to grow slowly over time. */ /* */ /* Note that AO_nop_full is a full memory barrier. */ /* */ /* Note that if some data is initialized with */ /* data.x = ...; data.y = ...; ... */ /* AO_store_release_write(&data_is_initialized, 1) */ /* then data is guaranteed to be initialized after the test */ /* if (AO_load_release_read(&data_is_initialized)) ... */ /* succeeds. Furthermore, this should generate near-optimal */ /* code on all common platforms. */ /* */ /* All operations operate on unsigned AO_t, which */ /* is the natural word size, and usually unsigned long. */ /* It is possible to check whether a particular operation op */ /* is available on a particular platform by checking whether */ /* AO_HAVE_op is defined. We make heavy use of these macros */ /* internally. */ /* The rest of this file basically has three sections: */ /* */ /* Some utility and default definitions. */ /* */ /* The architecture dependent section: */ /* This defines atomic operations that have direct hardware */ /* support on a particular platform, mostly by uncluding the */ /* appropriate compiler- and hardware-dependent file. */ /* */ /* The synthesis section: */ /* This tries to define other atomic operations in terms of */ /* those that are explicitly available on the platform. */ /* This section is hardware independent. */ /* We make no attempt to synthesize operations in ways that */ /* effectively introduce locks, except for the debugging/demo */ /* pthread-based implementation at the beginning. A more */ /* relistic implementation that falls back to locks could be */ /* added as a higher layer. But that would sacrifice */ /* usability from signal handlers. */ /* The synthesis section is implemented almost entirely in */ /* atomic_ops_generalize.h. */ /* Some common defaults. Overridden for some architectures. */ #define AO_t size_t /* The test_and_set primitive returns an AO_TS_VAL_t value. */ /* AO_TS_t is the type of an in-memory test-and-set location. */ #define AO_TS_INITIALIZER (AO_t)AO_TS_CLEAR /* Platform-dependent stuff: */ #if defined(__GNUC__) || defined(_MSC_VER) || defined(__INTEL_COMPILER) # define AO_INLINE static __inline #else # define AO_INLINE static #endif #if defined(__GNUC__) && !defined(__INTEL_COMPILER) # define AO_compiler_barrier() __asm__ __volatile__("" : : : "memory") #elif defined(_MSC_VER) # if defined(_AMD64_) # pragma intrinsic(_ReadWriteBarrier) # define AO_compiler_barrier() _ReadWriteBarrier() /* We assume this does not generate a fence instruction. */ /* The documentation is a bit unclear. */ # else # define AO_compiler_barrier() __asm { } /* The preceding implementation may be preferable here too. */ /* But the documentation warns about VC++ 2003 and earlier. */ # endif #elif defined(__INTEL_COMPILER) # define AO_compiler_barrier() __memory_barrier() /* Too strong? IA64-only? */ #elif defined(_HPUX_SOURCE) # if defined(__ia64) # include # define AO_compiler_barrier() _Asm_sched_fence() # else /* FIXME - We dont know how to do this. This is a guess. */ /* And probably a bad one. */ static volatile int AO_barrier_dummy; # define AO_compiler_barrier() AO_barrier_dummy = AO_barrier_dummy # endif #else /* We conjecture that the following usually gives us the right */ /* semantics or an error. */ # define AO_compiler_barrier() asm("") #endif #if defined(AO_USE_PTHREAD_DEFS) # include "atomic_ops/sysdeps/generic_pthread.h" #endif /* AO_USE_PTHREAD_DEFS */ #if defined(__GNUC__) && !defined(AO_USE_PTHREAD_DEFS) \ && !defined(__INTEL_COMPILER) # if defined(__i386__) # include "atomic_ops/sysdeps/gcc/x86.h" # endif /* __i386__ */ # if defined(__x86_64__) # include "atomic_ops/sysdeps/gcc/x86_64.h" # endif /* __i386__ */ # if defined(__ia64__) # include "atomic_ops/sysdeps/gcc/ia64.h" # define AO_GENERALIZE_TWICE # endif /* __ia64__ */ # if defined(__hppa__) # include "atomic_ops/sysdeps/gcc/hppa.h" # define AO_CAN_EMUL_CAS # endif /* __hppa__ */ # if defined(__alpha__) # include "atomic_ops/sysdeps/gcc/alpha.h" # define AO_GENERALIZE_TWICE # endif /* __alpha__ */ # if defined(__s390__) # include "atomic_ops/sysdeps/gcc/s390.h" # endif /* __s390__ */ # if defined(__sparc__) # include "atomic_ops/sysdeps/gcc/sparc.h" # define AO_CAN_EMUL_CAS # endif /* __sparc__ */ # if defined(__m68k__) # include "atomic_ops/sysdeps/gcc/m68k.h" # endif /* __m68k__ */ # if defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) # include "atomic_ops/sysdeps/gcc/powerpc.h" # endif /* __powerpc__ */ # if defined(__arm__) && !defined(AO_USE_PTHREAD_DEFS) # include "atomic_ops/sysdeps/gcc/arm.h" # define AO_CAN_EMUL_CAS # endif /* __arm__ */ # if defined(__cris__) || defined(CRIS) # include "atomic_ops/sysdeps/gcc/cris.h" # endif #endif /* __GNUC__ && !AO_USE_PTHREAD_DEFS */ #if defined(__INTEL_COMPILER) && !defined(AO_USE_PTHREAD_DEFS) # if defined(__ia64__) # include "atomic_ops/sysdeps/icc/ia64.h" # define AO_GENERALIZE_TWICE # endif #endif #if defined(_HPUX_SOURCE) && !defined(__GNUC__) && !defined(AO_USE_PTHREAD_DEFS) # if defined(__ia64) # include "atomic_ops/sysdeps/hpc/ia64.h" # define AO_GENERALIZE_TWICE # else # include "atomic_ops/sysdeps/hpc/hppa.h" # define AO_CAN_EMUL_CAS # endif #endif #if !defined(__GNUC__) && (defined(sparc) || defined(__sparc)) \ && !defined(AO_USE_PTHREAD_DEFS) # include "atomic_ops/sysdeps/sunc/sparc.h" # define AO_CAN_EMUL_CAS #endif #if defined(_MSC_VER) # if defined(_AMD64_) # include "atomic_ops/sysdeps/msftc/x86_64.h" # elif _M_IX86 >= 400 # include "atomic_ops/sysdeps/msftc/x86.h" # endif #endif #if defined(AO_REQUIRE_CAS) && !defined(AO_HAVE_compare_and_swap) \ && !defined(AO_HAVE_compare_and_swap_full) \ && !defined(AO_HAVE_compare_and_swap_acquire) # if defined(AO_CAN_EMUL_CAS) # include "atomic_ops/sysdeps/emul_cas.h" # else # error Cannot implement AO_compare_and_swap_full on this architecture. # endif #endif /* AO_REQUIRE_CAS && !AO_HAVE_compare_and_swap ... */ /* The most common way to clear a test-and-set location */ /* at the end of a critical section. */ #if AO_AO_TS_T && !defined(AO_CLEAR) # define AO_CLEAR(addr) AO_store_release((AO_TS_t *)addr, AO_TS_CLEAR) #endif #if AO_CHAR_TS_T && !defined(AO_CLEAR) # define AO_CLEAR(addr) AO_char_store_release((AO_TS_t *)addr, AO_TS_CLEAR) #endif /* * The generalization section. * Theoretically this should repeatedly include atomic_ops_generalize.h. * In fact, we observe that this converges after a small fixed number * of iterations, usually one. */ #include "atomic_ops/generalize.h" #ifdef AO_GENERALIZE_TWICE # include "atomic_ops/generalize.h" #endif /* For compatibility with version 0.4 and earlier */ #define AO_TS_T AO_TS_t #define AO_T AO_t #define AO_TS_VAL AO_TS_VAL_t #endif /* ATOMIC_OPS_H */ synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/Makefile.in0000664000076400007640000004641311104702315023350 0ustar stefanstefan# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 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 = $(libatomic_ops_a_SOURCES) $(libatomic_ops_gpl_a_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@ target_triplet = @target@ subdir = src DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" libLIBRARIES_INSTALL = $(INSTALL_DATA) LIBRARIES = $(lib_LIBRARIES) AR = ar ARFLAGS = cru libatomic_ops_a_AR = $(AR) $(ARFLAGS) libatomic_ops_a_LIBADD = am__libatomic_ops_a_SOURCES_DIST = atomic_ops.c atomic_ops_sysdeps.S @NEED_ASM_FALSE@am_libatomic_ops_a_OBJECTS = atomic_ops.$(OBJEXT) @NEED_ASM_TRUE@am_libatomic_ops_a_OBJECTS = atomic_ops.$(OBJEXT) \ @NEED_ASM_TRUE@ atomic_ops_sysdeps.$(OBJEXT) libatomic_ops_a_OBJECTS = $(am_libatomic_ops_a_OBJECTS) libatomic_ops_gpl_a_AR = $(AR) $(ARFLAGS) libatomic_ops_gpl_a_LIBADD = am_libatomic_ops_gpl_a_OBJECTS = atomic_ops_stack.$(OBJEXT) \ atomic_ops_malloc.$(OBJEXT) libatomic_ops_gpl_a_OBJECTS = $(am_libatomic_ops_gpl_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I. depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libatomic_ops_a_SOURCES) $(libatomic_ops_gpl_a_SOURCES) DIST_SOURCES = $(am__libatomic_ops_a_SOURCES_DIST) \ $(libatomic_ops_gpl_a_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 includeHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(include_HEADERS) ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ NEED_ASM_FALSE = @NEED_ASM_FALSE@ NEED_ASM_TRUE = @NEED_ASM_TRUE@ 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@ PICFLAG = @PICFLAG@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ 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__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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ SUBDIRS = atomic_ops AM_CFLAGS = @PICFLAG@ include_HEADERS = atomic_ops.h atomic_ops_stack.h atomic_ops_malloc.h lib_LIBRARIES = libatomic_ops.a libatomic_ops_gpl.a @NEED_ASM_FALSE@libatomic_ops_a_SOURCES = atomic_ops.c @NEED_ASM_TRUE@libatomic_ops_a_SOURCES = atomic_ops.c atomic_ops_sysdeps.S libatomic_ops_gpl_a_SOURCES = atomic_ops_stack.c atomic_ops_malloc.c EXTRA_DIST = Makefile.msft all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .S .c .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 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 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 src/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 install-libLIBRARIES: $(lib_LIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done @$(POST_INSTALL) @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ p=$(am__strip_dir) \ echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \ $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \ else :; fi; \ done uninstall-libLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \ rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLIBRARIES: -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) libatomic_ops.a: $(libatomic_ops_a_OBJECTS) $(libatomic_ops_a_DEPENDENCIES) -rm -f libatomic_ops.a $(libatomic_ops_a_AR) libatomic_ops.a $(libatomic_ops_a_OBJECTS) $(libatomic_ops_a_LIBADD) $(RANLIB) libatomic_ops.a libatomic_ops_gpl.a: $(libatomic_ops_gpl_a_OBJECTS) $(libatomic_ops_gpl_a_DEPENDENCIES) -rm -f libatomic_ops_gpl.a $(libatomic_ops_gpl_a_AR) libatomic_ops_gpl.a $(libatomic_ops_gpl_a_OBJECTS) $(libatomic_ops_gpl_a_LIBADD) $(RANLIB) libatomic_ops_gpl.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atomic_ops.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atomic_ops_malloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atomic_ops_stack.Po@am__quote@ .S.o: $(CCASCOMPILE) -c $< .S.obj: $(CCASCOMPILE) -c `$(CYGPATH_W) '$<'` .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` uninstall-info-am: install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)" @list='$(include_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ rm -f "$(DESTDIR)$(includedir)/$$f"; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done 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) @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 check-am: all-am check: check-recursive all-am: Makefile $(LIBRARIES) $(HEADERS) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libLIBRARIES mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-includeHEADERS install-exec-am: install-libLIBRARIES install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-includeHEADERS uninstall-info-am \ uninstall-libLIBRARIES uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ clean clean-generic clean-libLIBRARIES clean-recursive ctags \ ctags-recursive distclean distclean-compile distclean-generic \ distclean-hdr distclean-recursive 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-includeHEADERS install-info install-info-am \ install-libLIBRARIES install-man install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic maintainer-clean-recursive \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-includeHEADERS \ uninstall-info-am uninstall-libLIBRARIES # 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: synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/Makefile.am0000664000076400007640000000057411104702315023335 0ustar stefanstefanSUBDIRS=atomic_ops AM_CFLAGS=@PICFLAG@ include_HEADERS=atomic_ops.h atomic_ops_stack.h atomic_ops_malloc.h lib_LIBRARIES = libatomic_ops.a libatomic_ops_gpl.a if NEED_ASM libatomic_ops_a_SOURCES = atomic_ops.c atomic_ops_sysdeps.S else libatomic_ops_a_SOURCES = atomic_ops.c endif libatomic_ops_gpl_a_SOURCES = atomic_ops_stack.c atomic_ops_malloc.c EXTRA_DIST=Makefile.msft synopsis-0.12/src/Synopsis/gc/libatomic_ops/src/atomic_ops_sysdeps.S0000664000076400007640000000046211104702315025330 0ustar stefanstefan/* * Include the appropriate system-dependent assembly file, if any. * This is used only if the platform supports neither inline assembly * code, nor appropriate compiler intrinsics. */ #if !defined(__GNUC__) && (defined(sparc) || defined(__sparc)) # include "atomic_ops/sysdeps/sunc/sparc.S" #endif synopsis-0.12/src/Synopsis/gc/libatomic_ops/depcomp0000775000076400007640000003710011104702315022062 0ustar stefanstefan#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2005-07-09.11 # 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., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by 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 -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: synopsis-0.12/src/Synopsis/gc/libatomic_ops/AUTHORS0000664000076400007640000000023011104702315021547 0ustar stefanstefanOriginally written by Hans Boehm, with some platform-dependent code imported from the Boehm-Demers-Weiser GC, where it was contributed by many others. synopsis-0.12/src/Synopsis/gc/libatomic_ops/config.sub0000775000076400007640000007726411104702315022507 0ustar stefanstefan#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2006-06-06' # 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., 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. # 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, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xscalee[bl] | 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) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ | 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 ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; 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 ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; 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 ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; 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 ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -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 spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: synopsis-0.12/src/Synopsis/gc/libatomic_ops/compile0000775000076400007640000000717311104702316022073 0ustar stefanstefan#! /bin/sh # Wrapper for compilers which do not understand `-c -o'. scriptversion=2005-05-14.22 # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand `-c -o'. Remove `-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file `INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; esac ofile= cfile= eat= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as `compile cc -o foo foo.c'. # So we strip `-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no `-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # `.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'` # Create the lock directory. # Note: use `[/.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: synopsis-0.12/src/Synopsis/gc/libatomic_ops/missing0000775000076400007640000002540611104702315022112 0ustar stefanstefan#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2005-06-08.21 # 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., 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. 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 # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: synopsis-0.12/src/Synopsis/gc/libatomic_ops/Makefile.in0000664000076400007640000004307511104702315022562 0ustar stefanstefan# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 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@ target_triplet = @target@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \ ChangeLog INSTALL NEWS compile config.guess config.sub depcomp \ install-sh missing mkinstalldirs subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/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 = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ NEED_ASM_FALSE = @NEED_ASM_FALSE@ NEED_ASM_TRUE = @NEED_ASM_TRUE@ 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@ PICFLAG = @PICFLAG@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ 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__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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ SUBDIRS = src doc tests all: 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) 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): @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done 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) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ 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) $(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) $(am__remove_distdir) mkdir $(distdir) @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 installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ check-am clean clean-generic clean-recursive ctags \ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \ dist-tarZ dist-zip distcheck distclean distclean-generic \ distclean-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-recursive pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-info-am #distclean-local: # 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: synopsis-0.12/src/Synopsis/gc/libatomic_ops/configure.ac0000664000076400007640000000256711104702316023005 0ustar stefanstefan# Process this file with autoconf to produce a configure script. AC_INIT([libatomic_ops],[1.2]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR(src/atomic_ops.c) AM_INIT_AUTOMAKE AC_PROG_RANLIB AM_CONFIG_HEADER(src/config.h) # Checks for programs. AC_PROG_CC AM_PROG_AS # Checks for functions. AC_FUNC_MMAP # Checks for header files. AC_HEADER_STDC # AC_CHECK_HEADERS([ ]) # Determine PIC flag, adjust default CFLAGS need_asm=false PICFLAG= AC_MSG_CHECKING(Determining PIC compiler flag) if test "$GCC" = yes; then AC_MSG_RESULT(-fPIC) PICFLAG=-fPIC else case "$host" in *-*-hpux*) AC_MSG_RESULT("+Z") PICFLAG="+Z" if test "$GCC" != yes; then CFLAGS="$CFLAGS +O2 -mt" fi ;; *-*-solaris*) AC_MSG_RESULT(-Kpic) PICFLAG=-Kpic if test "$GCC" != yes; then CFLAGS="$CFLAGS -O" need_asm=true fi ;; *-*-linux*) AC_MSG_RESULT(-fPIC) PICFLAG=-fPIC # Any Linux compiler had better be gcc compatible. ;; *) AC_MSG_RESULT("") ;; esac fi CFLAGS="$CFLAGS -DNDEBUG" AC_SUBST(PICFLAG) AC_SUBST(DEFS) AM_CONDITIONAL(NEED_ASM, test x$need_asm = xtrue) AC_CONFIG_FILES([Makefile src/Makefile src/atomic_ops/Makefile src/atomic_ops/sysdeps/Makefile doc/Makefile tests/Makefile]) AC_CONFIG_COMMANDS([default],[[]],[[PICFLAG=${PICFLAG} CC=${CC} DEFS=${DEFS}]]) AC_OUTPUT synopsis-0.12/src/Synopsis/gc/libatomic_ops/tests/0000775000076400007640000000000011172123233021647 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops/tests/test_stack.c0000664000076400007640000001357111104702316024166 0ustar stefanstefan/* * Copyright (c) 2005 Hewlett-Packard Development Company, L.P. * Original Author: Hans Boehm * * This file may be redistributed and/or modified 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. * * It is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License in the * file doc/COPYING for more details. */ #if defined(HAVE_CONFIG_H) # include "config.h" #endif #include #include #include #include "atomic_ops.h" #include "atomic_ops_stack.h" #define MAX_NTHREADS 100 #ifndef NO_TIMES #include #include /* Need 64-bit long long support */ long long get_msecs(void) { struct timeval tv; gettimeofday(&tv, 0); return (long long)tv.tv_sec * 1000 + tv.tv_usec/1000; } #else # define get_msecs() 0 #endif typedef struct le { AO_t next; int data; } list_element; AO_stack_t the_list = AO_STACK_INITIALIZER; void add_elements(int n) { list_element * le; if (n == 0) return; add_elements(n-1); le = malloc(sizeof(list_element)); le -> data = n; AO_stack_push(&the_list, (AO_t *)le); } void print_list() { list_element *p; for (p = (list_element *)AO_REAL_HEAD_PTR(the_list); p != 0; p = (list_element *)AO_REAL_NEXT_PTR(p -> next)) printf("%d\n", p -> data); } static char marks[MAX_NTHREADS * MAX_NTHREADS]; void check_list(int n) { list_element *p; int i; for (i = 1; i <= n; ++i) marks[i] = 0; for (p = (list_element *)AO_REAL_HEAD_PTR(the_list); p != 0; p = (list_element *)AO_REAL_NEXT_PTR(p -> next)) { if (p -> data > n || p -> data <= 0) fprintf(stderr, "Found erroneous list element %d\n", p -> data); if (marks[p -> data] != 0) fprintf(stderr, "Found duplicate list element %d\n", p -> data); marks[p -> data] = 1; } for (i = 1; i <= n; ++i) if (marks[i] != 1) fprintf(stderr, "Missing list element %d\n", i); } volatile AO_t ops_performed = 0; #define LIMIT 1000000 /* Total number of push/pop ops in all threads per test. */ #ifdef AO_HAVE_fetch_and_add # define fetch_and_add(addr, val) AO_fetch_and_add(addr, val) #else /* Fake it. This is really quite unacceptable for timing */ /* purposes. But as a correctness test, it should be OK. */ AO_INLINE AO_t fetch_and_add(volatile AO_t * addr, AO_t val) { AO_t result = AO_load(addr); AO_store(addr, result + val); return result; } #endif void * run_one_test(void * arg) { list_element * t[MAX_NTHREADS + 1]; list_element * aux; long index = (long)arg; int i; int j = 0; # ifdef VERBOSE printf("starting thread %d\n", index); # endif while (fetch_and_add(&ops_performed, index + 1) + index + 1 < LIMIT) { for (i = 0; i < index + 1; ++i) { t[i] = (list_element *)AO_stack_pop(&the_list); if (0 == t[i]) { fprintf(stderr, "FAILED\n"); abort(); } } for (i = 0; i < index + 1; ++i) { AO_stack_push(&the_list, (AO_t *)t[i]); } j += (index + 1); } # ifdef VERBOSE printf("finished thread %d: %d total ops\n", index, j); # endif return 0; } #define N_EXPERIMENTS 1 unsigned long times[MAX_NTHREADS + 1][N_EXPERIMENTS]; int main(int argc, char **argv) { int nthreads; int max_nthreads; int exper_n; if (1 == argc) max_nthreads = 4; else if (2 == argc) { max_nthreads = atoi(argv[1]); if (max_nthreads < 1 || max_nthreads > MAX_NTHREADS) { fprintf(stderr, "Invalid max # of threads argument\n"); exit(1); } } else { fprintf(stderr, "Usage: %s [max # of threads]\n", argv[0]); exit(1); } for (exper_n = 0; exper_n < N_EXPERIMENTS; ++ exper_n) for (nthreads = 1; nthreads <= max_nthreads; ++nthreads) { int i; pthread_t thread[MAX_NTHREADS]; int list_length = nthreads*(nthreads+1)/2; long long start_time; add_elements(list_length); # ifdef VERBOSE printf("Initial list (nthreads = %d):\n", nthreads); print_list(); # endif ops_performed = 0; start_time = get_msecs(); for (i = 1; i < nthreads; ++i) { int code; if ((code = pthread_create(thread+i, 0, run_one_test, (void *)(long)i)) != 0) { fprintf(stderr, "Thread creation failed %u\n", code); exit(1); } } /* We use the main thread to run one test. This allows gprof */ /* profiling to work, for example. */ run_one_test(0); for (i = 1; i < nthreads; ++i) { int code; if ((code = pthread_join(thread[i], 0)) != 0) { fprintf(stderr, "Thread join failed %u\n", code); } } times[nthreads][exper_n] = (unsigned long)(get_msecs() - start_time); # ifdef VERBOSE printf("%d %lu\n", nthreads, (unsigned long)(get_msecs() - start_time)); printf("final list (should be reordered initial list):\n"); print_list(); # endif check_list(list_length); while ((list_element *)AO_stack_pop(&the_list)); } # ifndef NO_TIMES for (nthreads = 1; nthreads <= max_nthreads; ++nthreads) { unsigned long sum = 0; printf("About %d pushes + %d pops in %d threads:", LIMIT, LIMIT, nthreads); for (exper_n = 0; exper_n < N_EXPERIMENTS; ++exper_n) { # if defined(VERBOSE) printf("[%lu] ", times[nthreads][exper_n]); # endif sum += times[nthreads][exper_n]; } printf(" %lu msecs\n", (sum + N_EXPERIMENTS/2)/N_EXPERIMENTS); } # endif /* NO_TIMES */ return 0; } synopsis-0.12/src/Synopsis/gc/libatomic_ops/tests/test_atomic_include.h0000664000076400007640000013165411104702316026050 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ void test_atomic(void); void test_atomic_release(void); void test_atomic_acquire(void); void test_atomic_read(void); void test_atomic_write(void); void test_atomic_full(void); void test_atomic_release_write(void); void test_atomic_acquire_read(void); /* Some basic sanity tests. These do not test the barrier semantics. */ #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: )\n", \ __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ fprintf(stderr, "Missing: %s\n", #name "") void test_atomic(void) { AO_t x; unsigned char b; unsigned short s; unsigned int zz; # if defined(AO_HAVE_test_and_set) AO_TS_t z = AO_TS_INITIALIZER; # endif # if defined(AO_HAVE_double_t) AO_double_t w; w.AO_val1 = 0; w.AO_val2 = 0; # endif # if defined(AO_HAVE_nop) AO_nop(); # else MISSING(AO_nop); # endif # if defined(AO_HAVE_store) AO_store(&x, 13); TA_assert (x == 13); # else MISSING(AO_store); x = 13; # endif # if defined(AO_HAVE_load) TA_assert(AO_load(&x) == 13); # else MISSING(AO_load); # endif # if defined(AO_HAVE_test_and_set) assert(AO_test_and_set(&z) == AO_TS_CLEAR); assert(AO_test_and_set(&z) == AO_TS_SET); assert(AO_test_and_set(&z) == AO_TS_SET); AO_CLEAR(&z); # else MISSING(AO_test_and_set); # endif # if defined(AO_HAVE_fetch_and_add) TA_assert(AO_fetch_and_add(&x, 42) == 13); TA_assert(AO_fetch_and_add(&x, -42) == 55); # else MISSING(AO_fetch_and_add); # endif # if defined(AO_HAVE_fetch_and_add1) TA_assert(AO_fetch_and_add1(&x) == 13); # else MISSING(AO_fetch_and_add1); ++x; # endif # if defined(AO_HAVE_fetch_and_sub1) TA_assert(AO_fetch_and_sub1(&x) == 14); # else MISSING(AO_fetch_and_sub1); --x; # endif # if defined(AO_HAVE_short_store) AO_short_store(&s, 13); # else MISSING(AO_short_store); s = 13; # endif # if defined(AO_HAVE_short_load) TA_assert(AO_short_load(&s) == 13); # else MISSING(AO_short_load); # endif # if defined(AO_HAVE_short_fetch_and_add) TA_assert(AO_short_fetch_and_add(&s, 42) == 13); TA_assert(AO_short_fetch_and_add(&s, -42) == 55); # else MISSING(AO_short_fetch_and_add); # endif # if defined(AO_HAVE_short_fetch_and_add1) TA_assert(AO_short_fetch_and_add1(&s) == 13); # else MISSING(AO_short_fetch_and_add1); ++s; # endif # if defined(AO_HAVE_short_fetch_and_sub1) TA_assert(AO_short_fetch_and_sub1(&s) == 14); # else MISSING(AO_short_fetch_and_sub1); --s; # endif # if defined(AO_HAVE_char_store) AO_char_store(&b, 13); # else MISSING(AO_char_store); b = 13; # endif # if defined(AO_HAVE_char_load) TA_assert(AO_char_load(&b) == 13); # else MISSING(AO_char_load); # endif # if defined(AO_HAVE_char_fetch_and_add) TA_assert(AO_char_fetch_and_add(&b, 42) == 13); TA_assert(AO_char_fetch_and_add(&b, -42) == 55); # else MISSING(AO_char_fetch_and_add); # endif # if defined(AO_HAVE_char_fetch_and_add1) TA_assert(AO_char_fetch_and_add1(&b) == 13); # else MISSING(AO_char_fetch_and_add1); ++b; # endif # if defined(AO_HAVE_char_fetch_and_sub1) TA_assert(AO_char_fetch_and_sub1(&b) == 14); # else MISSING(AO_char_fetch_and_sub1); --b; # endif # if defined(AO_HAVE_int_store) AO_int_store(&zz, 13); # else MISSING(AO_int_store); zz = 13; # endif # if defined(AO_HAVE_int_load) TA_assert(AO_int_load(&zz) == 13); # else MISSING(AO_int_load); # endif # if defined(AO_HAVE_int_fetch_and_add) TA_assert(AO_int_fetch_and_add(&zz, 42) == 13); TA_assert(AO_int_fetch_and_add(&zz, -42) == 55); # else MISSING(AO_int_fetch_and_add); # endif # if defined(AO_HAVE_int_fetch_and_add1) TA_assert(AO_int_fetch_and_add1(&zz) == 13); # else MISSING(AO_int_fetch_and_add1); ++zz; # endif # if defined(AO_HAVE_int_fetch_and_sub1) TA_assert(AO_int_fetch_and_sub1(&zz) == 14); # else MISSING(AO_int_fetch_and_sub1); --zz; # endif # if defined(AO_HAVE_compare_and_swap) TA_assert(!AO_compare_and_swap(&x, 14, 42)); TA_assert(x == 13); TA_assert(AO_compare_and_swap(&x, 13, 42)); TA_assert(x == 42); # else MISSING(AO_compare_and_swap); # endif # if defined(AO_HAVE_or) AO_or(&x, 66); TA_assert(x == 106); # else MISSING(AO_or); x |= 34; # endif # if defined(AO_HAVE_compare_double_and_swap_double) TA_assert(!AO_compare_double_and_swap_double(&w, 17, 42, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_double_and_swap_double(&w, 0, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_double_and_swap_double(&w, 12, 13, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); w.AO_val1 = 0; w.AO_val2 = 0; # else MISSING(AO_compare_double_and_swap_double); # endif # if defined(AO_HAVE_compare_and_swap_double) TA_assert(!AO_compare_and_swap_double(&w, 17, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_and_swap_double(&w, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_and_swap_double(&w, 12, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); # else MISSING(AO_compare_and_swap_double); # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* Some basic sanity tests. These do not test the barrier semantics. */ #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _release)\n", \ __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ fprintf(stderr, "Missing: %s\n", #name "_release") void test_atomic_release(void) { AO_t x; unsigned char b; unsigned short s; unsigned int zz; # if defined(AO_HAVE_test_and_set_release) AO_TS_t z = AO_TS_INITIALIZER; # endif # if defined(AO_HAVE_double_t) AO_double_t w; w.AO_val1 = 0; w.AO_val2 = 0; # endif # if defined(AO_HAVE_nop_release) AO_nop_release(); # else MISSING(AO_nop); # endif # if defined(AO_HAVE_store_release) AO_store_release(&x, 13); TA_assert (x == 13); # else MISSING(AO_store); x = 13; # endif # if defined(AO_HAVE_load_release) TA_assert(AO_load_release(&x) == 13); # else MISSING(AO_load); # endif # if defined(AO_HAVE_test_and_set_release) assert(AO_test_and_set_release(&z) == AO_TS_CLEAR); assert(AO_test_and_set_release(&z) == AO_TS_SET); assert(AO_test_and_set_release(&z) == AO_TS_SET); AO_CLEAR(&z); # else MISSING(AO_test_and_set); # endif # if defined(AO_HAVE_fetch_and_add_release) TA_assert(AO_fetch_and_add_release(&x, 42) == 13); TA_assert(AO_fetch_and_add_release(&x, -42) == 55); # else MISSING(AO_fetch_and_add); # endif # if defined(AO_HAVE_fetch_and_add1_release) TA_assert(AO_fetch_and_add1_release(&x) == 13); # else MISSING(AO_fetch_and_add1); ++x; # endif # if defined(AO_HAVE_fetch_and_sub1_release) TA_assert(AO_fetch_and_sub1_release(&x) == 14); # else MISSING(AO_fetch_and_sub1); --x; # endif # if defined(AO_HAVE_short_store_release) AO_short_store_release(&s, 13); # else MISSING(AO_short_store); s = 13; # endif # if defined(AO_HAVE_short_load_release) TA_assert(AO_short_load(&s) == 13); # else MISSING(AO_short_load); # endif # if defined(AO_HAVE_short_fetch_and_add_release) TA_assert(AO_short_fetch_and_add_release(&s, 42) == 13); TA_assert(AO_short_fetch_and_add_release(&s, -42) == 55); # else MISSING(AO_short_fetch_and_add); # endif # if defined(AO_HAVE_short_fetch_and_add1_release) TA_assert(AO_short_fetch_and_add1_release(&s) == 13); # else MISSING(AO_short_fetch_and_add1); ++s; # endif # if defined(AO_HAVE_short_fetch_and_sub1_release) TA_assert(AO_short_fetch_and_sub1_release(&s) == 14); # else MISSING(AO_short_fetch_and_sub1); --s; # endif # if defined(AO_HAVE_char_store_release) AO_char_store_release(&b, 13); # else MISSING(AO_char_store); b = 13; # endif # if defined(AO_HAVE_char_load_release) TA_assert(AO_char_load(&b) == 13); # else MISSING(AO_char_load); # endif # if defined(AO_HAVE_char_fetch_and_add_release) TA_assert(AO_char_fetch_and_add_release(&b, 42) == 13); TA_assert(AO_char_fetch_and_add_release(&b, -42) == 55); # else MISSING(AO_char_fetch_and_add); # endif # if defined(AO_HAVE_char_fetch_and_add1_release) TA_assert(AO_char_fetch_and_add1_release(&b) == 13); # else MISSING(AO_char_fetch_and_add1); ++b; # endif # if defined(AO_HAVE_char_fetch_and_sub1_release) TA_assert(AO_char_fetch_and_sub1_release(&b) == 14); # else MISSING(AO_char_fetch_and_sub1); --b; # endif # if defined(AO_HAVE_int_store_release) AO_int_store_release(&zz, 13); # else MISSING(AO_int_store); zz = 13; # endif # if defined(AO_HAVE_int_load_release) TA_assert(AO_int_load(&zz) == 13); # else MISSING(AO_int_load); # endif # if defined(AO_HAVE_int_fetch_and_add_release) TA_assert(AO_int_fetch_and_add_release(&zz, 42) == 13); TA_assert(AO_int_fetch_and_add_release(&zz, -42) == 55); # else MISSING(AO_int_fetch_and_add); # endif # if defined(AO_HAVE_int_fetch_and_add1_release) TA_assert(AO_int_fetch_and_add1_release(&zz) == 13); # else MISSING(AO_int_fetch_and_add1); ++zz; # endif # if defined(AO_HAVE_int_fetch_and_sub1_release) TA_assert(AO_int_fetch_and_sub1_release(&zz) == 14); # else MISSING(AO_int_fetch_and_sub1); --zz; # endif # if defined(AO_HAVE_compare_and_swap_release) TA_assert(!AO_compare_and_swap_release(&x, 14, 42)); TA_assert(x == 13); TA_assert(AO_compare_and_swap_release(&x, 13, 42)); TA_assert(x == 42); # else MISSING(AO_compare_and_swap); # endif # if defined(AO_HAVE_or_release) AO_or_release(&x, 66); TA_assert(x == 106); # else MISSING(AO_or); x |= 34; # endif # if defined(AO_HAVE_compare_double_and_swap_double_release) TA_assert(!AO_compare_double_and_swap_double_release(&w, 17, 42, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_double_and_swap_double_release(&w, 0, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_double_and_swap_double_release(&w, 12, 13, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); w.AO_val1 = 0; w.AO_val2 = 0; # else MISSING(AO_compare_double_and_swap_double); # endif # if defined(AO_HAVE_compare_and_swap_double_release) TA_assert(!AO_compare_and_swap_double_release(&w, 17, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_and_swap_double_release(&w, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_and_swap_double_release(&w, 12, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); # else MISSING(AO_compare_and_swap_double); # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* Some basic sanity tests. These do not test the barrier semantics. */ #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _acquire)\n", \ __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ fprintf(stderr, "Missing: %s\n", #name "_acquire") void test_atomic_acquire(void) { AO_t x; unsigned char b; unsigned short s; unsigned int zz; # if defined(AO_HAVE_test_and_set_acquire) AO_TS_t z = AO_TS_INITIALIZER; # endif # if defined(AO_HAVE_double_t) AO_double_t w; w.AO_val1 = 0; w.AO_val2 = 0; # endif # if defined(AO_HAVE_nop_acquire) AO_nop_acquire(); # else MISSING(AO_nop); # endif # if defined(AO_HAVE_store_acquire) AO_store_acquire(&x, 13); TA_assert (x == 13); # else MISSING(AO_store); x = 13; # endif # if defined(AO_HAVE_load_acquire) TA_assert(AO_load_acquire(&x) == 13); # else MISSING(AO_load); # endif # if defined(AO_HAVE_test_and_set_acquire) assert(AO_test_and_set_acquire(&z) == AO_TS_CLEAR); assert(AO_test_and_set_acquire(&z) == AO_TS_SET); assert(AO_test_and_set_acquire(&z) == AO_TS_SET); AO_CLEAR(&z); # else MISSING(AO_test_and_set); # endif # if defined(AO_HAVE_fetch_and_add_acquire) TA_assert(AO_fetch_and_add_acquire(&x, 42) == 13); TA_assert(AO_fetch_and_add_acquire(&x, -42) == 55); # else MISSING(AO_fetch_and_add); # endif # if defined(AO_HAVE_fetch_and_add1_acquire) TA_assert(AO_fetch_and_add1_acquire(&x) == 13); # else MISSING(AO_fetch_and_add1); ++x; # endif # if defined(AO_HAVE_fetch_and_sub1_acquire) TA_assert(AO_fetch_and_sub1_acquire(&x) == 14); # else MISSING(AO_fetch_and_sub1); --x; # endif # if defined(AO_HAVE_short_store_acquire) AO_short_store_acquire(&s, 13); # else MISSING(AO_short_store); s = 13; # endif # if defined(AO_HAVE_short_load_acquire) TA_assert(AO_short_load(&s) == 13); # else MISSING(AO_short_load); # endif # if defined(AO_HAVE_short_fetch_and_add_acquire) TA_assert(AO_short_fetch_and_add_acquire(&s, 42) == 13); TA_assert(AO_short_fetch_and_add_acquire(&s, -42) == 55); # else MISSING(AO_short_fetch_and_add); # endif # if defined(AO_HAVE_short_fetch_and_add1_acquire) TA_assert(AO_short_fetch_and_add1_acquire(&s) == 13); # else MISSING(AO_short_fetch_and_add1); ++s; # endif # if defined(AO_HAVE_short_fetch_and_sub1_acquire) TA_assert(AO_short_fetch_and_sub1_acquire(&s) == 14); # else MISSING(AO_short_fetch_and_sub1); --s; # endif # if defined(AO_HAVE_char_store_acquire) AO_char_store_acquire(&b, 13); # else MISSING(AO_char_store); b = 13; # endif # if defined(AO_HAVE_char_load_acquire) TA_assert(AO_char_load(&b) == 13); # else MISSING(AO_char_load); # endif # if defined(AO_HAVE_char_fetch_and_add_acquire) TA_assert(AO_char_fetch_and_add_acquire(&b, 42) == 13); TA_assert(AO_char_fetch_and_add_acquire(&b, -42) == 55); # else MISSING(AO_char_fetch_and_add); # endif # if defined(AO_HAVE_char_fetch_and_add1_acquire) TA_assert(AO_char_fetch_and_add1_acquire(&b) == 13); # else MISSING(AO_char_fetch_and_add1); ++b; # endif # if defined(AO_HAVE_char_fetch_and_sub1_acquire) TA_assert(AO_char_fetch_and_sub1_acquire(&b) == 14); # else MISSING(AO_char_fetch_and_sub1); --b; # endif # if defined(AO_HAVE_int_store_acquire) AO_int_store_acquire(&zz, 13); # else MISSING(AO_int_store); zz = 13; # endif # if defined(AO_HAVE_int_load_acquire) TA_assert(AO_int_load(&zz) == 13); # else MISSING(AO_int_load); # endif # if defined(AO_HAVE_int_fetch_and_add_acquire) TA_assert(AO_int_fetch_and_add_acquire(&zz, 42) == 13); TA_assert(AO_int_fetch_and_add_acquire(&zz, -42) == 55); # else MISSING(AO_int_fetch_and_add); # endif # if defined(AO_HAVE_int_fetch_and_add1_acquire) TA_assert(AO_int_fetch_and_add1_acquire(&zz) == 13); # else MISSING(AO_int_fetch_and_add1); ++zz; # endif # if defined(AO_HAVE_int_fetch_and_sub1_acquire) TA_assert(AO_int_fetch_and_sub1_acquire(&zz) == 14); # else MISSING(AO_int_fetch_and_sub1); --zz; # endif # if defined(AO_HAVE_compare_and_swap_acquire) TA_assert(!AO_compare_and_swap_acquire(&x, 14, 42)); TA_assert(x == 13); TA_assert(AO_compare_and_swap_acquire(&x, 13, 42)); TA_assert(x == 42); # else MISSING(AO_compare_and_swap); # endif # if defined(AO_HAVE_or_acquire) AO_or_acquire(&x, 66); TA_assert(x == 106); # else MISSING(AO_or); x |= 34; # endif # if defined(AO_HAVE_compare_double_and_swap_double_acquire) TA_assert(!AO_compare_double_and_swap_double_acquire(&w, 17, 42, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_double_and_swap_double_acquire(&w, 0, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_double_and_swap_double_acquire(&w, 12, 13, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); w.AO_val1 = 0; w.AO_val2 = 0; # else MISSING(AO_compare_double_and_swap_double); # endif # if defined(AO_HAVE_compare_and_swap_double_acquire) TA_assert(!AO_compare_and_swap_double_acquire(&w, 17, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_and_swap_double_acquire(&w, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_and_swap_double_acquire(&w, 12, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); # else MISSING(AO_compare_and_swap_double); # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* Some basic sanity tests. These do not test the barrier semantics. */ #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _read)\n", \ __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ fprintf(stderr, "Missing: %s\n", #name "_read") void test_atomic_read(void) { AO_t x; unsigned char b; unsigned short s; unsigned int zz; # if defined(AO_HAVE_test_and_set_read) AO_TS_t z = AO_TS_INITIALIZER; # endif # if defined(AO_HAVE_double_t) AO_double_t w; w.AO_val1 = 0; w.AO_val2 = 0; # endif # if defined(AO_HAVE_nop_read) AO_nop_read(); # else MISSING(AO_nop); # endif # if defined(AO_HAVE_store_read) AO_store_read(&x, 13); TA_assert (x == 13); # else MISSING(AO_store); x = 13; # endif # if defined(AO_HAVE_load_read) TA_assert(AO_load_read(&x) == 13); # else MISSING(AO_load); # endif # if defined(AO_HAVE_test_and_set_read) assert(AO_test_and_set_read(&z) == AO_TS_CLEAR); assert(AO_test_and_set_read(&z) == AO_TS_SET); assert(AO_test_and_set_read(&z) == AO_TS_SET); AO_CLEAR(&z); # else MISSING(AO_test_and_set); # endif # if defined(AO_HAVE_fetch_and_add_read) TA_assert(AO_fetch_and_add_read(&x, 42) == 13); TA_assert(AO_fetch_and_add_read(&x, -42) == 55); # else MISSING(AO_fetch_and_add); # endif # if defined(AO_HAVE_fetch_and_add1_read) TA_assert(AO_fetch_and_add1_read(&x) == 13); # else MISSING(AO_fetch_and_add1); ++x; # endif # if defined(AO_HAVE_fetch_and_sub1_read) TA_assert(AO_fetch_and_sub1_read(&x) == 14); # else MISSING(AO_fetch_and_sub1); --x; # endif # if defined(AO_HAVE_short_store_read) AO_short_store_read(&s, 13); # else MISSING(AO_short_store); s = 13; # endif # if defined(AO_HAVE_short_load_read) TA_assert(AO_short_load(&s) == 13); # else MISSING(AO_short_load); # endif # if defined(AO_HAVE_short_fetch_and_add_read) TA_assert(AO_short_fetch_and_add_read(&s, 42) == 13); TA_assert(AO_short_fetch_and_add_read(&s, -42) == 55); # else MISSING(AO_short_fetch_and_add); # endif # if defined(AO_HAVE_short_fetch_and_add1_read) TA_assert(AO_short_fetch_and_add1_read(&s) == 13); # else MISSING(AO_short_fetch_and_add1); ++s; # endif # if defined(AO_HAVE_short_fetch_and_sub1_read) TA_assert(AO_short_fetch_and_sub1_read(&s) == 14); # else MISSING(AO_short_fetch_and_sub1); --s; # endif # if defined(AO_HAVE_char_store_read) AO_char_store_read(&b, 13); # else MISSING(AO_char_store); b = 13; # endif # if defined(AO_HAVE_char_load_read) TA_assert(AO_char_load(&b) == 13); # else MISSING(AO_char_load); # endif # if defined(AO_HAVE_char_fetch_and_add_read) TA_assert(AO_char_fetch_and_add_read(&b, 42) == 13); TA_assert(AO_char_fetch_and_add_read(&b, -42) == 55); # else MISSING(AO_char_fetch_and_add); # endif # if defined(AO_HAVE_char_fetch_and_add1_read) TA_assert(AO_char_fetch_and_add1_read(&b) == 13); # else MISSING(AO_char_fetch_and_add1); ++b; # endif # if defined(AO_HAVE_char_fetch_and_sub1_read) TA_assert(AO_char_fetch_and_sub1_read(&b) == 14); # else MISSING(AO_char_fetch_and_sub1); --b; # endif # if defined(AO_HAVE_int_store_read) AO_int_store_read(&zz, 13); # else MISSING(AO_int_store); zz = 13; # endif # if defined(AO_HAVE_int_load_read) TA_assert(AO_int_load(&zz) == 13); # else MISSING(AO_int_load); # endif # if defined(AO_HAVE_int_fetch_and_add_read) TA_assert(AO_int_fetch_and_add_read(&zz, 42) == 13); TA_assert(AO_int_fetch_and_add_read(&zz, -42) == 55); # else MISSING(AO_int_fetch_and_add); # endif # if defined(AO_HAVE_int_fetch_and_add1_read) TA_assert(AO_int_fetch_and_add1_read(&zz) == 13); # else MISSING(AO_int_fetch_and_add1); ++zz; # endif # if defined(AO_HAVE_int_fetch_and_sub1_read) TA_assert(AO_int_fetch_and_sub1_read(&zz) == 14); # else MISSING(AO_int_fetch_and_sub1); --zz; # endif # if defined(AO_HAVE_compare_and_swap_read) TA_assert(!AO_compare_and_swap_read(&x, 14, 42)); TA_assert(x == 13); TA_assert(AO_compare_and_swap_read(&x, 13, 42)); TA_assert(x == 42); # else MISSING(AO_compare_and_swap); # endif # if defined(AO_HAVE_or_read) AO_or_read(&x, 66); TA_assert(x == 106); # else MISSING(AO_or); x |= 34; # endif # if defined(AO_HAVE_compare_double_and_swap_double_read) TA_assert(!AO_compare_double_and_swap_double_read(&w, 17, 42, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_double_and_swap_double_read(&w, 0, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_double_and_swap_double_read(&w, 12, 13, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); w.AO_val1 = 0; w.AO_val2 = 0; # else MISSING(AO_compare_double_and_swap_double); # endif # if defined(AO_HAVE_compare_and_swap_double_read) TA_assert(!AO_compare_and_swap_double_read(&w, 17, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_and_swap_double_read(&w, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_and_swap_double_read(&w, 12, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); # else MISSING(AO_compare_and_swap_double); # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* Some basic sanity tests. These do not test the barrier semantics. */ #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _write)\n", \ __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ fprintf(stderr, "Missing: %s\n", #name "_write") void test_atomic_write(void) { AO_t x; unsigned char b; unsigned short s; unsigned int zz; # if defined(AO_HAVE_test_and_set_write) AO_TS_t z = AO_TS_INITIALIZER; # endif # if defined(AO_HAVE_double_t) AO_double_t w; w.AO_val1 = 0; w.AO_val2 = 0; # endif # if defined(AO_HAVE_nop_write) AO_nop_write(); # else MISSING(AO_nop); # endif # if defined(AO_HAVE_store_write) AO_store_write(&x, 13); TA_assert (x == 13); # else MISSING(AO_store); x = 13; # endif # if defined(AO_HAVE_load_write) TA_assert(AO_load_write(&x) == 13); # else MISSING(AO_load); # endif # if defined(AO_HAVE_test_and_set_write) assert(AO_test_and_set_write(&z) == AO_TS_CLEAR); assert(AO_test_and_set_write(&z) == AO_TS_SET); assert(AO_test_and_set_write(&z) == AO_TS_SET); AO_CLEAR(&z); # else MISSING(AO_test_and_set); # endif # if defined(AO_HAVE_fetch_and_add_write) TA_assert(AO_fetch_and_add_write(&x, 42) == 13); TA_assert(AO_fetch_and_add_write(&x, -42) == 55); # else MISSING(AO_fetch_and_add); # endif # if defined(AO_HAVE_fetch_and_add1_write) TA_assert(AO_fetch_and_add1_write(&x) == 13); # else MISSING(AO_fetch_and_add1); ++x; # endif # if defined(AO_HAVE_fetch_and_sub1_write) TA_assert(AO_fetch_and_sub1_write(&x) == 14); # else MISSING(AO_fetch_and_sub1); --x; # endif # if defined(AO_HAVE_short_store_write) AO_short_store_write(&s, 13); # else MISSING(AO_short_store); s = 13; # endif # if defined(AO_HAVE_short_load_write) TA_assert(AO_short_load(&s) == 13); # else MISSING(AO_short_load); # endif # if defined(AO_HAVE_short_fetch_and_add_write) TA_assert(AO_short_fetch_and_add_write(&s, 42) == 13); TA_assert(AO_short_fetch_and_add_write(&s, -42) == 55); # else MISSING(AO_short_fetch_and_add); # endif # if defined(AO_HAVE_short_fetch_and_add1_write) TA_assert(AO_short_fetch_and_add1_write(&s) == 13); # else MISSING(AO_short_fetch_and_add1); ++s; # endif # if defined(AO_HAVE_short_fetch_and_sub1_write) TA_assert(AO_short_fetch_and_sub1_write(&s) == 14); # else MISSING(AO_short_fetch_and_sub1); --s; # endif # if defined(AO_HAVE_char_store_write) AO_char_store_write(&b, 13); # else MISSING(AO_char_store); b = 13; # endif # if defined(AO_HAVE_char_load_write) TA_assert(AO_char_load(&b) == 13); # else MISSING(AO_char_load); # endif # if defined(AO_HAVE_char_fetch_and_add_write) TA_assert(AO_char_fetch_and_add_write(&b, 42) == 13); TA_assert(AO_char_fetch_and_add_write(&b, -42) == 55); # else MISSING(AO_char_fetch_and_add); # endif # if defined(AO_HAVE_char_fetch_and_add1_write) TA_assert(AO_char_fetch_and_add1_write(&b) == 13); # else MISSING(AO_char_fetch_and_add1); ++b; # endif # if defined(AO_HAVE_char_fetch_and_sub1_write) TA_assert(AO_char_fetch_and_sub1_write(&b) == 14); # else MISSING(AO_char_fetch_and_sub1); --b; # endif # if defined(AO_HAVE_int_store_write) AO_int_store_write(&zz, 13); # else MISSING(AO_int_store); zz = 13; # endif # if defined(AO_HAVE_int_load_write) TA_assert(AO_int_load(&zz) == 13); # else MISSING(AO_int_load); # endif # if defined(AO_HAVE_int_fetch_and_add_write) TA_assert(AO_int_fetch_and_add_write(&zz, 42) == 13); TA_assert(AO_int_fetch_and_add_write(&zz, -42) == 55); # else MISSING(AO_int_fetch_and_add); # endif # if defined(AO_HAVE_int_fetch_and_add1_write) TA_assert(AO_int_fetch_and_add1_write(&zz) == 13); # else MISSING(AO_int_fetch_and_add1); ++zz; # endif # if defined(AO_HAVE_int_fetch_and_sub1_write) TA_assert(AO_int_fetch_and_sub1_write(&zz) == 14); # else MISSING(AO_int_fetch_and_sub1); --zz; # endif # if defined(AO_HAVE_compare_and_swap_write) TA_assert(!AO_compare_and_swap_write(&x, 14, 42)); TA_assert(x == 13); TA_assert(AO_compare_and_swap_write(&x, 13, 42)); TA_assert(x == 42); # else MISSING(AO_compare_and_swap); # endif # if defined(AO_HAVE_or_write) AO_or_write(&x, 66); TA_assert(x == 106); # else MISSING(AO_or); x |= 34; # endif # if defined(AO_HAVE_compare_double_and_swap_double_write) TA_assert(!AO_compare_double_and_swap_double_write(&w, 17, 42, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_double_and_swap_double_write(&w, 0, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_double_and_swap_double_write(&w, 12, 13, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); w.AO_val1 = 0; w.AO_val2 = 0; # else MISSING(AO_compare_double_and_swap_double); # endif # if defined(AO_HAVE_compare_and_swap_double_write) TA_assert(!AO_compare_and_swap_double_write(&w, 17, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_and_swap_double_write(&w, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_and_swap_double_write(&w, 12, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); # else MISSING(AO_compare_and_swap_double); # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* Some basic sanity tests. These do not test the barrier semantics. */ #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _full)\n", \ __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ fprintf(stderr, "Missing: %s\n", #name "_full") void test_atomic_full(void) { AO_t x; unsigned char b; unsigned short s; unsigned int zz; # if defined(AO_HAVE_test_and_set_full) AO_TS_t z = AO_TS_INITIALIZER; # endif # if defined(AO_HAVE_double_t) AO_double_t w; w.AO_val1 = 0; w.AO_val2 = 0; # endif # if defined(AO_HAVE_nop_full) AO_nop_full(); # else MISSING(AO_nop); # endif # if defined(AO_HAVE_store_full) AO_store_full(&x, 13); TA_assert (x == 13); # else MISSING(AO_store); x = 13; # endif # if defined(AO_HAVE_load_full) TA_assert(AO_load_full(&x) == 13); # else MISSING(AO_load); # endif # if defined(AO_HAVE_test_and_set_full) assert(AO_test_and_set_full(&z) == AO_TS_CLEAR); assert(AO_test_and_set_full(&z) == AO_TS_SET); assert(AO_test_and_set_full(&z) == AO_TS_SET); AO_CLEAR(&z); # else MISSING(AO_test_and_set); # endif # if defined(AO_HAVE_fetch_and_add_full) TA_assert(AO_fetch_and_add_full(&x, 42) == 13); TA_assert(AO_fetch_and_add_full(&x, -42) == 55); # else MISSING(AO_fetch_and_add); # endif # if defined(AO_HAVE_fetch_and_add1_full) TA_assert(AO_fetch_and_add1_full(&x) == 13); # else MISSING(AO_fetch_and_add1); ++x; # endif # if defined(AO_HAVE_fetch_and_sub1_full) TA_assert(AO_fetch_and_sub1_full(&x) == 14); # else MISSING(AO_fetch_and_sub1); --x; # endif # if defined(AO_HAVE_short_store_full) AO_short_store_full(&s, 13); # else MISSING(AO_short_store); s = 13; # endif # if defined(AO_HAVE_short_load_full) TA_assert(AO_short_load(&s) == 13); # else MISSING(AO_short_load); # endif # if defined(AO_HAVE_short_fetch_and_add_full) TA_assert(AO_short_fetch_and_add_full(&s, 42) == 13); TA_assert(AO_short_fetch_and_add_full(&s, -42) == 55); # else MISSING(AO_short_fetch_and_add); # endif # if defined(AO_HAVE_short_fetch_and_add1_full) TA_assert(AO_short_fetch_and_add1_full(&s) == 13); # else MISSING(AO_short_fetch_and_add1); ++s; # endif # if defined(AO_HAVE_short_fetch_and_sub1_full) TA_assert(AO_short_fetch_and_sub1_full(&s) == 14); # else MISSING(AO_short_fetch_and_sub1); --s; # endif # if defined(AO_HAVE_char_store_full) AO_char_store_full(&b, 13); # else MISSING(AO_char_store); b = 13; # endif # if defined(AO_HAVE_char_load_full) TA_assert(AO_char_load(&b) == 13); # else MISSING(AO_char_load); # endif # if defined(AO_HAVE_char_fetch_and_add_full) TA_assert(AO_char_fetch_and_add_full(&b, 42) == 13); TA_assert(AO_char_fetch_and_add_full(&b, -42) == 55); # else MISSING(AO_char_fetch_and_add); # endif # if defined(AO_HAVE_char_fetch_and_add1_full) TA_assert(AO_char_fetch_and_add1_full(&b) == 13); # else MISSING(AO_char_fetch_and_add1); ++b; # endif # if defined(AO_HAVE_char_fetch_and_sub1_full) TA_assert(AO_char_fetch_and_sub1_full(&b) == 14); # else MISSING(AO_char_fetch_and_sub1); --b; # endif # if defined(AO_HAVE_int_store_full) AO_int_store_full(&zz, 13); # else MISSING(AO_int_store); zz = 13; # endif # if defined(AO_HAVE_int_load_full) TA_assert(AO_int_load(&zz) == 13); # else MISSING(AO_int_load); # endif # if defined(AO_HAVE_int_fetch_and_add_full) TA_assert(AO_int_fetch_and_add_full(&zz, 42) == 13); TA_assert(AO_int_fetch_and_add_full(&zz, -42) == 55); # else MISSING(AO_int_fetch_and_add); # endif # if defined(AO_HAVE_int_fetch_and_add1_full) TA_assert(AO_int_fetch_and_add1_full(&zz) == 13); # else MISSING(AO_int_fetch_and_add1); ++zz; # endif # if defined(AO_HAVE_int_fetch_and_sub1_full) TA_assert(AO_int_fetch_and_sub1_full(&zz) == 14); # else MISSING(AO_int_fetch_and_sub1); --zz; # endif # if defined(AO_HAVE_compare_and_swap_full) TA_assert(!AO_compare_and_swap_full(&x, 14, 42)); TA_assert(x == 13); TA_assert(AO_compare_and_swap_full(&x, 13, 42)); TA_assert(x == 42); # else MISSING(AO_compare_and_swap); # endif # if defined(AO_HAVE_or_full) AO_or_full(&x, 66); TA_assert(x == 106); # else MISSING(AO_or); x |= 34; # endif # if defined(AO_HAVE_compare_double_and_swap_double_full) TA_assert(!AO_compare_double_and_swap_double_full(&w, 17, 42, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_double_and_swap_double_full(&w, 0, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_double_and_swap_double_full(&w, 12, 13, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); w.AO_val1 = 0; w.AO_val2 = 0; # else MISSING(AO_compare_double_and_swap_double); # endif # if defined(AO_HAVE_compare_and_swap_double_full) TA_assert(!AO_compare_and_swap_double_full(&w, 17, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_and_swap_double_full(&w, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_and_swap_double_full(&w, 12, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); # else MISSING(AO_compare_and_swap_double); # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* Some basic sanity tests. These do not test the barrier semantics. */ #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _release_write)\n", \ __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ fprintf(stderr, "Missing: %s\n", #name "_release_write") void test_atomic_release_write(void) { AO_t x; unsigned char b; unsigned short s; unsigned int zz; # if defined(AO_HAVE_test_and_set_release_write) AO_TS_t z = AO_TS_INITIALIZER; # endif # if defined(AO_HAVE_double_t) AO_double_t w; w.AO_val1 = 0; w.AO_val2 = 0; # endif # if defined(AO_HAVE_nop_release_write) AO_nop_release_write(); # else MISSING(AO_nop); # endif # if defined(AO_HAVE_store_release_write) AO_store_release_write(&x, 13); TA_assert (x == 13); # else MISSING(AO_store); x = 13; # endif # if defined(AO_HAVE_load_release_write) TA_assert(AO_load_release_write(&x) == 13); # else MISSING(AO_load); # endif # if defined(AO_HAVE_test_and_set_release_write) assert(AO_test_and_set_release_write(&z) == AO_TS_CLEAR); assert(AO_test_and_set_release_write(&z) == AO_TS_SET); assert(AO_test_and_set_release_write(&z) == AO_TS_SET); AO_CLEAR(&z); # else MISSING(AO_test_and_set); # endif # if defined(AO_HAVE_fetch_and_add_release_write) TA_assert(AO_fetch_and_add_release_write(&x, 42) == 13); TA_assert(AO_fetch_and_add_release_write(&x, -42) == 55); # else MISSING(AO_fetch_and_add); # endif # if defined(AO_HAVE_fetch_and_add1_release_write) TA_assert(AO_fetch_and_add1_release_write(&x) == 13); # else MISSING(AO_fetch_and_add1); ++x; # endif # if defined(AO_HAVE_fetch_and_sub1_release_write) TA_assert(AO_fetch_and_sub1_release_write(&x) == 14); # else MISSING(AO_fetch_and_sub1); --x; # endif # if defined(AO_HAVE_short_store_release_write) AO_short_store_release_write(&s, 13); # else MISSING(AO_short_store); s = 13; # endif # if defined(AO_HAVE_short_load_release_write) TA_assert(AO_short_load(&s) == 13); # else MISSING(AO_short_load); # endif # if defined(AO_HAVE_short_fetch_and_add_release_write) TA_assert(AO_short_fetch_and_add_release_write(&s, 42) == 13); TA_assert(AO_short_fetch_and_add_release_write(&s, -42) == 55); # else MISSING(AO_short_fetch_and_add); # endif # if defined(AO_HAVE_short_fetch_and_add1_release_write) TA_assert(AO_short_fetch_and_add1_release_write(&s) == 13); # else MISSING(AO_short_fetch_and_add1); ++s; # endif # if defined(AO_HAVE_short_fetch_and_sub1_release_write) TA_assert(AO_short_fetch_and_sub1_release_write(&s) == 14); # else MISSING(AO_short_fetch_and_sub1); --s; # endif # if defined(AO_HAVE_char_store_release_write) AO_char_store_release_write(&b, 13); # else MISSING(AO_char_store); b = 13; # endif # if defined(AO_HAVE_char_load_release_write) TA_assert(AO_char_load(&b) == 13); # else MISSING(AO_char_load); # endif # if defined(AO_HAVE_char_fetch_and_add_release_write) TA_assert(AO_char_fetch_and_add_release_write(&b, 42) == 13); TA_assert(AO_char_fetch_and_add_release_write(&b, -42) == 55); # else MISSING(AO_char_fetch_and_add); # endif # if defined(AO_HAVE_char_fetch_and_add1_release_write) TA_assert(AO_char_fetch_and_add1_release_write(&b) == 13); # else MISSING(AO_char_fetch_and_add1); ++b; # endif # if defined(AO_HAVE_char_fetch_and_sub1_release_write) TA_assert(AO_char_fetch_and_sub1_release_write(&b) == 14); # else MISSING(AO_char_fetch_and_sub1); --b; # endif # if defined(AO_HAVE_int_store_release_write) AO_int_store_release_write(&zz, 13); # else MISSING(AO_int_store); zz = 13; # endif # if defined(AO_HAVE_int_load_release_write) TA_assert(AO_int_load(&zz) == 13); # else MISSING(AO_int_load); # endif # if defined(AO_HAVE_int_fetch_and_add_release_write) TA_assert(AO_int_fetch_and_add_release_write(&zz, 42) == 13); TA_assert(AO_int_fetch_and_add_release_write(&zz, -42) == 55); # else MISSING(AO_int_fetch_and_add); # endif # if defined(AO_HAVE_int_fetch_and_add1_release_write) TA_assert(AO_int_fetch_and_add1_release_write(&zz) == 13); # else MISSING(AO_int_fetch_and_add1); ++zz; # endif # if defined(AO_HAVE_int_fetch_and_sub1_release_write) TA_assert(AO_int_fetch_and_sub1_release_write(&zz) == 14); # else MISSING(AO_int_fetch_and_sub1); --zz; # endif # if defined(AO_HAVE_compare_and_swap_release_write) TA_assert(!AO_compare_and_swap_release_write(&x, 14, 42)); TA_assert(x == 13); TA_assert(AO_compare_and_swap_release_write(&x, 13, 42)); TA_assert(x == 42); # else MISSING(AO_compare_and_swap); # endif # if defined(AO_HAVE_or_release_write) AO_or_release_write(&x, 66); TA_assert(x == 106); # else MISSING(AO_or); x |= 34; # endif # if defined(AO_HAVE_compare_double_and_swap_double_release_write) TA_assert(!AO_compare_double_and_swap_double_release_write(&w, 17, 42, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_double_and_swap_double_release_write(&w, 0, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_double_and_swap_double_release_write(&w, 12, 13, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); w.AO_val1 = 0; w.AO_val2 = 0; # else MISSING(AO_compare_double_and_swap_double); # endif # if defined(AO_HAVE_compare_and_swap_double_release_write) TA_assert(!AO_compare_and_swap_double_release_write(&w, 17, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_and_swap_double_release_write(&w, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_and_swap_double_release_write(&w, 12, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); # else MISSING(AO_compare_and_swap_double); # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* Some basic sanity tests. These do not test the barrier semantics. */ #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _acquire_read)\n", \ __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ fprintf(stderr, "Missing: %s\n", #name "_acquire_read") void test_atomic_acquire_read(void) { AO_t x; unsigned char b; unsigned short s; unsigned int zz; # if defined(AO_HAVE_test_and_set_acquire_read) AO_TS_t z = AO_TS_INITIALIZER; # endif # if defined(AO_HAVE_double_t) AO_double_t w; w.AO_val1 = 0; w.AO_val2 = 0; # endif # if defined(AO_HAVE_nop_acquire_read) AO_nop_acquire_read(); # else MISSING(AO_nop); # endif # if defined(AO_HAVE_store_acquire_read) AO_store_acquire_read(&x, 13); TA_assert (x == 13); # else MISSING(AO_store); x = 13; # endif # if defined(AO_HAVE_load_acquire_read) TA_assert(AO_load_acquire_read(&x) == 13); # else MISSING(AO_load); # endif # if defined(AO_HAVE_test_and_set_acquire_read) assert(AO_test_and_set_acquire_read(&z) == AO_TS_CLEAR); assert(AO_test_and_set_acquire_read(&z) == AO_TS_SET); assert(AO_test_and_set_acquire_read(&z) == AO_TS_SET); AO_CLEAR(&z); # else MISSING(AO_test_and_set); # endif # if defined(AO_HAVE_fetch_and_add_acquire_read) TA_assert(AO_fetch_and_add_acquire_read(&x, 42) == 13); TA_assert(AO_fetch_and_add_acquire_read(&x, -42) == 55); # else MISSING(AO_fetch_and_add); # endif # if defined(AO_HAVE_fetch_and_add1_acquire_read) TA_assert(AO_fetch_and_add1_acquire_read(&x) == 13); # else MISSING(AO_fetch_and_add1); ++x; # endif # if defined(AO_HAVE_fetch_and_sub1_acquire_read) TA_assert(AO_fetch_and_sub1_acquire_read(&x) == 14); # else MISSING(AO_fetch_and_sub1); --x; # endif # if defined(AO_HAVE_short_store_acquire_read) AO_short_store_acquire_read(&s, 13); # else MISSING(AO_short_store); s = 13; # endif # if defined(AO_HAVE_short_load_acquire_read) TA_assert(AO_short_load(&s) == 13); # else MISSING(AO_short_load); # endif # if defined(AO_HAVE_short_fetch_and_add_acquire_read) TA_assert(AO_short_fetch_and_add_acquire_read(&s, 42) == 13); TA_assert(AO_short_fetch_and_add_acquire_read(&s, -42) == 55); # else MISSING(AO_short_fetch_and_add); # endif # if defined(AO_HAVE_short_fetch_and_add1_acquire_read) TA_assert(AO_short_fetch_and_add1_acquire_read(&s) == 13); # else MISSING(AO_short_fetch_and_add1); ++s; # endif # if defined(AO_HAVE_short_fetch_and_sub1_acquire_read) TA_assert(AO_short_fetch_and_sub1_acquire_read(&s) == 14); # else MISSING(AO_short_fetch_and_sub1); --s; # endif # if defined(AO_HAVE_char_store_acquire_read) AO_char_store_acquire_read(&b, 13); # else MISSING(AO_char_store); b = 13; # endif # if defined(AO_HAVE_char_load_acquire_read) TA_assert(AO_char_load(&b) == 13); # else MISSING(AO_char_load); # endif # if defined(AO_HAVE_char_fetch_and_add_acquire_read) TA_assert(AO_char_fetch_and_add_acquire_read(&b, 42) == 13); TA_assert(AO_char_fetch_and_add_acquire_read(&b, -42) == 55); # else MISSING(AO_char_fetch_and_add); # endif # if defined(AO_HAVE_char_fetch_and_add1_acquire_read) TA_assert(AO_char_fetch_and_add1_acquire_read(&b) == 13); # else MISSING(AO_char_fetch_and_add1); ++b; # endif # if defined(AO_HAVE_char_fetch_and_sub1_acquire_read) TA_assert(AO_char_fetch_and_sub1_acquire_read(&b) == 14); # else MISSING(AO_char_fetch_and_sub1); --b; # endif # if defined(AO_HAVE_int_store_acquire_read) AO_int_store_acquire_read(&zz, 13); # else MISSING(AO_int_store); zz = 13; # endif # if defined(AO_HAVE_int_load_acquire_read) TA_assert(AO_int_load(&zz) == 13); # else MISSING(AO_int_load); # endif # if defined(AO_HAVE_int_fetch_and_add_acquire_read) TA_assert(AO_int_fetch_and_add_acquire_read(&zz, 42) == 13); TA_assert(AO_int_fetch_and_add_acquire_read(&zz, -42) == 55); # else MISSING(AO_int_fetch_and_add); # endif # if defined(AO_HAVE_int_fetch_and_add1_acquire_read) TA_assert(AO_int_fetch_and_add1_acquire_read(&zz) == 13); # else MISSING(AO_int_fetch_and_add1); ++zz; # endif # if defined(AO_HAVE_int_fetch_and_sub1_acquire_read) TA_assert(AO_int_fetch_and_sub1_acquire_read(&zz) == 14); # else MISSING(AO_int_fetch_and_sub1); --zz; # endif # if defined(AO_HAVE_compare_and_swap_acquire_read) TA_assert(!AO_compare_and_swap_acquire_read(&x, 14, 42)); TA_assert(x == 13); TA_assert(AO_compare_and_swap_acquire_read(&x, 13, 42)); TA_assert(x == 42); # else MISSING(AO_compare_and_swap); # endif # if defined(AO_HAVE_or_acquire_read) AO_or_acquire_read(&x, 66); TA_assert(x == 106); # else MISSING(AO_or); x |= 34; # endif # if defined(AO_HAVE_compare_double_and_swap_double_acquire_read) TA_assert(!AO_compare_double_and_swap_double_acquire_read(&w, 17, 42, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_double_and_swap_double_acquire_read(&w, 0, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_double_and_swap_double_acquire_read(&w, 12, 13, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); w.AO_val1 = 0; w.AO_val2 = 0; # else MISSING(AO_compare_double_and_swap_double); # endif # if defined(AO_HAVE_compare_and_swap_double_acquire_read) TA_assert(!AO_compare_and_swap_double_acquire_read(&w, 17, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_and_swap_double_acquire_read(&w, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_and_swap_double_acquire_read(&w, 12, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); # else MISSING(AO_compare_and_swap_double); # endif } synopsis-0.12/src/Synopsis/gc/libatomic_ops/tests/test_atomic.template0000664000076400007640000001237611104702316025730 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* Some basic sanity tests. These do not test the barrier semantics. */ #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: XX)\n", \ __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ fprintf(stderr, "Missing: %s\n", #name "XX") void test_atomicXX(void) { AO_t x; unsigned char b; unsigned short s; unsigned int zz; # if defined(AO_HAVE_test_and_setXX) AO_TS_t z = AO_TS_INITIALIZER; # endif # if defined(AO_HAVE_double_t) AO_double_t w; w.AO_val1 = 0; w.AO_val2 = 0; # endif # if defined(AO_HAVE_nopXX) AO_nopXX(); # else MISSING(AO_nop); # endif # if defined(AO_HAVE_storeXX) AO_storeXX(&x, 13); TA_assert (x == 13); # else MISSING(AO_store); x = 13; # endif # if defined(AO_HAVE_loadXX) TA_assert(AO_loadXX(&x) == 13); # else MISSING(AO_load); # endif # if defined(AO_HAVE_test_and_setXX) assert(AO_test_and_setXX(&z) == AO_TS_CLEAR); assert(AO_test_and_setXX(&z) == AO_TS_SET); assert(AO_test_and_setXX(&z) == AO_TS_SET); AO_CLEAR(&z); # else MISSING(AO_test_and_set); # endif # if defined(AO_HAVE_fetch_and_addXX) TA_assert(AO_fetch_and_addXX(&x, 42) == 13); TA_assert(AO_fetch_and_addXX(&x, -42) == 55); # else MISSING(AO_fetch_and_add); # endif # if defined(AO_HAVE_fetch_and_add1XX) TA_assert(AO_fetch_and_add1XX(&x) == 13); # else MISSING(AO_fetch_and_add1); ++x; # endif # if defined(AO_HAVE_fetch_and_sub1XX) TA_assert(AO_fetch_and_sub1XX(&x) == 14); # else MISSING(AO_fetch_and_sub1); --x; # endif # if defined(AO_HAVE_short_storeXX) AO_short_storeXX(&s, 13); # else MISSING(AO_short_store); s = 13; # endif # if defined(AO_HAVE_short_loadXX) TA_assert(AO_short_load(&s) == 13); # else MISSING(AO_short_load); # endif # if defined(AO_HAVE_short_fetch_and_addXX) TA_assert(AO_short_fetch_and_addXX(&s, 42) == 13); TA_assert(AO_short_fetch_and_addXX(&s, -42) == 55); # else MISSING(AO_short_fetch_and_add); # endif # if defined(AO_HAVE_short_fetch_and_add1XX) TA_assert(AO_short_fetch_and_add1XX(&s) == 13); # else MISSING(AO_short_fetch_and_add1); ++s; # endif # if defined(AO_HAVE_short_fetch_and_sub1XX) TA_assert(AO_short_fetch_and_sub1XX(&s) == 14); # else MISSING(AO_short_fetch_and_sub1); --s; # endif # if defined(AO_HAVE_char_storeXX) AO_char_storeXX(&b, 13); # else MISSING(AO_char_store); b = 13; # endif # if defined(AO_HAVE_char_loadXX) TA_assert(AO_char_load(&b) == 13); # else MISSING(AO_char_load); # endif # if defined(AO_HAVE_char_fetch_and_addXX) TA_assert(AO_char_fetch_and_addXX(&b, 42) == 13); TA_assert(AO_char_fetch_and_addXX(&b, -42) == 55); # else MISSING(AO_char_fetch_and_add); # endif # if defined(AO_HAVE_char_fetch_and_add1XX) TA_assert(AO_char_fetch_and_add1XX(&b) == 13); # else MISSING(AO_char_fetch_and_add1); ++b; # endif # if defined(AO_HAVE_char_fetch_and_sub1XX) TA_assert(AO_char_fetch_and_sub1XX(&b) == 14); # else MISSING(AO_char_fetch_and_sub1); --b; # endif # if defined(AO_HAVE_int_storeXX) AO_int_storeXX(&zz, 13); # else MISSING(AO_int_store); zz = 13; # endif # if defined(AO_HAVE_int_loadXX) TA_assert(AO_int_load(&zz) == 13); # else MISSING(AO_int_load); # endif # if defined(AO_HAVE_int_fetch_and_addXX) TA_assert(AO_int_fetch_and_addXX(&zz, 42) == 13); TA_assert(AO_int_fetch_and_addXX(&zz, -42) == 55); # else MISSING(AO_int_fetch_and_add); # endif # if defined(AO_HAVE_int_fetch_and_add1XX) TA_assert(AO_int_fetch_and_add1XX(&zz) == 13); # else MISSING(AO_int_fetch_and_add1); ++zz; # endif # if defined(AO_HAVE_int_fetch_and_sub1XX) TA_assert(AO_int_fetch_and_sub1XX(&zz) == 14); # else MISSING(AO_int_fetch_and_sub1); --zz; # endif # if defined(AO_HAVE_compare_and_swapXX) TA_assert(!AO_compare_and_swapXX(&x, 14, 42)); TA_assert(x == 13); TA_assert(AO_compare_and_swapXX(&x, 13, 42)); TA_assert(x == 42); # else MISSING(AO_compare_and_swap); # endif # if defined(AO_HAVE_orXX) AO_orXX(&x, 66); TA_assert(x == 106); # else MISSING(AO_or); x |= 34; # endif # if defined(AO_HAVE_compare_double_and_swap_doubleXX) TA_assert(!AO_compare_double_and_swap_doubleXX(&w, 17, 42, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_double_and_swap_doubleXX(&w, 0, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_double_and_swap_doubleXX(&w, 12, 13, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); w.AO_val1 = 0; w.AO_val2 = 0; # else MISSING(AO_compare_double_and_swap_double); # endif # if defined(AO_HAVE_compare_and_swap_doubleXX) TA_assert(!AO_compare_and_swap_doubleXX(&w, 17, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_and_swap_doubleXX(&w, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_and_swap_doubleXX(&w, 12, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); # else MISSING(AO_compare_and_swap_double); # endif } synopsis-0.12/src/Synopsis/gc/libatomic_ops/tests/list_atomic.template0000664000076400007640000000312511104702316025714 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* This generates a compilable program. But it is really meant to be */ /* be used only with cc -E, to inspect the expensions generated by */ /* primitives. */ /* The result will not link or run. */ void list_atomicXX(void) { AO_T *addr, val, newval, oldval; AO_TS_T tsaddr; long incr; # if defined(AO_HAVE_nopXX) "AO_nopXX(): "; AO_nopXX(); # else "No AO_nopXX"; # endif # if defined(AO_HAVE_loadXX) "AO_loadXX(addr):"; AO_loadXX(addr); # else "No AO_loadXX"; # endif # if defined(AO_HAVE_storeXX) "AO_storeXX(addr, val):"; AO_storeXX(addr, val); # else "No AO_storeXX"; # endif # if defined(AO_HAVE_test_and_setXX) "AO_test_and_setXX(tsaddr):"; AO_test_and_setXX(tsaddr); # else "No AO_test_and_setXX"; # endif # if defined(AO_HAVE_fetch_and_add1XX) "AO_fetch_and_add1XX(addr):"; AO_fetch_and_add1XX(addr); # else "No AO_fetch_and_add1XX"; # endif # if defined(AO_HAVE_fetch_and_sub1XX) "AO_fetch_and_sub1XX(addr):"; AO_fetch_and_sub1XX(addr); # else "No AO_fetch_and_sub1XX"; # endif # if defined(AO_HAVE_fetch_and_addXX) "AO_fetch_and_addXX(addr, incr):"; AO_fetch_and_addXX(addr, incr); # else "No AO_fetch_and_addXX"; # endif # if defined(AO_HAVE_compare_and_swapXX) "AO_compare_and_swapXX(addr, oldval, newval):"; AO_compare_and_swapXX(addr, oldval, newval); # else "No AO_compare_and_swapXX"; # endif } synopsis-0.12/src/Synopsis/gc/libatomic_ops/tests/test_atomic.c0000664000076400007640000001073211104702316024331 0ustar stefanstefan/* * Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P. * Original Author: Hans Boehm * * This file may be redistributed and/or modified 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. * * It is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License in the * file doc/COPYING for more details. */ #if defined(HAVE_CONFIG_H) # include "config.h" #endif #include "run_parallel.inc" #include "test_atomic_include.h" #ifdef AO_USE_PTHREAD_DEFS # define NITERS 100000 #else # define NITERS 10000000 #endif void * add1sub1_thr(void * id); int add1sub1_test(void); void * acqrel_thr(void *id); int acqrel_test(void); void * test_and_set_thr(void * id); int test_and_set_test(void); #if defined(AO_HAVE_fetch_and_add1) && defined(AO_HAVE_fetch_and_sub1) AO_t counter = 0; void * add1sub1_thr(void * id) { int me = (int)(long)id; int i; for (i = 0; i < NITERS; ++i) if (me & 1) AO_fetch_and_sub1(&counter); else AO_fetch_and_add1(&counter); return 0; } int add1sub1_test(void) { return counter == 0; } #endif /* defined(AO_HAVE_fetch_and_add1) && defined(AO_HAVE_fetch_and_sub1) */ #if defined(AO_HAVE_store_release_write) && defined(AO_HAVE_load_acquire_read) /* Invariant: counter1 >= counter2 */ AO_t counter1 = 0; AO_t counter2 = 0; void * acqrel_thr(void *id) { int me = (int)(long)id; int i; for (i = 0; i < NITERS; ++i) if (me & 1) { AO_t my_counter1; if (me != 1) fprintf(stderr, "acqrel test: too many threads\n"); my_counter1 = AO_load(&counter1); AO_store(&counter1, my_counter1 + 1); AO_store_release_write(&counter2, my_counter1 + 1); } else { AO_t my_counter1a, my_counter2a; AO_t my_counter1b, my_counter2b; my_counter2a = AO_load_acquire_read(&counter2); my_counter1a = AO_load(&counter1); /* Redo this, to make sure that the second load of counter1 */ /* is not viewed as a common subexpression. */ my_counter2b = AO_load_acquire_read(&counter2); my_counter1b = AO_load(&counter1); if (my_counter1a < my_counter2a) { fprintf(stderr, "Saw release store out of order: %lu < %lu\n", (unsigned long)my_counter1a, (unsigned long)my_counter2a); abort(); } if (my_counter1b < my_counter2b) { fprintf(stderr, "Saw release store out of order (bad CSE?): %lu < %lu\n", (unsigned long)my_counter1b, (unsigned long)my_counter2b); abort(); } } return 0; } int acqrel_test(void) { return counter1 == NITERS && counter2 == NITERS; } #endif /* AO_HAVE_store_release_write && AO_HAVE_load_acquire_read */ #if defined(AO_HAVE_test_and_set_acquire) AO_TS_T lock = AO_TS_INITIALIZER; unsigned long locked_counter; volatile unsigned long junk = 13; void * test_and_set_thr(void * id) { unsigned long i; for (i = 0; i < NITERS/10; ++i) { while (AO_test_and_set_acquire(&lock) != AO_TS_CLEAR); ++locked_counter; if (locked_counter != 1) { fprintf(stderr, "Test and set failure 1, counter = %ld\n", locked_counter); abort(); } locked_counter *= 2; locked_counter -= 1; locked_counter *= 5; locked_counter -= 4; if (locked_counter != 1) { fprintf(stderr, "Test and set failure 2, counter = %ld\n", locked_counter); abort(); } --locked_counter; AO_CLEAR(&lock); /* Spend a bit of time outside the lock. */ junk *= 17; junk *= 17; } return 0; } int test_and_set_test(void) { return locked_counter == 0; } #endif /* defined(AO_HAVE_test_and_set_acquire) */ int main() { test_atomic(); test_atomic_acquire(); test_atomic_release(); test_atomic_read(); test_atomic_write(); test_atomic_full(); test_atomic_release_write(); test_atomic_acquire_read(); # if defined(AO_HAVE_fetch_and_add1) && defined(AO_HAVE_fetch_and_sub1) run_parallel(4, add1sub1_thr, add1sub1_test, "add1/sub1"); # endif # if defined(AO_HAVE_store_release_write) && defined(AO_HAVE_load_acquire_read) run_parallel(3, acqrel_thr, acqrel_test, "store_release_write/load_acquire_read"); # endif # if defined(AO_HAVE_test_and_set_acquire) run_parallel(5, test_and_set_thr, test_and_set_test, "test_and_set"); # endif return 0; } synopsis-0.12/src/Synopsis/gc/libatomic_ops/tests/test_malloc.c0000664000076400007640000001001111104702316024312 0ustar stefanstefan/* * Copyright (c) 2005 Hewlett-Packard Development Company, L.P. * Original Author: Hans Boehm * * This file may be redistributed and/or modified 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. * * It is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License in the * file doc/COPYING for more details. */ #if defined(HAVE_CONFIG_H) # include "config.h" #endif #include "run_parallel.inc" #include #include #include "atomic_ops_malloc.h" #define MAX_NTHREADS 100 #define N_REVERSALS 1000 /* must be even */ #define LENGTH 1000 #ifdef USE_STANDARD_MALLOC # define AO_malloc(n) malloc(n) # define AO_free(p) free(p) # define AO_malloc_enable_mmap() #endif typedef struct list_node { struct list_node *next; int data; } ln; ln *cons(int d, ln *tail) { static size_t extra = 0; size_t my_extra = extra; ln *result; int * extras; int i; if (my_extra > 100) extra = my_extra = 0; else ++extra; result = AO_malloc(sizeof(ln) + sizeof(int)*my_extra); if (result == 0) { fprintf(stderr, "Out of memory\n"); /* Normal for more than about 10 threads without mmap? */ abort(); } result -> data = d; result -> next = tail; extras = (int *)(result+1); for (i = 0; i < my_extra; ++i) extras[i] = 42; return result; } void print_list(ln *l) { ln *p; for (p = l; p != 0; p = p -> next) { fprintf(stderr, "%d, ", p -> data); } fprintf(stderr, "\n"); } /* Check that l contains numbers from m to n inclusive in ascending order */ void check_list(ln *l, int m, int n) { ln *p; int i; for (p = l, i = m; p != 0; p = p -> next, ++i) { if (i != p -> data) { fprintf(stderr, "Found %d, expected %d\n", p -> data, i); abort(); } } } /* Create a list of integers from m to n */ ln * make_list(int m, int n) { if (m > n) return 0; return cons(m, make_list(m+1, n)); } /* Reverse list x, and concatenate it to y, deallocating no longer needed */ /* nodes in x. */ ln * reverse(ln *x, ln *y) { ln * result; if (x == 0) return y; result = reverse(x -> next, cons(x -> data, y)); AO_free(x); return result; } int dummy_test(void) { return 1; } #define LARGE 200000 void * run_one_test(void * arg) { ln * x = make_list(1, LENGTH); int i; char *p = AO_malloc(LARGE); char *q; if (0 == p) { fprintf(stderr, "AO_malloc(%d) failed: This is normal without mmap\n", LARGE); AO_free(p); } else { p[0] = p[LARGE/2] = p[LARGE-1] = 'a'; q = AO_malloc(LARGE); q[0] = q[LARGE/2] = q[LARGE-1] = 'b'; if (p[0] != 'a' || p[LARGE/2] != 'a' || p[LARGE-1] != 'a') { fprintf(stderr, "First large allocation smashed\n"); abort(); } AO_free(p); if (q[0] != 'b' || q[LARGE/2] != 'b' || q[LARGE-1] != 'b') { fprintf(stderr, "Second large allocation smashed\n"); abort(); } AO_free(q); } # if 0 /* enable for debugging */ x = reverse(x, 0); print_list(x); x = reverse(x, 0); print_list(x); # endif for (i = 0; i < N_REVERSALS; ++i) { x = reverse(x, 0); } check_list(x, 1, LENGTH); return 0; } int main(int argc, char **argv) { int nthreads; int exper_n; if (1 == argc) { # if !defined(HAVE_MMAP) nthreads = 3; # else nthreads = 10; # endif } else if (2 == argc) { nthreads = atoi(argv[1]); if (nthreads < 1 || nthreads > MAX_NTHREADS) { fprintf(stderr, "Invalid # of threads argument\n"); exit(1); } } else { fprintf(stderr, "Usage: %s [# of threads]\n", argv[0]); exit(1); } printf("Performing %d reversals of %d element lists in %d threads\n", N_REVERSALS, LENGTH, nthreads); AO_malloc_enable_mmap(); run_parallel(nthreads, run_one_test, dummy_test, "AO_malloc/AO_free"); return 0; } synopsis-0.12/src/Synopsis/gc/libatomic_ops/tests/run_parallel.inc0000664000076400007640000001043711104702316025027 0ustar stefanstefan/* * Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ #if defined(_MSC_VER) || \ defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__) || \ defined(_WIN32_WINCE) # define USE_WINTHREADS #elif defined(__vxworks) # define USE_VXTHREADS #else # define USE_PTHREADS #endif #include #include #ifdef USE_PTHREADS # include #endif #ifdef USE_VXTHREADS # include # include #endif #ifdef USE_WINTHREADS # include #endif #include "atomic_ops.h" typedef void * (* thr_func)(void *); typedef int (* test_func)(void); /* Returns != 0 on success */ void * run_parallel(int nthreads, thr_func f1, test_func t, const char *name); #ifdef USE_PTHREADS void * run_parallel(int nthreads, thr_func f1, test_func t, const char *name) { pthread_attr_t attr; pthread_t thr[100]; int i; int code; fprintf(stderr, "Testing %s\n", name); if (nthreads > 100) { fprintf(stderr, "run_parallel: requested too many threads\n"); abort(); } # ifdef _HPUX_SOURCE /* Default stack size is too small, especially with the 64 bit ABI */ /* Increase it. */ if (pthread_default_stacksize_np(1024*1024, 0) != 0) { fprintf(stderr, "pthread_default_stacksize_np failed. " "OK after first call.\n"); } # endif pthread_attr_init(&attr); for (i = 0; i < nthreads; ++i) { if ((code = pthread_create(thr + i, &attr, f1, (void *)(long)i)) != 0) { perror("Thread creation failed"); fprintf(stderr, "Pthread_create returned %d, thread %d\n", code, i); abort(); } } for (i = 0; i < nthreads; ++i) { if ((code = pthread_join(thr[i], NULL)) != 0) { perror("Thread join failed"); fprintf(stderr, "Pthread_join returned %d, thread %d\n", code, i); abort(); } } if (t()) { fprintf(stderr, "Succeeded\n"); } else { fprintf(stderr, "Failed\n"); abort(); } return 0; } #endif /* USE_PTHREADS */ #ifdef USE_VXTHREADS void * run_parallel(int nthreads, thr_func f1, test_func t, const char *name) { int thr[100]; int i; fprintf(stderr, "Testing %s\n", name); if (nthreads > 100) { fprintf(stderr, "run_parallel: requested too many threads\n"); taskSuspend(0); } for (i = 0; i < nthreads; ++i) { thr[i] = taskSpawn((char*) name, 180, 0, 32768, (FUNCPTR) f1, i, 1, 2, 3, 4, 5, 6, 7, 8, 9); if (thr[i] == ERROR) { fprintf(stderr, "taskSpawn failed with %d, thread %d\n", errno, i); taskSuspend(0); } } for (i = 0; i < nthreads; ++i) { while (taskIdVerify(thr[i]) == OK) taskDelay(60); } if (t()) { fprintf(stderr, "Succeeded\n"); } else { fprintf(stderr, "Failed\n"); taskSuspend(0); } return 0; } #endif /* USE_VXTHREADS */ #ifdef USE_WINTHREADS struct tramp_args { thr_func fn; long arg; }; DWORD WINAPI tramp(LPVOID param) { struct tramp_args *args = (struct tramp_args *)param; return (DWORD)(args -> fn)((LPVOID)(args -> arg)); } void * run_parallel(int nthreads, thr_func f1, test_func t, const char *name) { HANDLE thr[100]; struct tramp_args args[100]; int i; DWORD code; fprintf(stderr, "Testing %s\n", name); if (nthreads > 100) { fprintf(stderr, "run_parallel: requested too many threads\n"); abort(); } for (i = 0; i < nthreads; ++i) { args[i].fn = f1; args[i].arg = i; if ((thr[i] = CreateThread(NULL, 0, tramp, (LPVOID)(args+i), 0, NULL)) == NULL) { perror("Thread creation failed"); fprintf(stderr, "CreateThread failed with %d, thread %d\n", GetLastError(), i); abort(); } } for (i = 0; i < nthreads; ++i) { if ((code = WaitForSingleObject(thr[i], INFINITE)) != WAIT_OBJECT_0) { perror("Thread join failed"); fprintf(stderr, "WaitForSingleObject returned %d, thread %d\n", code, i); abort(); } } if (t()) { fprintf(stderr, "Succeeded\n"); } else { fprintf(stderr, "Failed\n"); abort(); } return 0; } #endif /* USE_WINTHREADS */ synopsis-0.12/src/Synopsis/gc/libatomic_ops/tests/Makefile.in0000664000076400007640000004646011104702316023726 0ustar stefanstefan# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 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 = $(test_atomic_SOURCES) $(test_atomic_pthreads_SOURCES) $(test_malloc_SOURCES) $(test_stack_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@ target_triplet = @target@ check_PROGRAMS = test_atomic$(EXEEXT) test_atomic_pthreads$(EXEEXT) \ test_stack$(EXEEXT) test_malloc$(EXEEXT) subdir = tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = am_test_atomic_OBJECTS = test_atomic.$(OBJEXT) test_atomic_OBJECTS = $(am_test_atomic_OBJECTS) test_atomic_DEPENDENCIES = ../src/libatomic_ops.a am_test_atomic_pthreads_OBJECTS = \ test_atomic_pthreads-test_atomic.$(OBJEXT) test_atomic_pthreads_OBJECTS = $(am_test_atomic_pthreads_OBJECTS) test_atomic_pthreads_DEPENDENCIES = ../src/libatomic_ops.a am_test_malloc_OBJECTS = test_malloc.$(OBJEXT) test_malloc_OBJECTS = $(am_test_malloc_OBJECTS) test_malloc_DEPENDENCIES = ../src/libatomic_ops_gpl.a \ ../src/libatomic_ops.a am_test_stack_OBJECTS = test_stack.$(OBJEXT) test_stack_OBJECTS = $(am_test_stack_OBJECTS) test_stack_DEPENDENCIES = ../src/libatomic_ops_gpl.a \ ../src/libatomic_ops.a DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(test_atomic_SOURCES) $(test_atomic_pthreads_SOURCES) \ $(test_malloc_SOURCES) $(test_stack_SOURCES) DIST_SOURCES = $(test_atomic_SOURCES) $(test_atomic_pthreads_SOURCES) \ $(test_malloc_SOURCES) $(test_stack_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ NEED_ASM_FALSE = @NEED_ASM_FALSE@ NEED_ASM_TRUE = @NEED_ASM_TRUE@ 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@ PICFLAG = @PICFLAG@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ 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__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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ EXTRA_DIST = test_atomic.template list_atomic.template run_parallel.inc \ test_atomic_include.h # We distribute test_atomic_include.h, since it's hard to regenerate # on Windows without sed. BUILT_SOURCES = test_atomic_include.h list_atomic.i CLEANFILES = test_atomic_include.h list_atomic.c list_atomic.i AM_CPPFLAGS = -I$(srcdir)/../src TESTS = test_atomic test_atomic_pthreads test_stack test_malloc test_atomic_SOURCES = test_atomic.c test_atomic_LDADD = -lpthread ../src/libatomic_ops.a test_atomic_pthreads_SOURCES = test_atomic.c test_atomic_pthreads_CPPFLAGS = -DAO_USE_PTHREAD_DEFS $(AM_CPPFLAGS) test_atomic_pthreads_LDADD = -lpthread ../src/libatomic_ops.a test_stack_SOURCES = test_stack.c test_stack_LDADD = -lpthread ../src/libatomic_ops_gpl.a ../src/libatomic_ops.a test_malloc_SOURCES = test_malloc.c test_malloc_LDADD = -lpthread ../src/libatomic_ops_gpl.a ../src/libatomic_ops.a all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .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 tests/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-checkPROGRAMS: -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) test_atomic$(EXEEXT): $(test_atomic_OBJECTS) $(test_atomic_DEPENDENCIES) @rm -f test_atomic$(EXEEXT) $(LINK) $(test_atomic_LDFLAGS) $(test_atomic_OBJECTS) $(test_atomic_LDADD) $(LIBS) test_atomic_pthreads$(EXEEXT): $(test_atomic_pthreads_OBJECTS) $(test_atomic_pthreads_DEPENDENCIES) @rm -f test_atomic_pthreads$(EXEEXT) $(LINK) $(test_atomic_pthreads_LDFLAGS) $(test_atomic_pthreads_OBJECTS) $(test_atomic_pthreads_LDADD) $(LIBS) test_malloc$(EXEEXT): $(test_malloc_OBJECTS) $(test_malloc_DEPENDENCIES) @rm -f test_malloc$(EXEEXT) $(LINK) $(test_malloc_LDFLAGS) $(test_malloc_OBJECTS) $(test_malloc_LDADD) $(LIBS) test_stack$(EXEEXT): $(test_stack_OBJECTS) $(test_stack_DEPENDENCIES) @rm -f test_stack$(EXEEXT) $(LINK) $(test_stack_LDFLAGS) $(test_stack_OBJECTS) $(test_stack_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_atomic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_atomic_pthreads-test_atomic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_malloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_stack.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` test_atomic_pthreads-test_atomic.o: test_atomic.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_atomic_pthreads_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_atomic_pthreads-test_atomic.o -MD -MP -MF "$(DEPDIR)/test_atomic_pthreads-test_atomic.Tpo" -c -o test_atomic_pthreads-test_atomic.o `test -f 'test_atomic.c' || echo '$(srcdir)/'`test_atomic.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test_atomic_pthreads-test_atomic.Tpo" "$(DEPDIR)/test_atomic_pthreads-test_atomic.Po"; else rm -f "$(DEPDIR)/test_atomic_pthreads-test_atomic.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_atomic.c' object='test_atomic_pthreads-test_atomic.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_atomic_pthreads_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_atomic_pthreads-test_atomic.o `test -f 'test_atomic.c' || echo '$(srcdir)/'`test_atomic.c test_atomic_pthreads-test_atomic.obj: test_atomic.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_atomic_pthreads_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_atomic_pthreads-test_atomic.obj -MD -MP -MF "$(DEPDIR)/test_atomic_pthreads-test_atomic.Tpo" -c -o test_atomic_pthreads-test_atomic.obj `if test -f 'test_atomic.c'; then $(CYGPATH_W) 'test_atomic.c'; else $(CYGPATH_W) '$(srcdir)/test_atomic.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test_atomic_pthreads-test_atomic.Tpo" "$(DEPDIR)/test_atomic_pthreads-test_atomic.Po"; else rm -f "$(DEPDIR)/test_atomic_pthreads-test_atomic.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_atomic.c' object='test_atomic_pthreads-test_atomic.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_atomic_pthreads_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_atomic_pthreads-test_atomic.obj `if test -f 'test_atomic.c'; then $(CYGPATH_W) 'test_atomic.c'; else $(CYGPATH_W) '$(srcdir)/test_atomic.c'; fi` 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 check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list='$(TESTS)'; \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *" $$tst "*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ echo "XPASS: $$tst"; \ ;; \ *) \ echo "PASS: $$tst"; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *" $$tst "*) \ xfail=`expr $$xfail + 1`; \ echo "XFAIL: $$tst"; \ ;; \ *) \ failed=`expr $$failed + 1`; \ echo "FAIL: $$tst"; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ echo "SKIP: $$tst"; \ fi; \ done; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="All $$all tests passed"; \ else \ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all tests failed"; \ else \ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ skipped="($$skip tests were not run)"; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ echo "$$dashes"; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; 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 $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile installdirs: install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-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 pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic ctags distclean \ distclean-compile distclean-generic distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am test_atomic_include.h: test_atomic.template sed -e s/XX// $? > $@ sed -e s/XX/_release/ $? >> $@ sed -e s/XX/_acquire/ $? >> $@ sed -e s/XX/_read/ $? >> $@ sed -e s/XX/_write/ $? >> $@ sed -e s/XX/_full/ $? >> $@ sed -e s/XX/_release_write/ $? >> $@ sed -e s/XX/_acquire_read/ $? >> $@ list_atomic.c: list_atomic.template echo "#include \"atomic_ops.h\" " > $@ sed -e s/XX// $? >> $@ sed -e s/XX/_release/ $? >> $@ sed -e s/XX/_acquire/ $? >> $@ sed -e s/XX/_read/ $? >> $@ sed -e s/XX/_write/ $? >> $@ sed -e s/XX/_full/ $? >> $@ sed -e s/XX/_release_write/ $? >> $@ sed -e s/XX/_acquire_read/ $? >> $@ list_atomic.i: list_atomic.c $(COMPILE) $? -E > list_atomic.i # 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: synopsis-0.12/src/Synopsis/gc/libatomic_ops/tests/list_atomic.c0000664000076400007640000003411411104702316024325 0ustar stefanstefan#include "atomic_ops.h" /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* This generates a compilable program. But it is really meant to be */ /* be used only with cc -E, to inspect the expensions generated by */ /* primitives. */ /* The result will not link or run. */ void list_atomic(void) { AO_T *addr, val, newval, oldval; AO_TS_T tsaddr; long incr; # if defined(AO_HAVE_nop) "AO_nop(): "; AO_nop(); # else "No AO_nop"; # endif # if defined(AO_HAVE_load) "AO_load(addr):"; AO_load(addr); # else "No AO_load"; # endif # if defined(AO_HAVE_store) "AO_store(addr, val):"; AO_store(addr, val); # else "No AO_store"; # endif # if defined(AO_HAVE_test_and_set) "AO_test_and_set(tsaddr):"; AO_test_and_set(tsaddr); # else "No AO_test_and_set"; # endif # if defined(AO_HAVE_fetch_and_add1) "AO_fetch_and_add1(addr):"; AO_fetch_and_add1(addr); # else "No AO_fetch_and_add1"; # endif # if defined(AO_HAVE_fetch_and_sub1) "AO_fetch_and_sub1(addr):"; AO_fetch_and_sub1(addr); # else "No AO_fetch_and_sub1"; # endif # if defined(AO_HAVE_fetch_and_add) "AO_fetch_and_add(addr, incr):"; AO_fetch_and_add(addr, incr); # else "No AO_fetch_and_add"; # endif # if defined(AO_HAVE_compare_and_swap) "AO_compare_and_swap(addr, oldval, newval):"; AO_compare_and_swap(addr, oldval, newval); # else "No AO_compare_and_swap"; # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* This generates a compilable program. But it is really meant to be */ /* be used only with cc -E, to inspect the expensions generated by */ /* primitives. */ /* The result will not link or run. */ void list_atomic_release(void) { AO_T *addr, val, newval, oldval; AO_TS_T tsaddr; long incr; # if defined(AO_HAVE_nop_release) "AO_nop_release(): "; AO_nop_release(); # else "No AO_nop_release"; # endif # if defined(AO_HAVE_load_release) "AO_load_release(addr):"; AO_load_release(addr); # else "No AO_load_release"; # endif # if defined(AO_HAVE_store_release) "AO_store_release(addr, val):"; AO_store_release(addr, val); # else "No AO_store_release"; # endif # if defined(AO_HAVE_test_and_set_release) "AO_test_and_set_release(tsaddr):"; AO_test_and_set_release(tsaddr); # else "No AO_test_and_set_release"; # endif # if defined(AO_HAVE_fetch_and_add1_release) "AO_fetch_and_add1_release(addr):"; AO_fetch_and_add1_release(addr); # else "No AO_fetch_and_add1_release"; # endif # if defined(AO_HAVE_fetch_and_sub1_release) "AO_fetch_and_sub1_release(addr):"; AO_fetch_and_sub1_release(addr); # else "No AO_fetch_and_sub1_release"; # endif # if defined(AO_HAVE_fetch_and_add_release) "AO_fetch_and_add_release(addr, incr):"; AO_fetch_and_add_release(addr, incr); # else "No AO_fetch_and_add_release"; # endif # if defined(AO_HAVE_compare_and_swap_release) "AO_compare_and_swap_release(addr, oldval, newval):"; AO_compare_and_swap_release(addr, oldval, newval); # else "No AO_compare_and_swap_release"; # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* This generates a compilable program. But it is really meant to be */ /* be used only with cc -E, to inspect the expensions generated by */ /* primitives. */ /* The result will not link or run. */ void list_atomic_acquire(void) { AO_T *addr, val, newval, oldval; AO_TS_T tsaddr; long incr; # if defined(AO_HAVE_nop_acquire) "AO_nop_acquire(): "; AO_nop_acquire(); # else "No AO_nop_acquire"; # endif # if defined(AO_HAVE_load_acquire) "AO_load_acquire(addr):"; AO_load_acquire(addr); # else "No AO_load_acquire"; # endif # if defined(AO_HAVE_store_acquire) "AO_store_acquire(addr, val):"; AO_store_acquire(addr, val); # else "No AO_store_acquire"; # endif # if defined(AO_HAVE_test_and_set_acquire) "AO_test_and_set_acquire(tsaddr):"; AO_test_and_set_acquire(tsaddr); # else "No AO_test_and_set_acquire"; # endif # if defined(AO_HAVE_fetch_and_add1_acquire) "AO_fetch_and_add1_acquire(addr):"; AO_fetch_and_add1_acquire(addr); # else "No AO_fetch_and_add1_acquire"; # endif # if defined(AO_HAVE_fetch_and_sub1_acquire) "AO_fetch_and_sub1_acquire(addr):"; AO_fetch_and_sub1_acquire(addr); # else "No AO_fetch_and_sub1_acquire"; # endif # if defined(AO_HAVE_fetch_and_add_acquire) "AO_fetch_and_add_acquire(addr, incr):"; AO_fetch_and_add_acquire(addr, incr); # else "No AO_fetch_and_add_acquire"; # endif # if defined(AO_HAVE_compare_and_swap_acquire) "AO_compare_and_swap_acquire(addr, oldval, newval):"; AO_compare_and_swap_acquire(addr, oldval, newval); # else "No AO_compare_and_swap_acquire"; # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* This generates a compilable program. But it is really meant to be */ /* be used only with cc -E, to inspect the expensions generated by */ /* primitives. */ /* The result will not link or run. */ void list_atomic_read(void) { AO_T *addr, val, newval, oldval; AO_TS_T tsaddr; long incr; # if defined(AO_HAVE_nop_read) "AO_nop_read(): "; AO_nop_read(); # else "No AO_nop_read"; # endif # if defined(AO_HAVE_load_read) "AO_load_read(addr):"; AO_load_read(addr); # else "No AO_load_read"; # endif # if defined(AO_HAVE_store_read) "AO_store_read(addr, val):"; AO_store_read(addr, val); # else "No AO_store_read"; # endif # if defined(AO_HAVE_test_and_set_read) "AO_test_and_set_read(tsaddr):"; AO_test_and_set_read(tsaddr); # else "No AO_test_and_set_read"; # endif # if defined(AO_HAVE_fetch_and_add1_read) "AO_fetch_and_add1_read(addr):"; AO_fetch_and_add1_read(addr); # else "No AO_fetch_and_add1_read"; # endif # if defined(AO_HAVE_fetch_and_sub1_read) "AO_fetch_and_sub1_read(addr):"; AO_fetch_and_sub1_read(addr); # else "No AO_fetch_and_sub1_read"; # endif # if defined(AO_HAVE_fetch_and_add_read) "AO_fetch_and_add_read(addr, incr):"; AO_fetch_and_add_read(addr, incr); # else "No AO_fetch_and_add_read"; # endif # if defined(AO_HAVE_compare_and_swap_read) "AO_compare_and_swap_read(addr, oldval, newval):"; AO_compare_and_swap_read(addr, oldval, newval); # else "No AO_compare_and_swap_read"; # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* This generates a compilable program. But it is really meant to be */ /* be used only with cc -E, to inspect the expensions generated by */ /* primitives. */ /* The result will not link or run. */ void list_atomic_write(void) { AO_T *addr, val, newval, oldval; AO_TS_T tsaddr; long incr; # if defined(AO_HAVE_nop_write) "AO_nop_write(): "; AO_nop_write(); # else "No AO_nop_write"; # endif # if defined(AO_HAVE_load_write) "AO_load_write(addr):"; AO_load_write(addr); # else "No AO_load_write"; # endif # if defined(AO_HAVE_store_write) "AO_store_write(addr, val):"; AO_store_write(addr, val); # else "No AO_store_write"; # endif # if defined(AO_HAVE_test_and_set_write) "AO_test_and_set_write(tsaddr):"; AO_test_and_set_write(tsaddr); # else "No AO_test_and_set_write"; # endif # if defined(AO_HAVE_fetch_and_add1_write) "AO_fetch_and_add1_write(addr):"; AO_fetch_and_add1_write(addr); # else "No AO_fetch_and_add1_write"; # endif # if defined(AO_HAVE_fetch_and_sub1_write) "AO_fetch_and_sub1_write(addr):"; AO_fetch_and_sub1_write(addr); # else "No AO_fetch_and_sub1_write"; # endif # if defined(AO_HAVE_fetch_and_add_write) "AO_fetch_and_add_write(addr, incr):"; AO_fetch_and_add_write(addr, incr); # else "No AO_fetch_and_add_write"; # endif # if defined(AO_HAVE_compare_and_swap_write) "AO_compare_and_swap_write(addr, oldval, newval):"; AO_compare_and_swap_write(addr, oldval, newval); # else "No AO_compare_and_swap_write"; # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* This generates a compilable program. But it is really meant to be */ /* be used only with cc -E, to inspect the expensions generated by */ /* primitives. */ /* The result will not link or run. */ void list_atomic_full(void) { AO_T *addr, val, newval, oldval; AO_TS_T tsaddr; long incr; # if defined(AO_HAVE_nop_full) "AO_nop_full(): "; AO_nop_full(); # else "No AO_nop_full"; # endif # if defined(AO_HAVE_load_full) "AO_load_full(addr):"; AO_load_full(addr); # else "No AO_load_full"; # endif # if defined(AO_HAVE_store_full) "AO_store_full(addr, val):"; AO_store_full(addr, val); # else "No AO_store_full"; # endif # if defined(AO_HAVE_test_and_set_full) "AO_test_and_set_full(tsaddr):"; AO_test_and_set_full(tsaddr); # else "No AO_test_and_set_full"; # endif # if defined(AO_HAVE_fetch_and_add1_full) "AO_fetch_and_add1_full(addr):"; AO_fetch_and_add1_full(addr); # else "No AO_fetch_and_add1_full"; # endif # if defined(AO_HAVE_fetch_and_sub1_full) "AO_fetch_and_sub1_full(addr):"; AO_fetch_and_sub1_full(addr); # else "No AO_fetch_and_sub1_full"; # endif # if defined(AO_HAVE_fetch_and_add_full) "AO_fetch_and_add_full(addr, incr):"; AO_fetch_and_add_full(addr, incr); # else "No AO_fetch_and_add_full"; # endif # if defined(AO_HAVE_compare_and_swap_full) "AO_compare_and_swap_full(addr, oldval, newval):"; AO_compare_and_swap_full(addr, oldval, newval); # else "No AO_compare_and_swap_full"; # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* This generates a compilable program. But it is really meant to be */ /* be used only with cc -E, to inspect the expensions generated by */ /* primitives. */ /* The result will not link or run. */ void list_atomic_release_write(void) { AO_T *addr, val, newval, oldval; AO_TS_T tsaddr; long incr; # if defined(AO_HAVE_nop_release_write) "AO_nop_release_write(): "; AO_nop_release_write(); # else "No AO_nop_release_write"; # endif # if defined(AO_HAVE_load_release_write) "AO_load_release_write(addr):"; AO_load_release_write(addr); # else "No AO_load_release_write"; # endif # if defined(AO_HAVE_store_release_write) "AO_store_release_write(addr, val):"; AO_store_release_write(addr, val); # else "No AO_store_release_write"; # endif # if defined(AO_HAVE_test_and_set_release_write) "AO_test_and_set_release_write(tsaddr):"; AO_test_and_set_release_write(tsaddr); # else "No AO_test_and_set_release_write"; # endif # if defined(AO_HAVE_fetch_and_add1_release_write) "AO_fetch_and_add1_release_write(addr):"; AO_fetch_and_add1_release_write(addr); # else "No AO_fetch_and_add1_release_write"; # endif # if defined(AO_HAVE_fetch_and_sub1_release_write) "AO_fetch_and_sub1_release_write(addr):"; AO_fetch_and_sub1_release_write(addr); # else "No AO_fetch_and_sub1_release_write"; # endif # if defined(AO_HAVE_fetch_and_add_release_write) "AO_fetch_and_add_release_write(addr, incr):"; AO_fetch_and_add_release_write(addr, incr); # else "No AO_fetch_and_add_release_write"; # endif # if defined(AO_HAVE_compare_and_swap_release_write) "AO_compare_and_swap_release_write(addr, oldval, newval):"; AO_compare_and_swap_release_write(addr, oldval, newval); # else "No AO_compare_and_swap_release_write"; # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* This generates a compilable program. But it is really meant to be */ /* be used only with cc -E, to inspect the expensions generated by */ /* primitives. */ /* The result will not link or run. */ void list_atomic_acquire_read(void) { AO_T *addr, val, newval, oldval; AO_TS_T tsaddr; long incr; # if defined(AO_HAVE_nop_acquire_read) "AO_nop_acquire_read(): "; AO_nop_acquire_read(); # else "No AO_nop_acquire_read"; # endif # if defined(AO_HAVE_load_acquire_read) "AO_load_acquire_read(addr):"; AO_load_acquire_read(addr); # else "No AO_load_acquire_read"; # endif # if defined(AO_HAVE_store_acquire_read) "AO_store_acquire_read(addr, val):"; AO_store_acquire_read(addr, val); # else "No AO_store_acquire_read"; # endif # if defined(AO_HAVE_test_and_set_acquire_read) "AO_test_and_set_acquire_read(tsaddr):"; AO_test_and_set_acquire_read(tsaddr); # else "No AO_test_and_set_acquire_read"; # endif # if defined(AO_HAVE_fetch_and_add1_acquire_read) "AO_fetch_and_add1_acquire_read(addr):"; AO_fetch_and_add1_acquire_read(addr); # else "No AO_fetch_and_add1_acquire_read"; # endif # if defined(AO_HAVE_fetch_and_sub1_acquire_read) "AO_fetch_and_sub1_acquire_read(addr):"; AO_fetch_and_sub1_acquire_read(addr); # else "No AO_fetch_and_sub1_acquire_read"; # endif # if defined(AO_HAVE_fetch_and_add_acquire_read) "AO_fetch_and_add_acquire_read(addr, incr):"; AO_fetch_and_add_acquire_read(addr, incr); # else "No AO_fetch_and_add_acquire_read"; # endif # if defined(AO_HAVE_compare_and_swap_acquire_read) "AO_compare_and_swap_acquire_read(addr, oldval, newval):"; AO_compare_and_swap_acquire_read(addr, oldval, newval); # else "No AO_compare_and_swap_acquire_read"; # endif } synopsis-0.12/src/Synopsis/gc/libatomic_ops/tests/Makefile.am0000664000076400007640000000322511104702316023705 0ustar stefanstefanEXTRA_DIST=test_atomic.template list_atomic.template run_parallel.inc \ test_atomic_include.h # We distribute test_atomic_include.h, since it's hard to regenerate # on Windows without sed. BUILT_SOURCES = test_atomic_include.h list_atomic.i CLEANFILES = test_atomic_include.h list_atomic.c list_atomic.i AM_CPPFLAGS=-I$(srcdir)/../src TESTS=test_atomic test_atomic_pthreads test_stack test_malloc #create the test_atomic test program check_PROGRAMS=test_atomic test_atomic_pthreads test_stack test_malloc test_atomic_SOURCES=test_atomic.c test_atomic_LDADD=-lpthread ../src/libatomic_ops.a test_atomic_pthreads_SOURCES=test_atomic.c test_atomic_pthreads_CPPFLAGS=-DAO_USE_PTHREAD_DEFS $(AM_CPPFLAGS) test_atomic_pthreads_LDADD=-lpthread ../src/libatomic_ops.a test_stack_SOURCES=test_stack.c test_stack_LDADD=-lpthread ../src/libatomic_ops_gpl.a ../src/libatomic_ops.a test_malloc_SOURCES=test_malloc.c test_malloc_LDADD=-lpthread ../src/libatomic_ops_gpl.a ../src/libatomic_ops.a test_atomic_include.h: test_atomic.template sed -e s/XX// $? > $@ sed -e s/XX/_release/ $? >> $@ sed -e s/XX/_acquire/ $? >> $@ sed -e s/XX/_read/ $? >> $@ sed -e s/XX/_write/ $? >> $@ sed -e s/XX/_full/ $? >> $@ sed -e s/XX/_release_write/ $? >> $@ sed -e s/XX/_acquire_read/ $? >> $@ list_atomic.c: list_atomic.template echo "#include \"atomic_ops.h\" " > $@ sed -e s/XX// $? >> $@ sed -e s/XX/_release/ $? >> $@ sed -e s/XX/_acquire/ $? >> $@ sed -e s/XX/_read/ $? >> $@ sed -e s/XX/_write/ $? >> $@ sed -e s/XX/_full/ $? >> $@ sed -e s/XX/_release_write/ $? >> $@ sed -e s/XX/_acquire_read/ $? >> $@ list_atomic.i: list_atomic.c $(COMPILE) $? -E > list_atomic.i synopsis-0.12/src/Synopsis/gc/libatomic_ops/aclocal.m40000664000076400007640000010045211104702315022346 0ustar stefanstefan# generated automatically by aclocal 1.10 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_if(m4_PACKAGE_VERSION, [2.61],, [m4_fatal([this file was generated for autoconf 2.61. You have another version of autoconf. If you want to use that, you should regenerate the build system entirely.], [63])]) # Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.10' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.10], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.10])dnl _AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)]) # Figure out how to run the assembler. -*- Autoconf -*- # Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_PROG_AS # ---------- AC_DEFUN([AM_PROG_AS], [# By default we simply use the C compiler to build assembly code. AC_REQUIRE([AC_PROG_CC]) test "${CCAS+set}" = set || CCAS=$CC test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS AC_ARG_VAR([CCAS], [assembler compiler command (defaults to CC)]) AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)]) _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl ]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed 10q "$mf" | grep '^#.*generated by automake' > /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"]) ]) # 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 8 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # 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.60])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) ]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_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-"\$(SHELL) $am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR synopsis-0.12/src/Synopsis/gc/libatomic_ops/Makefile.am0000664000076400007640000000005311104702315022536 0ustar stefanstefanSUBDIRS = src doc tests #distclean-local: synopsis-0.12/src/Synopsis/gc/libatomic_ops/doc/0000775000076400007640000000000011172123233021252 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops/doc/README_win32.txt0000664000076400007640000000260311104702315023772 0ustar stefanstefanMost of the atomic_ops functionality is available under Win32 with the Microsoft tools, but the build process currently is considerably more primitive than on Linux/Unix platforms. To build: 1) Go to the src directory in the distribution. 2) Make sure the Microsoft command-line tools (e.g. nmake) are available. 3) Run "nmake -f Makefile.msft". This should run some tests, which may print warnings about the types of the "Interlocked" functions. I haven't been able to make all versions of VC++ happy. If you know how to, please send a patch. 4) To compile applications, you will need to retain or copy the following pieces from the resulting src directory contents: "atomic_ops.h" - Header file defining low-level primitives. This includes files from: "atomic_ops"- Subdirectory containing implementation header files. "atomic_ops_stack.h" - Header file describing almost lock-free stack. "atomic_ops_malloc.h" - Header file describing almost lock-free malloc. "libatomic_ops_gpl.lib" - Library containing implementation of the above two. The atomic_ops.h implementation is entirely in the header files in Win32. Most clients of atomic_ops.h will need to define AO_ASSUME_WINDOWS98 before including it. Compare_and_swap is otherwise not available. Note that the library is covered by the GNU General Public License, while the top 2 of these pieces allow use in proprietary code. synopsis-0.12/src/Synopsis/gc/libatomic_ops/doc/LICENSING.txt0000664000076400007640000000536211104702315023333 0ustar stefanstefanOur intent is to make it easy to use libatomic_ops, in both free and proprietary software. Hence most code that we expect to be linked into a client application is covered by an MIT-style license. A few library routines are covered by the GNU General Public License. These are put into a separate library, libatomic_ops_gpl.a . The low-level part of the library is mostly covered by the following license: ---------------------------------------- Copyright (c) ... 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. -------------------------------- A few files in the sysdeps directory were inherited in part from the Boehm-Demers-Weiser conservative garbage collector, and are covered by its license, which is similar in spirit: -------------------------------- Copyright (c) ... THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. Permission is hereby granted to use or copy this program for any purpose, provided the above notices are retained on all copies. Permission to modify the code and to distribute modified code is granted, provided the above notices are retained, and a notice that the code was modified is included with the above copyright notice. ---------------------------------- A few files are covered by the GNU General Public License. (See file "COPYING".) This applies only to test code, sample applications, and the libatomic_ops_gpl portion of the library. Thus libatomic_ops_gpl should generally not be linked into proprietary code. (This distinction was motivated by patent considerations.) It is possible that the license of the GPL pieces may be changed for future versions to make them more consistent with the rest of the package. If you submit patches, and have strong preferences about licensing, please express them. synopsis-0.12/src/Synopsis/gc/libatomic_ops/doc/COPYING0000664000076400007640000004311011104702315022303 0ustar stefanstefan 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. synopsis-0.12/src/Synopsis/gc/libatomic_ops/doc/README_malloc.txt0000664000076400007640000000601411104702316024300 0ustar stefanstefanThe libatomic_ops_gpl includes a simple almost-lock-free malloc implementation. This is intended as a safe way to allocate memory from a signal handler, or to allocate memory in the context of a library that does not know what thread library it will be used with. In either case locking is impossible. Note that the operations are only guaranteed to be 1-lock-free, i.e. a single blocked thread will not prevent progress, but multiple blocked threads may. To safely use these operations in a signal handler, the handler should be non-reentrant, i.e. it should not be interruptable by another handler using these operations. Furthermore use outside of signal handlers in a multithreaded application should be protected by a lock, so that at most one invocation may be interrupted by a signal. The header will define the macro "AO_MALLOC_IS_LOCK_FREE" on platforms on which malloc is completely lock-free, and hence these restrictions do not apply. In the presence of threads, but absence of contention, the time performance of this package should be as good, or slightly better than, most system malloc implementations. Its space performance is theoretically optimal (to within a constant factor), but probably quite poor in practice. In particular, no attempt is made to coalesce free small memory blocks. Something like Doug Lea's malloc is likely to use significantly less memory for complex applications. Perfomance on platforms without an efficient compare-and-swap implementation will be poor. This package was not designed for processor-scalability in the face of high allocation rates. If all threads happen to allocate different-sized objects, you might get lucky. Otherwise expect contention and false-sharing problems. If this is an issue, something like Maged Michael's algorithm (PLDI 2004) would be technically a far better choice. If you are concerned only with scalablity, and not signal-safety, you might also consider using Hoard instead. We have seen a factor of 3 to 4 slowdown from the standard glibc malloc implementation with contention, even when the performance without contention was faster. (To make the implementation more scalable, one would need to replicate at least the free list headers, so that concurrent access is possible without cache conflicts.) Unfortunately there is no portable async-signal-safe way to obtain large chunks of memory from the OS. Based on reading of the source code, mmap-based allocation appears safe under Linux, and probably BSD variants. It is probably unsafe for operating systems built on Mach, such as Apple's Darwin. Without use of mmap, the allocator is limited to a fixed size, statically preallocated heap (2MB by default), and will fail to allocate objects above a certain size (just under 64K by default). Use of mmap to circumvent these limitations requires an explicit call. The entire interface to the AO_malloc package currently consists of: #include /* includes atomic_ops.h */ void *AO_malloc(size_t sz); void AO_free(void *p); void AO_malloc_enable_mmap(void); synopsis-0.12/src/Synopsis/gc/libatomic_ops/doc/Makefile.in0000664000076400007640000002240011104702315023314 0ustar stefanstefan# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 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@ target_triplet = @target@ subdir = doc DIST_COMMON = $(dist_pkgdata_DATA) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in COPYING ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(pkgdatadir)" dist_pkgdataDATA_INSTALL = $(INSTALL_DATA) DATA = $(dist_pkgdata_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ NEED_ASM_FALSE = @NEED_ASM_FALSE@ NEED_ASM_TRUE = @NEED_ASM_TRUE@ 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@ PICFLAG = @PICFLAG@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ 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__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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ # installed documentation # dist_pkgdata_DATA = COPYING LICENSING.txt README.txt COPYING README_stack.txt README_malloc.txt README_win32.txt all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-dist_pkgdataDATA: $(dist_pkgdata_DATA) @$(NORMAL_INSTALL) test -z "$(pkgdatadir)" || $(mkdir_p) "$(DESTDIR)$(pkgdatadir)" @list='$(dist_pkgdata_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(dist_pkgdataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgdatadir)/$$f'"; \ $(dist_pkgdataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgdatadir)/$$f"; \ done uninstall-dist_pkgdataDATA: @$(NORMAL_UNINSTALL) @list='$(dist_pkgdata_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \ rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(pkgdatadir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-dist_pkgdataDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-dist_pkgdataDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-dist_pkgdataDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am uninstall uninstall-am \ uninstall-dist_pkgdataDATA uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: synopsis-0.12/src/Synopsis/gc/libatomic_ops/doc/README.txt0000664000076400007640000002545311104702315022760 0ustar stefanstefanUsage: 0) If possible, do this on a multiprocessor, especially if you are planning on modifying or enhancing the package. It will work on a uniprocessor, but the tests are much more likely to pass in the presence of serious problems. 1) Type ./configure --prefix=; make; make check in the directory containing unpacked source. The usual GNU build machinery is used, except that only static, but position-independent, libraries are normally built. On Windows, read README_win32.txt instead. 2) Applications should include atomic_ops.h. Nearly all operations are implemented by header files included from it. It is sometimes necessary, and always recommended to also link against libatomic_ops.a. To use the almost non-blocking stack or malloc implementations, see the corresponding README files, and also link against libatomic_gpl.a before linking against libatomic_ops.a. OVERVIEW: Atomic_ops.h defines a large collection of operations, each one of which is a combination of an (optional) atomic memory operation, and a memory barrier. Also defines associated feature-test macros to determine whether a particular operation is available on the current target hardware (either directly or by synthesis). This is an attempt to replace various existing files with similar goals, since they usually do not handle differences in memory barrier styles with sufficient generality. If this is included after defining AO_REQUIRE_CAS, then the package will make an attempt to emulate compare-and-swap in a way that (at least on Linux) should still be async-signal-safe. As a result, most other atomic operations will then be defined using the compare-and-swap emulation. This emulation is slow, since it needs to disable signals. And it needs to block in case of contention. If you care about performance on a platform that can't directly provide compare-and-swap, there are probably better alternatives. But this allows easy ports to some such platforms (e.g. PA_RISC). The option is ignored if compare-and-swap can be implemented directly. If atomic_ops.h is included after defining AO_USE_PTHREAD_DEFS, then all atomic operations will be emulated with pthread locking. This is NOT async-signal-safe. And it is slow. It is intended primarily for debugging of the atomic_ops package itself. Note that the implementation reflects our understanding of real processor behavior. This occasionally diverges from the documented behavior. (E.g. the documented X86 behavior seems to be weak enough that it is impractical to use. Current real implementations appear to be much better behaved.) We of course are in no position to guarantee that future processors (even HPs) will continue to behave this way, though we hope they will. This is a work in progress. Corrections/additions for other platforms are greatly appreciated. It passes rudimentary tests on X86, Itanium, and Alpha. OPERATIONS: Most operations operate on values of type AO_t, which are unsigned integers whose size matches that of pointers on the given architecture. Exceptions are: - AO_test_and_set operates on AO_TS_t, which is whatever size the hardware supports with good performance. In some cases this is the length of a cache line. In some cases it is a byte. In many cases it is equivalent to AO_t. - A few operations are implemented on smaller or larger size integers. Such operations are indicated by the appropriate prefix: AO_char_... Operates on unsigned char values. AO_short_... Operates on unsigned short values. AO_int_... Operates on unsigned int values. (Currently a very limited selection of these is implemented. We're working on it.) The defined operations are all of the form AO_[_](). The component specifies an atomic memory operation. It may be one of the following, where the corresponding argument and result types are also specified: void nop() No atomic operation. The barrier may still be useful. AO_t load(volatile AO_t * addr) Atomic load of *addr. void store(volatile AO_t * addr, AO_t new_val) Atomically store new_val to *addr. AO_t fetch_and_add(volatile AO_t *addr, AO_t incr) Atomically add incr to *addr, and return the original value of *addr. AO_t fetch_and_add1(volatile AO_t *addr) Equivalent to AO_fetch_and_add(addr, 1). AO_t fetch_and_sub1(volatile AO_t *addr) Equivalent to AO_fetch_and_add(addr, (AO_t)(-1)). void or(volatile AO_t *addr, AO_t incr) Atomically or incr into *addr. int compare_and_swap(volatile AO_t * addr, AO_t old_val, AO_t new_val) Atomically compare *addr to old_val, and replace *addr by new_val if the first comparison succeeds. Returns nonzero if the comparison succeeded and *addr was updated. AO_TS_VAL_t test_and_set(volatile AO_TS_t * addr) Atomically read the binary value at *addr, and set it. AO_TS_VAL_t is an enumeration type which includes the two values AO_TS_SET and and AO_TS_CLEAR. An AO_TS_t location is capable of holding an AO_TS_VAL_t, but may be much larger, as dictated by hardware constraints. Test_and_set logically sets the value to AO_TS_SET. It may be reset to AO_TS_CLEAR with the AO_CLEAR(AO_TS_t *) macro. AO_TS_t locations should be initialized to AO_TS_INITIALIZER. The values of AO_TS_SET and AO_TS_CLEAR are hardware dependent. (On PA-RISC, AO_TS_SET is zero!) Test_and_set is a more limited version of compare_and_swap. Its only advantage is that it is more easily implementable on some hardware. It should thus be used if only binary test-and-set functionality is needed. If available, we also provide compare_and_swap operations that operate on wider values. Since standard data types for double width values may not be available, these explicitly take pairs of arguments for the new and/or old value. Unfortunately, there are two common variants, neither of which can easily and efficiently emulate the other. The first performs a comparison against the entire value being replaced, where the second replaces a double-width replacement, but performs a single-width comparison: int compare_double_and_swap_double(volatile AO_double_t * addr, AO_t old_val1, AO_t old_val2, AO_t new_val1, AO_t new_val2); int compare_and_swap_double(volatile AO_double_t * addr, AO_t old_val1, AO_t new_val1, AO_t new_val2); where AO_double_t is a structure containing AO_val1 and AO_val2 fields, both of type AO_t. For compare_and_swap_double, we compare against the val1 field. AO_double_t exists only if AO_HAVE_double_t is defined. ORDERING CONSTRAINTS: Each operation name also includes a suffix that specifies the associated ordering semantics. The ordering constraint limits reordering of this operation with repsect to other atomic operations and ordinary memory references. The current implementation assumes that all memory references are to ordinary cacheable memory; the ordering guarantee is with respect to other threads or processes, not I/O devices. (Whether or not this distinction is important is platform-dependent.) Ordering suffixes are one of the following: : No memory barrier. A plain AO_nop() really does nothing. _release: Earlier operations must become visible to other threads before the atomic operation. _acquire: Later operations must become visible after this operation. _read: Subsequent reads must become visible after reads included in the atomic operation or preceding it. Rarely useful for clients? _write: Earlier writes become visible before writes during or after the atomic operation. Rarely useful for clients? _full: Ordered with respect to both earlier and later memops. _release_write: Ordered with respect to earlier writes. This is normally implemented as either a _write or _release barrier. _dd_acquire_read: Ordered with respect to later reads that are data dependent on this one. This is needed on a pointer read, which is later dereferenced to read a second value, with the expectation that the second read is ordered after the first one. On most architectures, this is equivalent to no barrier. (This is very hard to define precisely. It should probably be avoided.) _release_read: Ordered with respect to earlier reads. Useful for implementing read locks. Can be implemented as _release, but not as _read, since _read groups the current operation with the earlier ones. We assume that if a store is data-dependent on an a previous load, then the two are always implicitly ordered. It is possible to test whether AO_ is available on the current platform by checking whether AO_HAVE__ is defined as a macro. Note that we generally don't implement operations that are either meaningless (e.g. AO_nop_acquire, AO_nop_release) or which appear to have no clear use (e.g. AO_load_release, AO_store_acquire, AO_load_write, AO_store_read). On some platforms (e.g. PA-RISC) many operations will remain undefined unless AO_REQUIRE_CAS is defined before including the package. When typed in the package build directory, the following command will print operations that are unimplemented on the platform: make test_atomic; ./test_atomic The following command generates a file "list_atomic.i" containing the macro expansions of all implemented operations on the platform: make list_atomic.i Future directions: It currently appears that something roughly analogous to this is very likely to become part of the C++0x standard. That effort has pointed out a number of issues that we expect to address there. Since some of the solutions really require compiler support, they may not be completely addressed here. Known issues include: We should be more precise in defining the semantics of the ordering constraints, and if and how we can guarantee sequential consistency. Dd_acquire_read is very hard or impossible to define in a way that cannot be invalidated by reasonably standard compiler transformations. There is probably no good reason to provide operations on standard integer types, since those may have the wrong alignment constraints. Example: If you want to initialize an object, and then "publish" a pointer to it in a global location p, such that other threads reading the new value of p are guaranteed to see an initialized object, it suffices to use AO_release_write(p, ...) to write the pointer to the object, and to retrieve it in other threads with AO_acquire_read(p). Platform notes: All X86: We quietly assume 486 or better. Windows: Currently AO_REQUIRE_CAS is not supported. Microsoft compilers: Define AO_ASSUME_WINDOWS98 to get access to hardware compare-and-swap functionality. This relies on the InterlockedCompareExchange() function which was apparently not supported in Windows95. (There may be a better way to get access to this.) Currently only X86(32 bit) is supported for Windows. Gcc on x86: Define AO_USE_PENTIUM4_INSTRS to use the Pentium 4 mfence instruction. Currently this is appears to be of marginal benefit. synopsis-0.12/src/Synopsis/gc/libatomic_ops/doc/README_stack.txt0000664000076400007640000000766311104702316024151 0ustar stefanstefanNote that the AO_stack implementation is licensed under the GPL, unlike the lower level routines. The header file atomic_ops_stack.h defines a linked stack abstraction. Stacks may be accessed by multiple concurrent threads. The implementation is 1-lock-free, i.e. it will continue to make progress if at most one thread becomes inactive while operating on the data structure. (The implementation can be built to be N-lock-free for any given N. But that seems to rarely be useful, especially since larger N involve some slowdown.) This makes it safe to access these data structures from non-reentrant signal handlers, provided at most one non-signal-handler thread is accessing the data structure at once. This latter condition can be ensured by acquiring an ordinary lock around the non-hndler accesses to the data structure. For details see: Hans-J. Boehm, "An Almost Non-Blocking Stack", PODC 2004, http://portal.acm.org/citation.cfm?doid=1011767.1011774, or http://www.hpl.hp.com/techreports/2004/HPL-2004-105.html (This is not exactly the implementation described there, since the interface was cleaned up in the interim. But it should perform very similarly.) We use a fully lock-free implementation when the underlying hardware makes that less expensive, i.e. when we have a double-wide compare-and-swap operation available. (The fully lock-free implementation uses an AO_t- sized version count, and assumes it does not wrap during the time any given operation is active. This seems reasonably safe on 32-bit hardware, and very safe on 64-bit hardware.) If a fully lock-free implementation is used, the macro AO_STACK_IS_LOCK_FREE will be defined. The implementation is interesting only because it allows reuse of existing nodes. This is necessary, for example, to implement a memory allocator. Since we want to leave the precise stack node type up to the client, we insist only that each stack node contains a link field of type AO_t. When a new node is pushed on the stack, the push operation expects to be passed the pointer to this link field, which will then be overwritten by this link field. Similarly, the pop operation returns a pointer to the link field of the object that previously was on the top of the stack. The cleanest way to use these routines is probably to define the stack node type with an initial AO_t link field, so that the conversion between the link-field pointer and the stack element pointer is just a compile-time cast. But other possibilities exist. (This would be cleaner in C++ with templates.) A stack is represented by an AO_stack_t structure. (This is normally 2 or 3 times the size of a pointer.) It may be statically initialized by setting it to AO_STACK_INITIALIZER, or dynamically initialized to an empty stack with AO_stack_init. There are only three operations for accessing stacks: void AO_stack_init(AO_stack_t *list); void AO_stack_push_release(AO_stack_t *list, AO_t *new_element); AO_t * AO_stack_pop_acquire(volatile AO_stack_t *list); We require that the objects pushed as list elements remain addressable as long as any push or pop operation are in progress. (It is OK for an object to be "pop"ped off a stack and "deallocated" with a concurrent "pop" on the same stack still in progress, but only if "deallocation" leaves the object addressable. The second "pop" may still read the object, but the value it reads will not matter.) We require that the headers (AO_stack objects) remain allocated and valid as long as any operations on them are still in-flight. We also provide macros AO_REAL_HEAD_PTR that converts an AO_stack_t to a pointer to the link field in the next element, and AO_REAL_NEXT_PTR that converts a link field to a real, dereferencable, pointer to the link field in the next element. This is intended only for debugging, or to traverse the list after modification has ceased. There is otherwise no guarantee that walking a stack using this macro will produce any kind of consistent picture of the data structure. synopsis-0.12/src/Synopsis/gc/libatomic_ops/doc/Makefile.am0000664000076400007640000000021311104702315023301 0ustar stefanstefan# installed documentation # dist_pkgdata_DATA=COPYING LICENSING.txt README.txt COPYING README_stack.txt README_malloc.txt README_win32.txt synopsis-0.12/src/Synopsis/gc/libatomic_ops/INSTALL0000664000076400007640000000133411104702315021536 0ustar stefanstefanThe configuration and build scripts for this package were generated by automake/autoconf. "configure --prefix=; make; make install" in this directory should work. Note that much of the content of this library is in the header files. However two small libraries are built and installed: - libatomic_ops.a is a support library, which is not needed on some platforms. This is intended to be usable, under some mild restrictions, in free or proprietary code, as are all the header files. See doc/LICENSING.txt. - libatomic_ops_gpl.a contains some higher level facilities. This code is currently covered by the GPL. The contents currently correspond to the headers atomic_ops_stack.h and atomic_ops_malloc.h. synopsis-0.12/src/Synopsis/gc/libatomic_ops/NEWS0000664000076400007640000000000111104702315021172 0ustar stefanstefan synopsis-0.12/src/Synopsis/gc/configure_atomic_ops.sh0000775000076400007640000000013011104702316022410 0ustar stefanstefan#!/bin/sh P=`pwd`/libatomic_ops-install cd libatomic_ops-*[0-9] ./configure --prefix=$P synopsis-0.12/src/Synopsis/gc/digimars.mak0000775000076400007640000000372211104702316020161 0ustar stefanstefan# Makefile to build Hans Boehm garbage collector using the Digital Mars # compiler from www.digitalmars.com # Written by Walter Bright DEFINES=-DNDEBUG -DGC_BUILD -D_WINDOWS -DGC_DLL -DALL_INTERIOR_POINTERS -D__STDC__ -DWIN32_THREADS CFLAGS=-Iinclude $(DEFINES) -wx -g LFLAGS=/ma/implib/co CC=sc .c.obj: $(CC) -c $(CFLAGS) $* .cpp.obj: $(CC) -c $(CFLAGS) -Aa $* OBJS= \ allchblk.obj\ alloc.obj\ blacklst.obj\ checksums.obj\ dbg_mlc.obj\ dyn_load.obj\ finalize.obj\ gc_cpp.obj\ headers.obj\ mach_dep.obj\ malloc.obj\ mallocx.obj\ mark.obj\ mark_rts.obj\ misc.obj\ new_hblk.obj\ obj_map.obj\ os_dep.obj\ ptr_chck.obj\ reclaim.obj\ stubborn.obj\ typd_mlc.obj\ win32_threads.obj targets: gc.dll gc.lib gctest.exe gc.dll: $(OBJS) gc.def digimars.mak sc -ogc.dll $(OBJS) -L$(LFLAGS) gc.def kernel32.lib user32.lib gc.def: digimars.mak echo LIBRARY GC >gc.def echo DESCRIPTION "Hans Boehm Garbage Collector" >>gc.def echo EXETYPE NT >>gc.def echo EXPORTS >>gc.def echo GC_is_visible_print_proc >>gc.def echo GC_is_valid_displacement_print_proc >>gc.def clean: del gc.def del $(OBJS) gctest.exe : gc.lib tests\test.obj sc -ogctest.exe tests\test.obj gc.lib tests\test.obj : tests\test.c $(CC) -c -g -DNDEBUG -DGC_BUILD -D_WINDOWS -DGC_DLL \ -DALL_INTERIOR_POINTERS -DWIN32_THREADS \ -Iinclude tests\test.c -otests\test.obj allchblk.obj: allchblk.c alloc.obj: alloc.c blacklst.obj: blacklst.c checksums.obj: checksums.c dbg_mlc.obj: dbg_mlc.c dyn_load.obj: dyn_load.c finalize.obj: finalize.c gc_cpp.obj: gc_cpp.cpp headers.obj: headers.c mach_dep.obj: mach_dep.c malloc.obj: malloc.c mallocx.obj: mallocx.c mark.obj: mark.c mark_rts.obj: mark_rts.c misc.obj: misc.c new_hblk.obj: new_hblk.c obj_map.obj: obj_map.c os_dep.obj: os_dep.c ptr_chck.obj: ptr_chck.c reclaim.obj: reclaim.c stubborn.obj: stubborn.c typd_mlc.obj: typd_mlc.c win32_threads.obj: win32_threads.c synopsis-0.12/src/Synopsis/gc/add_gc_prefix.c0000664000076400007640000000064711104702316020612 0ustar stefanstefan# include # include "version.h" int main(argc, argv, envp) int argc; char ** argv; char ** envp; { int i; for (i = 1; i < argc; i++) { if (GC_ALPHA_VERSION == GC_NOT_ALPHA) { printf("gc%d.%d/%s ", GC_VERSION_MAJOR, GC_VERSION_MINOR, argv[i]); } else { printf("gc%d.%dalpha%d/%s ", GC_VERSION_MAJOR, GC_VERSION_MINOR, GC_ALPHA_VERSION, argv[i]); } } return(0); } synopsis-0.12/src/Synopsis/gc/sparc_mach_dep.S0000664000076400007640000000365511104702316020746 0ustar stefanstefan! SPARCompiler 3.0 and later apparently no longer handles ! asm outside functions. So we need a separate .s file ! This is only set up for SunOS 5, not SunOS 4. ! Assumes this is called before the stack contents are ! examined. .seg "text" .globl GC_save_regs_in_stack .globl GC_push_regs GC_save_regs_in_stack: #if defined(__arch64__) || defined(__sparcv9) save %sp,-128,%sp flushw ret restore %sp,2047+128,%o0 #else /* 32 bit SPARC */ ta 0x3 ! ST_FLUSH_WINDOWS mov %sp,%o0 retl nop #endif /* 32 bit SPARC */ .GC_save_regs_in_stack_end: .size GC_save_regs_in_stack,.GC_save_regs_in_stack_end-GC_save_regs_in_stack ! GC_clear_stack_inner(arg, limit) clears stack area up to limit and ! returns arg. Stack clearing is crucial on SPARC, so we supply ! an assembly version that s more careful. Assumes limit is hotter ! than sp, and limit is 8 byte aligned. .globl GC_clear_stack_inner GC_clear_stack_inner: #if defined(__arch64__) || defined(__sparcv9) mov %sp,%o2 ! Save sp add %sp,2047-8,%o3 ! p = sp+bias-8 add %o1,-2047-192,%sp ! Move sp out of the way, ! so that traps still work. ! Includes some extra words ! so we can be sloppy below. loop: stx %g0,[%o3] ! *(long *)p = 0 cmp %o3,%o1 bgu,pt %xcc, loop ! if (p > limit) goto loop add %o3,-8,%o3 ! p -= 8 (delay slot) retl mov %o2,%sp ! Restore sp., delay slot #else /* 32 bit SPARC */ mov %sp,%o2 ! Save sp add %sp,-8,%o3 ! p = sp-8 clr %g1 ! [g0,g1] = 0 add %o1,-0x60,%sp ! Move sp out of the way, ! so that traps still work. ! Includes some extra words ! so we can be sloppy below. loop: std %g0,[%o3] ! *(long long *)p = 0 cmp %o3,%o1 bgu loop ! if (p > limit) goto loop add %o3,-8,%o3 ! p -= 8 (delay slot) retl mov %o2,%sp ! Restore sp., delay slot #endif /* 32 bit SPARC */ .GC_clear_stack_inner_end: .size GC_clear_stack_inner,.GC_clear_stack_inner_end-GC_clear_stack_inner synopsis-0.12/src/Synopsis/gc/libtool.m40000664000076400007640000070230211104702315017572 0ustar stefanstefan# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- ## Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 ## Free Software Foundation, Inc. ## Originally by Gordon Matzigkeit , 1996 ## ## This file is free software; the Free Software Foundation gives ## unlimited permission to copy and/or distribute it, with or without ## modifications, as long as this notice is preserved. # serial 48 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 MSVC, # 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 "$LTCFLAGS" && LTCFLAGS=$CFLAGS 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="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; 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"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # 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; /^ *+/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; /^ *+/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 ;; sparc*-*solaris*) # 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 *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) LD="${LD-ld} -64" ;; esac ;; esac fi rm -rf conftest* ;; 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}\{0,1\} :&$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 -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || 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 linker 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 -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/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 all BSDs 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` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; 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 ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 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); */ } else puts (dlerror ()); exit (status); }] EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|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" wl=$lt_prog_compiler_wl 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 wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" 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}\{0,1\} :&$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 -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || 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 . 2>&AS_MESSAGE_LOG_FD $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~ chmod a+x \$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. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[123]]*) objformat=aout ;; *) objformat=elf ;; esac fi 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 ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes 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' ;; interix3*) 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' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; 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 # 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 /usr/lib $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 sys_lib_dlsearch_path_spec="/usr/lib" 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" ;; 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.3*) 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 ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; 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 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 ])# 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 if test -z "$LTCFLAGS"; then eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" 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 DLLs 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 variants of GNU ld 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 ;; interix3*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; 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 ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) 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 ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | 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_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_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" done 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 # AC_CONFIG_SUBDIRS is not called here. 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 # AC_CONFIG_SUBDIRS is not called here. 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 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 ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... 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 # Report which library types will 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_shlibpath_var, $1)=unsupported _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=cpp # 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 $as_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 $as_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 '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${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 '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_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' # Exported symbols can be pulled into shared objects from archives _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; 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 ;; 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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $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 lds 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 lds _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 _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' ;; *) _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _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*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _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 hppa*64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _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 ;; interix3*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; 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 ;; 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(archive_cmds_need_lc,$1)=yes _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -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} ${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 output_verbose_link_cmd='echo' # 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 ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. # So that behaviour is only enabled if SCOABSPATH is set to a # non-empty value in the environment. Most likely only useful for # creating official distributions of packages. # This is a hack until libtool officially supports absolute path # names for shared libraries. _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; 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" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... 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_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 # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # 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*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; 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)= ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; 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)='${wl}-a ${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)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; 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)='-Bstatic' ;; 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*) ;; 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 ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _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' ;; esac ;; 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' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; 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* | pgf95*) # 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)='-Bstatic' ;; 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' ;; 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*) _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 ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _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' ;; 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 # # Check to make sure the static flag actually works. # wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\" AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) ]) # 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 ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; 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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; interix3*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; 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* | pgf95*) # 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*) 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 ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_AC_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; 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 "$lt_prog_compiler_static"; 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 '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${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 '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_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' # Exported symbols can be pulled into shared objects from archives _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${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 lds _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 lds _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*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _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 fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -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*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _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)=: ;; 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*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7*) _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; 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 # # 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) pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $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]) ]) synopsis-0.12/src/Synopsis/gc/mallocx.c0000664000076400007640000004273011104702316017472 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996 by Silicon Graphics. All rights reserved. * Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* * These are extra allocation routines which are likely to be less * frequently used than those in malloc.c. They are separate in the * hope that the .o file will be excluded from statically linked * executables. We should probably break this up further. */ #include #include "private/gc_priv.h" extern ptr_t GC_clear_stack(); /* in misc.c, behaves like identity */ void GC_extend_size_map(); /* in misc.c. */ GC_bool GC_alloc_reclaim_list(); /* in malloc.c */ /* Some externally visible but unadvertised variables to allow access to */ /* free lists from inlined allocators without including gc_priv.h */ /* or introducing dependencies on internal data structure layouts. */ void ** const GC_objfreelist_ptr = GC_objfreelist; void ** const GC_aobjfreelist_ptr = GC_aobjfreelist; void ** const GC_uobjfreelist_ptr = GC_uobjfreelist; # ifdef ATOMIC_UNCOLLECTABLE void ** const GC_auobjfreelist_ptr = GC_auobjfreelist; # endif void * GC_generic_or_special_malloc(size_t lb, int knd) { switch(knd) { # ifdef STUBBORN_ALLOC case STUBBORN: return(GC_malloc_stubborn((size_t)lb)); # endif case PTRFREE: return(GC_malloc_atomic((size_t)lb)); case NORMAL: return(GC_malloc((size_t)lb)); case UNCOLLECTABLE: return(GC_malloc_uncollectable((size_t)lb)); # ifdef ATOMIC_UNCOLLECTABLE case AUNCOLLECTABLE: return(GC_malloc_atomic_uncollectable((size_t)lb)); # endif /* ATOMIC_UNCOLLECTABLE */ default: return(GC_generic_malloc(lb,knd)); } } /* Change the size of the block pointed to by p to contain at least */ /* lb bytes. The object may be (and quite likely will be) moved. */ /* The kind (e.g. atomic) is the same as that of the old. */ /* Shrinking of large blocks is not implemented well. */ void * GC_realloc(void * p, size_t lb) { struct hblk * h; hdr * hhdr; size_t sz; /* Current size in bytes */ size_t orig_sz; /* Original sz in bytes */ int obj_kind; if (p == 0) return(GC_malloc(lb)); /* Required by ANSI */ h = HBLKPTR(p); hhdr = HDR(h); sz = hhdr -> hb_sz; obj_kind = hhdr -> hb_obj_kind; orig_sz = sz; if (sz > MAXOBJBYTES) { /* Round it up to the next whole heap block */ register word descr; sz = (sz+HBLKSIZE-1) & (~HBLKMASK); hhdr -> hb_sz = sz; descr = GC_obj_kinds[obj_kind].ok_descriptor; if (GC_obj_kinds[obj_kind].ok_relocate_descr) descr += sz; hhdr -> hb_descr = descr; # ifdef MARK_BIT_PER_OBJ GC_ASSERT(hhdr -> hb_inv_sz == LARGE_INV_SZ); # else GC_ASSERT(hhdr -> hb_large_block && hhdr -> hb_map[ANY_INDEX] == 1); # endif if (IS_UNCOLLECTABLE(obj_kind)) GC_non_gc_bytes += (sz - orig_sz); /* Extra area is already cleared by GC_alloc_large_and_clear. */ } if (ADD_SLOP(lb) <= sz) { if (lb >= (sz >> 1)) { # ifdef STUBBORN_ALLOC if (obj_kind == STUBBORN) GC_change_stubborn(p); # endif if (orig_sz > lb) { /* Clear unneeded part of object to avoid bogus pointer */ /* tracing. */ /* Safe for stubborn objects. */ BZERO(((ptr_t)p) + lb, orig_sz - lb); } return(p); } else { /* shrink */ void * result = GC_generic_or_special_malloc((word)lb, obj_kind); if (result == 0) return(0); /* Could also return original object. But this */ /* gives the client warning of imminent disaster. */ BCOPY(p, result, lb); # ifndef IGNORE_FREE GC_free(p); # endif return(result); } } else { /* grow */ void * result = GC_generic_or_special_malloc((word)lb, obj_kind); if (result == 0) return(0); BCOPY(p, result, sz); # ifndef IGNORE_FREE GC_free(p); # endif return(result); } } # if defined(REDIRECT_MALLOC) && !defined(REDIRECT_REALLOC) # define REDIRECT_REALLOC GC_realloc # endif # ifdef REDIRECT_REALLOC /* As with malloc, avoid two levels of extra calls here. */ # ifdef GC_ADD_CALLER # define RA GC_RETURN_ADDR, # else # define RA # endif # define GC_debug_realloc_replacement(p, lb) \ GC_debug_realloc(p, lb, RA "unknown", 0) void * realloc(void * p, size_t lb) { return(REDIRECT_REALLOC(p, lb)); } # undef GC_debug_realloc_replacement # endif /* REDIRECT_REALLOC */ /* Allocate memory such that only pointers to near the */ /* beginning of the object are considered. */ /* We avoid holding allocation lock while we clear memory. */ void * GC_generic_malloc_ignore_off_page(size_t lb, int k) { void *result; size_t lw; size_t lb_rounded; word n_blocks; GC_bool init; DCL_LOCK_STATE; if (SMALL_OBJ(lb)) return(GC_generic_malloc((word)lb, k)); lw = ROUNDED_UP_WORDS(lb); lb_rounded = WORDS_TO_BYTES(lw); n_blocks = OBJ_SZ_TO_BLOCKS(lb_rounded); init = GC_obj_kinds[k].ok_init; if (GC_have_errors) GC_print_all_errors(); GC_INVOKE_FINALIZERS(); LOCK(); result = (ptr_t)GC_alloc_large(ADD_SLOP(lb), k, IGNORE_OFF_PAGE); if (0 != result) { if (GC_debugging_started) { BZERO(result, n_blocks * HBLKSIZE); } else { # ifdef THREADS /* Clear any memory that might be used for GC descriptors */ /* before we release the lock. */ ((word *)result)[0] = 0; ((word *)result)[1] = 0; ((word *)result)[lw-1] = 0; ((word *)result)[lw-2] = 0; # endif } } GC_bytes_allocd += lb_rounded; UNLOCK(); if (0 == result) { return((*GC_oom_fn)(lb)); } else { if (init && !GC_debugging_started) { BZERO(result, n_blocks * HBLKSIZE); } return(result); } } void * GC_malloc_ignore_off_page(size_t lb) { return((void *)GC_generic_malloc_ignore_off_page(lb, NORMAL)); } void * GC_malloc_atomic_ignore_off_page(size_t lb) { return((void *)GC_generic_malloc_ignore_off_page(lb, PTRFREE)); } /* Increment GC_bytes_allocd from code that doesn't have direct access */ /* to GC_arrays. */ void GC_incr_bytes_allocd(size_t n) { GC_bytes_allocd += n; } /* The same for GC_bytes_freed. */ void GC_incr_bytes_freed(size_t n) { GC_bytes_freed += n; } #if defined(THREADS) extern signed_word GC_bytes_found; /* Protected by GC lock. */ #ifdef PARALLEL_MARK volatile signed_word GC_bytes_allocd_tmp = 0; /* Number of bytes of memory allocated since */ /* we released the GC lock. Instead of */ /* reacquiring the GC lock just to add this in, */ /* we add it in the next time we reacquire */ /* the lock. (Atomically adding it doesn't */ /* work, since we would have to atomically */ /* update it in GC_malloc, which is too */ /* expensive.) */ #endif /* PARALLEL_MARK */ /* Return a list of 1 or more objects of the indicated size, linked */ /* through the first word in the object. This has the advantage that */ /* it acquires the allocation lock only once, and may greatly reduce */ /* time wasted contending for the allocation lock. Typical usage would */ /* be in a thread that requires many items of the same size. It would */ /* keep its own free list in thread-local storage, and call */ /* GC_malloc_many or friends to replenish it. (We do not round up */ /* object sizes, since a call indicates the intention to consume many */ /* objects of exactly this size.) */ /* We assume that the size is a multiple of GRANULE_BYTES. */ /* We return the free-list by assigning it to *result, since it is */ /* not safe to return, e.g. a linked list of pointer-free objects, */ /* since the collector would not retain the entire list if it were */ /* invoked just as we were returning. */ /* Note that the client should usually clear the link field. */ void GC_generic_malloc_many(size_t lb, int k, void **result) { void *op; void *p; void **opp; size_t lw; /* Length in words. */ size_t lg; /* Length in granules. */ signed_word my_bytes_allocd = 0; struct obj_kind * ok = &(GC_obj_kinds[k]); DCL_LOCK_STATE; GC_ASSERT((lb & (GRANULE_BYTES-1)) == 0); if (!SMALL_OBJ(lb)) { op = GC_generic_malloc(lb, k); if(0 != op) obj_link(op) = 0; *result = op; return; } lw = BYTES_TO_WORDS(lb); lg = BYTES_TO_GRANULES(lb); if (GC_have_errors) GC_print_all_errors(); GC_INVOKE_FINALIZERS(); LOCK(); if (!GC_is_initialized) GC_init_inner(); /* Do our share of marking work */ if (GC_incremental && !GC_dont_gc) { ENTER_GC(); GC_collect_a_little_inner(1); EXIT_GC(); } /* First see if we can reclaim a page of objects waiting to be */ /* reclaimed. */ { struct hblk ** rlh = ok -> ok_reclaim_list; struct hblk * hbp; hdr * hhdr; rlh += lg; while ((hbp = *rlh) != 0) { hhdr = HDR(hbp); *rlh = hhdr -> hb_next; GC_ASSERT(hhdr -> hb_sz == lb); hhdr -> hb_last_reclaimed = (unsigned short) GC_gc_no; # ifdef PARALLEL_MARK { signed_word my_bytes_allocd_tmp = GC_bytes_allocd_tmp; GC_ASSERT(my_bytes_allocd_tmp >= 0); /* We only decrement it while holding the GC lock. */ /* Thus we can't accidentally adjust it down in more */ /* than one thread simultaneously. */ if (my_bytes_allocd_tmp != 0) { (void)AO_fetch_and_add( (volatile AO_t *)(&GC_bytes_allocd_tmp), (AO_t)(-my_bytes_allocd_tmp)); GC_bytes_allocd += my_bytes_allocd_tmp; } } GC_acquire_mark_lock(); ++ GC_fl_builder_count; UNLOCK(); GC_release_mark_lock(); # endif op = GC_reclaim_generic(hbp, hhdr, lb, ok -> ok_init, 0, &my_bytes_allocd); if (op != 0) { /* We also reclaimed memory, so we need to adjust */ /* that count. */ /* This should be atomic, so the results may be */ /* inaccurate. */ GC_bytes_found += my_bytes_allocd; # ifdef PARALLEL_MARK *result = op; (void)AO_fetch_and_add( (volatile AO_t *)(&GC_bytes_allocd_tmp), (AO_t)(my_bytes_allocd)); GC_acquire_mark_lock(); -- GC_fl_builder_count; if (GC_fl_builder_count == 0) GC_notify_all_builder(); GC_release_mark_lock(); (void) GC_clear_stack(0); return; # else GC_bytes_allocd += my_bytes_allocd; goto out; # endif } # ifdef PARALLEL_MARK GC_acquire_mark_lock(); -- GC_fl_builder_count; if (GC_fl_builder_count == 0) GC_notify_all_builder(); GC_release_mark_lock(); LOCK(); /* GC lock is needed for reclaim list access. We */ /* must decrement fl_builder_count before reaquiring GC */ /* lock. Hopefully this path is rare. */ # endif } } /* Next try to use prefix of global free list if there is one. */ /* We don't refill it, but we need to use it up before allocating */ /* a new block ourselves. */ opp = &(GC_obj_kinds[k].ok_freelist[lg]); if ( (op = *opp) != 0 ) { *opp = 0; my_bytes_allocd = 0; for (p = op; p != 0; p = obj_link(p)) { my_bytes_allocd += lb; if (my_bytes_allocd >= HBLKSIZE) { *opp = obj_link(p); obj_link(p) = 0; break; } } GC_bytes_allocd += my_bytes_allocd; goto out; } /* Next try to allocate a new block worth of objects of this size. */ { struct hblk *h = GC_allochblk(lb, k, 0); if (h != 0) { if (IS_UNCOLLECTABLE(k)) GC_set_hdr_marks(HDR(h)); GC_bytes_allocd += HBLKSIZE - HBLKSIZE % lb; # ifdef PARALLEL_MARK GC_acquire_mark_lock(); ++ GC_fl_builder_count; UNLOCK(); GC_release_mark_lock(); # endif op = GC_build_fl(h, lw, ok -> ok_init, 0); # ifdef PARALLEL_MARK *result = op; GC_acquire_mark_lock(); -- GC_fl_builder_count; if (GC_fl_builder_count == 0) GC_notify_all_builder(); GC_release_mark_lock(); (void) GC_clear_stack(0); return; # else goto out; # endif } } /* As a last attempt, try allocating a single object. Note that */ /* this may trigger a collection or expand the heap. */ op = GC_generic_malloc_inner(lb, k); if (0 != op) obj_link(op) = 0; out: *result = op; UNLOCK(); (void) GC_clear_stack(0); } void * GC_malloc_many(size_t lb) { void *result; GC_generic_malloc_many(((lb + EXTRA_BYTES + GRANULE_BYTES-1) & ~(GRANULE_BYTES-1)), NORMAL, &result); return result; } /* Note that the "atomic" version of this would be unsafe, since the */ /* links would not be seen by the collector. */ # endif /* Allocate lb bytes of pointerful, traced, but not collectable data */ void * GC_malloc_uncollectable(size_t lb) { void *op; void **opp; size_t lg; DCL_LOCK_STATE; if( SMALL_OBJ(lb) ) { if (EXTRA_BYTES != 0 && lb != 0) lb--; /* We don't need the extra byte, since this won't be */ /* collected anyway. */ lg = GC_size_map[lb]; opp = &(GC_uobjfreelist[lg]); LOCK(); if( (op = *opp) != 0 ) { /* See above comment on signals. */ *opp = obj_link(op); obj_link(op) = 0; GC_bytes_allocd += GRANULES_TO_BYTES(lg); /* Mark bit ws already set on free list. It will be */ /* cleared only temporarily during a collection, as a */ /* result of the normal free list mark bit clearing. */ GC_non_gc_bytes += GRANULES_TO_BYTES(lg); UNLOCK(); } else { UNLOCK(); op = (ptr_t)GC_generic_malloc((word)lb, UNCOLLECTABLE); /* For small objects, the free lists are completely marked. */ } GC_ASSERT(0 == op || GC_is_marked(op)); return((void *) op); } else { hdr * hhdr; op = (ptr_t)GC_generic_malloc((word)lb, UNCOLLECTABLE); if (0 == op) return(0); GC_ASSERT(((word)op & (HBLKSIZE - 1)) == 0); /* large block */ hhdr = HDR((struct hbklk *)op); /* We don't need the lock here, since we have an undisguised */ /* pointer. We do need to hold the lock while we adjust */ /* mark bits. */ lb = hhdr -> hb_sz; LOCK(); set_mark_bit_from_hdr(hhdr, 0); /* Only object. */ GC_ASSERT(hhdr -> hb_n_marks == 0); hhdr -> hb_n_marks = 1; UNLOCK(); return((void *) op); } } /* Not well tested nor integrated. */ /* Debug version is tricky and currently missing. */ #include void * GC_memalign(size_t align, size_t lb) { size_t new_lb; size_t offset; ptr_t result; if (align <= GRANULE_BYTES) return GC_malloc(lb); if (align >= HBLKSIZE/2 || lb >= HBLKSIZE/2) { if (align > HBLKSIZE) return GC_oom_fn(LONG_MAX-1024) /* Fail */; return GC_malloc(lb <= HBLKSIZE? HBLKSIZE : lb); /* Will be HBLKSIZE aligned. */ } /* We could also try to make sure that the real rounded-up object size */ /* is a multiple of align. That would be correct up to HBLKSIZE. */ new_lb = lb + align - 1; result = GC_malloc(new_lb); offset = (word)result % align; if (offset != 0) { offset = align - offset; if (!GC_all_interior_pointers) { if (offset >= VALID_OFFSET_SZ) return GC_malloc(HBLKSIZE); GC_register_displacement(offset); } } result = (void *) ((ptr_t)result + offset); GC_ASSERT((word)result % align == 0); return result; } # ifdef ATOMIC_UNCOLLECTABLE /* Allocate lb bytes of pointerfree, untraced, uncollectable data */ /* This is normally roughly equivalent to the system malloc. */ /* But it may be useful if malloc is redefined. */ void * GC_malloc_atomic_uncollectable(size_t lb) { void *op; void **opp; size_t lg; DCL_LOCK_STATE; if( SMALL_OBJ(lb) ) { if (EXTRA_BYTES != 0 && lb != 0) lb--; /* We don't need the extra byte, since this won't be */ /* collected anyway. */ lg = GC_size_map[lb]; opp = &(GC_auobjfreelist[lg]); LOCK(); if( (op = *opp) != 0 ) { /* See above comment on signals. */ *opp = obj_link(op); obj_link(op) = 0; GC_bytes_allocd += GRANULES_TO_BYTES(lg); /* Mark bit was already set while object was on free list. */ GC_non_gc_bytes += GRANULES_TO_BYTES(lg); UNLOCK(); } else { UNLOCK(); op = (ptr_t)GC_generic_malloc(lb, AUNCOLLECTABLE); } GC_ASSERT(0 == op || GC_is_marked(op)); return((void *) op); } else { hdr * hhdr; op = (ptr_t)GC_generic_malloc(lb, AUNCOLLECTABLE); if (0 == op) return(0); GC_ASSERT(((word)op & (HBLKSIZE - 1)) == 0); hhdr = HDR((struct hbklk *)op); lb = hhdr -> hb_sz; LOCK(); set_mark_bit_from_hdr(hhdr, 0); /* Only object. */ GC_ASSERT(hhdr -> hb_n_marks == 0); hhdr -> hb_n_marks = 1; UNLOCK(); return((void *) op); } } #endif /* ATOMIC_UNCOLLECTABLE */ synopsis-0.12/src/Synopsis/gc/mach_dep.c0000664000076400007640000001750411104702316017574 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* Boehm, November 17, 1995 12:13 pm PST */ # include "private/gc_priv.h" # include # include # if defined(OS2) || defined(CX_UX) # define _setjmp(b) setjmp(b) # define _longjmp(b,v) longjmp(b,v) # endif # ifdef AMIGA # ifndef __GNUC__ # include # else # include # endif # endif #if defined(__MWERKS__) && !defined(POWERPC) asm static void PushMacRegisters() { sub.w #4,sp // reserve space for one parameter. move.l a2,(sp) jsr GC_push_one move.l a3,(sp) jsr GC_push_one move.l a4,(sp) jsr GC_push_one # if !__option(a6frames) // perhaps a6 should be pushed if stack frames are not being used. move.l a6,(sp) jsr GC_push_one # endif // skip a5 (globals), a6 (frame pointer), and a7 (stack pointer) move.l d2,(sp) jsr GC_push_one move.l d3,(sp) jsr GC_push_one move.l d4,(sp) jsr GC_push_one move.l d5,(sp) jsr GC_push_one move.l d6,(sp) jsr GC_push_one move.l d7,(sp) jsr GC_push_one add.w #4,sp // fix stack. rts } #endif /* __MWERKS__ */ # if defined(SPARC) || defined(IA64) /* Value returned from register flushing routine; either sp (SPARC) */ /* or ar.bsp (IA64) */ ptr_t GC_save_regs_ret_val; # endif /* Routine to mark from registers that are preserved by the C compiler. */ /* This must be ported to every new architecture. It is noe optional, */ /* and should not be used on platforms that are either UNIX-like, or */ /* require thread support. */ #undef HAVE_PUSH_REGS #if defined(USE_ASM_PUSH_REGS) # define HAVE_PUSH_REGS #else /* No asm implementation */ void GC_push_regs() { # if defined(M68K) && defined(AMIGA) /* AMIGA - could be replaced by generic code */ /* a0, a1, d0 and d1 are caller save */ # ifdef __GNUC__ asm("subq.w &0x4,%sp"); /* allocate word on top of stack */ asm("mov.l %a2,(%sp)"); asm("jsr _GC_push_one"); asm("mov.l %a3,(%sp)"); asm("jsr _GC_push_one"); asm("mov.l %a4,(%sp)"); asm("jsr _GC_push_one"); asm("mov.l %a5,(%sp)"); asm("jsr _GC_push_one"); asm("mov.l %a6,(%sp)"); asm("jsr _GC_push_one"); /* Skip frame pointer and stack pointer */ asm("mov.l %d2,(%sp)"); asm("jsr _GC_push_one"); asm("mov.l %d3,(%sp)"); asm("jsr _GC_push_one"); asm("mov.l %d4,(%sp)"); asm("jsr _GC_push_one"); asm("mov.l %d5,(%sp)"); asm("jsr _GC_push_one"); asm("mov.l %d6,(%sp)"); asm("jsr _GC_push_one"); asm("mov.l %d7,(%sp)"); asm("jsr _GC_push_one"); asm("addq.w &0x4,%sp"); /* put stack back where it was */ # define HAVE_PUSH_REGS # else /* !__GNUC__ */ GC_push_one(getreg(REG_A2)); GC_push_one(getreg(REG_A3)); # ifndef __SASC /* Can probably be changed to #if 0 -Kjetil M. (a4=globals)*/ GC_push_one(getreg(REG_A4)); # endif GC_push_one(getreg(REG_A5)); GC_push_one(getreg(REG_A6)); /* Skip stack pointer */ GC_push_one(getreg(REG_D2)); GC_push_one(getreg(REG_D3)); GC_push_one(getreg(REG_D4)); GC_push_one(getreg(REG_D5)); GC_push_one(getreg(REG_D6)); GC_push_one(getreg(REG_D7)); # define HAVE_PUSH_REGS # endif /* !__GNUC__ */ # endif /* AMIGA */ # if defined(M68K) && defined(MACOS) # if defined(THINK_C) # define PushMacReg(reg) \ move.l reg,(sp) \ jsr GC_push_one asm { sub.w #4,sp ; reserve space for one parameter. PushMacReg(a2); PushMacReg(a3); PushMacReg(a4); ; skip a5 (globals), a6 (frame pointer), and a7 (stack pointer) PushMacReg(d2); PushMacReg(d3); PushMacReg(d4); PushMacReg(d5); PushMacReg(d6); PushMacReg(d7); add.w #4,sp ; fix stack. } # define HAVE_PUSH_REGS # undef PushMacReg # endif /* THINK_C */ # if defined(__MWERKS__) PushMacRegisters(); # define HAVE_PUSH_REGS # endif /* __MWERKS__ */ # endif /* MACOS */ } #endif /* !USE_ASM_PUSH_REGS */ #if defined(HAVE_PUSH_REGS) && defined(THREADS) # error GC_push_regs cannot be used with threads /* Would fail for GC_do_blocking. There are probably other safety */ /* issues. */ # undef HAVE_PUSH_REGS #endif #if !defined(HAVE_PUSH_REGS) && defined(UNIX_LIKE) # include #endif /* Ensure that either registers are pushed, or callee-save registers */ /* are somewhere on the stack, and then call fn(arg, ctxt). */ /* ctxt is either a pointer to a ucontext_t we generated, or NULL. */ void GC_with_callee_saves_pushed(void (*fn)(ptr_t, void *), ptr_t arg) { word dummy; void * context = 0; # if defined(HAVE_PUSH_REGS) GC_push_regs(); # elif defined(UNIX_LIKE) && !defined(DARWIN) && !defined(ARM32) /* Older versions of Darwin seem to lack getcontext(). */ /* ARM Linux often doesn't support a real getcontext(). */ ucontext_t ctxt; if (getcontext(&ctxt) < 0) ABORT ("Getcontext failed: Use another register retrieval method?"); context = &ctxt; # if defined(SPARC) || defined(IA64) /* On a register window machine, we need to save register */ /* contents on the stack for this to work. This may already be */ /* subsumed by the getcontext() call. */ { GC_save_regs_ret_val = GC_save_regs_in_stack(); } # endif /* register windows. */ # elif defined(HAVE_BUILTIN_UNWIND_INIT) /* This was suggested by Richard Henderson as the way to */ /* force callee-save registers and register windows onto */ /* the stack. */ __builtin_unwind_init(); # else /* !HAVE_BUILTIN_UNWIND_INIT && !UNIX_LIKE */ /* && !HAVE_PUSH_REGS */ /* Generic code */ /* The idea is due to Parag Patel at HP. */ /* We're not sure whether he would like */ /* to be he acknowledged for it or not. */ jmp_buf regs; register word * i = (word *) regs; register ptr_t lim = (ptr_t)(regs) + (sizeof regs); /* Setjmp doesn't always clear all of the buffer. */ /* That tends to preserve garbage. Clear it. */ for (; (char *)i < lim; i++) { *i = 0; } # if defined(MSWIN32) || defined(MSWINCE) \ || defined(UTS4) || defined(LINUX) || defined(EWS4800) (void) setjmp(regs); # else (void) _setjmp(regs); /* We don't want to mess with signals. According to */ /* SUSV3, setjmp() may or may not save signal mask. */ /* _setjmp won't, but is less portable. */ # endif # endif /* !HAVE_PUSH_REGS ... */ fn(arg, context); /* Strongly discourage the compiler from treating the above */ /* as a tail-call, since that would pop the register */ /* contents before we get a chance to look at them. */ GC_noop1((word)(&dummy)); } void GC_push_regs_and_stack(ptr_t cold_gc_frame) { GC_with_callee_saves_pushed(GC_push_current_stack, cold_gc_frame); } #if defined(ASM_CLEAR_CODE) # ifdef LINT /*ARGSUSED*/ ptr_t GC_clear_stack_inner(arg, limit) ptr_t arg; word limit; { return(arg); } /* The real version is in a .S file */ # endif #endif /* ASM_CLEAR_CODE */ synopsis-0.12/src/Synopsis/gc/install-sh0000775000076400007640000001267111104702317017675 0ustar stefanstefan#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else : fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=$mkdirprog fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then : else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else : fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else : fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else : fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else : fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 synopsis-0.12/src/Synopsis/gc/misc.c0000664000076400007640000010021011104702317016753 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1999-2001 by Hewlett-Packard Company. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* Boehm, July 31, 1995 5:02 pm PDT */ #include #include #include #ifndef _WIN32_WCE #include #endif #define I_HIDE_POINTERS /* To make GC_call_with_alloc_lock visible */ #include "private/gc_pmark.h" #ifdef GC_SOLARIS_THREADS # include #endif #if defined(MSWIN32) || defined(MSWINCE) # define WIN32_LEAN_AND_MEAN # define NOSERVICE # include # include #endif #ifdef UNIX_LIKE # include # include # include int GC_log; /* Forward decl, so we can set it. */ #endif #ifdef NONSTOP # include #endif #if defined(THREADS) && defined(PCR) # include "il/PCR_IL.h" PCR_Th_ML GC_allocate_ml; #endif /* For other platforms with threads, the lock and possibly */ /* GC_lock_holder variables are defined in the thread support code. */ #if defined(NOSYS) || defined(ECOS) #undef STACKBASE #endif /* Dont unnecessarily call GC_register_main_static_data() in case */ /* dyn_load.c isn't linked in. */ #ifdef DYNAMIC_LOADING # define GC_REGISTER_MAIN_STATIC_DATA() GC_register_main_static_data() #else # define GC_REGISTER_MAIN_STATIC_DATA() TRUE #endif GC_FAR struct _GC_arrays GC_arrays /* = { 0 } */; GC_bool GC_debugging_started = FALSE; /* defined here so we don't have to load debug_malloc.o */ void (*GC_check_heap) (void) = (void (*) (void))0; void (*GC_print_all_smashed) (void) = (void (*) (void))0; void (*GC_start_call_back) (void) = (void (*) (void))0; ptr_t GC_stackbottom = 0; #ifdef IA64 ptr_t GC_register_stackbottom = 0; #endif GC_bool GC_dont_gc = 0; GC_bool GC_dont_precollect = 0; GC_bool GC_quiet = 0; #ifndef SMALL_CONFIG GC_bool GC_print_stats = 0; #endif GC_bool GC_print_back_height = 0; #ifndef NO_DEBUGGING GC_bool GC_dump_regularly = 0; /* Generate regular debugging dumps. */ #endif #ifdef KEEP_BACK_PTRS long GC_backtraces = 0; /* Number of random backtraces to */ /* generate for each GC. */ #endif #ifdef FIND_LEAK int GC_find_leak = 1; #else int GC_find_leak = 0; #endif #ifdef ALL_INTERIOR_POINTERS int GC_all_interior_pointers = 1; #else int GC_all_interior_pointers = 0; #endif long GC_large_alloc_warn_interval = 5; /* Interval between unsuppressed warnings. */ long GC_large_alloc_warn_suppressed = 0; /* Number of warnings suppressed so far. */ /*ARGSUSED*/ void * GC_default_oom_fn(size_t bytes_requested) { return(0); } void * (*GC_oom_fn) (size_t bytes_requested) = GC_default_oom_fn; void * GC_project2(void *arg1, void *arg2) { return arg2; } /* Set things up so that GC_size_map[i] >= granules(i), */ /* but not too much bigger */ /* and so that size_map contains relatively few distinct entries */ /* This was originally stolen from Russ Atkinson's Cedar */ /* quantization alogrithm (but we precompute it). */ void GC_init_size_map(void) { int i; /* Map size 0 to something bigger. */ /* This avoids problems at lower levels. */ GC_size_map[0] = 1; for (i = 1; i <= GRANULES_TO_BYTES(TINY_FREELISTS-1) - EXTRA_BYTES; i++) { GC_size_map[i] = ROUNDED_UP_GRANULES(i); GC_ASSERT(GC_size_map[i] < TINY_FREELISTS); } /* We leave the rest of the array to be filled in on demand. */ } /* Fill in additional entries in GC_size_map, including the ith one */ /* We assume the ith entry is currently 0. */ /* Note that a filled in section of the array ending at n always */ /* has length at least n/4. */ void GC_extend_size_map(size_t i) { size_t orig_granule_sz = ROUNDED_UP_GRANULES(i); size_t granule_sz = orig_granule_sz; size_t byte_sz = GRANULES_TO_BYTES(granule_sz); /* The size we try to preserve. */ /* Close to i, unless this would */ /* introduce too many distinct sizes. */ size_t smaller_than_i = byte_sz - (byte_sz >> 3); size_t much_smaller_than_i = byte_sz - (byte_sz >> 2); size_t low_limit; /* The lowest indexed entry we */ /* initialize. */ size_t j; if (GC_size_map[smaller_than_i] == 0) { low_limit = much_smaller_than_i; while (GC_size_map[low_limit] != 0) low_limit++; } else { low_limit = smaller_than_i + 1; while (GC_size_map[low_limit] != 0) low_limit++; granule_sz = ROUNDED_UP_GRANULES(low_limit); granule_sz += granule_sz >> 3; if (granule_sz < orig_granule_sz) granule_sz = orig_granule_sz; } /* For these larger sizes, we use an even number of granules. */ /* This makes it easier to, for example, construct a 16byte-aligned */ /* allocator even if GRANULE_BYTES is 8. */ granule_sz += 1; granule_sz &= ~1; if (granule_sz > MAXOBJGRANULES) { granule_sz = MAXOBJGRANULES; } /* If we can fit the same number of larger objects in a block, */ /* do so. */ { size_t number_of_objs = HBLK_GRANULES/granule_sz; granule_sz = HBLK_GRANULES/number_of_objs; granule_sz &= ~1; } byte_sz = GRANULES_TO_BYTES(granule_sz); /* We may need one extra byte; */ /* don't always fill in GC_size_map[byte_sz] */ byte_sz -= EXTRA_BYTES; for (j = low_limit; j <= byte_sz; j++) GC_size_map[j] = granule_sz; } /* * The following is a gross hack to deal with a problem that can occur * on machines that are sloppy about stack frame sizes, notably SPARC. * Bogus pointers may be written to the stack and not cleared for * a LONG time, because they always fall into holes in stack frames * that are not written. We partially address this by clearing * sections of the stack whenever we get control. */ word GC_stack_last_cleared = 0; /* GC_no when we last did this */ # ifdef THREADS # define BIG_CLEAR_SIZE 2048 /* Clear this much now and then. */ # define SMALL_CLEAR_SIZE 256 /* Clear this much every time. */ # endif # define CLEAR_SIZE 213 /* Granularity for GC_clear_stack_inner */ # define DEGRADE_RATE 50 ptr_t GC_min_sp; /* Coolest stack pointer value from which we've */ /* already cleared the stack. */ ptr_t GC_high_water; /* "hottest" stack pointer value we have seen */ /* recently. Degrades over time. */ word GC_bytes_allocd_at_reset; #if defined(ASM_CLEAR_CODE) extern void *GC_clear_stack_inner(void *, ptr_t); #else /* Clear the stack up to about limit. Return arg. */ /*ARGSUSED*/ void * GC_clear_stack_inner(void *arg, ptr_t limit) { word dummy[CLEAR_SIZE]; BZERO(dummy, CLEAR_SIZE*sizeof(word)); if ((ptr_t)(dummy) COOLER_THAN limit) { (void) GC_clear_stack_inner(arg, limit); } /* Make sure the recursive call is not a tail call, and the bzero */ /* call is not recognized as dead code. */ GC_noop1((word)dummy); return(arg); } #endif /* Clear some of the inaccessible part of the stack. Returns its */ /* argument, so it can be used in a tail call position, hence clearing */ /* another frame. */ void * GC_clear_stack(void *arg) { ptr_t sp = GC_approx_sp(); /* Hotter than actual sp */ # ifdef THREADS word dummy[SMALL_CLEAR_SIZE]; static unsigned random_no = 0; /* Should be more random than it is ... */ /* Used to occasionally clear a bigger */ /* chunk. */ # endif ptr_t limit; # define SLOP 400 /* Extra bytes we clear every time. This clears our own */ /* activation record, and should cause more frequent */ /* clearing near the cold end of the stack, a good thing. */ # define GC_SLOP 4000 /* We make GC_high_water this much hotter than we really saw */ /* saw it, to cover for GC noise etc. above our current frame. */ # define CLEAR_THRESHOLD 100000 /* We restart the clearing process after this many bytes of */ /* allocation. Otherwise very heavily recursive programs */ /* with sparse stacks may result in heaps that grow almost */ /* without bounds. As the heap gets larger, collection */ /* frequency decreases, thus clearing frequency would decrease, */ /* thus more junk remains accessible, thus the heap gets */ /* larger ... */ # ifdef THREADS if (++random_no % 13 == 0) { limit = sp; MAKE_HOTTER(limit, BIG_CLEAR_SIZE*sizeof(word)); limit = (ptr_t)((word)limit & ~0xf); /* Make it sufficiently aligned for assembly */ /* implementations of GC_clear_stack_inner. */ return GC_clear_stack_inner(arg, limit); } else { BZERO(dummy, SMALL_CLEAR_SIZE*sizeof(word)); return arg; } # else if (GC_gc_no > GC_stack_last_cleared) { /* Start things over, so we clear the entire stack again */ if (GC_stack_last_cleared == 0) GC_high_water = (ptr_t)GC_stackbottom; GC_min_sp = GC_high_water; GC_stack_last_cleared = GC_gc_no; GC_bytes_allocd_at_reset = GC_bytes_allocd; } /* Adjust GC_high_water */ MAKE_COOLER(GC_high_water, WORDS_TO_BYTES(DEGRADE_RATE) + GC_SLOP); if (sp HOTTER_THAN GC_high_water) { GC_high_water = sp; } MAKE_HOTTER(GC_high_water, GC_SLOP); limit = GC_min_sp; MAKE_HOTTER(limit, SLOP); if (sp COOLER_THAN limit) { limit = (ptr_t)((word)limit & ~0xf); /* Make it sufficiently aligned for assembly */ /* implementations of GC_clear_stack_inner. */ GC_min_sp = sp; return(GC_clear_stack_inner(arg, limit)); } else if (GC_bytes_allocd - GC_bytes_allocd_at_reset > CLEAR_THRESHOLD) { /* Restart clearing process, but limit how much clearing we do. */ GC_min_sp = sp; MAKE_HOTTER(GC_min_sp, CLEAR_THRESHOLD/4); if (GC_min_sp HOTTER_THAN GC_high_water) GC_min_sp = GC_high_water; GC_bytes_allocd_at_reset = GC_bytes_allocd; } return(arg); # endif } /* Return a pointer to the base address of p, given a pointer to a */ /* an address within an object. Return 0 o.w. */ void * GC_base(void * p) { ptr_t r; struct hblk *h; bottom_index *bi; hdr *candidate_hdr; ptr_t limit; r = p; if (!GC_is_initialized) return 0; h = HBLKPTR(r); GET_BI(r, bi); candidate_hdr = HDR_FROM_BI(bi, r); if (candidate_hdr == 0) return(0); /* If it's a pointer to the middle of a large object, move it */ /* to the beginning. */ while (IS_FORWARDING_ADDR_OR_NIL(candidate_hdr)) { h = FORWARDED_ADDR(h,candidate_hdr); r = (ptr_t)h; candidate_hdr = HDR(h); } if (HBLK_IS_FREE(candidate_hdr)) return(0); /* Make sure r points to the beginning of the object */ r = (ptr_t)((word)r & ~(WORDS_TO_BYTES(1) - 1)); { size_t offset = HBLKDISPL(r); signed_word sz = candidate_hdr -> hb_sz; size_t obj_displ = offset % sz; r -= obj_displ; limit = r + sz; if (limit > (ptr_t)(h + 1) && sz <= HBLKSIZE) { return(0); } if ((ptr_t)p >= limit) return(0); } return((void *)r); } /* Return the size of an object, given a pointer to its base. */ /* (For small obects this also happens to work from interior pointers, */ /* but that shouldn't be relied upon.) */ size_t GC_size(void * p) { hdr * hhdr = HDR(p); return hhdr -> hb_sz; } size_t GC_get_heap_size(void) { return GC_heapsize; } size_t GC_get_free_bytes(void) { return GC_large_free_bytes; } size_t GC_get_bytes_since_gc(void) { return GC_bytes_allocd; } size_t GC_get_total_bytes(void) { return GC_bytes_allocd+GC_bytes_allocd_before_gc; } GC_bool GC_is_initialized = FALSE; # if defined(PARALLEL_MARK) || defined(THREAD_LOCAL_ALLOC) extern void GC_init_parallel(void); # endif /* PARALLEL_MARK || THREAD_LOCAL_ALLOC */ void GC_init(void) { DCL_LOCK_STATE; #if defined(GC_WIN32_THREADS) && !defined(GC_PTHREADS) if (!GC_is_initialized) { BOOL (WINAPI *pfn) (LPCRITICAL_SECTION, DWORD) = NULL; HMODULE hK32 = GetModuleHandleA("kernel32.dll"); if (hK32) pfn = (BOOL (WINAPI *) (LPCRITICAL_SECTION, DWORD)) GetProcAddress (hK32, "InitializeCriticalSectionAndSpinCount"); if (pfn) pfn(&GC_allocate_ml, 4000); else InitializeCriticalSection (&GC_allocate_ml); } #endif /* MSWIN32 */ LOCK(); GC_init_inner(); UNLOCK(); # if defined(PARALLEL_MARK) || defined(THREAD_LOCAL_ALLOC) /* Make sure marker threads and started and thread local */ /* allocation is initialized, in case we didn't get */ /* called from GC_init_parallel(); */ { GC_init_parallel(); } # endif /* PARALLEL_MARK || THREAD_LOCAL_ALLOC */ # if defined(DYNAMIC_LOADING) && defined(DARWIN) { /* This must be called WITHOUT the allocation lock held and before any threads are created */ extern void GC_init_dyld(); GC_init_dyld(); } # endif } #if defined(MSWIN32) || defined(MSWINCE) CRITICAL_SECTION GC_write_cs; #endif #ifdef MSWIN32 extern void GC_init_win32(void); #endif extern void GC_setpagesize(); #ifdef MSWIN32 extern GC_bool GC_no_win32_dlls; #else # define GC_no_win32_dlls FALSE #endif void GC_exit_check(void) { GC_gcollect(); } #ifdef SEARCH_FOR_DATA_START extern void GC_init_linux_data_start(void); #endif #ifdef UNIX_LIKE extern void GC_set_and_save_fault_handler(void (*handler)(int)); static void looping_handler(sig) int sig; { GC_err_printf("Caught signal %d: looping in handler\n", sig); for(;;); } static GC_bool installed_looping_handler = FALSE; static void maybe_install_looping_handler() { /* Install looping handler before the write fault handler, so we */ /* handle write faults correctly. */ if (!installed_looping_handler && 0 != GETENV("GC_LOOP_ON_ABORT")) { GC_set_and_save_fault_handler(looping_handler); installed_looping_handler = TRUE; } } #else /* !UNIX_LIKE */ # define maybe_install_looping_handler() #endif void GC_init_inner() { # if !defined(THREADS) && defined(GC_ASSERTIONS) word dummy; # endif word initial_heap_sz = (word)MINHINCR; if (GC_is_initialized) return; # if defined(MSWIN32) || defined(MSWINCE) InitializeCriticalSection(&GC_write_cs); # endif # if (!defined(SMALL_CONFIG)) if (0 != GETENV("GC_PRINT_STATS")) { GC_print_stats = 1; } if (0 != GETENV("GC_PRINT_VERBOSE_STATS")) { GC_print_stats = VERBOSE; } # if defined(UNIX_LIKE) { char * file_name = GETENV("GC_LOG_FILE"); if (0 != file_name) { int log_d = open(file_name, O_CREAT|O_WRONLY|O_APPEND, 0666); if (log_d < 0) { GC_log_printf("Failed to open %s as log file\n", file_name); } else { GC_log = log_d; } } } # endif # endif # ifndef NO_DEBUGGING if (0 != GETENV("GC_DUMP_REGULARLY")) { GC_dump_regularly = 1; } # endif # ifdef KEEP_BACK_PTRS { char * backtraces_string = GETENV("GC_BACKTRACES"); if (0 != backtraces_string) { GC_backtraces = atol(backtraces_string); if (backtraces_string[0] == '\0') GC_backtraces = 1; } } # endif if (0 != GETENV("GC_FIND_LEAK")) { GC_find_leak = 1; atexit(GC_exit_check); } if (0 != GETENV("GC_ALL_INTERIOR_POINTERS")) { GC_all_interior_pointers = 1; } if (0 != GETENV("GC_DONT_GC")) { GC_dont_gc = 1; } if (0 != GETENV("GC_PRINT_BACK_HEIGHT")) { GC_print_back_height = 1; } if (0 != GETENV("GC_NO_BLACKLIST_WARNING")) { GC_large_alloc_warn_interval = LONG_MAX; } { char * addr_string = GETENV("GC_TRACE"); if (0 != addr_string) { # ifndef ENABLE_TRACE WARN("Tracing not enabled: Ignoring GC_TRACE value\n", 0); # else # ifdef STRTOULL long long addr = strtoull(addr_string, NULL, 16); # else long addr = strtoul(addr_string, NULL, 16); # endif if (addr < 0x1000) WARN("Unlikely trace address: 0x%lx\n", (GC_word)addr); GC_trace_addr = (ptr_t)addr; # endif } } { char * time_limit_string = GETENV("GC_PAUSE_TIME_TARGET"); if (0 != time_limit_string) { long time_limit = atol(time_limit_string); if (time_limit < 5) { WARN("GC_PAUSE_TIME_TARGET environment variable value too small " "or bad syntax: Ignoring\n", 0); } else { GC_time_limit = time_limit; } } } { char * interval_string = GETENV("GC_LARGE_ALLOC_WARN_INTERVAL"); if (0 != interval_string) { long interval = atol(interval_string); if (interval <= 0) { WARN("GC_LARGE_ALLOC_WARN_INTERVAL environment variable has " "bad value: Ignoring\n", 0); } else { GC_large_alloc_warn_interval = interval; } } } maybe_install_looping_handler(); /* Adjust normal object descriptor for extra allocation. */ if (ALIGNMENT > GC_DS_TAGS && EXTRA_BYTES != 0) { GC_obj_kinds[NORMAL].ok_descriptor = ((word)(-ALIGNMENT) | GC_DS_LENGTH); } GC_setpagesize(); GC_exclude_static_roots(beginGC_arrays, endGC_arrays); GC_exclude_static_roots(beginGC_obj_kinds, endGC_obj_kinds); # ifdef SEPARATE_GLOBALS GC_exclude_static_roots(beginGC_objfreelist, endGC_objfreelist); GC_exclude_static_roots(beginGC_aobjfreelist, endGC_aobjfreelist); # endif # ifdef MSWIN32 GC_init_win32(); # endif # if defined(USE_PROC_FOR_LIBRARIES) && defined(GC_LINUX_THREADS) WARN("USE_PROC_FOR_LIBRARIES + GC_LINUX_THREADS performs poorly.\n", 0); /* If thread stacks are cached, they tend to be scanned in */ /* entirety as part of the root set. This wil grow them to */ /* maximum size, and is generally not desirable. */ # endif # if defined(SEARCH_FOR_DATA_START) GC_init_linux_data_start(); # endif # if (defined(NETBSD) || defined(OPENBSD)) && defined(__ELF__) GC_init_netbsd_elf(); # endif # if !defined(THREADS) || defined(GC_PTHREADS) || defined(GC_WIN32_THREADS) \ || defined(GC_SOLARIS_THREADS) if (GC_stackbottom == 0) { GC_stackbottom = GC_get_main_stack_base(); # if (defined(LINUX) || defined(HPUX)) && defined(IA64) GC_register_stackbottom = GC_get_register_stack_base(); # endif } else { # if (defined(LINUX) || defined(HPUX)) && defined(IA64) if (GC_register_stackbottom == 0) { WARN("GC_register_stackbottom should be set with GC_stackbottom\n", 0); /* The following may fail, since we may rely on */ /* alignment properties that may not hold with a user set */ /* GC_stackbottom. */ GC_register_stackbottom = GC_get_register_stack_base(); } # endif } # endif /* Ignore gcc -Wall warnings on the following. */ GC_STATIC_ASSERT(sizeof (ptr_t) == sizeof(word)); GC_STATIC_ASSERT(sizeof (signed_word) == sizeof(word)); GC_STATIC_ASSERT(sizeof (struct hblk) == HBLKSIZE); # ifndef THREADS # ifdef STACK_GROWS_DOWN GC_ASSERT((word)(&dummy) <= (word)GC_stackbottom); # else GC_ASSERT((word)(&dummy) >= (word)GC_stackbottom); # endif # endif # if !defined(_AUX_SOURCE) || defined(__GNUC__) GC_ASSERT((word)(-1) > (word)0); /* word should be unsigned */ # endif GC_ASSERT((ptr_t)(word)(-1) > (ptr_t)0); /* Ptr_t comparisons should behave as unsigned comparisons. */ GC_ASSERT((signed_word)(-1) < (signed_word)0); # if !defined(SMALL_CONFIG) if (GC_incremental || 0 != GETENV("GC_ENABLE_INCREMENTAL")) { /* This used to test for !GC_no_win32_dlls. Why? */ GC_setpagesize(); /* For GWW_MPROTECT on Win32, this needs to happen before any */ /* heap memory is allocated. */ GC_dirty_init(); GC_ASSERT(GC_bytes_allocd == 0) GC_incremental = TRUE; } # endif /* !SMALL_CONFIG */ /* Add initial guess of root sets. Do this first, since sbrk(0) */ /* might be used. */ if (GC_REGISTER_MAIN_STATIC_DATA()) GC_register_data_segments(); GC_init_headers(); GC_bl_init(); GC_mark_init(); { char * sz_str = GETENV("GC_INITIAL_HEAP_SIZE"); if (sz_str != NULL) { initial_heap_sz = atoi(sz_str); if (initial_heap_sz <= MINHINCR * HBLKSIZE) { WARN("Bad initial heap size %s - ignoring it.\n", sz_str); } initial_heap_sz = divHBLKSZ(initial_heap_sz); } } { char * sz_str = GETENV("GC_MAXIMUM_HEAP_SIZE"); if (sz_str != NULL) { word max_heap_sz = (word)atol(sz_str); if (max_heap_sz < initial_heap_sz * HBLKSIZE) { WARN("Bad maximum heap size %s - ignoring it.\n", sz_str); } if (0 == GC_max_retries) GC_max_retries = 2; GC_set_max_heap_size(max_heap_sz); } } if (!GC_expand_hp_inner(initial_heap_sz)) { GC_err_printf("Can't start up: not enough memory\n"); EXIT(); } GC_initialize_offsets(); GC_register_displacement_inner(0L); # if defined(GC_LINUX_THREADS) && defined(REDIRECT_MALLOC) if (!GC_all_interior_pointers) { /* TLS ABI uses pointer-sized offsets for dtv. */ GC_register_displacement_inner(sizeof(void *)); } # endif GC_init_size_map(); # ifdef PCR if (PCR_IL_Lock(PCR_Bool_false, PCR_allSigsBlocked, PCR_waitForever) != PCR_ERes_okay) { ABORT("Can't lock load state\n"); } else if (PCR_IL_Unlock() != PCR_ERes_okay) { ABORT("Can't unlock load state\n"); } PCR_IL_Unlock(); GC_pcr_install(); # endif GC_is_initialized = TRUE; # if defined(GC_PTHREADS) || defined(GC_WIN32_THREADS) GC_thr_init(); # endif COND_DUMP; /* Get black list set up and/or incremental GC started */ if (!GC_dont_precollect || GC_incremental) GC_gcollect_inner(); # ifdef STUBBORN_ALLOC GC_stubborn_init(); # endif # if defined(GC_LINUX_THREADS) && defined(REDIRECT_MALLOC) { extern void GC_init_lib_bounds(void); GC_init_lib_bounds(); } # endif /* Convince lint that some things are used */ # ifdef LINT { extern char * GC_copyright[]; extern int GC_read(); extern void GC_register_finalizer_no_order(); GC_noop(GC_copyright, GC_find_header, GC_push_one, GC_call_with_alloc_lock, GC_read, GC_dont_expand, # ifndef NO_DEBUGGING GC_dump, # endif GC_register_finalizer_no_order); } # endif } void GC_enable_incremental(void) { # if !defined(SMALL_CONFIG) && !defined(KEEP_BACK_PTRS) /* If we are keeping back pointers, the GC itself dirties all */ /* pages on which objects have been marked, making */ /* incremental GC pointless. */ if (!GC_find_leak) { DCL_LOCK_STATE; LOCK(); if (GC_incremental) goto out; GC_setpagesize(); /* if (GC_no_win32_dlls) goto out; Should be win32S test? */ maybe_install_looping_handler(); /* Before write fault handler! */ GC_incremental = TRUE; if (!GC_is_initialized) { GC_init_inner(); } else { GC_dirty_init(); } if (!GC_dirty_maintained) goto out; if (GC_dont_gc) { /* Can't easily do it. */ UNLOCK(); return; } if (GC_bytes_allocd > 0) { /* There may be unmarked reachable objects */ GC_gcollect_inner(); } /* else we're OK in assuming everything's */ /* clean since nothing can point to an */ /* unmarked object. */ GC_read_dirty(); out: UNLOCK(); } else { GC_init(); } # else GC_init(); # endif } #if defined(MSWIN32) || defined(MSWINCE) # if defined(_MSC_VER) && defined(_DEBUG) # include # endif # ifdef OLD_WIN32_LOG_FILE # define LOG_FILE _T("gc.log") # endif HANDLE GC_stdout = 0; void GC_deinit() { if (GC_is_initialized) { DeleteCriticalSection(&GC_write_cs); } } # ifndef THREADS # define GC_need_to_lock 0 /* Not defined without threads */ # endif int GC_write(const char *buf, size_t len) { BOOL tmp; DWORD written; if (len == 0) return 0; if (GC_need_to_lock) EnterCriticalSection(&GC_write_cs); if (GC_stdout == INVALID_HANDLE_VALUE) { if (GC_need_to_lock) LeaveCriticalSection(&GC_write_cs); return -1; } else if (GC_stdout == 0) { char * file_name = GETENV("GC_LOG_FILE"); char logPath[_MAX_PATH + 5]; if (0 == file_name) { # ifdef OLD_WIN32_LOG_FILE strcpy(logPath, LOG_FILE); # else GetModuleFileName(NULL, logPath, _MAX_PATH); strcat(logPath, ".log"); # endif file_name = logPath; } GC_stdout = CreateFile(logPath, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_FLAG_WRITE_THROUGH, NULL); if (GC_stdout == INVALID_HANDLE_VALUE) ABORT("Open of log file failed"); } tmp = WriteFile(GC_stdout, buf, (DWORD)len, &written, NULL); if (!tmp) DebugBreak(); # if defined(_MSC_VER) && defined(_DEBUG) _CrtDbgReport(_CRT_WARN, NULL, 0, NULL, "%.*s", len, buf); # endif if (GC_need_to_lock) LeaveCriticalSection(&GC_write_cs); return tmp ? (int)written : -1; } # undef GC_need_to_lock #endif #if defined(OS2) || defined(MACOS) FILE * GC_stdout = NULL; FILE * GC_stderr = NULL; FILE * GC_log = NULL; int GC_tmp; /* Should really be local ... */ void GC_set_files() { if (GC_stdout == NULL) { GC_stdout = stdout; } if (GC_stderr == NULL) { GC_stderr = stderr; } if (GC_log == NULL) { GC_log = stderr; } } #endif #if !defined(OS2) && !defined(MACOS) && !defined(MSWIN32) && !defined(MSWINCE) int GC_stdout = 1; int GC_stderr = 2; int GC_log = 2; # if !defined(AMIGA) # include # endif #endif #if !defined(MSWIN32) && !defined(MSWINCE) && !defined(OS2) \ && !defined(MACOS) && !defined(ECOS) && !defined(NOSYS) int GC_write(fd, buf, len) int fd; const char *buf; size_t len; { register int bytes_written = 0; register int result; while (bytes_written < len) { # ifdef GC_SOLARIS_THREADS result = syscall(SYS_write, fd, buf + bytes_written, len - bytes_written); # else result = write(fd, buf + bytes_written, len - bytes_written); # endif if (-1 == result) return(result); bytes_written += result; } return(bytes_written); } #endif /* UN*X */ #ifdef ECOS int GC_write(fd, buf, len) { _Jv_diag_write (buf, len); return len; } #endif #ifdef NOSYS int GC_write(fd, buf, len) { /* No writing. */ return len; } #endif #if defined(MSWIN32) || defined(MSWINCE) /* FIXME: This is pretty ugly ... */ # define WRITE(f, buf, len) GC_write(buf, len) #else # if defined(OS2) || defined(MACOS) # define WRITE(f, buf, len) (GC_set_files(), \ GC_tmp = fwrite((buf), 1, (len), (f)), \ fflush(f), GC_tmp) # else # define WRITE(f, buf, len) GC_write((f), (buf), (len)) # endif #endif #define BUFSZ 1024 #ifdef _MSC_VER # define vsnprintf _vsnprintf #endif /* A version of printf that is unlikely to call malloc, and is thus safer */ /* to call from the collector in case malloc has been bound to GC_malloc. */ /* Floating point arguments ans formats should be avoided, since fp */ /* conversion is more likely to allocate. */ /* Assumes that no more than BUFSZ-1 characters are written at once. */ void GC_printf(const char *format, ...) { va_list args; char buf[BUFSZ+1]; va_start(args, format); if (GC_quiet) return; buf[BUFSZ] = 0x15; (void) vsnprintf(buf, BUFSZ, format, args); va_end(args); if (buf[BUFSZ] != 0x15) ABORT("GC_printf clobbered stack"); if (WRITE(GC_stdout, buf, strlen(buf)) < 0) ABORT("write to stdout failed"); } void GC_err_printf(const char *format, ...) { va_list args; char buf[BUFSZ+1]; va_start(args, format); buf[BUFSZ] = 0x15; (void) vsnprintf(buf, BUFSZ, format, args); va_end(args); if (buf[BUFSZ] != 0x15) ABORT("GC_printf clobbered stack"); if (WRITE(GC_stderr, buf, strlen(buf)) < 0) ABORT("write to stderr failed"); } void GC_log_printf(const char *format, ...) { va_list args; char buf[BUFSZ+1]; va_start(args, format); buf[BUFSZ] = 0x15; (void) vsnprintf(buf, BUFSZ, format, args); va_end(args); if (buf[BUFSZ] != 0x15) ABORT("GC_printf clobbered stack"); if (WRITE(GC_log, buf, strlen(buf)) < 0) ABORT("write to log failed"); } void GC_err_puts(const char *s) { if (WRITE(GC_stderr, s, strlen(s)) < 0) ABORT("write to stderr failed"); } #if defined(LINUX) && !defined(SMALL_CONFIG) void GC_err_write(buf, len) const char *buf; size_t len; { if (WRITE(GC_stderr, buf, len) < 0) ABORT("write to stderr failed"); } #endif void GC_default_warn_proc(char *msg, GC_word arg) { GC_err_printf(msg, arg); } GC_warn_proc GC_current_warn_proc = GC_default_warn_proc; GC_warn_proc GC_set_warn_proc(GC_warn_proc p) { GC_warn_proc result; # ifdef GC_WIN32_THREADS GC_ASSERT(GC_is_initialized); # endif LOCK(); result = GC_current_warn_proc; GC_current_warn_proc = p; UNLOCK(); return(result); } GC_word GC_set_free_space_divisor (GC_word value) { GC_word old = GC_free_space_divisor; GC_free_space_divisor = value; return old; } #ifndef PCR void GC_abort(const char *msg) { # if defined(MSWIN32) (void) MessageBoxA(NULL, msg, "Fatal error in gc", MB_ICONERROR|MB_OK); # else GC_err_printf("%s\n", msg); # endif if (GETENV("GC_LOOP_ON_ABORT") != NULL) { /* In many cases it's easier to debug a running process. */ /* It's arguably nicer to sleep, but that makes it harder */ /* to look at the thread if the debugger doesn't know much */ /* about threads. */ for(;;) {} } # if defined(MSWIN32) || defined(MSWINCE) DebugBreak(); # else (void) abort(); # endif } #endif void GC_enable() { LOCK(); GC_dont_gc--; UNLOCK(); } void GC_disable() { LOCK(); GC_dont_gc++; UNLOCK(); } /* Helper procedures for new kind creation. */ void ** GC_new_free_list_inner() { void *result = GC_INTERNAL_MALLOC((MAXOBJGRANULES+1)*sizeof(ptr_t), PTRFREE); if (result == 0) ABORT("Failed to allocate freelist for new kind"); BZERO(result, (MAXOBJGRANULES+1)*sizeof(ptr_t)); return result; } void ** GC_new_free_list() { void *result; LOCK(); result = GC_new_free_list_inner(); UNLOCK(); return result; } unsigned GC_new_kind_inner(void **fl, GC_word descr, int adjust, int clear) { unsigned result = GC_n_kinds++; if (GC_n_kinds > MAXOBJKINDS) ABORT("Too many kinds"); GC_obj_kinds[result].ok_freelist = fl; GC_obj_kinds[result].ok_reclaim_list = 0; GC_obj_kinds[result].ok_descriptor = descr; GC_obj_kinds[result].ok_relocate_descr = adjust; GC_obj_kinds[result].ok_init = clear; return result; } unsigned GC_new_kind(void **fl, GC_word descr, int adjust, int clear) { unsigned result; LOCK(); result = GC_new_kind_inner(fl, descr, adjust, clear); UNLOCK(); return result; } unsigned GC_new_proc_inner(GC_mark_proc proc) { unsigned result = GC_n_mark_procs++; if (GC_n_mark_procs > MAX_MARK_PROCS) ABORT("Too many mark procedures"); GC_mark_procs[result] = proc; return result; } unsigned GC_new_proc(GC_mark_proc proc) { unsigned result; LOCK(); result = GC_new_proc_inner(proc); UNLOCK(); return result; } void * GC_call_with_stack_base(GC_stack_base_func fn, void *arg) { int dummy; struct GC_stack_base base; base.mem_base = (void *)&dummy; # ifdef IA64 base.reg_base = (void *)GC_save_regs_in_stack(); /* Unnecessarily flushes register stack, */ /* but that probably doesn't hurt. */ # endif return fn(&base, arg); } #if !defined(NO_DEBUGGING) void GC_dump() { GC_printf("***Static roots:\n"); GC_print_static_roots(); GC_printf("\n***Heap sections:\n"); GC_print_heap_sects(); GC_printf("\n***Free blocks:\n"); GC_print_hblkfreelist(); GC_printf("\n***Blocks in use:\n"); GC_print_block_list(); GC_printf("\n***Finalization statistics:\n"); GC_print_finalization_stats(); } #endif /* NO_DEBUGGING */ synopsis-0.12/src/Synopsis/gc/ChangeLog0000664000076400007640000003246211104702320017435 0ustar stefanstefan2007-07-02 Hans Boehm * gc_config_macros.h: Also check for IA64 when setting GC_HPUX_THREADS. * mallocx.c: Change my_bytes_allocd to signed_word. * include/pthread_redirects.h: Remove obsolete Solaris threads (as opposed to pthreads) support. 2007-07-02 Hans Boehm * mach_dep.c (GC_with_callee_saves_pushed): Don't use getcontext() on ARM/Linux. Check getcontext() return value. 2007-06-29 Hans Boehm * backgraph.c (per_object_func): Make argument types consistent. (GC_traverse_back_graph): Mark GC_deepest_obj. 2007-06-29 Hans Boehm * finalize.c (GC_finalize): Change dl_size and fo_size to size_t. * os_dep.c (GC_win32_get_mem): Add GC_mem_top_down option. 2007-06-28 Hans Boehm * doc/README.win32, doc/README, README.QUICK: Fix some of the worst anachronisms. * dyn_load.c: Partially support cygwin, but don't enable it yet. 2007-06-28 Hans Boehm * Makefile.am: Use -no-undefined for libgc. * Makefile.in: Regenerate. * Makefile.direct: Document USE_PROC_FOR_LIBRARIES. * dyn_load.c (GC_register_map_entries): Rename prot_buf to prot consistently. * misc.c: Fix some WARN calls. Move GC_is_initialized setting and GC_thr_init() call. * os_dep.c: Consistently use WARN where appropriate. * thread_local_alloc.c: Revert change to GC_WIN32_THREADS test. Instead remove inappropriate pthread.h include. * doc/README.linux: Remove some anachronisms. 2007-06-23 Hans Boehm * alloc.c: Also use GC_check_tls on non-Linux systems. * mallocx.c (GC_reclaim_generic): Remove bogus declaration. * include/private/gc_priv.h (GC_reclaim_generic): Declare correctly with prototype. 2007-06-19 Hans Boehm * alloc.c (GC_adj_bytes_allocd): Avoid (long) casts, fix comment. (GC_print_heap_sects): Use size_t instead of unsigned long. * thread_local_alloc.c (GC_lookup_thread): Define in the correct context. * win32_threads.c, include/gc_config_macros.h: The last of Romano Paolo Tenca's patch. Move stdint.h include to gc_config_macros.h. * include/gc_inline.h: Avoid gc_priv.h dependencies. * tests/test.c (check_heap_stats): Replace unsigned long with size_t. 2007-06-12 Hans Boehm * aclocal.m4: Regenerate to update date. 2007-06-10 Hans Boehm * NT_X64_STATIC_THREADS_MAKEFILE: Replace obsolete -debugtype:cv. * mark_rts.c (GC_push_roots): Fix kind type. 2007-06-06 Hans Boehm * doc/README.win64: New file. * doc/doc.am, Makefile.direct: Add README.win64. * Makefile.in: Regenerate. 2007-06-06 Hans Boehm * Makefile.am, Makefile.direct: Add NT_X64_STATIC_THREADS_MAKEFILE. * Makefile.in: Regenerate. * NT_X64_STATIC_THREADS_MAKEFILE: Fix warning flags. * allochblk.c, alloc.c, blacklst.c, dbg_malc.c, dyn_load.c, finalize.c, headers.c, mach_dep.c, malloc.c, mark.c, misc.c, obj_map.c, os_dep.c, ptr_chck.c, reclaim.c, typd_mlc.c, win32_threads.c, cord/de_win.c, include/gc_mark.h, include/private/gc_hdrs.h, include/private/gc_pmark.h, include/private/gc_priv.h, tests/test_cpp.cc: Replace old style function declarations. Clean up integral types. Remove register declarations. The change in malloc.c and the "int descr" declaration in mark.c are the most likely to have been real bugs outside of win64. * msvc_dbg.c: Disable on win64. * win32_threads.c: Add AMD64 support. * include/gc.h: no backtrace on AMD64 for now. 2007-06-06 Hans Boehm * msvc_dbg.c(GetModuleBase): Replace strcat with strcat_s. 2007-06-06 Hans Boehm * include/gc.h: (GC_word, GC_signed_word): Fix win64 definitions. Don't include windows.h in an extern "C" context. * include/private/gcconfig.h: Fix win64/X86_64 configuration. * tests/test.c: Eliminate more old style function definitions. Cleanup pointer and integer casts for win64. * tests/test_cpp.cc: Don't include gc_priv.h. * NT_STATIC_THREADS_MAKEFILE: Restrict suffixes for VC++ 2005. * NT_X64_STATIC_THREADS_MAKEFILE: New. 2007-06-06 Hans Boehm (Really mostly Romano Paolo Tenca) * win32_threads.c: Separate out DEBUG_WIN32_PTHREADS_STACK. Ignore FINISHED threads for suspension. (GC_pthread_join): Add pthread_self() cast. (GC_pthread_start_inner): Execute cleanup handler when popping it. * include/private/gc_locks.h: Inline THREAD_EQUAL for GC_WIN32_PTHREADS. Define USE_PTHREAD_LOCKS only if we have pthreads. 2007-05-23 Hans Boehm (Really mostly Romano Paolo Tenca) * gc_dlopen.c, thread_local_alloc.c, threadlibs.c, win32_threads.c, tests/test.c: Accomodate GC_WIN32_PTHREADS. * include/gc.h: Don't include windows.h for GC_WIN32_PTHREADS. * include/gc_config_macros.h: Define both PTHREADS and GC_WIN32_THREADS. * include/private/gc_locks.h: Nonstandard definitions of NUMERIC_THREAD_ID for GC_WIN32_PTHREADS. * doc/README.win32, Makefile.direct: Include documentation for GC_WIN32_PTHREADS. * Makefile.direct: Remove some anachronisms in the documentation. 2007-05-23 Hans Boehm * Makefile.am: Move includes to bottom. Add better library dependencies. Increment library version. Remove "SUBDIRS += .". * cord/cord.am, tests/tests.am: Add better library dependencies. Remove now unnecessary dependencies. * Makefile.in: Regenerate. * include/gc.h (GC_begin_thread_ex, GC_endthreadex, GC_ExitThread): Move to define on all Windows platforms. (_beginthread): define to generate error if used. 2007-05-22 Hans Boehm * include/private/gc_locks.h: Format to 80 columns. 2007-05-22 Hans Boehm * malloc.c(GC_free): Ignore bad frees on MSWIN32 with REDIRECT_MALLOC. * NT_MAKEFILE: msvc_dbg.h is in include/private. Don't use cvars rc. * misc.c (WIN32 GC_write): Define GC_need_to_lock in single-threaded case. * win32_threads.c: Test for __MINGW32__ in addition to _MINGW_VER. (GC_CreateThread, GC_beginthreadex): Deallocate args even if we fail. * include/gc.h: Add GC_reachable_here(). (GC_WinMain): Add GC_API. (GC_beginthreadex, GC_endthreadex, GC_ExitThread): Declare. * tests/test.c: Add GC_reachable_here() call. 2007-05-21 Hans Boehm * alloc.c (GC_try_to_collect): Call GC_init if necessary. * tests/thread_leak_test.c: Don't unconditionally define GC_LINUX_THREADS. 2007-05-21 Andreas Tobler * Makefile.am: Remove extra_ldflags_libgc definition. * Makefile.in: Regenerate. 2007-05-17 Hans Boehm * include/private/gc_priv.h: Define AO_REQUIRE_CAS. 2007-05-16 Hans Boehm * finalize.c (GC_unreachable_finalize_mark_proc): Don't return void value. 2007-05-15 Hans Boehm * configure.ac, version.h, doc/README: Change version to 7.0alpha10. * configure: Regenerate. [7.0alpha9 release] 2007-05-15 Hans Boehm * configure.ac, version.h, doc/README: Change version to 7.0alpha9. * configure: Regenerate. 2007-05-15 Hans Boehm * Makefile.am: Include NT_STSTIC_THREADS_MAKEFILE in dist. * Makefile.in: Regenerate. * include/private/gc_locks.h: GC_compare_and_exchange, GC_atomic_add: remove. NUMERIC_THREAD_ID, THREAD_EQUAL: New. GC_lock_holder: now unsigned long. I_DONT_HOLD_LOCK, I_HOLD_LOCK: Update. * pthread_stop_world.c, pthread_support.c, win32_threads.c: Use NUMERIC_THREAD_ID, THREAD_EQUAL. * include/private/gcconfig.h: GENERIC_COMPARE_AND_SWAP: Remove. * include/private/thread_local_alloc.h: Don't USE_COMPILER_TLS on ARM. 2007-05-11 Hans Boehm * dbg_mlc.c, include/gc.h, finalize.c: Merge Alexandre Oliva's GC_debug_register_finalizer_unreachable() patch from gcc tree. * thread_local_alloc.c (GC_malloc, GC_malloc_atomic): Add assertions to check GC has been initialized. 2007-05-10 Hans Boehm * include/gc_cpp.h: Documentation updates. * include/gc_config_macros.h: Don't check for __ppc__ to set DARWIN_THREADS. * Makefile.am: Include configure_atomic_ops.sh in dist. * Makefile.in: Regenerate. 2007-05-08 Hans Boehm * Makefile.am: Dont distribute copied atomic_ops files. Include libatomic_ops with "make dist". * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac: Enable THREAD_LOCAL_ALLOC for Cygwin with threads. * win32_threads.c: Report error for Cygwin + GC_DLL. 2007-05-08 Hans Boehm * Makefile.direct: Update THREAD_LOCAL_ALLOC documentation. * cord/de_win.c: Rename and move AboutBox. Call GC_INIT. Remove MakeProcInstance anachronism. * doc/README.macros: Officially remove elif prohibition. Remove documentation for defunct SRC_M3 support. * include/gc.h: Remove more SRC_M3 references. * include/private/gcconfig.h: Remove still more SRC_M3 references. GC_SOLARIS_THREADS no longer needs to be checked separately. 2007-05-08 Hans Boehm * thread_local_alloc.c, include/private/thread_local_alloc.h: Spell __declspec correctly. * NT_STATIC_THREADS_MAKEFILE: Enable thread-local allocation. 2007-05-07 Hans Boehm * doc/README.win32: Adjust GC_win32_dll_threads rules again. 2007-05-07 Hans Boehm * mark.c (GC_mark_some wrapper): Restructure for readability, handle GC_started_thread_while_stopped. * misc.c (Win32 GC_write): Lock GC_write_cs only if needed. * win32_threads.c: (client_has_run): remove, GC_started_thread_while_stopped, GC_attached_thread: add. (GC_push_all_stacks): Add verbose output. (DllMain): Avoid initializing collector or the like. Never update both thread tables. * doc/README.win32: Adjust GC_win32_dll_threads rules. 2007-05-07 Hans Boehm * pthread_stop_world.c (GC_push_all_stacks): Print thread count with GC_PRINT_VERBOSE_STATS. 2007-05-01 Hans Boehm (and Manuel Serrano, Craig McDaniel) * configure.ac: Comment out redundant AC_DEFINE(NO_EXECUTE_PERMISSION). * configure: Regenerate. * sparc_mach_dep.S: Remove single quote in comment. * include/private/gcconfig.h: Fix DATAEND for NONSTOP. * win32_threads.c: Include stdint.h for Mingw. Add GC_API for DllMain. (GC_use_DllMain): Fix assertion. 2007-02-14 Andreas Tobler * configure.ac: Introduce extra_ldflags_libgc. Use it for Darwin. * configure: Regenerate. * Makefile.am (libgc_la_LDFLAGS): Use extra_ldflags_libgc. * Makefile.in: Regenerate. * include/private/gcconfig.h: Enable MPROTECT_VDB for all Darwin targets. Remove comments. Prepare ppc64 support for Darwin. 2007-01-29 Andreas Tobler * darwin_stop_world.c: Clean up and reformat code. 2007-01-28 Andreas Tobler * darwin_stop_world.c (GC_push_all_stacks): Fix compiler warnings. Make i unsigned. (GC_stop_world): Likewise. Remove unused GC_thread p. (GC_start_world): Likewise. * os_dep.c: Define GC_darwin_register_mach_handler_thread extern. Remove double SIG_HNDLR_PTR definition. (GC_forward_exception): Fix compiler warnings, make i unsigned. Initialize thread_state to NULL. (catch_exception_raise): Fix compiler warnings, make i unsigned. 2007-01-25 Petr Salinger and Hans Boehm * include/private/gc_priv.h (NEED_FIND_LIMIT, FREEBSD variant): also define for X86_64. * configure.ac: Move generic gnu (Hurd) case to below kfreebsd case. * configure: Regenerate. * README.changes: Point to ChangeLog. 2007-01-25 Andreas Tobler * darwin_stop_world.c: Move THREAD_FLD defines to ... * include/private/gc_priv.h: ... here. Fix THREAD_STATE definitions for ppc64. * os_dep.c (catch_exception_raise): Use THREAD_FLD for exc_state member access. 2007-01-18 Andreas Tobler * os_dep.c (if defined(MPROTECT_VDB) && defined(DARWIN)): Clean up and reformat code. Correct email reference. 2007-01-11 Andreas Tobler * configure.ac (i?86*-*-darwin*): Replaced HAS_I386_THREAD_STATE_* with HAS_X86_THREAD_STATE32_*. (x86_64-*-darwin*): Extended the above check for x86_64-*-darwin* with HAS_X86_THREAD_STATE64_*. Added value 1 in the above AC_DEFINE's. Important for the upcoming Leopard. * configure: Regenerated. * include/private/gcconfig.h: Modified X86_64 define for Darwin. Removed __x86_64__ check in POWERPC section. Added base definitions for the X86_64 Darwin port. * include/private/gc_priv.h: Added GC_MACH_HEADER and GC_MACH_SECTION to distinguish between 32 and 64-bit applications. Added definitions for X86_64 Darwin. * darwin_stop_world.c: Added HAS_X86_THREAD_STATE64___RAX. And replaced HAS_I386_THREAD_STATE___EAX with HAS_X86_THREAD_STATE32___EAX. (GC_push_all_stacks): Added code for X86_64 Darwin. Even for the !DARWIN_DONT_PARSE_STACK. Maybe obsolete. * dyn_load.c (GC_dyld_name_for_hdr): Use GC_MACH_HEADER. (GC_dyld_image_add): Use GC_MACH_HEADER and GC_MACH_SECTION. Distinguish between getsectbynamefromheader_64 and getsectbynamefromheader. * os_dep.c (catch_exception_raise): Introduce exception definition for X86_64 Darwin. Replaced old i386_EXCEPTION_STATE_* definition with x86_EXCEPTION_STATE32_*. Add X86_64 for exc_state.faultvaddr. 2007-01-09 Andreas Tobler * libtool.m4: Update to version from libtool-1.5.22. * ltmain.sh: Likewise. * ChangeLog: Created. See doc/README.changes for earlier changes. synopsis-0.12/src/Synopsis/gc/OS2_MAKEFILE0000664000076400007640000000374011104702316017450 0ustar stefanstefan# Makefile for OS/2. Assumes IBM's compiler, static linking, and a single thread. # Adding dynamic linking support seems easy, but takes a little bit of work. # Adding thread support may be nontrivial, since we haven't yet figured out how to # look at another thread's registers. # Significantly revised for GC version 4.4 by Mark Boulter (Jan 1994). OBJS= alloc.obj reclaim.obj allchblk.obj misc.obj mach_dep.obj os_dep.obj mark_rts.obj headers.obj mark.obj obj_map.obj blacklst.obj finalize.obj new_hblk.obj dbg_mlc.obj malloc.obj stubborn.obj typd_mlc.obj ptr_chck.obj mallocx.obj CORDOBJS= cord\cordbscs.obj cord\cordxtra.obj cord\cordprnt.obj CC= icc CFLAGS= /O /Q /DSMALL_CONFIG /DALL_INTERIOR_POINTERS # Use /Ti instead of /O for debugging # Setjmp_test may yield overly optimistic results when compiled # without optimization. all: $(OBJS) gctest.exe cord\cordtest.exe $(OBJS) test.obj: include\private\gc_priv.h include\private\gc_hdrs.h include\gc.h include\private\gcconfig.h ## ERASE THE LIB FIRST - if it is already there then this command will fail ## (make sure its there or erase will fail!) gc.lib: $(OBJS) echo . > gc.lib erase gc.lib LIB gc.lib $(OBJS), gc.lst mach_dep.obj: mach_dep.c $(CC) $(CFLAGS) /C mach_dep.c gctest.exe: test.obj gc.lib $(CC) $(CFLAGS) /B"/STACK:524288" /Fegctest test.obj gc.lib cord\cordbscs.obj: cord\cordbscs.c include\cord.h include\private\cord_pos.h $(CC) $(CFLAGS) /C /Focord\cordbscs cord\cordbscs.c cord\cordxtra.obj: cord\cordxtra.c include\cord.h include\private\cord_pos.h include\ec.h $(CC) $(CFLAGS) /C /Focord\cordxtra cord\cordxtra.c cord\cordprnt.obj: cord\cordprnt.c include\cord.h include\private\cord_pos.h include\ec.h $(CC) $(CFLAGS) /C /Focord\cordprnt cord\cordprnt.c cord\cordtest.exe: cord\cordtest.c include\cord.h include\private\cord_pos.h include\ec.h $(CORDOBJS) gc.lib $(CC) $(CFLAGS) /B"/STACK:65536" /Fecord\cordtest cord\cordtest.c gc.lib $(CORDOBJS) synopsis-0.12/src/Synopsis/gc/pthread_stop_world.c0000664000076400007640000004003011104702315021724 0ustar stefanstefan#include "private/pthread_support.h" #if defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS) && \ !defined(GC_DARWIN_THREADS) #include #include #include #include #include "atomic_ops.h" #if DEBUG_THREADS #ifndef NSIG # if defined(MAXSIG) # define NSIG (MAXSIG+1) # elif defined(_NSIG) # define NSIG _NSIG # elif defined(__SIGRTMAX) # define NSIG (__SIGRTMAX+1) # else --> please fix it # endif #endif void GC_print_sig_mask() { sigset_t blocked; int i; if (pthread_sigmask(SIG_BLOCK, NULL, &blocked) != 0) ABORT("pthread_sigmask"); GC_printf("Blocked: "); for (i = 1; i < NSIG; i++) { if (sigismember(&blocked, i)) { GC_printf("%d ", i); } } GC_printf("\n"); } #endif /* Remove the signals that we want to allow in thread stopping */ /* handler from a set. */ void GC_remove_allowed_signals(sigset_t *set) { if (sigdelset(set, SIGINT) != 0 || sigdelset(set, SIGQUIT) != 0 || sigdelset(set, SIGABRT) != 0 || sigdelset(set, SIGTERM) != 0) { ABORT("sigdelset() failed"); } # ifdef MPROTECT_VDB /* Handlers write to the thread structure, which is in the heap, */ /* and hence can trigger a protection fault. */ if (sigdelset(set, SIGSEGV) != 0 # ifdef SIGBUS || sigdelset(set, SIGBUS) != 0 # endif ) { ABORT("sigdelset() failed"); } # endif } static sigset_t suspend_handler_mask; volatile AO_t GC_stop_count; /* Incremented at the beginning of GC_stop_world. */ volatile AO_t GC_world_is_stopped = FALSE; /* FALSE ==> it is safe for threads to restart, i.e. */ /* they will see another suspend signal before they */ /* are expected to stop (unless they have voluntarily */ /* stopped). */ #ifdef GC_OSF1_THREADS GC_bool GC_retry_signals = TRUE; #else GC_bool GC_retry_signals = FALSE; #endif /* * We use signals to stop threads during GC. * * Suspended threads wait in signal handler for SIG_THR_RESTART. * That's more portable than semaphores or condition variables. * (We do use sem_post from a signal handler, but that should be portable.) * * The thread suspension signal SIG_SUSPEND is now defined in gc_priv.h. * Note that we can't just stop a thread; we need it to save its stack * pointer(s) and acknowledge. */ #ifndef SIG_THR_RESTART # if defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) || defined(GC_NETBSD_THREADS) # ifdef _SIGRTMIN # define SIG_THR_RESTART _SIGRTMIN + 5 # else # define SIG_THR_RESTART SIGRTMIN + 5 # endif # else # define SIG_THR_RESTART SIGXCPU # endif #endif sem_t GC_suspend_ack_sem; #ifdef GC_NETBSD_THREADS # define GC_NETBSD_THREADS_WORKAROUND /* It seems to be necessary to wait until threads have restarted. */ /* But it is unclear why that is the case. */ sem_t GC_restart_ack_sem; #endif void GC_suspend_handler_inner(ptr_t sig_arg, void *context); #if defined(IA64) || defined(HP_PA) || defined(M68K) void GC_suspend_handler(int sig, siginfo_t *info, void *context) { int old_errno = errno; GC_with_callee_saves_pushed(GC_suspend_handler_inner, (ptr_t)(word)sig); errno = old_errno; } #else /* We believe that in all other cases the full context is already */ /* in the signal handler frame. */ void GC_suspend_handler(int sig, siginfo_t *info, void *context) { int old_errno = errno; GC_suspend_handler_inner((ptr_t)(word)sig, context); errno = old_errno; } #endif void GC_suspend_handler_inner(ptr_t sig_arg, void *context) { int sig = (int)(word)sig_arg; int dummy; pthread_t my_thread = pthread_self(); GC_thread me; # ifdef PARALLEL_MARK word my_mark_no = GC_mark_no; /* Marker can't proceed until we acknowledge. Thus this is */ /* guaranteed to be the mark_no correspending to our */ /* suspension, i.e. the marker can't have incremented it yet. */ # endif AO_t my_stop_count = AO_load(&GC_stop_count); if (sig != SIG_SUSPEND) ABORT("Bad signal in suspend_handler"); # if DEBUG_THREADS GC_printf("Suspending 0x%x\n", (unsigned)my_thread); # endif me = GC_lookup_thread(my_thread); /* The lookup here is safe, since I'm doing this on behalf */ /* of a thread which holds the allocation lock in order */ /* to stop the world. Thus concurrent modification of the */ /* data structure is impossible. */ if (me -> stop_info.last_stop_count == my_stop_count) { /* Duplicate signal. OK if we are retrying. */ if (!GC_retry_signals) { WARN("Duplicate suspend signal in thread %lx\n", pthread_self()); } return; } # ifdef SPARC me -> stop_info.stack_ptr = GC_save_regs_in_stack(); # else me -> stop_info.stack_ptr = (ptr_t)(&dummy); # endif # ifdef IA64 me -> backing_store_ptr = GC_save_regs_in_stack(); # endif /* Tell the thread that wants to stop the world that this */ /* thread has been stopped. Note that sem_post() is */ /* the only async-signal-safe primitive in LinuxThreads. */ sem_post(&GC_suspend_ack_sem); me -> stop_info.last_stop_count = my_stop_count; /* Wait until that thread tells us to restart by sending */ /* this thread a SIG_THR_RESTART signal. */ /* SIG_THR_RESTART should be masked at this point. Thus there */ /* is no race. */ /* We do not continue until we receive a SIG_THR_RESTART, */ /* but we do not take that as authoritative. (We may be */ /* accidentally restarted by one of the user signals we */ /* don't block.) After we receive the signal, we use a */ /* primitive and expensive mechanism to wait until it's */ /* really safe to proceed. Under normal circumstances, */ /* this code should not be executed. */ do { sigsuspend (&suspend_handler_mask); } while (AO_load_acquire(&GC_world_is_stopped) && AO_load(&GC_stop_count) == my_stop_count); /* If the RESTART signal gets lost, we can still lose. That should be */ /* less likely than losing the SUSPEND signal, since we don't do much */ /* between the sem_post and sigsuspend. */ /* We'd need more handshaking to work around that. */ /* Simply dropping the sigsuspend call should be safe, but is unlikely */ /* to be efficient. */ # if DEBUG_THREADS GC_printf("Continuing 0x%x\n", (unsigned)my_thread); # endif } void GC_restart_handler(int sig) { pthread_t my_thread = pthread_self(); GC_thread me; if (sig != SIG_THR_RESTART) ABORT("Bad signal in suspend_handler"); # ifdef GC_NETBSD_THREADS_WORKAROUND sem_post(&GC_restart_ack_sem); # endif /* ** Note: even if we don't do anything useful here, ** it would still be necessary to have a signal handler, ** rather than ignoring the signals, otherwise ** the signals will not be delivered at all, and ** will thus not interrupt the sigsuspend() above. */ # if DEBUG_THREADS GC_printf("In GC_restart_handler for 0x%x\n", (unsigned)pthread_self()); # endif } # ifdef IA64 # define IF_IA64(x) x # else # define IF_IA64(x) # endif /* We hold allocation lock. Should do exactly the right thing if the */ /* world is stopped. Should not fail if it isn't. */ void GC_push_all_stacks() { GC_bool found_me = FALSE; size_t nthreads = 0; int i; GC_thread p; ptr_t lo, hi; /* On IA64, we also need to scan the register backing store. */ IF_IA64(ptr_t bs_lo; ptr_t bs_hi;) pthread_t me = pthread_self(); if (!GC_thr_initialized) GC_thr_init(); # if DEBUG_THREADS GC_printf("Pushing stacks from thread 0x%x\n", (unsigned) me); # endif for (i = 0; i < THREAD_TABLE_SZ; i++) { for (p = GC_threads[i]; p != 0; p = p -> next) { if (p -> flags & FINISHED) continue; ++nthreads; if (THREAD_EQUAL(p -> id, me)) { # ifdef SPARC lo = (ptr_t)GC_save_regs_in_stack(); # else lo = GC_approx_sp(); # endif found_me = TRUE; IF_IA64(bs_hi = (ptr_t)GC_save_regs_in_stack();) } else { lo = p -> stop_info.stack_ptr; IF_IA64(bs_hi = p -> backing_store_ptr;) } if ((p -> flags & MAIN_THREAD) == 0) { hi = p -> stack_end; IF_IA64(bs_lo = p -> backing_store_end); } else { /* The original stack. */ hi = GC_stackbottom; IF_IA64(bs_lo = BACKING_STORE_BASE;) } # if DEBUG_THREADS GC_printf("Stack for thread 0x%x = [%p,%p)\n", (unsigned)(p -> id), lo, hi); # endif if (0 == lo) ABORT("GC_push_all_stacks: sp not set!\n"); # ifdef STACK_GROWS_UP /* We got them backwards! */ GC_push_all_stack(hi, lo); # else GC_push_all_stack(lo, hi); # endif # ifdef IA64 # if DEBUG_THREADS GC_printf("Reg stack for thread 0x%x = [%lx,%lx)\n", (unsigned)p -> id, bs_lo, bs_hi); # endif if (THREAD_EQUAL(p -> id, me)) { /* FIXME: This may add an unbounded number of entries, */ /* and hence overflow the mark stack, which is bad. */ GC_push_all_eager(bs_lo, bs_hi); } else { GC_push_all_stack(bs_lo, bs_hi); } # endif } } if (GC_print_stats == VERBOSE) { GC_log_printf("Pushed %d thread stacks\n", nthreads); } if (!found_me && !GC_in_thread_creation) ABORT("Collecting from unknown thread."); } /* There seems to be a very rare thread stopping problem. To help us */ /* debug that, we save the ids of the stopping thread. */ pthread_t GC_stopping_thread; int GC_stopping_pid; /* We hold the allocation lock. Suspend all threads that might */ /* still be running. Return the number of suspend signals that */ /* were sent. */ int GC_suspend_all() { int n_live_threads = 0; int i; GC_thread p; int result; pthread_t my_thread = pthread_self(); GC_stopping_thread = my_thread; /* debugging only. */ GC_stopping_pid = getpid(); /* debugging only. */ for (i = 0; i < THREAD_TABLE_SZ; i++) { for (p = GC_threads[i]; p != 0; p = p -> next) { if (!THREAD_EQUAL(p -> id, my_thread)) { if (p -> flags & FINISHED) continue; if (p -> stop_info.last_stop_count == GC_stop_count) continue; if (p -> thread_blocked) /* Will wait */ continue; n_live_threads++; # if DEBUG_THREADS GC_printf("Sending suspend signal to 0x%x\n", (unsigned)(p -> id)); # endif result = pthread_kill(p -> id, SIG_SUSPEND); switch(result) { case ESRCH: /* Not really there anymore. Possible? */ n_live_threads--; break; case 0: break; default: ABORT("pthread_kill failed"); } } } } return n_live_threads; } void GC_stop_world() { int i; int n_live_threads; int code; GC_ASSERT(I_HOLD_LOCK()); # if DEBUG_THREADS GC_printf("Stopping the world from 0x%x\n", (unsigned)pthread_self()); # endif /* Make sure all free list construction has stopped before we start. */ /* No new construction can start, since free list construction is */ /* required to acquire and release the GC lock before it starts, */ /* and we have the lock. */ # ifdef PARALLEL_MARK GC_acquire_mark_lock(); GC_ASSERT(GC_fl_builder_count == 0); /* We should have previously waited for it to become zero. */ # endif /* PARALLEL_MARK */ AO_store(&GC_stop_count, GC_stop_count+1); /* Only concurrent reads are possible. */ AO_store_release(&GC_world_is_stopped, TRUE); n_live_threads = GC_suspend_all(); if (GC_retry_signals) { unsigned long wait_usecs = 0; /* Total wait since retry. */ # define WAIT_UNIT 3000 # define RETRY_INTERVAL 100000 for (;;) { int ack_count; sem_getvalue(&GC_suspend_ack_sem, &ack_count); if (ack_count == n_live_threads) break; if (wait_usecs > RETRY_INTERVAL) { int newly_sent = GC_suspend_all(); if (GC_print_stats) { GC_log_printf("Resent %d signals after timeout\n", newly_sent); } sem_getvalue(&GC_suspend_ack_sem, &ack_count); if (newly_sent < n_live_threads - ack_count) { WARN("Lost some threads during GC_stop_world?!\n",0); n_live_threads = ack_count + newly_sent; } wait_usecs = 0; } usleep(WAIT_UNIT); wait_usecs += WAIT_UNIT; } } for (i = 0; i < n_live_threads; i++) { retry: if (0 != (code = sem_wait(&GC_suspend_ack_sem))) { /* On Linux, sem_wait is documented to always return zero.*/ /* But the documentation appears to be incorrect. */ if (errno == EINTR) { /* Seems to happen with some versions of gdb. */ goto retry; } ABORT("sem_wait for handler failed"); } } # ifdef PARALLEL_MARK GC_release_mark_lock(); # endif #if DEBUG_THREADS GC_printf("World stopped from 0x%x\n", (unsigned)pthread_self()); #endif GC_stopping_thread = 0; /* debugging only */ } /* Caller holds allocation lock, and has held it continuously since */ /* the world stopped. */ void GC_start_world() { pthread_t my_thread = pthread_self(); register int i; register GC_thread p; register int n_live_threads = 0; register int result; # ifdef GC_NETBSD_THREADS_WORKAROUND int code; # endif # if DEBUG_THREADS GC_printf("World starting\n"); # endif AO_store(&GC_world_is_stopped, FALSE); for (i = 0; i < THREAD_TABLE_SZ; i++) { for (p = GC_threads[i]; p != 0; p = p -> next) { if (!THREAD_EQUAL(p -> id, my_thread)) { if (p -> flags & FINISHED) continue; if (p -> thread_blocked) continue; n_live_threads++; #if DEBUG_THREADS GC_printf("Sending restart signal to 0x%x\n", (unsigned)(p -> id)); #endif result = pthread_kill(p -> id, SIG_THR_RESTART); switch(result) { case ESRCH: /* Not really there anymore. Possible? */ n_live_threads--; break; case 0: break; default: ABORT("pthread_kill failed"); } } } } # ifdef GC_NETBSD_THREADS_WORKAROUND for (i = 0; i < n_live_threads; i++) while (0 != (code = sem_wait(&GC_restart_ack_sem))) if (errno != EINTR) { GC_err_printf1("sem_wait() returned %ld\n", (unsigned long)code); ABORT("sem_wait() for restart handler failed"); } # endif # if DEBUG_THREADS GC_printf("World started\n"); # endif } void GC_stop_init() { struct sigaction act; if (sem_init(&GC_suspend_ack_sem, 0, 0) != 0) ABORT("sem_init failed"); # ifdef GC_NETBSD_THREADS_WORKAROUND if (sem_init(&GC_restart_ack_sem, 0, 0) != 0) ABORT("sem_init failed"); # endif act.sa_flags = SA_RESTART | SA_SIGINFO; if (sigfillset(&act.sa_mask) != 0) { ABORT("sigfillset() failed"); } GC_remove_allowed_signals(&act.sa_mask); /* SIG_THR_RESTART is set in the resulting mask. */ /* It is unmasked by the handler when necessary. */ act.sa_sigaction = GC_suspend_handler; if (sigaction(SIG_SUSPEND, &act, NULL) != 0) { ABORT("Cannot set SIG_SUSPEND handler"); } act.sa_flags &= ~ SA_SIGINFO; act.sa_handler = GC_restart_handler; if (sigaction(SIG_THR_RESTART, &act, NULL) != 0) { ABORT("Cannot set SIG_THR_RESTART handler"); } /* Inititialize suspend_handler_mask. It excludes SIG_THR_RESTART. */ if (sigfillset(&suspend_handler_mask) != 0) ABORT("sigfillset() failed"); GC_remove_allowed_signals(&suspend_handler_mask); if (sigdelset(&suspend_handler_mask, SIG_THR_RESTART) != 0) ABORT("sigdelset() failed"); /* Check for GC_RETRY_SIGNALS. */ if (0 != GETENV("GC_RETRY_SIGNALS")) { GC_retry_signals = TRUE; } if (0 != GETENV("GC_NO_RETRY_SIGNALS")) { GC_retry_signals = FALSE; } if (GC_print_stats && GC_retry_signals) { GC_log_printf("Will retry suspend signal if necessary.\n"); } } #endif synopsis-0.12/src/Synopsis/gc/reclaim.c0000664000076400007640000004174711104702316017456 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1996 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ #include #include "private/gc_priv.h" signed_word GC_bytes_found = 0; /* Number of bytes of memory reclaimed */ #if defined(PARALLEL_MARK) || defined(THREAD_LOCAL_ALLOC) word GC_fl_builder_count = 0; /* Number of threads currently building free lists without */ /* holding GC lock. It is not safe to collect if this is */ /* nonzero. */ #endif /* PARALLEL_MARK */ /* We defer printing of leaked objects until we're done with the GC */ /* cycle, since the routine for printing objects needs to run outside */ /* the collector, e.g. without the allocation lock. */ #define MAX_LEAKED 40 ptr_t GC_leaked[MAX_LEAKED]; unsigned GC_n_leaked = 0; GC_bool GC_have_errors = FALSE; void GC_add_leaked(ptr_t leaked) { if (GC_n_leaked < MAX_LEAKED) { GC_have_errors = TRUE; GC_leaked[GC_n_leaked++] = leaked; /* Make sure it's not reclaimed this cycle */ GC_set_mark_bit(leaked); } } static GC_bool printing_errors = FALSE; /* Print all objects on the list after printing any smashed objs. */ /* Clear both lists. */ void GC_print_all_errors () { unsigned i; LOCK(); if (printing_errors) { UNLOCK(); return; } printing_errors = TRUE; UNLOCK(); if (GC_debugging_started) GC_print_all_smashed(); for (i = 0; i < GC_n_leaked; ++i) { ptr_t p = GC_leaked[i]; if (HDR(p) -> hb_obj_kind == PTRFREE) { GC_err_printf("Leaked atomic object at "); } else { GC_err_printf("Leaked composite object at "); } GC_print_heap_obj(p); GC_err_printf("\n"); GC_free(p); GC_leaked[i] = 0; } GC_n_leaked = 0; printing_errors = FALSE; } /* * reclaim phase * */ /* * Test whether a block is completely empty, i.e. contains no marked * objects. This does not require the block to be in physical * memory. */ GC_bool GC_block_empty(hdr *hhdr) { return (hhdr -> hb_n_marks == 0); } GC_bool GC_block_nearly_full(hdr *hhdr) { return (hhdr -> hb_n_marks > 7 * HBLK_OBJS(hhdr -> hb_sz)/8); } /* FIXME: This should perhaps again be specialized for USE_MARK_BYTES */ /* and USE_MARK_BITS cases. */ /* * Restore unmarked small objects in h of size sz to the object * free list. Returns the new list. * Clears unmarked objects. Sz is in bytes. */ /*ARGSUSED*/ ptr_t GC_reclaim_clear(struct hblk *hbp, hdr *hhdr, size_t sz, ptr_t list, signed_word *count) { word bit_no = 0; word *p, *q, *plim; signed_word n_bytes_found = 0; GC_ASSERT(hhdr == GC_find_header((ptr_t)hbp)); GC_ASSERT(sz == hhdr -> hb_sz); GC_ASSERT((sz & (BYTES_PER_WORD-1)) == 0); p = (word *)(hbp->hb_body); plim = (word *)(hbp->hb_body + HBLKSIZE - sz); /* go through all words in block */ while( p <= plim ) { if( mark_bit_from_hdr(hhdr, bit_no) ) { p = (word *)((ptr_t)p + sz); } else { n_bytes_found += sz; /* object is available - put on list */ obj_link(p) = list; list = ((ptr_t)p); /* Clear object, advance p to next object in the process */ q = (word *)((ptr_t)p + sz); # ifdef USE_MARK_BYTES GC_ASSERT(!(sz & 1) && !((word)p & (2 * sizeof(word) - 1))); p[1] = 0; p += 2; while (p < q) { CLEAR_DOUBLE(p); p += 2; } # else p++; /* Skip link field */ while (p < q) { *p++ = 0; } # endif } bit_no += MARK_BIT_OFFSET(sz); } *count += n_bytes_found; return(list); } /* The same thing, but don't clear objects: */ /*ARGSUSED*/ ptr_t GC_reclaim_uninit(struct hblk *hbp, hdr *hhdr, size_t sz, ptr_t list, signed_word *count) { word bit_no = 0; word *p, *plim; signed_word n_bytes_found = 0; GC_ASSERT(sz == hhdr -> hb_sz); p = (word *)(hbp->hb_body); plim = (word *)((ptr_t)hbp + HBLKSIZE - sz); /* go through all words in block */ while( p <= plim ) { if( !mark_bit_from_hdr(hhdr, bit_no) ) { n_bytes_found += sz; /* object is available - put on list */ obj_link(p) = list; list = ((ptr_t)p); } p = (word *)((ptr_t)p + sz); bit_no += MARK_BIT_OFFSET(sz); } *count += n_bytes_found; return(list); } /* Don't really reclaim objects, just check for unmarked ones: */ /*ARGSUSED*/ void GC_reclaim_check(struct hblk *hbp, hdr *hhdr, word sz) { word bit_no = 0; ptr_t p, plim; GC_ASSERT(sz == hhdr -> hb_sz); p = hbp->hb_body; plim = p + HBLKSIZE - sz; /* go through all words in block */ while( p <= plim ) { if( !mark_bit_from_hdr(hhdr, bit_no) ) { GC_add_leaked(p); } p += sz; bit_no += MARK_BIT_OFFSET(sz); } } /* * Generic procedure to rebuild a free list in hbp. * Also called directly from GC_malloc_many. * Sz is now in bytes. */ ptr_t GC_reclaim_generic(struct hblk * hbp, hdr *hhdr, size_t sz, GC_bool init, ptr_t list, signed_word *count) { ptr_t result = list; GC_ASSERT(GC_find_header((ptr_t)hbp) == hhdr); GC_remove_protection(hbp, 1, (hhdr)->hb_descr == 0 /* Pointer-free? */); if (init) { result = GC_reclaim_clear(hbp, hhdr, sz, list, count); } else { GC_ASSERT((hhdr)->hb_descr == 0 /* Pointer-free block */); result = GC_reclaim_uninit(hbp, hhdr, sz, list, count); } if (IS_UNCOLLECTABLE(hhdr -> hb_obj_kind)) GC_set_hdr_marks(hhdr); return result; } /* * Restore unmarked small objects in the block pointed to by hbp * to the appropriate object free list. * If entirely empty blocks are to be completely deallocated, then * caller should perform that check. */ void GC_reclaim_small_nonempty_block(struct hblk *hbp, int report_if_found, signed_word *count) { hdr *hhdr = HDR(hbp); size_t sz = hhdr -> hb_sz; int kind = hhdr -> hb_obj_kind; struct obj_kind * ok = &GC_obj_kinds[kind]; void **flh = &(ok -> ok_freelist[BYTES_TO_GRANULES(sz)]); hhdr -> hb_last_reclaimed = (unsigned short) GC_gc_no; if (report_if_found) { GC_reclaim_check(hbp, hhdr, sz); } else { *flh = GC_reclaim_generic(hbp, hhdr, sz, (ok -> ok_init || GC_debugging_started), *flh, &GC_bytes_found); } } /* * Restore an unmarked large object or an entirely empty blocks of small objects * to the heap block free list. * Otherwise enqueue the block for later processing * by GC_reclaim_small_nonempty_block. * If report_if_found is TRUE, then process any block immediately, and * simply report free objects; do not actually reclaim them. */ void GC_reclaim_block(struct hblk *hbp, word report_if_found) { hdr * hhdr = HDR(hbp); size_t sz = hhdr -> hb_sz; /* size of objects in current block */ struct obj_kind * ok = &GC_obj_kinds[hhdr -> hb_obj_kind]; struct hblk ** rlh; if( sz > MAXOBJBYTES ) { /* 1 big object */ if( !mark_bit_from_hdr(hhdr, 0) ) { if (report_if_found) { GC_add_leaked((ptr_t)hbp); } else { size_t blocks = OBJ_SZ_TO_BLOCKS(sz); if (blocks > 1) { GC_large_allocd_bytes -= blocks * HBLKSIZE; } GC_bytes_found += sz; GC_freehblk(hbp); } } else { if (hhdr -> hb_descr != 0) { GC_composite_in_use += sz; } else { GC_atomic_in_use += sz; } } } else { GC_bool empty = GC_block_empty(hhdr); # ifdef PARALLEL_MARK /* Count can be low or one too high because we sometimes */ /* have to ignore decrements. Objects can also potentially */ /* be repeatedly marked by each marker. */ /* Here we assume two markers, but this is extremely */ /* unlikely to fail spuriously with more. And if it does, it */ /* should be looked at. */ GC_ASSERT(hhdr -> hb_n_marks <= 2 * (HBLKSIZE/sz + 1) + 16); # else GC_ASSERT(sz * hhdr -> hb_n_marks <= HBLKSIZE); # endif if (hhdr -> hb_descr != 0) { GC_composite_in_use += sz * hhdr -> hb_n_marks; } else { GC_atomic_in_use += sz * hhdr -> hb_n_marks; } if (report_if_found) { GC_reclaim_small_nonempty_block(hbp, (int)report_if_found, &GC_bytes_found); } else if (empty) { GC_bytes_found += HBLKSIZE; GC_freehblk(hbp); } else if (TRUE != GC_block_nearly_full(hhdr)){ /* group of smaller objects, enqueue the real work */ rlh = &(ok -> ok_reclaim_list[BYTES_TO_GRANULES(sz)]); hhdr -> hb_next = *rlh; *rlh = hbp; } /* else not worth salvaging. */ /* We used to do the nearly_full check later, but we */ /* already have the right cache context here. Also */ /* doing it here avoids some silly lock contention in */ /* GC_malloc_many. */ } } #if !defined(NO_DEBUGGING) /* Routines to gather and print heap block info */ /* intended for debugging. Otherwise should be called */ /* with lock. */ struct Print_stats { size_t number_of_blocks; size_t total_bytes; }; #ifdef USE_MARK_BYTES /* Return the number of set mark bits in the given header */ int GC_n_set_marks(hdr *hhdr) { int result = 0; int i; size_t sz = hhdr -> hb_sz; int offset = MARK_BIT_OFFSET(sz); int limit = FINAL_MARK_BIT(sz); for (i = 0; i < limit; i += offset) { result += hhdr -> hb_marks[i]; } GC_ASSERT(hhdr -> hb_marks[limit]); return(result); } #else /* Number of set bits in a word. Not performance critical. */ static int set_bits(word n) { word m = n; int result = 0; while (m > 0) { if (m & 1) result++; m >>= 1; } return(result); } /* Return the number of set mark bits in the given header */ int GC_n_set_marks(hdr *hhdr) { int result = 0; int i; int n_mark_words; # ifdef MARK_BIT_PER_OBJ int n_objs = HBLK_OBJS(hhdr -> hb_sz); if (0 == n_objs) n_objs = 1; n_mark_words = divWORDSZ(n_objs + WORDSZ - 1); # else /* MARK_BIT_PER_GRANULE */ n_mark_words = MARK_BITS_SZ; # endif for (i = 0; i < n_mark_words - 1; i++) { result += set_bits(hhdr -> hb_marks[i]); } # ifdef MARK_BIT_PER_OBJ result += set_bits((hhdr -> hb_marks[n_mark_words - 1]) << (n_mark_words * WORDSZ - n_objs)); # else result += set_bits(hhdr -> hb_marks[n_mark_words - 1]); # endif return(result - 1); } #endif /* !USE_MARK_BYTES */ /*ARGSUSED*/ void GC_print_block_descr(struct hblk *h, word /* struct PrintStats */ raw_ps) { hdr * hhdr = HDR(h); size_t bytes = hhdr -> hb_sz; struct Print_stats *ps; unsigned n_marks = GC_n_set_marks(hhdr); if (hhdr -> hb_n_marks != n_marks) { GC_printf("(%u:%u,%u!=%u)", hhdr -> hb_obj_kind, bytes, hhdr -> hb_n_marks, n_marks); } else { GC_printf("(%u:%u,%u)", hhdr -> hb_obj_kind, bytes, n_marks); } bytes += HBLKSIZE-1; bytes &= ~(HBLKSIZE-1); ps = (struct Print_stats *)raw_ps; ps->total_bytes += bytes; ps->number_of_blocks++; } void GC_print_block_list() { struct Print_stats pstats; GC_printf("(kind(0=ptrfree,1=normal,2=unc.):size_in_bytes, #_marks_set)\n"); pstats.number_of_blocks = 0; pstats.total_bytes = 0; GC_apply_to_all_blocks(GC_print_block_descr, (word)&pstats); GC_printf("\nblocks = %lu, bytes = %lu\n", (unsigned long)pstats.number_of_blocks, (unsigned long)pstats.total_bytes); } /* Currently for debugger use only: */ void GC_print_free_list(int kind, size_t sz_in_granules) { struct obj_kind * ok = &GC_obj_kinds[kind]; ptr_t flh = ok -> ok_freelist[sz_in_granules]; struct hblk *lastBlock = 0; int n = 0; while (flh){ struct hblk *block = HBLKPTR(flh); if (block != lastBlock){ GC_printf("\nIn heap block at 0x%x:\n\t", block); lastBlock = block; } GC_printf("%d: 0x%x;", ++n, flh); flh = obj_link(flh); } } #endif /* NO_DEBUGGING */ /* * Clear all obj_link pointers in the list of free objects *flp. * Clear *flp. * This must be done before dropping a list of free gcj-style objects, * since may otherwise end up with dangling "descriptor" pointers. * It may help for other pointer-containing objects. */ void GC_clear_fl_links(void **flp) { void *next = *flp; while (0 != next) { *flp = 0; flp = &(obj_link(next)); next = *flp; } } /* * Perform GC_reclaim_block on the entire heap, after first clearing * small object free lists (if we are not just looking for leaks). */ void GC_start_reclaim(GC_bool report_if_found) { unsigned kind; # if defined(PARALLEL_MARK) || defined(THREAD_LOCAL_ALLOC) GC_ASSERT(0 == GC_fl_builder_count); # endif /* Reset in use counters. GC_reclaim_block recomputes them. */ GC_composite_in_use = 0; GC_atomic_in_use = 0; /* Clear reclaim- and free-lists */ for (kind = 0; kind < GC_n_kinds; kind++) { void **fop; void **lim; struct hblk ** rlp; struct hblk ** rlim; struct hblk ** rlist = GC_obj_kinds[kind].ok_reclaim_list; GC_bool should_clobber = (GC_obj_kinds[kind].ok_descriptor != 0); if (rlist == 0) continue; /* This kind not used. */ if (!report_if_found) { lim = &(GC_obj_kinds[kind].ok_freelist[MAXOBJGRANULES+1]); for( fop = GC_obj_kinds[kind].ok_freelist; fop < lim; fop++ ) { if (*fop != 0) { if (should_clobber) { GC_clear_fl_links(fop); } else { *fop = 0; } } } } /* otherwise free list objects are marked, */ /* and its safe to leave them */ rlim = rlist + MAXOBJGRANULES+1; for( rlp = rlist; rlp < rlim; rlp++ ) { *rlp = 0; } } /* Go through all heap blocks (in hblklist) and reclaim unmarked objects */ /* or enqueue the block for later processing. */ GC_apply_to_all_blocks(GC_reclaim_block, (word)report_if_found); # ifdef EAGER_SWEEP /* This is a very stupid thing to do. We make it possible anyway, */ /* so that you can convince yourself that it really is very stupid. */ GC_reclaim_all((GC_stop_func)0, FALSE); # endif # if defined(PARALLEL_MARK) || defined(THREAD_LOCAL_ALLOC) GC_ASSERT(0 == GC_fl_builder_count); # endif } /* * Sweep blocks of the indicated object size and kind until either the * appropriate free list is nonempty, or there are no more blocks to * sweep. */ void GC_continue_reclaim(size_t sz /* granules */, int kind) { hdr * hhdr; struct hblk * hbp; struct obj_kind * ok = &(GC_obj_kinds[kind]); struct hblk ** rlh = ok -> ok_reclaim_list; void **flh = &(ok -> ok_freelist[sz]); if (rlh == 0) return; /* No blocks of this kind. */ rlh += sz; while ((hbp = *rlh) != 0) { hhdr = HDR(hbp); *rlh = hhdr -> hb_next; GC_reclaim_small_nonempty_block(hbp, FALSE, &GC_bytes_found); if (*flh != 0) break; } } /* * Reclaim all small blocks waiting to be reclaimed. * Abort and return FALSE when/if (*stop_func)() returns TRUE. * If this returns TRUE, then it's safe to restart the world * with incorrectly cleared mark bits. * If ignore_old is TRUE, then reclaim only blocks that have been * recently reclaimed, and discard the rest. * Stop_func may be 0. */ GC_bool GC_reclaim_all(GC_stop_func stop_func, GC_bool ignore_old) { word sz; unsigned kind; hdr * hhdr; struct hblk * hbp; struct obj_kind * ok; struct hblk ** rlp; struct hblk ** rlh; CLOCK_TYPE start_time; CLOCK_TYPE done_time; if (GC_print_stats == VERBOSE) GET_TIME(start_time); for (kind = 0; kind < GC_n_kinds; kind++) { ok = &(GC_obj_kinds[kind]); rlp = ok -> ok_reclaim_list; if (rlp == 0) continue; for (sz = 1; sz <= MAXOBJGRANULES; sz++) { rlh = rlp + sz; while ((hbp = *rlh) != 0) { if (stop_func != (GC_stop_func)0 && (*stop_func)()) { return(FALSE); } hhdr = HDR(hbp); *rlh = hhdr -> hb_next; if (!ignore_old || hhdr -> hb_last_reclaimed == GC_gc_no - 1) { /* It's likely we'll need it this time, too */ /* It's been touched recently, so this */ /* shouldn't trigger paging. */ GC_reclaim_small_nonempty_block(hbp, FALSE, &GC_bytes_found); } } } } if (GC_print_stats == VERBOSE) { GET_TIME(done_time); GC_log_printf("Disposing of reclaim lists took %lu msecs\n", MS_TIME_DIFF(done_time,start_time)); } return(TRUE); } synopsis-0.12/src/Synopsis/gc/sparc_sunos4_mach_dep.s0000664000076400007640000000151711104702320022307 0ustar stefanstefan! SPARCompiler 3.0 and later apparently no longer handles ! asm outside functions. So we need a separate .s file ! This is only set up for SunOS 4. ! Assumes this is called before the stack contents are ! examined. .seg "text" .globl _GC_save_regs_in_stack .globl _GC_push_regs _GC_save_regs_in_stack: _GC_push_regs: ta 0x3 ! ST_FLUSH_WINDOWS mov %sp,%o0 retl nop .globl _GC_clear_stack_inner _GC_clear_stack_inner: mov %sp,%o2 ! Save sp add %sp,-8,%o3 ! p = sp-8 clr %g1 ! [g0,g1] = 0 add %o1,-0x60,%sp ! Move sp out of the way, ! so that traps still work. ! Includes some extra words ! so we can be sloppy below. loop: std %g0,[%o3] ! *(long long *)p = 0 cmp %o3,%o1 bgu loop ! if (p > limit) goto loop add %o3,-8,%o3 ! p -= 8 (delay slot) retl mov %o2,%sp ! Restore sp., delay slot synopsis-0.12/src/Synopsis/gc/finalize.c0000664000076400007640000006612011104702317017634 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1996 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (C) 2007 Free Software Foundation, Inc * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* Boehm, February 1, 1996 1:19 pm PST */ # define I_HIDE_POINTERS # include "private/gc_pmark.h" # ifdef FINALIZE_ON_DEMAND int GC_finalize_on_demand = 1; # else int GC_finalize_on_demand = 0; # endif # ifdef JAVA_FINALIZATION int GC_java_finalization = 1; # else int GC_java_finalization = 0; # endif /* Type of mark procedure used for marking from finalizable object. */ /* This procedure normally does not mark the object, only its */ /* descendents. */ typedef void finalization_mark_proc(/* ptr_t finalizable_obj_ptr */); # define HASH3(addr,size,log_size) \ ((((word)(addr) >> 3) ^ ((word)(addr) >> (3+(log_size)))) \ & ((size) - 1)) #define HASH2(addr,log_size) HASH3(addr, 1 << log_size, log_size) struct hash_chain_entry { word hidden_key; struct hash_chain_entry * next; }; unsigned GC_finalization_failures = 0; /* Number of finalization requests that failed for lack of memory. */ static struct disappearing_link { struct hash_chain_entry prolog; # define dl_hidden_link prolog.hidden_key /* Field to be cleared. */ # define dl_next(x) (struct disappearing_link *)((x) -> prolog.next) # define dl_set_next(x,y) (x) -> prolog.next = (struct hash_chain_entry *)(y) word dl_hidden_obj; /* Pointer to object base */ } **dl_head = 0; static signed_word log_dl_table_size = -1; /* Binary log of */ /* current size of array pointed to by dl_head. */ /* -1 ==> size is 0. */ word GC_dl_entries = 0; /* Number of entries currently in disappearing */ /* link table. */ static struct finalizable_object { struct hash_chain_entry prolog; # define fo_hidden_base prolog.hidden_key /* Pointer to object base. */ /* No longer hidden once object */ /* is on finalize_now queue. */ # define fo_next(x) (struct finalizable_object *)((x) -> prolog.next) # define fo_set_next(x,y) (x) -> prolog.next = (struct hash_chain_entry *)(y) GC_finalization_proc fo_fn; /* Finalizer. */ ptr_t fo_client_data; word fo_object_size; /* In bytes. */ finalization_mark_proc * fo_mark_proc; /* Mark-through procedure */ } **fo_head = 0; struct finalizable_object * GC_finalize_now = 0; /* LIst of objects that should be finalized now. */ static signed_word log_fo_table_size = -1; word GC_fo_entries = 0; void GC_push_finalizer_structures(void) { GC_push_all((ptr_t)(&dl_head), (ptr_t)(&dl_head) + sizeof(word)); GC_push_all((ptr_t)(&fo_head), (ptr_t)(&fo_head) + sizeof(word)); GC_push_all((ptr_t)(&GC_finalize_now), (ptr_t)(&GC_finalize_now) + sizeof(word)); } /* Double the size of a hash table. *size_ptr is the log of its current */ /* size. May be a noop. */ /* *table is a pointer to an array of hash headers. If we succeed, we */ /* update both *table and *log_size_ptr. */ /* Lock is held. Signals are disabled. */ void GC_grow_table(struct hash_chain_entry ***table, signed_word *log_size_ptr) { register word i; register struct hash_chain_entry *p; signed_word log_old_size = *log_size_ptr; signed_word log_new_size = log_old_size + 1; word old_size = ((log_old_size == -1)? 0: (1 << log_old_size)); word new_size = (word)1 << log_new_size; /* FIXME: Power of 2 size often gets rounded up to one more page. */ struct hash_chain_entry **new_table = (struct hash_chain_entry **) GC_INTERNAL_MALLOC_IGNORE_OFF_PAGE( (size_t)new_size * sizeof(struct hash_chain_entry *), NORMAL); if (new_table == 0) { if (table == 0) { ABORT("Insufficient space for initial table allocation"); } else { return; } } for (i = 0; i < old_size; i++) { p = (*table)[i]; while (p != 0) { ptr_t real_key = (ptr_t)REVEAL_POINTER(p -> hidden_key); struct hash_chain_entry *next = p -> next; size_t new_hash = HASH3(real_key, new_size, log_new_size); p -> next = new_table[new_hash]; new_table[new_hash] = p; p = next; } } *log_size_ptr = log_new_size; *table = new_table; } int GC_register_disappearing_link(void * * link) { ptr_t base; base = (ptr_t)GC_base((void *)link); if (base == 0) ABORT("Bad arg to GC_register_disappearing_link"); return(GC_general_register_disappearing_link(link, base)); } int GC_general_register_disappearing_link(void * * link, void * obj) { struct disappearing_link *curr_dl; size_t index; struct disappearing_link * new_dl; DCL_LOCK_STATE; if ((word)link & (ALIGNMENT-1)) ABORT("Bad arg to GC_general_register_disappearing_link"); # ifdef THREADS LOCK(); # endif if (log_dl_table_size == -1 || GC_dl_entries > ((word)1 << log_dl_table_size)) { GC_grow_table((struct hash_chain_entry ***)(&dl_head), &log_dl_table_size); if (GC_print_stats) { GC_log_printf("Grew dl table to %u entries\n", (1 << log_dl_table_size)); } } index = HASH2(link, log_dl_table_size); curr_dl = dl_head[index]; for (curr_dl = dl_head[index]; curr_dl != 0; curr_dl = dl_next(curr_dl)) { if (curr_dl -> dl_hidden_link == HIDE_POINTER(link)) { curr_dl -> dl_hidden_obj = HIDE_POINTER(obj); # ifdef THREADS UNLOCK(); # endif return(1); } } new_dl = (struct disappearing_link *) GC_INTERNAL_MALLOC(sizeof(struct disappearing_link),NORMAL); if (0 == new_dl) { # ifdef THREADS UNLOCK(); # endif new_dl = (struct disappearing_link *) GC_oom_fn(sizeof(struct disappearing_link)); if (0 == new_dl) { GC_finalization_failures++; return(0); } /* It's not likely we'll make it here, but ... */ # ifdef THREADS LOCK(); # endif } new_dl -> dl_hidden_obj = HIDE_POINTER(obj); new_dl -> dl_hidden_link = HIDE_POINTER(link); dl_set_next(new_dl, dl_head[index]); dl_head[index] = new_dl; GC_dl_entries++; # ifdef THREADS UNLOCK(); # endif return(0); } int GC_unregister_disappearing_link(void * * link) { struct disappearing_link *curr_dl, *prev_dl; size_t index; DCL_LOCK_STATE; LOCK(); index = HASH2(link, log_dl_table_size); if (((word)link & (ALIGNMENT-1))) goto out; prev_dl = 0; curr_dl = dl_head[index]; while (curr_dl != 0) { if (curr_dl -> dl_hidden_link == HIDE_POINTER(link)) { if (prev_dl == 0) { dl_head[index] = dl_next(curr_dl); } else { dl_set_next(prev_dl, dl_next(curr_dl)); } GC_dl_entries--; UNLOCK(); # ifdef DBG_HDRS_ALL dl_set_next(curr_dl, 0); # else GC_free((void *)curr_dl); # endif return(1); } prev_dl = curr_dl; curr_dl = dl_next(curr_dl); } out: UNLOCK(); return(0); } /* Possible finalization_marker procedures. Note that mark stack */ /* overflow is handled by the caller, and is not a disaster. */ GC_API void GC_normal_finalize_mark_proc(ptr_t p) { hdr * hhdr = HDR(p); PUSH_OBJ(p, hhdr, GC_mark_stack_top, &(GC_mark_stack[GC_mark_stack_size])); } /* This only pays very partial attention to the mark descriptor. */ /* It does the right thing for normal and atomic objects, and treats */ /* most others as normal. */ GC_API void GC_ignore_self_finalize_mark_proc(ptr_t p) { hdr * hhdr = HDR(p); word descr = hhdr -> hb_descr; ptr_t q, r; ptr_t scan_limit; ptr_t target_limit = p + hhdr -> hb_sz - 1; if ((descr & GC_DS_TAGS) == GC_DS_LENGTH) { scan_limit = p + descr - sizeof(word); } else { scan_limit = target_limit + 1 - sizeof(word); } for (q = p; q <= scan_limit; q += ALIGNMENT) { r = *(ptr_t *)q; if (r < p || r > target_limit) { GC_PUSH_ONE_HEAP(r, q); } } } /*ARGSUSED*/ GC_API void GC_null_finalize_mark_proc(ptr_t p) { } /* Possible finalization_marker procedures. Note that mark stack */ /* overflow is handled by the caller, and is not a disaster. */ /* GC_unreachable_finalize_mark_proc is an alias for normal marking, */ /* but it is explicitly tested for, and triggers different */ /* behavior. Objects registered in this way are not finalized */ /* if they are reachable by other finalizable objects, eve if those */ /* other objects specify no ordering. */ GC_API void GC_unreachable_finalize_mark_proc(ptr_t p) { GC_normal_finalize_mark_proc(p); } /* Register a finalization function. See gc.h for details. */ /* in the nonthreads case, we try to avoid disabling signals, */ /* since it can be expensive. Threads packages typically */ /* make it cheaper. */ /* The last parameter is a procedure that determines */ /* marking for finalization ordering. Any objects marked */ /* by that procedure will be guaranteed to not have been */ /* finalized when this finalizer is invoked. */ GC_API void GC_register_finalizer_inner(void * obj, GC_finalization_proc fn, void *cd, GC_finalization_proc *ofn, void **ocd, finalization_mark_proc mp) { ptr_t base; struct finalizable_object * curr_fo, * prev_fo; size_t index; struct finalizable_object *new_fo; hdr *hhdr; DCL_LOCK_STATE; # ifdef THREADS LOCK(); # endif if (log_fo_table_size == -1 || GC_fo_entries > ((word)1 << log_fo_table_size)) { GC_grow_table((struct hash_chain_entry ***)(&fo_head), &log_fo_table_size); if (GC_print_stats) { GC_log_printf("Grew fo table to %u entries\n", (1 << log_fo_table_size)); } } /* in the THREADS case signals are disabled and we hold allocation */ /* lock; otherwise neither is true. Proceed carefully. */ base = (ptr_t)obj; index = HASH2(base, log_fo_table_size); prev_fo = 0; curr_fo = fo_head[index]; while (curr_fo != 0) { GC_ASSERT(GC_size(curr_fo) >= sizeof(struct finalizable_object)); if (curr_fo -> fo_hidden_base == HIDE_POINTER(base)) { /* Interruption by a signal in the middle of this */ /* should be safe. The client may see only *ocd */ /* updated, but we'll declare that to be his */ /* problem. */ if (ocd) *ocd = (void *) (curr_fo -> fo_client_data); if (ofn) *ofn = curr_fo -> fo_fn; /* Delete the structure for base. */ if (prev_fo == 0) { fo_head[index] = fo_next(curr_fo); } else { fo_set_next(prev_fo, fo_next(curr_fo)); } if (fn == 0) { GC_fo_entries--; /* May not happen if we get a signal. But a high */ /* estimate will only make the table larger than */ /* necessary. */ # if !defined(THREADS) && !defined(DBG_HDRS_ALL) GC_free((void *)curr_fo); # endif } else { curr_fo -> fo_fn = fn; curr_fo -> fo_client_data = (ptr_t)cd; curr_fo -> fo_mark_proc = mp; /* Reinsert it. We deleted it first to maintain */ /* consistency in the event of a signal. */ if (prev_fo == 0) { fo_head[index] = curr_fo; } else { fo_set_next(prev_fo, curr_fo); } } # ifdef THREADS UNLOCK(); # endif return; } prev_fo = curr_fo; curr_fo = fo_next(curr_fo); } if (ofn) *ofn = 0; if (ocd) *ocd = 0; if (fn == 0) { # ifdef THREADS UNLOCK(); # endif return; } GET_HDR(base, hhdr); if (0 == hhdr) { /* We won't collect it, hence finalizer wouldn't be run. */ # ifdef THREADS UNLOCK(); # endif return; } new_fo = (struct finalizable_object *) GC_INTERNAL_MALLOC(sizeof(struct finalizable_object),NORMAL); GC_ASSERT(GC_size(new_fo) >= sizeof(struct finalizable_object)); if (EXPECT(0 == new_fo, FALSE)) { # ifdef THREADS UNLOCK(); # endif new_fo = (struct finalizable_object *) GC_oom_fn(sizeof(struct finalizable_object)); if (0 == new_fo) { GC_finalization_failures++; return; } /* It's not likely we'll make it here, but ... */ # ifdef THREADS LOCK(); # endif } new_fo -> fo_hidden_base = (word)HIDE_POINTER(base); new_fo -> fo_fn = fn; new_fo -> fo_client_data = (ptr_t)cd; new_fo -> fo_object_size = hhdr -> hb_sz; new_fo -> fo_mark_proc = mp; fo_set_next(new_fo, fo_head[index]); GC_fo_entries++; fo_head[index] = new_fo; # ifdef THREADS UNLOCK(); # endif } void GC_register_finalizer(void * obj, GC_finalization_proc fn, void * cd, GC_finalization_proc *ofn, void ** ocd) { GC_register_finalizer_inner(obj, fn, cd, ofn, ocd, GC_normal_finalize_mark_proc); } void GC_register_finalizer_ignore_self(void * obj, GC_finalization_proc fn, void * cd, GC_finalization_proc *ofn, void ** ocd) { GC_register_finalizer_inner(obj, fn, cd, ofn, ocd, GC_ignore_self_finalize_mark_proc); } void GC_register_finalizer_no_order(void * obj, GC_finalization_proc fn, void * cd, GC_finalization_proc *ofn, void ** ocd) { GC_register_finalizer_inner(obj, fn, cd, ofn, ocd, GC_null_finalize_mark_proc); } static GC_bool need_unreachable_finalization = FALSE; /* Avoid the work if this isn't used. */ void GC_register_finalizer_unreachable(void * obj, GC_finalization_proc fn, void * cd, GC_finalization_proc *ofn, void ** ocd) { need_unreachable_finalization = TRUE; GC_ASSERT(GC_java_finalization); GC_register_finalizer_inner(obj, fn, cd, ofn, ocd, GC_unreachable_finalize_mark_proc); } #ifndef NO_DEBUGGING void GC_dump_finalization(void) { struct disappearing_link * curr_dl; struct finalizable_object * curr_fo; ptr_t real_ptr, real_link; int dl_size = (log_dl_table_size == -1 ) ? 0 : (1 << log_dl_table_size); int fo_size = (log_fo_table_size == -1 ) ? 0 : (1 << log_fo_table_size); int i; GC_printf("Disappearing links:\n"); for (i = 0; i < dl_size; i++) { for (curr_dl = dl_head[i]; curr_dl != 0; curr_dl = dl_next(curr_dl)) { real_ptr = (ptr_t)REVEAL_POINTER(curr_dl -> dl_hidden_obj); real_link = (ptr_t)REVEAL_POINTER(curr_dl -> dl_hidden_link); GC_printf("Object: %p, Link:%p\n", real_ptr, real_link); } } GC_printf("Finalizers:\n"); for (i = 0; i < fo_size; i++) { for (curr_fo = fo_head[i]; curr_fo != 0; curr_fo = fo_next(curr_fo)) { real_ptr = (ptr_t)REVEAL_POINTER(curr_fo -> fo_hidden_base); GC_printf("Finalizable object: %p\n", real_ptr); } } } #endif /* Called with world stopped. Cause disappearing links to disappear, */ /* and invoke finalizers. */ void GC_finalize(void) { struct disappearing_link * curr_dl, * prev_dl, * next_dl; struct finalizable_object * curr_fo, * prev_fo, * next_fo; ptr_t real_ptr, real_link; size_t i; size_t dl_size = (log_dl_table_size == -1 ) ? 0 : (1 << log_dl_table_size); size_t fo_size = (log_fo_table_size == -1 ) ? 0 : (1 << log_fo_table_size); /* Make disappearing links disappear */ for (i = 0; i < dl_size; i++) { curr_dl = dl_head[i]; prev_dl = 0; while (curr_dl != 0) { real_ptr = (ptr_t)REVEAL_POINTER(curr_dl -> dl_hidden_obj); real_link = (ptr_t)REVEAL_POINTER(curr_dl -> dl_hidden_link); if (!GC_is_marked(real_ptr)) { *(word *)real_link = 0; next_dl = dl_next(curr_dl); if (prev_dl == 0) { dl_head[i] = next_dl; } else { dl_set_next(prev_dl, next_dl); } GC_clear_mark_bit((ptr_t)curr_dl); GC_dl_entries--; curr_dl = next_dl; } else { prev_dl = curr_dl; curr_dl = dl_next(curr_dl); } } } /* Mark all objects reachable via chains of 1 or more pointers */ /* from finalizable objects. */ GC_ASSERT(GC_mark_state == MS_NONE); for (i = 0; i < fo_size; i++) { for (curr_fo = fo_head[i]; curr_fo != 0; curr_fo = fo_next(curr_fo)) { GC_ASSERT(GC_size(curr_fo) >= sizeof(struct finalizable_object)); real_ptr = (ptr_t)REVEAL_POINTER(curr_fo -> fo_hidden_base); if (!GC_is_marked(real_ptr)) { GC_MARKED_FOR_FINALIZATION(real_ptr); GC_MARK_FO(real_ptr, curr_fo -> fo_mark_proc); if (GC_is_marked(real_ptr)) { WARN("Finalization cycle involving %lx\n", real_ptr); } } } } /* Enqueue for finalization all objects that are still */ /* unreachable. */ GC_bytes_finalized = 0; for (i = 0; i < fo_size; i++) { curr_fo = fo_head[i]; prev_fo = 0; while (curr_fo != 0) { real_ptr = (ptr_t)REVEAL_POINTER(curr_fo -> fo_hidden_base); if (!GC_is_marked(real_ptr)) { if (!GC_java_finalization) { GC_set_mark_bit(real_ptr); } /* Delete from hash table */ next_fo = fo_next(curr_fo); if (prev_fo == 0) { fo_head[i] = next_fo; } else { fo_set_next(prev_fo, next_fo); } GC_fo_entries--; /* Add to list of objects awaiting finalization. */ fo_set_next(curr_fo, GC_finalize_now); GC_finalize_now = curr_fo; /* unhide object pointer so any future collections will */ /* see it. */ curr_fo -> fo_hidden_base = (word) REVEAL_POINTER(curr_fo -> fo_hidden_base); GC_bytes_finalized += curr_fo -> fo_object_size + sizeof(struct finalizable_object); GC_ASSERT(GC_is_marked(GC_base((ptr_t)curr_fo))); curr_fo = next_fo; } else { prev_fo = curr_fo; curr_fo = fo_next(curr_fo); } } } if (GC_java_finalization) { /* make sure we mark everything reachable from objects finalized using the no_order mark_proc */ for (curr_fo = GC_finalize_now; curr_fo != NULL; curr_fo = fo_next(curr_fo)) { real_ptr = (ptr_t)curr_fo -> fo_hidden_base; if (!GC_is_marked(real_ptr)) { if (curr_fo -> fo_mark_proc == GC_null_finalize_mark_proc) { GC_MARK_FO(real_ptr, GC_normal_finalize_mark_proc); } if (curr_fo -> fo_mark_proc != GC_unreachable_finalize_mark_proc) { GC_set_mark_bit(real_ptr); } } } /* now revive finalize-when-unreachable objects reachable from other finalizable objects */ if (need_unreachable_finalization) { curr_fo = GC_finalize_now; prev_fo = 0; while (curr_fo != 0) { next_fo = fo_next(curr_fo); if (curr_fo -> fo_mark_proc == GC_unreachable_finalize_mark_proc) { real_ptr = (ptr_t)curr_fo -> fo_hidden_base; if (!GC_is_marked(real_ptr)) { GC_set_mark_bit(real_ptr); } else { if (prev_fo == 0) GC_finalize_now = next_fo; else fo_set_next(prev_fo, next_fo); curr_fo -> fo_hidden_base = (word) HIDE_POINTER(curr_fo -> fo_hidden_base); GC_bytes_finalized -= curr_fo -> fo_object_size + sizeof(struct finalizable_object); i = HASH2(real_ptr, log_fo_table_size); fo_set_next (curr_fo, fo_head[i]); GC_fo_entries++; fo_head[i] = curr_fo; curr_fo = prev_fo; } } prev_fo = curr_fo; curr_fo = next_fo; } } } /* Remove dangling disappearing links. */ for (i = 0; i < dl_size; i++) { curr_dl = dl_head[i]; prev_dl = 0; while (curr_dl != 0) { real_link = GC_base((ptr_t)REVEAL_POINTER(curr_dl -> dl_hidden_link)); if (real_link != 0 && !GC_is_marked(real_link)) { next_dl = dl_next(curr_dl); if (prev_dl == 0) { dl_head[i] = next_dl; } else { dl_set_next(prev_dl, next_dl); } GC_clear_mark_bit((ptr_t)curr_dl); GC_dl_entries--; curr_dl = next_dl; } else { prev_dl = curr_dl; curr_dl = dl_next(curr_dl); } } } } #ifndef JAVA_FINALIZATION_NOT_NEEDED /* Enqueue all remaining finalizers to be run - Assumes lock is * held, and signals are disabled */ void GC_enqueue_all_finalizers(void) { struct finalizable_object * curr_fo, * prev_fo, * next_fo; ptr_t real_ptr; register int i; int fo_size; fo_size = (log_fo_table_size == -1 ) ? 0 : (1 << log_fo_table_size); GC_bytes_finalized = 0; for (i = 0; i < fo_size; i++) { curr_fo = fo_head[i]; prev_fo = 0; while (curr_fo != 0) { real_ptr = (ptr_t)REVEAL_POINTER(curr_fo -> fo_hidden_base); GC_MARK_FO(real_ptr, GC_normal_finalize_mark_proc); GC_set_mark_bit(real_ptr); /* Delete from hash table */ next_fo = fo_next(curr_fo); if (prev_fo == 0) { fo_head[i] = next_fo; } else { fo_set_next(prev_fo, next_fo); } GC_fo_entries--; /* Add to list of objects awaiting finalization. */ fo_set_next(curr_fo, GC_finalize_now); GC_finalize_now = curr_fo; /* unhide object pointer so any future collections will */ /* see it. */ curr_fo -> fo_hidden_base = (word) REVEAL_POINTER(curr_fo -> fo_hidden_base); GC_bytes_finalized += curr_fo -> fo_object_size + sizeof(struct finalizable_object); curr_fo = next_fo; } } return; } /* Invoke all remaining finalizers that haven't yet been run. * This is needed for strict compliance with the Java standard, * which can make the runtime guarantee that all finalizers are run. * Unfortunately, the Java standard implies we have to keep running * finalizers until there are no more left, a potential infinite loop. * YUCK. * Note that this is even more dangerous than the usual Java * finalizers, in that objects reachable from static variables * may have been finalized when these finalizers are run. * Finalizers run at this point must be prepared to deal with a * mostly broken world. * This routine is externally callable, so is called without * the allocation lock. */ GC_API void GC_finalize_all(void) { DCL_LOCK_STATE; LOCK(); while (GC_fo_entries > 0) { GC_enqueue_all_finalizers(); UNLOCK(); GC_INVOKE_FINALIZERS(); LOCK(); } UNLOCK(); } #endif /* Returns true if it is worth calling GC_invoke_finalizers. (Useful if */ /* finalizers can only be called from some kind of `safe state' and */ /* getting into that safe state is expensive.) */ int GC_should_invoke_finalizers(void) { return GC_finalize_now != 0; } /* Invoke finalizers for all objects that are ready to be finalized. */ /* Should be called without allocation lock. */ int GC_invoke_finalizers(void) { struct finalizable_object * curr_fo; int count = 0; word bytes_freed_before; DCL_LOCK_STATE; while (GC_finalize_now != 0) { # ifdef THREADS LOCK(); # endif if (count == 0) { bytes_freed_before = GC_bytes_freed; /* Don't do this outside, since we need the lock. */ } curr_fo = GC_finalize_now; # ifdef THREADS if (curr_fo != 0) GC_finalize_now = fo_next(curr_fo); UNLOCK(); if (curr_fo == 0) break; # else GC_finalize_now = fo_next(curr_fo); # endif fo_set_next(curr_fo, 0); (*(curr_fo -> fo_fn))((ptr_t)(curr_fo -> fo_hidden_base), curr_fo -> fo_client_data); curr_fo -> fo_client_data = 0; ++count; # ifdef UNDEFINED /* This is probably a bad idea. It throws off accounting if */ /* nearly all objects are finalizable. O.w. it shouldn't */ /* matter. */ GC_free((void *)curr_fo); # endif } /* bytes_freed_before is initialized whenever count != 0 */ if (count != 0 && bytes_freed_before != GC_bytes_freed) { LOCK(); GC_finalizer_bytes_freed += (GC_bytes_freed - bytes_freed_before); UNLOCK(); } return count; } void (* GC_finalizer_notifier)() = (void (*) (void))0; static GC_word last_finalizer_notification = 0; void GC_notify_or_invoke_finalizers(void) { /* This is a convenient place to generate backtraces if appropriate, */ /* since that code is not callable with the allocation lock. */ # if defined(KEEP_BACK_PTRS) || defined(MAKE_BACK_GRAPH) static word last_back_trace_gc_no = 1; /* Skip first one. */ if (GC_gc_no > last_back_trace_gc_no) { word i; # ifdef KEEP_BACK_PTRS LOCK(); /* Stops when GC_gc_no wraps; that's OK. */ last_back_trace_gc_no = (word)(-1); /* disable others. */ for (i = 0; i < GC_backtraces; ++i) { /* FIXME: This tolerates concurrent heap mutation, */ /* which may cause occasional mysterious results. */ /* We need to release the GC lock, since GC_print_callers */ /* acquires it. It probably shouldn't. */ UNLOCK(); GC_generate_random_backtrace_no_gc(); LOCK(); } last_back_trace_gc_no = GC_gc_no; UNLOCK(); # endif # ifdef MAKE_BACK_GRAPH if (GC_print_back_height) GC_print_back_graph_stats(); # endif } # endif if (GC_finalize_now == 0) return; if (!GC_finalize_on_demand) { (void) GC_invoke_finalizers(); # ifndef THREADS GC_ASSERT(GC_finalize_now == 0); # endif /* Otherwise GC can run concurrently and add more */ return; } if (GC_finalizer_notifier != (void (*) (void))0 && last_finalizer_notification != GC_gc_no) { last_finalizer_notification = GC_gc_no; GC_finalizer_notifier(); } } void * GC_call_with_alloc_lock(GC_fn_type fn, void * client_data) { void * result; DCL_LOCK_STATE; # ifdef THREADS LOCK(); /* FIXME - This looks wrong!! */ SET_LOCK_HOLDER(); # endif result = (*fn)(client_data); # ifdef THREADS # ifndef GC_ASSERTIONS UNSET_LOCK_HOLDER(); # endif /* o.w. UNLOCK() does it implicitly */ UNLOCK(); # endif return(result); } #if !defined(NO_DEBUGGING) void GC_print_finalization_stats(void) { struct finalizable_object *fo = GC_finalize_now; size_t ready = 0; GC_printf("%u finalization table entries; %u disappearing links\n", GC_fo_entries, GC_dl_entries); for (; 0 != fo; fo = fo_next(fo)) ++ready; GC_printf("%u objects are eligible for immediate finalization\n", ready); } #endif /* NO_DEBUGGING */ synopsis-0.12/src/Synopsis/gc/WCC_MAKEFILE0000664000076400007640000001162211104702316017457 0ustar stefanstefan# Makefile for Watcom C/C++ 10.5, 10.6, 11.0 on NT, OS2 and DOS4GW. # May work with Watcom 10.0. # Uncoment one of the lines below for cross compilation. SYSTEM=MSWIN32 #SYSTEM=DOS4GW #SYSTEM=OS2 # The collector can be built either as dynamic or as static library. # Select the library type you need. #MAKE_AS_DLL=1 MAKE_AS_LIB=1 # Select calling conventions. # Possible choices are r and s. CALLING=s # Select target CPU. # Possible choices are 3, 4, 5, and 6. # The last choice available only since version 11.0. CPU=5 # Set optimization options. # Watcom before 11.0 does not support option "-oh". OPTIM=-oneatx -s #OPTIM=-ohneatx -s DEFS=-DALL_INTERIOR_POINTERS #-DSMALL_CONFIG #-DGC_DEBUG ##### !ifndef SYSTEM !ifdef __MSDOS__ SYSTEM=DOS4GW !else ifdef __NT__ SYSTEM=MSWIN32 !else ifdef __OS2__ SYSTEM=OS2 !else SYSTEM=Unknown !endif !endif !define $(SYSTEM) !ifdef DOS4GW SYSFLAG=-DDOS4GW -bt=dos !else ifdef MSWIN32 SYSFLAG=-DMSWIN32 -bt=nt !else ifdef OS2 SYSFLAG=-DOS2 -bt=os2 !else !error undefined or unsupported target platform: $(SYSTEM) !endif !ifdef MAKE_AS_DLL DLLFLAG=-bd -DGC_DLL TEST_DLLFLAG=-DGC_DLL !else ifdef MAKE_AS_LIB DLLFLAG= TEST_DLLFLAG= !else !error Either MAKE_AS_LIB or MAKE_AS_DLL should be defined !endif CC=wcc386 CXX=wpp386 # -DUSE_GENERIC is required ! CFLAGS=-$(CPU)$(CALLING) $(OPTIM) -zp4 -zc $(SYSFLAG) $(DLLFLAG) -DGC_BUILD -DUSE_GENERIC $(DEFS) CXXFLAGS= $(CFLAGS) TEST_CFLAGS=-$(CPU)$(CALLING) $(OPTIM) -zp4 -zc $(SYSFLAG) $(TEST_DLLFLAG) $(DEFS) TEST_CXXFLAGS= $(TEST_CFLAGS) OBJS= alloc.obj reclaim.obj allchblk.obj misc.obj & mach_dep.obj os_dep.obj mark_rts.obj headers.obj mark.obj & obj_map.obj blacklst.obj finalize.obj new_hblk.obj & dbg_mlc.obj malloc.obj stubborn.obj dyn_load.obj & typd_mlc.obj ptr_chck.obj mallocx.obj all: gc.lib gctest.exe test_cpp.exe !ifdef MAKE_AS_DLL gc.lib: gc.dll gc_cpp.obj *wlib -b -c -n -p=512 $@ +gc.dll +gc_cpp.obj gc.dll: $(OBJS) .AUTODEPEND @%create $*.lnk !ifdef DOS4GW @%append $*.lnk sys os2v2_dll !else ifdef MSWIN32 @%append $*.lnk sys nt_dll !else ifdef OS2 @%append $*.lnk sys os2v2_dll !endif @%append $*.lnk name $* @for %i in ($(OBJS)) do @%append $*.lnk file '%i' !ifeq CALLING s @%append $*.lnk export GC_is_marked @%append $*.lnk export GC_incr_bytes_allocd @%append $*.lnk export GC_incr_bytes_freed @%append $*.lnk export GC_generic_malloc_words_small !else @%append $*.lnk export GC_is_marked_ @%append $*.lnk export GC_incr_bytes_allocd_ @%append $*.lnk export GC_incr_bytes_freed_ @%append $*.lnk export GC_generic_malloc_words_small_ !endif *wlink @$*.lnk !else gc.lib: $(OBJS) gc_cpp.obj @%create $*.lb1 @for %i in ($(OBJS)) do @%append $*.lb1 +'%i' @%append $*.lb1 +'gc_cpp.obj' *wlib -b -c -n -p=512 $@ @$*.lb1 !endif gctest.exe: test.obj gc.lib %create $*.lnk !ifdef DOS4GW @%append $*.lnk sys dos4g !else ifdef MSWIN32 @%append $*.lnk sys nt !else ifdef OS2 @%append $*.lnk sys os2v2 !endif @%append $*.lnk op case @%append $*.lnk op stack=256K @%append $*.lnk name $* @%append $*.lnk file test.obj @%append $*.lnk library gc.lib !ifdef MAKE_AS_DLL !ifeq CALLING s @%append $*.lnk import GC_is_marked gc !else @%append $*.lnk import GC_is_marked_ gc !endif !endif *wlink @$*.lnk test_cpp.exe: test_cpp.obj gc.lib %create $*.lnk !ifdef DOS4GW @%append $*.lnk sys dos4g !else ifdef MSWIN32 @%append $*.lnk sys nt !else ifdef OS2 @%append $*.lnk sys os2v2 !endif @%append $*.lnk op case @%append $*.lnk op stack=256K @%append $*.lnk name $* @%append $*.lnk file test_cpp.obj @%append $*.lnk library gc.lib !ifdef MAKE_AS_DLL !ifeq CALLING s @%append $*.lnk import GC_incr_bytes_allocd gc @%append $*.lnk import GC_incr_bytes_freed gc @%append $*.lnk import GC_generic_malloc_words_small gc !else @%append $*.lnk import GC_incr_bytes_allocd_ gc @%append $*.lnk import GC_incr_bytes_freed_ gc @%append $*.lnk import GC_generic_malloc_words_small_ gc !endif !endif *wlink @$*.lnk gc_cpp.obj: gc_cpp.cc .AUTODEPEND $(CXX) $(TEST_CXXFLAGS) -iinclude $*.cc test.obj: tests\test.c .AUTODEPEND $(CC) $(TEST_CFLAGS) $*.c test_cpp.obj: tests\test_cpp.cc .AUTODEPEND $(CXX) $(TEST_CXXFLAGS) -iinclude $*.cc .c.obj: .AUTODEPEND $(CC) $(CFLAGS) $*.c .cc.obj: .AUTODEPEND $(CXX) $(CXXFLAGS) $*.cc clean : .SYMBOLIC @if exist *.obj del *.obj @if exist *.map del *.map @if exist *.lnk del *.lnk @if exist *.lb1 del *.lb1 @if exist *.sym del *.sym @if exist *.err del *.err @if exist *.tmp del *.tmp @if exist *.lst del *.lst @if exist *.exe del *.exe @if exist *.log del *.log @if exist *.lib del *.lib @if exist *.dll del *.dll synopsis-0.12/src/Synopsis/gc/sparc_netbsd_mach_dep.s0000664000076400007640000000161311104702316022335 0ustar stefanstefan! SPARCompiler 3.0 and later apparently no longer handles ! asm outside functions. So we need a separate .s file ! This is only set up for SunOS 4. ! Assumes this is called before the stack contents are ! examined. #include "machine/asm.h" .seg "text" .globl _C_LABEL(GC_save_regs_in_stack) .globl _C_LABEL(GC_push_regs) _C_LABEL(GC_save_regs_in_stack): _C_LABEL(GC_push_regs): ta 0x3 ! ST_FLUSH_WINDOWS mov %sp,%o0 retl nop .globl _C_LABEL(GC_clear_stack_inner) _C_LABEL(GC_clear_stack_inner): mov %sp,%o2 ! Save sp add %sp,-8,%o3 ! p = sp-8 clr %g1 ! [g0,g1] = 0 add %o1,-0x60,%sp ! Move sp out of the way, ! so that traps still work. ! Includes some extra words ! so we can be sloppy below. loop: std %g0,[%o3] ! *(long long *)p = 0 cmp %o3,%o1 bgu loop ! if (p > limit) goto loop add %o3,-8,%o3 ! p -= 8 (delay slot) retl mov %o2,%sp ! Restore sp., delay slot synopsis-0.12/src/Synopsis/gc/Makefile.DLLs0000664000076400007640000000753411104702321020123 0ustar stefanstefan#-----------------------------------------------------------------------------# # Makefile.DLLs, version 0.4. # Contributed by Fergus Henderson. # This Makefile contains rules for creating DLLs on Windows using gnu-win32. #-----------------------------------------------------------------------------# # This rule creates a `.def' file, which lists the symbols that are exported # from the DLL. We use `nm' to get a list of all the exported text (`T') # symbols and data symbols -- including uninitialized data (`B'), # initialized data (`D'), read-only data (`R'), and common blocks (`C'). %.def: %.a echo EXPORTS > $@ nm $< | grep '^........ [BCDRT] _' | sed 's/[^_]*_//' >> $@ # We need to use macros to access global data: # the user of the DLL must refer to `foo' as `(*__imp_foo)'. # This rule creates a `_globals.h' file, which contains macros # for doing this. SYM_PREFIX = $(firstword $(SYM_PREFIX-$*) $*) DLL_MACRO = $(SYM_PREFIX)_USE_DLL IMP_MACRO = $(SYM_PREFIX)_IMP GLOBAL_MACRO = $(SYM_PREFIX)_GLOBAL %_globals.h: %.a echo "/* automatically generated by Makefile.DLLs */" > $@ echo "#if defined(__GNUC__) && defined(_WIN32) \\" >> $@ echo " && defined($(DLL_MACRO))" >> $@ echo "# define $(IMP_MACRO)(name) __imp_##name" >> $@ echo "# define $(GLOBAL_MACRO)(name) (*$(IMP_MACRO)(name))" >> $@ echo "#else" >> $@ echo "# define $(GLOBAL_MACRO)(name) name" >> $@ echo "#endif" >> $@ echo "" >> $@ for sym in `nm $< | grep '^........ [BCDR] _' | sed 's/[^_]*_//'`; do \ echo "#define $$sym $(GLOBAL_MACRO)($$sym)" >> $@; \ done # This rule creates the export object file (`foo.exp') which contains the # jump table array; this export object file becomes part of the DLL. # This rule also creates the import library (`foo_dll.a') which contains small # stubs for all the functions exported by the DLL which jump to them via the # jump table. Executables that will use the DLL must be linked against this # stub library. %.exp %_dll.a : %.def dlltool $(DLLTOOLFLAGS) $(DLLTOOLFLAGS-$*) \ --def $< \ --dllname $*.dll \ --output-exp $*.exp \ --output-lib $*_dll.a # The `sed' commands below are to convert DOS-style `C:\foo\bar' # pathnames into Unix-style `//c/foo/bar' pathnames. CYGWIN32_LIBS = $(shell echo \ -L`dirname \`gcc -print-file-name=libgcc.a | \ sed -e 's@^\\\\([A-Za-z]\\\\):@//\\\\1@g' -e 's@\\\\\\\\@/@g' \` ` \ -L`dirname \`gcc -print-file-name=libcygwin.a | \ sed -e 's@^\\\\([A-Za-z]\\\\):@//\\\\1@g' -e 's@\\\\\\\\@/@g' \` ` \ -L`dirname \`gcc -print-file-name=libkernel32.a | \ sed -e 's@^\\\\([A-Za-z]\\\\):@//\\\\1@g' -e 's@\\\\\\\\@/@g' \` ` \ -lgcc -lcygwin -lkernel32 -lgcc) RELOCATABLE=yes ifeq "$(strip $(RELOCATABLE))" "yes" # to create relocatable DLLs, we need to do two passes %.dll: %.exp %.a dll_fixup.o dll_init.o $(LD) $(LDFLAGS) $(LDFLAGS-$*) --dll -o $*.base \ -e _dll_entry@12 dll_init.o \ dll_fixup.o $*.exp $*.a \ $(LDLIBS) $(LDLIBS-$*) \ $(CYGWIN32_LIBS) $(LD) $(LDFLAGS) $(LDFLAGS-$*) --dll --base-file $*.base -o $@ \ -e _dll_entry@12 dll_init.o \ dll_fixup.o $*.exp $*.a \ $(LDLIBS) $(LDLIBS-$*) \ $(CYGWIN32_LIBS) rm -f $*.base else %.dll: %.exp %.a dll_fixup.o dll_init.o $(LD) $(LDFLAGS) $(LDFLAGS-$*) --dll -o $@ \ -e _dll_entry@12 dll_init.o \ dll_fixup.o $*.exp $*.a \ $(LDLIBS) $(LDLIBS-$*) \ $(CYGWIN32_LIBS) endif # This black magic piece of assembler needs to be linked in in order to # properly terminate the list of imported DLLs. dll_fixup.s: echo '.section .idata$$3' > dll_fixup.s echo '.long 0,0,0,0, 0,0,0,0' >> dll_fixup.s # This bit is necessary to provide an initialization function for the DLL. dll_init.c: echo '__attribute__((stdcall))' > dll_init.c echo 'int dll_entry(int handle, int reason, void *ptr)' >> dll_init.c echo '{return 1; }' >> dll_init.c dont_throw_away: dll_fixup.o dll_init.o synopsis-0.12/src/Synopsis/gc/ltmain.sh0000664000076400007640000057753011104702316017522 0ustar stefanstefan# 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.22 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" # 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= duplicate_deps=no preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" ##################################### # Shell function definitions: # This seems to be the best place for them # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $mkdir "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || { $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 exit $EXIT_FAILURE } fi $echo "X$my_tmpdir" | $Xsed } # 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 /{s,.*,import,;p;q;};}'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac 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 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 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 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 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" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then exit $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\" disable_libs=no # 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 preserve_args="$preserve_args --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 case $disable_libs in no) ;; shared) build_libtool_libs=no build_old_libs=yes ;; static) build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` ;; esac # 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 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 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. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 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 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qlibobj="\"$qlibobj\"" ;; esac test "X$libobj" != "X$qlibobj" \ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." 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 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 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 prefer_static_libs=yes else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built fi build_libtool_libs=no build_old_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 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 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 else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" 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|darwin_framework_skip) test "$prev" = "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|-arch|-isysroot) case " $CC " in *" ${arg} ${1} "* | *" ${arg} ${1} "*) prev=darwin_framework_skip ;; *) compiler_flags="$compiler_flags $arg" prev=darwin_framework ;; esac 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 absdir="$dir" notinst_path="$notinst_path $dir" 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*) testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-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 ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && 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 # -m*, -t[45]*, -txscale* pass through architecture-specific # compiler args for GCC # -pg pass through profiling flag for GCC # @file GCC response files -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ -t[45]*|-txscale*|@*) # 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 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" compiler_flags="$compiler_flags $arg" 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 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 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 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 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 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 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 else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" 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 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 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 exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then exit $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 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' or unhandled argument \`$deplib'" 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 $absdir" ;; 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 use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes ; then use_static_libs=no fi if test -n "$library_names" && { test "$use_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.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) 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 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. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # 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 # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done deplibs="$new_libs" # 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" linknames= 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=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break 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" : ".*" 2>/dev/null` && 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" : ".*" 2>/dev/null` && 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" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_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 $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi 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 # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done compile_deplibs="$new_libs" 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*) testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; 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"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac 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"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac 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 $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -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. case $host in *cygwin* | *mingw* ) if test -f "$output_objdir/${outputname}.def" ; then compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` else 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}%"` fi ;; * ) 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}%"` ;; esac ;; *) $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" exit_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 $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* ) output_name=`basename $output` output_path=`dirname $output` cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #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 '/' # define PATH_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 # ifndef PATH_SEPARATOR_2 # define PATH_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 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) /* -DDEBUG is fairly common in CFLAGS. */ #undef DEBUG #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); const char * base_name (const char *name); char * find_executable(const char *wrapper); int check_executable(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 (base_name (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* 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; for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" return 127; } 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 ; } const char * base_name (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha ((unsigned char)name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } 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 $LTCFLAGS -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" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$gentop"; then exit $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" : ".*" 2>/dev/null` && 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" | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 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 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 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) case " $install_prog " in *[\\\ /]cp\ *) ;; *) prev=$arg ;; esac ;; -g | -m | -o) prev=$arg ;; -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 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 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. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $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" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_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= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; 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= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir=`func_mktempdir` 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 anyway 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 "X----------------------------------------------------------------------" | $Xsed $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 "X----------------------------------------------------------------------" | $Xsed 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" case "$mode" in clean) case " $library_names " in # " " in the beginning catches empty $dlname *" $dlname "*) ;; *) rmfiles="$rmfiles $objdir/$dlname" ;; esac test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" ;; uninstall) 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. ;; esac 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 disable_libs=shared # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static disable_libs=static # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: synopsis-0.12/src/Synopsis/gc/config.guess0000775000076400007640000012625711104702315020215 0ustar stefanstefan#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2006-06-06' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerppc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[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 ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; x86:Interix*:[345]*) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T:Interix*:[345]*) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; 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 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: synopsis-0.12/src/Synopsis/gc/mark.c0000664000076400007640000016544011104702316016771 0ustar stefanstefan /* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved. * Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */ # include # include "private/gc_pmark.h" #if defined(MSWIN32) && defined(__GNUC__) # include #endif /* We put this here to minimize the risk of inlining. */ /*VARARGS*/ #ifdef __WATCOMC__ void GC_noop(void *p, ...) {} #else void GC_noop() {} #endif /* Single argument version, robust against whole program analysis. */ void GC_noop1(word x) { static volatile word sink; sink = x; } /* mark_proc GC_mark_procs[MAX_MARK_PROCS] = {0} -- declared in gc_priv.h */ unsigned GC_n_mark_procs = GC_RESERVED_MARK_PROCS; /* Initialize GC_obj_kinds properly and standard free lists properly. */ /* This must be done statically since they may be accessed before */ /* GC_init is called. */ /* It's done here, since we need to deal with mark descriptors. */ struct obj_kind GC_obj_kinds[MAXOBJKINDS] = { /* PTRFREE */ { &GC_aobjfreelist[0], 0 /* filled in dynamically */, 0 | GC_DS_LENGTH, FALSE, FALSE }, /* NORMAL */ { &GC_objfreelist[0], 0, 0 | GC_DS_LENGTH, /* Adjusted in GC_init_inner for EXTRA_BYTES */ TRUE /* add length to descr */, TRUE }, /* UNCOLLECTABLE */ { &GC_uobjfreelist[0], 0, 0 | GC_DS_LENGTH, TRUE /* add length to descr */, TRUE }, # ifdef ATOMIC_UNCOLLECTABLE /* AUNCOLLECTABLE */ { &GC_auobjfreelist[0], 0, 0 | GC_DS_LENGTH, FALSE /* add length to descr */, FALSE }, # endif # ifdef STUBBORN_ALLOC /*STUBBORN*/ { &GC_sobjfreelist[0], 0, 0 | GC_DS_LENGTH, TRUE /* add length to descr */, TRUE }, # endif }; # ifdef ATOMIC_UNCOLLECTABLE # ifdef STUBBORN_ALLOC unsigned GC_n_kinds = 5; # else unsigned GC_n_kinds = 4; # endif # else # ifdef STUBBORN_ALLOC unsigned GC_n_kinds = 4; # else unsigned GC_n_kinds = 3; # endif # endif # ifndef INITIAL_MARK_STACK_SIZE # define INITIAL_MARK_STACK_SIZE (1*HBLKSIZE) /* INITIAL_MARK_STACK_SIZE * sizeof(mse) should be a */ /* multiple of HBLKSIZE. */ /* The incremental collector actually likes a larger */ /* size, since it want to push all marked dirty objs */ /* before marking anything new. Currently we let it */ /* grow dynamically. */ # endif /* * Limits of stack for GC_mark routine. * All ranges between GC_mark_stack(incl.) and GC_mark_stack_top(incl.) still * need to be marked from. */ word GC_n_rescuing_pages; /* Number of dirty pages we marked from */ /* excludes ptrfree pages, etc. */ mse * GC_mark_stack; mse * GC_mark_stack_limit; size_t GC_mark_stack_size = 0; #ifdef PARALLEL_MARK # include "atomic_ops.h" mse * volatile GC_mark_stack_top; /* Updated only with mark lock held, but read asynchronously. */ volatile AO_t GC_first_nonempty; /* Lowest entry on mark stack */ /* that may be nonempty. */ /* Updated only by initiating */ /* thread. */ #else mse * GC_mark_stack_top; #endif static struct hblk * scan_ptr; mark_state_t GC_mark_state = MS_NONE; GC_bool GC_mark_stack_too_small = FALSE; GC_bool GC_objects_are_marked = FALSE; /* Are there collectable marked */ /* objects in the heap? */ /* Is a collection in progress? Note that this can return true in the */ /* nonincremental case, if a collection has been abandoned and the */ /* mark state is now MS_INVALID. */ GC_bool GC_collection_in_progress(void) { return(GC_mark_state != MS_NONE); } /* clear all mark bits in the header */ void GC_clear_hdr_marks(hdr *hhdr) { size_t last_bit = FINAL_MARK_BIT(hhdr -> hb_sz); # ifdef USE_MARK_BYTES BZERO(hhdr -> hb_marks, MARK_BITS_SZ); hhdr -> hb_marks[last_bit] = 1; # else BZERO(hhdr -> hb_marks, MARK_BITS_SZ*sizeof(word)); set_mark_bit_from_hdr(hhdr, last_bit); # endif hhdr -> hb_n_marks = 0; } /* Set all mark bits in the header. Used for uncollectable blocks. */ void GC_set_hdr_marks(hdr *hhdr) { unsigned i; size_t sz = hhdr -> hb_sz; size_t n_marks = FINAL_MARK_BIT(sz); # ifdef USE_MARK_BYTES for (i = 0; i <= n_marks; i += MARK_BIT_OFFSET(sz)) { hhdr -> hb_marks[i] = 1; } # else for (i = 0; i < divWORDSZ(n_marks + WORDSZ); ++i) { hhdr -> hb_marks[i] = ONES; } # endif # ifdef MARK_BIT_PER_OBJ hhdr -> hb_n_marks = n_marks - 1; # else hhdr -> hb_n_marks = HBLK_OBJS(sz); # endif } /* * Clear all mark bits associated with block h. */ /*ARGSUSED*/ static void clear_marks_for_block(struct hblk *h, word dummy) { register hdr * hhdr = HDR(h); if (IS_UNCOLLECTABLE(hhdr -> hb_obj_kind)) return; /* Mark bit for these is cleared only once the object is */ /* explicitly deallocated. This either frees the block, or */ /* the bit is cleared once the object is on the free list. */ GC_clear_hdr_marks(hhdr); } /* Slow but general routines for setting/clearing/asking about mark bits */ void GC_set_mark_bit(ptr_t p) { struct hblk *h = HBLKPTR(p); hdr * hhdr = HDR(h); word bit_no = MARK_BIT_NO(p - (ptr_t)h, hhdr -> hb_sz); if (!mark_bit_from_hdr(hhdr, bit_no)) { set_mark_bit_from_hdr(hhdr, bit_no); ++hhdr -> hb_n_marks; } } void GC_clear_mark_bit(ptr_t p) { struct hblk *h = HBLKPTR(p); hdr * hhdr = HDR(h); word bit_no = MARK_BIT_NO(p - (ptr_t)h, hhdr -> hb_sz); if (mark_bit_from_hdr(hhdr, bit_no)) { size_t n_marks; clear_mark_bit_from_hdr(hhdr, bit_no); n_marks = hhdr -> hb_n_marks - 1; # ifdef PARALLEL_MARK if (n_marks != 0) hhdr -> hb_n_marks = n_marks; /* Don't decrement to zero. The counts are approximate due to */ /* concurrency issues, but we need to ensure that a count of */ /* zero implies an empty block. */ # else hhdr -> hb_n_marks = n_marks; # endif } } GC_bool GC_is_marked(ptr_t p) { struct hblk *h = HBLKPTR(p); hdr * hhdr = HDR(h); word bit_no = MARK_BIT_NO(p - (ptr_t)h, hhdr -> hb_sz); return((GC_bool)mark_bit_from_hdr(hhdr, bit_no)); } /* * Clear mark bits in all allocated heap blocks. This invalidates * the marker invariant, and sets GC_mark_state to reflect this. * (This implicitly starts marking to reestablish the invariant.) */ void GC_clear_marks(void) { GC_apply_to_all_blocks(clear_marks_for_block, (word)0); GC_objects_are_marked = FALSE; GC_mark_state = MS_INVALID; scan_ptr = 0; } /* Initiate a garbage collection. Initiates a full collection if the */ /* mark state is invalid. */ /*ARGSUSED*/ void GC_initiate_gc(void) { if (GC_dirty_maintained) GC_read_dirty(); # ifdef STUBBORN_ALLOC GC_read_changed(); # endif # ifdef CHECKSUMS { extern void GC_check_dirty(); if (GC_dirty_maintained) GC_check_dirty(); } # endif GC_n_rescuing_pages = 0; if (GC_mark_state == MS_NONE) { GC_mark_state = MS_PUSH_RESCUERS; } else if (GC_mark_state != MS_INVALID) { ABORT("unexpected state"); } /* else this is really a full collection, and mark */ /* bits are invalid. */ scan_ptr = 0; } static void alloc_mark_stack(size_t); # if defined(MSWIN32) || defined(USE_PROC_FOR_LIBRARIES) && defined(THREADS) /* Under rare conditions, we may end up marking from nonexistent memory. */ /* Hence we need to be prepared to recover by running GC_mark_some */ /* with a suitable handler in place. */ # define WRAP_MARK_SOME # endif /* Perform a small amount of marking. */ /* We try to touch roughly a page of memory. */ /* Return TRUE if we just finished a mark phase. */ /* Cold_gc_frame is an address inside a GC frame that */ /* remains valid until all marking is complete. */ /* A zero value indicates that it's OK to miss some */ /* register values. */ /* We hold the allocation lock. In the case of */ /* incremental collection, the world may not be stopped.*/ #ifdef WRAP_MARK_SOME /* For win32, this is called after we establish a structured */ /* exception handler, in case Windows unmaps one of our root */ /* segments. See below. In either case, we acquire the */ /* allocator lock long before we get here. */ GC_bool GC_mark_some_inner(ptr_t cold_gc_frame) #else GC_bool GC_mark_some(ptr_t cold_gc_frame) #endif { switch(GC_mark_state) { case MS_NONE: return(FALSE); case MS_PUSH_RESCUERS: if (GC_mark_stack_top >= GC_mark_stack_limit - INITIAL_MARK_STACK_SIZE/2) { /* Go ahead and mark, even though that might cause us to */ /* see more marked dirty objects later on. Avoid this */ /* in the future. */ GC_mark_stack_too_small = TRUE; MARK_FROM_MARK_STACK(); return(FALSE); } else { scan_ptr = GC_push_next_marked_dirty(scan_ptr); if (scan_ptr == 0) { if (GC_print_stats) { GC_log_printf("Marked from %u dirty pages\n", GC_n_rescuing_pages); } GC_push_roots(FALSE, cold_gc_frame); GC_objects_are_marked = TRUE; if (GC_mark_state != MS_INVALID) { GC_mark_state = MS_ROOTS_PUSHED; } } } return(FALSE); case MS_PUSH_UNCOLLECTABLE: if (GC_mark_stack_top >= GC_mark_stack + GC_mark_stack_size/4) { # ifdef PARALLEL_MARK /* Avoid this, since we don't parallelize the marker */ /* here. */ if (GC_parallel) GC_mark_stack_too_small = TRUE; # endif MARK_FROM_MARK_STACK(); return(FALSE); } else { scan_ptr = GC_push_next_marked_uncollectable(scan_ptr); if (scan_ptr == 0) { GC_push_roots(TRUE, cold_gc_frame); GC_objects_are_marked = TRUE; if (GC_mark_state != MS_INVALID) { GC_mark_state = MS_ROOTS_PUSHED; } } } return(FALSE); case MS_ROOTS_PUSHED: # ifdef PARALLEL_MARK /* In the incremental GC case, this currently doesn't */ /* quite do the right thing, since it runs to */ /* completion. On the other hand, starting a */ /* parallel marker is expensive, so perhaps it is */ /* the right thing? */ /* Eventually, incremental marking should run */ /* asynchronously in multiple threads, without grabbing */ /* the allocation lock. */ if (GC_parallel) { GC_do_parallel_mark(); GC_ASSERT(GC_mark_stack_top < (mse *)GC_first_nonempty); GC_mark_stack_top = GC_mark_stack - 1; if (GC_mark_stack_too_small) { alloc_mark_stack(2*GC_mark_stack_size); } if (GC_mark_state == MS_ROOTS_PUSHED) { GC_mark_state = MS_NONE; return(TRUE); } else { return(FALSE); } } # endif if (GC_mark_stack_top >= GC_mark_stack) { MARK_FROM_MARK_STACK(); return(FALSE); } else { GC_mark_state = MS_NONE; if (GC_mark_stack_too_small) { alloc_mark_stack(2*GC_mark_stack_size); } return(TRUE); } case MS_INVALID: case MS_PARTIALLY_INVALID: if (!GC_objects_are_marked) { GC_mark_state = MS_PUSH_UNCOLLECTABLE; return(FALSE); } if (GC_mark_stack_top >= GC_mark_stack) { MARK_FROM_MARK_STACK(); return(FALSE); } if (scan_ptr == 0 && GC_mark_state == MS_INVALID) { /* About to start a heap scan for marked objects. */ /* Mark stack is empty. OK to reallocate. */ if (GC_mark_stack_too_small) { alloc_mark_stack(2*GC_mark_stack_size); } GC_mark_state = MS_PARTIALLY_INVALID; } scan_ptr = GC_push_next_marked(scan_ptr); if (scan_ptr == 0 && GC_mark_state == MS_PARTIALLY_INVALID) { GC_push_roots(TRUE, cold_gc_frame); GC_objects_are_marked = TRUE; if (GC_mark_state != MS_INVALID) { GC_mark_state = MS_ROOTS_PUSHED; } } return(FALSE); default: ABORT("GC_mark_some: bad state"); return(FALSE); } } #if defined(MSWIN32) && defined(__GNUC__) typedef struct { EXCEPTION_REGISTRATION ex_reg; void *alt_path; } ext_ex_regn; static EXCEPTION_DISPOSITION mark_ex_handler( struct _EXCEPTION_RECORD *ex_rec, void *est_frame, struct _CONTEXT *context, void *disp_ctxt) { if (ex_rec->ExceptionCode == STATUS_ACCESS_VIOLATION) { ext_ex_regn *xer = (ext_ex_regn *)est_frame; /* Unwind from the inner function assuming the standard */ /* function prologue. */ /* Assumes code has not been compiled with */ /* -fomit-frame-pointer. */ context->Esp = context->Ebp; context->Ebp = *((DWORD *)context->Esp); context->Esp = context->Esp - 8; /* Resume execution at the "real" handler within the */ /* wrapper function. */ context->Eip = (DWORD )(xer->alt_path); return ExceptionContinueExecution; } else { return ExceptionContinueSearch; } } # endif /* __GNUC__ && MSWIN32 */ #ifdef GC_WIN32_THREADS extern GC_bool GC_started_thread_while_stopped(void); /* In win32_threads.c. Did we invalidate mark phase with an */ /* unexpected thread start? */ #endif # ifdef WRAP_MARK_SOME GC_bool GC_mark_some(ptr_t cold_gc_frame) { GC_bool ret_val; # ifdef MSWIN32 # ifndef __GNUC__ /* Windows 98 appears to asynchronously create and remove */ /* writable memory mappings, for reasons we haven't yet */ /* understood. Since we look for writable regions to */ /* determine the root set, we may try to mark from an */ /* address range that disappeared since we started the */ /* collection. Thus we have to recover from faults here. */ /* This code does not appear to be necessary for Windows */ /* 95/NT/2000. Note that this code should never generate */ /* an incremental GC write fault. */ /* It's conceivable that this is the same issue with */ /* terminating threads that we see with Linux and */ /* USE_PROC_FOR_LIBRARIES. */ __try { ret_val = GC_mark_some_inner(cold_gc_frame); } __except (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { goto handle_ex; } # ifdef GC_WIN32_THREADS /* With DllMain-based thread tracking, a thread may have */ /* started while we were marking. This is logically equivalent */ /* to the exception case; our results are invalid and we have */ /* to start over. This cannot be prevented since we can't */ /* block in DllMain. */ if (GC_started_thread_while_stopped()) goto handle_ex; # endif rm_handler: return ret_val; # else /* __GNUC__ */ /* Manually install an exception handler since GCC does */ /* not yet support Structured Exception Handling (SEH) on */ /* Win32. */ ext_ex_regn er; er.alt_path = &&handle_ex; er.ex_reg.handler = mark_ex_handler; asm volatile ("movl %%fs:0, %0" : "=r" (er.ex_reg.prev)); asm volatile ("movl %0, %%fs:0" : : "r" (&er)); ret_val = GC_mark_some_inner(cold_gc_frame); /* Prevent GCC from considering the following code unreachable */ /* and thus eliminating it. */ if (er.alt_path == 0) goto handle_ex; rm_handler: /* Uninstall the exception handler */ asm volatile ("mov %0, %%fs:0" : : "r" (er.ex_reg.prev)); return ret_val; # endif /* __GNUC__ */ # else /* !MSWIN32 */ /* Here we are handling the case in which /proc is used for root */ /* finding, and we have threads. We may find a stack for a */ /* thread that is in the process of exiting, and disappears */ /* while we are marking it. This seems extremely difficult to */ /* avoid otherwise. */ if (GC_incremental) WARN("Incremental GC incompatible with /proc roots\n", 0); /* I'm not sure if this could still work ... */ GC_setup_temporary_fault_handler(); if(SETJMP(GC_jmp_buf) != 0) goto handle_ex; ret_val = GC_mark_some_inner(cold_gc_frame); rm_handler: GC_reset_fault_handler(); return ret_val; # endif /* !MSWIN32 */ handle_ex: /* Exception handler starts here for all cases. */ if (GC_print_stats) { GC_log_printf("Caught ACCESS_VIOLATION in marker. " "Memory mapping disappeared.\n"); } /* We have bad roots on the stack. Discard mark stack. */ /* Rescan from marked objects. Redetermine roots. */ GC_invalidate_mark_state(); scan_ptr = 0; ret_val = FALSE; goto rm_handler; // Back to platform-specific code. } #endif /* WRAP_MARK_SOME */ GC_bool GC_mark_stack_empty(void) { return(GC_mark_stack_top < GC_mark_stack); } void GC_invalidate_mark_state(void) { GC_mark_state = MS_INVALID; GC_mark_stack_top = GC_mark_stack-1; } mse * GC_signal_mark_stack_overflow(mse *msp) { GC_mark_state = MS_INVALID; GC_mark_stack_too_small = TRUE; if (GC_print_stats) { GC_log_printf("Mark stack overflow; current size = %lu entries\n", GC_mark_stack_size); } return(msp - GC_MARK_STACK_DISCARDS); } /* * Mark objects pointed to by the regions described by * mark stack entries between mark_stack and mark_stack_top, * inclusive. Assumes the upper limit of a mark stack entry * is never 0. A mark stack entry never has size 0. * We try to traverse on the order of a hblk of memory before we return. * Caller is responsible for calling this until the mark stack is empty. * Note that this is the most performance critical routine in the * collector. Hence it contains all sorts of ugly hacks to speed * things up. In particular, we avoid procedure calls on the common * path, we take advantage of peculiarities of the mark descriptor * encoding, we optionally maintain a cache for the block address to * header mapping, we prefetch when an object is "grayed", etc. */ mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack, mse *mark_stack_limit) { signed_word credit = HBLKSIZE; /* Remaining credit for marking work */ ptr_t current_p; /* Pointer to current candidate ptr. */ word current; /* Candidate pointer. */ ptr_t limit; /* (Incl) limit of current candidate */ /* range */ word descr; ptr_t greatest_ha = GC_greatest_plausible_heap_addr; ptr_t least_ha = GC_least_plausible_heap_addr; DECLARE_HDR_CACHE; # define SPLIT_RANGE_WORDS 128 /* Must be power of 2. */ GC_objects_are_marked = TRUE; INIT_HDR_CACHE; # ifdef OS2 /* Use untweaked version to circumvent compiler problem */ while (mark_stack_top >= mark_stack && credit >= 0) { # else while ((((ptr_t)mark_stack_top - (ptr_t)mark_stack) | credit) >= 0) { # endif current_p = mark_stack_top -> mse_start; descr = mark_stack_top -> mse_descr; retry: /* current_p and descr describe the current object. */ /* *mark_stack_top is vacant. */ /* The following is 0 only for small objects described by a simple */ /* length descriptor. For many applications this is the common */ /* case, so we try to detect it quickly. */ if (descr & ((~(WORDS_TO_BYTES(SPLIT_RANGE_WORDS) - 1)) | GC_DS_TAGS)) { word tag = descr & GC_DS_TAGS; switch(tag) { case GC_DS_LENGTH: /* Large length. */ /* Process part of the range to avoid pushing too much on the */ /* stack. */ GC_ASSERT(descr < (word)GC_greatest_plausible_heap_addr - (word)GC_least_plausible_heap_addr); # ifdef ENABLE_TRACE if (GC_trace_addr >= current_p && GC_trace_addr < current_p + descr) { GC_log_printf("GC:%d Large section; start %p len %lu\n", GC_gc_no, current_p, (unsigned long) descr); } # endif /* ENABLE_TRACE */ # ifdef PARALLEL_MARK # define SHARE_BYTES 2048 if (descr > SHARE_BYTES && GC_parallel && mark_stack_top < mark_stack_limit - 1) { int new_size = (descr/2) & ~(sizeof(word)-1); mark_stack_top -> mse_start = current_p; mark_stack_top -> mse_descr = new_size + sizeof(word); /* makes sure we handle */ /* misaligned pointers. */ mark_stack_top++; # ifdef ENABLE_TRACE if (GC_trace_addr >= current_p && GC_trace_addr < current_p + descr) { GC_log_printf("GC:%d splitting (parallel) %p at %p\n", GC_gc_no, current_p, current_p + new_size); } # endif /* ENABLE_TRACE */ current_p += new_size; descr -= new_size; goto retry; } # endif /* PARALLEL_MARK */ mark_stack_top -> mse_start = limit = current_p + WORDS_TO_BYTES(SPLIT_RANGE_WORDS-1); mark_stack_top -> mse_descr = descr - WORDS_TO_BYTES(SPLIT_RANGE_WORDS-1); # ifdef ENABLE_TRACE if (GC_trace_addr >= current_p && GC_trace_addr < current_p + descr) { GC_log_printf("GC:%d splitting %p at %p\n", GC_gc_no, current_p, limit); } # endif /* ENABLE_TRACE */ /* Make sure that pointers overlapping the two ranges are */ /* considered. */ limit += sizeof(word) - ALIGNMENT; break; case GC_DS_BITMAP: mark_stack_top--; # ifdef ENABLE_TRACE if (GC_trace_addr >= current_p && GC_trace_addr < current_p + WORDS_TO_BYTES(WORDSZ-2)) { GC_log_printf("GC:%d Tracing from %p bitmap descr %lu\n", GC_gc_no, current_p, (unsigned long) descr); } # endif /* ENABLE_TRACE */ descr &= ~GC_DS_TAGS; credit -= WORDS_TO_BYTES(WORDSZ/2); /* guess */ while (descr != 0) { if ((signed_word)descr < 0) { current = *(word *)current_p; FIXUP_POINTER(current); if ((ptr_t)current >= least_ha && (ptr_t)current < greatest_ha) { PREFETCH((ptr_t)current); # ifdef ENABLE_TRACE if (GC_trace_addr == current_p) { GC_log_printf("GC:%d Considering(3) %p -> %p\n", GC_gc_no, current_p, (ptr_t) current); } # endif /* ENABLE_TRACE */ PUSH_CONTENTS((ptr_t)current, mark_stack_top, mark_stack_limit, current_p, exit1); } } descr <<= 1; current_p += sizeof(word); } continue; case GC_DS_PROC: mark_stack_top--; # ifdef ENABLE_TRACE if (GC_trace_addr >= current_p && GC_base(current_p) != 0 && GC_base(current_p) == GC_base(GC_trace_addr)) { GC_log_printf("GC:%d Tracing from %p proc descr %lu\n", GC_gc_no, current_p, (unsigned long) descr); } # endif /* ENABLE_TRACE */ credit -= GC_PROC_BYTES; mark_stack_top = (*PROC(descr)) ((word *)current_p, mark_stack_top, mark_stack_limit, ENV(descr)); continue; case GC_DS_PER_OBJECT: if ((signed_word)descr >= 0) { /* Descriptor is in the object. */ descr = *(word *)(current_p + descr - GC_DS_PER_OBJECT); } else { /* Descriptor is in type descriptor pointed to by first */ /* word in object. */ ptr_t type_descr = *(ptr_t *)current_p; /* type_descr is either a valid pointer to the descriptor */ /* structure, or this object was on a free list. If it */ /* it was anything but the last object on the free list, */ /* we will misinterpret the next object on the free list as */ /* the type descriptor, and get a 0 GC descriptor, which */ /* is ideal. Unfortunately, we need to check for the last */ /* object case explicitly. */ if (0 == type_descr) { /* Rarely executed. */ mark_stack_top--; continue; } descr = *(word *)(type_descr - (descr - (GC_DS_PER_OBJECT - GC_INDIR_PER_OBJ_BIAS))); } if (0 == descr) { /* Can happen either because we generated a 0 descriptor */ /* or we saw a pointer to a free object. */ mark_stack_top--; continue; } goto retry; } } else /* Small object with length descriptor */ { mark_stack_top--; limit = current_p + (word)descr; } # ifdef ENABLE_TRACE if (GC_trace_addr >= current_p && GC_trace_addr < limit) { GC_log_printf("GC:%d Tracing from %p len %lu\n", GC_gc_no, current_p, (unsigned long) descr); } # endif /* ENABLE_TRACE */ /* The simple case in which we're scanning a range. */ GC_ASSERT(!((word)current_p & (ALIGNMENT-1))); credit -= limit - current_p; limit -= sizeof(word); { # define PREF_DIST 4 # ifndef SMALL_CONFIG word deferred; /* Try to prefetch the next pointer to be examined asap. */ /* Empirically, this also seems to help slightly without */ /* prefetches, at least on linux/X86. Presumably this loop */ /* ends up with less register pressure, and gcc thus ends up */ /* generating slightly better code. Overall gcc code quality */ /* for this loop is still not great. */ for(;;) { PREFETCH(limit - PREF_DIST*CACHE_LINE_SIZE); GC_ASSERT(limit >= current_p); deferred = *(word *)limit; FIXUP_POINTER(deferred); limit -= ALIGNMENT; if ((ptr_t)deferred >= least_ha && (ptr_t)deferred < greatest_ha) { PREFETCH((ptr_t)deferred); break; } if (current_p > limit) goto next_object; /* Unroll once, so we don't do too many of the prefetches */ /* based on limit. */ deferred = *(word *)limit; FIXUP_POINTER(deferred); limit -= ALIGNMENT; if ((ptr_t)deferred >= least_ha && (ptr_t)deferred < greatest_ha) { PREFETCH((ptr_t)deferred); break; } if (current_p > limit) goto next_object; } # endif while (current_p <= limit) { /* Empirically, unrolling this loop doesn't help a lot. */ /* Since PUSH_CONTENTS expands to a lot of code, */ /* we don't. */ current = *(word *)current_p; FIXUP_POINTER(current); PREFETCH(current_p + PREF_DIST*CACHE_LINE_SIZE); if ((ptr_t)current >= least_ha && (ptr_t)current < greatest_ha) { /* Prefetch the contents of the object we just pushed. It's */ /* likely we will need them soon. */ PREFETCH((ptr_t)current); # ifdef ENABLE_TRACE if (GC_trace_addr == current_p) { GC_log_printf("GC:%d Considering(1) %p -> %p\n", GC_gc_no, current_p, (ptr_t) current); } # endif /* ENABLE_TRACE */ PUSH_CONTENTS((ptr_t)current, mark_stack_top, mark_stack_limit, current_p, exit2); } current_p += ALIGNMENT; } # ifndef SMALL_CONFIG /* We still need to mark the entry we previously prefetched. */ /* We already know that it passes the preliminary pointer */ /* validity test. */ # ifdef ENABLE_TRACE if (GC_trace_addr == current_p) { GC_log_printf("GC:%d Considering(2) %p -> %p\n", GC_gc_no, current_p, (ptr_t) deferred); } # endif /* ENABLE_TRACE */ PUSH_CONTENTS((ptr_t)deferred, mark_stack_top, mark_stack_limit, current_p, exit4); next_object:; # endif } } return mark_stack_top; } #ifdef PARALLEL_MARK /* We assume we have an ANSI C Compiler. */ GC_bool GC_help_wanted = FALSE; unsigned GC_helper_count = 0; unsigned GC_active_count = 0; word GC_mark_no = 0; #define LOCAL_MARK_STACK_SIZE HBLKSIZE /* Under normal circumstances, this is big enough to guarantee */ /* We don't overflow half of it in a single call to */ /* GC_mark_from. */ /* Steal mark stack entries starting at mse low into mark stack local */ /* until we either steal mse high, or we have max entries. */ /* Return a pointer to the top of the local mark stack. */ /* *next is replaced by a pointer to the next unscanned mark stack */ /* entry. */ mse * GC_steal_mark_stack(mse * low, mse * high, mse * local, unsigned max, mse **next) { mse *p; mse *top = local - 1; unsigned i = 0; GC_ASSERT(high >= low-1 && high - low + 1 <= GC_mark_stack_size); for (p = low; p <= high && i <= max; ++p) { word descr = AO_load((volatile AO_t *) &(p -> mse_descr)); if (descr != 0) { /* Must be ordered after read of descr: */ AO_store_release_write((volatile AO_t *) &(p -> mse_descr), 0); /* More than one thread may get this entry, but that's only */ /* a minor performance problem. */ ++top; top -> mse_descr = descr; top -> mse_start = p -> mse_start; GC_ASSERT((top -> mse_descr & GC_DS_TAGS) != GC_DS_LENGTH || top -> mse_descr < (ptr_t)GC_greatest_plausible_heap_addr - (ptr_t)GC_least_plausible_heap_addr); /* If this is a big object, count it as */ /* size/256 + 1 objects. */ ++i; if ((descr & GC_DS_TAGS) == GC_DS_LENGTH) i += (descr >> 8); } } *next = p; return top; } /* Copy back a local mark stack. */ /* low and high are inclusive bounds. */ void GC_return_mark_stack(mse * low, mse * high) { mse * my_top; mse * my_start; size_t stack_size; if (high < low) return; stack_size = high - low + 1; GC_acquire_mark_lock(); my_top = GC_mark_stack_top; /* Concurrent modification impossible. */ my_start = my_top + 1; if (my_start - GC_mark_stack + stack_size > GC_mark_stack_size) { if (GC_print_stats) { GC_log_printf("No room to copy back mark stack."); } GC_mark_state = MS_INVALID; GC_mark_stack_too_small = TRUE; /* We drop the local mark stack. We'll fix things later. */ } else { BCOPY(low, my_start, stack_size * sizeof(mse)); GC_ASSERT((mse *)AO_load((volatile AO_t *)(&GC_mark_stack_top)) == my_top); AO_store_release_write((volatile AO_t *)(&GC_mark_stack_top), (AO_t)(my_top + stack_size)); /* Ensures visibility of previously written stack contents. */ } GC_release_mark_lock(); GC_notify_all_marker(); } /* Mark from the local mark stack. */ /* On return, the local mark stack is empty. */ /* But this may be achieved by copying the */ /* local mark stack back into the global one. */ void GC_do_local_mark(mse *local_mark_stack, mse *local_top) { unsigned n; # define N_LOCAL_ITERS 1 # ifdef GC_ASSERTIONS /* Make sure we don't hold mark lock. */ GC_acquire_mark_lock(); GC_release_mark_lock(); # endif for (;;) { for (n = 0; n < N_LOCAL_ITERS; ++n) { local_top = GC_mark_from(local_top, local_mark_stack, local_mark_stack + LOCAL_MARK_STACK_SIZE); if (local_top < local_mark_stack) return; if (local_top - local_mark_stack >= LOCAL_MARK_STACK_SIZE/2) { GC_return_mark_stack(local_mark_stack, local_top); return; } } if ((mse *)AO_load((volatile AO_t *)(&GC_mark_stack_top)) < (mse *)AO_load(&GC_first_nonempty) && GC_active_count < GC_helper_count && local_top > local_mark_stack + 1) { /* Try to share the load, since the main stack is empty, */ /* and helper threads are waiting for a refill. */ /* The entries near the bottom of the stack are likely */ /* to require more work. Thus we return those, eventhough */ /* it's harder. */ mse * new_bottom = local_mark_stack + (local_top - local_mark_stack)/2; GC_ASSERT(new_bottom > local_mark_stack && new_bottom < local_top); GC_return_mark_stack(local_mark_stack, new_bottom - 1); memmove(local_mark_stack, new_bottom, (local_top - new_bottom + 1) * sizeof(mse)); local_top -= (new_bottom - local_mark_stack); } } } #define ENTRIES_TO_GET 5 long GC_markers = 2; /* Normally changed by thread-library- */ /* -specific code. */ /* Mark using the local mark stack until the global mark stack is empty */ /* and there are no active workers. Update GC_first_nonempty to reflect */ /* progress. */ /* Caller does not hold mark lock. */ /* Caller has already incremented GC_helper_count. We decrement it, */ /* and maintain GC_active_count. */ void GC_mark_local(mse *local_mark_stack, int id) { mse * my_first_nonempty; GC_acquire_mark_lock(); GC_active_count++; my_first_nonempty = (mse *)AO_load(&GC_first_nonempty); GC_ASSERT((mse *)AO_load(&GC_first_nonempty) >= GC_mark_stack && (mse *)AO_load(&GC_first_nonempty) <= (mse *)AO_load((volatile AO_t *)(&GC_mark_stack_top)) + 1); if (GC_print_stats == VERBOSE) GC_log_printf("Starting mark helper %lu\n", (unsigned long)id); GC_release_mark_lock(); for (;;) { size_t n_on_stack; size_t n_to_get; mse * my_top; mse * local_top; mse * global_first_nonempty = (mse *)AO_load(&GC_first_nonempty); GC_ASSERT(my_first_nonempty >= GC_mark_stack && my_first_nonempty <= (mse *)AO_load((volatile AO_t *)(&GC_mark_stack_top)) + 1); GC_ASSERT(global_first_nonempty >= GC_mark_stack && global_first_nonempty <= (mse *)AO_load((volatile AO_t *)(&GC_mark_stack_top)) + 1); if (my_first_nonempty < global_first_nonempty) { my_first_nonempty = global_first_nonempty; } else if (global_first_nonempty < my_first_nonempty) { AO_compare_and_swap(&GC_first_nonempty, (AO_t) global_first_nonempty, (AO_t) my_first_nonempty); /* If this fails, we just go ahead, without updating */ /* GC_first_nonempty. */ } /* Perhaps we should also update GC_first_nonempty, if it */ /* is less. But that would require using atomic updates. */ my_top = (mse *)AO_load_acquire((volatile AO_t *)(&GC_mark_stack_top)); n_on_stack = my_top - my_first_nonempty + 1; if (0 == n_on_stack) { GC_acquire_mark_lock(); my_top = GC_mark_stack_top; /* Asynchronous modification impossible here, */ /* since we hold mark lock. */ n_on_stack = my_top - my_first_nonempty + 1; if (0 == n_on_stack) { GC_active_count--; GC_ASSERT(GC_active_count <= GC_helper_count); /* Other markers may redeposit objects */ /* on the stack. */ if (0 == GC_active_count) GC_notify_all_marker(); while (GC_active_count > 0 && (mse *)AO_load(&GC_first_nonempty) > GC_mark_stack_top) { /* We will be notified if either GC_active_count */ /* reaches zero, or if more objects are pushed on */ /* the global mark stack. */ GC_wait_marker(); } if (GC_active_count == 0 && (mse *)AO_load(&GC_first_nonempty) > GC_mark_stack_top) { GC_bool need_to_notify = FALSE; /* The above conditions can't be falsified while we */ /* hold the mark lock, since neither */ /* GC_active_count nor GC_mark_stack_top can */ /* change. GC_first_nonempty can only be */ /* incremented asynchronously. Thus we know that */ /* both conditions actually held simultaneously. */ GC_helper_count--; if (0 == GC_helper_count) need_to_notify = TRUE; if (GC_print_stats == VERBOSE) GC_log_printf( "Finished mark helper %lu\n", (unsigned long)id); GC_release_mark_lock(); if (need_to_notify) GC_notify_all_marker(); return; } /* else there's something on the stack again, or */ /* another helper may push something. */ GC_active_count++; GC_ASSERT(GC_active_count > 0); GC_release_mark_lock(); continue; } else { GC_release_mark_lock(); } } n_to_get = ENTRIES_TO_GET; if (n_on_stack < 2 * ENTRIES_TO_GET) n_to_get = 1; local_top = GC_steal_mark_stack(my_first_nonempty, my_top, local_mark_stack, n_to_get, &my_first_nonempty); GC_ASSERT(my_first_nonempty >= GC_mark_stack && my_first_nonempty <= (mse *)AO_load((volatile AO_t *)(&GC_mark_stack_top)) + 1); GC_do_local_mark(local_mark_stack, local_top); } } /* Perform Parallel mark. */ /* We hold the GC lock, not the mark lock. */ /* Currently runs until the mark stack is */ /* empty. */ void GC_do_parallel_mark() { mse local_mark_stack[LOCAL_MARK_STACK_SIZE]; GC_acquire_mark_lock(); GC_ASSERT(I_HOLD_LOCK()); /* This could be a GC_ASSERT, but it seems safer to keep it on */ /* all the time, especially since it's cheap. */ if (GC_help_wanted || GC_active_count != 0 || GC_helper_count != 0) ABORT("Tried to start parallel mark in bad state"); if (GC_print_stats == VERBOSE) GC_log_printf("Starting marking for mark phase number %lu\n", (unsigned long)GC_mark_no); GC_first_nonempty = (AO_t)GC_mark_stack; GC_active_count = 0; GC_helper_count = 1; GC_help_wanted = TRUE; GC_release_mark_lock(); GC_notify_all_marker(); /* Wake up potential helpers. */ GC_mark_local(local_mark_stack, 0); GC_acquire_mark_lock(); GC_help_wanted = FALSE; /* Done; clean up. */ while (GC_helper_count > 0) GC_wait_marker(); /* GC_helper_count cannot be incremented while GC_help_wanted == FALSE */ if (GC_print_stats == VERBOSE) GC_log_printf( "Finished marking for mark phase number %lu\n", (unsigned long)GC_mark_no); GC_mark_no++; GC_release_mark_lock(); GC_notify_all_marker(); } /* Try to help out the marker, if it's running. */ /* We do not hold the GC lock, but the requestor does. */ void GC_help_marker(word my_mark_no) { mse local_mark_stack[LOCAL_MARK_STACK_SIZE]; unsigned my_id; if (!GC_parallel) return; GC_acquire_mark_lock(); while (GC_mark_no < my_mark_no || (!GC_help_wanted && GC_mark_no == my_mark_no)) { GC_wait_marker(); } my_id = GC_helper_count; if (GC_mark_no != my_mark_no || my_id >= GC_markers) { /* Second test is useful only if original threads can also */ /* act as helpers. Under Linux they can't. */ GC_release_mark_lock(); return; } GC_helper_count = my_id + 1; GC_release_mark_lock(); GC_mark_local(local_mark_stack, my_id); /* GC_mark_local decrements GC_helper_count. */ } #endif /* PARALLEL_MARK */ /* Allocate or reallocate space for mark stack of size n entries. */ /* May silently fail. */ static void alloc_mark_stack(size_t n) { mse * new_stack = (mse *)GC_scratch_alloc(n * sizeof(struct GC_ms_entry)); # ifdef GWW_VDB /* Don't recycle a stack segment obtained with the wrong flags. */ /* Win32 GetWriteWatch requires the right kind of memory. */ static GC_bool GC_incremental_at_stack_alloc = 0; GC_bool recycle_old = (!GC_incremental || GC_incremental_at_stack_alloc); GC_incremental_at_stack_alloc = GC_incremental; # else # define recycle_old 1 # endif GC_mark_stack_too_small = FALSE; if (GC_mark_stack_size != 0) { if (new_stack != 0) { if (recycle_old) { /* Recycle old space */ size_t page_offset = (word)GC_mark_stack & (GC_page_size - 1); size_t size = GC_mark_stack_size * sizeof(struct GC_ms_entry); size_t displ = 0; if (0 != page_offset) displ = GC_page_size - page_offset; size = (size - displ) & ~(GC_page_size - 1); if (size > 0) { GC_add_to_heap((struct hblk *) ((word)GC_mark_stack + displ), (word)size); } } GC_mark_stack = new_stack; GC_mark_stack_size = n; GC_mark_stack_limit = new_stack + n; if (GC_print_stats) { GC_log_printf("Grew mark stack to %lu frames\n", (unsigned long) GC_mark_stack_size); } } else { if (GC_print_stats) { GC_log_printf("Failed to grow mark stack to %lu frames\n", (unsigned long) n); } } } else { if (new_stack == 0) { GC_err_printf("No space for mark stack\n"); EXIT(); } GC_mark_stack = new_stack; GC_mark_stack_size = n; GC_mark_stack_limit = new_stack + n; } GC_mark_stack_top = GC_mark_stack-1; } void GC_mark_init() { alloc_mark_stack(INITIAL_MARK_STACK_SIZE); } /* * Push all locations between b and t onto the mark stack. * b is the first location to be checked. t is one past the last * location to be checked. * Should only be used if there is no possibility of mark stack * overflow. */ void GC_push_all(ptr_t bottom, ptr_t top) { register word length; bottom = (ptr_t)(((word) bottom + ALIGNMENT-1) & ~(ALIGNMENT-1)); top = (ptr_t)(((word) top) & ~(ALIGNMENT-1)); if (top == 0 || bottom == top) return; GC_mark_stack_top++; if (GC_mark_stack_top >= GC_mark_stack_limit) { ABORT("unexpected mark stack overflow"); } length = top - bottom; # if GC_DS_TAGS > ALIGNMENT - 1 length += GC_DS_TAGS; length &= ~GC_DS_TAGS; # endif GC_mark_stack_top -> mse_start = bottom; GC_mark_stack_top -> mse_descr = length; } /* * Analogous to the above, but push only those pages h with dirty_fn(h) != 0. * We use push_fn to actually push the block. * Used both to selectively push dirty pages, or to push a block * in piecemeal fashion, to allow for more marking concurrency. * Will not overflow mark stack if push_fn pushes a small fixed number * of entries. (This is invoked only if push_fn pushes a single entry, * or if it marks each object before pushing it, thus ensuring progress * in the event of a stack overflow.) */ void GC_push_selected(ptr_t bottom, ptr_t top, int (*dirty_fn) (struct hblk *), void (*push_fn) (ptr_t, ptr_t)) { struct hblk * h; bottom = (ptr_t)(((word) bottom + ALIGNMENT-1) & ~(ALIGNMENT-1)); top = (ptr_t)(((word) top) & ~(ALIGNMENT-1)); if (top == 0 || bottom == top) return; h = HBLKPTR(bottom + HBLKSIZE); if (top <= (ptr_t) h) { if ((*dirty_fn)(h-1)) { (*push_fn)(bottom, top); } return; } if ((*dirty_fn)(h-1)) { (*push_fn)(bottom, (ptr_t)h); } while ((ptr_t)(h+1) <= top) { if ((*dirty_fn)(h)) { if ((word)(GC_mark_stack_top - GC_mark_stack) > 3 * GC_mark_stack_size / 4) { /* Danger of mark stack overflow */ (*push_fn)((ptr_t)h, top); return; } else { (*push_fn)((ptr_t)h, (ptr_t)(h+1)); } } h++; } if ((ptr_t)h != top) { if ((*dirty_fn)(h)) { (*push_fn)((ptr_t)h, top); } } if (GC_mark_stack_top >= GC_mark_stack_limit) { ABORT("unexpected mark stack overflow"); } } # ifndef SMALL_CONFIG #ifdef PARALLEL_MARK /* Break up root sections into page size chunks to better spread */ /* out work. */ GC_bool GC_true_func(struct hblk *h) { return TRUE; } # define GC_PUSH_ALL(b,t) GC_push_selected(b,t,GC_true_func,GC_push_all); #else # define GC_PUSH_ALL(b,t) GC_push_all(b,t); #endif void GC_push_conditional(ptr_t bottom, ptr_t top, GC_bool all) { if (all) { if (GC_dirty_maintained) { # ifdef PROC_VDB /* Pages that were never dirtied cannot contain pointers */ GC_push_selected(bottom, top, GC_page_was_ever_dirty, GC_push_all); # else GC_push_all(bottom, top); # endif } else { GC_push_all(bottom, top); } } else { GC_push_selected(bottom, top, GC_page_was_dirty, GC_push_all); } } #endif # if defined(MSWIN32) || defined(MSWINCE) void __cdecl GC_push_one(word p) # else void GC_push_one(word p) # endif { GC_PUSH_ONE_STACK((ptr_t)p, MARKED_FROM_REGISTER); } struct GC_ms_entry *GC_mark_and_push(void *obj, mse *mark_stack_ptr, mse *mark_stack_limit, void **src) { hdr * hhdr; PREFETCH(obj); GET_HDR(obj, hhdr); if (EXPECT(IS_FORWARDING_ADDR_OR_NIL(hhdr),FALSE)) { if (GC_all_interior_pointers) { hhdr = GC_find_header(GC_base(obj)); if (hhdr == 0) { GC_ADD_TO_BLACK_LIST_NORMAL(obj, src); return mark_stack_ptr; } } else { GC_ADD_TO_BLACK_LIST_NORMAL(obj, src); return mark_stack_ptr; } } if (EXPECT(HBLK_IS_FREE(hhdr),0)) { GC_ADD_TO_BLACK_LIST_NORMAL(obj, src); return mark_stack_ptr; } PUSH_CONTENTS_HDR(obj, mark_stack_ptr /* modified */, mark_stack_limit, src, was_marked, hhdr, TRUE); was_marked: return mark_stack_ptr; } /* Mark and push (i.e. gray) a single object p onto the main */ /* mark stack. Consider p to be valid if it is an interior */ /* pointer. */ /* The object p has passed a preliminary pointer validity */ /* test, but we do not definitely know whether it is valid. */ /* Mark bits are NOT atomically updated. Thus this must be the */ /* only thread setting them. */ # if defined(PRINT_BLACK_LIST) || defined(KEEP_BACK_PTRS) void GC_mark_and_push_stack(ptr_t p, ptr_t source) # else void GC_mark_and_push_stack(ptr_t p) # define source 0 # endif { hdr * hhdr; ptr_t r = p; PREFETCH(p); GET_HDR(p, hhdr); if (EXPECT(IS_FORWARDING_ADDR_OR_NIL(hhdr),FALSE)) { if (hhdr != 0) { r = GC_base(p); hhdr = HDR(r); } if (hhdr == 0) { GC_ADD_TO_BLACK_LIST_STACK(p, source); return; } } if (EXPECT(HBLK_IS_FREE(hhdr),0)) { GC_ADD_TO_BLACK_LIST_NORMAL(p, src); return; } # if defined(MANUAL_VDB) && defined(THREADS) /* Pointer is on the stack. We may have dirtied the object */ /* it points to, but not yet have called GC_dirty(); */ GC_dirty(p); /* Implicitly affects entire object. */ # endif PUSH_CONTENTS_HDR(r, GC_mark_stack_top, GC_mark_stack_limit, source, mark_and_push_exit, hhdr, FALSE); mark_and_push_exit: ; /* We silently ignore pointers to near the end of a block, */ /* which is very mildly suboptimal. */ /* FIXME: We should probably add a header word to address */ /* this. */ } # ifdef TRACE_BUF # define TRACE_ENTRIES 1000 struct trace_entry { char * kind; word gc_no; word bytes_allocd; word arg1; word arg2; } GC_trace_buf[TRACE_ENTRIES]; int GC_trace_buf_ptr = 0; void GC_add_trace_entry(char *kind, word arg1, word arg2) { GC_trace_buf[GC_trace_buf_ptr].kind = kind; GC_trace_buf[GC_trace_buf_ptr].gc_no = GC_gc_no; GC_trace_buf[GC_trace_buf_ptr].bytes_allocd = GC_bytes_allocd; GC_trace_buf[GC_trace_buf_ptr].arg1 = arg1 ^ 0x80000000; GC_trace_buf[GC_trace_buf_ptr].arg2 = arg2 ^ 0x80000000; GC_trace_buf_ptr++; if (GC_trace_buf_ptr >= TRACE_ENTRIES) GC_trace_buf_ptr = 0; } void GC_print_trace(word gc_no, GC_bool lock) { int i; struct trace_entry *p; if (lock) LOCK(); for (i = GC_trace_buf_ptr-1; i != GC_trace_buf_ptr; i--) { if (i < 0) i = TRACE_ENTRIES-1; p = GC_trace_buf + i; if (p -> gc_no < gc_no || p -> kind == 0) return; printf("Trace:%s (gc:%d,bytes:%d) 0x%X, 0x%X\n", p -> kind, p -> gc_no, p -> bytes_allocd, (p -> arg1) ^ 0x80000000, (p -> arg2) ^ 0x80000000); } printf("Trace incomplete\n"); if (lock) UNLOCK(); } # endif /* TRACE_BUF */ /* * A version of GC_push_all that treats all interior pointers as valid * and scans the entire region immediately, in case the contents * change. */ void GC_push_all_eager(ptr_t bottom, ptr_t top) { word * b = (word *)(((word) bottom + ALIGNMENT-1) & ~(ALIGNMENT-1)); word * t = (word *)(((word) top) & ~(ALIGNMENT-1)); register word *p; register ptr_t q; register word *lim; register ptr_t greatest_ha = GC_greatest_plausible_heap_addr; register ptr_t least_ha = GC_least_plausible_heap_addr; # define GC_greatest_plausible_heap_addr greatest_ha # define GC_least_plausible_heap_addr least_ha if (top == 0) return; /* check all pointers in range and push if they appear */ /* to be valid. */ lim = t - 1 /* longword */; for (p = b; p <= lim; p = (word *)(((ptr_t)p) + ALIGNMENT)) { q = (ptr_t)(*p); GC_PUSH_ONE_STACK((ptr_t)q, p); } # undef GC_greatest_plausible_heap_addr # undef GC_least_plausible_heap_addr } #ifndef THREADS /* * A version of GC_push_all that treats all interior pointers as valid * and scans part of the area immediately, to make sure that saved * register values are not lost. * Cold_gc_frame delimits the stack section that must be scanned * eagerly. A zero value indicates that no eager scanning is needed. * We don't need to worry about the MANUAL_VDB case here, since this * is only called in the single-threaded case. We assume that we * cannot collect between an assignment and the corresponding * GC_dirty() call. */ void GC_push_all_stack_partially_eager(ptr_t bottom, ptr_t top, ptr_t cold_gc_frame) { if (!NEED_FIXUP_POINTER && GC_all_interior_pointers) { /* Push the hot end of the stack eagerly, so that register values */ /* saved inside GC frames are marked before they disappear. */ /* The rest of the marking can be deferred until later. */ if (0 == cold_gc_frame) { GC_push_all_stack(bottom, top); return; } GC_ASSERT(bottom <= cold_gc_frame && cold_gc_frame <= top); # ifdef STACK_GROWS_DOWN GC_push_all(cold_gc_frame - sizeof(ptr_t), top); GC_push_all_eager(bottom, cold_gc_frame); # else /* STACK_GROWS_UP */ GC_push_all(bottom, cold_gc_frame + sizeof(ptr_t)); GC_push_all_eager(cold_gc_frame, top); # endif /* STACK_GROWS_UP */ } else { GC_push_all_eager(bottom, top); } # ifdef TRACE_BUF GC_add_trace_entry("GC_push_all_stack", bottom, top); # endif } #endif /* !THREADS */ void GC_push_all_stack(ptr_t bottom, ptr_t top) { # if defined(THREADS) && defined(MPROTECT_VDB) GC_push_all_eager(bottom, top); # else if (!NEED_FIXUP_POINTER && GC_all_interior_pointers) { GC_push_all(bottom, top); } else { GC_push_all_eager(bottom, top); } # endif } #if !defined(SMALL_CONFIG) && !defined(USE_MARK_BYTES) && \ defined(MARK_BIT_PER_GRANULE) # if GC_GRANULE_WORDS == 1 # define USE_PUSH_MARKED_ACCELERATORS # define PUSH_GRANULE(q) \ { ptr_t qcontents = (ptr_t)((q)[0]); \ GC_PUSH_ONE_HEAP(qcontents, (q)); } # elif GC_GRANULE_WORDS == 2 # define USE_PUSH_MARKED_ACCELERATORS # define PUSH_GRANULE(q) \ { ptr_t qcontents = (ptr_t)((q)[0]); \ GC_PUSH_ONE_HEAP(qcontents, (q)); \ qcontents = (ptr_t)((q)[1]); \ GC_PUSH_ONE_HEAP(qcontents, (q)+1); } # elif GC_GRANULE_WORDS == 4 # define USE_PUSH_MARKED_ACCELERATORS # define PUSH_GRANULE(q) \ { ptr_t qcontents = (ptr_t)((q)[0]); \ GC_PUSH_ONE_HEAP(qcontents, (q)); \ qcontents = (ptr_t)((q)[1]); \ GC_PUSH_ONE_HEAP(qcontents, (q)+1); \ qcontents = (ptr_t)((q)[2]); \ GC_PUSH_ONE_HEAP(qcontents, (q)+2); \ qcontents = (ptr_t)((q)[3]); \ GC_PUSH_ONE_HEAP(qcontents, (q)+3); } # endif #endif #ifdef USE_PUSH_MARKED_ACCELERATORS /* Push all objects reachable from marked objects in the given block */ /* containing objects of size 1 granule. */ void GC_push_marked1(struct hblk *h, hdr *hhdr) { word * mark_word_addr = &(hhdr->hb_marks[0]); word *p; word *plim; word *q; word mark_word; /* Allow registers to be used for some frequently acccessed */ /* global variables. Otherwise aliasing issues are likely */ /* to prevent that. */ ptr_t greatest_ha = GC_greatest_plausible_heap_addr; ptr_t least_ha = GC_least_plausible_heap_addr; mse * mark_stack_top = GC_mark_stack_top; mse * mark_stack_limit = GC_mark_stack_limit; # define GC_mark_stack_top mark_stack_top # define GC_mark_stack_limit mark_stack_limit # define GC_greatest_plausible_heap_addr greatest_ha # define GC_least_plausible_heap_addr least_ha p = (word *)(h->hb_body); plim = (word *)(((word)h) + HBLKSIZE); /* go through all words in block */ while( p < plim ) { mark_word = *mark_word_addr++; q = p; while(mark_word != 0) { if (mark_word & 1) { PUSH_GRANULE(q); } q += GC_GRANULE_WORDS; mark_word >>= 1; } p += WORDSZ*GC_GRANULE_WORDS; } # undef GC_greatest_plausible_heap_addr # undef GC_least_plausible_heap_addr # undef GC_mark_stack_top # undef GC_mark_stack_limit GC_mark_stack_top = mark_stack_top; } #ifndef UNALIGNED /* Push all objects reachable from marked objects in the given block */ /* of size 2 (granules) objects. */ void GC_push_marked2(struct hblk *h, hdr *hhdr) { word * mark_word_addr = &(hhdr->hb_marks[0]); word *p; word *plim; word *q; word mark_word; ptr_t greatest_ha = GC_greatest_plausible_heap_addr; ptr_t least_ha = GC_least_plausible_heap_addr; mse * mark_stack_top = GC_mark_stack_top; mse * mark_stack_limit = GC_mark_stack_limit; # define GC_mark_stack_top mark_stack_top # define GC_mark_stack_limit mark_stack_limit # define GC_greatest_plausible_heap_addr greatest_ha # define GC_least_plausible_heap_addr least_ha p = (word *)(h->hb_body); plim = (word *)(((word)h) + HBLKSIZE); /* go through all words in block */ while( p < plim ) { mark_word = *mark_word_addr++; q = p; while(mark_word != 0) { if (mark_word & 1) { PUSH_GRANULE(q); PUSH_GRANULE(q + GC_GRANULE_WORDS); } q += 2 * GC_GRANULE_WORDS; mark_word >>= 2; } p += WORDSZ*GC_GRANULE_WORDS; } # undef GC_greatest_plausible_heap_addr # undef GC_least_plausible_heap_addr # undef GC_mark_stack_top # undef GC_mark_stack_limit GC_mark_stack_top = mark_stack_top; } # if GC_GRANULE_WORDS < 4 /* Push all objects reachable from marked objects in the given block */ /* of size 4 (granules) objects. */ /* There is a risk of mark stack overflow here. But we handle that. */ /* And only unmarked objects get pushed, so it's not very likely. */ void GC_push_marked4(struct hblk *h, hdr *hhdr) { word * mark_word_addr = &(hhdr->hb_marks[0]); word *p; word *plim; word *q; word mark_word; ptr_t greatest_ha = GC_greatest_plausible_heap_addr; ptr_t least_ha = GC_least_plausible_heap_addr; mse * mark_stack_top = GC_mark_stack_top; mse * mark_stack_limit = GC_mark_stack_limit; # define GC_mark_stack_top mark_stack_top # define GC_mark_stack_limit mark_stack_limit # define GC_greatest_plausible_heap_addr greatest_ha # define GC_least_plausible_heap_addr least_ha p = (word *)(h->hb_body); plim = (word *)(((word)h) + HBLKSIZE); /* go through all words in block */ while( p < plim ) { mark_word = *mark_word_addr++; q = p; while(mark_word != 0) { if (mark_word & 1) { PUSH_GRANULE(q); PUSH_GRANULE(q + GC_GRANULE_WORDS); PUSH_GRANULE(q + 2*GC_GRANULE_WORDS); PUSH_GRANULE(q + 3*GC_GRANULE_WORDS); } q += 4 * GC_GRANULE_WORDS; mark_word >>= 4; } p += WORDSZ*GC_GRANULE_WORDS; } # undef GC_greatest_plausible_heap_addr # undef GC_least_plausible_heap_addr # undef GC_mark_stack_top # undef GC_mark_stack_limit GC_mark_stack_top = mark_stack_top; } #endif /* GC_GRANULE_WORDS < 4 */ #endif /* UNALIGNED */ #endif /* USE_PUSH_MARKED_ACCELERATORS */ /* Push all objects reachable from marked objects in the given block */ void GC_push_marked(struct hblk *h, hdr *hhdr) { size_t sz = hhdr -> hb_sz; word descr = hhdr -> hb_descr; ptr_t p; word bit_no; ptr_t lim; mse * GC_mark_stack_top_reg; mse * mark_stack_limit = GC_mark_stack_limit; /* Some quick shortcuts: */ if ((0 | GC_DS_LENGTH) == descr) return; if (GC_block_empty(hhdr)/* nothing marked */) return; GC_n_rescuing_pages++; GC_objects_are_marked = TRUE; if (sz > MAXOBJBYTES) { lim = h -> hb_body; } else { lim = (h + 1)->hb_body - sz; } switch(BYTES_TO_GRANULES(sz)) { # if defined(USE_PUSH_MARKED_ACCELERATORS) case 1: GC_push_marked1(h, hhdr); break; # if !defined(UNALIGNED) case 2: GC_push_marked2(h, hhdr); break; # if GC_GRANULE_WORDS < 4 case 4: GC_push_marked4(h, hhdr); break; # endif # endif # endif default: GC_mark_stack_top_reg = GC_mark_stack_top; for (p = h -> hb_body, bit_no = 0; p <= lim; p += sz, bit_no += MARK_BIT_OFFSET(sz)) { if (mark_bit_from_hdr(hhdr, bit_no)) { /* Mark from fields inside the object */ PUSH_OBJ(p, hhdr, GC_mark_stack_top_reg, mark_stack_limit); } } GC_mark_stack_top = GC_mark_stack_top_reg; } } #ifndef SMALL_CONFIG /* Test whether any page in the given block is dirty */ GC_bool GC_block_was_dirty(struct hblk *h, hdr *hhdr) { size_t sz = hhdr -> hb_sz; if (sz <= MAXOBJBYTES) { return(GC_page_was_dirty(h)); } else { ptr_t p = (ptr_t)h; while (p < (ptr_t)h + sz) { if (GC_page_was_dirty((struct hblk *)p)) return(TRUE); p += HBLKSIZE; } return(FALSE); } } #endif /* SMALL_CONFIG */ /* Similar to GC_push_next_marked, but return address of next block */ struct hblk * GC_push_next_marked(struct hblk *h) { hdr * hhdr = HDR(h); if (EXPECT(IS_FORWARDING_ADDR_OR_NIL(hhdr), FALSE)) { h = GC_next_used_block(h); if (h == 0) return(0); hhdr = GC_find_header((ptr_t)h); } GC_push_marked(h, hhdr); return(h + OBJ_SZ_TO_BLOCKS(hhdr -> hb_sz)); } #ifndef SMALL_CONFIG /* Identical to above, but mark only from dirty pages */ struct hblk * GC_push_next_marked_dirty(struct hblk *h) { hdr * hhdr = HDR(h); if (!GC_dirty_maintained) { ABORT("dirty bits not set up"); } for (;;) { if (EXPECT(IS_FORWARDING_ADDR_OR_NIL(hhdr), FALSE)) { h = GC_next_used_block(h); if (h == 0) return(0); hhdr = GC_find_header((ptr_t)h); } # ifdef STUBBORN_ALLOC if (hhdr -> hb_obj_kind == STUBBORN) { if (GC_page_was_changed(h) && GC_block_was_dirty(h, hhdr)) { break; } } else { if (GC_block_was_dirty(h, hhdr)) break; } # else if (GC_block_was_dirty(h, hhdr)) break; # endif h += OBJ_SZ_TO_BLOCKS(hhdr -> hb_sz); hhdr = HDR(h); } GC_push_marked(h, hhdr); return(h + OBJ_SZ_TO_BLOCKS(hhdr -> hb_sz)); } #endif /* Similar to above, but for uncollectable pages. Needed since we */ /* do not clear marks for such pages, even for full collections. */ struct hblk * GC_push_next_marked_uncollectable(struct hblk *h) { hdr * hhdr = HDR(h); for (;;) { if (EXPECT(IS_FORWARDING_ADDR_OR_NIL(hhdr), FALSE)) { h = GC_next_used_block(h); if (h == 0) return(0); hhdr = GC_find_header((ptr_t)h); } if (hhdr -> hb_obj_kind == UNCOLLECTABLE) break; h += OBJ_SZ_TO_BLOCKS(hhdr -> hb_sz); hhdr = HDR(h); } GC_push_marked(h, hhdr); return(h + OBJ_SZ_TO_BLOCKS(hhdr -> hb_sz)); } synopsis-0.12/src/Synopsis/gc/callprocs0000775000076400007640000000022411104702316017567 0ustar stefanstefan#!/bin/sh GC_DEBUG=1 export GC_DEBUG $* 2>&1 | awk '{print "0x3e=c\""$0"\""};/^\t##PC##=/ {if ($2 != 0) {print $2"?i"}}' | adb $1 | sed "s/^ >/>/" synopsis-0.12/src/Synopsis/gc/SMakefile.amiga0000664000076400007640000000772211104702315020530 0ustar stefanstefan # Rewritten smakefile for amiga / sas/c. -Kjetil M. # Dont use the cord-package if you define parm=both or parm=reg. #----------------TOOLS-------------------------------- CC=sc LINKER=slink LIBER=oml #----------------CPU OPTIONS-------------------------- CPU=68060 #----------------FPU OPTIONS-------------------------- MATH=8 MATHLIB=LIB:scm881.lib #----------------COMPILER OPTIONS--------------------- IGNORE= IGNORE=85 IGNORE=154 IGNORE=161 IGNORE=100 OPTIMIZE=optimize optimizetime optglobal optimizerdepth=100 optimizerpeephole optloop OPTSCHED optimizerinlocal optimizerrecurdepth=100 # optimizerinline optimizercomplexity=100 OPT= $(OPTIMIZE) CPU=$(CPU) math=$(MATH) NOSTACKCHECK VERBOSE \ MAPHUNK NOVERSION NOICONS nodebug \ parm=reg \ DEFINE __USE_SYSBASE SOPT= $(OPT) $(IGNORE) \ DEFINE AMIGA_SKIP_SEG \ DEFINE ATOMIC_UNCOLLECTABLE \ DEFINE GC_AMIGA_FASTALLOC \ DEFINE GC_AMIGA_RETRY \ DEFINE GC_AMIGA_PRINTSTATS \ DEFINE GC_AMIGA_GC #DEFINE ALL_INTERIOR_POINTERS \ SCOPT= $(SOPT) define GC_AMIGA_MAKINGLIB CSCOPT= $(OPT) DEFINE AMIGA IGNORE=100 IGNORE=161 #------------------LINKING---------------------------- all: gctest setjmp_t cord/cordtest clean: delete *.lib gctest setjmp_t *.o *.lnk cord/*.o cord/*.lib cord/*.lnk cord/cordtest smake test: setjmp_t gctest cord/cordtest setjmp_t gctest cord/cordtest gctest: gc$(CPU).lib GCAmigaOS$(CPU).lib test.o $(LINKER) LIB:c.o test.o TO gctest LIB gc$(CPU).lib LIB:sc.lib $(MATHLIB) setjmp_t: setjmp_t.o gc.h $(LINKER) LIB:c.o setjmp_t.o to setjmp_t lib LIB:sc.lib cord/cordtest: cord/cordtest.o cord/cord$(CPU).lib gc$(CPU).lib slink LIB:c.o cord/cordtest.o LIB $(MATHLIB) gc$(CPU).lib cord/cord$(CPU).lib LIB:sc.lib TO cord/cordtest #------------------LIBBING---------------------------- OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o real_malloc.o dyn_load.o dbg_mlc.o malloc.o stubborn.o checksums.o typd_mlc.o ptr_chck.o mallocx.o gc$(CPU).lib: $(OBJS) $(LIBER) gc$(CPU).lib r $(OBJS) COBJS = cord/cordbscs.o cord/cordprnt.o cord/cordxtra.o cord/cord$(CPU).lib: $(COBJS) oml cord/cord$(CPU).lib r $(COBJS) #------------------COMPILING-------------------------- INC= gc_private.h gc_hdrs.h gc.h gcconfig.h alloc.o : alloc.c $(INC) $(CC) alloc.c $(SCOPT) ignore=7 reclaim.o : reclaim.c $(INC) $(CC) reclaim.c $(SCOPT) allchblk.o : allchblk.c $(INC) $(CC) allchblk.c $(SCOPT) misc.o : misc.c $(INC) $(CC) misc.c $(SCOPT) os_dep.o : os_dep.c $(INC) AmigaOS.c $(CC) os_dep.c $(SCOPT) mark_rts.o : mark_rts.c $(INC) $(CC) mark_rts.c $(SCOPT) headers.o : headers.c $(INC) $(CC) headers.c $(SCOPT) mark.o : mark.c $(INC) $(CC) mark.c $(SCOPT) obj_map.o : obj_map.c $(INC) $(CC) obj_map.c $(SCOPT) blacklst.o : blacklst.c $(INC) $(CC) blacklst.c $(SCOPT) finalize.o : finalize.c $(INC) $(CC) finalize.c $(SCOPT) noopt #Could sas/c still have problems with this one? Gctest sometimes fails to finalize all. new_hblk.o : new_hblk.c $(INC) $(CC) new_hblk.c $(SCOPT) real_malloc.o : real_malloc.c $(INC) $(CC) real_malloc.c $(SCOPT) dyn_load.o : dyn_load.c $(INC) $(CC) dyn_load.c $(SCOPT) dbg_mlc.o : dbg_mlc.c $(INC) $(CC) dbg_mlc.c $(SCOPT) malloc.o : malloc.c $(INC) $(CC) malloc.c $(SCOPT) mallocx.o : mallocx.c $(INC) $(CC) mallocx.c $(SCOPT) stubborn.o : stubborn.c $(INC) $(CC) stubborn.c $(SCOPT) checksums.o : checksums.c $(INC) $(CC) checksums.c $(SCOPT) typd_mlc.o: typd_mlc.c $(INC) $(CC) typd_mlc.c $(SCOPT) mach_dep.o : mach_dep.c $(INC) $(CC) mach_dep.c $(SCOPT) ptr_chck.o: ptr_chck.c $(INC) $(CC) ptr_chck.c $(SCOPT) test.o : test.c $(INC) $(CC) test.c $(SOPT) setjmp_t: setjmp_t.c gc.h $(CC) setjmp_t.c $(SOPT) # cords: cord/cordbscs.o: cord/cordbscs.c sc cord/cordbscs.c $(CSCOPT) cord/cordprnt.o: cord/cordprnt.c sc cord/cordprnt.c $(CSCOPT) cord/cordxtra.o: cord/cordxtra.c sc cord/cordxtra.c $(CSCOPT) cord/cordtest.o: cord/cordtest.c sc cord/cordtest.c $(CSCOPT) synopsis-0.12/src/Synopsis/gc/thread_local_alloc.c0000664000076400007640000002376211104702316021632 0ustar stefanstefan/* * Copyright (c) 2000-2005 by Hewlett-Packard Company. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ #include "private/gc_priv.h" # if defined(THREAD_LOCAL_ALLOC) #include "private/thread_local_alloc.h" #include "gc_inline.h" # include #if defined(USE_COMPILER_TLS) __thread #elif defined(USE_WIN32_COMPILER_TLS) __declspec(thread) #endif GC_key_t GC_thread_key; static GC_bool keys_initialized; /* Return a single nonempty freelist fl to the global one pointed to */ /* by gfl. */ static void return_single_freelist(void *fl, void **gfl) { void *q, **qptr; if (*gfl == 0) { *gfl = fl; } else { GC_ASSERT(GC_size(fl) == GC_size(*gfl)); /* Concatenate: */ for (qptr = &(obj_link(fl)), q = *qptr; (word)q >= HBLKSIZE; qptr = &(obj_link(q)), q = *qptr); GC_ASSERT(0 == q); *qptr = *gfl; *gfl = fl; } } /* Recover the contents of the freelist array fl into the global one gfl.*/ /* We hold the allocator lock. */ static void return_freelists(void **fl, void **gfl) { int i; for (i = 1; i < TINY_FREELISTS; ++i) { if ((word)(fl[i]) >= HBLKSIZE) { return_single_freelist(fl[i], gfl+i); } /* Clear fl[i], since the thread structure may hang around. */ /* Do it in a way that is likely to trap if we access it. */ fl[i] = (ptr_t)HBLKSIZE; } /* The 0 granule freelist really contains 1 granule objects. */ # ifdef GC_GCJ_SUPPORT if (fl[0] == ERROR_FL) return; # endif if ((word)(fl[0]) >= HBLKSIZE) { return_single_freelist(fl[0], gfl+1); } } /* Each thread structure must be initialized. */ /* This call must be made from the new thread. */ /* Caller holds allocation lock. */ void GC_init_thread_local(GC_tlfs p) { int i; if (!keys_initialized) { if (0 != GC_key_create(&GC_thread_key, 0)) { ABORT("Failed to create key for local allocator"); } keys_initialized = TRUE; } if (0 != GC_setspecific(GC_thread_key, p)) { ABORT("Failed to set thread specific allocation pointers"); } for (i = 1; i < TINY_FREELISTS; ++i) { p -> ptrfree_freelists[i] = (void *)1; p -> normal_freelists[i] = (void *)1; # ifdef GC_GCJ_SUPPORT p -> gcj_freelists[i] = (void *)1; # endif } /* Set up the size 0 free lists. */ /* We now handle most of them like regular free lists, to ensure */ /* That explicit deallocation works. However, allocation of a */ /* size 0 "gcj" object is always an error. */ p -> ptrfree_freelists[0] = (void *)1; p -> normal_freelists[0] = (void *)1; # ifdef GC_GCJ_SUPPORT p -> gcj_freelists[0] = ERROR_FL; # endif } #ifdef GC_GCJ_SUPPORT extern void ** GC_gcjobjfreelist; #endif /* We hold the allocator lock. */ void GC_destroy_thread_local(GC_tlfs p) { /* We currently only do this from the thread itself or from */ /* the fork handler for a child process. */ # ifndef HANDLE_FORK GC_ASSERT(GC_getspecific(GC_thread_key) == (void *)p); # endif return_freelists(p -> ptrfree_freelists, GC_aobjfreelist); return_freelists(p -> normal_freelists, GC_objfreelist); # ifdef GC_GCJ_SUPPORT return_freelists(p -> gcj_freelists, GC_gcjobjfreelist); # endif } #if defined(GC_ASSERTIONS) && defined(GC_PTHREADS) && !defined(CYGWIN32) \ && !defined(GC_WIN32_PTHREADS) # include extern char * GC_lookup_thread(pthread_t id); #endif #if defined(GC_ASSERTIONS) && defined(GC_WIN32_THREADS) extern char * GC_lookup_thread(int id); #endif void * GC_malloc(size_t bytes) { size_t granules = ROUNDED_UP_GRANULES(bytes); void *tsd; void *result; void **tiny_fl; # if defined(REDIRECT_MALLOC) && !defined(USE_PTHREAD_SPECIFIC) GC_key_t k = GC_thread_key; if (EXPECT(0 == k, 0)) { /* We haven't yet run GC_init_parallel. That means */ /* we also aren't locking, so this is fairly cheap. */ return GC_core_malloc(bytes); } tsd = GC_getspecific(k); # else GC_ASSERT(GC_is_initialized); tsd = GC_getspecific(GC_thread_key); # endif # if defined(REDIRECT_MALLOC) && defined(USE_PTHREAD_SPECIFIC) if (EXPECT(NULL == tsd, 0)) { return GC_core_malloc(bytes); } # endif # ifdef GC_ASSERTIONS /* We can't check tsd correctly, since we don't have access to */ /* the right declarations. But we can check that it's close. */ LOCK(); { # if defined(GC_WIN32_THREADS) char * me = (char *)GC_lookup_thread_inner(GetCurrentThreadId()); # else char * me = GC_lookup_thread(pthread_self()); # endif GC_ASSERT((char *)tsd > me && (char *)tsd < me + 1000); } UNLOCK(); # endif tiny_fl = ((GC_tlfs)tsd) -> normal_freelists; GC_FAST_MALLOC_GRANS(result, granules, tiny_fl, DIRECT_GRANULES, NORMAL, GC_core_malloc(bytes), obj_link(result)=0); return result; } void * GC_malloc_atomic(size_t bytes) { size_t granules = ROUNDED_UP_GRANULES(bytes); void *result; void **tiny_fl; GC_ASSERT(GC_is_initialized); tiny_fl = ((GC_tlfs)GC_getspecific(GC_thread_key)) -> ptrfree_freelists; GC_FAST_MALLOC_GRANS(result, bytes, tiny_fl, DIRECT_GRANULES, PTRFREE, GC_core_malloc_atomic(bytes), 0/* no init */); return result; } #ifdef GC_GCJ_SUPPORT #include "include/gc_gcj.h" #ifdef GC_ASSERTIONS extern GC_bool GC_gcj_malloc_initialized; #endif extern int GC_gcj_kind; /* Gcj-style allocation without locks is extremely tricky. The */ /* fundamental issue is that we may end up marking a free list, which */ /* has freelist links instead of "vtable" pointers. That is usually */ /* OK, since the next object on the free list will be cleared, and */ /* will thus be interpreted as containg a zero descriptor. That's fine */ /* if the object has not yet been initialized. But there are */ /* interesting potential races. */ /* In the case of incremental collection, this seems hopeless, since */ /* the marker may run asynchronously, and may pick up the pointer to */ /* the next freelist entry (which it thinks is a vtable pointer), get */ /* suspended for a while, and then see an allocated object instead */ /* of the vtable. This made be avoidable with either a handshake with */ /* the collector or, probably more easily, by moving the free list */ /* links to the second word of each object. The latter isn't a */ /* universal win, since on architecture like Itanium, nonzero offsets */ /* are not necessarily free. And there may be cache fill order issues. */ /* For now, we punt with incremental GC. This probably means that */ /* incremental GC should be enabled before we fork a second thread. */ void * GC_gcj_malloc(size_t bytes, void * ptr_to_struct_containing_descr) { if (GC_EXPECT(GC_incremental, 0)) { return GC_core_gcj_malloc(bytes, ptr_to_struct_containing_descr); } else { size_t granules = ROUNDED_UP_GRANULES(bytes); void *result; void **tiny_fl = ((GC_tlfs)GC_getspecific(GC_thread_key)) -> gcj_freelists; GC_ASSERT(GC_gcj_malloc_initialized); GC_FAST_MALLOC_GRANS(result, bytes, tiny_fl, DIRECT_GRANULES, GC_gcj_kind, GC_core_gcj_malloc(bytes, ptr_to_struct_containing_descr), {AO_compiler_barrier(); *(void **)result = ptr_to_struct_containing_descr;}); /* This forces the initialization of the "method ptr". */ /* This is necessary to ensure some very subtle properties */ /* required if a GC is run in the middle of such an allocation. */ /* Here we implicitly also assume atomicity for the free list. */ /* and method pointer assignments. */ /* We must update the freelist before we store the pointer. */ /* Otherwise a GC at this point would see a corrupted */ /* free list. */ /* A real memory barrier is not needed, since the */ /* action of stopping this thread will cause prior writes */ /* to complete. */ /* We assert that any concurrent marker will stop us. */ /* Thus it is impossible for a mark procedure to see the */ /* allocation of the next object, but to see this object */ /* still containing a free list pointer. Otherwise the */ /* marker, by misinterpreting the freelist link as a vtable */ /* pointer, might find a random "mark descriptor" in the next */ /* object. */ return result; } } #endif /* GC_GCJ_SUPPORT */ /* The thread support layer must arrange to mark thread-local */ /* free lists explicitly, since the link field is often */ /* invisible to the marker. It knows hoe to find all threads; */ /* we take care of an individual thread freelist structure. */ void GC_mark_thread_local_fls_for(GC_tlfs p) { ptr_t q; int j; for (j = 1; j < TINY_FREELISTS; ++j) { q = p -> ptrfree_freelists[j]; if ((word)q > HBLKSIZE) GC_set_fl_marks(q); q = p -> normal_freelists[j]; if ((word)q > HBLKSIZE) GC_set_fl_marks(q); # ifdef GC_GCJ_SUPPORT q = p -> gcj_freelists[j]; if ((word)q > HBLKSIZE) GC_set_fl_marks(q); # endif /* GC_GCJ_SUPPORT */ } } #if defined(GC_ASSERTIONS) /* Check that all thread-local free-lists in p are completely marked. */ void GC_check_tls_for(GC_tlfs p) { ptr_t q; int j; for (j = 1; j < TINY_FREELISTS; ++j) { q = p -> ptrfree_freelists[j]; if ((word)q > HBLKSIZE) GC_check_fl_marks(q); q = p -> normal_freelists[j]; if ((word)q > HBLKSIZE) GC_check_fl_marks(q); # ifdef GC_GCJ_SUPPORT q = p -> gcj_freelists[j]; if ((word)q > HBLKSIZE) GC_check_fl_marks(q); # endif /* GC_GCJ_SUPPORT */ } } #endif /* GC_ASSERTIONS */ # else /* !THREAD_LOCAL_ALLOC */ # define GC_destroy_thread_local(t) # endif /* !THREAD_LOCAL_ALLOC */ synopsis-0.12/src/Synopsis/gc/configure0000775000076400007640000271132511126175476017622 0ustar stefanstefan#! /bin/sh # From configure.ac Revision: 1.25 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for gc 7.0. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # 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 exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='gc' PACKAGE_TARNAME='gc' PACKAGE_VERSION='7.0' PACKAGE_STRING='gc 7.0' PACKAGE_BUGREPORT='Hans.Boehm@hp.com' ac_unique_file="gcj_mlc.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA am__isrc CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT GC_VERSION CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CCAS CCASFLAGS CCASDEPMODE am__fastdepCCAS_TRUE am__fastdepCCAS_FALSE AR RANLIB GC_CFLAGS THREADDLLIBS THREADS_TRUE THREADS_FALSE PTHREADS_TRUE PTHREADS_FALSE DARWIN_THREADS_TRUE DARWIN_THREADS_FALSE WIN32_THREADS_TRUE WIN32_THREADS_FALSE COMPILER_XLC_TRUE COMPILER_XLC_FALSE extra_ldflags_libgc EXTRA_TEST_LIBS target_all CPLUSPLUS_TRUE CPLUSPLUS_FALSE INCLUDES CXXINCLUDES addobjs addlibs GREP EGREP LN_S ECHO CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL ENABLE_GCJ_SUPPORT_TRUE ENABLE_GCJ_SUPPORT_FALSE UNWINDLIBS USE_LIBDIR_TRUE USE_LIBDIR_FALSE subdirs USE_INTERNAL_LIBATOMIC_OPS_TRUE USE_INTERNAL_LIBATOMIC_OPS_FALSE NEED_ATOMIC_OPS_ASM_TRUE NEED_ATOMIC_OPS_ASM_FALSE atomic_ops_libs LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CXX CXXFLAGS CCC CCAS CCASFLAGS CPP CXXCPP F77 FFLAGS' ac_subdirs_all='libatomic_ops' # 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. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_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 ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_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'` 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 ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_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'` 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; }; } 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 directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $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 test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures gc 7.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/gc] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of gc 7.0:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-threads=TYPE choose threading package --enable-parallel-mark parallelize marking and free list construction --enable-cplusplus install C++ support --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) --disable-gcj-support Disable support for gcj. --disable-java-finalization Disable support for java finalization. --disable-atomic-uncollectible Disable support for atomic uncollectible allocation. --enable-redirect-malloc Redirect malloc and friends to GC routines --enable-large-config Optimize for large (> 100 MB) heap or root set --enable-gc-debug include full support for pointer backtracing etc. --enable-gc-assertions collector-internal assertion checking Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-ecos enable runtime eCos target support --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] --with-target-subdir=SUBDIR configuring with a cross compiler --with-cross-host=HOST configuring with a cross compiler Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXX C++ compiler command CXXFLAGS C++ compiler flags CCAS assembler compiler command (defaults to CC) CCASFLAGS assembler compiler flags (defaults to CFLAGS) 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. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF gc configure 7.0 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by gc $as_me 7.0, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file 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 $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { 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 ## version must conform to [0-9]+[.][0-9]+(alpha[0-9]+)? ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 echo "$as_me: error: cannot run $SHELL $ac_aux_dir/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_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && { { 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=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_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; } case $ac_cv_build in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 echo "$as_me: error: invalid value of canonical build" >&2;} { (exit 1); exit 1; }; };; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { 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 if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 echo "$as_me: error: invalid value of canonical host" >&2;} { (exit 1); exit 1; }; };; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { echo "$as_me:$LINENO: checking target system type" >&5 echo $ECHO_N "checking target system type... $ECHO_C" >&6; } if test "${ac_cv_target+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_target" >&5 echo "${ECHO_T}$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5 echo "$as_me: error: invalid value of canonical target" >&2;} { (exit 1); exit 1; }; };; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- { echo "$as_me:$LINENO: checking GC version numbers" >&5 echo $ECHO_N "checking GC version numbers... $ECHO_C" >&6; } GC_VERSION_MAJOR=`echo $PACKAGE_VERSION | sed 's/^\([0-9][0-9]*\)[.].*$/\1/g'` GC_VERSION_MINOR=`echo $PACKAGE_VERSION | sed 's/^[^.]*[.]\([0-9][0-9]*\).*$/\1/g'` GC_ALPHA_VERSION=`echo $PACKAGE_VERSION | sed 's/^[^.]*[.][0-9]*//'` case "$GC_ALPHA_VERSION" in alpha*) GC_ALPHA_VERSION=`echo $GC_ALPHA_VERSION \ | sed 's/alpha\([0-9][0-9]*\)/\1/'` ;; *) GC_ALPHA_MAJOR='' ;; esac if test :$GC_VERSION_MAJOR: = :: \ -o :$GC_VERSION_MINOR: = :: ; then { echo "$as_me:$LINENO: result: invalid" >&5 echo "${ECHO_T}invalid" >&6; } { { echo "$as_me:$LINENO: error: nonconforming PACKAGE_VERSION='$PACKAGE_VERSION'" >&5 echo "$as_me: error: nonconforming PACKAGE_VERSION='$PACKAGE_VERSION'" >&2;} { (exit 1); exit 1; }; } fi cat >>confdefs.h <<_ACEOF #define GC_VERSION_MAJOR $GC_VERSION_MAJOR _ACEOF cat >>confdefs.h <<_ACEOF #define GC_VERSION_MINOR $GC_VERSION_MINOR _ACEOF if test :$GC_ALPHA_VERSION: != :: ; then cat >>confdefs.h <<_ACEOF #define GC_ALPHA_VERSION $GC_ALPHA_VERSION _ACEOF fi { echo "$as_me:$LINENO: result: major=$GC_VERSION_MAJOR minor=$GC_VERSION_MINOR \ ${GC_ALPHA_VERSION:+alpha=}$GC_ALPHA_VERSION" >&5 echo "${ECHO_T}major=$GC_VERSION_MAJOR minor=$GC_VERSION_MINOR \ ${GC_ALPHA_VERSION:+alpha=}$GC_ALPHA_VERSION" >&6; } am__api_version='1.10' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. { 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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done IFS=$as_save_IFS fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { 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 -f 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 { echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } if test -z "$MKDIR_P"; then if test "${ac_cv_path_mkdir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. test -d ./--version && rmdir ./--version MKDIR_P="$ac_install_sh -d" fi fi { echo "$as_me:$LINENO: result: $MKDIR_P" >&5 echo "${ECHO_T}$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { 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 x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { 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 if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then { { 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 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='gc' VERSION='7.0' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { 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 if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' { echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE 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 was given. if test "${enable_dependency_tracking+set}" = set; then enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { 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` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then 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 # Check that 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' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 that 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 { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { 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 ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { 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/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { 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 if test "x$CC" != xcc; then { echo "$as_me:$LINENO: checking whether $CC and cc understand -c and -o together" >&5 echo $ECHO_N "checking whether $CC and cc understand -c and -o together... $ECHO_C" >&6; } else { echo "$as_me:$LINENO: checking whether cc understands -c and -o together" >&5 echo $ECHO_N "checking whether cc understands -c and -o together... $ECHO_C" >&6; } fi set dummy $CC; ac_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then 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 # Make sure it works both with $CC and with simple cc. # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -f conftest2.$ac_objext && { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. if { ac_try='cc -c conftest.$ac_ext >&5' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && test -f conftest2.$ac_objext && { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # cc works too. : else # cc exists but doesn't like -o. eval ac_cv_prog_cc_${ac_cc}_c_o=no fi fi fi else eval ac_cv_prog_cc_${ac_cc}_c_o=no fi rm -f core conftest* fi if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then { 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; } cat >>confdefs.h <<\_ACEOF #define NO_MINUS_C_MINUS_O 1 _ACEOF fi # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC ac_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { 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 g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { 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 if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { 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 ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= { echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { 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 # By default we simply use the C compiler to build assembly code. test "${CCAS+set}" = set || CCAS=$CC test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS depcc="$CCAS" 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_CCAS_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_CCAS_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CCAS_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CCAS_dependencies_compiler_type=none fi fi { echo "$as_me:$LINENO: result: $am_cv_CCAS_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CCAS_dependencies_compiler_type" >&6; } CCASDEPMODE=depmode=$am_cv_CCAS_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CCAS_dependencies_compiler_type" = gcc3; then am__fastdepCCAS_TRUE= am__fastdepCCAS_FALSE='#' else am__fastdepCCAS_TRUE='#' am__fastdepCCAS_FALSE= fi ## FIXME: really needed? (AC_LIBTOOL already provides this) 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 IFS=$as_save_IFS 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_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 if test "x$ac_ct_AR" = x; then AR="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { 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 if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi # :) # 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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done IFS=$as_save_IFS fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { 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' . ${srcdir}/configure.host GC_CFLAGS=${gc_cflags} # Check whether --enable-threads was given. if test "${enable_threads+set}" = set; then enableval=$enable_threads; THREADS=$enableval else { echo "$as_me:$LINENO: checking for thread model used by GCC" >&5 echo $ECHO_N "checking for thread model used by GCC... $ECHO_C" >&6; } THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` if test -z "$THREADS"; then THREADS=no fi { echo "$as_me:$LINENO: result: $THREADS" >&5 echo "${ECHO_T}$THREADS" >&6; } fi # Check whether --enable-parallel-mark was given. if test "${enable_parallel_mark+set}" = set; then enableval=$enable_parallel_mark; case "$THREADS" in no | none | single) { { echo "$as_me:$LINENO: error: Parallel mark requires --enable-threads=x spec" >&5 echo "$as_me: error: Parallel mark requires --enable-threads=x spec" >&2;} { (exit 1); exit 1; }; } ;; esac fi # Check whether --enable-cplusplus was given. if test "${enable_cplusplus+set}" = set; then enableval=$enable_cplusplus; fi INCLUDES=-I${srcdir}/include THREADDLLIBS= need_atomic_ops_asm=false ## Libraries needed to support dynamic loading and/or threads. case "$THREADS" in no | none | single) THREADS=none ;; posix | pthreads) THREADS=posix THREADDLLIBS=-lpthread case "$host" in x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux*) cat >>confdefs.h <<\_ACEOF #define GC_LINUX_THREADS 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _REENTRANT 1 _ACEOF if test "${enable_parallel_mark}" = yes; then cat >>confdefs.h <<\_ACEOF #define PARALLEL_MARK 1 _ACEOF fi cat >>confdefs.h <<\_ACEOF #define THREAD_LOCAL_ALLOC 1 _ACEOF { echo "$as_me:$LINENO: WARNING: \"Explict GC_INIT() calls may be required.\"" >&5 echo "$as_me: WARNING: \"Explict GC_INIT() calls may be required.\"" >&2;}; ;; *-*-linux*) cat >>confdefs.h <<\_ACEOF #define GC_LINUX_THREADS 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _REENTRANT 1 _ACEOF ;; *-*-aix*) cat >>confdefs.h <<\_ACEOF #define GC_AIX_THREADS 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _REENTRANT 1 _ACEOF ;; *-*-hpux11*) { echo "$as_me:$LINENO: WARNING: \"Only HP/UX 11 POSIX threads are supported.\"" >&5 echo "$as_me: WARNING: \"Only HP/UX 11 POSIX threads are supported.\"" >&2;} cat >>confdefs.h <<\_ACEOF #define GC_HPUX_THREADS 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _POSIX_C_SOURCE 199506L _ACEOF if test "${enable_parallel_mark}" = yes; then cat >>confdefs.h <<\_ACEOF #define PARALLEL_MARK 1 _ACEOF fi cat >>confdefs.h <<\_ACEOF #define THREAD_LOCAL_ALLOC 1 _ACEOF { echo "$as_me:$LINENO: WARNING: \"Explict GC_INIT() calls may be required.\"" >&5 echo "$as_me: WARNING: \"Explict GC_INIT() calls may be required.\"" >&2;}; THREADDLLIBS="-lpthread -lrt" # HPUX needs REENTRANT for the _r calls. cat >>confdefs.h <<\_ACEOF #define _REENTRANT 1 _ACEOF ;; *-*-hpux10*) { echo "$as_me:$LINENO: WARNING: \"Only HP-UX 11 POSIX threads are supported.\"" >&5 echo "$as_me: WARNING: \"Only HP-UX 11 POSIX threads are supported.\"" >&2;} ;; *-*-freebsd*) { echo "$as_me:$LINENO: WARNING: \"FreeBSD does not yet fully support threads with Boehm GC.\"" >&5 echo "$as_me: WARNING: \"FreeBSD does not yet fully support threads with Boehm GC.\"" >&2;} cat >>confdefs.h <<\_ACEOF #define GC_FREEBSD_THREADS 1 _ACEOF INCLUDES="$INCLUDES -pthread" ;; *-*-kfreebsd*-gnu) cat >>confdefs.h <<\_ACEOF #define GC_FREEBSD_THREADS 1 _ACEOF INCLUDES="$INCLUDES -pthread" THREADDLLIBS=-pthread cat >>confdefs.h <<\_ACEOF #define _REENTRANT 1 _ACEOF if test "${enable_parallel_mark}" = yes; then cat >>confdefs.h <<\_ACEOF #define PARALLEL_MARK 1 _ACEOF fi cat >>confdefs.h <<\_ACEOF #define THREAD_LOCAL_ALLOC 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define USE_COMPILER_TLS 1 _ACEOF ;; *-*-gnu*) cat >>confdefs.h <<\_ACEOF #define GC_GNU_THREADS 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _REENTRANT 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define THREAD_LOCAL_ALLOC 1 _ACEOF ;; *-*-netbsd*) { echo "$as_me:$LINENO: WARNING: \"Only on NetBSD 2.0 or later.\"" >&5 echo "$as_me: WARNING: \"Only on NetBSD 2.0 or later.\"" >&2;} cat >>confdefs.h <<\_ACEOF #define GC_NETBSD_THREADS 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _REENTRANT 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _PTHREADS 1 _ACEOF THREADDLLIBS="-lpthread -lrt" ;; *-*-solaris*) cat >>confdefs.h <<\_ACEOF #define GC_SOLARIS_THREADS 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define THREAD_LOCAL_ALLOC 1 _ACEOF THREADDLLIBS="-lpthread -lrt" if test "$GCC" != yes; then CFLAGS="$CFLAGS -O" need_atomic_ops_asm=true fi ;; *-*-irix*) cat >>confdefs.h <<\_ACEOF #define GC_IRIX_THREADS 1 _ACEOF ;; *-*-cygwin*) cat >>confdefs.h <<\_ACEOF #define GC_WIN32_THREADS 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define THREAD_LOCAL_ALLOC 1 _ACEOF win32_threads=true ;; *-*-darwin*) cat >>confdefs.h <<\_ACEOF #define GC_DARWIN_THREADS 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define THREAD_LOCAL_ALLOC 1 _ACEOF { echo "$as_me:$LINENO: WARNING: \"Explict GC_INIT() calls may be required.\"" >&5 echo "$as_me: WARNING: \"Explict GC_INIT() calls may be required.\"" >&2;}; if test "${enable_parallel_mark}" = yes; then cat >>confdefs.h <<\_ACEOF #define PARALLEL_MARK 1 _ACEOF fi darwin_threads=true ;; *-*-osf*) cat >>confdefs.h <<\_ACEOF #define GC_OSF1_THREADS 1 _ACEOF if test "${enable_parallel_mark}" = yes; then cat >>confdefs.h <<\_ACEOF #define PARALLEL_MARK 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define THREAD_LOCAL_ALLOC 1 _ACEOF { echo "$as_me:$LINENO: WARNING: \"Explict GC_INIT() calls may be required.\"" >&5 echo "$as_me: WARNING: \"Explict GC_INIT() calls may be required.\"" >&2;}; # May want to enable it in other cases, too. # Measurements havent yet been done. fi INCLUDES="$INCLUDES -pthread" THREADDLLIBS="-lpthread -lrt" ;; *) { { echo "$as_me:$LINENO: error: \"Pthreads not supported by the GC on this platform.\"" >&5 echo "$as_me: error: \"Pthreads not supported by the GC on this platform.\"" >&2;} { (exit 1); exit 1; }; } ;; esac ;; win32) cat >>confdefs.h <<\_ACEOF #define GC_WIN32_THREADS 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define NO_GETENV 1 _ACEOF ;; dgux386) THREADS=dgux386 { echo "$as_me:$LINENO: result: $THREADDLLIBS" >&5 echo "${ECHO_T}$THREADDLLIBS" >&6; } # Use pthread GCC switch THREADDLLIBS=-pthread if test "${enable_parallel_mark}" = yes; then cat >>confdefs.h <<\_ACEOF #define PARALLEL_MARK 1 _ACEOF fi cat >>confdefs.h <<\_ACEOF #define THREAD_LOCAL_ALLOC 1 _ACEOF { echo "$as_me:$LINENO: WARNING: \"Explict GC_INIT() calls may be required.\"" >&5 echo "$as_me: WARNING: \"Explict GC_INIT() calls may be required.\"" >&2;}; cat >>confdefs.h <<\_ACEOF #define GC_DGUX386_THREADS 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define DGUX_THREADS 1 _ACEOF # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread INCLUDES="-pthread $INCLUDES" ;; aix) THREADS=posix THREADDLLIBS=-lpthread cat >>confdefs.h <<\_ACEOF #define GC_AIX_THREADS 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _REENTRANT 1 _ACEOF ;; decosf1 | irix | mach | os2 | solaris | dce | vxworks) { { echo "$as_me:$LINENO: error: thread package $THREADS not yet supported" >&5 echo "$as_me: error: thread package $THREADS not yet supported" >&2;} { (exit 1); exit 1; }; } ;; *) { { echo "$as_me:$LINENO: error: $THREADS is an unknown thread package" >&5 echo "$as_me: error: $THREADS is an unknown thread package" >&2;} { (exit 1); exit 1; }; } ;; esac if test x$THREADS != xnone; then THREADS_TRUE= THREADS_FALSE='#' else THREADS_TRUE='#' THREADS_FALSE= fi if test x$THREADS = xposix; then PTHREADS_TRUE= PTHREADS_FALSE='#' else PTHREADS_TRUE='#' PTHREADS_FALSE= fi if test x$darwin_threads = xtrue; then DARWIN_THREADS_TRUE= DARWIN_THREADS_FALSE='#' else DARWIN_THREADS_TRUE='#' DARWIN_THREADS_FALSE= fi if test x$win32_threads = xtrue; then WIN32_THREADS_TRUE= WIN32_THREADS_FALSE='#' else WIN32_THREADS_TRUE='#' WIN32_THREADS_FALSE= fi case "$host" in powerpc-*-darwin*) powerpc_darwin=true ;; esac # Darwin needs a few extra special tests to deal with variation in the # system headers. case "$host" in powerpc*-*-darwin*) { echo "$as_me:$LINENO: checking for ppc_thread_state_t.r0" >&5 echo $ECHO_N "checking for ppc_thread_state_t.r0... $ECHO_C" >&6; } if test "${ac_cv_member_ppc_thread_state_t_r0+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { static ppc_thread_state_t ac_aggr; if (ac_aggr.r0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_ppc_thread_state_t_r0=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { static ppc_thread_state_t ac_aggr; if (sizeof ac_aggr.r0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_ppc_thread_state_t_r0=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_ppc_thread_state_t_r0=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_member_ppc_thread_state_t_r0" >&5 echo "${ECHO_T}$ac_cv_member_ppc_thread_state_t_r0" >&6; } if test $ac_cv_member_ppc_thread_state_t_r0 = yes; then cat >>confdefs.h <<\_ACEOF #define HAS_PPC_THREAD_STATE_R0 1 _ACEOF fi { echo "$as_me:$LINENO: checking for ppc_thread_state_t.__r0" >&5 echo $ECHO_N "checking for ppc_thread_state_t.__r0... $ECHO_C" >&6; } if test "${ac_cv_member_ppc_thread_state_t___r0+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { static ppc_thread_state_t ac_aggr; if (ac_aggr.__r0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_ppc_thread_state_t___r0=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { static ppc_thread_state_t ac_aggr; if (sizeof ac_aggr.__r0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_ppc_thread_state_t___r0=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_ppc_thread_state_t___r0=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_member_ppc_thread_state_t___r0" >&5 echo "${ECHO_T}$ac_cv_member_ppc_thread_state_t___r0" >&6; } if test $ac_cv_member_ppc_thread_state_t___r0 = yes; then cat >>confdefs.h <<\_ACEOF #define HAS_PPC_THREAD_STATE___R0 1 _ACEOF fi { echo "$as_me:$LINENO: checking for ppc_thread_state64_t.r0" >&5 echo $ECHO_N "checking for ppc_thread_state64_t.r0... $ECHO_C" >&6; } if test "${ac_cv_member_ppc_thread_state64_t_r0+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { static ppc_thread_state64_t ac_aggr; if (ac_aggr.r0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_ppc_thread_state64_t_r0=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { static ppc_thread_state64_t ac_aggr; if (sizeof ac_aggr.r0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_ppc_thread_state64_t_r0=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_ppc_thread_state64_t_r0=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_member_ppc_thread_state64_t_r0" >&5 echo "${ECHO_T}$ac_cv_member_ppc_thread_state64_t_r0" >&6; } if test $ac_cv_member_ppc_thread_state64_t_r0 = yes; then cat >>confdefs.h <<\_ACEOF #define HAS_PPC_THREAD_STATE64_R0 1 _ACEOF fi { echo "$as_me:$LINENO: checking for ppc_thread_state64_t.__r0" >&5 echo $ECHO_N "checking for ppc_thread_state64_t.__r0... $ECHO_C" >&6; } if test "${ac_cv_member_ppc_thread_state64_t___r0+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { static ppc_thread_state64_t ac_aggr; if (ac_aggr.__r0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_ppc_thread_state64_t___r0=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { static ppc_thread_state64_t ac_aggr; if (sizeof ac_aggr.__r0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_ppc_thread_state64_t___r0=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_ppc_thread_state64_t___r0=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_member_ppc_thread_state64_t___r0" >&5 echo "${ECHO_T}$ac_cv_member_ppc_thread_state64_t___r0" >&6; } if test $ac_cv_member_ppc_thread_state64_t___r0 = yes; then cat >>confdefs.h <<\_ACEOF #define HAS_PPC_THREAD_STATE64___R0 1 _ACEOF fi ;; i?86*-*-darwin*) { echo "$as_me:$LINENO: checking for x86_thread_state32_t.eax" >&5 echo $ECHO_N "checking for x86_thread_state32_t.eax... $ECHO_C" >&6; } if test "${ac_cv_member_x86_thread_state32_t_eax+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { static x86_thread_state32_t ac_aggr; if (ac_aggr.eax) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_x86_thread_state32_t_eax=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { static x86_thread_state32_t ac_aggr; if (sizeof ac_aggr.eax) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_x86_thread_state32_t_eax=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_x86_thread_state32_t_eax=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_member_x86_thread_state32_t_eax" >&5 echo "${ECHO_T}$ac_cv_member_x86_thread_state32_t_eax" >&6; } if test $ac_cv_member_x86_thread_state32_t_eax = yes; then cat >>confdefs.h <<\_ACEOF #define HAS_X86_THREAD_STATE32_EAX 1 _ACEOF fi { echo "$as_me:$LINENO: checking for x86_thread_state32_t.__eax" >&5 echo $ECHO_N "checking for x86_thread_state32_t.__eax... $ECHO_C" >&6; } if test "${ac_cv_member_x86_thread_state32_t___eax+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { static x86_thread_state32_t ac_aggr; if (ac_aggr.__eax) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_x86_thread_state32_t___eax=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { static x86_thread_state32_t ac_aggr; if (sizeof ac_aggr.__eax) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_x86_thread_state32_t___eax=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_x86_thread_state32_t___eax=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_member_x86_thread_state32_t___eax" >&5 echo "${ECHO_T}$ac_cv_member_x86_thread_state32_t___eax" >&6; } if test $ac_cv_member_x86_thread_state32_t___eax = yes; then cat >>confdefs.h <<\_ACEOF #define HAS_X86_THREAD_STATE32___EAX 1 _ACEOF fi ;; x86_64-*-darwin*) { echo "$as_me:$LINENO: checking for x86_thread_state64_t.rax" >&5 echo $ECHO_N "checking for x86_thread_state64_t.rax... $ECHO_C" >&6; } if test "${ac_cv_member_x86_thread_state64_t_rax+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { static x86_thread_state64_t ac_aggr; if (ac_aggr.rax) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_x86_thread_state64_t_rax=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { static x86_thread_state64_t ac_aggr; if (sizeof ac_aggr.rax) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_x86_thread_state64_t_rax=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_x86_thread_state64_t_rax=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_member_x86_thread_state64_t_rax" >&5 echo "${ECHO_T}$ac_cv_member_x86_thread_state64_t_rax" >&6; } if test $ac_cv_member_x86_thread_state64_t_rax = yes; then cat >>confdefs.h <<\_ACEOF #define HAS_X86_THREAD_STATE64_RAX 1 _ACEOF fi { echo "$as_me:$LINENO: checking for x86_thread_state64_t.__rax" >&5 echo $ECHO_N "checking for x86_thread_state64_t.__rax... $ECHO_C" >&6; } if test "${ac_cv_member_x86_thread_state64_t___rax+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { static x86_thread_state64_t ac_aggr; if (ac_aggr.__rax) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_x86_thread_state64_t___rax=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { static x86_thread_state64_t ac_aggr; if (sizeof ac_aggr.__rax) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_x86_thread_state64_t___rax=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_x86_thread_state64_t___rax=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_member_x86_thread_state64_t___rax" >&5 echo "${ECHO_T}$ac_cv_member_x86_thread_state64_t___rax" >&6; } if test $ac_cv_member_x86_thread_state64_t___rax = yes; then cat >>confdefs.h <<\_ACEOF #define HAS_X86_THREAD_STATE64___RAX 1 _ACEOF fi ;; *) ;; esac { echo "$as_me:$LINENO: checking for xlc" >&5 echo $ECHO_N "checking for xlc... $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. */ int main () { #ifndef __xlC__ # error #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then compiler_xlc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 compiler_xlc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $compiler_xlc" >&5 echo "${ECHO_T}$compiler_xlc" >&6; } if test $compiler_xlc = yes; then COMPILER_XLC_TRUE= COMPILER_XLC_FALSE='#' else COMPILER_XLC_TRUE='#' COMPILER_XLC_FALSE= fi if test $compiler_xlc = yes -a "$powerpc_darwin" = true; then # the darwin stack-frame-walking code is completely broken on xlc cat >>confdefs.h <<\_ACEOF #define DARWIN_DONT_PARSE_STACK 1 _ACEOF fi # We never want libdl on darwin. It is a fake libdl that just ends up making # dyld calls anyway case "$host" in *-*-darwin*) ;; *) { 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 GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 THREADDLLIBS="$THREADDLLIBS -ldl" fi ;; esac # extra LD Flags which are required for targets case "${host}" in *-*-darwin*) extra_ldflags_libgc=-Wl,-single_module ;; esac target_all=libgc.la TARGET_ECOS="no" # Check whether --with-ecos was given. if test "${with_ecos+set}" = set; then withval=$with_ecos; TARGET_ECOS="$with_ecos" fi addobjs= addlibs= CXXINCLUDES= case "$TARGET_ECOS" in no) ;; *) cat >>confdefs.h <<\_ACEOF #define ECOS 1 _ACEOF CXXINCLUDES="-I${TARGET_ECOS}/include" addobjs="$addobjs ecos.lo" ;; esac if test "${enable_cplusplus}" = yes; then CPLUSPLUS_TRUE= CPLUSPLUS_FALSE='#' else CPLUSPLUS_TRUE='#' CPLUSPLUS_FALSE= fi # Configuration of shared libraries # { echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; } # Check whether --enable-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 case "$host" in alpha-*-openbsd*) enable_shared=no { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } ;; *) { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } ;; esac # Configuration of machine-dependent code # { echo "$as_me:$LINENO: checking which machine-dependent code should be used" >&5 echo $ECHO_N "checking which machine-dependent code should be used... $ECHO_C" >&6; } machdep= case "$host" in alpha-*-openbsd*) machdep="mach_dep.lo" if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then { echo "$as_me:$LINENO: WARNING: OpenBSD/Alpha without dlopen(). Shared library support is disabled" >&5 echo "$as_me: WARNING: OpenBSD/Alpha without dlopen(). Shared library support is disabled" >&2;} fi ;; alpha*-*-linux*) machdep="mach_dep.lo" ;; i?86-*-solaris2.[89] | i?86-*-solaris2.1?) cat >>confdefs.h <<\_ACEOF #define SOLARIS25_PROC_VDB_BUG_FIXED 1 _ACEOF ;; mipstx39-*-elf*) machdep="mach_dep.lo" cat >>confdefs.h <<\_ACEOF #define STACKBASE __stackbase _ACEOF cat >>confdefs.h <<\_ACEOF #define DATASTART_IS_ETEXT 1 _ACEOF ;; mips-dec-ultrix*) machdep="mach-dep.lo" ;; mips-nec-sysv*|mips-unknown-sysv*) ;; mips*-*-linux*) ;; mips-*-*) machdep="mach_dep.lo" ;; sparc-*-netbsd*) machdep="mach_dep.lo sparc_netbsd_mach_dep.lo" ;; sparc-sun-solaris2.3) machdep="mach_dep.lo sparc_mach_dep.lo" cat >>confdefs.h <<\_ACEOF #define SUNOS53_SHARED_LIB 1 _ACEOF ;; sparc*-sun-solaris2.*) machdep="mach_dep.lo sparc_mach_dep.lo" ;; ia64-*-*) machdep="mach_dep.lo ia64_save_regs_in_stack.lo" ;; esac if test x"$machdep" = x; then { echo "$as_me:$LINENO: result: $machdep" >&5 echo "${ECHO_T}$machdep" >&6; } machdep="mach_dep.lo" fi addobjs="$addobjs $machdep" # Check whether --enable-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 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 { 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 grep that handles long lines and -e" >&5 echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Extract the first word of "grep ggrep" to use in msg output if test -z "$GREP"; then set dummy grep ggrep; ac_prog_name=$2 if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS fi GREP="$ac_cv_path_GREP" if test -z "$GREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 echo "${ECHO_T}$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } if test "${ac_cv_path_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_path_EGREP="$GREP -E" else # Extract the first word of "egrep" to use in msg output if test -z "$EGREP"; then set dummy egrep; ac_prog_name=$2 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS fi EGREP="$ac_cv_path_EGREP" if test -z "$EGREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi 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 variants of GNU ld 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 lds 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='$LTCC $LTCFLAGS -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_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_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" done 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 ;; interix3*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; 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 ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) 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 ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | 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"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check whether --enable-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 6971 "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 { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 ;; sparc*-*solaris*) # 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 *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) LD="${LD-ld} -64" ;; esac ;; esac fi rm -rf conftest* ;; 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* 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 { as_var=$as_ac_Header; eval "test \"\${$as_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. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&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 { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else 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 Hans.Boehm@hp.com ## ## -------------------------------- ## _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 { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&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=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.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 nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.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 nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.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=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu 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 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 IFS=$as_save_IFS 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 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_F77="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_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 if test "x$ac_ct_F77" = x; then F77="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac F77=$ac_ct_F77 fi fi # Provide some information about the compiler. echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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 core 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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 core 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 all BSDs 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` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; 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 ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 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*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; 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 MSVC, # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 IFS=$as_save_IFS 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="ar" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_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 if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { 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 if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi if test -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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { 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 if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi 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 "$LTCFLAGS" && LTCFLAGS=$CFLAGS 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="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; 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 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 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"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # 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; /^ *+/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; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $rm conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... 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}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:9234: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:9238: \$? = $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 -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || 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' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; 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* | pgf95*) # 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='-Bstatic' ;; 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' ;; 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*) 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 ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; 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}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:9502: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:9506: \$? = $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 -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || 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 # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag 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_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker 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 -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/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 { 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}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:9606: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:9610: \$? = $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 -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $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 ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # 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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; interix3*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; 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* | pgf95*) # 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*) 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 ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; 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 "$lt_prog_compiler_static"; 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 { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${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 '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_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 { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${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 lds 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 lds 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*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then 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 fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -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*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld='+b $libdir' hardcode_direct=no hardcode_shlibpath_var=no ;; *) 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=: ;; 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*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; 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 # # 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 pic_flag=$lt_prog_compiler_pic 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~ chmod a+x \$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. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi 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 ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes 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' ;; interix3*) 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' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; 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 # 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 /usr/lib $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 sys_lib_dlsearch_path_spec="/usr/lib" 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" ;; 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.3*) 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 ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; 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 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 { 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 GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char 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 #endif int main () { return shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char 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 #endif int main () { return dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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" wl=$lt_prog_compiler_wl 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); */ } else puts (dlerror ()); 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; ) >&5 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_dlunknown|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 wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { 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); */ } else puts (dlerror ()); 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; ) >&5 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_dlunknown|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 library types will 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 LTCFLAGS 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 # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # 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 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 if test -z "$LTCFLAGS"; then eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" 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=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu 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_shlibpath_var_CXX=unsupported 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=cpp # 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"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # 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; /^ *+/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; /^ *+/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 $as_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 $as_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 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 variants of GNU ld 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 lds 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 { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${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 '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_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 { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' archive_cmds_need_lc_CXX=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_CXX=no 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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $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 lds 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 lds 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 hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_CXX='+b $libdir' ;; *) export_dynamic_flag_spec_CXX='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) 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*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) 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 hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) 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 ;; interix3*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; 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 ;; 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++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -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} ${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 output_verbose_link_cmd='echo' # 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 ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='${wl}-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. # So that behaviour is only enabled if SCOABSPATH is set to a # non-empty value in the environment. Most likely only useful for # creating official distributions of packages. # This is a hack until libtool officially supports absolute path # names for shared libraries. no_undefined_flag_CXX='${wl}-z,text' allow_undefined_flag_CXX='${wl}-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; 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" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... 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 # PORTME: override above test on systems where it is broken case $host_os in interix3*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; solaris*) case $cc_basename in CC*) # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. postdeps_CXX='-lCstd -lCrun' ;; esac ;; esac 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= ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; 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='${wl}-a ${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='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; 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='-Bstatic' ;; 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*) ;; 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 ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; 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}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:14354: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:14358: \$? = $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 -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || 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 # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" { echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } if test "${lt_prog_compiler_static_works_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_CXX=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker 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 -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_CXX=yes fi else lt_prog_compiler_static_works_CXX=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi { echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6; } if test x"$lt_prog_compiler_static_works_CXX" = xyes; then : else lt_prog_compiler_static_CXX= fi { 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}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:14458: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:14462: \$? = $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 -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $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 # # 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 pic_flag=$lt_prog_compiler_pic_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~ chmod a+x \$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. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi 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 ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes 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' ;; interix3*) 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' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; 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 # 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 /usr/lib $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 sys_lib_dlsearch_path_spec="/usr/lib" 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" ;; 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.3*) 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 ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; 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 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 { 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 # 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 LTCFLAGS 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 # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # 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"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # 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; /^ *+/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; /^ *+/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; } 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' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; 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* | pgf95*) # 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='-Bstatic' ;; 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' ;; 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*) 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 ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; 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}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:16028: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:16032: \$? = $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 -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || 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 # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\" { echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } if test "${lt_prog_compiler_static_works_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_F77=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker 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 -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_F77=yes fi else lt_prog_compiler_static_works_F77=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi { echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6; } if test x"$lt_prog_compiler_static_works_F77" = xyes; then : else lt_prog_compiler_static_F77= fi { 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}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:16132: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:16136: \$? = $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 -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_F77=yes fi fi chmod u+w . 2>&5 $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 ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; 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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_F77=no fi ;; interix3*) hardcode_direct_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; 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* | pgf95*) # 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*) 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 ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs_F77=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; esac ;; 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 "$lt_prog_compiler_static"; 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 { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${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 '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_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 { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_F77='$convenience' archive_cmds_need_lc_F77=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${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 lds 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 lds 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*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then 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 fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -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*) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_F77='+b $libdir' hardcode_direct_F77=no hardcode_shlibpath_var_F77=no ;; *) 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=: ;; 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*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) no_undefined_flag_F77='${wl}-z,text' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_F77='${wl}-z,text' allow_undefined_flag_F77='${wl}-z,nodefs' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_F77=':' link_all_deplibs_F77=yes export_dynamic_flag_spec_F77='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; 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 # # 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 pic_flag=$lt_prog_compiler_pic_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~ chmod a+x \$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. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi 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 ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes 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' ;; interix3*) 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' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; 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 # 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 /usr/lib $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 sys_lib_dlsearch_path_spec="/usr/lib" 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" ;; 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.3*) 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 ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; 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 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 { 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 # 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 LTCFLAGS 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 # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # 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"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # 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; /^ *+/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; /^ *+/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 ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... 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}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:18334: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:18338: \$? = $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 -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || 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' ;; interix3*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; 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* | pgf95*) # 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='-Bstatic' ;; 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' ;; 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*) 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 ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' ;; 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}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:18602: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:18606: \$? = $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 -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || 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 # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\" { echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; } if test "${lt_prog_compiler_static_works_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_prog_compiler_static_works_GCJ=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker 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 -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_static_works_GCJ=yes fi else lt_prog_compiler_static_works_GCJ=yes fi fi $rm conftest* LDFLAGS="$save_LDFLAGS" fi { echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5 echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6; } if test x"$lt_prog_compiler_static_works_GCJ" = xyes; then : else lt_prog_compiler_static_GCJ= fi { 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}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:18706: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:18710: \$? = $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 -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_GCJ=yes fi fi chmod u+w . 2>&5 $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 ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; 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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_GCJ=no fi ;; interix3*) hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' export_dynamic_flag_spec_GCJ='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; 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* | pgf95*) # 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*) 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 ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs_GCJ=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' else ld_shlibs_GCJ=no fi ;; esac ;; 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 "$lt_prog_compiler_static"; 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 { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${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 '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_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 { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_GCJ='$convenience' archive_cmds_need_lc_GCJ=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${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 lds 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 lds 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*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then 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 fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -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*) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' hardcode_libdir_separator_GCJ=: case $host_cpu in hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' hardcode_direct_GCJ=no hardcode_shlibpath_var_GCJ=no ;; *) 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=: ;; 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*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) no_undefined_flag_GCJ='${wl}-z,text' archive_cmds_need_lc_GCJ=no hardcode_shlibpath_var_GCJ=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_GCJ='${wl}-z,text' allow_undefined_flag_GCJ='${wl}-z,nodefs' archive_cmds_need_lc_GCJ=no hardcode_shlibpath_var_GCJ=no hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator_GCJ=':' link_all_deplibs_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; 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 # # 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 pic_flag=$lt_prog_compiler_pic_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~ chmod a+x \$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. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi 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 ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; freebsd*) # from 4.6 on shlibpath_overrides_runpath=yes 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' ;; interix3*) 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' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; 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 # 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 /usr/lib $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 sys_lib_dlsearch_path_spec="/usr/lib" 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" ;; 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.3*) 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 ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' shlibpath_overrides_runpath=no else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' shlibpath_overrides_runpath=yes case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; 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 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 { 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 # 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 LTCFLAGS 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 # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # 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"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # 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; /^ *+/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; /^ *+/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 LTCFLAGS 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 # LTCC compiler flags. LTCFLAGS=$lt_LTCFLAGS # 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 # # Check for AViiON Machines running DGUX # ac_is_dgux=no if test "${ac_cv_header_sys_dg_sys_info_h+set}" = set; then { echo "$as_me:$LINENO: checking for sys/dg_sys_info.h" >&5 echo $ECHO_N "checking for sys/dg_sys_info.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_dg_sys_info_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi { echo "$as_me:$LINENO: result: $ac_cv_header_sys_dg_sys_info_h" >&5 echo "${ECHO_T}$ac_cv_header_sys_dg_sys_info_h" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking sys/dg_sys_info.h usability" >&5 echo $ECHO_N "checking sys/dg_sys_info.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { 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 sys/dg_sys_info.h presence" >&5 echo $ECHO_N "checking sys/dg_sys_info.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else 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: sys/dg_sys_info.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: sys/dg_sys_info.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: sys/dg_sys_info.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: sys/dg_sys_info.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: sys/dg_sys_info.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: sys/dg_sys_info.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: sys/dg_sys_info.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: sys/dg_sys_info.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: sys/dg_sys_info.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: sys/dg_sys_info.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: sys/dg_sys_info.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: sys/dg_sys_info.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: sys/dg_sys_info.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: sys/dg_sys_info.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: sys/dg_sys_info.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: sys/dg_sys_info.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## -------------------------------- ## ## Report this to Hans.Boehm@hp.com ## ## -------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for sys/dg_sys_info.h" >&5 echo $ECHO_N "checking for sys/dg_sys_info.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_dg_sys_info_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_sys_dg_sys_info_h=$ac_header_preproc fi { echo "$as_me:$LINENO: result: $ac_cv_header_sys_dg_sys_info_h" >&5 echo "${ECHO_T}$ac_cv_header_sys_dg_sys_info_h" >&6; } fi if test $ac_cv_header_sys_dg_sys_info_h = yes; then ac_is_dgux=yes; fi ## :GOTCHA: we do not check anything but sys/dg_sys_info.h if test $ac_is_dgux = yes; then if test "$enable_full_debug" = "yes"; then CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2" CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2" else CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2" CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2" fi fi # Check whether --with-target-subdir was given. if test "${with_target_subdir+set}" = set; then withval=$with_target_subdir; fi # Check whether --with-cross-host was given. if test "${with_cross_host+set}" = set; then withval=$with_cross_host; fi # automake wants to see AC_EXEEXT. But we don't need it. And having # it is actually a problem, because the compiler we're passed can't # necessarily do a full link. So we fool automake here. if false; then # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands # to nothing, so nothing would remain between `then' and `fi' if it # were not for the `:' below. : fi { echo "$as_me:$LINENO: checking whether Solaris gcc optimization fix is necessary" >&5 echo $ECHO_N "checking whether Solaris gcc optimization fix is necessary... $ECHO_C" >&6; } case "$host" in *aix*) if test "$GCC" = yes; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } new_CFLAGS= for i in $CFLAGS; do case "$i" in -O*) ;; *) new_CFLAGS="$new_CFLAGS $i" ;; esac done CFLAGS="$new_CFLAGS" 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 cat >>confdefs.h <<\_ACEOF #define NO_EXECUTE_PERMISSION 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define ALL_INTERIOR_POINTERS 1 _ACEOF # Check whether --enable-gcj-support was given. if test "${enable_gcj_support+set}" = set; then enableval=$enable_gcj_support; fi if test x"$enable_gcj_support" != xno; then ENABLE_GCJ_SUPPORT_TRUE= ENABLE_GCJ_SUPPORT_FALSE='#' else ENABLE_GCJ_SUPPORT_TRUE='#' ENABLE_GCJ_SUPPORT_FALSE= fi if test x"$enable_gcj_support" != xno; then cat >>confdefs.h <<\_ACEOF #define GC_GCJ_SUPPORT 1 _ACEOF fi # Check whether --enable-java-finalization was given. if test "${enable_java_finalization+set}" = set; then enableval=$enable_java_finalization; fi if test x"$enable_java_finalization" != xno; then cat >>confdefs.h <<\_ACEOF #define JAVA_FINALIZATION 1 _ACEOF fi # Check whether --enable-atomic-uncollectable was given. if test "${enable_atomic_uncollectable+set}" = set; then enableval=$enable_atomic_uncollectable; fi if test x"$enable_atomic_uncollectible" != x"no"; then cat >>confdefs.h <<\_ACEOF #define ATOMIC_UNCOLLECTABLE 1 _ACEOF fi # Check whether --enable-redirect-malloc was given. if test "${enable_redirect_malloc+set}" = set; then enableval=$enable_redirect_malloc; fi if test "${enable_redirect_malloc}" = yes; then if test "${enable_full_debug}" = yes; then cat >>confdefs.h <<\_ACEOF #define REDIRECT_MALLOC GC_debug_malloc_replacement _ACEOF cat >>confdefs.h <<\_ACEOF #define REDIRECT_REALLOC GC_debug_realloc_replacement _ACEOF cat >>confdefs.h <<\_ACEOF #define REDIRECT_FREE GC_debug_free _ACEOF else cat >>confdefs.h <<\_ACEOF #define REDIRECT_MALLOC GC_malloc _ACEOF fi fi # Check whether --enable-large-config was given. if test "${enable_large_config+set}" = set; then enableval=$enable_large_config; fi if test "${enable_large_config}" = yes; then cat >>confdefs.h <<\_ACEOF #define LARGE_CONFIG 1 _ACEOF fi if test -n "${with_cross_host}"; then cat >>confdefs.h <<\_ACEOF #define NO_CLOCK 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define SMALL_CONFIG 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define NO_DEBUGGING 1 _ACEOF fi UNWINDLIBS= # Check whether --enable-gc-debug was given. if test "${enable_gc_debug+set}" = set; then enableval=$enable_gc_debug; if test "$enable_gc_debug" = "yes"; then { echo "$as_me:$LINENO: WARNING: \"Should define GC_DEBUG and use debug alloc. in clients.\"" >&5 echo "$as_me: WARNING: \"Should define GC_DEBUG and use debug alloc. in clients.\"" >&2;} cat >>confdefs.h <<\_ACEOF #define KEEP_BACK_PTRS 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define DBG_HDRS_ALL 1 _ACEOF case $host in ia64-*-linux* ) cat >>confdefs.h <<\_ACEOF #define MAKE_BACK_GRAPH 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define SAVE_CALL_COUNT 8 _ACEOF { echo "$as_me:$LINENO: checking for backtrace in -lunwind" >&5 echo $ECHO_N "checking for backtrace in -lunwind... $ECHO_C" >&6; } if test "${ac_cv_lib_unwind_backtrace+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lunwind $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 GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char backtrace (); int main () { return backtrace (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_unwind_backtrace=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_unwind_backtrace=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_unwind_backtrace" >&5 echo "${ECHO_T}$ac_cv_lib_unwind_backtrace" >&6; } if test $ac_cv_lib_unwind_backtrace = yes; then cat >>confdefs.h <<\_ACEOF #define GC_HAVE_BUILTIN_BACKTRACE 1 _ACEOF UNWINDLIBS=-lunwind { echo "$as_me:$LINENO: WARNING: \"Client code may need to link against libunwind.\"" >&5 echo "$as_me: WARNING: \"Client code may need to link against libunwind.\"" >&2;} fi ;; x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* ) cat >>confdefs.h <<\_ACEOF #define MAKE_BACK_GRAPH 1 _ACEOF { echo "$as_me:$LINENO: WARNING: \"Client must not use -fomit-frame-pointer.\"" >&5 echo "$as_me: WARNING: \"Client must not use -fomit-frame-pointer.\"" >&2;} cat >>confdefs.h <<\_ACEOF #define SAVE_CALL_COUNT 8 _ACEOF ;; i345686-*-dgux*) cat >>confdefs.h <<\_ACEOF #define MAKE_BACK_GRAPH 1 _ACEOF ;; esac fi fi # Check whether --enable-gc-assertions was given. if test "${enable_gc_assertions+set}" = set; then enableval=$enable_gc_assertions; fi if test "${enable_gc_assertions}" = yes; then cat >>confdefs.h <<\_ACEOF #define GC_ASSERTIONS 1 _ACEOF fi if test -z "$with_cross_host"; then USE_LIBDIR_TRUE= USE_LIBDIR_FALSE='#' else USE_LIBDIR_TRUE='#' USE_LIBDIR_FALSE= fi atomic_ops_libs=-latomic_ops if test "${ac_cv_header_atomic_ops_h+set}" = set; then { echo "$as_me:$LINENO: checking for atomic_ops.h" >&5 echo $ECHO_N "checking for atomic_ops.h... $ECHO_C" >&6; } if test "${ac_cv_header_atomic_ops_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi { echo "$as_me:$LINENO: result: $ac_cv_header_atomic_ops_h" >&5 echo "${ECHO_T}$ac_cv_header_atomic_ops_h" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking atomic_ops.h usability" >&5 echo $ECHO_N "checking atomic_ops.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { 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 atomic_ops.h presence" >&5 echo $ECHO_N "checking atomic_ops.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else 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: atomic_ops.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: atomic_ops.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: atomic_ops.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: atomic_ops.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: atomic_ops.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: atomic_ops.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: atomic_ops.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: atomic_ops.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: atomic_ops.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: atomic_ops.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: atomic_ops.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: atomic_ops.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: atomic_ops.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: atomic_ops.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: atomic_ops.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: atomic_ops.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## -------------------------------- ## ## Report this to Hans.Boehm@hp.com ## ## -------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for atomic_ops.h" >&5 echo $ECHO_N "checking for atomic_ops.h... $ECHO_C" >&6; } if test "${ac_cv_header_atomic_ops_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_atomic_ops_h=$ac_header_preproc fi { echo "$as_me:$LINENO: result: $ac_cv_header_atomic_ops_h" >&5 echo "${ECHO_T}$ac_cv_header_atomic_ops_h" >&6; } fi if test $ac_cv_header_atomic_ops_h = yes; then { echo "$as_me:$LINENO: Using pre-installed libatomic_ops" >&5 echo "$as_me: Using pre-installed libatomic_ops" >&6;} else ao_dir= for candidate in ${srcdir}/libatomic_ops*; do case $candidate in *.tar.gz) ;; *install) ;; *) if test -e "$candidate"; then ao_dir="$candidate" fi ;; esac done if test -z "$ao_dir"; then { { echo "$as_me:$LINENO: error: Missig libatomic_ops." >&5 echo "$as_me: error: Missig libatomic_ops." >&2;} { (exit 1); exit 1; }; } fi ao_version="${ao_dir#*libatomic_ops-}" { echo "$as_me:$LINENO: Using internal version of libatomic_ops" >&5 echo "$as_me: Using internal version of libatomic_ops" >&6;} test -e ${srcdir}/libatomic_ops \ || ln -s ${ao_dir} ${srcdir}/libatomic_ops subdirs="$subdirs libatomic_ops" test -e ${srcdir}/atomic_ops.c \ || ln -s ${srcdir}/libatomic_ops/src/atomic_ops.c \ ${srcdir}/atomic_ops.c test -e ${srcdir}/atomic_ops_sysdeps.S \ || ln -s ${srcdir}/libatomic_ops/src/atomic_ops_sysdeps.S \ ${srcdir}/atomic_ops_sysdeps.S GC_CFLAGS="${GC_CFLAGS} -I \$(top_srcdir)/libatomic_ops/src" maybe_libatomic_ops="libatomic_ops" fi if test -n "$maybe_libatomic_ops" -a "$THREADS" != "none"; then USE_INTERNAL_LIBATOMIC_OPS_TRUE= USE_INTERNAL_LIBATOMIC_OPS_FALSE='#' else USE_INTERNAL_LIBATOMIC_OPS_TRUE='#' USE_INTERNAL_LIBATOMIC_OPS_FALSE= fi if test -n "$maybe_libatomic_ops" -a x$need_atomic_ops_asm = xtrue; then NEED_ATOMIC_OPS_ASM_TRUE= NEED_ATOMIC_OPS_ASM_FALSE='#' else NEED_ATOMIC_OPS_ASM_TRUE='#' NEED_ATOMIC_OPS_ASM_FALSE= fi ac_config_files="$ac_config_files Makefile bdw-gc.pc" ac_config_commands="$ac_config_commands default" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__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__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCCAS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCCAS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${THREADS_TRUE}" && test -z "${THREADS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"THREADS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"THREADS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${PTHREADS_TRUE}" && test -z "${PTHREADS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"PTHREADS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"PTHREADS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${DARWIN_THREADS_TRUE}" && test -z "${DARWIN_THREADS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"DARWIN_THREADS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"DARWIN_THREADS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${WIN32_THREADS_TRUE}" && test -z "${WIN32_THREADS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"WIN32_THREADS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"WIN32_THREADS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${COMPILER_XLC_TRUE}" && test -z "${COMPILER_XLC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"COMPILER_XLC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"COMPILER_XLC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${CPLUSPLUS_TRUE}" && test -z "${CPLUSPLUS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"CPLUSPLUS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"CPLUSPLUS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${ENABLE_GCJ_SUPPORT_TRUE}" && test -z "${ENABLE_GCJ_SUPPORT_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_GCJ_SUPPORT\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"ENABLE_GCJ_SUPPORT\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${USE_LIBDIR_TRUE}" && test -z "${USE_LIBDIR_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"USE_LIBDIR\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"USE_LIBDIR\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${USE_INTERNAL_LIBATOMIC_OPS_TRUE}" && test -z "${USE_INTERNAL_LIBATOMIC_OPS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"USE_INTERNAL_LIBATOMIC_OPS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"USE_INTERNAL_LIBATOMIC_OPS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${NEED_ATOMIC_OPS_ASM_TRUE}" && test -z "${NEED_ATOMIC_OPS_ASM_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"NEED_ATOMIC_OPS_ASM\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"NEED_ATOMIC_OPS_ASM\" 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 more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by gc $as_me 7.0, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" config_commands="$ac_config_commands" _ACEOF 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 and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ gc config.status 7.0 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' _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 ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" srcdir=${srcdir} host=${host} CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} CC="${CC}" DEFS="$DEFS" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "bdw-gc.pc") CONFIG_FILES="$CONFIG_FILES bdw-gc.pc" ;; "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; *) { { 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_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for 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 _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim build!$build$ac_delim build_cpu!$build_cpu$ac_delim build_vendor!$build_vendor$ac_delim build_os!$build_os$ac_delim host!$host$ac_delim host_cpu!$host_cpu$ac_delim host_vendor!$host_vendor$ac_delim host_os!$host_os$ac_delim target!$target$ac_delim target_cpu!$target_cpu$ac_delim target_vendor!$target_vendor$ac_delim target_os!$target_os$ac_delim INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim INSTALL_DATA!$INSTALL_DATA$ac_delim am__isrc!$am__isrc$ac_delim CYGPATH_W!$CYGPATH_W$ac_delim PACKAGE!$PACKAGE$ac_delim VERSION!$VERSION$ac_delim ACLOCAL!$ACLOCAL$ac_delim AUTOCONF!$AUTOCONF$ac_delim AUTOMAKE!$AUTOMAKE$ac_delim AUTOHEADER!$AUTOHEADER$ac_delim MAKEINFO!$MAKEINFO$ac_delim install_sh!$install_sh$ac_delim STRIP!$STRIP$ac_delim INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim mkdir_p!$mkdir_p$ac_delim AWK!$AWK$ac_delim SET_MAKE!$SET_MAKE$ac_delim am__leading_dot!$am__leading_dot$ac_delim AMTAR!$AMTAR$ac_delim am__tar!$am__tar$ac_delim am__untar!$am__untar$ac_delim MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim MAINT!$MAINT$ac_delim GC_VERSION!$GC_VERSION$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim DEPDIR!$DEPDIR$ac_delim am__include!$am__include$ac_delim am__quote!$am__quote$ac_delim AMDEP_TRUE!$AMDEP_TRUE$ac_delim AMDEP_FALSE!$AMDEP_FALSE$ac_delim AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim CCDEPMODE!$CCDEPMODE$ac_delim am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim ac_ct_CXX!$ac_ct_CXX$ac_delim CXXDEPMODE!$CXXDEPMODE$ac_delim am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF CEOF$ac_eof _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF CCAS!$CCAS$ac_delim CCASFLAGS!$CCASFLAGS$ac_delim CCASDEPMODE!$CCASDEPMODE$ac_delim am__fastdepCCAS_TRUE!$am__fastdepCCAS_TRUE$ac_delim am__fastdepCCAS_FALSE!$am__fastdepCCAS_FALSE$ac_delim AR!$AR$ac_delim RANLIB!$RANLIB$ac_delim GC_CFLAGS!$GC_CFLAGS$ac_delim THREADDLLIBS!$THREADDLLIBS$ac_delim THREADS_TRUE!$THREADS_TRUE$ac_delim THREADS_FALSE!$THREADS_FALSE$ac_delim PTHREADS_TRUE!$PTHREADS_TRUE$ac_delim PTHREADS_FALSE!$PTHREADS_FALSE$ac_delim DARWIN_THREADS_TRUE!$DARWIN_THREADS_TRUE$ac_delim DARWIN_THREADS_FALSE!$DARWIN_THREADS_FALSE$ac_delim WIN32_THREADS_TRUE!$WIN32_THREADS_TRUE$ac_delim WIN32_THREADS_FALSE!$WIN32_THREADS_FALSE$ac_delim COMPILER_XLC_TRUE!$COMPILER_XLC_TRUE$ac_delim COMPILER_XLC_FALSE!$COMPILER_XLC_FALSE$ac_delim extra_ldflags_libgc!$extra_ldflags_libgc$ac_delim EXTRA_TEST_LIBS!$EXTRA_TEST_LIBS$ac_delim target_all!$target_all$ac_delim CPLUSPLUS_TRUE!$CPLUSPLUS_TRUE$ac_delim CPLUSPLUS_FALSE!$CPLUSPLUS_FALSE$ac_delim INCLUDES!$INCLUDES$ac_delim CXXINCLUDES!$CXXINCLUDES$ac_delim addobjs!$addobjs$ac_delim addlibs!$addlibs$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim LN_S!$LN_S$ac_delim ECHO!$ECHO$ac_delim CPP!$CPP$ac_delim CXXCPP!$CXXCPP$ac_delim F77!$F77$ac_delim FFLAGS!$FFLAGS$ac_delim ac_ct_F77!$ac_ct_F77$ac_delim LIBTOOL!$LIBTOOL$ac_delim ENABLE_GCJ_SUPPORT_TRUE!$ENABLE_GCJ_SUPPORT_TRUE$ac_delim ENABLE_GCJ_SUPPORT_FALSE!$ENABLE_GCJ_SUPPORT_FALSE$ac_delim UNWINDLIBS!$UNWINDLIBS$ac_delim USE_LIBDIR_TRUE!$USE_LIBDIR_TRUE$ac_delim USE_LIBDIR_FALSE!$USE_LIBDIR_FALSE$ac_delim subdirs!$subdirs$ac_delim USE_INTERNAL_LIBATOMIC_OPS_TRUE!$USE_INTERNAL_LIBATOMIC_OPS_TRUE$ac_delim USE_INTERNAL_LIBATOMIC_OPS_FALSE!$USE_INTERNAL_LIBATOMIC_OPS_FALSE$ac_delim NEED_ATOMIC_OPS_ASM_TRUE!$NEED_ATOMIC_OPS_ASM_TRUE$ac_delim NEED_ATOMIC_OPS_ASM_FALSE!$NEED_ATOMIC_OPS_ASM_FALSE$ac_delim atomic_ops_libs!$atomic_ops_libs$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 51; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES :C $CONFIG_COMMANDS do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF 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&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir=$dirpart/$fdir case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done # for ac_tag { (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 # # CONFIG_SUBDIRS section. # if test "$no_recursion" != yes; then # Remove --cache-file and --srcdir arguments so they do not pile up. ac_sub_configure_args= ac_prev= eval "set x $ac_configure_args" shift for ac_arg do if test -n "$ac_prev"; then ac_prev= continue fi case $ac_arg in -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=*) ;; --config-cache | -C) ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) ;; *) case $ac_arg in *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;; esac done # Always prepend --prefix to ensure using the same prefix # in subdir configurations. ac_arg="--prefix=$prefix" case $ac_arg in *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" # Pass --silent if test "$silent" = yes; then ac_sub_configure_args="--silent $ac_sub_configure_args" fi ac_popdir=`pwd` for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue # Do not complain, so a configure script can configure whichever # parts of a large source tree are present. test -d "$srcdir/$ac_dir" || continue ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" echo "$as_me:$LINENO: $ac_msg" >&5 echo "$ac_msg" >&6 { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" # Check for guested configure; otherwise get Cygnus style configure. if test -f "$ac_srcdir/configure.gnu"; then ac_sub_configure=$ac_srcdir/configure.gnu elif test -f "$ac_srcdir/configure"; then ac_sub_configure=$ac_srcdir/configure elif test -f "$ac_srcdir/configure.in"; then # This should be Cygnus configure. ac_sub_configure=$ac_aux_dir/configure else { echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5 echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} ac_sub_configure= fi # The recursion is here. if test -n "$ac_sub_configure"; then # Make the cache file name correct relative to the subdirectory. case $cache_file in [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; *) # Relative name. ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; esac { echo "$as_me:$LINENO: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} # The eval makes quoting arguments work. eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || { { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5 echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;} { (exit 1); exit 1; }; } fi cd "$ac_popdir" done fi synopsis-0.12/src/Synopsis/gc/BCC_MAKEFILE0000664000076400007640000000447711104702315017443 0ustar stefanstefan# Makefile for Borland C++ 5.5 on NT # If you have the Borland assembler, remove "-DUSE_GENERIC" # bc= c:\Borland\BCC55 bcbin= $(bc)\bin bclib= $(bc)\lib bcinclude= $(bc)\include gcinclude1 = $(bc)\gc6.2\include gcinclude2 = $(bc)\gc6.2\cord cc= $(bcbin)\bcc32 rc= $(bcbin)\brc32 lib= $(bcbin)\tlib link= $(bcbin)\ilink32 cflags= -O2 -R -v- -vi -H -H=gc.csm -I$(bcinclude);$(gcinclude1);$(gcinclude2) -L$(bclib) \ -w-pro -w-aus -w-par -w-ccc -w-rch -a4 -D__STDC__=0 defines= -DALL_INTERIOR_POINTERS -DUSE_GENERIC -DNO_GETENV -DJAVA_FINALIZATION -DGC_OPERATOR_NEW_ARRAY .c.obj: $(cc) @&&| $(cdebug) $(cflags) $(cvars) $(defines) -o$* -c $*.c | .cpp.obj: $(cc) @&&| $(cdebug) $(cflags) $(cvars) $(defines) -o$* -c $*.cpp | .rc.res: $(rc) -i$(bcinclude) -r -fo$* $*.rc XXXOBJS= XXXalloc.obj XXXreclaim.obj XXXallchblk.obj XXXmisc.obj \ XXXmach_dep.obj XXXos_dep.obj XXXmark_rts.obj XXXheaders.obj XXXmark.obj \ XXXobj_map.obj XXXblacklst.obj XXXfinalize.obj XXXnew_hblk.obj \ XXXdbg_mlc.obj XXXmalloc.obj XXXstubborn.obj XXXdyn_load.obj \ XXXtypd_mlc.obj XXXptr_chck.obj XXXgc_cpp.obj XXXmallocx.obj OBJS= $(XXXOBJS:XXX=) all: gctest.exe cord\de.exe test_cpp.exe $(OBJS) test.obj: include\private\gc_priv.h include\private\gc_hdrs.h include\gc.h include\private\gcconfig.h MAKEFILE gc.lib: $(OBJS) del gc.lib $(lib) $* @&&| $(XXXOBJS:XXX=+) | gctest.exe: tests\test.obj gc.lib $(cc) @&&| $(cflags) -W -e$* tests\test.obj gc.lib | cord\de.obj cord\de_win.obj: include\cord.h include\private\cord_pos.h cord\de_win.h \ cord\de_cmds.h cord\de.exe: cord\cordbscs.obj cord\cordxtra.obj cord\de.obj cord\de_win.obj \ cord\de_win.res gc.lib $(cc) @&&| $(cflags) -W -e$* cord\cordbscs.obj cord\cordxtra.obj \ cord\de.obj cord\de_win.obj gc.lib | $(rc) cord\de_win.res cord\de.exe gc_cpp.obj: include\gc_cpp.h include\gc.h gc_cpp.cpp: gc_cpp.cc copy gc_cpp.cc gc_cpp.cpp test_cpp.cpp: tests\test_cpp.cc copy tests\test_cpp.cc test_cpp.cpp test_cpp.exe: test_cpp.obj include\gc_cpp.h include\gc.h gc.lib $(cc) @&&| $(cflags) -W -e$* test_cpp.obj gc.lib | scratch: -del *.obj *.res *.exe *.csm cord\*.obj cord\*.res cord\*.exe cord\*.csm clean: del gc.lib del *.obj del tests\test.obj synopsis-0.12/src/Synopsis/gc/atomic_ops.c0000664000076400007640000001415711104702316020172 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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. */ /* * Initialized data and out-of-line functions to support atomic_ops.h * go here. Currently this is needed only for pthread-based atomics * emulation, or for compare-and-swap emulation. * Pthreads emulation isn't useful on a native Windows platform, and * cas emulation is not needed. Thus we skip this on Windows. */ #if defined(HAVE_CONFIG_H) # include "config.h" #endif #if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__BORLANDC__) #undef AO_REQUIRE_CAS #include #include #ifdef _HPUX_SOURCE # include #else # include #endif #include "atomic_ops.h" /* Without cas emulation! */ #ifndef AO_HAVE_double_t # include "atomic_ops/sysdeps/standard_ao_double_t.h" #endif /* * Lock for pthreads-based implementation. */ pthread_mutex_t AO_pt_lock = PTHREAD_MUTEX_INITIALIZER; /* * Out of line compare-and-swap emulation based on test and set. * * We use a small table of locks for different compare_and_swap locations. * Before we update perform a compare-and-swap, we grap the corresponding * lock. Different locations may hash to the same lock, but since we * never acquire more than one lock at a time, this can't deadlock. * We explicitly disable signals while we perform this operation. * * FIXME: We should probably also suppport emulation based on Lamport * locks, since we may not have test_and_set either. */ #define AO_HASH_SIZE 16 #define AO_HASH(x) (((unsigned long)(x) >> 12) & (AO_HASH_SIZE-1)) AO_TS_t AO_locks[AO_HASH_SIZE] = { AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, }; static AO_T dummy = 1; /* Spin for 2**n units. */ void AO_spin(int n) { int i; AO_T j = AO_load(&dummy); for (i = 0; i < (2 << n); ++i) { j *= 5; j -= 4; } AO_store(&dummy, j); } void AO_pause(int n) { if (n < 12) AO_spin(n); else { struct timeval tv; /* Short async-signal-safe sleep. */ tv.tv_sec = 0; tv.tv_usec = (n > 28? 100000 : (1 << (n - 12))); select(0, 0, 0, 0, &tv); } } static void lock_ool(volatile AO_TS_t *l) { int i = 0; while (AO_test_and_set_acquire(l) == AO_TS_SET) AO_pause(++i); } AO_INLINE void lock(volatile AO_TS_t *l) { if (AO_test_and_set_acquire(l) == AO_TS_SET) lock_ool(l); } AO_INLINE void unlock(volatile AO_TS_t *l) { AO_CLEAR(l); } static sigset_t all_sigs; static volatile AO_t initialized = 0; static volatile AO_TS_t init_lock = AO_TS_INITIALIZER; int AO_compare_and_swap_emulation(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_TS_t *my_lock = AO_locks + AO_HASH(addr); sigset_t old_sigs; int result; if (!AO_load_acquire(&initialized)) { lock(&init_lock); if (!initialized) sigfillset(&all_sigs); unlock(&init_lock); AO_store_release(&initialized, 1); } sigprocmask(SIG_BLOCK, &all_sigs, &old_sigs); /* Neither sigprocmask nor pthread_sigmask is 100% */ /* guaranteed to work here. Sigprocmask is not */ /* guaranteed be thread safe, and pthread_sigmask */ /* is not async-signal-safe. Under linuxthreads, */ /* sigprocmask may block some pthreads-internal */ /* signals. So long as we do that for short periods, */ /* we should be OK. */ lock(my_lock); if (*addr == old) { *addr = new_val; result = 1; } else result = 0; unlock(my_lock); sigprocmask(SIG_SETMASK, &old_sigs, NULL); return result; } int AO_compare_double_and_swap_double_emulation(volatile AO_double_t *addr, AO_t old_val1, AO_t old_val2, AO_t new_val1, AO_t new_val2) { AO_TS_t *my_lock = AO_locks + AO_HASH(addr); sigset_t old_sigs; int result; if (!AO_load_acquire(&initialized)) { lock(&init_lock); if (!initialized) sigfillset(&all_sigs); unlock(&init_lock); AO_store_release(&initialized, 1); } sigprocmask(SIG_BLOCK, &all_sigs, &old_sigs); /* Neither sigprocmask nor pthread_sigmask is 100% */ /* guaranteed to work here. Sigprocmask is not */ /* guaranteed be thread safe, and pthread_sigmask */ /* is not async-signal-safe. Under linuxthreads, */ /* sigprocmask may block some pthreads-internal */ /* signals. So long as we do that for short periods, */ /* we should be OK. */ lock(my_lock); if (addr -> AO_val1 == old_val1 && addr -> AO_val2 == old_val2) { addr -> AO_val1 = new_val1; addr -> AO_val2 = new_val2; result = 1; } else result = 0; unlock(my_lock); sigprocmask(SIG_SETMASK, &old_sigs, NULL); return result; } void AO_store_full_emulation(volatile AO_t *addr, AO_t val) { AO_TS_t *my_lock = AO_locks + AO_HASH(addr); lock(my_lock); *addr = val; unlock(my_lock); } #else /* Non-posix platform */ int AO_non_posix_implementation_is_entirely_in_headers; #endif synopsis-0.12/src/Synopsis/gc/mark_rts.c0000664000076400007640000004370611104702316017661 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ # include # include "private/gc_priv.h" /* Data structure for list of root sets. */ /* We keep a hash table, so that we can filter out duplicate additions. */ /* Under Win32, we need to do a better job of filtering overlaps, so */ /* we resort to sequential search, and pay the price. */ /* This is really declared in gc_priv.h: struct roots { ptr_t r_start; ptr_t r_end; # if !defined(MSWIN32) && !defined(MSWINCE) struct roots * r_next; # endif GC_bool r_tmp; -- Delete before registering new dynamic libraries }; struct roots GC_static_roots[MAX_ROOT_SETS]; */ int GC_no_dls = 0; /* Register dynamic library data segments. */ static int n_root_sets = 0; /* GC_static_roots[0..n_root_sets) contains the valid root sets. */ # if !defined(NO_DEBUGGING) /* For debugging: */ void GC_print_static_roots(void) { register int i; size_t total = 0; for (i = 0; i < n_root_sets; i++) { GC_printf("From %p to %p ", GC_static_roots[i].r_start, GC_static_roots[i].r_end); if (GC_static_roots[i].r_tmp) { GC_printf(" (temporary)\n"); } else { GC_printf("\n"); } total += GC_static_roots[i].r_end - GC_static_roots[i].r_start; } GC_printf("Total size: %ld\n", (unsigned long) total); if (GC_root_size != total) { GC_printf("GC_root_size incorrect: %ld!!\n", (unsigned long) GC_root_size); } } # endif /* NO_DEBUGGING */ /* Primarily for debugging support: */ /* Is the address p in one of the registered static */ /* root sections? */ GC_bool GC_is_static_root(ptr_t p) { static int last_root_set = MAX_ROOT_SETS; register int i; if (last_root_set < n_root_sets && p >= GC_static_roots[last_root_set].r_start && p < GC_static_roots[last_root_set].r_end) return(TRUE); for (i = 0; i < n_root_sets; i++) { if (p >= GC_static_roots[i].r_start && p < GC_static_roots[i].r_end) { last_root_set = i; return(TRUE); } } return(FALSE); } #if !defined(MSWIN32) && !defined(MSWINCE) /* # define LOG_RT_SIZE 6 # define RT_SIZE (1 << LOG_RT_SIZE) -- Power of 2, may be != MAX_ROOT_SETS struct roots * GC_root_index[RT_SIZE]; -- Hash table header. Used only to check whether a range is -- already present. -- really defined in gc_priv.h */ static INLINE int rt_hash(ptr_t addr) { word result = (word) addr; # if CPP_WORDSZ > 8*LOG_RT_SIZE result ^= result >> 8*LOG_RT_SIZE; # endif # if CPP_WORDSZ > 4*LOG_RT_SIZE result ^= result >> 4*LOG_RT_SIZE; # endif result ^= result >> 2*LOG_RT_SIZE; result ^= result >> LOG_RT_SIZE; result &= (RT_SIZE-1); return(result); } /* Is a range starting at b already in the table? If so return a */ /* pointer to it, else NIL. */ struct roots * GC_roots_present(ptr_t b) { int h = rt_hash(b); struct roots *p = GC_root_index[h]; while (p != 0) { if (p -> r_start == (ptr_t)b) return(p); p = p -> r_next; } return(FALSE); } /* Add the given root structure to the index. */ static void add_roots_to_index(struct roots *p) { int h = rt_hash(p -> r_start); p -> r_next = GC_root_index[h]; GC_root_index[h] = p; } # else /* MSWIN32 || MSWINCE */ # define add_roots_to_index(p) # endif word GC_root_size = 0; void GC_add_roots(void *b, void *e) { DCL_LOCK_STATE; if (!GC_is_initialized) GC_init(); LOCK(); GC_add_roots_inner((ptr_t)b, (ptr_t)e, FALSE); UNLOCK(); } /* Add [b,e) to the root set. Adding the same interval a second time */ /* is a moderately fast noop, and hence benign. We do not handle */ /* different but overlapping intervals efficiently. (We do handle */ /* them correctly.) */ /* Tmp specifies that the interval may be deleted before */ /* reregistering dynamic libraries. */ void GC_add_roots_inner(ptr_t b, ptr_t e, GC_bool tmp) { struct roots * old; # if defined(MSWIN32) || defined(MSWINCE) /* Spend the time to ensure that there are no overlapping */ /* or adjacent intervals. */ /* This could be done faster with e.g. a */ /* balanced tree. But the execution time here is */ /* virtually guaranteed to be dominated by the time it */ /* takes to scan the roots. */ { register int i; for (i = 0; i < n_root_sets; i++) { old = GC_static_roots + i; if (b <= old -> r_end && e >= old -> r_start) { if (b < old -> r_start) { old -> r_start = b; GC_root_size += (old -> r_start - b); } if (e > old -> r_end) { old -> r_end = e; GC_root_size += (e - old -> r_end); } old -> r_tmp &= tmp; break; } } if (i < n_root_sets) { /* merge other overlapping intervals */ struct roots *other; for (i++; i < n_root_sets; i++) { other = GC_static_roots + i; b = other -> r_start; e = other -> r_end; if (b <= old -> r_end && e >= old -> r_start) { if (b < old -> r_start) { old -> r_start = b; GC_root_size += (old -> r_start - b); } if (e > old -> r_end) { old -> r_end = e; GC_root_size += (e - old -> r_end); } old -> r_tmp &= other -> r_tmp; /* Delete this entry. */ GC_root_size -= (other -> r_end - other -> r_start); other -> r_start = GC_static_roots[n_root_sets-1].r_start; other -> r_end = GC_static_roots[n_root_sets-1].r_end; n_root_sets--; } } return; } } # else old = GC_roots_present(b); if (old != 0) { if (e <= old -> r_end) /* already there */ return; /* else extend */ GC_root_size += e - old -> r_end; old -> r_end = e; return; } # endif if (n_root_sets == MAX_ROOT_SETS) { ABORT("Too many root sets\n"); } GC_static_roots[n_root_sets].r_start = (ptr_t)b; GC_static_roots[n_root_sets].r_end = (ptr_t)e; GC_static_roots[n_root_sets].r_tmp = tmp; # if !defined(MSWIN32) && !defined(MSWINCE) GC_static_roots[n_root_sets].r_next = 0; # endif add_roots_to_index(GC_static_roots + n_root_sets); GC_root_size += e - b; n_root_sets++; } static GC_bool roots_were_cleared = FALSE; void GC_clear_roots (void) { DCL_LOCK_STATE; if (!GC_is_initialized) GC_init(); LOCK(); roots_were_cleared = TRUE; n_root_sets = 0; GC_root_size = 0; # if !defined(MSWIN32) && !defined(MSWINCE) { register int i; for (i = 0; i < RT_SIZE; i++) GC_root_index[i] = 0; } # endif UNLOCK(); } /* Internal use only; lock held. */ static void GC_remove_root_at_pos(int i) { GC_root_size -= (GC_static_roots[i].r_end - GC_static_roots[i].r_start); GC_static_roots[i].r_start = GC_static_roots[n_root_sets-1].r_start; GC_static_roots[i].r_end = GC_static_roots[n_root_sets-1].r_end; GC_static_roots[i].r_tmp = GC_static_roots[n_root_sets-1].r_tmp; n_root_sets--; } #if !defined(MSWIN32) && !defined(MSWINCE) static void GC_rebuild_root_index(void) { int i; for (i = 0; i < RT_SIZE; i++) GC_root_index[i] = 0; for (i = 0; i < n_root_sets; i++) add_roots_to_index(GC_static_roots + i); } #endif /* Internal use only; lock held. */ void GC_remove_tmp_roots(void) { int i; for (i = 0; i < n_root_sets; ) { if (GC_static_roots[i].r_tmp) { GC_remove_root_at_pos(i); } else { i++; } } #if !defined(MSWIN32) && !defined(MSWINCE) GC_rebuild_root_index(); #endif } #if !defined(MSWIN32) && !defined(MSWINCE) void GC_remove_roots(void *b, void *e) { DCL_LOCK_STATE; LOCK(); GC_remove_roots_inner((ptr_t)b, (ptr_t)e); UNLOCK(); } /* Should only be called when the lock is held */ void GC_remove_roots_inner(ptr_t b, ptr_t e) { int i; for (i = 0; i < n_root_sets; ) { if (GC_static_roots[i].r_start >= b && GC_static_roots[i].r_end <= e) { GC_remove_root_at_pos(i); } else { i++; } } GC_rebuild_root_index(); } #endif /* !defined(MSWIN32) && !defined(MSWINCE) */ #if defined(MSWIN32) || defined(_WIN32_WCE_EMULATION) /* Workaround for the OS mapping and unmapping behind our back: */ /* Is the address p in one of the temporary static root sections? */ GC_bool GC_is_tmp_root(ptr_t p) { static int last_root_set = MAX_ROOT_SETS; register int i; if (last_root_set < n_root_sets && p >= GC_static_roots[last_root_set].r_start && p < GC_static_roots[last_root_set].r_end) return GC_static_roots[last_root_set].r_tmp; for (i = 0; i < n_root_sets; i++) { if (p >= GC_static_roots[i].r_start && p < GC_static_roots[i].r_end) { last_root_set = i; return GC_static_roots[i].r_tmp; } } return(FALSE); } #endif /* MSWIN32 || _WIN32_WCE_EMULATION */ ptr_t GC_approx_sp(void) { volatile word dummy; dummy = 42; /* Force stack to grow if necessary. Otherwise the */ /* later accesses might cause the kernel to think we're */ /* doing something wrong. */ # ifdef _MSC_VER # pragma warning(disable:4172) # endif return((ptr_t)(&dummy)); # ifdef _MSC_VER # pragma warning(default:4172) # endif } /* * Data structure for excluded static roots. * Real declaration is in gc_priv.h. struct exclusion { ptr_t e_start; ptr_t e_end; }; struct exclusion GC_excl_table[MAX_EXCLUSIONS]; -- Array of exclusions, ascending -- address order. */ size_t GC_excl_table_entries = 0; /* Number of entries in use. */ /* Return the first exclusion range that includes an address >= start_addr */ /* Assumes the exclusion table contains at least one entry (namely the */ /* GC data structures). */ struct exclusion * GC_next_exclusion(ptr_t start_addr) { size_t low = 0; size_t high = GC_excl_table_entries - 1; size_t mid; while (high > low) { mid = (low + high) >> 1; /* low <= mid < high */ if ((word) GC_excl_table[mid].e_end <= (word) start_addr) { low = mid + 1; } else { high = mid; } } if ((word) GC_excl_table[low].e_end <= (word) start_addr) return 0; return GC_excl_table + low; } void GC_exclude_static_roots(void *start, void *finish) { struct exclusion * next; size_t next_index, i; if (0 == GC_excl_table_entries) { next = 0; } else { next = GC_next_exclusion(start); } if (0 != next) { if ((word)(next -> e_start) < (word) finish) { /* incomplete error check. */ ABORT("exclusion ranges overlap"); } if ((word)(next -> e_start) == (word) finish) { /* extend old range backwards */ next -> e_start = (ptr_t)start; return; } next_index = next - GC_excl_table; for (i = GC_excl_table_entries; i > next_index; --i) { GC_excl_table[i] = GC_excl_table[i-1]; } } else { next_index = GC_excl_table_entries; } if (GC_excl_table_entries == MAX_EXCLUSIONS) ABORT("Too many exclusions"); GC_excl_table[next_index].e_start = (ptr_t)start; GC_excl_table[next_index].e_end = (ptr_t)finish; ++GC_excl_table_entries; } /* Invoke push_conditional on ranges that are not excluded. */ void GC_push_conditional_with_exclusions(ptr_t bottom, ptr_t top, GC_bool all) { struct exclusion * next; ptr_t excl_start; while (bottom < top) { next = GC_next_exclusion(bottom); if (0 == next || (excl_start = next -> e_start) >= top) { GC_push_conditional(bottom, top, all); return; } if (excl_start > bottom) GC_push_conditional(bottom, excl_start, all); bottom = next -> e_end; } } /* * In the absence of threads, push the stack contents. * In the presence of threads, push enough of the current stack * to ensure that callee-save registers saved in collector frames have been * seen. * FIXME: Merge with per-thread stuff. */ void GC_push_current_stack(ptr_t cold_gc_frame, void * context) { # if defined(THREADS) if (0 == cold_gc_frame) return; # ifdef STACK_GROWS_DOWN GC_push_all_eager(GC_approx_sp(), cold_gc_frame); /* For IA64, the register stack backing store is handled */ /* in the thread-specific code. */ # else GC_push_all_eager( cold_gc_frame, GC_approx_sp() ); # endif # else # ifdef STACK_GROWS_DOWN GC_push_all_stack_partially_eager( GC_approx_sp(), GC_stackbottom, cold_gc_frame ); # ifdef IA64 /* We also need to push the register stack backing store. */ /* This should really be done in the same way as the */ /* regular stack. For now we fudge it a bit. */ /* Note that the backing store grows up, so we can't use */ /* GC_push_all_stack_partially_eager. */ { extern word GC_save_regs_ret_val; /* Previously set to backing store pointer. */ ptr_t bsp = (ptr_t) GC_save_regs_ret_val; ptr_t cold_gc_bs_pointer; if (GC_all_interior_pointers) { cold_gc_bs_pointer = bsp - 2048; if (cold_gc_bs_pointer < BACKING_STORE_BASE) { cold_gc_bs_pointer = BACKING_STORE_BASE; } else { GC_push_all_stack(BACKING_STORE_BASE, cold_gc_bs_pointer); } } else { cold_gc_bs_pointer = BACKING_STORE_BASE; } GC_push_all_eager(cold_gc_bs_pointer, bsp); /* All values should be sufficiently aligned that we */ /* dont have to worry about the boundary. */ } # endif # else GC_push_all_stack_partially_eager( GC_stackbottom, GC_approx_sp(), cold_gc_frame ); # endif # endif /* !THREADS */ } /* * Push GC internal roots. Only called if there is some reason to believe * these would not otherwise get registered. */ void GC_push_gc_structures(void) { GC_push_finalizer_structures(); # if defined(THREADS) GC_push_thread_structures(); # endif } #ifdef THREAD_LOCAL_ALLOC void GC_mark_thread_local_free_lists(void); #endif void GC_cond_register_dynamic_libraries(void) { # if defined(DYNAMIC_LOADING) || defined(MSWIN32) || defined(MSWINCE) \ || defined(PCR) GC_remove_tmp_roots(); if (!GC_no_dls) GC_register_dynamic_libraries(); # else GC_no_dls = TRUE; # endif } /* * Call the mark routines (GC_tl_push for a single pointer, GC_push_conditional * on groups of pointers) on every top level accessible pointer. * If all is FALSE, arrange to push only possibly altered values. * Cold_gc_frame is an address inside a GC frame that * remains valid until all marking is complete. * A zero value indicates that it's OK to miss some * register values. */ void GC_push_roots(GC_bool all, ptr_t cold_gc_frame) { int i; unsigned kind; /* * Next push static data. This must happen early on, since it's * not robust against mark stack overflow. */ /* Reregister dynamic libraries, in case one got added. */ /* There is some argument for doing this as late as possible, */ /* especially on win32, where it can change asynchronously. */ /* In those cases, we do it here. But on other platforms, it's */ /* not safe with the world stopped, so we do it earlier. */ # if !defined(REGISTER_LIBRARIES_EARLY) GC_cond_register_dynamic_libraries(); # endif /* Mark everything in static data areas */ for (i = 0; i < n_root_sets; i++) { GC_push_conditional_with_exclusions( GC_static_roots[i].r_start, GC_static_roots[i].r_end, all); } /* Mark all free list header blocks, if those were allocated from */ /* the garbage collected heap. This makes sure they don't */ /* disappear if we are not marking from static data. It also */ /* saves us the trouble of scanning them, and possibly that of */ /* marking the freelists. */ for (kind = 0; kind < GC_n_kinds; kind++) { void *base = GC_base(GC_obj_kinds[kind].ok_freelist); if (0 != base) { GC_set_mark_bit(base); } } /* Mark from GC internal roots if those might otherwise have */ /* been excluded. */ if (GC_no_dls || roots_were_cleared) { GC_push_gc_structures(); } /* Mark thread local free lists, even if their mark */ /* descriptor excludes the link field. */ /* If the world is not stopped, this is unsafe. It is */ /* also unnecessary, since we will do this again with the */ /* world stopped. */ # if defined(THREAD_LOCAL_ALLOC) if (GC_world_stopped) GC_mark_thread_local_free_lists(); # endif /* * Now traverse stacks, and mark from register contents. * These must be done last, since they can legitimately overflow * the mark stack. * This is usually done by saving the current context on the * stack, and then just tracing from the stack. */ GC_push_regs_and_stack(cold_gc_frame); if (GC_push_other_roots != 0) (*GC_push_other_roots)(); /* In the threads case, this also pushes thread stacks. */ /* Note that without interior pointer recognition lots */ /* of stuff may have been pushed already, and this */ /* should be careful about mark stack overflows. */ } synopsis-0.12/src/Synopsis/gc/NT_MAKEFILE0000664000076400007640000000530211104702316017362 0ustar stefanstefan# Makefile for Windows NT. Assumes Microsoft compiler, and a single thread. # DLLs are included in the root set under NT, but not under win32S. # Use "nmake nodebug=1 all" for optimized versions of library, gctest and editor. MY_CPU=X86 CPU=$(MY_CPU) !include OBJS= alloc.obj reclaim.obj allchblk.obj misc.obj mach_dep.obj os_dep.obj mark_rts.obj headers.obj mark.obj obj_map.obj blacklst.obj finalize.obj new_hblk.obj dbg_mlc.obj malloc.obj stubborn.obj dyn_load.obj typd_mlc.obj ptr_chck.obj gc_cpp.obj mallocx.obj msvc_dbg.obj all: gctest.exe cord\de.exe test_cpp.exe .c.obj: $(cc) $(cdebug) $(cflags) $(cvars) -Iinclude -DALL_INTERIOR_POINTERS -D__STDC__ -DGC_NOT_DLL -DGC_BUILD $*.c /Fo$*.obj .cpp.obj: $(cc) $(cdebug) $(cflags) $(cvars) -Iinclude -DALL_INTERIOR_POINTERS -DGC_NOT_DLL -DGC_BUILD $*.CPP /Fo$*.obj $(OBJS) tests\test.obj: include\private\gc_priv.h include\private\gc_hdrs.h include\gc.h include\private\gcconfig.h include\private\gc_locks.h include\private\gc_pmark.h include\gc_mark.h include\private\msvc_dbg.h gc.lib: $(OBJS) lib /MACHINE:i386 /out:gc.lib $(OBJS) # The original NT SDK used lib32 instead of lib gctest.exe: tests\test.obj gc.lib # The following works for win32 debugging. For win32s debugging use debugtype:coff # and add mapsympe line. # This produces a "GUI" applications that opens no windows and writes to the log file # "gc.log". This is done to make the result runnable under win32s. $(link) -debug:full -debugtype:cv $(guiflags) -stack:131072 -out:$*.exe tests\test.obj $(guilibs) gc.lib # mapsympe -n -o gctest.sym gctest.exe cord\de_win.rbj: cord\de_win.res cvtres /MACHINE:$(MY_CPU) /OUT:cord\de_win.rbj cord\de_win.res cord\de.obj cord\de_win.obj: include\cord.h include\private\cord_pos.h cord\de_win.h cord\de_cmds.h cord\de_win.res: cord\de_win.rc cord\de_win.h cord\de_cmds.h $(rc) $(rcvars) -r -fo cord\de_win.res cord\de_win.rc # Cord/de is a real win32 gui application. cord\de.exe: cord\cordbscs.obj cord\cordxtra.obj cord\de.obj cord\de_win.obj cord\de_win.rbj gc.lib $(link) -debug:full -debugtype:cv $(guiflags) -stack:16384 -out:cord\de.exe cord\cordbscs.obj cord\cordxtra.obj cord\de.obj cord\de_win.obj cord\de_win.rbj gc.lib $(guilibs) gc_cpp.obj: include\gc_cpp.h include\gc.h gc_cpp.cpp: gc_cpp.cc copy gc_cpp.cc gc_cpp.cpp test_cpp.cpp: tests\test_cpp.cc copy tests\test_cpp.cc test_cpp.cpp # This generates the C++ test executable. The executable expects # a single numeric argument, which is the number of iterations. # The output appears in the file "gc.log". test_cpp.exe: test_cpp.obj include\gc_cpp.h include\gc.h gc.lib $(link) -debug:full -debugtype:cv $(guiflags) -stack:16384 -out:test_cpp.exe test_cpp.obj gc.lib $(guilibs) synopsis-0.12/src/Synopsis/gc/checksums.c0000664000076400007640000001273111104702316020016 0ustar stefanstefan/* * Copyright (c) 1992-1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* Boehm, March 29, 1995 12:51 pm PST */ # ifdef CHECKSUMS # include "private/gc_priv.h" /* This is debugging code intended to verify the results of dirty bit */ /* computations. Works only in a single threaded environment. */ /* We assume that stubborn objects are changed only when they are */ /* enabled for writing. (Certain kinds of writing are actually */ /* safe under other conditions.) */ # define NSUMS 10000 # define OFFSET 0x10000 typedef struct { GC_bool new_valid; word old_sum; word new_sum; struct hblk * block; /* Block to which this refers + OFFSET */ /* to hide it from collector. */ } page_entry; page_entry GC_sums [NSUMS]; word GC_checksum(h) struct hblk *h; { register word *p = (word *)h; register word *lim = (word *)(h+1); register word result = 0; while (p < lim) { result += *p++; } return(result | 0x80000000 /* doesn't look like pointer */); } # ifdef STUBBORN_ALLOC /* Check whether a stubborn object from the given block appears on */ /* the appropriate free list. */ GC_bool GC_on_free_list(struct hblk *h) struct hblk *h; { hdr * hhdr = HDR(h); int sz = BYTES_TO_WORDS(hhdr -> hb_sz); ptr_t p; if (sz > MAXOBJWORDS) return(FALSE); for (p = GC_sobjfreelist[sz]; p != 0; p = obj_link(p)) { if (HBLKPTR(p) == h) return(TRUE); } return(FALSE); } # endif int GC_n_dirty_errors; int GC_n_changed_errors; int GC_n_clean; int GC_n_dirty; void GC_update_check_page(struct hblk *h, int index) { page_entry *pe = GC_sums + index; register hdr * hhdr = HDR(h); struct hblk *b; if (pe -> block != 0 && pe -> block != h + OFFSET) ABORT("goofed"); pe -> old_sum = pe -> new_sum; pe -> new_sum = GC_checksum(h); # if !defined(MSWIN32) && !defined(MSWINCE) if (pe -> new_sum != 0x80000000 && !GC_page_was_ever_dirty(h)) { GC_printf("GC_page_was_ever_dirty(%p) is wrong\n", h); } # endif if (GC_page_was_dirty(h)) { GC_n_dirty++; } else { GC_n_clean++; } b = h; while (IS_FORWARDING_ADDR_OR_NIL(hhdr) && hhdr != 0) { b -= (word)hhdr; hhdr = HDR(b); } if (pe -> new_valid && hhdr != 0 && hhdr -> hb_descr != 0 /* may contain pointers */ && pe -> old_sum != pe -> new_sum) { if (!GC_page_was_dirty(h) || !GC_page_was_ever_dirty(h)) { /* Set breakpoint here */GC_n_dirty_errors++; } # ifdef STUBBORN_ALLOC if (!HBLK_IS_FREE(hhdr) && hhdr -> hb_obj_kind == STUBBORN && !GC_page_was_changed(h) && !GC_on_free_list(h)) { /* if GC_on_free_list(h) then reclaim may have touched it */ /* without any allocations taking place. */ /* Set breakpoint here */GC_n_changed_errors++; } # endif } pe -> new_valid = TRUE; pe -> block = h + OFFSET; } unsigned long GC_bytes_in_used_blocks; void GC_add_block(h, dummy) struct hblk *h; word dummy; { hdr * hhdr = HDR(h); bytes = hhdr -> hb_sz; bytes += HBLKSIZE-1; bytes &= ~(HBLKSIZE-1); GC_bytes_in_used_blocks += bytes; } void GC_check_blocks() { unsigned long bytes_in_free_blocks = GC_large_free_bytes; GC_bytes_in_used_blocks = 0; GC_apply_to_all_blocks(GC_add_block, (word)0); GC_printf("GC_bytes_in_used_blocks = %lu, bytes_in_free_blocks = %lu ", GC_bytes_in_used_blocks, bytes_in_free_blocks); GC_printf("GC_heapsize = %lu\n", (unsigned long)GC_heapsize); if (GC_bytes_in_used_blocks + bytes_in_free_blocks != GC_heapsize) { GC_printf("LOST SOME BLOCKS!!\n"); } } /* Should be called immediately after GC_read_dirty and GC_read_changed. */ void GC_check_dirty() { register int index; register unsigned i; register struct hblk *h; register ptr_t start; GC_check_blocks(); GC_n_dirty_errors = 0; GC_n_changed_errors = 0; GC_n_clean = 0; GC_n_dirty = 0; index = 0; for (i = 0; i < GC_n_heap_sects; i++) { start = GC_heap_sects[i].hs_start; for (h = (struct hblk *)start; h < (struct hblk *)(start + GC_heap_sects[i].hs_bytes); h++) { GC_update_check_page(h, index); index++; if (index >= NSUMS) goto out; } } out: GC_printf("Checked %lu clean and %lu dirty pages\n", (unsigned long) GC_n_clean, (unsigned long) GC_n_dirty); if (GC_n_dirty_errors > 0) { GC_printf("Found %lu dirty bit errors\n", (unsigned long)GC_n_dirty_errors); } if (GC_n_changed_errors > 0) { GC_printf("Found %lu changed bit errors\n", (unsigned long)GC_n_changed_errors); GC_printf("These may be benign (provoked by nonpointer changes)\n"); # ifdef THREADS GC_printf( "Also expect 1 per thread currently allocating a stubborn obj.\n"); # endif } } # else extern int GC_quiet; /* ANSI C doesn't allow translation units to be empty. */ /* So we guarantee this one is nonempty. */ # endif /* CHECKSUMS */ synopsis-0.12/src/Synopsis/gc/NT_STATIC_THREADS_MAKEFILE0000664000076400007640000000654711104702317021620 0ustar stefanstefan# Makefile for Windows NT. Assumes Microsoft compiler. # DLLs are included in the root set under NT, but not under win32S. # Use "nmake nodebug=1 all" for optimized versions of library, gctest and editor. MY_CPU=X86 CPU=$(MY_CPU) !include # Make sure that .cc is not viewed as a suffix. It is for VC++2005, but # not earlier versions. We can deal with either, but not inconsistency. .SUFFIXES: .SUFFIXES: .obj .cpp .c # Atomic_ops installation directory. For win32, the source directory # should do, since we only need the headers. # We assume this was manually unpacked, since I'm not sure there is # a Windows standard command line tool to do this. AO_VERSION=1.2 AO_SRC_DIR=libatomic_ops-$(AO_VERSION)/src AO_INCLUDE_DIR=$(AO_SRC_DIR) OBJS= alloc.obj reclaim.obj allchblk.obj misc.obj mach_dep.obj os_dep.obj mark_rts.obj headers.obj mark.obj obj_map.obj blacklst.obj finalize.obj new_hblk.obj dbg_mlc.obj malloc.obj stubborn.obj dyn_load.obj typd_mlc.obj ptr_chck.obj gc_cpp.obj mallocx.obj win32_threads.obj msvc_dbg.obj thread_local_alloc.obj all: gctest.exe cord\de.exe test_cpp.exe .c.obj: $(cc) $(cdebug) $(cflags) $(cvarsmt) -Iinclude -I$(AO_INCLUDE_DIR) -DALL_INTERIOR_POINTERS -D__STDC__ -DGC_NOT_DLL -DGC_WIN32_THREADS -DTHREAD_LOCAL_ALLOC $*.c /Fo$*.obj .cpp.obj: $(cc) $(cdebug) $(cflags) $(cvarsmt) -Iinclude -I$(AO_INCLUDE_DIR) -DALL_INTERIOR_POINTERS -DGC_NOT_DLL $*.CPP -DGC_WIN32_THREADS -DTHREAD_LOCAL_ALLOC /Fo$*.obj $(OBJS) tests\test.obj: include\private\gc_priv.h include\private\gc_hdrs.h include\gc.h include\private\gcconfig.h include\private\gc_locks.h include\private\gc_pmark.h include\gc_mark.h include\private\msvc_dbg.h gc.lib: $(OBJS) lib /MACHINE:i386 /out:gc.lib $(OBJS) # The original NT SDK used lib32 instead of lib gctest.exe: tests\test.obj gc.lib # The following works for win32 debugging. For win32s debugging use debugtype:coff # and add mapsympe line. # This produces a "GUI" applications that opens no windows and writes to the log file # "gc.log". This is done to make the result runnable under win32s. $(link) -debug:full -debugtype:cv $(guiflags) -stack:131072 -out:$*.exe tests\test.obj $(guilibs) gc.lib # mapsympe -n -o gctest.sym gctest.exe cord\de_win.rbj: cord\de_win.res cvtres /MACHINE:$(MY_CPU) /OUT:cord\de_win.rbj cord\de_win.res cord\de.obj cord\de_win.obj: include\cord.h include\private\cord_pos.h cord\de_win.h cord\de_cmds.h cord\de_win.res: cord\de_win.rc cord\de_win.h cord\de_cmds.h $(rc) $(rcvars) -r -fo cord\de_win.res cord\de_win.rc # Cord/de is a real win32 gui application. cord\de.exe: cord\cordbscs.obj cord\cordxtra.obj cord\de.obj cord\de_win.obj cord\de_win.rbj gc.lib $(link) -debug:full -debugtype:cv $(guiflags) -stack:16384 -out:cord\de.exe cord\cordbscs.obj cord\cordxtra.obj cord\de.obj cord\de_win.obj cord\de_win.rbj gc.lib $(guilibs) gc_cpp.obj: include\gc_cpp.h include\gc.h gc_cpp.cpp: gc_cpp.cc copy gc_cpp.cc gc_cpp.cpp test_cpp.cpp: tests\test_cpp.cc copy tests\test_cpp.cc test_cpp.cpp # This generates the C++ test executable. The executable expects # a single numeric argument, which is the number of iterations. # The output appears in the file "gc.log". test_cpp.exe: test_cpp.obj include\gc_cpp.h include\gc.h gc.lib $(link) -debug:full -debugtype:cv $(guiflags) -stack:16384 -out:test_cpp.exe test_cpp.obj gc.lib $(guilibs) AO_SCR_DIR: tar xvfz $(AO_SRC_DIR).tar.gz; synopsis-0.12/src/Synopsis/gc/os_dep.c0000664000076400007640000040400711104702320017276 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999 by Hewlett-Packard Company. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ # include "private/gc_priv.h" # ifdef THREADS # include "atomic_ops.h" # endif # if defined(LINUX) && !defined(POWERPC) # include # if (LINUX_VERSION_CODE <= 0x10400) /* Ugly hack to get struct sigcontext_struct definition. Required */ /* for some early 1.3.X releases. Will hopefully go away soon. */ /* in some later Linux releases, asm/sigcontext.h may have to */ /* be included instead. */ # define __KERNEL__ # include # undef __KERNEL__ # else /* Kernels prior to 2.1.1 defined struct sigcontext_struct instead of */ /* struct sigcontext. libc6 (glibc2) uses "struct sigcontext" in */ /* prototypes, so we have to include the top-level sigcontext.h to */ /* make sure the former gets defined to be the latter if appropriate. */ # include # if 2 <= __GLIBC__ # if 2 == __GLIBC__ && 0 == __GLIBC_MINOR__ /* glibc 2.1 no longer has sigcontext.h. But signal.h */ /* has the right declaration for glibc 2.1. */ # include # endif /* 0 == __GLIBC_MINOR__ */ # else /* not 2 <= __GLIBC__ */ /* libc5 doesn't have : go directly with the kernel */ /* one. Check LINUX_VERSION_CODE to see which we should reference. */ # include # endif /* 2 <= __GLIBC__ */ # endif # endif # if !defined(OS2) && !defined(PCR) && !defined(AMIGA) && !defined(MACOS) \ && !defined(MSWINCE) # include # if !defined(MSWIN32) # include # endif # endif # include # if defined(MSWINCE) # define SIGSEGV 0 /* value is irrelevant */ # else # include # endif #ifdef UNIX_LIKE # include #endif #if defined(LINUX) || defined(LINUX_STACKBOTTOM) # include #endif /* Blatantly OS dependent routines, except for those that are related */ /* to dynamic loading. */ #ifdef AMIGA # define GC_AMIGA_DEF # include "AmigaOS.c" # undef GC_AMIGA_DEF #endif #if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32) # define WIN32_LEAN_AND_MEAN # define NOSERVICE # include /* It's not clear this is completely kosher under Cygwin. But it */ /* allows us to get a working GC_get_stack_base. */ #endif #ifdef MACOS # include #endif #ifdef IRIX5 # include # include /* for locking */ #endif #if defined(LINUX) || defined(FREEBSD) || defined(SOLARIS) || defined(IRIX5) \ || defined(USE_MMAP) || defined(USE_MUNMAP) # define MMAP_SUPPORTED #endif #if defined(MMAP_SUPPORTED) || defined(ADD_HEAP_GUARD_PAGES) # if defined(USE_MUNMAP) && !defined(USE_MMAP) --> USE_MUNMAP requires USE_MMAP # endif # include # include # include # include #endif #ifdef DARWIN /* for get_etext and friends */ #include #endif #ifdef DJGPP /* Apparently necessary for djgpp 2.01. May cause problems with */ /* other versions. */ typedef long unsigned int caddr_t; #endif #ifdef PCR # include "il/PCR_IL.h" # include "th/PCR_ThCtl.h" # include "mm/PCR_MM.h" #endif #if !defined(NO_EXECUTE_PERMISSION) # define OPT_PROT_EXEC PROT_EXEC #else # define OPT_PROT_EXEC 0 #endif #if defined(LINUX) && \ (defined(USE_PROC_FOR_LIBRARIES) || defined(IA64) || !defined(SMALL_CONFIG)) # define NEED_PROC_MAPS #endif #ifdef NEED_PROC_MAPS /* We need to parse /proc/self/maps, either to find dynamic libraries, */ /* and/or to find the register backing store base (IA64). Do it once */ /* here. */ #define READ read /* Repeatedly perform a read call until the buffer is filled or */ /* we encounter EOF. */ ssize_t GC_repeat_read(int fd, char *buf, size_t count) { ssize_t num_read = 0; ssize_t result; while (num_read < count) { result = READ(fd, buf + num_read, count - num_read); if (result < 0) return result; if (result == 0) break; num_read += result; } return num_read; } /* Determine the length of a file by incrementally reading it into a */ /* This would be sily to use on a file supporting lseek, but Linux */ /* /proc files usually do not. */ size_t GC_get_file_len(int f) { size_t total = 0; ssize_t result; # define GET_FILE_LEN_BUF_SZ 500 char buf[GET_FILE_LEN_BUF_SZ]; do { result = read(f, buf, GET_FILE_LEN_BUF_SZ); if (result == -1) return 0; total += result; } while (result > 0); return total; } size_t GC_get_maps_len(void) { int f = open("/proc/self/maps", O_RDONLY); size_t result = GC_get_file_len(f); close(f); return result; } /* * Copy the contents of /proc/self/maps to a buffer in our address space. * Return the address of the buffer, or zero on failure. * This code could be simplified if we could determine its size * ahead of time. */ char * GC_get_maps(void) { int f; int result; static char init_buf[1]; static char *maps_buf = init_buf; static size_t maps_buf_sz = 1; size_t maps_size, old_maps_size = 0; /* The buffer is essentially static, so there must be a single client. */ GC_ASSERT(I_HOLD_LOCK()); /* Note that in the presence of threads, the maps file can */ /* essentially shrink asynchronously and unexpectedly as */ /* threads that we already think of as dead release their */ /* stacks. And there is no easy way to read the entire */ /* file atomically. This is arguably a misfeature of the */ /* /proc/.../maps interface. */ /* Since we dont believe the file can grow */ /* asynchronously, it should suffice to first determine */ /* the size (using lseek or read), and then to reread the */ /* file. If the size is inconsistent we have to retry. */ /* This only matters with threads enabled, and if we use */ /* this to locate roots (not the default). */ /* Determine the initial size of /proc/self/maps. */ /* Note that lseek doesn't work, at least as of 2.6.15. */ # ifdef THREADS maps_size = GC_get_maps_len(); if (0 == maps_size) return 0; # else maps_size = 4000; /* Guess */ # endif /* Read /proc/self/maps, growing maps_buf as necessary. */ /* Note that we may not allocate conventionally, and */ /* thus can't use stdio. */ do { while (maps_size >= maps_buf_sz) { /* Grow only by powers of 2, since we leak "too small" buffers. */ while (maps_size >= maps_buf_sz) maps_buf_sz *= 2; maps_buf = GC_scratch_alloc(maps_buf_sz); # ifdef THREADS /* Recompute initial length, since we allocated. */ /* This can only happen a few times per program */ /* execution. */ maps_size = GC_get_maps_len(); if (0 == maps_size) return 0; # endif if (maps_buf == 0) return 0; } GC_ASSERT(maps_buf_sz >= maps_size + 1); f = open("/proc/self/maps", O_RDONLY); if (-1 == f) return 0; # ifdef THREADS old_maps_size = maps_size; # endif maps_size = 0; do { result = GC_repeat_read(f, maps_buf, maps_buf_sz-1); if (result <= 0) return 0; maps_size += result; } while (result == maps_buf_sz-1); close(f); # ifdef THREADS if (maps_size > old_maps_size) { GC_err_printf("Old maps size = %d, new maps size = %d\n", old_maps_size, maps_size); ABORT("Unexpected asynchronous /proc/self/maps growth: " "Unregistered thread?"); } # endif } while (maps_size >= maps_buf_sz || maps_size < old_maps_size); /* In the single-threaded case, the second clause is false. */ maps_buf[maps_size] = '\0'; /* Apply fn to result. */ return maps_buf; } // // GC_parse_map_entry parses an entry from /proc/self/maps so we can // locate all writable data segments that belong to shared libraries. // The format of one of these entries and the fields we care about // is as follows: // XXXXXXXX-XXXXXXXX r-xp 00000000 30:05 260537 name of mapping...\n // ^^^^^^^^ ^^^^^^^^ ^^^^ ^^ // start end prot maj_dev // // Note that since about august 2003 kernels, the columns no longer have // fixed offsets on 64-bit kernels. Hence we no longer rely on fixed offsets // anywhere, which is safer anyway. // /* * Assign various fields of the first line in buf_ptr to *start, *end, * *prot, *maj_dev and *mapping_name. Mapping_name may be NULL. * *prot and *mapping_name are assigned pointers into the original * buffer. */ char *GC_parse_map_entry(char *buf_ptr, ptr_t *start, ptr_t *end, char **prot, unsigned int *maj_dev, char **mapping_name) { char *start_start, *end_start, *maj_dev_start; char *p; char *endp; if (buf_ptr == NULL || *buf_ptr == '\0') { return NULL; } p = buf_ptr; while (isspace(*p)) ++p; start_start = p; GC_ASSERT(isxdigit(*start_start)); *start = (ptr_t)strtoul(start_start, &endp, 16); p = endp; GC_ASSERT(*p=='-'); ++p; end_start = p; GC_ASSERT(isxdigit(*end_start)); *end = (ptr_t)strtoul(end_start, &endp, 16); p = endp; GC_ASSERT(isspace(*p)); while (isspace(*p)) ++p; GC_ASSERT(*p == 'r' || *p == '-'); *prot = p; /* Skip past protection field to offset field */ while (!isspace(*p)) ++p; while (isspace(*p)) ++p; GC_ASSERT(isxdigit(*p)); /* Skip past offset field, which we ignore */ while (!isspace(*p)) ++p; while (isspace(*p)) ++p; maj_dev_start = p; GC_ASSERT(isxdigit(*maj_dev_start)); *maj_dev = strtoul(maj_dev_start, NULL, 16); if (mapping_name == 0) { while (*p && *p++ != '\n'); } else { while (*p && *p != '\n' && *p != '/' && *p != '[') p++; *mapping_name = p; while (*p && *p++ != '\n'); } return p; } /* Try to read the backing store base from /proc/self/maps. */ /* Return the bounds of the writable mapping with a 0 major device, */ /* which includes the address passed as data. */ /* Return FALSE if there is no such mapping. */ GC_bool GC_enclosing_mapping(ptr_t addr, ptr_t *startp, ptr_t *endp) { char *prot; ptr_t my_start, my_end; unsigned int maj_dev; char *maps = GC_get_maps(); char *buf_ptr = maps; if (0 == maps) return(FALSE); for (;;) { buf_ptr = GC_parse_map_entry(buf_ptr, &my_start, &my_end, &prot, &maj_dev, 0); if (buf_ptr == NULL) return FALSE; if (prot[1] == 'w' && maj_dev == 0) { if (my_end > addr && my_start <= addr) { *startp = my_start; *endp = my_end; return TRUE; } } } return FALSE; } /* Find the text(code) mapping for the library whose name starts with nm. */ GC_bool GC_text_mapping(char *nm, ptr_t *startp, ptr_t *endp) { size_t nm_len = strlen(nm); char *prot; char *map_path; ptr_t my_start, my_end; unsigned int maj_dev; char *maps = GC_get_maps(); char *buf_ptr = maps; if (0 == maps) return(FALSE); for (;;) { buf_ptr = GC_parse_map_entry(buf_ptr, &my_start, &my_end, &prot, &maj_dev, &map_path); if (buf_ptr == NULL) return FALSE; if (prot[0] == 'r' && prot[1] == '-' && prot[2] == 'x' && strncmp(nm, map_path, nm_len) == 0) { *startp = my_start; *endp = my_end; return TRUE; } } return FALSE; } #ifdef IA64 static ptr_t backing_store_base_from_proc(void) { ptr_t my_start, my_end; if (!GC_enclosing_mapping(GC_save_regs_in_stack(), &my_start, &my_end)) { if (GC_print_stats) { GC_log_printf("Failed to find backing store base from /proc\n"); } return 0; } return my_start; } #endif #endif /* NEED_PROC_MAPS */ #if defined(SEARCH_FOR_DATA_START) /* The I386 case can be handled without a search. The Alpha case */ /* used to be handled differently as well, but the rules changed */ /* for recent Linux versions. This seems to be the easiest way to */ /* cover all versions. */ # if defined(LINUX) || defined(HURD) /* Some Linux distributions arrange to define __data_start. Some */ /* define data_start as a weak symbol. The latter is technically */ /* broken, since the user program may define data_start, in which */ /* case we lose. Nonetheless, we try both, prefering __data_start. */ /* We assume gcc-compatible pragmas. */ # pragma weak __data_start extern int __data_start[]; # pragma weak data_start extern int data_start[]; # endif /* LINUX */ extern int _end[]; ptr_t GC_data_start; void GC_init_linux_data_start() { extern ptr_t GC_find_limit(ptr_t, GC_bool); # if defined(LINUX) || defined(HURD) /* Try the easy approaches first: */ if ((ptr_t)__data_start != 0) { GC_data_start = (ptr_t)(__data_start); return; } if ((ptr_t)data_start != 0) { GC_data_start = (ptr_t)(data_start); return; } # endif /* LINUX */ GC_data_start = GC_find_limit((ptr_t)(_end), FALSE); } #endif # ifdef ECOS # ifndef ECOS_GC_MEMORY_SIZE # define ECOS_GC_MEMORY_SIZE (448 * 1024) # endif /* ECOS_GC_MEMORY_SIZE */ // FIXME: This is a simple way of allocating memory which is // compatible with ECOS early releases. Later releases use a more // sophisticated means of allocating memory than this simple static // allocator, but this method is at least bound to work. static char memory[ECOS_GC_MEMORY_SIZE]; static char *brk = memory; static void *tiny_sbrk(ptrdiff_t increment) { void *p = brk; brk += increment; if (brk > memory + sizeof memory) { brk -= increment; return NULL; } return p; } #define sbrk tiny_sbrk # endif /* ECOS */ #if (defined(NETBSD) || defined(OPENBSD)) && defined(__ELF__) ptr_t GC_data_start; void GC_init_netbsd_elf(void) { extern ptr_t GC_find_limit(ptr_t, GC_bool); extern char **environ; /* This may need to be environ, without the underscore, for */ /* some versions. */ GC_data_start = GC_find_limit((ptr_t)&environ, FALSE); } #endif # ifdef OS2 # include # if !defined(__IBMC__) && !defined(__WATCOMC__) /* e.g. EMX */ struct exe_hdr { unsigned short magic_number; unsigned short padding[29]; long new_exe_offset; }; #define E_MAGIC(x) (x).magic_number #define EMAGIC 0x5A4D #define E_LFANEW(x) (x).new_exe_offset struct e32_exe { unsigned char magic_number[2]; unsigned char byte_order; unsigned char word_order; unsigned long exe_format_level; unsigned short cpu; unsigned short os; unsigned long padding1[13]; unsigned long object_table_offset; unsigned long object_count; unsigned long padding2[31]; }; #define E32_MAGIC1(x) (x).magic_number[0] #define E32MAGIC1 'L' #define E32_MAGIC2(x) (x).magic_number[1] #define E32MAGIC2 'X' #define E32_BORDER(x) (x).byte_order #define E32LEBO 0 #define E32_WORDER(x) (x).word_order #define E32LEWO 0 #define E32_CPU(x) (x).cpu #define E32CPU286 1 #define E32_OBJTAB(x) (x).object_table_offset #define E32_OBJCNT(x) (x).object_count struct o32_obj { unsigned long size; unsigned long base; unsigned long flags; unsigned long pagemap; unsigned long mapsize; unsigned long reserved; }; #define O32_FLAGS(x) (x).flags #define OBJREAD 0x0001L #define OBJWRITE 0x0002L #define OBJINVALID 0x0080L #define O32_SIZE(x) (x).size #define O32_BASE(x) (x).base # else /* IBM's compiler */ /* A kludge to get around what appears to be a header file bug */ # ifndef WORD # define WORD unsigned short # endif # ifndef DWORD # define DWORD unsigned long # endif # define EXE386 1 # include # include # endif /* __IBMC__ */ # define INCL_DOSEXCEPTIONS # define INCL_DOSPROCESS # define INCL_DOSERRORS # define INCL_DOSMODULEMGR # define INCL_DOSMEMMGR # include /* Disable and enable signals during nontrivial allocations */ void GC_disable_signals(void) { ULONG nest; DosEnterMustComplete(&nest); if (nest != 1) ABORT("nested GC_disable_signals"); } void GC_enable_signals(void) { ULONG nest; DosExitMustComplete(&nest); if (nest != 0) ABORT("GC_enable_signals"); } # else # if !defined(PCR) && !defined(AMIGA) && !defined(MSWIN32) \ && !defined(MSWINCE) \ && !defined(MACOS) && !defined(DJGPP) && !defined(DOS4GW) \ && !defined(NOSYS) && !defined(ECOS) # if 0 /* Use the traditional BSD interface */ # define SIGSET_T int # define SIG_DEL(set, signal) (set) &= ~(sigmask(signal)) # define SIG_FILL(set) (set) = 0x7fffffff /* Setting the leading bit appears to provoke a bug in some */ /* longjmp implementations. Most systems appear not to have */ /* a signal 32. */ # define SIGSETMASK(old, new) (old) = sigsetmask(new) # endif /* Use POSIX/SYSV interface */ # define SIGSET_T sigset_t # define SIG_DEL(set, signal) sigdelset(&(set), (signal)) # define SIG_FILL(set) sigfillset(&set) # define SIGSETMASK(old, new) sigprocmask(SIG_SETMASK, &(new), &(old)) static GC_bool mask_initialized = FALSE; static SIGSET_T new_mask; static SIGSET_T old_mask; static SIGSET_T dummy; #if defined(GC_ASSERTIONS) && !defined(THREADS) # define CHECK_SIGNALS int GC_sig_disabled = 0; #endif void GC_disable_signals(void) { if (!mask_initialized) { SIG_FILL(new_mask); SIG_DEL(new_mask, SIGSEGV); SIG_DEL(new_mask, SIGILL); SIG_DEL(new_mask, SIGQUIT); # ifdef SIGBUS SIG_DEL(new_mask, SIGBUS); # endif # ifdef SIGIOT SIG_DEL(new_mask, SIGIOT); # endif # ifdef SIGEMT SIG_DEL(new_mask, SIGEMT); # endif # ifdef SIGTRAP SIG_DEL(new_mask, SIGTRAP); # endif mask_initialized = TRUE; } # ifdef CHECK_SIGNALS if (GC_sig_disabled != 0) ABORT("Nested disables"); GC_sig_disabled++; # endif SIGSETMASK(old_mask,new_mask); } void GC_enable_signals(void) { # ifdef CHECK_SIGNALS if (GC_sig_disabled != 1) ABORT("Unmatched enable"); GC_sig_disabled--; # endif SIGSETMASK(dummy,old_mask); } # endif /* !PCR */ # endif /*!OS/2 */ /* Ivan Demakov: simplest way (to me) */ #if defined (DOS4GW) void GC_disable_signals() { } void GC_enable_signals() { } #endif /* Find the page size */ word GC_page_size; # if defined(MSWIN32) || defined(MSWINCE) void GC_setpagesize(void) { GetSystemInfo(&GC_sysinfo); GC_page_size = GC_sysinfo.dwPageSize; } # else # if defined(MPROTECT_VDB) || defined(PROC_VDB) || defined(USE_MMAP) void GC_setpagesize(void) { GC_page_size = GETPAGESIZE(); } # else /* It's acceptable to fake it. */ void GC_setpagesize(void) { GC_page_size = HBLKSIZE; } # endif # endif /* * Find the base of the stack. * Used only in single-threaded environment. * With threads, GC_mark_roots needs to know how to do this. * Called with allocator lock held. */ # if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32) # define is_writable(prot) ((prot) == PAGE_READWRITE \ || (prot) == PAGE_WRITECOPY \ || (prot) == PAGE_EXECUTE_READWRITE \ || (prot) == PAGE_EXECUTE_WRITECOPY) /* Return the number of bytes that are writable starting at p. */ /* The pointer p is assumed to be page aligned. */ /* If base is not 0, *base becomes the beginning of the */ /* allocation region containing p. */ word GC_get_writable_length(ptr_t p, ptr_t *base) { MEMORY_BASIC_INFORMATION buf; word result; word protect; result = VirtualQuery(p, &buf, sizeof(buf)); if (result != sizeof(buf)) ABORT("Weird VirtualQuery result"); if (base != 0) *base = (ptr_t)(buf.AllocationBase); protect = (buf.Protect & ~(PAGE_GUARD | PAGE_NOCACHE)); if (!is_writable(protect)) { return(0); } if (buf.State != MEM_COMMIT) return(0); return(buf.RegionSize); } int GC_get_stack_base(struct GC_stack_base *sb) { int dummy; ptr_t sp = (ptr_t)(&dummy); ptr_t trunc_sp = (ptr_t)((word)sp & ~(GC_page_size - 1)); word size = GC_get_writable_length(trunc_sp, 0); sb -> mem_base = trunc_sp + size; return GC_SUCCESS; } #define HAVE_GET_STACK_BASE /* This is always called from the main thread. */ ptr_t GC_get_main_stack_base(void) { struct GC_stack_base sb; GC_get_stack_base(&sb); return (ptr_t)sb.mem_base; } # endif /* MS Windows */ # ifdef BEOS # include ptr_t GC_get_main_stack_base(void){ thread_info th; get_thread_info(find_thread(NULL),&th); return th.stack_end; } # endif /* BEOS */ # ifdef OS2 ptr_t GC_get_main_stack_base(void) { PTIB ptib; PPIB ppib; if (DosGetInfoBlocks(&ptib, &ppib) != NO_ERROR) { GC_err_printf("DosGetInfoBlocks failed\n"); ABORT("DosGetInfoBlocks failed\n"); } return((ptr_t)(ptib -> tib_pstacklimit)); } # endif /* OS2 */ # ifdef AMIGA # define GC_AMIGA_SB # include "AmigaOS.c" # undef GC_AMIGA_SB # endif /* AMIGA */ # if defined(NEED_FIND_LIMIT) || defined(UNIX_LIKE) typedef void (*handler)(int); # if defined(SUNOS5SIGS) || defined(IRIX5) || defined(OSF1) \ || defined(HURD) || defined(NETBSD) static struct sigaction old_segv_act; # if defined(_sigargs) /* !Irix6.x */ || defined(HPUX) \ || defined(HURD) || defined(NETBSD) static struct sigaction old_bus_act; # endif # else static handler old_segv_handler, old_bus_handler; # endif void GC_set_and_save_fault_handler(handler h) { # if defined(SUNOS5SIGS) || defined(IRIX5) \ || defined(OSF1) || defined(HURD) || defined(NETBSD) struct sigaction act; act.sa_handler = h; # if 0 /* Was necessary for Solaris 2.3 and very temporary */ /* NetBSD bugs. */ act.sa_flags = SA_RESTART | SA_NODEFER; # else act.sa_flags = SA_RESTART; # endif (void) sigemptyset(&act.sa_mask); # ifdef GC_IRIX_THREADS /* Older versions have a bug related to retrieving and */ /* and setting a handler at the same time. */ (void) sigaction(SIGSEGV, 0, &old_segv_act); (void) sigaction(SIGSEGV, &act, 0); # else (void) sigaction(SIGSEGV, &act, &old_segv_act); # if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \ || defined(HPUX) || defined(HURD) || defined(NETBSD) /* Under Irix 5.x or HP/UX, we may get SIGBUS. */ /* Pthreads doesn't exist under Irix 5.x, so we */ /* don't have to worry in the threads case. */ (void) sigaction(SIGBUS, &act, &old_bus_act); # endif # endif /* GC_IRIX_THREADS */ # else old_segv_handler = signal(SIGSEGV, h); # ifdef SIGBUS old_bus_handler = signal(SIGBUS, h); # endif # endif } # endif /* NEED_FIND_LIMIT || UNIX_LIKE */ # if defined(NEED_FIND_LIMIT) || \ defined(USE_PROC_FOR_LIBRARIES) && defined(THREADS) /* Some tools to implement HEURISTIC2 */ # define MIN_PAGE_SIZE 256 /* Smallest conceivable page size, bytes */ /*ARGSUSED*/ void GC_fault_handler(int sig) { LONGJMP(GC_jmp_buf, 1); } void GC_setup_temporary_fault_handler(void) { /* Handler is process-wide, so this should only happen in */ /* one thread at a time. */ GC_ASSERT(I_HOLD_LOCK()); GC_set_and_save_fault_handler(GC_fault_handler); } void GC_reset_fault_handler(void) { # if defined(SUNOS5SIGS) || defined(IRIX5) \ || defined(OSF1) || defined(HURD) || defined(NETBSD) (void) sigaction(SIGSEGV, &old_segv_act, 0); # if defined(IRIX5) && defined(_sigargs) /* Irix 5.x, not 6.x */ \ || defined(HPUX) || defined(HURD) || defined(NETBSD) (void) sigaction(SIGBUS, &old_bus_act, 0); # endif # else (void) signal(SIGSEGV, old_segv_handler); # ifdef SIGBUS (void) signal(SIGBUS, old_bus_handler); # endif # endif } /* Return the first nonaddressible location > p (up) or */ /* the smallest location q s.t. [q,p) is addressable (!up). */ /* We assume that p (up) or p-1 (!up) is addressable. */ /* Requires allocation lock. */ ptr_t GC_find_limit_with_bound(ptr_t p, GC_bool up, ptr_t bound) { static volatile ptr_t result; /* Safer if static, since otherwise it may not be */ /* preserved across the longjmp. Can safely be */ /* static since it's only called with the */ /* allocation lock held. */ GC_ASSERT(I_HOLD_LOCK()); GC_setup_temporary_fault_handler(); if (SETJMP(GC_jmp_buf) == 0) { result = (ptr_t)(((word)(p)) & ~(MIN_PAGE_SIZE-1)); for (;;) { if (up) { result += MIN_PAGE_SIZE; if (result >= bound) return bound; } else { result -= MIN_PAGE_SIZE; if (result <= bound) return bound; } GC_noop1((word)(*result)); } } GC_reset_fault_handler(); if (!up) { result += MIN_PAGE_SIZE; } return(result); } ptr_t GC_find_limit(ptr_t p, GC_bool up) { if (up) { return GC_find_limit_with_bound(p, up, (ptr_t)(word)(-1)); } else { return GC_find_limit_with_bound(p, up, 0); } } # endif #if defined(ECOS) || defined(NOSYS) ptr_t GC_get_main_stack_base(void) { return STACKBOTTOM; } #endif #ifdef HPUX_STACKBOTTOM #include #include ptr_t GC_get_register_stack_base(void) { struct pst_vm_status vm_status; int i = 0; while (pstat_getprocvm(&vm_status, sizeof(vm_status), 0, i++) == 1) { if (vm_status.pst_type == PS_RSESTACK) { return (ptr_t) vm_status.pst_vaddr; } } /* old way to get the register stackbottom */ return (ptr_t)(((word)GC_stackbottom - BACKING_STORE_DISPLACEMENT - 1) & ~(BACKING_STORE_ALIGNMENT - 1)); } #endif /* HPUX_STACK_BOTTOM */ #ifdef LINUX_STACKBOTTOM #include #include # define STAT_SKIP 27 /* Number of fields preceding startstack */ /* field in /proc/self/stat */ #ifdef USE_LIBC_PRIVATES # pragma weak __libc_stack_end extern ptr_t __libc_stack_end; #endif # ifdef IA64 # ifdef USE_LIBC_PRIVATES # pragma weak __libc_ia64_register_backing_store_base extern ptr_t __libc_ia64_register_backing_store_base; # endif ptr_t GC_get_register_stack_base(void) { ptr_t result; # ifdef USE_LIBC_PRIVATES if (0 != &__libc_ia64_register_backing_store_base && 0 != __libc_ia64_register_backing_store_base) { /* Glibc 2.2.4 has a bug such that for dynamically linked */ /* executables __libc_ia64_register_backing_store_base is */ /* defined but uninitialized during constructor calls. */ /* Hence we check for both nonzero address and value. */ return __libc_ia64_register_backing_store_base; } # endif result = backing_store_base_from_proc(); if (0 == result) { result = GC_find_limit(GC_save_regs_in_stack(), FALSE); /* Now seems to work better than constant displacement */ /* heuristic used in 6.X versions. The latter seems to */ /* fail for 2.6 kernels. */ } return result; } # endif ptr_t GC_linux_stack_base(void) { /* We read the stack base value from /proc/self/stat. We do this */ /* using direct I/O system calls in order to avoid calling malloc */ /* in case REDIRECT_MALLOC is defined. */ # define STAT_BUF_SIZE 4096 # define STAT_READ read /* Should probably call the real read, if read is wrapped. */ char stat_buf[STAT_BUF_SIZE]; int f; char c; word result = 0; size_t i, buf_offset = 0; /* First try the easy way. This should work for glibc 2.2 */ /* This fails in a prelinked ("prelink" command) executable */ /* since the correct value of __libc_stack_end never */ /* becomes visible to us. The second test works around */ /* this. */ # ifdef USE_LIBC_PRIVATES if (0 != &__libc_stack_end && 0 != __libc_stack_end ) { # if defined(IA64) /* Some versions of glibc set the address 16 bytes too */ /* low while the initialization code is running. */ if (((word)__libc_stack_end & 0xfff) + 0x10 < 0x1000) { return __libc_stack_end + 0x10; } /* Otherwise it's not safe to add 16 bytes and we fall */ /* back to using /proc. */ # elif defined(SPARC) /* Older versions of glibc for 64-bit Sparc do not set * this variable correctly, it gets set to either zero * or one. */ if (__libc_stack_end != (ptr_t) (unsigned long)0x1) return __libc_stack_end; # else return __libc_stack_end; # endif } # endif f = open("/proc/self/stat", O_RDONLY); if (f < 0 || STAT_READ(f, stat_buf, STAT_BUF_SIZE) < 2 * STAT_SKIP) { ABORT("Couldn't read /proc/self/stat"); } c = stat_buf[buf_offset++]; /* Skip the required number of fields. This number is hopefully */ /* constant across all Linux implementations. */ for (i = 0; i < STAT_SKIP; ++i) { while (isspace(c)) c = stat_buf[buf_offset++]; while (!isspace(c)) c = stat_buf[buf_offset++]; } while (isspace(c)) c = stat_buf[buf_offset++]; while (isdigit(c)) { result *= 10; result += c - '0'; c = stat_buf[buf_offset++]; } close(f); if (result < 0x10000000) ABORT("Absurd stack bottom value"); return (ptr_t)result; } #endif /* LINUX_STACKBOTTOM */ #ifdef FREEBSD_STACKBOTTOM /* This uses an undocumented sysctl call, but at least one expert */ /* believes it will stay. */ #include #include #include ptr_t GC_freebsd_stack_base(void) { int nm[2] = {CTL_KERN, KERN_USRSTACK}; ptr_t base; size_t len = sizeof(ptr_t); int r = sysctl(nm, 2, &base, &len, NULL, 0); if (r) ABORT("Error getting stack base"); return base; } #endif /* FREEBSD_STACKBOTTOM */ #if !defined(BEOS) && !defined(AMIGA) && !defined(MSWIN32) \ && !defined(MSWINCE) && !defined(OS2) && !defined(NOSYS) && !defined(ECOS) \ && !defined(CYGWIN32) ptr_t GC_get_main_stack_base(void) { # if defined(HEURISTIC1) || defined(HEURISTIC2) word dummy; # endif ptr_t result; # define STACKBOTTOM_ALIGNMENT_M1 ((word)STACK_GRAN - 1) # ifdef STACKBOTTOM return(STACKBOTTOM); # else # ifdef HEURISTIC1 # ifdef STACK_GROWS_DOWN result = (ptr_t)((((word)(&dummy)) + STACKBOTTOM_ALIGNMENT_M1) & ~STACKBOTTOM_ALIGNMENT_M1); # else result = (ptr_t)(((word)(&dummy)) & ~STACKBOTTOM_ALIGNMENT_M1); # endif # endif /* HEURISTIC1 */ # ifdef LINUX_STACKBOTTOM result = GC_linux_stack_base(); # endif # ifdef FREEBSD_STACKBOTTOM result = GC_freebsd_stack_base(); # endif # ifdef HEURISTIC2 # ifdef STACK_GROWS_DOWN result = GC_find_limit((ptr_t)(&dummy), TRUE); # ifdef HEURISTIC2_LIMIT if (result > HEURISTIC2_LIMIT && (ptr_t)(&dummy) < HEURISTIC2_LIMIT) { result = HEURISTIC2_LIMIT; } # endif # else result = GC_find_limit((ptr_t)(&dummy), FALSE); # ifdef HEURISTIC2_LIMIT if (result < HEURISTIC2_LIMIT && (ptr_t)(&dummy) > HEURISTIC2_LIMIT) { result = HEURISTIC2_LIMIT; } # endif # endif # endif /* HEURISTIC2 */ # ifdef STACK_GROWS_DOWN if (result == 0) result = (ptr_t)(signed_word)(-sizeof(ptr_t)); # endif return(result); # endif /* STACKBOTTOM */ } # endif /* ! AMIGA, !OS 2, ! MS Windows, !BEOS, !NOSYS, !ECOS */ #if defined(GC_LINUX_THREADS) && !defined(HAVE_GET_STACK_BASE) #include #ifdef IA64 ptr_t GC_greatest_stack_base_below(ptr_t bound); /* From pthread_support.c */ #endif int GC_get_stack_base(struct GC_stack_base *b) { pthread_attr_t attr; size_t size; if (pthread_getattr_np(pthread_self(), &attr) != 0) { WARN("pthread_getattr_np failed\n", 0); return GC_UNIMPLEMENTED; } if (pthread_attr_getstack(&attr, &(b -> mem_base), &size) != 0) { ABORT("pthread_attr_getstack failed"); } # ifdef STACK_GROWS_DOWN b -> mem_base = (char *)(b -> mem_base) + size; # endif # ifdef IA64 /* We could try backing_store_base_from_proc, but that's safe */ /* only if no mappings are being asynchronously created. */ /* Subtracting the size from the stack base doesn't work for at */ /* least the main thread. */ LOCK(); { ptr_t bsp = GC_save_regs_in_stack(); ptr_t next_stack = GC_greatest_stack_base_below(bsp); if (0 == next_stack) { b -> reg_base = GC_find_limit(bsp, FALSE); } else { /* Avoid walking backwards into preceding memory stack and */ /* growing it. */ b -> reg_base = GC_find_limit_with_bound(bsp, FALSE, next_stack); } } UNLOCK(); # endif return GC_SUCCESS; } #define HAVE_GET_STACK_BASE #endif /* GC_LINUX_THREADS */ #ifndef HAVE_GET_STACK_BASE /* Retrieve stack base. */ /* Using the GC_find_limit version is risky. */ /* On IA64, for example, there is no guard page between the */ /* stack of one thread and the register backing store of the */ /* next. Thus this is likely to identify way too large a */ /* "stack" and thus at least result in disastrous performance. */ /* FIXME - Implement better strategies here. */ int GC_get_stack_base(struct GC_stack_base *b) { int dummy; # ifdef NEED_FIND_LIMIT # ifdef STACK_GROWS_DOWN b -> mem_base = GC_find_limit((ptr_t)(&dummy), TRUE); # ifdef IA64 b -> reg_base = GC_find_limit(GC_save_regs_in_stack(), FALSE); # endif # else b -> mem_base = GC_find_limit(&dummy, FALSE); # endif return GC_SUCCESS; # else return GC_UNIMPLEMENTED; # endif } #endif /* * Register static data segment(s) as roots. * If more data segments are added later then they need to be registered * add that point (as we do with SunOS dynamic loading), * or GC_mark_roots needs to check for them (as we do with PCR). * Called with allocator lock held. */ # ifdef OS2 void GC_register_data_segments(void) { PTIB ptib; PPIB ppib; HMODULE module_handle; # define PBUFSIZ 512 UCHAR path[PBUFSIZ]; FILE * myexefile; struct exe_hdr hdrdos; /* MSDOS header. */ struct e32_exe hdr386; /* Real header for my executable */ struct o32_obj seg; /* Currrent segment */ int nsegs; if (DosGetInfoBlocks(&ptib, &ppib) != NO_ERROR) { GC_err_printf("DosGetInfoBlocks failed\n"); ABORT("DosGetInfoBlocks failed\n"); } module_handle = ppib -> pib_hmte; if (DosQueryModuleName(module_handle, PBUFSIZ, path) != NO_ERROR) { GC_err_printf("DosQueryModuleName failed\n"); ABORT("DosGetInfoBlocks failed\n"); } myexefile = fopen(path, "rb"); if (myexefile == 0) { GC_err_puts("Couldn't open executable "); GC_err_puts(path); GC_err_puts("\n"); ABORT("Failed to open executable\n"); } if (fread((char *)(&hdrdos), 1, sizeof hdrdos, myexefile) < sizeof hdrdos) { GC_err_puts("Couldn't read MSDOS header from "); GC_err_puts(path); GC_err_puts("\n"); ABORT("Couldn't read MSDOS header"); } if (E_MAGIC(hdrdos) != EMAGIC) { GC_err_puts("Executable has wrong DOS magic number: "); GC_err_puts(path); GC_err_puts("\n"); ABORT("Bad DOS magic number"); } if (fseek(myexefile, E_LFANEW(hdrdos), SEEK_SET) != 0) { GC_err_puts("Seek to new header failed in "); GC_err_puts(path); GC_err_puts("\n"); ABORT("Bad DOS magic number"); } if (fread((char *)(&hdr386), 1, sizeof hdr386, myexefile) < sizeof hdr386) { GC_err_puts("Couldn't read MSDOS header from "); GC_err_puts(path); GC_err_puts("\n"); ABORT("Couldn't read OS/2 header"); } if (E32_MAGIC1(hdr386) != E32MAGIC1 || E32_MAGIC2(hdr386) != E32MAGIC2) { GC_err_puts("Executable has wrong OS/2 magic number:"); GC_err_puts(path); GC_err_puts("\n"); ABORT("Bad OS/2 magic number"); } if ( E32_BORDER(hdr386) != E32LEBO || E32_WORDER(hdr386) != E32LEWO) { GC_err_puts("Executable %s has wrong byte order: "); GC_err_puts(path); GC_err_puts("\n"); ABORT("Bad byte order"); } if ( E32_CPU(hdr386) == E32CPU286) { GC_err_puts("GC can't handle 80286 executables: "); GC_err_puts(path); GC_err_puts("\n"); EXIT(); } if (fseek(myexefile, E_LFANEW(hdrdos) + E32_OBJTAB(hdr386), SEEK_SET) != 0) { GC_err_puts("Seek to object table failed: "); GC_err_puts(path); GC_err_puts("\n"); ABORT("Seek to object table failed"); } for (nsegs = E32_OBJCNT(hdr386); nsegs > 0; nsegs--) { int flags; if (fread((char *)(&seg), 1, sizeof seg, myexefile) < sizeof seg) { GC_err_puts("Couldn't read obj table entry from "); GC_err_puts(path); GC_err_puts("\n"); ABORT("Couldn't read obj table entry"); } flags = O32_FLAGS(seg); if (!(flags & OBJWRITE)) continue; if (!(flags & OBJREAD)) continue; if (flags & OBJINVALID) { GC_err_printf("Object with invalid pages?\n"); continue; } GC_add_roots_inner(O32_BASE(seg), O32_BASE(seg)+O32_SIZE(seg), FALSE); } } # else /* !OS2 */ # if defined(MSWIN32) || defined(MSWINCE) # ifdef MSWIN32 /* Unfortunately, we have to handle win32s very differently from NT, */ /* Since VirtualQuery has very different semantics. In particular, */ /* under win32s a VirtualQuery call on an unmapped page returns an */ /* invalid result. Under NT, GC_register_data_segments is a noop and */ /* all real work is done by GC_register_dynamic_libraries. Under */ /* win32s, we cannot find the data segments associated with dll's. */ /* We register the main data segment here. */ GC_bool GC_no_win32_dlls = FALSE; /* This used to be set for gcc, to avoid dealing with */ /* the structured exception handling issues. But we now have */ /* assembly code to do that right. */ # if defined(GWW_VDB) # ifndef _BASETSD_H_ typedef ULONG * PULONG_PTR; # endif typedef UINT (WINAPI * GetWriteWatch_type)( DWORD, PVOID, SIZE_T, PVOID*, PULONG_PTR, PULONG); static GetWriteWatch_type GetWriteWatch_func; static DWORD GetWriteWatch_alloc_flag; # define GC_GWW_AVAILABLE() (GetWriteWatch_func != NULL) static void detect_GetWriteWatch(void) { static GC_bool done; if (done) return; GetWriteWatch_func = (GetWriteWatch_type) GetProcAddress(GetModuleHandle("kernel32.dll"), "GetWriteWatch"); if (GetWriteWatch_func != NULL) { /* Also check whether VirtualAlloc accepts MEM_WRITE_WATCH, */ /* as some versions of kernel32.dll have one but not the */ /* other, making the feature completely broken. */ void * page = VirtualAlloc(NULL, GC_page_size, MEM_WRITE_WATCH | MEM_RESERVE, PAGE_READWRITE); if (page != NULL) { PVOID pages[16]; ULONG_PTR count = 16; DWORD page_size; /* Check that it actually works. In spite of some */ /* documentation it actually seems to exist on W2K. */ /* This test may be unnecessary, but ... */ if (GetWriteWatch_func(WRITE_WATCH_FLAG_RESET, page, GC_page_size, pages, &count, &page_size) != 0) { /* GetWriteWatch always fails. */ GetWriteWatch_func = NULL; } else { GetWriteWatch_alloc_flag = MEM_WRITE_WATCH; } VirtualFree(page, GC_page_size, MEM_RELEASE); } else { /* GetWriteWatch will be useless. */ GetWriteWatch_func = NULL; } } if (GC_print_stats) { if (GetWriteWatch_func == NULL) { GC_log_printf("Did not find a usable GetWriteWatch()\n"); } else { GC_log_printf("Using GetWriteWatch()\n"); } } done = TRUE; } # endif /* GWW_VDB */ GC_bool GC_wnt = FALSE; /* This is a Windows NT derivative, i.e. NT, W2K, XP or later. */ void GC_init_win32(void) { /* Set GC_wnt. */ /* If we're running under win32s, assume that no DLLs will be loaded */ /* I doubt anyone still runs win32s, but ... */ DWORD v = GetVersion(); GC_wnt = !(v & 0x80000000); GC_no_win32_dlls |= ((!GC_wnt) && (v & 0xff) <= 3); } /* Return the smallest address a such that VirtualQuery */ /* returns correct results for all addresses between a and start. */ /* Assumes VirtualQuery returns correct information for start. */ ptr_t GC_least_described_address(ptr_t start) { MEMORY_BASIC_INFORMATION buf; size_t result; LPVOID limit; ptr_t p; LPVOID q; limit = GC_sysinfo.lpMinimumApplicationAddress; p = (ptr_t)((word)start & ~(GC_page_size - 1)); for (;;) { q = (LPVOID)(p - GC_page_size); if ((ptr_t)q > (ptr_t)p /* underflow */ || q < limit) break; result = VirtualQuery(q, &buf, sizeof(buf)); if (result != sizeof(buf) || buf.AllocationBase == 0) break; p = (ptr_t)(buf.AllocationBase); } return p; } # endif # ifndef REDIRECT_MALLOC /* We maintain a linked list of AllocationBase values that we know */ /* correspond to malloc heap sections. Currently this is only called */ /* during a GC. But there is some hope that for long running */ /* programs we will eventually see most heap sections. */ /* In the long run, it would be more reliable to occasionally walk */ /* the malloc heap with HeapWalk on the default heap. But that */ /* apparently works only for NT-based Windows. */ /* In the long run, a better data structure would also be nice ... */ struct GC_malloc_heap_list { void * allocation_base; struct GC_malloc_heap_list *next; } *GC_malloc_heap_l = 0; /* Is p the base of one of the malloc heap sections we already know */ /* about? */ GC_bool GC_is_malloc_heap_base(ptr_t p) { struct GC_malloc_heap_list *q = GC_malloc_heap_l; while (0 != q) { if (q -> allocation_base == p) return TRUE; q = q -> next; } return FALSE; } void *GC_get_allocation_base(void *p) { MEMORY_BASIC_INFORMATION buf; size_t result = VirtualQuery(p, &buf, sizeof(buf)); if (result != sizeof(buf)) { ABORT("Weird VirtualQuery result"); } return buf.AllocationBase; } size_t GC_max_root_size = 100000; /* Appr. largest root size. */ void GC_add_current_malloc_heap() { struct GC_malloc_heap_list *new_l = malloc(sizeof(struct GC_malloc_heap_list)); void * candidate = GC_get_allocation_base(new_l); if (new_l == 0) return; if (GC_is_malloc_heap_base(candidate)) { /* Try a little harder to find malloc heap. */ size_t req_size = 10000; do { void *p = malloc(req_size); if (0 == p) { free(new_l); return; } candidate = GC_get_allocation_base(p); free(p); req_size *= 2; } while (GC_is_malloc_heap_base(candidate) && req_size < GC_max_root_size/10 && req_size < 500000); if (GC_is_malloc_heap_base(candidate)) { free(new_l); return; } } if (GC_print_stats) GC_log_printf("Found new system malloc AllocationBase at %p\n", candidate); new_l -> allocation_base = candidate; new_l -> next = GC_malloc_heap_l; GC_malloc_heap_l = new_l; } # endif /* REDIRECT_MALLOC */ /* Is p the start of either the malloc heap, or of one of our */ /* heap sections? */ GC_bool GC_is_heap_base (ptr_t p) { unsigned i; # ifndef REDIRECT_MALLOC static word last_gc_no = (word)(-1); if (last_gc_no != GC_gc_no) { GC_add_current_malloc_heap(); last_gc_no = GC_gc_no; } if (GC_root_size > GC_max_root_size) GC_max_root_size = GC_root_size; if (GC_is_malloc_heap_base(p)) return TRUE; # endif for (i = 0; i < GC_n_heap_bases; i++) { if (GC_heap_bases[i] == p) return TRUE; } return FALSE ; } # ifdef MSWIN32 void GC_register_root_section(ptr_t static_root) { MEMORY_BASIC_INFORMATION buf; size_t result; DWORD protect; LPVOID p; char * base; char * limit, * new_limit; if (!GC_no_win32_dlls) return; p = base = limit = GC_least_described_address(static_root); while (p < GC_sysinfo.lpMaximumApplicationAddress) { result = VirtualQuery(p, &buf, sizeof(buf)); if (result != sizeof(buf) || buf.AllocationBase == 0 || GC_is_heap_base(buf.AllocationBase)) break; new_limit = (char *)p + buf.RegionSize; protect = buf.Protect; if (buf.State == MEM_COMMIT && is_writable(protect)) { if ((char *)p == limit) { limit = new_limit; } else { if (base != limit) GC_add_roots_inner(base, limit, FALSE); base = p; limit = new_limit; } } if (p > (LPVOID)new_limit /* overflow */) break; p = (LPVOID)new_limit; } if (base != limit) GC_add_roots_inner(base, limit, FALSE); } #endif void GC_register_data_segments() { # ifdef MSWIN32 static char dummy; GC_register_root_section((ptr_t)(&dummy)); # endif } # else /* !OS2 && !Windows */ # if (defined(SVR4) || defined(AUX) || defined(DGUX) \ || (defined(LINUX) && defined(SPARC))) && !defined(PCR) ptr_t GC_SysVGetDataStart(size_t max_page_size, ptr_t etext_addr) { word text_end = ((word)(etext_addr) + sizeof(word) - 1) & ~(sizeof(word) - 1); /* etext rounded to word boundary */ word next_page = ((text_end + (word)max_page_size - 1) & ~((word)max_page_size - 1)); word page_offset = (text_end & ((word)max_page_size - 1)); volatile char * result = (char *)(next_page + page_offset); /* Note that this isnt equivalent to just adding */ /* max_page_size to &etext if &etext is at a page boundary */ GC_setup_temporary_fault_handler(); if (SETJMP(GC_jmp_buf) == 0) { /* Try writing to the address. */ *result = *result; GC_reset_fault_handler(); } else { GC_reset_fault_handler(); /* We got here via a longjmp. The address is not readable. */ /* This is known to happen under Solaris 2.4 + gcc, which place */ /* string constants in the text segment, but after etext. */ /* Use plan B. Note that we now know there is a gap between */ /* text and data segments, so plan A bought us something. */ result = (char *)GC_find_limit((ptr_t)(DATAEND), FALSE); } return((ptr_t)result); } # endif # if defined(FREEBSD) && (defined(I386) || defined(X86_64) || defined(powerpc) || defined(__powerpc__)) && !defined(PCR) /* Its unclear whether this should be identical to the above, or */ /* whether it should apply to non-X86 architectures. */ /* For now we don't assume that there is always an empty page after */ /* etext. But in some cases there actually seems to be slightly more. */ /* This also deals with holes between read-only data and writable data. */ ptr_t GC_FreeBSDGetDataStart(size_t max_page_size, ptr_t etext_addr) { word text_end = ((word)(etext_addr) + sizeof(word) - 1) & ~(sizeof(word) - 1); /* etext rounded to word boundary */ volatile word next_page = (text_end + (word)max_page_size - 1) & ~((word)max_page_size - 1); volatile ptr_t result = (ptr_t)text_end; GC_setup_temporary_fault_handler(); if (SETJMP(GC_jmp_buf) == 0) { /* Try reading at the address. */ /* This should happen before there is another thread. */ for (; next_page < (word)(DATAEND); next_page += (word)max_page_size) *(volatile char *)next_page; GC_reset_fault_handler(); } else { GC_reset_fault_handler(); /* As above, we go to plan B */ result = GC_find_limit((ptr_t)(DATAEND), FALSE); } return(result); } # endif #ifdef AMIGA # define GC_AMIGA_DS # include "AmigaOS.c" # undef GC_AMIGA_DS #else /* !OS2 && !Windows && !AMIGA */ void GC_register_data_segments(void) { # if !defined(PCR) && !defined(MACOS) # if defined(REDIRECT_MALLOC) && defined(GC_SOLARIS_THREADS) /* As of Solaris 2.3, the Solaris threads implementation */ /* allocates the data structure for the initial thread with */ /* sbrk at process startup. It needs to be scanned, so that */ /* we don't lose some malloc allocated data structures */ /* hanging from it. We're on thin ice here ... */ extern caddr_t sbrk(); GC_add_roots_inner(DATASTART, (ptr_t)sbrk(0), FALSE); # else GC_add_roots_inner(DATASTART, (ptr_t)(DATAEND), FALSE); # if defined(DATASTART2) GC_add_roots_inner(DATASTART2, (ptr_t)(DATAEND2), FALSE); # endif # endif # endif # if defined(MACOS) { # if defined(THINK_C) extern void* GC_MacGetDataStart(void); /* globals begin above stack and end at a5. */ GC_add_roots_inner((ptr_t)GC_MacGetDataStart(), (ptr_t)LMGetCurrentA5(), FALSE); # else # if defined(__MWERKS__) # if !__POWERPC__ extern void* GC_MacGetDataStart(void); /* MATTHEW: Function to handle Far Globals (CW Pro 3) */ # if __option(far_data) extern void* GC_MacGetDataEnd(void); # endif /* globals begin above stack and end at a5. */ GC_add_roots_inner((ptr_t)GC_MacGetDataStart(), (ptr_t)LMGetCurrentA5(), FALSE); /* MATTHEW: Handle Far Globals */ # if __option(far_data) /* Far globals follow he QD globals: */ GC_add_roots_inner((ptr_t)LMGetCurrentA5(), (ptr_t)GC_MacGetDataEnd(), FALSE); # endif # else extern char __data_start__[], __data_end__[]; GC_add_roots_inner((ptr_t)&__data_start__, (ptr_t)&__data_end__, FALSE); # endif /* __POWERPC__ */ # endif /* __MWERKS__ */ # endif /* !THINK_C */ } # endif /* MACOS */ /* Dynamic libraries are added at every collection, since they may */ /* change. */ } # endif /* ! AMIGA */ # endif /* ! MSWIN32 && ! MSWINCE*/ # endif /* ! OS2 */ /* * Auxiliary routines for obtaining memory from OS. */ # if !defined(OS2) && !defined(PCR) && !defined(AMIGA) \ && !defined(MSWIN32) && !defined(MSWINCE) \ && !defined(MACOS) && !defined(DOS4GW) && !defined(NONSTOP) # define SBRK_ARG_T ptrdiff_t #if defined(MMAP_SUPPORTED) #ifdef USE_MMAP_FIXED # define GC_MMAP_FLAGS MAP_FIXED | MAP_PRIVATE /* Seems to yield better performance on Solaris 2, but can */ /* be unreliable if something is already mapped at the address. */ #else # define GC_MMAP_FLAGS MAP_PRIVATE #endif #ifdef USE_MMAP_ANON # define zero_fd -1 # if defined(MAP_ANONYMOUS) # define OPT_MAP_ANON MAP_ANONYMOUS # else # define OPT_MAP_ANON MAP_ANON # endif #else static int zero_fd; # define OPT_MAP_ANON 0 #endif #ifndef HEAP_START # define HEAP_START 0 #endif ptr_t GC_unix_mmap_get_mem(word bytes) { void *result; static ptr_t last_addr = HEAP_START; # ifndef USE_MMAP_ANON static GC_bool initialized = FALSE; if (!initialized) { zero_fd = open("/dev/zero", O_RDONLY); fcntl(zero_fd, F_SETFD, FD_CLOEXEC); initialized = TRUE; } # endif if (bytes & (GC_page_size -1)) ABORT("Bad GET_MEM arg"); result = mmap(last_addr, bytes, PROT_READ | PROT_WRITE | OPT_PROT_EXEC, GC_MMAP_FLAGS | OPT_MAP_ANON, zero_fd, 0/* offset */); if (result == MAP_FAILED) return(0); last_addr = (ptr_t)result + bytes + GC_page_size - 1; last_addr = (ptr_t)((word)last_addr & ~(GC_page_size - 1)); # if !defined(LINUX) if (last_addr == 0) { /* Oops. We got the end of the address space. This isn't */ /* usable by arbitrary C code, since one-past-end pointers */ /* don't work, so we discard it and try again. */ munmap(result, (size_t)(-GC_page_size) - (size_t)result); /* Leave last page mapped, so we can't repeat. */ return GC_unix_mmap_get_mem(bytes); } # else GC_ASSERT(last_addr != 0); # endif return((ptr_t)result); } # endif /* MMAP_SUPPORTED */ #if defined(USE_MMAP) ptr_t GC_unix_get_mem(word bytes) { return GC_unix_mmap_get_mem(bytes); } #else /* Not USE_MMAP */ ptr_t GC_unix_sbrk_get_mem(word bytes) { ptr_t result; # ifdef IRIX5 /* Bare sbrk isn't thread safe. Play by malloc rules. */ /* The equivalent may be needed on other systems as well. */ __LOCK_MALLOC(); # endif { ptr_t cur_brk = (ptr_t)sbrk(0); SBRK_ARG_T lsbs = (word)cur_brk & (GC_page_size-1); if ((SBRK_ARG_T)bytes < 0) { result = 0; /* too big */ goto out; } if (lsbs != 0) { if((ptr_t)sbrk(GC_page_size - lsbs) == (ptr_t)(-1)) { result = 0; goto out; } } # ifdef ADD_HEAP_GUARD_PAGES /* This is useful for catching severe memory overwrite problems that */ /* span heap sections. It shouldn't otherwise be turned on. */ { ptr_t guard = (ptr_t)sbrk((SBRK_ARG_T)GC_page_size); if (mprotect(guard, GC_page_size, PROT_NONE) != 0) ABORT("ADD_HEAP_GUARD_PAGES: mprotect failed"); } # endif /* ADD_HEAP_GUARD_PAGES */ result = (ptr_t)sbrk((SBRK_ARG_T)bytes); if (result == (ptr_t)(-1)) result = 0; } out: # ifdef IRIX5 __UNLOCK_MALLOC(); # endif return(result); } #if defined(MMAP_SUPPORTED) /* By default, we try both sbrk and mmap, in that order. */ ptr_t GC_unix_get_mem(word bytes) { static GC_bool sbrk_failed = FALSE; ptr_t result = 0; if (!sbrk_failed) result = GC_unix_sbrk_get_mem(bytes); if (0 == result) { sbrk_failed = TRUE; result = GC_unix_mmap_get_mem(bytes); } if (0 == result) { /* Try sbrk again, in case sbrk memory became available. */ result = GC_unix_sbrk_get_mem(bytes); } return result; } #else /* !MMAP_SUPPORTED */ ptr_t GC_unix_get_mem(word bytes) { return GC_unix_sbrk_get_mem(bytes); } #endif #endif /* Not USE_MMAP */ # endif /* UN*X */ # ifdef OS2 void * os2_alloc(size_t bytes) { void * result; if (DosAllocMem(&result, bytes, PAG_EXECUTE | PAG_READ | PAG_WRITE | PAG_COMMIT) != NO_ERROR) { return(0); } if (result == 0) return(os2_alloc(bytes)); return(result); } # endif /* OS2 */ # if defined(MSWIN32) || defined(MSWINCE) SYSTEM_INFO GC_sysinfo; # endif # ifdef MSWIN32 # ifdef USE_GLOBAL_ALLOC # define GLOBAL_ALLOC_TEST 1 # else # define GLOBAL_ALLOC_TEST GC_no_win32_dlls # endif word GC_n_heap_bases = 0; word GC_mem_top_down = 0; /* Change to MEM_TOP_DOWN for better 64-bit */ /* testing. Otherwise all addresses tend to */ /* end up in first 4GB, hiding bugs. */ ptr_t GC_win32_get_mem(word bytes) { ptr_t result; if (GLOBAL_ALLOC_TEST) { /* VirtualAlloc doesn't like PAGE_EXECUTE_READWRITE. */ /* There are also unconfirmed rumors of other */ /* problems, so we dodge the issue. */ result = (ptr_t) GlobalAlloc(0, bytes + HBLKSIZE); result = (ptr_t)(((word)result + HBLKSIZE - 1) & ~(HBLKSIZE-1)); } else { /* VirtualProtect only works on regions returned by a */ /* single VirtualAlloc call. Thus we allocate one */ /* extra page, which will prevent merging of blocks */ /* in separate regions, and eliminate any temptation */ /* to call VirtualProtect on a range spanning regions. */ /* This wastes a small amount of memory, and risks */ /* increased fragmentation. But better alternatives */ /* would require effort. */ /* Pass the MEM_WRITE_WATCH only if GetWriteWatch-based */ /* VDBs are enabled and the GetWriteWatch function is */ /* available. Otherwise we waste resources or possibly */ /* cause VirtualAlloc to fail (observed in Windows 2000 */ /* SP2). */ result = (ptr_t) VirtualAlloc(NULL, bytes + 1, # ifdef GWW_VDB GetWriteWatch_alloc_flag | # endif MEM_COMMIT | MEM_RESERVE | GC_mem_top_down, PAGE_EXECUTE_READWRITE); } if (HBLKDISPL(result) != 0) ABORT("Bad VirtualAlloc result"); /* If I read the documentation correctly, this can */ /* only happen if HBLKSIZE > 64k or not a power of 2. */ if (GC_n_heap_bases >= MAX_HEAP_SECTS) ABORT("Too many heap sections"); GC_heap_bases[GC_n_heap_bases++] = result; return(result); } void GC_win32_free_heap(void) { if (GC_no_win32_dlls) { while (GC_n_heap_bases > 0) { GlobalFree (GC_heap_bases[--GC_n_heap_bases]); GC_heap_bases[GC_n_heap_bases] = 0; } } } # endif #ifdef AMIGA # define GC_AMIGA_AM # include "AmigaOS.c" # undef GC_AMIGA_AM #endif # ifdef MSWINCE word GC_n_heap_bases = 0; ptr_t GC_wince_get_mem(word bytes) { ptr_t result; word i; /* Round up allocation size to multiple of page size */ bytes = (bytes + GC_page_size-1) & ~(GC_page_size-1); /* Try to find reserved, uncommitted pages */ for (i = 0; i < GC_n_heap_bases; i++) { if (((word)(-(signed_word)GC_heap_lengths[i]) & (GC_sysinfo.dwAllocationGranularity-1)) >= bytes) { result = GC_heap_bases[i] + GC_heap_lengths[i]; break; } } if (i == GC_n_heap_bases) { /* Reserve more pages */ word res_bytes = (bytes + GC_sysinfo.dwAllocationGranularity-1) & ~(GC_sysinfo.dwAllocationGranularity-1); /* If we ever support MPROTECT_VDB here, we will probably need to */ /* ensure that res_bytes is strictly > bytes, so that VirtualProtect */ /* never spans regions. It seems to be OK for a VirtualFree */ /* argument to span regions, so we should be OK for now. */ result = (ptr_t) VirtualAlloc(NULL, res_bytes, MEM_RESERVE | MEM_TOP_DOWN, PAGE_EXECUTE_READWRITE); if (HBLKDISPL(result) != 0) ABORT("Bad VirtualAlloc result"); /* If I read the documentation correctly, this can */ /* only happen if HBLKSIZE > 64k or not a power of 2. */ if (GC_n_heap_bases >= MAX_HEAP_SECTS) ABORT("Too many heap sections"); GC_heap_bases[GC_n_heap_bases] = result; GC_heap_lengths[GC_n_heap_bases] = 0; GC_n_heap_bases++; } /* Commit pages */ result = (ptr_t) VirtualAlloc(result, bytes, MEM_COMMIT, PAGE_EXECUTE_READWRITE); if (result != NULL) { if (HBLKDISPL(result) != 0) ABORT("Bad VirtualAlloc result"); GC_heap_lengths[i] += bytes; } return(result); } # endif #ifdef USE_MUNMAP /* For now, this only works on Win32/WinCE and some Unix-like */ /* systems. If you have something else, don't define */ /* USE_MUNMAP. */ /* We assume ANSI C to support this feature. */ #if !defined(MSWIN32) && !defined(MSWINCE) #include #include #include #include #endif /* Compute a page aligned starting address for the unmap */ /* operation on a block of size bytes starting at start. */ /* Return 0 if the block is too small to make this feasible. */ ptr_t GC_unmap_start(ptr_t start, size_t bytes) { ptr_t result = start; /* Round start to next page boundary. */ result += GC_page_size - 1; result = (ptr_t)((word)result & ~(GC_page_size - 1)); if (result + GC_page_size > start + bytes) return 0; return result; } /* Compute end address for an unmap operation on the indicated */ /* block. */ ptr_t GC_unmap_end(ptr_t start, size_t bytes) { ptr_t end_addr = start + bytes; end_addr = (ptr_t)((word)end_addr & ~(GC_page_size - 1)); return end_addr; } /* Under Win32/WinCE we commit (map) and decommit (unmap) */ /* memory using VirtualAlloc and VirtualFree. These functions */ /* work on individual allocations of virtual memory, made */ /* previously using VirtualAlloc with the MEM_RESERVE flag. */ /* The ranges we need to (de)commit may span several of these */ /* allocations; therefore we use VirtualQuery to check */ /* allocation lengths, and split up the range as necessary. */ /* We assume that GC_remap is called on exactly the same range */ /* as a previous call to GC_unmap. It is safe to consistently */ /* round the endpoints in both places. */ void GC_unmap(ptr_t start, size_t bytes) { ptr_t start_addr = GC_unmap_start(start, bytes); ptr_t end_addr = GC_unmap_end(start, bytes); word len = end_addr - start_addr; if (0 == start_addr) return; # if defined(MSWIN32) || defined(MSWINCE) while (len != 0) { MEMORY_BASIC_INFORMATION mem_info; GC_word free_len; if (VirtualQuery(start_addr, &mem_info, sizeof(mem_info)) != sizeof(mem_info)) ABORT("Weird VirtualQuery result"); free_len = (len < mem_info.RegionSize) ? len : mem_info.RegionSize; if (!VirtualFree(start_addr, free_len, MEM_DECOMMIT)) ABORT("VirtualFree failed"); GC_unmapped_bytes += free_len; start_addr += free_len; len -= free_len; } # else /* We immediately remap it to prevent an intervening mmap from */ /* accidentally grabbing the same address space. */ { void * result; result = mmap(start_addr, len, PROT_NONE, MAP_PRIVATE | MAP_FIXED | OPT_MAP_ANON, zero_fd, 0/* offset */); if (result != (void *)start_addr) ABORT("mmap(...PROT_NONE...) failed"); } GC_unmapped_bytes += len; # endif } void GC_remap(ptr_t start, size_t bytes) { ptr_t start_addr = GC_unmap_start(start, bytes); ptr_t end_addr = GC_unmap_end(start, bytes); word len = end_addr - start_addr; # if defined(MSWIN32) || defined(MSWINCE) ptr_t result; if (0 == start_addr) return; while (len != 0) { MEMORY_BASIC_INFORMATION mem_info; GC_word alloc_len; if (VirtualQuery(start_addr, &mem_info, sizeof(mem_info)) != sizeof(mem_info)) ABORT("Weird VirtualQuery result"); alloc_len = (len < mem_info.RegionSize) ? len : mem_info.RegionSize; result = VirtualAlloc(start_addr, alloc_len, MEM_COMMIT, PAGE_EXECUTE_READWRITE); if (result != start_addr) { ABORT("VirtualAlloc remapping failed"); } GC_unmapped_bytes -= alloc_len; start_addr += alloc_len; len -= alloc_len; } # else /* It was already remapped with PROT_NONE. */ int result; if (0 == start_addr) return; result = mprotect(start_addr, len, PROT_READ | PROT_WRITE | OPT_PROT_EXEC); if (result != 0) { GC_err_printf( "Mprotect failed at %p (length %ld) with errno %d\n", start_addr, (unsigned long)len, errno); ABORT("Mprotect remapping failed"); } GC_unmapped_bytes -= len; # endif } /* Two adjacent blocks have already been unmapped and are about to */ /* be merged. Unmap the whole block. This typically requires */ /* that we unmap a small section in the middle that was not previously */ /* unmapped due to alignment constraints. */ void GC_unmap_gap(ptr_t start1, size_t bytes1, ptr_t start2, size_t bytes2) { ptr_t start1_addr = GC_unmap_start(start1, bytes1); ptr_t end1_addr = GC_unmap_end(start1, bytes1); ptr_t start2_addr = GC_unmap_start(start2, bytes2); ptr_t end2_addr = GC_unmap_end(start2, bytes2); ptr_t start_addr = end1_addr; ptr_t end_addr = start2_addr; size_t len; GC_ASSERT(start1 + bytes1 == start2); if (0 == start1_addr) start_addr = GC_unmap_start(start1, bytes1 + bytes2); if (0 == start2_addr) end_addr = GC_unmap_end(start1, bytes1 + bytes2); if (0 == start_addr) return; len = end_addr - start_addr; # if defined(MSWIN32) || defined(MSWINCE) while (len != 0) { MEMORY_BASIC_INFORMATION mem_info; GC_word free_len; if (VirtualQuery(start_addr, &mem_info, sizeof(mem_info)) != sizeof(mem_info)) ABORT("Weird VirtualQuery result"); free_len = (len < mem_info.RegionSize) ? len : mem_info.RegionSize; if (!VirtualFree(start_addr, free_len, MEM_DECOMMIT)) ABORT("VirtualFree failed"); GC_unmapped_bytes += free_len; start_addr += free_len; len -= free_len; } # else if (len != 0 && munmap(start_addr, len) != 0) ABORT("munmap failed"); GC_unmapped_bytes += len; # endif } #endif /* USE_MUNMAP */ /* Routine for pushing any additional roots. In THREADS */ /* environment, this is also responsible for marking from */ /* thread stacks. */ #ifndef THREADS void (*GC_push_other_roots)(void) = 0; #else /* THREADS */ # ifdef PCR PCR_ERes GC_push_thread_stack(PCR_Th_T *t, PCR_Any dummy) { struct PCR_ThCtl_TInfoRep info; PCR_ERes result; info.ti_stkLow = info.ti_stkHi = 0; result = PCR_ThCtl_GetInfo(t, &info); GC_push_all_stack((ptr_t)(info.ti_stkLow), (ptr_t)(info.ti_stkHi)); return(result); } /* Push the contents of an old object. We treat this as stack */ /* data only becasue that makes it robust against mark stack */ /* overflow. */ PCR_ERes GC_push_old_obj(void *p, size_t size, PCR_Any data) { GC_push_all_stack((ptr_t)p, (ptr_t)p + size); return(PCR_ERes_okay); } void GC_default_push_other_roots(void) { /* Traverse data allocated by previous memory managers. */ { extern struct PCR_MM_ProcsRep * GC_old_allocator; if ((*(GC_old_allocator->mmp_enumerate))(PCR_Bool_false, GC_push_old_obj, 0) != PCR_ERes_okay) { ABORT("Old object enumeration failed"); } } /* Traverse all thread stacks. */ if (PCR_ERes_IsErr( PCR_ThCtl_ApplyToAllOtherThreads(GC_push_thread_stack,0)) || PCR_ERes_IsErr(GC_push_thread_stack(PCR_Th_CurrThread(), 0))) { ABORT("Thread stack marking failed\n"); } } # endif /* PCR */ # if defined(GC_PTHREADS) || defined(GC_WIN32_THREADS) extern void GC_push_all_stacks(void); void GC_default_push_other_roots(void) { GC_push_all_stacks(); } # endif /* GC_WIN32_THREADS || GC_PTHREADS */ void (*GC_push_other_roots)(void) = GC_default_push_other_roots; #endif /* THREADS */ /* * Routines for accessing dirty bits on virtual pages. * There are six ways to maintain this information: * DEFAULT_VDB: A simple dummy implementation that treats every page * as possibly dirty. This makes incremental collection * useless, but the implementation is still correct. * MANUAL_VDB: Stacks and static data are always considered dirty. * Heap pages are considered dirty if GC_dirty(p) has been * called on some pointer p pointing to somewhere inside * an object on that page. A GC_dirty() call on a large * object directly dirties only a single page, but for * MANUAL_VDB we are careful to treat an object with a dirty * page as completely dirty. * In order to avoid races, an object must be marked dirty * after it is written, and a reference to the object * must be kept on a stack or in a register in the interim. * With threads enabled, an object directly reachable from the * stack at the time of a collection is treated as dirty. * In single-threaded mode, it suffices to ensure that no * collection can take place between the pointer assignment * and the GC_dirty() call. * PCR_VDB: Use PPCRs virtual dirty bit facility. * PROC_VDB: Use the /proc facility for reading dirty bits. Only * works under some SVR4 variants. Even then, it may be * too slow to be entirely satisfactory. Requires reading * dirty bits for entire address space. Implementations tend * to assume that the client is a (slow) debugger. * MPROTECT_VDB:Protect pages and then catch the faults to keep track of * dirtied pages. The implementation (and implementability) * is highly system dependent. This usually fails when system * calls write to a protected page. We prevent the read system * call from doing so. It is the clients responsibility to * make sure that other system calls are similarly protected * or write only to the stack. * GWW_VDB: Use the Win32 GetWriteWatch functions, if available, to * read dirty bits. In case it is not available (because we * are running on Windows 95, Windows 2000 or earlier), * MPROTECT_VDB may be defined as a fallback strategy. */ GC_bool GC_dirty_maintained = FALSE; #if defined(PROC_VDB) || defined(GWW_VDB) /* Add all pages in pht2 to pht1 */ void GC_or_pages(page_hash_table pht1, page_hash_table pht2) { register int i; for (i = 0; i < PHT_SIZE; i++) pht1[i] |= pht2[i]; } #endif #ifdef GWW_VDB # define GC_GWW_BUF_LEN 1024 static PVOID gww_buf[GC_GWW_BUF_LEN]; # ifdef MPROTECT_VDB GC_bool GC_gww_dirty_init(void) { detect_GetWriteWatch(); return GC_GWW_AVAILABLE(); } # else void GC_dirty_init(void) { detect_GetWriteWatch(); GC_dirty_maintained = GC_GWW_AVAILABLE(); } # endif # ifdef MPROTECT_VDB static void GC_gww_read_dirty(void) # else void GC_read_dirty(void) # endif { word i; BZERO(GC_grungy_pages, sizeof(GC_grungy_pages)); for (i = 0; i != GC_n_heap_sects; ++i) { ULONG_PTR count; do { PVOID * pages, * pages_end; DWORD page_size; pages = gww_buf; count = GC_GWW_BUF_LEN; /* * GetWriteWatch is documented as returning non-zero when it fails, * but the documentation doesn't explicitly say why it would fail or * what its behaviour will be if it fails. * It does appear to fail, at least on recent W2K instances, if * the underlying memory was not allocated with the appropriate * flag. This is common if GC_enable_incremental is called * shortly after GC initialization. To avoid modifying the * interface, we silently work around such a failure, it it only * affects the initial (small) heap allocation. * If there are more dirty * pages than will fit in the buffer, this is not treated as a * failure; we must check the page count in the loop condition. * Since each partial call will reset the status of some * pages, this should eventually terminate even in the overflow * case. */ if (GetWriteWatch_func(WRITE_WATCH_FLAG_RESET, GC_heap_sects[i].hs_start, GC_heap_sects[i].hs_bytes, pages, &count, &page_size) != 0) { static int warn_count = 0; unsigned j; struct hblk * start = (struct hblk *)GC_heap_sects[i].hs_start; static struct hblk *last_warned = 0; size_t nblocks = divHBLKSZ(GC_heap_sects[i].hs_bytes); if ( i != 0 && last_warned != start && warn_count++ < 5) { last_warned = start; WARN( "GC_gww_read_dirty unexpectedly failed at %ld: " "Falling back to marking all pages dirty\n", start); } for (j = 0; j < nblocks; ++j) { word hash = PHT_HASH(start + j); set_pht_entry_from_index(GC_grungy_pages, hash); } count = 1; /* Done with this section. */ } else /* succeeded */{ pages_end = pages + count; while (pages != pages_end) { struct hblk * h = (struct hblk *) *pages++; struct hblk * h_end = (struct hblk *) ((char *) h + page_size); do set_pht_entry_from_index(GC_grungy_pages, PHT_HASH(h)); while (++h < h_end); } } } while (count == GC_GWW_BUF_LEN); } GC_or_pages(GC_written_pages, GC_grungy_pages); } # ifdef MPROTECT_VDB static GC_bool GC_gww_page_was_dirty(struct hblk * h) # else GC_bool GC_page_was_dirty(struct hblk * h) # endif { return HDR(h) == 0 || get_pht_entry_from_index(GC_grungy_pages, PHT_HASH(h)); } # ifdef MPROTECT_VDB static GC_bool GC_gww_page_was_ever_dirty(struct hblk * h) # else GC_bool GC_page_was_ever_dirty(struct hblk * h) # endif { return HDR(h) == 0 || get_pht_entry_from_index(GC_written_pages, PHT_HASH(h)); } # ifndef MPROTECT_VDB void GC_remove_protection(struct hblk *h, word nblocks, GC_bool is_ptrfree) {} # endif # endif /* GWW_VDB */ # ifdef DEFAULT_VDB /* All of the following assume the allocation lock is held, and */ /* signals are disabled. */ /* The client asserts that unallocated pages in the heap are never */ /* written. */ /* Initialize virtual dirty bit implementation. */ void GC_dirty_init(void) { if (GC_print_stats == VERBOSE) GC_log_printf("Initializing DEFAULT_VDB...\n"); GC_dirty_maintained = TRUE; } /* Retrieve system dirty bits for heap to a local buffer. */ /* Restore the systems notion of which pages are dirty. */ void GC_read_dirty(void) {} /* Is the HBLKSIZE sized page at h marked dirty in the local buffer? */ /* If the actual page size is different, this returns TRUE if any */ /* of the pages overlapping h are dirty. This routine may err on the */ /* side of labelling pages as dirty (and this implementation does). */ /*ARGSUSED*/ GC_bool GC_page_was_dirty(struct hblk *h) { return(TRUE); } /* * The following two routines are typically less crucial. They matter * most with large dynamic libraries, or if we can't accurately identify * stacks, e.g. under Solaris 2.X. Otherwise the following default * versions are adequate. */ /* Could any valid GC heap pointer ever have been written to this page? */ /*ARGSUSED*/ GC_bool GC_page_was_ever_dirty(struct hblk *h) { return(TRUE); } /* A call that: */ /* I) hints that [h, h+nblocks) is about to be written. */ /* II) guarantees that protection is removed. */ /* (I) may speed up some dirty bit implementations. */ /* (II) may be essential if we need to ensure that */ /* pointer-free system call buffers in the heap are */ /* not protected. */ /*ARGSUSED*/ void GC_remove_protection(struct hblk *h, word nblocks, GC_bool is_ptrfree) { } # endif /* DEFAULT_VDB */ # ifdef MANUAL_VDB /* Initialize virtual dirty bit implementation. */ void GC_dirty_init(void) { if (GC_print_stats == VERBOSE) GC_log_printf("Initializing MANUAL_VDB...\n"); /* GC_dirty_pages and GC_grungy_pages are already cleared. */ GC_dirty_maintained = TRUE; } /* Retrieve system dirty bits for heap to a local buffer. */ /* Restore the systems notion of which pages are dirty. */ void GC_read_dirty(void) { BCOPY((word *)GC_dirty_pages, GC_grungy_pages, (sizeof GC_dirty_pages)); BZERO((word *)GC_dirty_pages, (sizeof GC_dirty_pages)); } /* Is the HBLKSIZE sized page at h marked dirty in the local buffer? */ /* If the actual page size is different, this returns TRUE if any */ /* of the pages overlapping h are dirty. This routine may err on the */ /* side of labelling pages as dirty (and this implementation does). */ /*ARGSUSED*/ GC_bool GC_page_was_dirty(struct hblk *h) { register word index; index = PHT_HASH(h); return(HDR(h) == 0 || get_pht_entry_from_index(GC_grungy_pages, index)); } /* Could any valid GC heap pointer ever have been written to this page? */ /*ARGSUSED*/ GC_bool GC_page_was_ever_dirty(struct hblk *h) { /* FIXME - implement me. */ return(TRUE); } /* Mark the page containing p as dirty. Logically, this dirties the */ /* entire object. */ void GC_dirty(ptr_t p) { word index = PHT_HASH(p); async_set_pht_entry_from_index(GC_dirty_pages, index); } /*ARGSUSED*/ void GC_remove_protection(struct hblk *h, word nblocks, GC_bool is_ptrfree) { } # endif /* MANUAL_VDB */ # ifdef MPROTECT_VDB /* * See DEFAULT_VDB for interface descriptions. */ /* * This implementation maintains dirty bits itself by catching write * faults and keeping track of them. We assume nobody else catches * SIGBUS or SIGSEGV. We assume no write faults occur in system calls. * This means that clients must ensure that system calls don't write * to the write-protected heap. Probably the best way to do this is to * ensure that system calls write at most to POINTERFREE objects in the * heap, and do even that only if we are on a platform on which those * are not protected. Another alternative is to wrap system calls * (see example for read below), but the current implementation holds * applications. * We assume the page size is a multiple of HBLKSIZE. * We prefer them to be the same. We avoid protecting POINTERFREE * objects only if they are the same. */ # if !defined(MSWIN32) && !defined(MSWINCE) && !defined(DARWIN) # include # include # include # define PROTECT(addr, len) \ if (mprotect((caddr_t)(addr), (size_t)(len), \ PROT_READ | OPT_PROT_EXEC) < 0) { \ ABORT("mprotect failed"); \ } # define UNPROTECT(addr, len) \ if (mprotect((caddr_t)(addr), (size_t)(len), \ PROT_WRITE | PROT_READ | OPT_PROT_EXEC ) < 0) { \ ABORT("un-mprotect failed"); \ } # else # ifdef DARWIN /* Using vm_protect (mach syscall) over mprotect (BSD syscall) seems to decrease the likelihood of some of the problems described below. */ #include static mach_port_t GC_task_self; #define PROTECT(addr,len) \ if(vm_protect(GC_task_self,(vm_address_t)(addr),(vm_size_t)(len), \ FALSE,VM_PROT_READ) != KERN_SUCCESS) { \ ABORT("vm_portect failed"); \ } #define UNPROTECT(addr,len) \ if(vm_protect(GC_task_self,(vm_address_t)(addr),(vm_size_t)(len), \ FALSE,VM_PROT_READ|VM_PROT_WRITE) != KERN_SUCCESS) { \ ABORT("vm_portect failed"); \ } # else # ifndef MSWINCE # include # endif static DWORD protect_junk; # define PROTECT(addr, len) \ if (!VirtualProtect((addr), (len), PAGE_EXECUTE_READ, \ &protect_junk)) { \ DWORD last_error = GetLastError(); \ GC_printf("Last error code: %lx\n", last_error); \ ABORT("VirtualProtect failed"); \ } # define UNPROTECT(addr, len) \ if (!VirtualProtect((addr), (len), PAGE_EXECUTE_READWRITE, \ &protect_junk)) { \ ABORT("un-VirtualProtect failed"); \ } # endif /* !DARWIN */ # endif /* MSWIN32 || MSWINCE || DARWIN */ #if defined(MSWIN32) typedef LPTOP_LEVEL_EXCEPTION_FILTER SIG_HNDLR_PTR; # undef SIG_DFL # define SIG_DFL (LPTOP_LEVEL_EXCEPTION_FILTER) (-1) #elif defined(MSWINCE) typedef LONG (WINAPI *SIG_HNDLR_PTR)(struct _EXCEPTION_POINTERS *); # undef SIG_DFL # define SIG_DFL (SIG_HNDLR_PTR) (-1) #elif defined(DARWIN) typedef void (* SIG_HNDLR_PTR)(); #else typedef void (* SIG_HNDLR_PTR)(int, siginfo_t *, void *); typedef void (* PLAIN_HNDLR_PTR)(int); #endif #if defined(__GLIBC__) # if __GLIBC__ < 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ < 2 # error glibc too old? # endif #endif #ifndef DARWIN SIG_HNDLR_PTR GC_old_bus_handler; GC_bool GC_old_bus_handler_used_si; SIG_HNDLR_PTR GC_old_segv_handler; /* Also old MSWIN32 ACCESS_VIOLATION filter */ GC_bool GC_old_segv_handler_used_si; #endif /* !DARWIN */ #if defined(THREADS) /* We need to lock around the bitmap update in the write fault handler */ /* in order to avoid the risk of losing a bit. We do this with a */ /* test-and-set spin lock if we know how to do that. Otherwise we */ /* check whether we are already in the handler and use the dumb but */ /* safe fallback algorithm of setting all bits in the word. */ /* Contention should be very rare, so we do the minimum to handle it */ /* correctly. */ #ifdef AO_HAVE_test_and_set_acquire static volatile AO_TS_t fault_handler_lock = 0; void async_set_pht_entry_from_index(volatile page_hash_table db, size_t index) { while (AO_test_and_set_acquire(&fault_handler_lock) == AO_TS_SET) {} /* Could also revert to set_pht_entry_from_index_safe if initial */ /* GC_test_and_set fails. */ set_pht_entry_from_index(db, index); AO_CLEAR(&fault_handler_lock); } #else /* !AO_have_test_and_set_acquire */ # error No test_and_set operation: Introduces a race. /* THIS WOULD BE INCORRECT! */ /* The dirty bit vector may be temporarily wrong, */ /* just before we notice the conflict and correct it. We may end up */ /* looking at it while it's wrong. But this requires contention */ /* exactly when a GC is triggered, which seems far less likely to */ /* fail than the old code, which had no reported failures. Thus we */ /* leave it this way while we think of something better, or support */ /* GC_test_and_set on the remaining platforms. */ static volatile word currently_updating = 0; void async_set_pht_entry_from_index(volatile page_hash_table db, size_t index) { unsigned int update_dummy; currently_updating = (word)(&update_dummy); set_pht_entry_from_index(db, index); /* If we get contention in the 10 or so instruction window here, */ /* and we get stopped by a GC between the two updates, we lose! */ if (currently_updating != (word)(&update_dummy)) { set_pht_entry_from_index_safe(db, index); /* We claim that if two threads concurrently try to update the */ /* dirty bit vector, the first one to execute UPDATE_START */ /* will see it changed when UPDATE_END is executed. (Note that */ /* &update_dummy must differ in two distinct threads.) It */ /* will then execute set_pht_entry_from_index_safe, thus */ /* returning us to a safe state, though not soon enough. */ } } #endif /* !AO_HAVE_test_and_set_acquire */ #else /* !THREADS */ # define async_set_pht_entry_from_index(db, index) \ set_pht_entry_from_index(db, index) #endif /* !THREADS */ #if !defined(DARWIN) # include # if defined(FREEBSD) # define SIG_OK TRUE # define CODE_OK (code == BUS_PAGE_FAULT) # elif defined(OSF1) # define SIG_OK (sig == SIGSEGV) # define CODE_OK (code == 2 /* experimentally determined */) # elif defined(IRIX5) # define SIG_OK (sig == SIGSEGV) # define CODE_OK (code == EACCES) # elif defined(HURD) # define SIG_OK (sig == SIGBUS || sig == SIGSEGV) # define CODE_OK TRUE # elif defined(LINUX) # define SIG_OK (sig == SIGSEGV) # define CODE_OK TRUE /* Empirically c.trapno == 14, on IA32, but is that useful? */ /* Should probably consider alignment issues on other */ /* architectures. */ # elif defined(HPUX) # define SIG_OK (sig == SIGSEGV || sig == SIGBUS) # define CODE_OK (si -> si_code == SEGV_ACCERR) \ || (si -> si_code == BUS_ADRERR) \ || (si -> si_code == BUS_UNKNOWN) \ || (si -> si_code == SEGV_UNKNOWN) \ || (si -> si_code == BUS_OBJERR) # elif defined(FREEBSD) # define SIG_OK (sig == SIGBUS) # define CODE_OK (si -> si_code == BUS_PAGE_FAULT) # elif defined(SUNOS5SIGS) # define SIG_OK (sig == SIGSEGV) # define CODE_OK (si -> si_code == SEGV_ACCERR) # elif defined(MSWIN32) || defined(MSWINCE) # define SIG_OK (exc_info -> ExceptionRecord -> ExceptionCode \ == STATUS_ACCESS_VIOLATION) # define CODE_OK (exc_info -> ExceptionRecord -> ExceptionInformation[0] \ == 1) /* Write fault */ # endif # if defined(MSWIN32) || defined(MSWINCE) LONG WINAPI GC_write_fault_handler(struct _EXCEPTION_POINTERS *exc_info) # else # include /*ARGSUSED*/ void GC_write_fault_handler(int sig, siginfo_t *si, void *raw_sc) # endif /* MSWIN32 || MSWINCE */ { # if !defined(MSWIN32) && !defined(MSWINCE) int code = si -> si_code; /* Ignore gcc unused var. warning. */ ucontext_t * scp = (ucontext_t *)raw_sc; /* Ignore gcc unused var. warning. */ char *addr = si -> si_addr; # endif # if defined(MSWIN32) || defined(MSWINCE) char * addr = (char *) (exc_info -> ExceptionRecord -> ExceptionInformation[1]); # define sig SIGSEGV # endif unsigned i; if (SIG_OK && CODE_OK) { register struct hblk * h = (struct hblk *)((word)addr & ~(GC_page_size-1)); GC_bool in_allocd_block; # ifdef SUNOS5SIGS /* Address is only within the correct physical page. */ in_allocd_block = FALSE; for (i = 0; i < divHBLKSZ(GC_page_size); i++) { if (HDR(h+i) != 0) { in_allocd_block = TRUE; } } # else in_allocd_block = (HDR(addr) != 0); # endif if (!in_allocd_block) { /* FIXME - We should make sure that we invoke the */ /* old handler with the appropriate calling */ /* sequence, which often depends on SA_SIGINFO. */ /* Heap blocks now begin and end on page boundaries */ SIG_HNDLR_PTR old_handler; GC_bool used_si; if (sig == SIGSEGV) { old_handler = GC_old_segv_handler; used_si = GC_old_segv_handler_used_si; } else { old_handler = GC_old_bus_handler; used_si = GC_old_bus_handler_used_si; } if (old_handler == (SIG_HNDLR_PTR)SIG_DFL) { # if !defined(MSWIN32) && !defined(MSWINCE) GC_err_printf("Segfault at %p\n", addr); ABORT("Unexpected bus error or segmentation fault"); # else return(EXCEPTION_CONTINUE_SEARCH); # endif } else { /* * FIXME: This code should probably check if the * old signal handler used the traditional style and * if so call it using that style. */ # ifdef MSWIN32 return((*old_handler)(exc_info)); # else if (used_si) ((SIG_HNDLR_PTR)old_handler) (sig, si, raw_sc); else /* FIXME: should pass nonstandard args as well. */ ((PLAIN_HNDLR_PTR)old_handler) (sig); return; # endif } } UNPROTECT(h, GC_page_size); /* We need to make sure that no collection occurs between */ /* the UNPROTECT and the setting of the dirty bit. Otherwise */ /* a write by a third thread might go unnoticed. Reversing */ /* the order is just as bad, since we would end up unprotecting */ /* a page in a GC cycle during which it's not marked. */ /* Currently we do this by disabling the thread stopping */ /* signals while this handler is running. An alternative might */ /* be to record the fact that we're about to unprotect, or */ /* have just unprotected a page in the GC's thread structure, */ /* and then to have the thread stopping code set the dirty */ /* flag, if necessary. */ for (i = 0; i < divHBLKSZ(GC_page_size); i++) { size_t index = PHT_HASH(h+i); async_set_pht_entry_from_index(GC_dirty_pages, index); } /* The write may not take place before dirty bits are read. */ /* But then we'll fault again ... */ # if defined(MSWIN32) || defined(MSWINCE) return(EXCEPTION_CONTINUE_EXECUTION); # else return; # endif } #if defined(MSWIN32) || defined(MSWINCE) return EXCEPTION_CONTINUE_SEARCH; #else GC_err_printf("Segfault at %p\n", addr); ABORT("Unexpected bus error or segmentation fault"); #endif } #endif /* !DARWIN */ /* * We hold the allocation lock. We expect block h to be written * shortly. Ensure that all pages containing any part of the n hblks * starting at h are no longer protected. If is_ptrfree is false, * also ensure that they will subsequently appear to be dirty. */ void GC_remove_protection(struct hblk *h, word nblocks, GC_bool is_ptrfree) { struct hblk * h_trunc; /* Truncated to page boundary */ struct hblk * h_end; /* Page boundary following block end */ struct hblk * current; GC_bool found_clean; # if defined(GWW_VDB) if (GC_GWW_AVAILABLE()) return; # endif if (!GC_dirty_maintained) return; h_trunc = (struct hblk *)((word)h & ~(GC_page_size-1)); h_end = (struct hblk *)(((word)(h + nblocks) + GC_page_size-1) & ~(GC_page_size-1)); found_clean = FALSE; for (current = h_trunc; current < h_end; ++current) { size_t index = PHT_HASH(current); if (!is_ptrfree || current < h || current >= h + nblocks) { async_set_pht_entry_from_index(GC_dirty_pages, index); } } UNPROTECT(h_trunc, (ptr_t)h_end - (ptr_t)h_trunc); } #if !defined(DARWIN) void GC_dirty_init(void) { # if !defined(MSWIN32) && !defined(MSWINCE) struct sigaction act, oldact; act.sa_flags = SA_RESTART | SA_SIGINFO; act.sa_sigaction = GC_write_fault_handler; (void)sigemptyset(&act.sa_mask); # ifdef SIG_SUSPEND /* Arrange to postpone SIG_SUSPEND while we're in a write fault */ /* handler. This effectively makes the handler atomic w.r.t. */ /* stopping the world for GC. */ (void)sigaddset(&act.sa_mask, SIG_SUSPEND); # endif /* SIG_SUSPEND */ # endif if (GC_print_stats == VERBOSE) GC_log_printf( "Initializing mprotect virtual dirty bit implementation\n"); GC_dirty_maintained = TRUE; if (GC_page_size % HBLKSIZE != 0) { GC_err_printf("Page size not multiple of HBLKSIZE\n"); ABORT("Page size not multiple of HBLKSIZE"); } # if !defined(MSWIN32) && !defined(MSWINCE) # if defined(GC_IRIX_THREADS) sigaction(SIGSEGV, 0, &oldact); sigaction(SIGSEGV, &act, 0); # else { int res = sigaction(SIGSEGV, &act, &oldact); if (res != 0) ABORT("Sigaction failed"); } # endif if (oldact.sa_flags & SA_SIGINFO) { GC_old_segv_handler = oldact.sa_sigaction; GC_old_segv_handler_used_si = TRUE; } else { GC_old_segv_handler = (SIG_HNDLR_PTR)oldact.sa_handler; GC_old_segv_handler_used_si = FALSE; } if (GC_old_segv_handler == (SIG_HNDLR_PTR)SIG_IGN) { GC_err_printf("Previously ignored segmentation violation!?"); GC_old_segv_handler = (SIG_HNDLR_PTR)SIG_DFL; } if (GC_old_segv_handler != (SIG_HNDLR_PTR)SIG_DFL) { if (GC_print_stats == VERBOSE) GC_log_printf("Replaced other SIGSEGV handler\n"); } # endif /* ! MS windows */ # if defined(HPUX) || defined(LINUX) || defined(HURD) \ || (defined(FREEBSD) && defined(SUNOS5SIGS)) sigaction(SIGBUS, &act, &oldact); if (oldact.sa_flags & SA_SIGINFO) { GC_old_bus_handler = oldact.sa_sigaction; GC_old_bus_handler_used_si = TRUE; } else { GC_old_bus_handler = (SIG_HNDLR_PTR)oldact.sa_handler; GC_old_bus_handler_used_si = FALSE; } if (GC_old_bus_handler == (SIG_HNDLR_PTR)SIG_IGN) { GC_err_printf("Previously ignored bus error!?"); GC_old_bus_handler = (SIG_HNDLR_PTR)SIG_DFL; } if (GC_old_bus_handler != (SIG_HNDLR_PTR)SIG_DFL) { if (GC_print_stats == VERBOSE) GC_log_printf("Replaced other SIGBUS handler\n"); } # endif /* HPUX || LINUX || HURD || (FREEBSD && SUNOS5SIGS) */ # if defined(MSWIN32) # if defined(GWW_VDB) if (GC_gww_dirty_init()) return; # endif GC_old_segv_handler = SetUnhandledExceptionFilter(GC_write_fault_handler); if (GC_old_segv_handler != NULL) { if (GC_print_stats) GC_log_printf("Replaced other UnhandledExceptionFilter\n"); } else { GC_old_segv_handler = SIG_DFL; } # endif } #endif /* !DARWIN */ int GC_incremental_protection_needs(void) { if (GC_page_size == HBLKSIZE) { return GC_PROTECTS_POINTER_HEAP; } else { return GC_PROTECTS_POINTER_HEAP | GC_PROTECTS_PTRFREE_HEAP; } } #define HAVE_INCREMENTAL_PROTECTION_NEEDS #define IS_PTRFREE(hhdr) ((hhdr)->hb_descr == 0) #define PAGE_ALIGNED(x) !((word)(x) & (GC_page_size - 1)) void GC_protect_heap(void) { ptr_t start; size_t len; struct hblk * current; struct hblk * current_start; /* Start of block to be protected. */ struct hblk * limit; unsigned i; GC_bool protect_all = (0 != (GC_incremental_protection_needs() & GC_PROTECTS_PTRFREE_HEAP)); for (i = 0; i < GC_n_heap_sects; i++) { start = GC_heap_sects[i].hs_start; len = GC_heap_sects[i].hs_bytes; if (protect_all) { PROTECT(start, len); } else { GC_ASSERT(PAGE_ALIGNED(len)) GC_ASSERT(PAGE_ALIGNED(start)) current_start = current = (struct hblk *)start; limit = (struct hblk *)(start + len); while (current < limit) { hdr * hhdr; word nhblks; GC_bool is_ptrfree; GC_ASSERT(PAGE_ALIGNED(current)); GET_HDR(current, hhdr); if (IS_FORWARDING_ADDR_OR_NIL(hhdr)) { /* This can happen only if we're at the beginning of a */ /* heap segment, and a block spans heap segments. */ /* We will handle that block as part of the preceding */ /* segment. */ GC_ASSERT(current_start == current); current_start = ++current; continue; } if (HBLK_IS_FREE(hhdr)) { GC_ASSERT(PAGE_ALIGNED(hhdr -> hb_sz)); nhblks = divHBLKSZ(hhdr -> hb_sz); is_ptrfree = TRUE; /* dirty on alloc */ } else { nhblks = OBJ_SZ_TO_BLOCKS(hhdr -> hb_sz); is_ptrfree = IS_PTRFREE(hhdr); } if (is_ptrfree) { if (current_start < current) { PROTECT(current_start, (ptr_t)current - (ptr_t)current_start); } current_start = (current += nhblks); } else { current += nhblks; } } if (current_start < current) { PROTECT(current_start, (ptr_t)current - (ptr_t)current_start); } } } } /* We assume that either the world is stopped or its OK to lose dirty */ /* bits while this is happenning (as in GC_enable_incremental). */ void GC_read_dirty(void) { # if defined(GWW_VDB) if (GC_GWW_AVAILABLE()) { GC_gww_read_dirty(); return; } # endif BCOPY((word *)GC_dirty_pages, GC_grungy_pages, (sizeof GC_dirty_pages)); BZERO((word *)GC_dirty_pages, (sizeof GC_dirty_pages)); GC_protect_heap(); } GC_bool GC_page_was_dirty(struct hblk *h) { register word index; # if defined(GWW_VDB) if (GC_GWW_AVAILABLE()) return GC_gww_page_was_dirty(h); # endif index = PHT_HASH(h); return(HDR(h) == 0 || get_pht_entry_from_index(GC_grungy_pages, index)); } /* * Acquiring the allocation lock here is dangerous, since this * can be called from within GC_call_with_alloc_lock, and the cord * package does so. On systems that allow nested lock acquisition, this * happens to work. * On other systems, SET_LOCK_HOLDER and friends must be suitably defined. */ static GC_bool syscall_acquired_lock = FALSE; /* Protected by GC lock. */ #if 0 void GC_begin_syscall(void) { /* FIXME: Resurrecting this code would require fixing the */ /* test, which can spuriously return TRUE. */ if (!I_HOLD_LOCK()) { LOCK(); syscall_acquired_lock = TRUE; } } void GC_end_syscall(void) { if (syscall_acquired_lock) { syscall_acquired_lock = FALSE; UNLOCK(); } } void GC_unprotect_range(ptr_t addr, word len) { struct hblk * start_block; struct hblk * end_block; register struct hblk *h; ptr_t obj_start; if (!GC_dirty_maintained) return; obj_start = GC_base(addr); if (obj_start == 0) return; if (GC_base(addr + len - 1) != obj_start) { ABORT("GC_unprotect_range(range bigger than object)"); } start_block = (struct hblk *)((word)addr & ~(GC_page_size - 1)); end_block = (struct hblk *)((word)(addr + len - 1) & ~(GC_page_size - 1)); end_block += GC_page_size/HBLKSIZE - 1; for (h = start_block; h <= end_block; h++) { register word index = PHT_HASH(h); async_set_pht_entry_from_index(GC_dirty_pages, index); } UNPROTECT(start_block, ((ptr_t)end_block - (ptr_t)start_block) + HBLKSIZE); } /* We no longer wrap read by default, since that was causing too many */ /* problems. It is preferred that the client instead avoids writing */ /* to the write-protected heap with a system call. */ /* This still serves as sample code if you do want to wrap system calls.*/ #if !defined(MSWIN32) && !defined(MSWINCE) && !defined(GC_USE_LD_WRAP) /* Replacement for UNIX system call. */ /* Other calls that write to the heap should be handled similarly. */ /* Note that this doesn't work well for blocking reads: It will hold */ /* the allocation lock for the entire duration of the call. Multithreaded */ /* clients should really ensure that it won't block, either by setting */ /* the descriptor nonblocking, or by calling select or poll first, to */ /* make sure that input is available. */ /* Another, preferred alternative is to ensure that system calls never */ /* write to the protected heap (see above). */ # include # include ssize_t read(int fd, void *buf, size_t nbyte) { int result; GC_begin_syscall(); GC_unprotect_range(buf, (word)nbyte); # if defined(IRIX5) || defined(GC_LINUX_THREADS) /* Indirect system call may not always be easily available. */ /* We could call _read, but that would interfere with the */ /* libpthread interception of read. */ /* On Linux, we have to be careful with the linuxthreads */ /* read interception. */ { struct iovec iov; iov.iov_base = buf; iov.iov_len = nbyte; result = readv(fd, &iov, 1); } # else # if defined(HURD) result = __read(fd, buf, nbyte); # else /* The two zero args at the end of this list are because one IA-64 syscall() implementation actually requires six args to be passed, even though they aren't always used. */ result = syscall(SYS_read, fd, buf, nbyte, 0, 0); # endif /* !HURD */ # endif GC_end_syscall(); return(result); } #endif /* !MSWIN32 && !MSWINCE && !GC_LINUX_THREADS */ #if defined(GC_USE_LD_WRAP) && !defined(THREADS) /* We use the GNU ld call wrapping facility. */ /* This requires that the linker be invoked with "--wrap read". */ /* This can be done by passing -Wl,"--wrap read" to gcc. */ /* I'm not sure that this actually wraps whatever version of read */ /* is called by stdio. That code also mentions __read. */ # include ssize_t __wrap_read(int fd, void *buf, size_t nbyte) { int result; GC_begin_syscall(); GC_unprotect_range(buf, (word)nbyte); result = __real_read(fd, buf, nbyte); GC_end_syscall(); return(result); } /* We should probably also do this for __read, or whatever stdio */ /* actually calls. */ #endif #endif /* 0 */ /*ARGSUSED*/ GC_bool GC_page_was_ever_dirty(struct hblk *h) { # if defined(GWW_VDB) if (GC_GWW_AVAILABLE()) return GC_gww_page_was_ever_dirty(h); # endif return(TRUE); } # endif /* MPROTECT_VDB */ # ifdef PROC_VDB /* * See DEFAULT_VDB for interface descriptions. */ /* * This implementaion assumes a Solaris 2.X like /proc pseudo-file-system * from which we can read page modified bits. This facility is far from * optimal (e.g. we would like to get the info for only some of the * address space), but it avoids intercepting system calls. */ #include #include #include #include #include #include #include #define INITIAL_BUF_SZ 16384 word GC_proc_buf_size = INITIAL_BUF_SZ; char *GC_proc_buf; int GC_proc_fd; void GC_dirty_init(void) { int fd; char buf[30]; GC_dirty_maintained = TRUE; if (GC_bytes_allocd != 0 || GC_bytes_allocd_before_gc != 0) { register int i; for (i = 0; i < PHT_SIZE; i++) GC_written_pages[i] = (word)(-1); if (GC_print_stats == VERBOSE) GC_log_printf( "Allocated bytes:%lu:all pages may have been written\n", (unsigned long) (GC_bytes_allocd + GC_bytes_allocd_before_gc)); } sprintf(buf, "/proc/%d", getpid()); fd = open(buf, O_RDONLY); if (fd < 0) { ABORT("/proc open failed"); } GC_proc_fd = syscall(SYS_ioctl, fd, PIOCOPENPD, 0); close(fd); syscall(SYS_fcntl, GC_proc_fd, F_SETFD, FD_CLOEXEC); if (GC_proc_fd < 0) { ABORT("/proc ioctl failed"); } GC_proc_buf = GC_scratch_alloc(GC_proc_buf_size); } /* Ignore write hints. They don't help us here. */ /*ARGSUSED*/ void GC_remove_protection(h, nblocks, is_ptrfree) struct hblk *h; word nblocks; GC_bool is_ptrfree; { } # define READ(fd,buf,nbytes) read(fd, buf, nbytes) void GC_read_dirty(void) { unsigned long ps, np; int nmaps; ptr_t vaddr; struct prasmap * map; char * bufp; ptr_t current_addr, limit; int i; BZERO(GC_grungy_pages, (sizeof GC_grungy_pages)); bufp = GC_proc_buf; if (READ(GC_proc_fd, bufp, GC_proc_buf_size) <= 0) { if (GC_print_stats) GC_log_printf("/proc read failed: GC_proc_buf_size = %lu\n", (unsigned long)GC_proc_buf_size); { /* Retry with larger buffer. */ word new_size = 2 * GC_proc_buf_size; char * new_buf = GC_scratch_alloc(new_size); if (new_buf != 0) { GC_proc_buf = bufp = new_buf; GC_proc_buf_size = new_size; } if (READ(GC_proc_fd, bufp, GC_proc_buf_size) <= 0) { WARN("Insufficient space for /proc read\n", 0); /* Punt: */ memset(GC_grungy_pages, 0xff, sizeof (page_hash_table)); memset(GC_written_pages, 0xff, sizeof(page_hash_table)); return; } } } /* Copy dirty bits into GC_grungy_pages */ nmaps = ((struct prpageheader *)bufp) -> pr_nmap; /* printf( "nmaps = %d, PG_REFERENCED = %d, PG_MODIFIED = %d\n", nmaps, PG_REFERENCED, PG_MODIFIED); */ bufp = bufp + sizeof(struct prpageheader); for (i = 0; i < nmaps; i++) { map = (struct prasmap *)bufp; vaddr = (ptr_t)(map -> pr_vaddr); ps = map -> pr_pagesize; np = map -> pr_npage; /* printf("vaddr = 0x%X, ps = 0x%X, np = 0x%X\n", vaddr, ps, np); */ limit = vaddr + ps * np; bufp += sizeof (struct prasmap); for (current_addr = vaddr; current_addr < limit; current_addr += ps){ if ((*bufp++) & PG_MODIFIED) { register struct hblk * h = (struct hblk *) current_addr; while ((ptr_t)h < current_addr + ps) { register word index = PHT_HASH(h); set_pht_entry_from_index(GC_grungy_pages, index); h++; } } } bufp += sizeof(long) - 1; bufp = (char *)((unsigned long)bufp & ~(sizeof(long)-1)); } /* Update GC_written_pages. */ GC_or_pages(GC_written_pages, GC_grungy_pages); } #undef READ GC_bool GC_page_was_dirty(struct hblk *h) { register word index = PHT_HASH(h); register GC_bool result; result = get_pht_entry_from_index(GC_grungy_pages, index); return(result); } GC_bool GC_page_was_ever_dirty(struct hblk *h) { register word index = PHT_HASH(h); register GC_bool result; result = get_pht_entry_from_index(GC_written_pages, index); return(result); } # endif /* PROC_VDB */ # ifdef PCR_VDB # include "vd/PCR_VD.h" # define NPAGES (32*1024) /* 128 MB */ PCR_VD_DB GC_grungy_bits[NPAGES]; ptr_t GC_vd_base; /* Address corresponding to GC_grungy_bits[0] */ /* HBLKSIZE aligned. */ void GC_dirty_init(void) { GC_dirty_maintained = TRUE; /* For the time being, we assume the heap generally grows up */ GC_vd_base = GC_heap_sects[0].hs_start; if (GC_vd_base == 0) { ABORT("Bad initial heap segment"); } if (PCR_VD_Start(HBLKSIZE, GC_vd_base, NPAGES*HBLKSIZE) != PCR_ERes_okay) { ABORT("dirty bit initialization failed"); } } void GC_read_dirty(void) { /* lazily enable dirty bits on newly added heap sects */ { static int onhs = 0; int nhs = GC_n_heap_sects; for( ; onhs < nhs; onhs++ ) { PCR_VD_WriteProtectEnable( GC_heap_sects[onhs].hs_start, GC_heap_sects[onhs].hs_bytes ); } } if (PCR_VD_Clear(GC_vd_base, NPAGES*HBLKSIZE, GC_grungy_bits) != PCR_ERes_okay) { ABORT("dirty bit read failed"); } } GC_bool GC_page_was_dirty(struct hblk *h) { if((ptr_t)h < GC_vd_base || (ptr_t)h >= GC_vd_base + NPAGES*HBLKSIZE) { return(TRUE); } return(GC_grungy_bits[h - (struct hblk *)GC_vd_base] & PCR_VD_DB_dirtyBit); } /*ARGSUSED*/ void GC_remove_protection(struct hblk *h, word nblocks, GC_bool is_ptrfree) { PCR_VD_WriteProtectDisable(h, nblocks*HBLKSIZE); PCR_VD_WriteProtectEnable(h, nblocks*HBLKSIZE); } # endif /* PCR_VDB */ #if defined(MPROTECT_VDB) && defined(DARWIN) /* The following sources were used as a *reference* for this exception handling code: 1. Apple's mach/xnu documentation 2. Timothy J. Wood's "Mach Exception Handlers 101" post to the omnigroup's macosx-dev list. www.omnigroup.com/mailman/archive/macosx-dev/2000-June/014178.html 3. macosx-nat.c from Apple's GDB source code. */ /* The bug that caused all this trouble should now be fixed. This should eventually be removed if all goes well. */ /* #define BROKEN_EXCEPTION_HANDLING */ #include #include #include #include #include #include extern void GC_darwin_register_mach_handler_thread(mach_port_t); /* These are not defined in any header, although they are documented */ extern boolean_t exc_server(mach_msg_header_t *, mach_msg_header_t *); extern kern_return_t exception_raise(mach_port_t, mach_port_t, mach_port_t, exception_type_t, exception_data_t, mach_msg_type_number_t); extern kern_return_t exception_raise_state(mach_port_t, mach_port_t, mach_port_t, exception_type_t, exception_data_t, mach_msg_type_number_t, thread_state_flavor_t*, thread_state_t, mach_msg_type_number_t, thread_state_t, mach_msg_type_number_t*); extern kern_return_t exception_raise_state_identity(mach_port_t, mach_port_t, mach_port_t, exception_type_t, exception_data_t, mach_msg_type_number_t, thread_state_flavor_t*, thread_state_t, mach_msg_type_number_t, thread_state_t, mach_msg_type_number_t*); #define MAX_EXCEPTION_PORTS 16 static struct { mach_msg_type_number_t count; exception_mask_t masks[MAX_EXCEPTION_PORTS]; exception_handler_t ports[MAX_EXCEPTION_PORTS]; exception_behavior_t behaviors[MAX_EXCEPTION_PORTS]; thread_state_flavor_t flavors[MAX_EXCEPTION_PORTS]; } GC_old_exc_ports; static struct { mach_port_t exception; #if defined(THREADS) mach_port_t reply; #endif } GC_ports; typedef struct { mach_msg_header_t head; } GC_msg_t; typedef enum { GC_MP_NORMAL, GC_MP_DISCARDING, GC_MP_STOPPED } GC_mprotect_state_t; /* FIXME: 1 and 2 seem to be safe to use in the msgh_id field, but it isn't documented. Use the source and see if they should be ok. */ #define ID_STOP 1 #define ID_RESUME 2 /* These values are only used on the reply port */ #define ID_ACK 3 #if defined(THREADS) GC_mprotect_state_t GC_mprotect_state; /* The following should ONLY be called when the world is stopped */ static void GC_mprotect_thread_notify(mach_msg_id_t id) { struct { GC_msg_t msg; mach_msg_trailer_t trailer; } buf; mach_msg_return_t r; /* remote, local */ buf.msg.head.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_MAKE_SEND, 0); buf.msg.head.msgh_size = sizeof(buf.msg); buf.msg.head.msgh_remote_port = GC_ports.exception; buf.msg.head.msgh_local_port = MACH_PORT_NULL; buf.msg.head.msgh_id = id; r = mach_msg(&buf.msg.head, MACH_SEND_MSG | MACH_RCV_MSG | MACH_RCV_LARGE, sizeof(buf.msg), sizeof(buf), GC_ports.reply, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); if(r != MACH_MSG_SUCCESS) ABORT("mach_msg failed in GC_mprotect_thread_notify"); if(buf.msg.head.msgh_id != ID_ACK) ABORT("invalid ack in GC_mprotect_thread_notify"); } /* Should only be called by the mprotect thread */ static void GC_mprotect_thread_reply(void) { GC_msg_t msg; mach_msg_return_t r; /* remote, local */ msg.head.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_MAKE_SEND, 0); msg.head.msgh_size = sizeof(msg); msg.head.msgh_remote_port = GC_ports.reply; msg.head.msgh_local_port = MACH_PORT_NULL; msg.head.msgh_id = ID_ACK; r = mach_msg(&msg.head, MACH_SEND_MSG, sizeof(msg), 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); if(r != MACH_MSG_SUCCESS) ABORT("mach_msg failed in GC_mprotect_thread_reply"); } void GC_mprotect_stop(void) { GC_mprotect_thread_notify(ID_STOP); } void GC_mprotect_resume(void) { GC_mprotect_thread_notify(ID_RESUME); } #else /* !THREADS */ /* The compiler should optimize away any GC_mprotect_state computations */ #define GC_mprotect_state GC_MP_NORMAL #endif static void *GC_mprotect_thread(void *arg) { mach_msg_return_t r; /* These two structures contain some private kernel data. We don't need to access any of it so we don't bother defining a proper struct. The correct definitions are in the xnu source code. */ struct { mach_msg_header_t head; char data[256]; } reply; struct { mach_msg_header_t head; mach_msg_body_t msgh_body; char data[1024]; } msg; mach_msg_id_t id; GC_darwin_register_mach_handler_thread(mach_thread_self()); for(;;) { r = mach_msg(&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE | (GC_mprotect_state == GC_MP_DISCARDING ? MACH_RCV_TIMEOUT : 0), 0, sizeof(msg), GC_ports.exception, GC_mprotect_state == GC_MP_DISCARDING ? 0 : MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); id = r == MACH_MSG_SUCCESS ? msg.head.msgh_id : -1; # if defined(THREADS) if(GC_mprotect_state == GC_MP_DISCARDING) { if(r == MACH_RCV_TIMED_OUT) { GC_mprotect_state = GC_MP_STOPPED; GC_mprotect_thread_reply(); continue; } if(r == MACH_MSG_SUCCESS && (id == ID_STOP || id == ID_RESUME)) ABORT("out of order mprotect thread request"); } # endif /* THREADS */ if(r != MACH_MSG_SUCCESS) { GC_err_printf("mach_msg failed with %d %s\n", (int)r, mach_error_string(r)); ABORT("mach_msg failed"); } switch(id) { # if defined(THREADS) case ID_STOP: if(GC_mprotect_state != GC_MP_NORMAL) ABORT("Called mprotect_stop when state wasn't normal"); GC_mprotect_state = GC_MP_DISCARDING; break; case ID_RESUME: if(GC_mprotect_state != GC_MP_STOPPED) ABORT("Called mprotect_resume when state wasn't stopped"); GC_mprotect_state = GC_MP_NORMAL; GC_mprotect_thread_reply(); break; # endif /* THREADS */ default: /* Handle the message (calls catch_exception_raise) */ if(!exc_server(&msg.head, &reply.head)) ABORT("exc_server failed"); /* Send the reply */ r = mach_msg(&reply.head, MACH_SEND_MSG, reply.head.msgh_size, 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); if(r != MACH_MSG_SUCCESS) { /* This will fail if the thread dies, but the thread */ /* shouldn't die... */ # ifdef BROKEN_EXCEPTION_HANDLING GC_err_printf("mach_msg failed with %d %s while sending" "exc reply\n", (int)r,mach_error_string(r)); # else ABORT("mach_msg failed while sending exception reply"); # endif } } /* switch */ } /* for(;;) */ /* NOT REACHED */ return NULL; } /* All this SIGBUS code shouldn't be necessary. All protection faults should be going throught the mach exception handler. However, it seems a SIGBUS is occasionally sent for some unknown reason. Even more odd, it seems to be meaningless and safe to ignore. */ #ifdef BROKEN_EXCEPTION_HANDLING static SIG_HNDLR_PTR GC_old_bus_handler; /* Updates to this aren't atomic, but the SIGBUSs seem pretty rare. Even if this doesn't get updated property, it isn't really a problem */ static int GC_sigbus_count; static void GC_darwin_sigbus(int num, siginfo_t *sip, void *context) { if(num != SIGBUS) ABORT("Got a non-sigbus signal in the sigbus handler"); /* Ugh... some seem safe to ignore, but too many in a row probably means trouble. GC_sigbus_count is reset for each mach exception that is handled */ if(GC_sigbus_count >= 8) { ABORT("Got more than 8 SIGBUSs in a row!"); } else { GC_sigbus_count++; WARN("Ignoring SIGBUS.\n", 0); } } #endif /* BROKEN_EXCEPTION_HANDLING */ void GC_dirty_init(void) { kern_return_t r; mach_port_t me; pthread_t thread; pthread_attr_t attr; exception_mask_t mask; if (GC_print_stats == VERBOSE) GC_log_printf("Inititalizing mach/darwin mprotect virtual dirty bit " "implementation\n"); # ifdef BROKEN_EXCEPTION_HANDLING WARN("Enabling workarounds for various darwin " "exception handling bugs.\n", 0); # endif GC_dirty_maintained = TRUE; if (GC_page_size % HBLKSIZE != 0) { GC_err_printf("Page size not multiple of HBLKSIZE\n"); ABORT("Page size not multiple of HBLKSIZE"); } GC_task_self = me = mach_task_self(); r = mach_port_allocate(me, MACH_PORT_RIGHT_RECEIVE, &GC_ports.exception); if(r != KERN_SUCCESS) ABORT("mach_port_allocate failed (exception port)"); r = mach_port_insert_right(me, GC_ports.exception, GC_ports.exception, MACH_MSG_TYPE_MAKE_SEND); if(r != KERN_SUCCESS) ABORT("mach_port_insert_right failed (exception port)"); # if defined(THREADS) r = mach_port_allocate(me, MACH_PORT_RIGHT_RECEIVE, &GC_ports.reply); if(r != KERN_SUCCESS) ABORT("mach_port_allocate failed (reply port)"); # endif /* The exceptions we want to catch */ mask = EXC_MASK_BAD_ACCESS; r = task_get_exception_ports(me, mask, GC_old_exc_ports.masks, &GC_old_exc_ports.count, GC_old_exc_ports.ports, GC_old_exc_ports.behaviors, GC_old_exc_ports.flavors); if(r != KERN_SUCCESS) ABORT("task_get_exception_ports failed"); r = task_set_exception_ports(me, mask, GC_ports.exception, EXCEPTION_DEFAULT, GC_MACH_THREAD_STATE); if(r != KERN_SUCCESS) ABORT("task_set_exception_ports failed"); if(pthread_attr_init(&attr) != 0) ABORT("pthread_attr_init failed"); if(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) != 0) ABORT("pthread_attr_setdetachedstate failed"); # undef pthread_create /* This will call the real pthread function, not our wrapper */ if(pthread_create(&thread, &attr, GC_mprotect_thread, NULL) != 0) ABORT("pthread_create failed"); pthread_attr_destroy(&attr); /* Setup the sigbus handler for ignoring the meaningless SIGBUSs */ # ifdef BROKEN_EXCEPTION_HANDLING { struct sigaction sa, oldsa; sa.sa_handler = (SIG_HNDLR_PTR)GC_darwin_sigbus; sigemptyset(&sa.sa_mask); sa.sa_flags = SA_RESTART|SA_SIGINFO; if(sigaction(SIGBUS, &sa, &oldsa) < 0) ABORT("sigaction"); GC_old_bus_handler = (SIG_HNDLR_PTR)oldsa.sa_handler; if (GC_old_bus_handler != SIG_DFL) { if (GC_print_stats == VERBOSE) GC_err_printf("Replaced other SIGBUS handler\n"); } } # endif /* BROKEN_EXCEPTION_HANDLING */ } /* The source code for Apple's GDB was used as a reference for the exception forwarding code. This code is similar to be GDB code only because there is only one way to do it. */ static kern_return_t GC_forward_exception(mach_port_t thread, mach_port_t task, exception_type_t exception, exception_data_t data, mach_msg_type_number_t data_count) { unsigned int i; kern_return_t r; mach_port_t port; exception_behavior_t behavior; thread_state_flavor_t flavor; thread_state_t thread_state = NULL; mach_msg_type_number_t thread_state_count = THREAD_STATE_MAX; for(i=0; i < GC_old_exc_ports.count; i++) if(GC_old_exc_ports.masks[i] & (1 << exception)) break; if(i==GC_old_exc_ports.count) ABORT("No handler for exception!"); port = GC_old_exc_ports.ports[i]; behavior = GC_old_exc_ports.behaviors[i]; flavor = GC_old_exc_ports.flavors[i]; if(behavior != EXCEPTION_DEFAULT) { r = thread_get_state(thread, flavor, thread_state, &thread_state_count); if(r != KERN_SUCCESS) ABORT("thread_get_state failed in forward_exception"); } switch(behavior) { case EXCEPTION_DEFAULT: r = exception_raise(port, thread, task, exception, data, data_count); break; case EXCEPTION_STATE: r = exception_raise_state(port, thread, task, exception, data, data_count, &flavor, thread_state, thread_state_count, thread_state, &thread_state_count); break; case EXCEPTION_STATE_IDENTITY: r = exception_raise_state_identity(port, thread, task, exception, data, data_count, &flavor, thread_state, thread_state_count, thread_state, &thread_state_count); break; default: r = KERN_FAILURE; /* make gcc happy */ ABORT("forward_exception: unknown behavior"); break; } if(behavior != EXCEPTION_DEFAULT) { r = thread_set_state(thread, flavor, thread_state, thread_state_count); if(r != KERN_SUCCESS) ABORT("thread_set_state failed in forward_exception"); } return r; } #define FWD() GC_forward_exception(thread, task, exception, code, code_count) /* This violates the namespace rules but there isn't anything that can be done about it. The exception handling stuff is hard coded to call this */ kern_return_t catch_exception_raise(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, exception_data_t code, mach_msg_type_number_t code_count) { kern_return_t r; char *addr; struct hblk *h; unsigned int i; # if defined(POWERPC) # if CPP_WORDSZ == 32 thread_state_flavor_t flavor = PPC_EXCEPTION_STATE; mach_msg_type_number_t exc_state_count = PPC_EXCEPTION_STATE_COUNT; ppc_exception_state_t exc_state; # else thread_state_flavor_t flavor = PPC_EXCEPTION_STATE64; mach_msg_type_number_t exc_state_count = PPC_EXCEPTION_STATE64_COUNT; ppc_exception_state64_t exc_state; # endif # elif defined(I386) || defined(X86_64) # if CPP_WORDSZ == 32 thread_state_flavor_t flavor = x86_EXCEPTION_STATE32; mach_msg_type_number_t exc_state_count = x86_EXCEPTION_STATE32_COUNT; x86_exception_state32_t exc_state; # else thread_state_flavor_t flavor = x86_EXCEPTION_STATE64; mach_msg_type_number_t exc_state_count = x86_EXCEPTION_STATE64_COUNT; x86_exception_state64_t exc_state; # endif # else # error FIXME for non-ppc/x86 darwin # endif if(exception != EXC_BAD_ACCESS || code[0] != KERN_PROTECTION_FAILURE) { # ifdef DEBUG_EXCEPTION_HANDLING /* We aren't interested, pass it on to the old handler */ GC_printf("Exception: 0x%x Code: 0x%x 0x%x in catch....\n", exception, code_count > 0 ? code[0] : -1, code_count > 1 ? code[1] : -1); # endif return FWD(); } r = thread_get_state(thread, flavor, (natural_t*)&exc_state, &exc_state_count); if(r != KERN_SUCCESS) { /* The thread is supposed to be suspended while the exception handler is called. This shouldn't fail. */ # ifdef BROKEN_EXCEPTION_HANDLING GC_err_printf("thread_get_state failed in catch_exception_raise\n"); return KERN_SUCCESS; # else ABORT("thread_get_state failed in catch_exception_raise"); # endif } /* This is the address that caused the fault */ # if defined(POWERPC) addr = (char*) exc_state. THREAD_FLD(dar); # elif defined (I386) || defined (X86_64) addr = (char*) exc_state. THREAD_FLD(faultvaddr); # else # error FIXME for non POWERPC/I386 # endif if((HDR(addr)) == 0) { /* Ugh... just like the SIGBUS problem above, it seems we get a bogus KERN_PROTECTION_FAILURE every once and a while. We wait till we get a bunch in a row before doing anything about it. If a "real" fault ever occurres it'll just keep faulting over and over and we'll hit the limit pretty quickly. */ # ifdef BROKEN_EXCEPTION_HANDLING static char *last_fault; static int last_fault_count; if(addr != last_fault) { last_fault = addr; last_fault_count = 0; } if(++last_fault_count < 32) { if(last_fault_count == 1) WARN("Ignoring KERN_PROTECTION_FAILURE at %lx\n", (GC_word)addr); return KERN_SUCCESS; } GC_err_printf("Unexpected KERN_PROTECTION_FAILURE at %p\n",addr); /* Can't pass it along to the signal handler because that is ignoring SIGBUS signals. We also shouldn't call ABORT here as signals don't always work too well from the exception handler. */ GC_err_printf("Aborting\n"); exit(EXIT_FAILURE); # else /* BROKEN_EXCEPTION_HANDLING */ /* Pass it along to the next exception handler (which should call SIGBUS/SIGSEGV) */ return FWD(); # endif /* !BROKEN_EXCEPTION_HANDLING */ } # ifdef BROKEN_EXCEPTION_HANDLING /* Reset the number of consecutive SIGBUSs */ GC_sigbus_count = 0; # endif if(GC_mprotect_state == GC_MP_NORMAL) { /* common case */ h = (struct hblk*)((word)addr & ~(GC_page_size-1)); UNPROTECT(h, GC_page_size); for (i = 0; i < divHBLKSZ(GC_page_size); i++) { register int index = PHT_HASH(h+i); async_set_pht_entry_from_index(GC_dirty_pages, index); } } else if(GC_mprotect_state == GC_MP_DISCARDING) { /* Lie to the thread for now. No sense UNPROTECT()ing the memory when we're just going to PROTECT() it again later. The thread will just fault again once it resumes */ } else { /* Shouldn't happen, i don't think */ GC_printf("KERN_PROTECTION_FAILURE while world is stopped\n"); return FWD(); } return KERN_SUCCESS; } #undef FWD /* These should never be called, but just in case... */ kern_return_t catch_exception_raise_state(mach_port_name_t exception_port, int exception, exception_data_t code, mach_msg_type_number_t codeCnt, int flavor, thread_state_t old_state, int old_stateCnt, thread_state_t new_state, int new_stateCnt) { ABORT("catch_exception_raise_state"); return(KERN_INVALID_ARGUMENT); } kern_return_t catch_exception_raise_state_identity(mach_port_name_t exception_port, mach_port_t thread, mach_port_t task, int exception, exception_data_t code, mach_msg_type_number_t codeCnt, int flavor, thread_state_t old_state, int old_stateCnt, thread_state_t new_state, int new_stateCnt) { ABORT("catch_exception_raise_state_identity"); return(KERN_INVALID_ARGUMENT); } #endif /* DARWIN && MPROTECT_VDB */ # ifndef HAVE_INCREMENTAL_PROTECTION_NEEDS int GC_incremental_protection_needs() { return GC_PROTECTS_NONE; } # endif /* !HAVE_INCREMENTAL_PROTECTION_NEEDS */ /* * Call stack save code for debugging. * Should probably be in mach_dep.c, but that requires reorganization. */ /* I suspect the following works for most X86 *nix variants, so */ /* long as the frame pointer is explicitly stored. In the case of gcc, */ /* compiler flags (e.g. -fomit-frame-pointer) determine whether it is. */ #if defined(I386) && defined(LINUX) && defined(SAVE_CALL_CHAIN) # include struct frame { struct frame *fr_savfp; long fr_savpc; long fr_arg[NARGS]; /* All the arguments go here. */ }; #endif #if defined(SPARC) # if defined(LINUX) # include struct frame { long fr_local[8]; long fr_arg[6]; struct frame *fr_savfp; long fr_savpc; # ifndef __arch64__ char *fr_stret; # endif long fr_argd[6]; long fr_argx[0]; }; # elif defined (DRSNX) # include # elif defined(OPENBSD) # include # elif defined(FREEBSD) || defined(NETBSD) # include # else # include # endif # if NARGS > 6 # error We only know how to to get the first 6 arguments # endif #endif /* SPARC */ #ifdef NEED_CALLINFO /* Fill in the pc and argument information for up to NFRAMES of my */ /* callers. Ignore my frame and my callers frame. */ #ifdef LINUX # include #endif #endif /* NEED_CALLINFO */ #if defined(GC_HAVE_BUILTIN_BACKTRACE) # ifdef _MSC_VER # include "private/msvc_dbg.h" # else # include # endif #endif #ifdef SAVE_CALL_CHAIN #if NARGS == 0 && NFRAMES % 2 == 0 /* No padding */ \ && defined(GC_HAVE_BUILTIN_BACKTRACE) #ifdef REDIRECT_MALLOC /* Deal with possible malloc calls in backtrace by omitting */ /* the infinitely recursing backtrace. */ # ifdef THREADS __thread /* If your compiler doesn't understand this */ /* you could use something like pthread_getspecific. */ # endif GC_in_save_callers = FALSE; #endif void GC_save_callers (struct callinfo info[NFRAMES]) { void * tmp_info[NFRAMES + 1]; int npcs, i; # define IGNORE_FRAMES 1 /* We retrieve NFRAMES+1 pc values, but discard the first, since it */ /* points to our own frame. */ # ifdef REDIRECT_MALLOC if (GC_in_save_callers) { info[0].ci_pc = (word)(&GC_save_callers); for (i = 1; i < NFRAMES; ++i) info[i].ci_pc = 0; return; } GC_in_save_callers = TRUE; # endif GC_ASSERT(sizeof(struct callinfo) == sizeof(void *)); npcs = backtrace((void **)tmp_info, NFRAMES + IGNORE_FRAMES); BCOPY(tmp_info+IGNORE_FRAMES, info, (npcs - IGNORE_FRAMES) * sizeof(void *)); for (i = npcs - IGNORE_FRAMES; i < NFRAMES; ++i) info[i].ci_pc = 0; # ifdef REDIRECT_MALLOC GC_in_save_callers = FALSE; # endif } #else /* No builtin backtrace; do it ourselves */ #if (defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD)) && defined(SPARC) # define FR_SAVFP fr_fp # define FR_SAVPC fr_pc #else # define FR_SAVFP fr_savfp # define FR_SAVPC fr_savpc #endif #if defined(SPARC) && (defined(__arch64__) || defined(__sparcv9)) # define BIAS 2047 #else # define BIAS 0 #endif void GC_save_callers (struct callinfo info[NFRAMES]) { struct frame *frame; struct frame *fp; int nframes = 0; # ifdef I386 /* We assume this is turned on only with gcc as the compiler. */ asm("movl %%ebp,%0" : "=r"(frame)); fp = frame; # else frame = (struct frame *) GC_save_regs_in_stack (); fp = (struct frame *)((long) frame -> FR_SAVFP + BIAS); #endif for (; (!(fp HOTTER_THAN frame) && !(GC_stackbottom HOTTER_THAN (ptr_t)fp) && (nframes < NFRAMES)); fp = (struct frame *)((long) fp -> FR_SAVFP + BIAS), nframes++) { register int i; info[nframes].ci_pc = fp->FR_SAVPC; # if NARGS > 0 for (i = 0; i < NARGS; i++) { info[nframes].ci_arg[i] = ~(fp->fr_arg[i]); } # endif /* NARGS > 0 */ } if (nframes < NFRAMES) info[nframes].ci_pc = 0; } #endif /* No builtin backtrace */ #endif /* SAVE_CALL_CHAIN */ #ifdef NEED_CALLINFO /* Print info to stderr. We do NOT hold the allocation lock */ void GC_print_callers (struct callinfo info[NFRAMES]) { register int i; static int reentry_count = 0; GC_bool stop = FALSE; /* FIXME: This should probably use a different lock, so that we */ /* become callable with or without the allocation lock. */ LOCK(); ++reentry_count; UNLOCK(); # if NFRAMES == 1 GC_err_printf("\tCaller at allocation:\n"); # else GC_err_printf("\tCall chain at allocation:\n"); # endif for (i = 0; i < NFRAMES && !stop ; i++) { if (info[i].ci_pc == 0) break; # if NARGS > 0 { int j; GC_err_printf("\t\targs: "); for (j = 0; j < NARGS; j++) { if (j != 0) GC_err_printf(", "); GC_err_printf("%d (0x%X)", ~(info[i].ci_arg[j]), ~(info[i].ci_arg[j])); } GC_err_printf("\n"); } # endif if (reentry_count > 1) { /* We were called during an allocation during */ /* a previous GC_print_callers call; punt. */ GC_err_printf("\t\t##PC##= 0x%lx\n", info[i].ci_pc); continue; } { # ifdef LINUX FILE *pipe; # endif # if defined(GC_HAVE_BUILTIN_BACKTRACE) \ && !defined(GC_BACKTRACE_SYMBOLS_BROKEN) char **sym_name = backtrace_symbols((void **)(&(info[i].ci_pc)), 1); char *name = sym_name[0]; # else char buf[40]; char *name = buf; sprintf(buf, "##PC##= 0x%lx", info[i].ci_pc); # endif # if defined(LINUX) && !defined(SMALL_CONFIG) /* Try for a line number. */ { # define EXE_SZ 100 static char exe_name[EXE_SZ]; # define CMD_SZ 200 char cmd_buf[CMD_SZ]; # define RESULT_SZ 200 static char result_buf[RESULT_SZ]; size_t result_len; char *old_preload; # define PRELOAD_SZ 200 char preload_buf[PRELOAD_SZ]; static GC_bool found_exe_name = FALSE; static GC_bool will_fail = FALSE; int ret_code; /* Try to get it via a hairy and expensive scheme. */ /* First we get the name of the executable: */ if (will_fail) goto out; if (!found_exe_name) { ret_code = readlink("/proc/self/exe", exe_name, EXE_SZ); if (ret_code < 0 || ret_code >= EXE_SZ || exe_name[0] != '/') { will_fail = TRUE; /* Dont try again. */ goto out; } exe_name[ret_code] = '\0'; found_exe_name = TRUE; } /* Then we use popen to start addr2line -e */ /* There are faster ways to do this, but hopefully this */ /* isn't time critical. */ sprintf(cmd_buf, "/usr/bin/addr2line -f -e %s 0x%lx", exe_name, (unsigned long)info[i].ci_pc); old_preload = getenv ("LD_PRELOAD"); if (0 != old_preload) { if (strlen (old_preload) >= PRELOAD_SZ) { will_fail = TRUE; goto out; } strcpy (preload_buf, old_preload); unsetenv ("LD_PRELOAD"); } pipe = popen(cmd_buf, "r"); if (0 != old_preload && 0 != setenv ("LD_PRELOAD", preload_buf, 0)) { WARN("Failed to reset LD_PRELOAD\n", 0); } if (pipe == NULL || (result_len = fread(result_buf, 1, RESULT_SZ - 1, pipe)) == 0) { if (pipe != NULL) pclose(pipe); will_fail = TRUE; goto out; } if (result_buf[result_len - 1] == '\n') --result_len; result_buf[result_len] = 0; if (result_buf[0] == '?' || (result_buf[result_len-2] == ':' && result_buf[result_len-1] == '0')) { pclose(pipe); goto out; } /* Get rid of embedded newline, if any. Test for "main" */ { char * nl = strchr(result_buf, '\n'); if (nl != NULL && nl < result_buf + result_len) { *nl = ':'; } if (strncmp(result_buf, "main", nl - result_buf) == 0) { stop = TRUE; } } if (result_len < RESULT_SZ - 25) { /* Add in hex address */ sprintf(result_buf + result_len, " [0x%lx]", (unsigned long)info[i].ci_pc); } name = result_buf; pclose(pipe); out:; } # endif /* LINUX */ GC_err_printf("\t\t%s\n", name); # if defined(GC_HAVE_BUILTIN_BACKTRACE) \ && !defined(GC_BACKTRACE_SYMBOLS_BROKEN) free(sym_name); /* May call GC_free; that's OK */ # endif } } LOCK(); --reentry_count; UNLOCK(); } #endif /* NEED_CALLINFO */ #if defined(LINUX) && defined(__ELF__) && !defined(SMALL_CONFIG) /* Dump /proc/self/maps to GC_stderr, to enable looking up names for addresses in FIND_LEAK output. */ static word dump_maps(char *maps) { GC_err_write(maps, strlen(maps)); return 1; } void GC_print_address_map(void) { GC_err_printf("---------- Begin address map ----------\n"); dump_maps(GC_get_maps()); GC_err_printf("---------- End address map ----------\n"); } #endif synopsis-0.12/src/Synopsis/gc/gc_cpp.cpp0000664000076400007640000000011311104702321017607 0ustar stefanstefan// Visual C++ seems to prefer a .cpp extension to .cc #include "gc_cpp.cc" synopsis-0.12/src/Synopsis/gc/if_mach.c0000664000076400007640000000134711104702320017413 0ustar stefanstefan/* Conditionally execute a command based on machine and OS from gcconfig.h */ # include "private/gcconfig.h" # include # include # include int main(int argc, char **argv, char **envp) { if (argc < 4) goto Usage; if (strcmp(MACH_TYPE, argv[1]) != 0) return(0); if (strcmp(OS_TYPE, "") != 0 && strcmp(argv[2], "") != 0 && strcmp(OS_TYPE, argv[2]) != 0) return(0); fprintf(stderr, "^^^^Starting command^^^^\n"); fflush(stdout); execvp(argv[3], argv+3); perror("Couldn't execute"); Usage: fprintf(stderr, "Usage: %s mach_type os_type command\n", argv[0]); fprintf(stderr, "Currently mach_type = %s, os_type = %s\n", MACH_TYPE, OS_TYPE); return(1); } synopsis-0.12/src/Synopsis/gc/MacOS.c0000664000076400007640000000755611104702321017000 0ustar stefanstefan/* MacOS.c Some routines for the Macintosh OS port of the Hans-J. Boehm, Alan J. Demers garbage collector. 11/22/94 pcb StripAddress the temporary memory handle for 24-bit mode. 11/30/94 pcb Tracking all memory usage so we can deallocate it all at once. 02/10/96 pcb Added routine to perform a final collection when unloading shared library. by Patrick C. Beard. */ /* Boehm, February 15, 1996 2:55 pm PST */ #include #include #include #include #include #include #include "gc.h" #include "gc_priv.h" // use 'CODE' resource 0 to get exact location of the beginning of global space. typedef struct { unsigned long aboveA5; unsigned long belowA5; unsigned long JTSize; unsigned long JTOffset; } *CodeZeroPtr, **CodeZeroHandle; void* GC_MacGetDataStart() { CodeZeroHandle code0 = (CodeZeroHandle)GetResource('CODE', 0); if (code0) { long belowA5Size = (**code0).belowA5; ReleaseResource((Handle)code0); return (LMGetCurrentA5() - belowA5Size); } fprintf(stderr, "Couldn't load the jump table."); exit(-1); return 0; } /* track the use of temporary memory so it can be freed all at once. */ typedef struct TemporaryMemoryBlock TemporaryMemoryBlock, **TemporaryMemoryHandle; struct TemporaryMemoryBlock { TemporaryMemoryHandle nextBlock; char data[]; }; static TemporaryMemoryHandle theTemporaryMemory = NULL; static Boolean firstTime = true; void GC_MacFreeTemporaryMemory(void); Ptr GC_MacTemporaryNewPtr(size_t size, Boolean clearMemory) { static Boolean firstTime = true; OSErr result; TemporaryMemoryHandle tempMemBlock; Ptr tempPtr = nil; tempMemBlock = (TemporaryMemoryHandle)TempNewHandle(size + sizeof(TemporaryMemoryBlock), &result); if (tempMemBlock && result == noErr) { HLockHi((Handle)tempMemBlock); tempPtr = (**tempMemBlock).data; if (clearMemory) memset(tempPtr, 0, size); tempPtr = StripAddress(tempPtr); // keep track of the allocated blocks. (**tempMemBlock).nextBlock = theTemporaryMemory; theTemporaryMemory = tempMemBlock; } # if !defined(SHARED_LIBRARY_BUILD) // install an exit routine to clean up the memory used at the end. if (firstTime) { atexit(&GC_MacFreeTemporaryMemory); firstTime = false; } # endif return tempPtr; } extern word GC_fo_entries; static void perform_final_collection() { unsigned i; word last_fo_entries = 0; /* adjust the stack bottom, because CFM calls us from another stack location. */ GC_stackbottom = (ptr_t)&i; /* try to collect and finalize everything in sight */ for (i = 0; i < 2 || GC_fo_entries < last_fo_entries; i++) { last_fo_entries = GC_fo_entries; GC_gcollect(); } } void GC_MacFreeTemporaryMemory() { # if defined(SHARED_LIBRARY_BUILD) /* if possible, collect all memory, and invoke all finalizers. */ perform_final_collection(); # endif if (theTemporaryMemory != NULL) { long totalMemoryUsed = 0; TemporaryMemoryHandle tempMemBlock = theTemporaryMemory; while (tempMemBlock != NULL) { TemporaryMemoryHandle nextBlock = (**tempMemBlock).nextBlock; totalMemoryUsed += GetHandleSize((Handle)tempMemBlock); DisposeHandle((Handle)tempMemBlock); tempMemBlock = nextBlock; } theTemporaryMemory = NULL; # if !defined(SHARED_LIBRARY_BUILD) if (GC_print_stats) { fprintf(stdout, "[total memory used: %ld bytes.]\n", totalMemoryUsed); fprintf(stdout, "[total collections: %ld.]\n", GC_gc_no); } # endif } } #if __option(far_data) void* GC_MacGetDataEnd() { CodeZeroHandle code0 = (CodeZeroHandle)GetResource('CODE', 0); if (code0) { long aboveA5Size = (**code0).aboveA5; ReleaseResource((Handle)code0); return (LMGetCurrentA5() + aboveA5Size); } fprintf(stderr, "Couldn't load the jump table."); exit(-1); return 0; } #endif /* __option(far_data) */ synopsis-0.12/src/Synopsis/gc/mkinstalldirs0000775000076400007640000000351211104702316020470 0ustar stefanstefan#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain # $Id: mkinstalldirs,v 1.1.1.1 2005/10/10 22:33:34 hboehm Exp $ errstatus=0 dirmode="" usage="\ Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." # process command line arguments while test $# -gt 0 ; do case "${1}" in -h | --help | --h* ) # -h for help echo "${usage}" 1>&2; exit 0 ;; -m ) # -m PERM arg shift test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } dirmode="${1}" shift ;; -- ) shift; break ;; # stop option processing -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option * ) break ;; # first non-opt arg esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac case $dirmode in '') if mkdir -p -- . 2>/dev/null; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" fi ;; *) if mkdir -m "$dirmode" -p -- . 2>/dev/null; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" fi ;; esac for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" lasterr="" chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then errstatus=$lasterr fi fi fi fi pathcomp="$pathcomp/" done done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 3 # End: # mkinstalldirs ends here synopsis-0.12/src/Synopsis/gc/depcomp0000775000076400007640000003033511104702316017242 0ustar stefanstefan#! /bin/sh # depcomp - compile a program generating dependencies as side-effects # Copyright 1999, 2000 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # `libtool' can also be set to `yes' or `no'. if test -z "$depfile"; then base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` dir=`echo "$object" | sed 's,/.*$,/,'` if test "$dir" = "$object"; then dir= fi # FIXME: should be _deps on DOS. depfile="$dir.deps/$base" fi tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. This file always lives in the current directory. # Also, the AIX compiler puts `$object:' at the start of each line; # $object doesn't have directory information. stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" outname="$stripped.o" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; 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. base=`echo "$object" | sed -e 's/\.o$//' -e 's/\.lo$//'` tmpdepfile1="$base.o.d" tmpdepfile2="$base.d" if test "$libtool" = yes; then "$@" -Wc,-MD else "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" else tmpdepfile="$tmpdepfile2" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a space and a tab in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. test -z "$dashmflag" && dashmflag=-M ( IFS=" " case " $* " in *" --mode=compile "*) # this is libtool, let us make it quiet for arg do # cycle over the arguments case "$arg" in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi 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) # 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;; -*) ;; *) set fnord "$@" "$arg"; shift;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. ( IFS=" " case " $* " in *" --mode=compile "*) for arg do # cycle over the arguments case $arg in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac "$@" -E | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. ( IFS=" " case " $* " in *" --mode=compile "*) for arg do # cycle over the arguments case $arg in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac 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" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi 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 synopsis-0.12/src/Synopsis/gc/blacklst.c0000664000076400007640000002144611104702316017633 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* Boehm, August 9, 1995 6:09 pm PDT */ # include "private/gc_priv.h" /* * We maintain several hash tables of hblks that have had false hits. * Each contains one bit per hash bucket; If any page in the bucket * has had a false hit, we assume that all of them have. * See the definition of page_hash_table in gc_private.h. * False hits from the stack(s) are much more dangerous than false hits * from elsewhere, since the former can pin a large object that spans the * block, eventhough it does not start on the dangerous block. */ /* * Externally callable routines are: * GC_add_to_black_list_normal * GC_add_to_black_list_stack * GC_promote_black_lists * GC_is_black_listed * * All require that the allocator lock is held. */ /* Pointers to individual tables. We replace one table by another by */ /* switching these pointers. */ word * GC_old_normal_bl; /* Nonstack false references seen at last full */ /* collection. */ word * GC_incomplete_normal_bl; /* Nonstack false references seen since last */ /* full collection. */ word * GC_old_stack_bl; word * GC_incomplete_stack_bl; word GC_total_stack_black_listed; word GC_black_list_spacing = MINHINCR*HBLKSIZE; /* Initial rough guess */ void GC_clear_bl(word *); void GC_default_print_heap_obj_proc(ptr_t p) { ptr_t base = GC_base(p); GC_err_printf("start: %p, appr. length: %ld", base, (unsigned long)GC_size(base)); } void (*GC_print_heap_obj) (ptr_t p) = GC_default_print_heap_obj_proc; void GC_print_source_ptr(ptr_t p) { ptr_t base = GC_base(p); if (0 == base) { if (0 == p) { GC_err_printf("in register"); } else { GC_err_printf("in root set"); } } else { GC_err_printf("in object at "); (*GC_print_heap_obj)(base); } } void GC_bl_init(void) { if (!GC_all_interior_pointers) { GC_old_normal_bl = (word *) GC_scratch_alloc((word)(sizeof (page_hash_table))); GC_incomplete_normal_bl = (word *)GC_scratch_alloc ((word)(sizeof(page_hash_table))); if (GC_old_normal_bl == 0 || GC_incomplete_normal_bl == 0) { GC_err_printf("Insufficient memory for black list\n"); EXIT(); } GC_clear_bl(GC_old_normal_bl); GC_clear_bl(GC_incomplete_normal_bl); } GC_old_stack_bl = (word *)GC_scratch_alloc((word)(sizeof(page_hash_table))); GC_incomplete_stack_bl = (word *)GC_scratch_alloc ((word)(sizeof(page_hash_table))); if (GC_old_stack_bl == 0 || GC_incomplete_stack_bl == 0) { GC_err_printf("Insufficient memory for black list\n"); EXIT(); } GC_clear_bl(GC_old_stack_bl); GC_clear_bl(GC_incomplete_stack_bl); } void GC_clear_bl(word *doomed) { BZERO(doomed, sizeof(page_hash_table)); } void GC_copy_bl(word *old, word *new) { BCOPY(old, new, sizeof(page_hash_table)); } static word total_stack_black_listed(void); /* Signal the completion of a collection. Turn the incomplete black */ /* lists into new black lists, etc. */ void GC_promote_black_lists(void) { word * very_old_normal_bl = GC_old_normal_bl; word * very_old_stack_bl = GC_old_stack_bl; GC_old_normal_bl = GC_incomplete_normal_bl; GC_old_stack_bl = GC_incomplete_stack_bl; if (!GC_all_interior_pointers) { GC_clear_bl(very_old_normal_bl); } GC_clear_bl(very_old_stack_bl); GC_incomplete_normal_bl = very_old_normal_bl; GC_incomplete_stack_bl = very_old_stack_bl; GC_total_stack_black_listed = total_stack_black_listed(); if (GC_print_stats == VERBOSE) GC_log_printf("%ld bytes in heap blacklisted for interior pointers\n", (unsigned long)GC_total_stack_black_listed); if (GC_total_stack_black_listed != 0) { GC_black_list_spacing = HBLKSIZE*(GC_heapsize/GC_total_stack_black_listed); } if (GC_black_list_spacing < 3 * HBLKSIZE) { GC_black_list_spacing = 3 * HBLKSIZE; } if (GC_black_list_spacing > MAXHINCR * HBLKSIZE) { GC_black_list_spacing = MAXHINCR * HBLKSIZE; /* Makes it easier to allocate really huge blocks, which otherwise */ /* may have problems with nonuniform blacklist distributions. */ /* This way we should always succeed immediately after growing the */ /* heap. */ } } void GC_unpromote_black_lists(void) { if (!GC_all_interior_pointers) { GC_copy_bl(GC_old_normal_bl, GC_incomplete_normal_bl); } GC_copy_bl(GC_old_stack_bl, GC_incomplete_stack_bl); } /* P is not a valid pointer reference, but it falls inside */ /* the plausible heap bounds. */ /* Add it to the normal incomplete black list if appropriate. */ #ifdef PRINT_BLACK_LIST void GC_add_to_black_list_normal(word p, ptr_t source) #else void GC_add_to_black_list_normal(word p) #endif { if (!(GC_modws_valid_offsets[p & (sizeof(word)-1)])) return; { word index = PHT_HASH((word)p); if (HDR(p) == 0 || get_pht_entry_from_index(GC_old_normal_bl, index)) { # ifdef PRINT_BLACK_LIST if (!get_pht_entry_from_index(GC_incomplete_normal_bl, index)) { GC_err_printf( "Black listing (normal) %p referenced from %p ", (ptr_t) p, source); GC_print_source_ptr(source); GC_err_puts("\n"); } # endif set_pht_entry_from_index(GC_incomplete_normal_bl, index); } /* else this is probably just an interior pointer to an allocated */ /* object, and isn't worth black listing. */ } } /* And the same for false pointers from the stack. */ #ifdef PRINT_BLACK_LIST void GC_add_to_black_list_stack(word p, ptr_t source) ptr_t source; #else void GC_add_to_black_list_stack(word p) #endif { word index = PHT_HASH((word)p); if (HDR(p) == 0 || get_pht_entry_from_index(GC_old_stack_bl, index)) { # ifdef PRINT_BLACK_LIST if (!get_pht_entry_from_index(GC_incomplete_stack_bl, index)) { GC_err_printf( "Black listing (stack) %p referenced from %p ", (ptr_t)p, source); GC_print_source_ptr(source); GC_err_puts("\n"); } # endif set_pht_entry_from_index(GC_incomplete_stack_bl, index); } } /* * Is the block starting at h of size len bytes black listed? If so, * return the address of the next plausible r such that (r, len) might not * be black listed. (R may not actually be in the heap. We guarantee only * that every smaller value of r after h is also black listed.) * If (h,len) is not black listed, return 0. * Knows about the structure of the black list hash tables. */ struct hblk * GC_is_black_listed(struct hblk *h, word len) { word index = PHT_HASH((word)h); word i; word nblocks = divHBLKSZ(len); if (!GC_all_interior_pointers) { if (get_pht_entry_from_index(GC_old_normal_bl, index) || get_pht_entry_from_index(GC_incomplete_normal_bl, index)) { return(h+1); } } for (i = 0; ; ) { if (GC_old_stack_bl[divWORDSZ(index)] == 0 && GC_incomplete_stack_bl[divWORDSZ(index)] == 0) { /* An easy case */ i += WORDSZ - modWORDSZ(index); } else { if (get_pht_entry_from_index(GC_old_stack_bl, index) || get_pht_entry_from_index(GC_incomplete_stack_bl, index)) { return(h+i+1); } i++; } if (i >= nblocks) break; index = PHT_HASH((word)(h+i)); } return(0); } /* Return the number of blacklisted blocks in a given range. */ /* Used only for statistical purposes. */ /* Looks only at the GC_incomplete_stack_bl. */ word GC_number_stack_black_listed(struct hblk *start, struct hblk *endp1) { register struct hblk * h; word result = 0; for (h = start; h < endp1; h++) { word index = PHT_HASH((word)h); if (get_pht_entry_from_index(GC_old_stack_bl, index)) result++; } return(result); } /* Return the total number of (stack) black-listed bytes. */ static word total_stack_black_listed(void) { register unsigned i; word total = 0; for (i = 0; i < GC_n_heap_sects; i++) { struct hblk * start = (struct hblk *) GC_heap_sects[i].hs_start; size_t len = (word) GC_heap_sects[i].hs_bytes; struct hblk * endp1 = start + len/HBLKSIZE; total += GC_number_stack_black_listed(start, endp1); } return(total * HBLKSIZE); } synopsis-0.12/src/Synopsis/gc/malloc.c0000664000076400007640000003473111104702315017303 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ #include #include #include #include "private/gc_priv.h" extern void * GC_clear_stack(void *); /* in misc.c, behaves like identity */ void GC_extend_size_map(size_t); /* in misc.c. */ /* Allocate reclaim list for kind: */ /* Return TRUE on success */ GC_bool GC_alloc_reclaim_list(struct obj_kind *kind) { struct hblk ** result = (struct hblk **) GC_scratch_alloc((MAXOBJGRANULES+1) * sizeof(struct hblk *)); if (result == 0) return(FALSE); BZERO(result, (MAXOBJGRANULES+1)*sizeof(struct hblk *)); kind -> ok_reclaim_list = result; return(TRUE); } /* Allocate a large block of size lb bytes. */ /* The block is not cleared. */ /* Flags is 0 or IGNORE_OFF_PAGE. */ /* We hold the allocation lock. */ /* EXTRA_BYTES were already added to lb. */ ptr_t GC_alloc_large(size_t lb, int k, unsigned flags) { struct hblk * h; word n_blocks; ptr_t result; /* Round up to a multiple of a granule. */ lb = (lb + GRANULE_BYTES - 1) & ~(GRANULE_BYTES - 1); n_blocks = OBJ_SZ_TO_BLOCKS(lb); if (!GC_is_initialized) GC_init_inner(); /* Do our share of marking work */ if(GC_incremental && !GC_dont_gc) GC_collect_a_little_inner((int)n_blocks); h = GC_allochblk(lb, k, flags); # ifdef USE_MUNMAP if (0 == h) { GC_merge_unmapped(); h = GC_allochblk(lb, k, flags); } # endif while (0 == h && GC_collect_or_expand(n_blocks, (flags != 0))) { h = GC_allochblk(lb, k, flags); } if (h == 0) { result = 0; } else { size_t total_bytes = n_blocks * HBLKSIZE; if (n_blocks > 1) { GC_large_allocd_bytes += total_bytes; if (GC_large_allocd_bytes > GC_max_large_allocd_bytes) GC_max_large_allocd_bytes = GC_large_allocd_bytes; } result = h -> hb_body; } return result; } /* Allocate a large block of size lb bytes. Clear if appropriate. */ /* We hold the allocation lock. */ /* EXTRA_BYTES were already added to lb. */ ptr_t GC_alloc_large_and_clear(size_t lb, int k, unsigned flags) { ptr_t result = GC_alloc_large(lb, k, flags); word n_blocks = OBJ_SZ_TO_BLOCKS(lb); if (0 == result) return 0; if (GC_debugging_started || GC_obj_kinds[k].ok_init) { /* Clear the whole block, in case of GC_realloc call. */ BZERO(result, n_blocks * HBLKSIZE); } return result; } /* allocate lb bytes for an object of kind k. */ /* Should not be used to directly to allocate */ /* objects such as STUBBORN objects that */ /* require special handling on allocation. */ /* First a version that assumes we already */ /* hold lock: */ void * GC_generic_malloc_inner(size_t lb, int k) { void *op; if(SMALL_OBJ(lb)) { struct obj_kind * kind = GC_obj_kinds + k; size_t lg = GC_size_map[lb]; void ** opp = &(kind -> ok_freelist[lg]); if( (op = *opp) == 0 ) { if (GC_size_map[lb] == 0) { if (!GC_is_initialized) GC_init_inner(); if (GC_size_map[lb] == 0) GC_extend_size_map(lb); return(GC_generic_malloc_inner(lb, k)); } if (kind -> ok_reclaim_list == 0) { if (!GC_alloc_reclaim_list(kind)) goto out; } op = GC_allocobj(lg, k); if (op == 0) goto out; } *opp = obj_link(op); obj_link(op) = 0; GC_bytes_allocd += GRANULES_TO_BYTES(lg); } else { op = (ptr_t)GC_alloc_large_and_clear(ADD_SLOP(lb), k, 0); GC_bytes_allocd += lb; } out: return op; } /* Allocate a composite object of size n bytes. The caller guarantees */ /* that pointers past the first page are not relevant. Caller holds */ /* allocation lock. */ void * GC_generic_malloc_inner_ignore_off_page(size_t lb, int k) { word lb_adjusted; void * op; if (lb <= HBLKSIZE) return(GC_generic_malloc_inner(lb, k)); lb_adjusted = ADD_SLOP(lb); op = GC_alloc_large_and_clear(lb_adjusted, k, IGNORE_OFF_PAGE); GC_bytes_allocd += lb_adjusted; return op; } void * GC_generic_malloc(size_t lb, int k) { void * result; DCL_LOCK_STATE; if (GC_have_errors) GC_print_all_errors(); GC_INVOKE_FINALIZERS(); if (SMALL_OBJ(lb)) { LOCK(); result = GC_generic_malloc_inner((word)lb, k); UNLOCK(); } else { size_t lw; size_t lb_rounded; word n_blocks; GC_bool init; lw = ROUNDED_UP_WORDS(lb); lb_rounded = WORDS_TO_BYTES(lw); n_blocks = OBJ_SZ_TO_BLOCKS(lb_rounded); init = GC_obj_kinds[k].ok_init; LOCK(); result = (ptr_t)GC_alloc_large(lb_rounded, k, 0); if (0 != result) { if (GC_debugging_started) { BZERO(result, n_blocks * HBLKSIZE); } else { # ifdef THREADS /* Clear any memory that might be used for GC descriptors */ /* before we release the lock. */ ((word *)result)[0] = 0; ((word *)result)[1] = 0; ((word *)result)[lw-1] = 0; ((word *)result)[lw-2] = 0; # endif } } GC_bytes_allocd += lb_rounded; UNLOCK(); if (init && !GC_debugging_started && 0 != result) { BZERO(result, n_blocks * HBLKSIZE); } } if (0 == result) { return((*GC_oom_fn)(lb)); } else { return(result); } } #define GENERAL_MALLOC(lb,k) \ GC_clear_stack(GC_generic_malloc(lb, k)) /* We make the GC_clear_stack_call a tail call, hoping to get more of */ /* the stack. */ /* Allocate lb bytes of atomic (pointerfree) data */ #ifdef THREAD_LOCAL_ALLOC void * GC_core_malloc_atomic(size_t lb) #else void * GC_malloc_atomic(size_t lb) #endif { void *op; void ** opp; size_t lg; DCL_LOCK_STATE; if(SMALL_OBJ(lb)) { lg = GC_size_map[lb]; opp = &(GC_aobjfreelist[lg]); LOCK(); if( EXPECT((op = *opp) == 0, 0) ) { UNLOCK(); return(GENERAL_MALLOC((word)lb, PTRFREE)); } *opp = obj_link(op); GC_bytes_allocd += GRANULES_TO_BYTES(lg); UNLOCK(); return((void *) op); } else { return(GENERAL_MALLOC((word)lb, PTRFREE)); } } /* provide a version of strdup() that uses the collector to allocate the copy of the string */ # ifdef __STDC__ char *GC_strdup(const char *s) # else char *GC_strdup(s) char *s; #endif { char *copy; if (s == NULL) return NULL; if ((copy = GC_malloc_atomic(strlen(s) + 1)) == NULL) { errno = ENOMEM; return NULL; } strcpy(copy, s); return copy; } /* Allocate lb bytes of composite (pointerful) data */ #ifdef THREAD_LOCAL_ALLOC void * GC_core_malloc(size_t lb) #else void * GC_malloc(size_t lb) #endif { void *op; void **opp; size_t lg; DCL_LOCK_STATE; if(SMALL_OBJ(lb)) { lg = GC_size_map[lb]; opp = (void **)&(GC_objfreelist[lg]); LOCK(); if( EXPECT((op = *opp) == 0, 0) ) { UNLOCK(); return(GENERAL_MALLOC((word)lb, NORMAL)); } /* See above comment on signals. */ GC_ASSERT(0 == obj_link(op) || (word)obj_link(op) <= (word)GC_greatest_plausible_heap_addr && (word)obj_link(op) >= (word)GC_least_plausible_heap_addr); *opp = obj_link(op); obj_link(op) = 0; GC_bytes_allocd += GRANULES_TO_BYTES(lg); UNLOCK(); return op; } else { return(GENERAL_MALLOC(lb, NORMAL)); } } # ifdef REDIRECT_MALLOC /* Avoid unnecessary nested procedure calls here, by #defining some */ /* malloc replacements. Otherwise we end up saving a */ /* meaningless return address in the object. It also speeds things up, */ /* but it is admittedly quite ugly. */ # ifdef GC_ADD_CALLER # define RA GC_RETURN_ADDR, # else # define RA # endif # define GC_debug_malloc_replacement(lb) \ GC_debug_malloc(lb, RA "unknown", 0) void * malloc(size_t lb) { /* It might help to manually inline the GC_malloc call here. */ /* But any decent compiler should reduce the extra procedure call */ /* to at most a jump instruction in this case. */ # if defined(I386) && defined(GC_SOLARIS_THREADS) /* * Thread initialisation can call malloc before * we're ready for it. * It's not clear that this is enough to help matters. * The thread implementation may well call malloc at other * inopportune times. */ if (!GC_is_initialized) return sbrk(lb); # endif /* I386 && GC_SOLARIS_THREADS */ return((void *)REDIRECT_MALLOC(lb)); } #ifdef GC_LINUX_THREADS static ptr_t GC_libpthread_start = 0; static ptr_t GC_libpthread_end = 0; static ptr_t GC_libld_start = 0; static ptr_t GC_libld_end = 0; extern GC_bool GC_text_mapping(char *nm, ptr_t *startp, ptr_t *endp); /* From os_dep.c */ void GC_init_lib_bounds(void) { if (GC_libpthread_start != 0) return; if (!GC_text_mapping("/lib/tls/libpthread-", &GC_libpthread_start, &GC_libpthread_end) && !GC_text_mapping("/lib/libpthread-", &GC_libpthread_start, &GC_libpthread_end)) { WARN("Failed to find libpthread.so text mapping: Expect crash\n", 0); /* This might still work with some versions of libpthread, */ /* so we don't abort. Perhaps we should. */ /* Generate message only once: */ GC_libpthread_start = (ptr_t)1; } if (!GC_text_mapping("/lib/ld-", &GC_libld_start, &GC_libld_end)) { WARN("Failed to find ld.so text mapping: Expect crash\n", 0); } } #endif void * calloc(size_t n, size_t lb) { # if defined(GC_LINUX_THREADS) && !defined(USE_PROC_FOR_LIBRARIES) /* libpthread allocated some memory that is only pointed to by */ /* mmapped thread stacks. Make sure it's not collectable. */ { static GC_bool lib_bounds_set = FALSE; ptr_t caller = (ptr_t)__builtin_return_address(0); /* This test does not need to ensure memory visibility, since */ /* the bounds will be set when/if we create another thread. */ if (!lib_bounds_set) { GC_init_lib_bounds(); lib_bounds_set = TRUE; } if (caller >= GC_libpthread_start && caller < GC_libpthread_end || (caller >= GC_libld_start && caller < GC_libld_end)) return GC_malloc_uncollectable(n*lb); /* The two ranges are actually usually adjacent, so there may */ /* be a way to speed this up. */ } # endif return((void *)REDIRECT_MALLOC(n*lb)); } #ifndef strdup # include char *strdup(const char *s) { size_t len = strlen(s) + 1; char * result = ((char *)REDIRECT_MALLOC(len+1)); if (result == 0) { errno = ENOMEM; return 0; } BCOPY(s, result, len+1); return result; } #endif /* !defined(strdup) */ /* If strdup is macro defined, we assume that it actually calls malloc, */ /* and thus the right thing will happen even without overriding it. */ /* This seems to be true on most Linux systems. */ #undef GC_debug_malloc_replacement # endif /* REDIRECT_MALLOC */ /* Explicitly deallocate an object p. */ void GC_free(void * p) { struct hblk *h; hdr *hhdr; size_t sz; /* In bytes */ size_t ngranules; /* sz in granules */ void **flh; int knd; struct obj_kind * ok; DCL_LOCK_STATE; if (p == 0) return; /* Required by ANSI. It's not my fault ... */ h = HBLKPTR(p); hhdr = HDR(h); sz = hhdr -> hb_sz; ngranules = BYTES_TO_GRANULES(sz); GC_ASSERT(GC_base(p) == p); # if defined(REDIRECT_MALLOC) && \ (defined(GC_SOLARIS_THREADS) || defined(GC_LINUX_THREADS) \ || defined(MSWIN32)) /* For Solaris, we have to redirect malloc calls during */ /* initialization. For the others, this seems to happen */ /* implicitly. */ /* Don't try to deallocate that memory. */ if (0 == hhdr) return; # endif knd = hhdr -> hb_obj_kind; ok = &GC_obj_kinds[knd]; if (EXPECT((ngranules <= MAXOBJGRANULES), 1)) { LOCK(); GC_bytes_freed += sz; if (IS_UNCOLLECTABLE(knd)) GC_non_gc_bytes -= sz; /* Its unnecessary to clear the mark bit. If the */ /* object is reallocated, it doesn't matter. O.w. the */ /* collector will do it, since it's on a free list. */ if (ok -> ok_init) { BZERO((word *)p + 1, sz-sizeof(word)); } flh = &(ok -> ok_freelist[ngranules]); obj_link(p) = *flh; *flh = (ptr_t)p; UNLOCK(); } else { LOCK(); GC_bytes_freed += sz; if (IS_UNCOLLECTABLE(knd)) GC_non_gc_bytes -= sz; GC_freehblk(h); UNLOCK(); } } /* Explicitly deallocate an object p when we already hold lock. */ /* Only used for internally allocated objects, so we can take some */ /* shortcuts. */ #ifdef THREADS void GC_free_inner(void * p) { struct hblk *h; hdr *hhdr; size_t sz; /* bytes */ size_t ngranules; /* sz in granules */ void ** flh; int knd; struct obj_kind * ok; DCL_LOCK_STATE; h = HBLKPTR(p); hhdr = HDR(h); knd = hhdr -> hb_obj_kind; sz = hhdr -> hb_sz; ngranules = BYTES_TO_GRANULES(sz); ok = &GC_obj_kinds[knd]; if (ngranules <= MAXOBJGRANULES) { GC_bytes_freed += sz; if (IS_UNCOLLECTABLE(knd)) GC_non_gc_bytes -= sz; if (ok -> ok_init) { BZERO((word *)p + 1, sz-sizeof(word)); } flh = &(ok -> ok_freelist[ngranules]); obj_link(p) = *flh; *flh = (ptr_t)p; } else { GC_bytes_freed += sz; if (IS_UNCOLLECTABLE(knd)) GC_non_gc_bytes -= sz; GC_freehblk(h); } } #endif /* THREADS */ # if defined(REDIRECT_MALLOC) && !defined(REDIRECT_FREE) # define REDIRECT_FREE GC_free # endif # ifdef REDIRECT_FREE void free(void * p) { # if defined(GC_LINUX_THREADS) && !defined(USE_PROC_FOR_LIBRARIES) { /* Don't bother with initialization checks. If nothing */ /* has been initialized, the check fails, and that's safe, */ /* since we haven't allocated uncollectable objects either. */ ptr_t caller = (ptr_t)__builtin_return_address(0); /* This test does not need to ensure memory visibility, since */ /* the bounds will be set when/if we create another thread. */ if (caller >= GC_libpthread_start && caller > GC_libpthread_end) { GC_free(p); return; } } # endif # ifndef IGNORE_FREE REDIRECT_FREE(p); # endif } # endif /* REDIRECT_MALLOC */ synopsis-0.12/src/Synopsis/gc/config.sub0000775000076400007640000007726411104702315017663 0ustar stefanstefan#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2006-06-06' # 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., 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. # 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, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xscalee[bl] | 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) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ | 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 ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; 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 ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; 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 ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; 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 ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -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 spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: synopsis-0.12/src/Synopsis/gc/gcj_mlc.c0000664000076400007640000001646511104702316017437 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */ /* Boehm, July 31, 1995 5:02 pm PDT */ #ifdef GC_GCJ_SUPPORT /* * This is an allocator interface tuned for gcj (the GNU static * java compiler). * * Each allocated object has a pointer in its first word to a vtable, * which for our purposes is simply a structure describing the type of * the object. * This descriptor structure contains a GC marking descriptor at offset * MARK_DESCR_OFFSET. * * It is hoped that this interface may also be useful for other systems, * possibly with some tuning of the constants. But the immediate goal * is to get better gcj performance. * * We assume: * 1) We have an ANSI conforming C compiler. * 2) Counting on explicit initialization of this interface is OK. * 3) FASTLOCK is not a significant win. */ #include "private/gc_pmark.h" #include "gc_gcj.h" #include "private/dbg_mlc.h" GC_bool GC_gcj_malloc_initialized = FALSE; int GC_gcj_kind; /* Object kind for objects with descriptors */ /* in "vtable". */ int GC_gcj_debug_kind; /* The kind of objects that is always marked */ /* with a mark proc call. */ ptr_t * GC_gcjobjfreelist; ptr_t * GC_gcjdebugobjfreelist; /* Caller does not hold allocation lock. */ void GC_init_gcj_malloc(int mp_index, void * /* really GC_mark_proc */mp) { register int i; GC_bool ignore_gcj_info; DCL_LOCK_STATE; GC_init(); /* In case it's not already done. */ LOCK(); if (GC_gcj_malloc_initialized) { UNLOCK(); return; } GC_gcj_malloc_initialized = TRUE; ignore_gcj_info = (0 != GETENV("GC_IGNORE_GCJ_INFO")); if (GC_print_stats && ignore_gcj_info) { GC_log_printf("Gcj-style type information is disabled!\n"); } GC_ASSERT(GC_mark_procs[mp_index] == (GC_mark_proc)0); /* unused */ GC_mark_procs[mp_index] = (GC_mark_proc)mp; if (mp_index >= GC_n_mark_procs) ABORT("GC_init_gcj_malloc: bad index"); /* Set up object kind gcj-style indirect descriptor. */ GC_gcjobjfreelist = (ptr_t *)GC_new_free_list_inner(); if (ignore_gcj_info) { /* Use a simple length-based descriptor, thus forcing a fully */ /* conservative scan. */ GC_gcj_kind = GC_new_kind_inner((void **)GC_gcjobjfreelist, (0 | GC_DS_LENGTH), TRUE, TRUE); } else { GC_gcj_kind = GC_new_kind_inner( (void **)GC_gcjobjfreelist, (((word)(-MARK_DESCR_OFFSET - GC_INDIR_PER_OBJ_BIAS)) | GC_DS_PER_OBJECT), FALSE, TRUE); } /* Set up object kind for objects that require mark proc call. */ if (ignore_gcj_info) { GC_gcj_debug_kind = GC_gcj_kind; GC_gcjdebugobjfreelist = GC_gcjobjfreelist; } else { GC_gcjdebugobjfreelist = (ptr_t *)GC_new_free_list_inner(); GC_gcj_debug_kind = GC_new_kind_inner( (void **)GC_gcjdebugobjfreelist, GC_MAKE_PROC(mp_index, 1 /* allocated with debug info */), FALSE, TRUE); } UNLOCK(); } void * GC_clear_stack(void *); #define GENERAL_MALLOC(lb,k) \ GC_clear_stack(GC_generic_malloc_inner((word)lb, k)) #define GENERAL_MALLOC_IOP(lb,k) \ GC_clear_stack(GC_generic_malloc_inner_ignore_off_page(lb, k)) /* We need a mechanism to release the lock and invoke finalizers. */ /* We don't really have an opportunity to do this on a rarely executed */ /* path on which the lock is not held. Thus we check at a */ /* rarely executed point at which it is safe to release the lock. */ /* We do this even where we could just call GC_INVOKE_FINALIZERS, */ /* since it's probably cheaper and certainly more uniform. */ /* FIXME - Consider doing the same elsewhere? */ static void maybe_finalize() { static int last_finalized_no = 0; if (GC_gc_no == last_finalized_no) return; if (!GC_is_initialized) return; UNLOCK(); GC_INVOKE_FINALIZERS(); last_finalized_no = GC_gc_no; LOCK(); } /* Allocate an object, clear it, and store the pointer to the */ /* type structure (vtable in gcj). */ /* This adds a byte at the end of the object if GC_malloc would.*/ #ifdef THREAD_LOCAL_ALLOC void * GC_core_gcj_malloc(size_t lb, void * ptr_to_struct_containing_descr) #else void * GC_gcj_malloc(size_t lb, void * ptr_to_struct_containing_descr) #endif { ptr_t op; ptr_t * opp; word lg; DCL_LOCK_STATE; if(SMALL_OBJ(lb)) { lg = GC_size_map[lb]; opp = &(GC_gcjobjfreelist[lg]); LOCK(); op = *opp; if(EXPECT(op == 0, 0)) { maybe_finalize(); op = (ptr_t)GENERAL_MALLOC((word)lb, GC_gcj_kind); if (0 == op) { UNLOCK(); return(GC_oom_fn(lb)); } } else { *opp = obj_link(op); GC_bytes_allocd += GRANULES_TO_BYTES(lg); } *(void **)op = ptr_to_struct_containing_descr; GC_ASSERT(((void **)op)[1] == 0); UNLOCK(); } else { LOCK(); maybe_finalize(); op = (ptr_t)GENERAL_MALLOC((word)lb, GC_gcj_kind); if (0 == op) { UNLOCK(); return(GC_oom_fn(lb)); } *(void **)op = ptr_to_struct_containing_descr; UNLOCK(); } return((void *) op); } /* Similar to GC_gcj_malloc, but add debug info. This is allocated */ /* with GC_gcj_debug_kind. */ void * GC_debug_gcj_malloc(size_t lb, void * ptr_to_struct_containing_descr, GC_EXTRA_PARAMS) { void * result; /* We're careful to avoid extra calls, which could */ /* confuse the backtrace. */ LOCK(); maybe_finalize(); result = GC_generic_malloc_inner(lb + DEBUG_BYTES, GC_gcj_debug_kind); if (result == 0) { UNLOCK(); GC_err_printf("GC_debug_gcj_malloc(%ld, %p) returning NIL (", (unsigned long)lb, ptr_to_struct_containing_descr); GC_err_puts(s); GC_err_printf(":%d)\n", i); return(GC_oom_fn(lb)); } *((void **)((ptr_t)result + sizeof(oh))) = ptr_to_struct_containing_descr; UNLOCK(); if (!GC_debugging_started) { GC_start_debugging(); } ADD_CALL_CHAIN(result, ra); return (GC_store_debug_info(result, (word)lb, s, (word)i)); } void * GC_gcj_malloc_ignore_off_page(size_t lb, void * ptr_to_struct_containing_descr) { ptr_t op; ptr_t * opp; word lg; DCL_LOCK_STATE; if(SMALL_OBJ(lb)) { lg = GC_size_map[lb]; opp = &(GC_gcjobjfreelist[lg]); LOCK(); if( (op = *opp) == 0 ) { maybe_finalize(); op = (ptr_t)GENERAL_MALLOC_IOP(lb, GC_gcj_kind); lg = GC_size_map[lb]; /* May have been uninitialized. */ } else { *opp = obj_link(op); GC_bytes_allocd += GRANULES_TO_BYTES(lg); } *(void **)op = ptr_to_struct_containing_descr; UNLOCK(); } else { LOCK(); maybe_finalize(); op = (ptr_t)GENERAL_MALLOC_IOP(lb, GC_gcj_kind); if (0 != op) { *(void **)op = ptr_to_struct_containing_descr; } UNLOCK(); } return((void *) op); } #else char GC_no_gcj_support; #endif /* GC_GCJ_SUPPORT */ synopsis-0.12/src/Synopsis/gc/hpux_test_and_clear.s0000664000076400007640000000074711104702315022067 0ustar stefanstefan .SPACE $PRIVATE$ .SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31 .SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82 .SPACE $TEXT$ .SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44 .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY .IMPORT $global$,DATA .IMPORT $$dyncall,MILLICODE .SPACE $TEXT$ .SUBSPA $CODE$ .align 4 .EXPORT GC_test_and_clear,ENTRY,PRIV_LEV=3,ARGW0=GR,RTNVAL=GR GC_test_and_clear .PROC .CALLINFO FRAME=0,NO_CALLS .ENTRY ldcw,co (%r26),%r28 bv,n 0(%r2) .EXIT .PROCEND synopsis-0.12/src/Synopsis/gc/Makefile.dj0000664000076400007640000005134011104702316017720 0ustar stefanstefan# This Makefile is intended only for DJGPP use. # It is mainly a copy of the main Makefile, but tends to get out of sync # with it. A merge would probably be appropriate. # Primary targets: # gc.a - builds basic library # libgc.a - builds library for use with g++ "-fgc-keyword" extension # -fgc-keyword was never really available. Historical # interest only. # c++ - adds C++ interface to library # cords - adds cords (heavyweight strings) to library # test - prints porting information, then builds basic version of gc.a, # and runs some tests of collector and cords. Does not add cords or # c++ interface to gc.a # cord/de$(EXE_SUFFIX) - builds dumb editor based on cords. ABI_FLAG= CC=gcc $(ABI_FLAG) CXX=gxx $(ABI_FLAG) AS=gcc -c -x assembler-with-cpp $(ABI_FLAG) # The above doesn't work with gas, which doesn't run cpp. # Define AS as `gcc -c -x assembler-with-cpp' instead. # Under Irix 6, you will have to specify the ABI (-o32, -n32, or -64) # if you use something other than the default ABI on your machine. # special defines for DJGPP CXXLD=gxx $(ABI_FLAG) EXE_SUFFIX=.exe srcdir= . VPATH= $(srcdir) CFLAGS= -gstabs+ -O2 -I$(srcdir)/include -DATOMIC_UNCOLLECTABLE -DALL_INTERIOR_POINTERS -DNO_EXECUTE_PERMISSION # Setjmp_test may yield overly optimistic results when compiled # without optimization. # -DFIND_LEAK causes GC_find_leak to be initially set. # This causes the collector to assume that all inaccessible # objects should have been explicitly deallocated, and reports exceptions. # Finalization and the test program are not usable in this mode. # -DALL_INTERIOR_POINTERS allows all pointers to the interior # of objects to be recognized. (See gc_priv.h for consequences.) # -DSMALL_CONFIG tries to tune the collector for small heap sizes, # usually causing it to use less space in such situations. # Incremental collection no longer works in this case. # -DLARGE_CONFIG tunes the collector for unusually large heaps. # Necessary for heaps larger than about 500 MB on most machines. # Recommended for heaps larger than about 64 MB. # -DDONT_ADD_BYTE_AT_END is meaningful only with # -DALL_INTERIOR_POINTERS. Normally -DALL_INTERIOR_POINTERS # causes all objects to be padded so that pointers just past the end of # an object can be recognized. This can be expensive. (The padding # is normally more than one byte due to alignment constraints.) # -DDONT_ADD_BYTE_AT_END disables the padding. # -DNO_SIGNALS does not disable signals during critical parts of # the GC process. This is no less correct than many malloc # implementations, and it sometimes has a significant performance # impact. However, it is dangerous for many not-quite-ANSI C # programs that call things like printf in asynchronous signal handlers. # This is on by default. Turning it off has not been extensively tested with # compilers that reorder stores. It should have been. # -DNO_EXECUTE_PERMISSION may cause some or all of the heap to not # have execute permission, i.e. it may be impossible to execute # code from the heap. Currently this only affects the incremental # collector on UNIX machines. It may greatly improve its performance, # since this may avoid some expensive cache synchronization. # -DGC_NO_OPERATOR_NEW_ARRAY declares that the C++ compiler does not support # the new syntax "operator new[]" for allocating and deleting arrays. # See gc_cpp.h for details. No effect on the C part of the collector. # This is defined implicitly in a few environments. Must also be defined # by clients that use gc_cpp.h. # -DREDIRECT_MALLOC=X causes malloc, realloc, and free to be defined # as aliases for X, GC_realloc, and GC_free, respectively. # Calloc is redefined in terms of the new malloc. X should # be either GC_malloc or GC_malloc_uncollectable. # The former is occasionally useful for working around leaks in code # you don't want to (or can't) look at. It may not work for # existing code, but it often does. Neither works on all platforms, # since some ports use malloc or calloc to obtain system memory. # (Probably works for UNIX, and win32.) # -DIGNORE_FREE turns calls to free into a noop. Only useful with # -DREDIRECT_MALLOC. # -DNO_DEBUGGING removes GC_dump and the debugging routines it calls. # Reduces code size slightly at the expense of debuggability. # -DJAVA_FINALIZATION makes it somewhat safer to finalize objects out of # order by specifying a nonstandard finalization mark procedure (see # finalize.c). Objects reachable from finalizable objects will be marked # in a sepearte postpass, and hence their memory won't be reclaimed. # Not recommended unless you are implementing a language that specifies # these semantics. Since 5.0, determines only only the initial value # of GC_java_finalization variable. # -DFINALIZE_ON_DEMAND causes finalizers to be run only in response # to explicit GC_invoke_finalizers() calls. # In 5.0 this became runtime adjustable, and this only determines the # initial value of GC_finalize_on_demand. # -DATOMIC_UNCOLLECTABLE includes code for GC_malloc_atomic_uncollectable. # This is useful if either the vendor malloc implementation is poor, # or if REDIRECT_MALLOC is used. # -DHBLKSIZE=ddd, where ddd is a power of 2 between 512 and 16384, explicitly # sets the heap block size. Each heap block is devoted to a single size and # kind of object. For the incremental collector it makes sense to match # the most likely page size. Otherwise large values result in more # fragmentation, but generally better performance for large heaps. # -DPRINT_BLACK_LIST Whenever a black list entry is added, i.e. whenever # the garbage collector detects a value that looks almost, but not quite, # like a pointer, print both the address containing the value, and the # value of the near-bogus-pointer. Can be used to identifiy regions of # memory that are likely to contribute misidentified pointers. # -DKEEP_BACK_PTRS Add code to save back pointers in debugging headers # for objects allocated with the debugging allocator. If all objects # through GC_MALLOC with GC_DEBUG defined, this allows the client # to determine how particular or randomly chosen objects are reachable # for debugging/profiling purposes. The gc_backptr.h interface is # implemented only if this is defined. # -DGC_ASSERTIONS Enable some internal GC assertion checking. Currently # this facility is only used in a few places. It is intended primarily # for debugging of the garbage collector itself, but could also # -DDBG_HDRS_ALL Make sure that all objects have debug headers. Increases # the reliability (from 99.9999% to 100%) of some of the debugging # code (especially KEEP_BACK_PTRS). Makes -DSHORT_DBG_HDRS possible. # Assumes that all client allocation is done through debugging # allocators. # -DSHORT_DBG_HDRS Assume that all objects have debug headers. Shorten # the headers to minimize object size, at the expense of checking for # writes past the end of an object. This is intended for environments # in which most client code is written in a "safe" language, such as # Scheme or Java. Assumes that all client allocation is done using # the GC_debug_ functions (or through the macros that expand to these. # (Also eliminates the field for the requested object size.) # occasionally be useful for debugging of client code. Slows down the # collector somewhat, but not drastically. # -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly # altered stubborn objects, at substantial performance cost. # Use only for debugging of the incremental collector. # -DGC_GCJ_SUPPORT includes support for gcj (and possibly other systems # that include a pointer to a type descriptor in each allocated object). # Building this way requires an ANSI C compiler. # -DUSE_I686_PREFETCH causes the collector to issue Pentium III style # prefetch instructions. No effect except on X86 Linux platforms. # Assumes a very recent gcc-compatible compiler and assembler. # (Gas prefetcht0 support was added around May 1999.) # Empirically the code appears to still run correctly on Pentium II # processors, though with no performance benefit. May not run on other # X86 processors? In some cases this improves performance by # 15% or so. # -DUSE_3DNOW_PREFETCH causes the collector to issue AMD 3DNow style # prefetch instructions. Same restrictions as USE_I686_PREFETCH. # UNTESTED!! # -DGC_USE_LD_WRAP in combination with the gld flags listed in README.linux # causes the collector some system and pthread calls in a more transparent # fashion than the usual macro-based approach. Requires GNU ld, and # currently probably works only with Linux. CXXFLAGS= $(CFLAGS) -DGC_OPERATOR_NEW_ARRAY AR= ar RANLIB= ranlib OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o malloc.o stubborn.o checksums.o solaris_threads.o typd_mlc.o ptr_chck.o mallocx.o solaris_pthreads.o gcj_mlc.o specific.o CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c solaris_threads.c typd_mlc.c ptr_chck.c mallocx.c solaris_pthreads.c gcj_mlc.c specific.c CORD_SRCS= cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/de.c cord/cordtest.c include/cord.h include/ec.h include/private/cord_pos.h cord/de_win.c cord/de_win.h cord/de_cmds.h cord/de_win.ICO cord/de_win.RC cord/SCOPTIONS.amiga cord/SMakefile.amiga CORD_OBJS= cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o SRCS= $(CSRCS) mips_sgi_mach_dep.S rs6000_mach_dep.s alpha_mach_dep.S \ sparc_mach_dep.S include/gc.h include/gc_typed.h \ include/private/gc_hdrs.h include/private/gc_priv.h \ include/private/gcconfig.h include/private/gc_mark.h \ include/gc_inline.h gc.man \ threadlibs.c if_mach.c if_not_there.c gc_cpp.cc include/gc_cpp.h \ include/weakpointer.h include/private/gc_locks.h \ gcc_support.c mips_ultrix_mach_dep.s include/gc_alloc.h \ include/new_gc_alloc.h include/javaxfc.h sparc_sunos4_mach_dep.s \ include/private/solaris_threads.h include/gc_backptr.h \ hpux_test_and_clear.s include/gc_gcj.h \ include/gc_local_alloc.h include/private/dbg_mlc.h \ include/private/specific.h \ include/leak_detector.h $(CORD_SRCS) OTHER_FILES= Makefile PCR-Makefile OS2_MAKEFILE NT_MAKEFILE BCC_MAKEFILE \ README tests/test.c test_cpp.cc setjmp_t.c SMakefile.amiga \ SCoptions.amiga README.amiga README.win32 cord/README \ README.rs6000 README.QUICK callprocs pc_excludes \ barrett_diagram README.OS2 README.Mac MacProjects.sit.hqx \ MacOS.c EMX_MAKEFILE README.debugging \ Mac_files/datastart.c Mac_files/dataend.c \ Mac_files/MacOS_config.h Mac_files/MacOS_Test_config.h \ add_gc_prefix.c README.solaris2 README.sgi README.hp README.uts \ win32_threads.c NT_THREADS_MAKEFILE gc.mak README.dj Makefile.dj \ README.alpha README.linux README.MacOSX version.h Makefile.DLLs \ WCC_MAKEFILE nursery.c include/gc_nursery.h include/gc_copy_descr.h CORD_INCLUDE_FILES= $(srcdir)/include/gc.h $(srcdir)/include/cord.h \ $(srcdir)/include/ec.h $(srcdir)/include/private/cord_pos.h UTILS= if_mach$(EXE_SUFFIX) if_not_there$(EXE_SUFFIX) # Libraries needed for curses applications. Only needed for de. CURSES= -lcurses -ltermlib # The following is irrelevant on most systems. But a few # versions of make otherwise fork the shell specified in # the SHELL environment variable. SHELL= /bin/sh SPECIALCFLAGS = -I$(srcdir)/include # Alternative flags to the C compiler for mach_dep.c. # Mach_dep.c often doesn't like optimization, and it's # not time-critical anyway. # Set SPECIALCFLAGS to -q nodirect_code on Encore. all: gc.a gctest$(EXE_SUFFIX) $(OBJS) test.o dyn_load.o dyn_load_sunos53.o: \ $(srcdir)/include/private/gc_priv.h \ $(srcdir)/include/private/gc_hdrs.h $(srcdir)/include/private/gc_locks.h \ $(srcdir)/include/gc.h \ $(srcdir)/include/private/gcconfig.h $(srcdir)/include/gc_typed.h \ Makefile # The dependency on Makefile is needed. Changing # options affects the size of GC_arrays, # invalidating all .o files that rely on gc_priv.h mark.o typd_mlc.o finalize.o: $(srcdir)/include/gc_mark.h base_lib gc.a: $(OBJS) dyn_load.o $(UTILS) echo > base_lib rm -f on_sparc_sunos5_1 ./if_mach SPARC SOLARIS touch on_sparc_sunos5_1 ./if_mach SPARC SOLARIS $(AR) rus gc.a $(OBJS) dyn_load.o ./if_not_there on_sparc_sunos5_1 $(AR) ru gc.a $(OBJS) dyn_load.o -./if_not_there on_sparc_sunos5_1 $(RANLIB) gc.a # ignore ranlib failure; that usually means it doesn't exist, and isn't needed cords: $(CORD_OBJS) cord/cordtest$(EXE_SUFFIX) $(UTILS) rm -f on_sparc_sunos5_3 ./if_mach SPARC SOLARIS touch on_sparc_sunos5_3 ./if_mach SPARC SOLARIS $(AR) rus gc.a $(CORD_OBJS) ./if_not_there on_sparc_sunos5_3 $(AR) ru gc.a $(CORD_OBJS) -./if_not_there on_sparc_sunos5_3 $(RANLIB) gc.a gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/include/gc_cpp.h $(srcdir)/include/gc.h Makefile $(CXX) -c $(CXXFLAGS) $(srcdir)/gc_cpp.cc test_cpp$(EXE_SUFFIX): $(srcdir)/test_cpp.cc $(srcdir)/include/gc_cpp.h gc_cpp.o $(srcdir)/include/gc.h \ base_lib $(UTILS) rm -f test_cpp test_cpp$(EXE_SUFFIX) ./if_mach HP_PA "" $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/test_cpp.cc gc_cpp.o gc.a -ldld ./if_not_there test_cpp$(EXE_SUFFIX) $(CXXLD) $(CXXFLAGS) -o test_cpp$(EXE_SUFFIX) $(srcdir)/test_cpp.cc gc_cpp.o gc.a rm -f test_cpp c++: gc_cpp.o $(srcdir)/include/gc_cpp.h test_cpp$(EXE_SUFFIX) rm -f on_sparc_sunos5_4 ./if_mach SPARC SOLARIS touch on_sparc_sunos5_4 ./if_mach SPARC SOLARIS $(AR) rus gc.a gc_cpp.o ./if_not_there on_sparc_sunos5_4 $(AR) ru gc.a gc_cpp.o -./if_not_there on_sparc_sunos5_4 $(RANLIB) gc.a ./test_cpp$(EXE_SUFFIX) 1 echo > c++ dyn_load_sunos53.o: dyn_load.c $(CC) $(CFLAGS) -DSUNOS53_SHARED_LIB -c $(srcdir)/dyn_load.c -o $@ # SunOS5 shared library version of the collector sunos5gc.so: $(OBJS) dyn_load_sunos53.o $(CC) -G -o sunos5gc.so $(OBJS) dyn_load_sunos53.o -ldl ln sunos5gc.so libgc.so # Alpha/OSF shared library version of the collector libalphagc.so: $(OBJS) ld -shared -o libalphagc.so $(OBJS) dyn_load.o -lc ln libalphagc.so libgc.so # IRIX shared library version of the collector libirixgc.so: $(OBJS) dyn_load.o ld -shared $(ABI_FLAG) -o libirixgc.so $(OBJS) dyn_load.o -lc ln libirixgc.so libgc.so # Linux shared library version of the collector liblinuxgc.so: $(OBJS) dyn_load.o gcc -shared -o liblinuxgc.so $(OBJS) dyn_load.o -lo ln liblinuxgc.so libgc.so mach_dep.o: $(srcdir)/mach_dep.c $(srcdir)/mips_sgi_mach_dep.S $(srcdir)/mips_ultrix_mach_dep.s \ $(srcdir)/rs6000_mach_dep.s $(UTILS) rm -f mach_dep.o ./if_mach MIPS IRIX5 $(AS) -o mach_dep.o $(srcdir)/mips_sgi_mach_dep.S ./if_mach MIPS RISCOS $(AS) -o mach_dep.o $(srcdir)/mips_ultrix_mach_dep.s ./if_mach MIPS ULTRIX $(AS) -o mach_dep.o $(srcdir)/mips_ultrix_mach_dep.s ./if_mach POWERPC AIX $(AS) -o mach_dep.o $(srcdir)/rs6000_mach_dep.s ./if_mach ALPHA "" $(AS) -o mach_dep.o $(srcdir)/alpha_mach_dep.S ./if_mach SPARC SOLARIS $(AS) -o mach_dep.o $(srcdir)/sparc_mach_dep.S ./if_mach SPARC SUNOS4 $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s ./if_not_there mach_dep.o $(CC) -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c mark_rts.o: $(srcdir)/mark_rts.c if_mach if_not_there $(UTILS) rm -f mark_rts.o -./if_mach ALPHA OSF1 $(CC) -c $(CFLAGS) -Wo,-notail $(srcdir)/mark_rts.c ./if_not_there mark_rts.o $(CC) -c $(CFLAGS) $(srcdir)/mark_rts.c # Work-around for DEC optimizer tail recursion elimination bug. # The ALPHA-specific line should be removed if gcc is used. alloc.o: version.h cord/cordbscs.o: $(srcdir)/cord/cordbscs.c $(CORD_INCLUDE_FILES) $(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordbscs.c mv cordbscs.o cord/cordbscs.o # not all compilers understand -o filename cord/cordxtra.o: $(srcdir)/cord/cordxtra.c $(CORD_INCLUDE_FILES) $(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordxtra.c mv cordxtra.o cord/cordxtra.o cord/cordprnt.o: $(srcdir)/cord/cordprnt.c $(CORD_INCLUDE_FILES) $(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordprnt.c mv cordprnt.o cord/cordprnt.o cord/cordtest$(EXE_SUFFIX): $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a $(UTILS) /tmp rm -f cord/cordtest$(EXE_SUFFIX) ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/cordtest$(EXE_SUFFIX) $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -lucb ./if_mach HP_PA "" $(CC) $(CFLAGS) -o cord/cordtest$(EXE_SUFFIX) $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -ldld ./if_not_there cord/cordtest$(EXE_SUFFIX) $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a rm -f cord/cordtest cordtest -mv cordtest$(EXE_SUFFIX) cord/ /tmp: $(UTILS) ./if_not_there /tmp mkdir /tmp cord/de$(EXE_SUFFIX): $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(UTILS) rm -f cord/de cord/de$(EXE_SUFFIX) ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -lucb `./threadlibs` ./if_mach HP_PA "" $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -ldld ./if_mach RS6000 "" $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses ./if_mach I386 LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs` ./if_mach ALPHA LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses ./if_not_there cord/de$(EXE_SUFFIX) $(CC) $(CFLAGS) -o cord/de$(EXE_SUFFIX) $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) if_mach$(EXE_SUFFIX): $(srcdir)/if_mach.c $(srcdir)/include/private/gcconfig.h rm -f if_mach if_mach$(EXE_SUFFIX) $(CC) $(CFLAGS) -o if_mach $(srcdir)/if_mach.c threadlibs$(EXE_SUFFIX): $(srcdir)/threadlibs.c $(srcdir)include/private/gcconfig.h Makefile rm -f threadlibs threadlibs$(EXE_SUFFIX) $(CC) $(CFLAGS) -o threadlibs $(srcdir)/threadlibs.c if_not_there$(EXE_SUFFIX): $(srcdir)/if_not_there.c rm -f if_not_there if_not_there$(EXE_SUFFIX) $(CC) $(CFLAGS) -o if_not_there $(srcdir)/if_not_there.c # Clean removes *.o several times, # because as the first one doesn't seem to get them all! clean: rm -f gc.a *.o rm -f *.o rm -f *.o rm -f cord/*.o rm -f gctest gctest_dyn_link test_cpp rm -f setjmp_test mon.out gmon.out a.out core if_not_there if_mach rm -f threadlibs $(CORD_OBJS) cordtest cord/cordtest de cord/de rm -f gctest$(EXE_SUFFIX) gctest_dyn_link$(EXE_SUFFIX) test_cpp$(EXE_SUFFIX) rm -f setjmp_test$(EXE_SUFFIX) if_not_there$(EXE_SUFFIX) if_mach$(EXE_SUFFIX) rm -f threadlibs$(EXE_SUFFIX) cord/cordtest$(EXE_SUFFIX) -rm -f *~ gctest$(EXE_SUFFIX): tests/test.o gc.a if_mach$(EXE_SUFFIX) if_not_there$(EXE_SUFFIX) rm -f gctest gctest$(EXE_SUFFIX) ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o gctest tests/test.o gc.a -lucb ./if_mach HP_PA "" $(CC) $(CFLAGS) -o gctest tests/test.o gc.a -ldld ./if_not_there gctest$(EXE_SUFFIX) $(CC) $(CFLAGS) -o gctest$(EXE_SUFFIX) tests/test.o gc.a rm -f gctest # If an optimized setjmp_test generates a segmentation fault, # odds are your compiler is broken. Gctest may still work. # Try compiling setjmp_t.c unoptimized. setjmp_test$(EXE_SUFFIX): $(srcdir)/setjmp_t.c $(srcdir)/include/gc.h \ if_mach$(EXE_SUFFIX) if_not_there$(EXE_SUFFIX) rm -f setjmp_test$(EXE_SUFFIX) $(CC) $(CFLAGS) -o setjmp_test $(srcdir)/setjmp_t.c rm -f setjmp_test test: KandRtest cord/cordtest$(EXE_SUFFIX) ./cord/cordtest$(EXE_SUFFIX) # Those tests that work even with a K&R C compiler: KandRtest: setjmp_test$(EXE_SUFFIX) gctest$(EXE_SUFFIX) ./setjmp_test$(EXE_SUFFIX) ./gctest$(EXE_SUFFIX) add_gc_prefix$(EXE_SUFFIX): add_gc_prefix.c $(CC) -o add_gc_prefix$(EXE_SUFFIX) $(srcdir)/add_gc_prefix.c rm -f add_gc_prefix gc.tar: $(SRCS) $(OTHER_FILES) add_gc_prefix ./add_gc_prefix$(EXE_SUFFIX) $(SRCS) $(OTHER_FILES) > /tmp/gc.tar-files (cd $(srcdir)/.. ; tar cvfh - `cat /tmp/gc.tar-files`) > gc.tar pc_gc.tar: $(SRCS) $(OTHER_FILES) tar cvfX pc_gc.tar pc_excludes $(SRCS) $(OTHER_FILES) gc.tar.Z: gc.tar compress gc.tar gc.tar.gz: gc.tar gzip gc.tar lint: $(CSRCS) tests/test.c lint -DLINT $(CSRCS) tests/test.c | egrep -v "possible pointer alignment problem|abort|exit|sbrk|mprotect|syscall" # BTL: added to test shared library version of collector. # Currently works only under SunOS5. Requires GC_INIT call from statically # loaded client code. ABSDIR = `pwd` gctest_dyn_link: test.o libgc.so $(CC) -L$(ABSDIR) -R$(ABSDIR) -o gctest_dyn_link test.o -lgc -ldl -lthread test_dll.o: tests/test.c libgc_globals.h $(CC) $(CFLAGS) -DGC_USE_DLL -c tests/test.c -o test_dll.o test_dll: test_dll.o libgc_dll.a libgc.dll $(CC) test_dll.o -L$(ABSDIR) -lgc_dll -o test_dll SYM_PREFIX-libgc=GC # Uncomment the following line to build a GNU win32 DLL # include Makefile.DLLs synopsis-0.12/src/Synopsis/gc/compile0000775000076400007640000000715711104702320017244 0ustar stefanstefan#! /bin/sh # Wrapper for compilers which do not understand `-c -o'. scriptversion=2004-10-12.08 # Copyright (C) 1999, 2000, 2003, 2004 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 0 ;; -v | --v*) echo "compile $scriptversion" exit 0 ;; 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: synopsis-0.12/src/Synopsis/gc/missing0000775000076400007640000002405011104702316017261 0ustar stefanstefan#! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing 0.4 - GNU automake" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. You can get \`$1Help2man' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then # We have makeinfo, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; tar) shift if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar ${1+"$@"} && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar ${1+"$@"} && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" ${1+"$@"} && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" ${1+"$@"} && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequirements for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/0000775000076400007640000000000011172123233021003 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/install-sh0000775000076400007640000002202111104702320022777 0ustar stefanstefan#!/bin/sh # install - install a program, script, or datafile scriptversion=2005-05-14.22 # 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: synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/ChangeLog0000664000076400007640000001415211104702320022553 0ustar stefanstefan2007-06-26 Hans Boehm (really Luca Barbato) * src/atomic_ops/sysdeps/gcc/powerpc.h (AO_load_acquire): Add 64-bit version. 2007-06-13 Hans Boehm * src/atomic_ops.h: include stddef.h 2007-06-06 Hans Boehm * src/atomic_ops/sysdeps/msftc/x86_64.h: New file. * src/atomic_ops.h: Add test for msftc/x86_64.h. * src/atomic_ops/sysdeps/msftc/x86.h: Complain for _WIN64. * src/atomic_ops/sysdeps/Makefile.am: Add x86_64.h. * src/atomic_ops/sysdeps/Makefile.in: Regenerate. * src/atomic_ops/sysdeps/aligned_atomic_load_store.h, src/atomic_ops/sysdeps/int_aligned_atomic_load_store.h, src/atomic_ops/sysdeps/short_aligned_atomic_load_store.h: Replace unsigned long cast with size_t. 2007-05-17 Hans Boehm * src/atomic_ops/sysdeps/gcc/hppa.h (AO_test_and_set_full): Add cast for return. 2007-05-14 Hans Boehm doc/README.txt: Update to reflect C++0x effort. 2007-05-07 Hans Boehm (with help from Philipp Zambelli) * src/atomic_ops/sysdeps/msftc/x86.h: Don't just assume that mfence is present. * src/atomic_ops/sysdeps/gcc/arm.h (AO_test_and_set_full): Correct oldval type. 2006-11-09 Earl Chew (Agilent) * msftc/x86.h: Follow Microsoft documentation and include windows.h. [1.2 release] 2006-07-11 Hans Boehm * src/atomic_ops/sysdeps/hpc/ia64.h: Fix typos. 2006-03-28 Earl Chew (Agilent) * src/atomic_ops/sysdeps/gcc/powerpc.h: Remove unused variable cr. * src/atomic_ops/sysdeps/msftc/x86.h: Use new intrinsics available in MSVC 2003 and MSVC 2005. Use inline assembler to generate mfence and byte sized xchg Use correct prototype for InterlockedCompareExchange. * src/atomic_ops.h: Add test for __PPC__ . * tests/run_parallel.inc: Add simple VxWorks support. * tests/test_atomic.c, tests/test_atomic_include.h: Add prototypes to silence compiler warnings. 2006-1-13 Hans Boehm *src/atomic_ops/sysdeps/gcc/powerpc.h: Beginnings of 64 bit support. *src/atomic_ops/sysdeps/gcc/x86.h: Use "=q" for AO_test_and_set_full. 2005-11-4 Hans Boehm *src/atomic_ops/sysdeps/gcc/ia64.h: Include all_acquire_release_volatile.h, instead of just the pointer-sized version. *src/atomic_ops/sysdeps/gcc/ia64.h: Include all_acquire_release_volatile.h and all_atomic_load_store.h, instead of just the pointer-sized versions. [1.1 release] 2005-09-27 Hans Boehm *src/atomic_ops.h: Define AO_CAN_EMUL_CAS for arm. *src/atomic_ops/sysdeps/read_ordered.h: New file, extracted from ordered_except_wr.h. *src/atomic_ops/sysdeps/ordered_except_wr.h: include read_ordered.h instead of duplicating it. *src/atomic_ops/sysdeps/gcc/arm.h: Include read_ordered.h. 2005-09-16 Hans Boehm *src/atomic_ops/sysdeps/gcc/arm.h: Replace the AO_test_and_set definition with one that might actually work. (Thanks to Kazu Hirata and Paul Brook.) 2005-08-01 Hans Boehm *src/atomic_ops/Makefile.am: Change function naming from "byte" to "char" (again). [1.0 release] 2005-03-21 Hans Boehm Fix various acquire_release_volatile.h files to reflect the fact that both icc and gcc seem to reorder ordinary memory accesses around volatile accesses early in the compilation. Modify the acquire release test to catch this problem (with high probablity, and only on a multiprocessor). 2005-03 Hans Boehm Fixes for recently introduced bugs. Update x86 and x86-64 assembly syntax to deal with complaints by some recent gcc versions. 2005-02 Hans Boehm Added libatomic_ops_gpl library with support for mostly lock-free stack and malloc(). 2005-01 Ian Wienand , Al Stone , Hans Boehm Use autoconf, automake, starting with code from Debian package. Don't use libtool. 2005-01 Hans Boehm * test_and_set_t_is_ao_t.h, test_and_set_t_is_char.h, others: Change most platforms to use byte-wide test-and-set locations. 2005-01 Hans Boehm * ao_t_is_int.h: Add to trivially support int-wide operations on platforms with int-sized pointers. 2004-12 Hans Boehm * gcc/powerpc.h: First serious attempt to support PowerPC (with help from Maged Michael and others). 2004-12 Hans Boehm * sunc/sparc.[hS]: Added minimal supprt for the Sun SPARC compiler. * atomic_ops_sysdeps.S: Add support for platforms that require out-of-line assmebly code. 2004-10 Hans Boehm More work on char, short, int sized data. Add both compare_double_and_swap_double and compare_and_swap_double. Typically each platform will provide at most one of these. 2004-07-02 Ranko Zivojnovic Replace both instances of AO_HAVE_NOP_FULL with AO_HAVE_nop_full. 2004-06 Hans Boehm Start to add atomic_ops primitives for different sized data. 2003-12-18 Hans Boehm * atomic_ops/sysdeps/acquire_release_volatile.h, atomic_ops.h: Fix support for ecc on IA64. Remove compiler_barrier workaround for gcc 3.4 and later. 2003-12-17 Hans Boehm * atomic_ops/sysdeps/hpc/{ia64.h,hppa.h}, atomic_ops/sysdeps/msftc/x86.h, Makefile, Makefile.atomic_ops, Makefile.atomic_ops.msft, atomic_ops.h: Add initial support for atomic_ops for VC++/Windows/X86 and HP/UX with the HP compiler on PA_RISC and IA64. 2003-12-09 Hans Boehm * many: Install under "atomic_ops" instead of "ao". Change atomic_ops include file structure. Auxiliary include files are all under include/atomic_ops. Fix (hopefully) "make dist" in atomic_ops distribution. Renamed various types to end in _t, though the old versions are still defined for backward compatibility. 2003-12-08 Carlos O'Donell * ao_sysdeps/gcc/hppa.h: Define AO_CLEAR macro. Change AO_pa_clearable_loc type. Add __ldcw, and __ldcw_align helper macros. AO_test_and_set_full uses helper macros. Started sometime after version 0.4 release. Currently the format is informal. Eventually should become more GNU-like. synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/README0000664000076400007640000000122411104702317021663 0ustar stefanstefanThis package provides semi-portable access to hardware provided atomic memory operations. These might allow you to write code: - That does more interesting things in signal handlers. - Makes more effective use of multiprocessors by allowing you to write clever lock-free code. Note that such code is very difficult to get right, and will unavoidably be less portable than lock-based code. It ia also not always faster than lock-based code. But it may occasionally be a large performance win. - To experiment with new and much better thread programming paradigms, etc. For details and licensing restrictions see the files in the doc subdirectory. synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/config.guess0000775000076400007640000012625711104702317023341 0ustar stefanstefan#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2006-06-06' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerppc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[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 ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; x86:Interix*:[345]*) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T:Interix*:[345]*) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; 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 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/configure0000775000076400007640000054507211126175477022747 0ustar stefanstefan#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for libatomic_ops 1.2. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='libatomic_ops' PACKAGE_TARNAME='libatomic_ops' PACKAGE_VERSION='1.2' PACKAGE_STRING='libatomic_ops 1.2' PACKAGE_BUGREPORT='' ac_unique_file="src/atomic_ops.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA am__isrc CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar RANLIB CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CCAS CCASFLAGS CCASDEPMODE am__fastdepCCAS_TRUE am__fastdepCCAS_FALSE CPP GREP EGREP PICFLAG NEED_ASM_TRUE NEED_ASM_FALSE LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CCAS CCASFLAGS CPP' # 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. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_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 ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_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'` 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 ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_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'` 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; }; } 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 directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $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 test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures libatomic_ops 1.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 \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/libatomic_ops] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of libatomic_ops 1.2:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CCAS assembler compiler command (defaults to CC) CCASFLAGS assembler compiler flags (defaults to CFLAGS) CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF libatomic_ops configure 1.2 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by libatomic_ops $as_me 1.2, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file 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 $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { 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 "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 echo "$as_me: error: cannot run $SHELL $ac_aux_dir/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_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && { { 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=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_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; } case $ac_cv_build in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 echo "$as_me: error: invalid value of canonical build" >&2;} { (exit 1); exit 1; }; };; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { 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 if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 echo "$as_me: error: invalid value of canonical host" >&2;} { (exit 1); exit 1; }; };; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { echo "$as_me:$LINENO: checking target system type" >&5 echo $ECHO_N "checking target system type... $ECHO_C" >&6; } if test "${ac_cv_target+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_target" >&5 echo "${ECHO_T}$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5 echo "$as_me: error: invalid value of canonical target" >&2;} { (exit 1); exit 1; }; };; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- am__api_version='1.10' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. { 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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done IFS=$as_save_IFS fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { 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 -f 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 { echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } if test -z "$MKDIR_P"; then if test "${ac_cv_path_mkdir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. test -d ./--version && rmdir ./--version MKDIR_P="$ac_install_sh -d" fi fi { echo "$as_me:$LINENO: result: $MKDIR_P" >&5 echo "${ECHO_T}$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { 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 x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { 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 if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then { { 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 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='libatomic_ops' VERSION='1.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-"\$(SHELL) $am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { 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 if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { 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 if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi ac_config_headers="$ac_config_headers src/config.h" # Checks for programs. 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { 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` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then 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 # Check that 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' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 that 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 { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { 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 ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu 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 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="$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/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { 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 # By default we simply use the C compiler to build assembly code. test "${CCAS+set}" = set || CCAS=$CC test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS depcc="$CCAS" 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_CCAS_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_CCAS_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CCAS_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CCAS_dependencies_compiler_type=none fi fi { echo "$as_me:$LINENO: result: $am_cv_CCAS_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CCAS_dependencies_compiler_type" >&6; } CCASDEPMODE=depmode=$am_cv_CCAS_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CCAS_dependencies_compiler_type" = gcc3; then am__fastdepCCAS_TRUE= am__fastdepCCAS_FALSE='#' else am__fastdepCCAS_TRUE='#' am__fastdepCCAS_FALSE= fi # Checks for functions. 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else 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 grep that handles long lines and -e" >&5 echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Extract the first word of "grep ggrep" to use in msg output if test -z "$GREP"; then set dummy grep ggrep; ac_prog_name=$2 if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS fi GREP="$ac_cv_path_GREP" if test -z "$GREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 echo "${ECHO_T}$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } if test "${ac_cv_path_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_path_EGREP="$GREP -E" else # Extract the first word of "egrep" to use in msg output if test -z "$EGREP"; then set dummy egrep; ac_prog_name=$2 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS fi EGREP="$ac_cv_path_EGREP" if test -z "$EGREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* 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 { as_var=$as_ac_Header; eval "test \"\${$as_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. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&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 stdlib.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else 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;} ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in getpagesize 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 { as_var=$as_ac_var; eval "test \"\${$as_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 GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { echo "$as_me:$LINENO: checking for working mmap" >&5 echo $ECHO_N "checking for working mmap... $ECHO_C" >&6; } if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_mmap_fixed_mapped=no else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default /* malloc might have been renamed as rpl_malloc. */ #undef malloc /* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: mmap private not fixed mmap private fixed at somewhere currently unmapped mmap private fixed at somewhere already mapped mmap shared not fixed mmap shared fixed at somewhere currently unmapped mmap shared fixed at somewhere already mapped For private mappings, we should verify that changes cannot be read() back from the file, nor mmap's back from the file at a different address. (There have been systems where private was not correctly implemented like the infamous i386 svr4.0, and systems where the VM page cache was not coherent with the file system buffer cache like early versions of FreeBSD and possibly contemporary NetBSD.) For shared mappings, we should conversely verify that changes get propagated back to all the places they're supposed to be. Grep wants private fixed already mapped. The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ #include #include #if !defined STDC_HEADERS && !defined HAVE_STDLIB_H char *malloc (); #endif /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE /* Assume that all systems that can run configure have sys/param.h. */ # ifndef HAVE_SYS_PARAM_H # define HAVE_SYS_PARAM_H 1 # endif # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ # ifdef HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE # else /* no EXEC_PAGESIZE */ # ifdef NBPG # define getpagesize() NBPG * CLSIZE # ifndef CLSIZE # define CLSIZE 1 # endif /* no CLSIZE */ # else /* no NBPG */ # ifdef NBPC # define getpagesize() NBPC # else /* no NBPC */ # ifdef PAGESIZE # define getpagesize() PAGESIZE # endif /* PAGESIZE */ # endif /* no NBPC */ # endif /* no NBPG */ # endif /* no EXEC_PAGESIZE */ # else /* no HAVE_SYS_PARAM_H */ # define getpagesize() 8192 /* punt totally */ # endif /* no HAVE_SYS_PARAM_H */ # endif /* no _SC_PAGESIZE */ #endif /* no HAVE_GETPAGESIZE */ int main () { char *data, *data2, *data3; int i, pagesize; int fd; pagesize = getpagesize (); /* First, make a file with some known garbage in it. */ data = (char *) malloc (pagesize); if (!data) return 1; for (i = 0; i < pagesize; ++i) *(data + i) = rand (); umask (0); fd = creat ("conftest.mmap", 0600); if (fd < 0) return 1; if (write (fd, data, pagesize) != pagesize) return 1; close (fd); /* Next, try to mmap the file at a fixed address which already has something else allocated at it. If we can, also make sure that we see the same garbage. */ fd = open ("conftest.mmap", O_RDWR); if (fd < 0) return 1; data2 = (char *) malloc (2 * pagesize); if (!data2) return 1; data2 += (pagesize - ((long int) data2 & (pagesize - 1))) & (pagesize - 1); if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, 0L)) return 1; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data2 + i)) return 1; /* Finally, make sure that changes to the mapped area do not percolate back to the file as seen by read(). (This is a bug on some variants of i386 svr4.0.) */ for (i = 0; i < pagesize; ++i) *(data2 + i) = *(data2 + i) + 1; data3 = (char *) malloc (pagesize); if (!data3) return 1; if (read (fd, data3, pagesize) != pagesize) return 1; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data3 + i)) return 1; close (fd); return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_mmap_fixed_mapped=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_mmap_fixed_mapped=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5 echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6; } if test $ac_cv_func_mmap_fixed_mapped = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_MMAP 1 _ACEOF fi rm -f conftest.mmap # 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* 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 # AC_CHECK_HEADERS([ ]) # Determine PIC flag, adjust default CFLAGS need_asm=false PICFLAG= { echo "$as_me:$LINENO: checking Determining PIC compiler flag" >&5 echo $ECHO_N "checking Determining PIC compiler flag... $ECHO_C" >&6; } if test "$GCC" = yes; then { echo "$as_me:$LINENO: result: -fPIC" >&5 echo "${ECHO_T}-fPIC" >&6; } PICFLAG=-fPIC else case "$host" in *-*-hpux*) { echo "$as_me:$LINENO: result: \"+Z\"" >&5 echo "${ECHO_T}\"+Z\"" >&6; } PICFLAG="+Z" if test "$GCC" != yes; then CFLAGS="$CFLAGS +O2 -mt" fi ;; *-*-solaris*) { echo "$as_me:$LINENO: result: -Kpic" >&5 echo "${ECHO_T}-Kpic" >&6; } PICFLAG=-Kpic if test "$GCC" != yes; then CFLAGS="$CFLAGS -O" need_asm=true fi ;; *-*-linux*) { echo "$as_me:$LINENO: result: -fPIC" >&5 echo "${ECHO_T}-fPIC" >&6; } PICFLAG=-fPIC # Any Linux compiler had better be gcc compatible. ;; *) { echo "$as_me:$LINENO: result: \"\"" >&5 echo "${ECHO_T}\"\"" >&6; } ;; esac fi CFLAGS="$CFLAGS -DNDEBUG" if test x$need_asm = xtrue; then NEED_ASM_TRUE= NEED_ASM_FALSE='#' else NEED_ASM_TRUE='#' NEED_ASM_FALSE= fi ac_config_files="$ac_config_files Makefile src/Makefile src/atomic_ops/Makefile src/atomic_ops/sysdeps/Makefile doc/Makefile tests/Makefile" ac_config_commands="$ac_config_commands default" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCCAS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCCAS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${NEED_ASM_TRUE}" && test -z "${NEED_ASM_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"NEED_ASM\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"NEED_ASM\" 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 more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by libatomic_ops $as_me 1.2, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF 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 and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ libatomic_ops config.status 1.2 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' _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 ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --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;; --he | --h) # Conflict between --help and --header { 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 ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" PICFLAG=${PICFLAG} CC=${CC} DEFS=${DEFS} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/atomic_ops/Makefile") CONFIG_FILES="$CONFIG_FILES src/atomic_ops/Makefile" ;; "src/atomic_ops/sysdeps/Makefile") CONFIG_FILES="$CONFIG_FILES src/atomic_ops/sysdeps/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; *) { { 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 against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for 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 _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim build!$build$ac_delim build_cpu!$build_cpu$ac_delim build_vendor!$build_vendor$ac_delim build_os!$build_os$ac_delim host!$host$ac_delim host_cpu!$host_cpu$ac_delim host_vendor!$host_vendor$ac_delim host_os!$host_os$ac_delim target!$target$ac_delim target_cpu!$target_cpu$ac_delim target_vendor!$target_vendor$ac_delim target_os!$target_os$ac_delim INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim INSTALL_DATA!$INSTALL_DATA$ac_delim am__isrc!$am__isrc$ac_delim CYGPATH_W!$CYGPATH_W$ac_delim PACKAGE!$PACKAGE$ac_delim VERSION!$VERSION$ac_delim ACLOCAL!$ACLOCAL$ac_delim AUTOCONF!$AUTOCONF$ac_delim AUTOMAKE!$AUTOMAKE$ac_delim AUTOHEADER!$AUTOHEADER$ac_delim MAKEINFO!$MAKEINFO$ac_delim install_sh!$install_sh$ac_delim STRIP!$STRIP$ac_delim INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim mkdir_p!$mkdir_p$ac_delim AWK!$AWK$ac_delim SET_MAKE!$SET_MAKE$ac_delim am__leading_dot!$am__leading_dot$ac_delim AMTAR!$AMTAR$ac_delim am__tar!$am__tar$ac_delim am__untar!$am__untar$ac_delim RANLIB!$RANLIB$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim DEPDIR!$DEPDIR$ac_delim am__include!$am__include$ac_delim am__quote!$am__quote$ac_delim AMDEP_TRUE!$AMDEP_TRUE$ac_delim AMDEP_FALSE!$AMDEP_FALSE$ac_delim AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim CCDEPMODE!$CCDEPMODE$ac_delim am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim CCAS!$CCAS$ac_delim CCASFLAGS!$CCASFLAGS$ac_delim CCASDEPMODE!$CCASDEPMODE$ac_delim am__fastdepCCAS_TRUE!$am__fastdepCCAS_TRUE$ac_delim am__fastdepCCAS_FALSE!$am__fastdepCCAS_FALSE$ac_delim CPP!$CPP$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim PICFLAG!$PICFLAG$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF CEOF$ac_eof _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF NEED_ASM_TRUE!$NEED_ASM_TRUE$ac_delim NEED_ASM_FALSE!$NEED_ASM_FALSE$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 4; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF 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&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; :H) # # CONFIG_HEADER # _ACEOF # Transform confdefs.h into a sed script `conftest.defines', that # substitutes the proper values into config.h.in to produce config.h. rm -f conftest.defines conftest.tail # First, append a space to every undef/define line, to ease matching. echo 's/$/ /' >conftest.defines # Then, protect against being on the right side of a sed subst, or in # an unquoted here document, in config.status. If some macros were # called several times there might be several #defines for the same # symbol, which is useless. But do not sort them, since the last # AC_DEFINE must be honored. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* # These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where # NAME is the cpp macro being defined, VALUE is the value it is being given. # PARAMS is the parameter list in the macro definition--in most cases, it's # just an empty string. ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' ac_dB='\\)[ (].*,\\1define\\2' ac_dC=' ' ac_dD=' ,' uniq confdefs.h | sed -n ' t rset :rset s/^[ ]*#[ ]*define[ ][ ]*// t ok d :ok s/[\\&,]/\\&/g s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p ' >>conftest.defines # Remove the space that was appended to ease matching. # Then replace #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. # (The regexp can be short, since the line contains either #define or #undef.) echo 's/ $// s,^[ #]*u.*,/* & */,' >>conftest.defines # Break up conftest.defines: ac_max_sed_lines=50 # First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" # Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" # Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" # et cetera. ac_in='$ac_file_inputs' ac_out='"$tmp/out1"' ac_nxt='"$tmp/out2"' while : do # Write a here document: cat >>$CONFIG_STATUS <<_ACEOF # First, check the format of the line: cat >"\$tmp/defines.sed" <<\\CEOF /^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def /^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def b :def _ACEOF sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail grep . conftest.tail >/dev/null || break rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines conftest.tail echo "ac_result=$ac_in" >>$CONFIG_STATUS cat >>$CONFIG_STATUS <<\_ACEOF if test x"$ac_file" != x-; then echo "/* $configure_input */" >"$tmp/config.h" cat "$ac_result" >>"$tmp/config.h" 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 rm -f $ac_file mv "$tmp/config.h" $ac_file fi else echo "/* $configure_input */" cat "$ac_result" fi rm -f "$tmp/out12" # Compute $ac_file's index in $config_headers. _am_arg=$ac_file _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir=$dirpart/$fdir case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; "default":C) ;; esac done # for ac_tag { (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 synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/COPYING0000664000076400007640000004311011104702320022030 0ustar stefanstefan 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. synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/mkinstalldirs0000775000076400007640000000662211104702317023620 0ustar stefanstefan#! /bin/sh # mkinstalldirs --- make directory hierarchy scriptversion=2005-06-29.22 # Original author: Noah Friedman # Created: 1993-05-16 # Public domain. # # This file is maintained in Automake, please report # bugs to or send patches to # . errstatus=0 dirmode= usage="\ Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... Create each directory DIR (with mode MODE, if specified), including all leading file name components. Report bugs to ." # process command line arguments while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help echo "$usage" exit $? ;; -m) # -m PERM arg shift test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } dirmode=$1 shift ;; --version) echo "$0 $scriptversion" exit $? ;; --) # stop option processing shift break ;; -*) # unknown option echo "$usage" 1>&2 exit 1 ;; *) # first non-opt arg break ;; esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac # Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and # mkdir -p a/c at the same time, both will detect that a is missing, # one will create a, then the other will try to create a and die with # a "File exists" error. This is a problem when calling mkinstalldirs # from a parallel make. We use --version in the probe to restrict # ourselves to GNU mkdir, which is thread-safe. case $dirmode in '') if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -p -- $*" exec 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. test -d ./-p && rmdir ./-p test -d ./--version && rmdir ./--version fi ;; *) if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" else # Clean up after NextStep and OpenStep mkdir. for d in ./-m ./-p ./--version "./$dirmode"; do test -d $d && rmdir $d done fi ;; esac for file do case $file in /*) pathcomp=/ ;; *) pathcomp= ;; esac oIFS=$IFS IFS=/ set fnord $file shift IFS=$oIFS for d do test "x$d" = x && continue pathcomp=$pathcomp$d case $pathcomp in -*) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" lasterr= chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then errstatus=$lasterr fi fi fi fi pathcomp=$pathcomp/ done done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/0000775000076400007640000000000011172123233021572 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops_malloc.c0000664000076400007640000001614511104702317025432 0ustar stefanstefan/* * Copyright (c) 2005 Hewlett-Packard Development Company, L.P. * Original Author: Hans Boehm * * This file may be redistributed and/or modified 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. * * It is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License in the * file doc/COPYING for more details. */ #if defined(HAVE_CONFIG_H) # include "config.h" #endif #define AO_REQUIRE_CAS #include "atomic_ops_stack.h" #include /* for ffs, which is assumed reentrant. */ #include #ifdef AO_TRACE_MALLOC # include # include #endif /* * We round up each allocation request to the next power of two * minus one word. * We keep one stack of free objects for each size. Each object * has an initial word (offset -sizeof(AO_t) from the visible pointer) * which contains either * The binary log of the object size in bytes (small objects) * The object size (a multiple of CHUNK_SIZE) for large objects. * The second case only arises if mmap-based allocation is supported. * We align the user-visible part of each object on a GRANULARITY * byte boundary. That means that the actual (hidden) start of * the object starts a word before this boundary. */ #ifndef LOG_MAX_SIZE # define LOG_MAX_SIZE 16 /* We assume that 2**LOG_MAX_SIZE is a multiple of page size. */ #endif #ifndef ALIGNMENT # define ALIGNMENT 16 /* Assumed to be at least sizeof(AO_t). */ #endif #define CHUNK_SIZE (1 << LOG_MAX_SIZE) #ifndef AO_INITIAL_HEAP_SIZE # define AO_INITIAL_HEAP_SIZE (2*(LOG_MAX_SIZE+1)*CHUNK_SIZE) #endif char AO_initial_heap[AO_INITIAL_HEAP_SIZE]; static volatile AO_t initial_heap_ptr = (AO_t)AO_initial_heap; static volatile char *initial_heap_lim = AO_initial_heap + AO_INITIAL_HEAP_SIZE; #if defined(HAVE_MMAP) #include #include #include #include static volatile AO_t mmap_enabled = 0; void AO_malloc_enable_mmap(void) { AO_store(&mmap_enabled, 1); } static char *get_mmaped(size_t sz) { char * result; assert(!(sz & (CHUNK_SIZE - 1))); if (!mmap_enabled) return 0; # if defined(MAP_ANONYMOUS) result = mmap(0, sz, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); # elif defined(MAP_ANON) result = mmap(0, sz, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); # else { int zero_fd = open("/dev/zero", O_RDONLY); result = mmap(0, sz, PROT_READ | PROT_WRITE, MAP_PRIVATE, zero_fd, 0); close(zero_fd); } # endif if (result == MAP_FAILED) result = 0; return result; } /* Allocate an object of size (incl. header) of size > CHUNK_SIZE. */ /* sz includes space for an AO_t-sized header. */ static char * AO_malloc_large(size_t sz) { char * result; /* The header will force us to waste ALIGNMENT bytes, incl. header. */ sz += ALIGNMENT; /* Round to multiple of CHUNK_SIZE. */ sz = (sz + CHUNK_SIZE - 1) & ~(CHUNK_SIZE - 1); result = get_mmaped(sz); if (result == 0) return 0; result += ALIGNMENT; ((AO_t *)result)[-1] = (AO_t)sz; return result; } static void AO_free_large(char * p) { AO_t sz = ((AO_t *)p)[-1]; if (munmap(p - ALIGNMENT, (size_t)sz) != 0) abort(); /* Programmer error. Not really async-signal-safe, but ... */ } #else /* No MMAP */ void AO_malloc_enable_mmap(void) { } static char *get_mmaped(size_t sz) { return 0; } static char * AO_malloc_large(size_t sz) { return 0; } static void AO_free_large(char * p) { abort(); /* Programmer error. Not really async-signal-safe, but ... */ } #endif /* No MMAP */ static char * get_chunk(void) { char *initial_ptr; char *my_chunk_ptr; char * my_lim; retry: initial_ptr = (char *)AO_load(&initial_heap_ptr); my_chunk_ptr = (char *)(((AO_t)initial_ptr + (ALIGNMENT - 1)) & ~(ALIGNMENT - 1)); if (initial_ptr != my_chunk_ptr) { /* Align correctly. If this fails, someone else did it for us. */ AO_compare_and_swap_acquire(&initial_heap_ptr, (AO_t)initial_ptr, (AO_t)my_chunk_ptr); } my_lim = my_chunk_ptr + CHUNK_SIZE; if (my_lim <= initial_heap_lim) { if (!AO_compare_and_swap(&initial_heap_ptr, (AO_t)my_chunk_ptr, (AO_t)my_lim)) goto retry; return my_chunk_ptr; } /* We failed. The initial heap is used up. */ my_chunk_ptr = get_mmaped(CHUNK_SIZE); assert (!((AO_t)my_chunk_ptr & (ALIGNMENT-1))); return my_chunk_ptr; } /* Object free lists. Ith entry corresponds to objects */ /* of total size 2**i bytes. */ AO_stack_t AO_free_list[LOG_MAX_SIZE+1]; /* Chunk free list, linked through first word in chunks. */ /* All entries of size CHUNK_SIZE. */ AO_stack_t AO_chunk_free_list; /* Break up the chunk, and add it to the object free list for */ /* the given size. Sz must be a power of two. */ /* We have exclusive access to chunk. */ static void add_chunk_as(void * chunk, size_t sz, unsigned log_sz) { char *first = (char *)chunk + ALIGNMENT - sizeof(AO_t); char *limit = (char *)chunk + CHUNK_SIZE - sz; char *next, *p; for (p = first; p <= limit; p = next) { next = p + sz; AO_stack_push(AO_free_list+log_sz, (AO_t *)p); } } static int msbs[16] = {0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4}; /* Return the position of the most significant set bit in the */ /* argument. */ /* We follow the conventions of ffs(), i.e. the least */ /* significant bit is number one. */ int msb(size_t s) { int result = 0; if ((s & 0xff) != s) { /* The following shift often generates warnings on 32-bit arch's */ /* That's OK, because it will never be executed there. */ if (sizeof(size_t) > 4 && (s >> 32) != 0) { s >>= 32; result += 32; } if ((s >> 16) != 0) { s >>= 16; result += 16; } if ((s >> 8) != 0) { s >>= 8; result += 8; } } if (s > 15) { s >>= 4; result += 4; } result += msbs[s]; return result; } void * AO_malloc(size_t sz) { AO_t *result; size_t adj_sz = sz + sizeof(AO_t); int log_sz; if (sz > CHUNK_SIZE) return AO_malloc_large(sz); log_sz = msb(adj_sz-1); result = AO_stack_pop(AO_free_list+log_sz); while (0 == result) { void * chunk = get_chunk(); if (0 == chunk) return 0; adj_sz = 1 << log_sz; add_chunk_as(chunk, adj_sz, log_sz); result = AO_stack_pop(AO_free_list+log_sz); } *result = log_sz; # ifdef AO_TRACE_MALLOC fprintf(stderr, "%x: AO_malloc(%lu) = %p\n", (int)pthread_self(), (unsigned long)sz, result+1); # endif return result + 1; } void AO_free(void *p) { char *base = (char *)p - sizeof(AO_t); int log_sz; if (0 == p) return; log_sz = *(AO_t *)base; # ifdef AO_TRACE_MALLOC fprintf(stderr, "%x: AO_free(%p sz:%lu)\n", (int)pthread_self(), p, (unsigned long) (log_sz > LOG_MAX_SIZE? log_sz : (1 << log_sz))); # endif if (log_sz > LOG_MAX_SIZE) AO_free_large(p); else AO_stack_push(AO_free_list+log_sz, (AO_t *)base); } synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops.c0000664000076400007640000001415711104702317024104 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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. */ /* * Initialized data and out-of-line functions to support atomic_ops.h * go here. Currently this is needed only for pthread-based atomics * emulation, or for compare-and-swap emulation. * Pthreads emulation isn't useful on a native Windows platform, and * cas emulation is not needed. Thus we skip this on Windows. */ #if defined(HAVE_CONFIG_H) # include "config.h" #endif #if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__BORLANDC__) #undef AO_REQUIRE_CAS #include #include #ifdef _HPUX_SOURCE # include #else # include #endif #include "atomic_ops.h" /* Without cas emulation! */ #ifndef AO_HAVE_double_t # include "atomic_ops/sysdeps/standard_ao_double_t.h" #endif /* * Lock for pthreads-based implementation. */ pthread_mutex_t AO_pt_lock = PTHREAD_MUTEX_INITIALIZER; /* * Out of line compare-and-swap emulation based on test and set. * * We use a small table of locks for different compare_and_swap locations. * Before we update perform a compare-and-swap, we grap the corresponding * lock. Different locations may hash to the same lock, but since we * never acquire more than one lock at a time, this can't deadlock. * We explicitly disable signals while we perform this operation. * * FIXME: We should probably also suppport emulation based on Lamport * locks, since we may not have test_and_set either. */ #define AO_HASH_SIZE 16 #define AO_HASH(x) (((unsigned long)(x) >> 12) & (AO_HASH_SIZE-1)) AO_TS_t AO_locks[AO_HASH_SIZE] = { AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, }; static AO_T dummy = 1; /* Spin for 2**n units. */ void AO_spin(int n) { int i; AO_T j = AO_load(&dummy); for (i = 0; i < (2 << n); ++i) { j *= 5; j -= 4; } AO_store(&dummy, j); } void AO_pause(int n) { if (n < 12) AO_spin(n); else { struct timeval tv; /* Short async-signal-safe sleep. */ tv.tv_sec = 0; tv.tv_usec = (n > 28? 100000 : (1 << (n - 12))); select(0, 0, 0, 0, &tv); } } static void lock_ool(volatile AO_TS_t *l) { int i = 0; while (AO_test_and_set_acquire(l) == AO_TS_SET) AO_pause(++i); } AO_INLINE void lock(volatile AO_TS_t *l) { if (AO_test_and_set_acquire(l) == AO_TS_SET) lock_ool(l); } AO_INLINE void unlock(volatile AO_TS_t *l) { AO_CLEAR(l); } static sigset_t all_sigs; static volatile AO_t initialized = 0; static volatile AO_TS_t init_lock = AO_TS_INITIALIZER; int AO_compare_and_swap_emulation(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_TS_t *my_lock = AO_locks + AO_HASH(addr); sigset_t old_sigs; int result; if (!AO_load_acquire(&initialized)) { lock(&init_lock); if (!initialized) sigfillset(&all_sigs); unlock(&init_lock); AO_store_release(&initialized, 1); } sigprocmask(SIG_BLOCK, &all_sigs, &old_sigs); /* Neither sigprocmask nor pthread_sigmask is 100% */ /* guaranteed to work here. Sigprocmask is not */ /* guaranteed be thread safe, and pthread_sigmask */ /* is not async-signal-safe. Under linuxthreads, */ /* sigprocmask may block some pthreads-internal */ /* signals. So long as we do that for short periods, */ /* we should be OK. */ lock(my_lock); if (*addr == old) { *addr = new_val; result = 1; } else result = 0; unlock(my_lock); sigprocmask(SIG_SETMASK, &old_sigs, NULL); return result; } int AO_compare_double_and_swap_double_emulation(volatile AO_double_t *addr, AO_t old_val1, AO_t old_val2, AO_t new_val1, AO_t new_val2) { AO_TS_t *my_lock = AO_locks + AO_HASH(addr); sigset_t old_sigs; int result; if (!AO_load_acquire(&initialized)) { lock(&init_lock); if (!initialized) sigfillset(&all_sigs); unlock(&init_lock); AO_store_release(&initialized, 1); } sigprocmask(SIG_BLOCK, &all_sigs, &old_sigs); /* Neither sigprocmask nor pthread_sigmask is 100% */ /* guaranteed to work here. Sigprocmask is not */ /* guaranteed be thread safe, and pthread_sigmask */ /* is not async-signal-safe. Under linuxthreads, */ /* sigprocmask may block some pthreads-internal */ /* signals. So long as we do that for short periods, */ /* we should be OK. */ lock(my_lock); if (addr -> AO_val1 == old_val1 && addr -> AO_val2 == old_val2) { addr -> AO_val1 = new_val1; addr -> AO_val2 = new_val2; result = 1; } else result = 0; unlock(my_lock); sigprocmask(SIG_SETMASK, &old_sigs, NULL); return result; } void AO_store_full_emulation(volatile AO_t *addr, AO_t val) { AO_TS_t *my_lock = AO_locks + AO_HASH(addr); lock(my_lock); *addr = val; unlock(my_lock); } #else /* Non-posix platform */ int AO_non_posix_implementation_is_entirely_in_headers; #endif synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/config.h.in0000664000076400007640000000277611104702317023632 0ustar stefanstefan/* src/config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_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 /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/0000775000076400007640000000000011172123233023727 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/generalize-small.template0000664000076400007640000005073211104702317030727 0ustar stefanstefan/* XSIZE_load */ #if defined(AO_HAVE_XSIZE_load_acquire) && !defined(AO_HAVE_XSIZE_load) # define AO_XSIZE_load(addr) AO_XSIZE_load_acquire(addr) # define AO_HAVE_XSIZE_load #endif #if defined(AO_HAVE_XSIZE_load_full) && !defined(AO_HAVE_XSIZE_load_acquire) # define AO_XSIZE_load_acquire(addr) AO_XSIZE_load_full(addr) # define AO_HAVE_XSIZE_load_acquire #endif #if defined(AO_HAVE_XSIZE_load_full) && !defined(AO_HAVE_XSIZE_load_read) # define AO_XSIZE_load_read(addr) AO_XSIZE_load_full(addr) # define AO_HAVE_XSIZE_load_read #endif #if !defined(AO_HAVE_XSIZE_load_acquire_read) && defined(AO_HAVE_XSIZE_load_acquire) # define AO_XSIZE_load_acquire_read(addr) AO_XSIZE_load_acquire(addr) # define AO_HAVE_XSIZE_load_acquire_read #endif #if defined(AO_HAVE_XSIZE_load) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_XSIZE_load_acquire) AO_INLINE unsigned XCTYPE AO_XSIZE_load_acquire(volatile unsigned XCTYPE *addr) { unsigned XCTYPE result = AO_XSIZE_load(addr); /* Acquire barrier would be useless, since the load could be delayed */ /* beyond it. */ AO_nop_full(); return result; } # define AO_HAVE_XSIZE_load_acquire #endif #if defined(AO_HAVE_XSIZE_load) && defined(AO_HAVE_nop_read) && \ !defined(AO_HAVE_XSIZE_load_read) AO_INLINE unsigned XCTYPE AO_XSIZE_load_read(volatile unsigned XCTYPE *addr) { unsigned XCTYPE result = AO_XSIZE_load(addr); /* Acquire barrier would be useless, since the load could be delayed */ /* beyond it. */ AO_nop_read(); return result; } # define AO_HAVE_XSIZE_load_read #endif #if defined(AO_HAVE_XSIZE_load_acquire) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_XSIZE_load_full) # define AO_XSIZE_load_full(addr) (AO_nop_full(), AO_XSIZE_load_acquire(addr)) # define AO_HAVE_XSIZE_load_full #endif #if !defined(AO_HAVE_XSIZE_load_acquire_read) && defined(AO_HAVE_XSIZE_load_read) # define AO_XSIZE_load_acquire_read(addr) AO_XSIZE_load_read(addr) # define AO_HAVE_XSIZE_load_acquire_read #endif #if defined(AO_HAVE_XSIZE_load_acquire_read) && !defined(AO_HAVE_XSIZE_load) # define AO_XSIZE_load(addr) AO_XSIZE_load_acquire_read(addr) # define AO_HAVE_XSIZE_load #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_XSIZE_load_acquire_read) # define AO_XSIZE_load_dd_acquire_read(addr) \ AO_XSIZE_load_acquire_read(addr) # define AO_HAVE_XSIZE_load_dd_acquire_read # endif #else # if defined(AO_HAVE_XSIZE_load) # define AO_XSIZE_load_dd_acquire_read(addr) \ AO_XSIZE_load(addr) # define AO_HAVE_XSIZE_load_dd_acquire_read # endif #endif /* XSIZE_store */ #if defined(AO_HAVE_XSIZE_store_release) && !defined(AO_HAVE_XSIZE_store) # define AO_XSIZE_store(addr, val) AO_XSIZE_store_release(addr,val) # define AO_HAVE_XSIZE_store #endif #if defined(AO_HAVE_XSIZE_store_full) && !defined(AO_HAVE_XSIZE_store_release) # define AO_XSIZE_store_release(addr,val) AO_XSIZE_store_full(addr,val) # define AO_HAVE_XSIZE_store_release #endif #if defined(AO_HAVE_XSIZE_store_full) && !defined(AO_HAVE_XSIZE_store_write) # define AO_XSIZE_store_write(addr,val) AO_XSIZE_store_full(addr,val) # define AO_HAVE_XSIZE_store_write #endif #if defined(AO_HAVE_XSIZE_store_release) && \ !defined(AO_HAVE_XSIZE_store_release_write) # define AO_XSIZE_store_release_write(addr, val) \ AO_XSIZE_store_release(addr,val) # define AO_HAVE_XSIZE_store_release_write #endif #if defined(AO_HAVE_XSIZE_store_write) && !defined(AO_HAVE_XSIZE_store) # define AO_XSIZE_store(addr, val) AO_XSIZE_store_write(addr,val) # define AO_HAVE_XSIZE_store #endif #if defined(AO_HAVE_XSIZE_store) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_XSIZE_store_release) # define AO_XSIZE_store_release(addr,val) \ (AO_nop_full(), AO_XSIZE_store(addr,val)) # define AO_HAVE_XSIZE_store_release #endif #if defined(AO_HAVE_nop_write) && defined(AO_HAVE_XSIZE_store) && \ !defined(AO_HAVE_XSIZE_store_write) # define AO_XSIZE_store_write(addr, val) \ (AO_nop_write(), AO_XSIZE_store(addr,val)) # define AO_HAVE_XSIZE_store_write #endif #if defined(AO_HAVE_XSIZE_store_write) && \ !defined(AO_HAVE_XSIZE_store_release_write) # define AO_XSIZE_store_release_write(addr, val) AO_XSIZE_store_write(addr,val) # define AO_HAVE_XSIZE_store_release_write #endif #if defined(AO_HAVE_XSIZE_store_release) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_XSIZE_store_full) # define AO_XSIZE_store_full(addr, val) \ (AO_XSIZE_store_release(addr, val), AO_nop_full()) # define AO_HAVE_XSIZE_store_full #endif /* XSIZE_fetch_and_add */ #if defined(AO_HAVE_XSIZE_compare_and_swap_full) && \ !defined(AO_HAVE_XSIZE_fetch_and_add_full) AO_INLINE AO_t AO_XSIZE_fetch_and_add_full(volatile unsigned XCTYPE *addr, unsigned XCTYPE incr) { unsigned XCTYPE old; do { old = *addr; } while (!AO_XSIZE_compare_and_swap_full(addr, old, old+incr)); return old; } # define AO_HAVE_XSIZE_fetch_and_add_full #endif #if defined(AO_HAVE_XSIZE_compare_and_swap_acquire) && \ !defined(AO_HAVE_XSIZE_fetch_and_add_acquire) AO_INLINE AO_t AO_XSIZE_fetch_and_add_acquire(volatile unsigned XCTYPE *addr, unsigned XCTYPE incr) { unsigned XCTYPE old; do { old = *addr; } while (!AO_XSIZE_compare_and_swap_acquire(addr, old, old+incr)); return old; } # define AO_HAVE_XSIZE_fetch_and_add_acquire #endif #if defined(AO_HAVE_XSIZE_compare_and_swap_release) && \ !defined(AO_HAVE_XSIZE_fetch_and_add_release) AO_INLINE AO_t AO_XSIZE_fetch_and_add_release(volatile unsigned XCTYPE *addr, unsigned XCTYPE incr) { unsigned XCTYPE old; do { old = *addr; } while (!AO_XSIZE_compare_and_swap_release(addr, old, old+incr)); return old; } # define AO_HAVE_XSIZE_fetch_and_add_release #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_full) # if !defined(AO_HAVE_XSIZE_fetch_and_add_release) # define AO_XSIZE_fetch_and_add_release(addr, val) \ AO_XSIZE_fetch_and_add_full(addr, val) # define AO_HAVE_XSIZE_fetch_and_add_release # endif # if !defined(AO_HAVE_XSIZE_fetch_and_add_acquire) # define AO_XSIZE_fetch_and_add_acquire(addr, val) \ AO_XSIZE_fetch_and_add_full(addr, val) # define AO_HAVE_XSIZE_fetch_and_add_acquire # endif # if !defined(AO_HAVE_XSIZE_fetch_and_add_write) # define AO_XSIZE_fetch_and_add_write(addr, val) \ AO_XSIZE_fetch_and_add_full(addr, val) # define AO_HAVE_XSIZE_fetch_and_add_write # endif # if !defined(AO_HAVE_XSIZE_fetch_and_add_read) # define AO_XSIZE_fetch_and_add_read(addr, val) \ AO_XSIZE_fetch_and_add_full(addr, val) # define AO_HAVE_XSIZE_fetch_and_add_read # endif #endif /* AO_HAVE_XSIZE_fetch_and_add_full */ #if !defined(AO_HAVE_XSIZE_fetch_and_add) && \ defined(AO_HAVE_XSIZE_fetch_and_add_release) # define AO_XSIZE_fetch_and_add(addr, val) \ AO_XSIZE_fetch_and_add_release(addr, val) # define AO_HAVE_XSIZE_fetch_and_add #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add) && \ defined(AO_HAVE_XSIZE_fetch_and_add_acquire) # define AO_XSIZE_fetch_and_add(addr, val) \ AO_XSIZE_fetch_and_add_acquire(addr, val) # define AO_HAVE_XSIZE_fetch_and_add #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add) && \ defined(AO_HAVE_XSIZE_fetch_and_add_write) # define AO_XSIZE_fetch_and_add(addr, val) \ AO_XSIZE_fetch_and_add_write(addr, val) # define AO_HAVE_XSIZE_fetch_and_add #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add) && \ defined(AO_HAVE_XSIZE_fetch_and_add_read) # define AO_XSIZE_fetch_and_add(addr, val) \ AO_XSIZE_fetch_and_add_read(addr, val) # define AO_HAVE_XSIZE_fetch_and_add #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_XSIZE_fetch_and_add_full) # define AO_XSIZE_fetch_and_add_full(addr, val) \ (AO_nop_full(), AO_XSIZE_fetch_and_add_acquire(addr, val)) #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add_release_write) && \ defined(AO_HAVE_XSIZE_fetch_and_add_write) # define AO_XSIZE_fetch_and_add_release_write(addr, val) \ AO_XSIZE_fetch_and_add_write(addr, val) # define AO_HAVE_XSIZE_fetch_and_add_release_write #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add_release_write) && \ defined(AO_HAVE_XSIZE_fetch_and_add_release) # define AO_XSIZE_fetch_and_add_release_write(addr, val) \ AO_XSIZE_fetch_and_add_release(addr, val) # define AO_HAVE_XSIZE_fetch_and_add_release_write #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add_acquire_read) && \ defined(AO_HAVE_XSIZE_fetch_and_add_read) # define AO_XSIZE_fetch_and_add_acquire_read(addr, val) \ AO_XSIZE_fetch_and_add_read(addr, val) # define AO_HAVE_XSIZE_fetch_and_add_acquire_read #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add_acquire_read) && \ defined(AO_HAVE_XSIZE_fetch_and_add_acquire) # define AO_XSIZE_fetch_and_add_acquire_read(addr, val) \ AO_XSIZE_fetch_and_add_acquire(addr, val) # define AO_HAVE_XSIZE_fetch_and_add_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_XSIZE_fetch_and_add_acquire_read) # define AO_XSIZE_fetch_and_add_dd_acquire_read(addr, val) \ AO_XSIZE_fetch_and_add_acquire_read(addr, val) # define AO_HAVE_XSIZE_fetch_and_add_dd_acquire_read # endif #else # if defined(AO_HAVE_XSIZE_fetch_and_add) # define AO_XSIZE_fetch_and_add_dd_acquire_read(addr, val) \ AO_XSIZE_fetch_and_add(addr, val) # define AO_HAVE_XSIZE_fetch_and_add_dd_acquire_read # endif #endif /* XSIZE_fetch_and_add1 */ #if defined(AO_HAVE_XSIZE_fetch_and_add_full) &&\ !defined(AO_HAVE_XSIZE_fetch_and_add1_full) # define AO_XSIZE_fetch_and_add1_full(addr) \ AO_XSIZE_fetch_and_add_full(addr,1) # define AO_HAVE_XSIZE_fetch_and_add1_full #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_release) &&\ !defined(AO_HAVE_XSIZE_fetch_and_add1_release) # define AO_XSIZE_fetch_and_add1_release(addr) \ AO_XSIZE_fetch_and_add_release(addr,1) # define AO_HAVE_XSIZE_fetch_and_add1_release #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_acquire) &&\ !defined(AO_HAVE_XSIZE_fetch_and_add1_acquire) # define AO_XSIZE_fetch_and_add1_acquire(addr) \ AO_XSIZE_fetch_and_add_acquire(addr,1) # define AO_HAVE_XSIZE_fetch_and_add1_acquire #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_write) &&\ !defined(AO_HAVE_XSIZE_fetch_and_add1_write) # define AO_XSIZE_fetch_and_add1_write(addr) \ AO_XSIZE_fetch_and_add_write(addr,1) # define AO_HAVE_XSIZE_fetch_and_add1_write #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_read) &&\ !defined(AO_HAVE_XSIZE_fetch_and_add1_read) # define AO_XSIZE_fetch_and_add1_read(addr) \ AO_XSIZE_fetch_and_add_read(addr,1) # define AO_HAVE_XSIZE_fetch_and_add1_read #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_release_write) &&\ !defined(AO_HAVE_XSIZE_fetch_and_add1_release_write) # define AO_XSIZE_fetch_and_add1_release_write(addr) \ AO_XSIZE_fetch_and_add_release_write(addr,1) # define AO_HAVE_XSIZE_fetch_and_add1_release_write #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_acquire_read) &&\ !defined(AO_HAVE_XSIZE_fetch_and_add1_acquire_read) # define AO_XSIZE_fetch_and_add1_acquire_read(addr) \ AO_XSIZE_fetch_and_add_acquire_read(addr,1) # define AO_HAVE_XSIZE_fetch_and_add1_acquire_read #endif #if defined(AO_HAVE_XSIZE_fetch_and_add) &&\ !defined(AO_HAVE_XSIZE_fetch_and_add1) # define AO_XSIZE_fetch_and_add1(addr) \ AO_XSIZE_fetch_and_add(addr,1) # define AO_HAVE_XSIZE_fetch_and_add1 #endif #if defined(AO_HAVE_XSIZE_fetch_and_add1_full) # if !defined(AO_HAVE_XSIZE_fetch_and_add1_release) # define AO_XSIZE_fetch_and_add1_release(addr) \ AO_XSIZE_fetch_and_add1_full(addr) # define AO_HAVE_XSIZE_fetch_and_add1_release # endif # if !defined(AO_HAVE_XSIZE_fetch_and_add1_acquire) # define AO_XSIZE_fetch_and_add1_acquire(addr) \ AO_XSIZE_fetch_and_add1_full(addr) # define AO_HAVE_XSIZE_fetch_and_add1_acquire # endif # if !defined(AO_HAVE_XSIZE_fetch_and_add1_write) # define AO_XSIZE_fetch_and_add1_write(addr) \ AO_XSIZE_fetch_and_add1_full(addr) # define AO_HAVE_XSIZE_fetch_and_add1_write # endif # if !defined(AO_HAVE_XSIZE_fetch_and_add1_read) # define AO_XSIZE_fetch_and_add1_read(addr) \ AO_XSIZE_fetch_and_add1_full(addr) # define AO_HAVE_XSIZE_fetch_and_add1_read # endif #endif /* AO_HAVE_XSIZE_fetch_and_add1_full */ #if !defined(AO_HAVE_XSIZE_fetch_and_add1) && \ defined(AO_HAVE_XSIZE_fetch_and_add1_release) # define AO_XSIZE_fetch_and_add1(addr) \ AO_XSIZE_fetch_and_add1_release(addr) # define AO_HAVE_XSIZE_fetch_and_add1 #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add1) && \ defined(AO_HAVE_XSIZE_fetch_and_add1_acquire) # define AO_XSIZE_fetch_and_add1(addr) \ AO_XSIZE_fetch_and_add1_acquire(addr) # define AO_HAVE_XSIZE_fetch_and_add1 #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add1) && \ defined(AO_HAVE_XSIZE_fetch_and_add1_write) # define AO_XSIZE_fetch_and_add1(addr) \ AO_XSIZE_fetch_and_add1_write(addr) # define AO_HAVE_XSIZE_fetch_and_add1 #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add1) && \ defined(AO_HAVE_XSIZE_fetch_and_add1_read) # define AO_XSIZE_fetch_and_add1(addr) \ AO_XSIZE_fetch_and_add1_read(addr) # define AO_HAVE_XSIZE_fetch_and_add1 #endif #if defined(AO_HAVE_XSIZE_fetch_and_add1_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_XSIZE_fetch_and_add1_full) # define AO_XSIZE_fetch_and_add1_full(addr) \ (AO_nop_full(), AO_XSIZE_fetch_and_add1_acquire(addr)) # define AO_HAVE_XSIZE_fetch_and_add1_full #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add1_release_write) && \ defined(AO_HAVE_XSIZE_fetch_and_add1_write) # define AO_XSIZE_fetch_and_add1_release_write(addr) \ AO_XSIZE_fetch_and_add1_write(addr) # define AO_HAVE_XSIZE_fetch_and_add1_release_write #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add1_release_write) && \ defined(AO_HAVE_XSIZE_fetch_and_add1_release) # define AO_XSIZE_fetch_and_add1_release_write(addr) \ AO_XSIZE_fetch_and_add1_release(addr) # define AO_HAVE_XSIZE_fetch_and_add1_release_write #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add1_acquire_read) && \ defined(AO_HAVE_XSIZE_fetch_and_add1_read) # define AO_XSIZE_fetch_and_add1_acquire_read(addr) \ AO_XSIZE_fetch_and_add1_read(addr) # define AO_HAVE_XSIZE_fetch_and_add1_acquire_read #endif #if !defined(AO_HAVE_XSIZE_fetch_and_add1_acquire_read) && \ defined(AO_HAVE_XSIZE_fetch_and_add1_acquire) # define AO_XSIZE_fetch_and_add1_acquire_read(addr) \ AO_XSIZE_fetch_and_add1_acquire(addr) # define AO_HAVE_XSIZE_fetch_and_add1_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_XSIZE_fetch_and_add1_acquire_read) # define AO_XSIZE_fetch_and_add1_dd_acquire_read(addr) \ AO_XSIZE_fetch_and_add1_acquire_read(addr) # define AO_HAVE_XSIZE_fetch_and_add1_dd_acquire_read # endif #else # if defined(AO_HAVE_XSIZE_fetch_and_add1) # define AO_XSIZE_fetch_and_add1_dd_acquire_read(addr) \ AO_XSIZE_fetch_and_add1(addr) # define AO_HAVE_XSIZE_fetch_and_add1_dd_acquire_read # endif #endif /* XSIZE_fetch_and_sub1 */ #if defined(AO_HAVE_XSIZE_fetch_and_add_full) &&\ !defined(AO_HAVE_XSIZE_fetch_and_sub1_full) # define AO_XSIZE_fetch_and_sub1_full(addr) \ AO_XSIZE_fetch_and_add_full(addr,(unsigned XCTYPE)(-1)) # define AO_HAVE_XSIZE_fetch_and_sub1_full #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_release) &&\ !defined(AO_HAVE_XSIZE_fetch_and_sub1_release) # define AO_XSIZE_fetch_and_sub1_release(addr) \ AO_XSIZE_fetch_and_add_release(addr,(unsigned XCTYPE)(-1)) # define AO_HAVE_XSIZE_fetch_and_sub1_release #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_acquire) &&\ !defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire) # define AO_XSIZE_fetch_and_sub1_acquire(addr) \ AO_XSIZE_fetch_and_add_acquire(addr,(unsigned XCTYPE)(-1)) # define AO_HAVE_XSIZE_fetch_and_sub1_acquire #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_write) &&\ !defined(AO_HAVE_XSIZE_fetch_and_sub1_write) # define AO_XSIZE_fetch_and_sub1_write(addr) \ AO_XSIZE_fetch_and_add_write(addr,(unsigned XCTYPE)(-1)) # define AO_HAVE_XSIZE_fetch_and_sub1_write #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_read) &&\ !defined(AO_HAVE_XSIZE_fetch_and_sub1_read) # define AO_XSIZE_fetch_and_sub1_read(addr) \ AO_XSIZE_fetch_and_add_read(addr,(unsigned XCTYPE)(-1)) # define AO_HAVE_XSIZE_fetch_and_sub1_read #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_release_write) &&\ !defined(AO_HAVE_XSIZE_fetch_and_sub1_release_write) # define AO_XSIZE_fetch_and_sub1_release_write(addr) \ AO_XSIZE_fetch_and_add_release_write(addr,(unsigned XCTYPE)(-1)) # define AO_HAVE_XSIZE_fetch_and_sub1_release_write #endif #if defined(AO_HAVE_XSIZE_fetch_and_add_acquire_read) &&\ !defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire_read) # define AO_XSIZE_fetch_and_sub1_acquire_read(addr) \ AO_XSIZE_fetch_and_add_acquire_read(addr,(unsigned XCTYPE)(-1)) # define AO_HAVE_XSIZE_fetch_and_sub1_acquire_read #endif #if defined(AO_HAVE_XSIZE_fetch_and_add) &&\ !defined(AO_HAVE_XSIZE_fetch_and_sub1) # define AO_XSIZE_fetch_and_sub1(addr) \ AO_XSIZE_fetch_and_add(addr,(unsigned XCTYPE)(-1)) # define AO_HAVE_XSIZE_fetch_and_sub1 #endif #if defined(AO_HAVE_XSIZE_fetch_and_sub1_full) # if !defined(AO_HAVE_XSIZE_fetch_and_sub1_release) # define AO_XSIZE_fetch_and_sub1_release(addr) \ AO_XSIZE_fetch_and_sub1_full(addr) # define AO_HAVE_XSIZE_fetch_and_sub1_release # endif # if !defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire) # define AO_XSIZE_fetch_and_sub1_acquire(addr) \ AO_XSIZE_fetch_and_sub1_full(addr) # define AO_HAVE_XSIZE_fetch_and_sub1_acquire # endif # if !defined(AO_HAVE_XSIZE_fetch_and_sub1_write) # define AO_XSIZE_fetch_and_sub1_write(addr) \ AO_XSIZE_fetch_and_sub1_full(addr) # define AO_HAVE_XSIZE_fetch_and_sub1_write # endif # if !defined(AO_HAVE_XSIZE_fetch_and_sub1_read) # define AO_XSIZE_fetch_and_sub1_read(addr) \ AO_XSIZE_fetch_and_sub1_full(addr) # define AO_HAVE_XSIZE_fetch_and_sub1_read # endif #endif /* AO_HAVE_XSIZE_fetch_and_sub1_full */ #if !defined(AO_HAVE_XSIZE_fetch_and_sub1) && \ defined(AO_HAVE_XSIZE_fetch_and_sub1_release) # define AO_XSIZE_fetch_and_sub1(addr) \ AO_XSIZE_fetch_and_sub1_release(addr) # define AO_HAVE_XSIZE_fetch_and_sub1 #endif #if !defined(AO_HAVE_XSIZE_fetch_and_sub1) && \ defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire) # define AO_XSIZE_fetch_and_sub1(addr) \ AO_XSIZE_fetch_and_sub1_acquire(addr) # define AO_HAVE_XSIZE_fetch_and_sub1 #endif #if !defined(AO_HAVE_XSIZE_fetch_and_sub1) && \ defined(AO_HAVE_XSIZE_fetch_and_sub1_write) # define AO_XSIZE_fetch_and_sub1(addr) \ AO_XSIZE_fetch_and_sub1_write(addr) # define AO_HAVE_XSIZE_fetch_and_sub1 #endif #if !defined(AO_HAVE_XSIZE_fetch_and_sub1) && \ defined(AO_HAVE_XSIZE_fetch_and_sub1_read) # define AO_XSIZE_fetch_and_sub1(addr) \ AO_XSIZE_fetch_and_sub1_read(addr) # define AO_HAVE_XSIZE_fetch_and_sub1 #endif #if defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_XSIZE_fetch_and_sub1_full) # define AO_XSIZE_fetch_and_sub1_full(addr) \ (AO_nop_full(), AO_XSIZE_fetch_and_sub1_acquire(addr)) # define AO_HAVE_XSIZE_fetch_and_sub1_full #endif #if !defined(AO_HAVE_XSIZE_fetch_and_sub1_release_write) && \ defined(AO_HAVE_XSIZE_fetch_and_sub1_write) # define AO_XSIZE_fetch_and_sub1_release_write(addr) \ AO_XSIZE_fetch_and_sub1_write(addr) # define AO_HAVE_XSIZE_fetch_and_sub1_release_write #endif #if !defined(AO_HAVE_XSIZE_fetch_and_sub1_release_write) && \ defined(AO_HAVE_XSIZE_fetch_and_sub1_release) # define AO_XSIZE_fetch_and_sub1_release_write(addr) \ AO_XSIZE_fetch_and_sub1_release(addr) # define AO_HAVE_XSIZE_fetch_and_sub1_release_write #endif #if !defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire_read) && \ defined(AO_HAVE_XSIZE_fetch_and_sub1_read) # define AO_XSIZE_fetch_and_sub1_acquire_read(addr) \ AO_XSIZE_fetch_and_sub1_read(addr) # define AO_HAVE_XSIZE_fetch_and_sub1_acquire_read #endif #if !defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire_read) && \ defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire) # define AO_XSIZE_fetch_and_sub1_acquire_read(addr) \ AO_XSIZE_fetch_and_sub1_acquire(addr) # define AO_HAVE_XSIZE_fetch_and_sub1_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_XSIZE_fetch_and_sub1_acquire_read) # define AO_XSIZE_fetch_and_sub1_dd_acquire_read(addr) \ AO_XSIZE_fetch_and_sub1_acquire_read(addr) # define AO_HAVE_XSIZE_fetch_and_sub1_dd_acquire_read # endif #else # if defined(AO_HAVE_XSIZE_fetch_and_sub1) # define AO_XSIZE_fetch_and_sub1_dd_acquire_read(addr) \ AO_XSIZE_fetch_and_sub1(addr) # define AO_HAVE_XSIZE_fetch_and_sub1_dd_acquire_read # endif #endif synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/generalize-small.h0000664000076400007640000017006611104702317027346 0ustar stefanstefan/* char_load */ #if defined(AO_HAVE_char_load_acquire) && !defined(AO_HAVE_char_load) # define AO_char_load(addr) AO_char_load_acquire(addr) # define AO_HAVE_char_load #endif #if defined(AO_HAVE_char_load_full) && !defined(AO_HAVE_char_load_acquire) # define AO_char_load_acquire(addr) AO_char_load_full(addr) # define AO_HAVE_char_load_acquire #endif #if defined(AO_HAVE_char_load_full) && !defined(AO_HAVE_char_load_read) # define AO_char_load_read(addr) AO_char_load_full(addr) # define AO_HAVE_char_load_read #endif #if !defined(AO_HAVE_char_load_acquire_read) && defined(AO_HAVE_char_load_acquire) # define AO_char_load_acquire_read(addr) AO_char_load_acquire(addr) # define AO_HAVE_char_load_acquire_read #endif #if defined(AO_HAVE_char_load) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_char_load_acquire) AO_INLINE unsigned char AO_char_load_acquire(volatile unsigned char *addr) { unsigned char result = AO_char_load(addr); /* Acquire barrier would be useless, since the load could be delayed */ /* beyond it. */ AO_nop_full(); return result; } # define AO_HAVE_char_load_acquire #endif #if defined(AO_HAVE_char_load) && defined(AO_HAVE_nop_read) && \ !defined(AO_HAVE_char_load_read) AO_INLINE unsigned char AO_char_load_read(volatile unsigned char *addr) { unsigned char result = AO_char_load(addr); /* Acquire barrier would be useless, since the load could be delayed */ /* beyond it. */ AO_nop_read(); return result; } # define AO_HAVE_char_load_read #endif #if defined(AO_HAVE_char_load_acquire) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_char_load_full) # define AO_char_load_full(addr) (AO_nop_full(), AO_char_load_acquire(addr)) # define AO_HAVE_char_load_full #endif #if !defined(AO_HAVE_char_load_acquire_read) && defined(AO_HAVE_char_load_read) # define AO_char_load_acquire_read(addr) AO_char_load_read(addr) # define AO_HAVE_char_load_acquire_read #endif #if defined(AO_HAVE_char_load_acquire_read) && !defined(AO_HAVE_char_load) # define AO_char_load(addr) AO_char_load_acquire_read(addr) # define AO_HAVE_char_load #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_char_load_acquire_read) # define AO_char_load_dd_acquire_read(addr) \ AO_char_load_acquire_read(addr) # define AO_HAVE_char_load_dd_acquire_read # endif #else # if defined(AO_HAVE_char_load) # define AO_char_load_dd_acquire_read(addr) \ AO_char_load(addr) # define AO_HAVE_char_load_dd_acquire_read # endif #endif /* char_store */ #if defined(AO_HAVE_char_store_release) && !defined(AO_HAVE_char_store) # define AO_char_store(addr, val) AO_char_store_release(addr,val) # define AO_HAVE_char_store #endif #if defined(AO_HAVE_char_store_full) && !defined(AO_HAVE_char_store_release) # define AO_char_store_release(addr,val) AO_char_store_full(addr,val) # define AO_HAVE_char_store_release #endif #if defined(AO_HAVE_char_store_full) && !defined(AO_HAVE_char_store_write) # define AO_char_store_write(addr,val) AO_char_store_full(addr,val) # define AO_HAVE_char_store_write #endif #if defined(AO_HAVE_char_store_release) && \ !defined(AO_HAVE_char_store_release_write) # define AO_char_store_release_write(addr, val) \ AO_char_store_release(addr,val) # define AO_HAVE_char_store_release_write #endif #if defined(AO_HAVE_char_store_write) && !defined(AO_HAVE_char_store) # define AO_char_store(addr, val) AO_char_store_write(addr,val) # define AO_HAVE_char_store #endif #if defined(AO_HAVE_char_store) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_char_store_release) # define AO_char_store_release(addr,val) \ (AO_nop_full(), AO_char_store(addr,val)) # define AO_HAVE_char_store_release #endif #if defined(AO_HAVE_nop_write) && defined(AO_HAVE_char_store) && \ !defined(AO_HAVE_char_store_write) # define AO_char_store_write(addr, val) \ (AO_nop_write(), AO_char_store(addr,val)) # define AO_HAVE_char_store_write #endif #if defined(AO_HAVE_char_store_write) && \ !defined(AO_HAVE_char_store_release_write) # define AO_char_store_release_write(addr, val) AO_char_store_write(addr,val) # define AO_HAVE_char_store_release_write #endif #if defined(AO_HAVE_char_store_release) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_char_store_full) # define AO_char_store_full(addr, val) \ (AO_char_store_release(addr, val), AO_nop_full()) # define AO_HAVE_char_store_full #endif /* char_fetch_and_add */ #if defined(AO_HAVE_char_compare_and_swap_full) && \ !defined(AO_HAVE_char_fetch_and_add_full) AO_INLINE AO_t AO_char_fetch_and_add_full(volatile unsigned char *addr, unsigned char incr) { unsigned char old; do { old = *addr; } while (!AO_char_compare_and_swap_full(addr, old, old+incr)); return old; } # define AO_HAVE_char_fetch_and_add_full #endif #if defined(AO_HAVE_char_compare_and_swap_acquire) && \ !defined(AO_HAVE_char_fetch_and_add_acquire) AO_INLINE AO_t AO_char_fetch_and_add_acquire(volatile unsigned char *addr, unsigned char incr) { unsigned char old; do { old = *addr; } while (!AO_char_compare_and_swap_acquire(addr, old, old+incr)); return old; } # define AO_HAVE_char_fetch_and_add_acquire #endif #if defined(AO_HAVE_char_compare_and_swap_release) && \ !defined(AO_HAVE_char_fetch_and_add_release) AO_INLINE AO_t AO_char_fetch_and_add_release(volatile unsigned char *addr, unsigned char incr) { unsigned char old; do { old = *addr; } while (!AO_char_compare_and_swap_release(addr, old, old+incr)); return old; } # define AO_HAVE_char_fetch_and_add_release #endif #if defined(AO_HAVE_char_fetch_and_add_full) # if !defined(AO_HAVE_char_fetch_and_add_release) # define AO_char_fetch_and_add_release(addr, val) \ AO_char_fetch_and_add_full(addr, val) # define AO_HAVE_char_fetch_and_add_release # endif # if !defined(AO_HAVE_char_fetch_and_add_acquire) # define AO_char_fetch_and_add_acquire(addr, val) \ AO_char_fetch_and_add_full(addr, val) # define AO_HAVE_char_fetch_and_add_acquire # endif # if !defined(AO_HAVE_char_fetch_and_add_write) # define AO_char_fetch_and_add_write(addr, val) \ AO_char_fetch_and_add_full(addr, val) # define AO_HAVE_char_fetch_and_add_write # endif # if !defined(AO_HAVE_char_fetch_and_add_read) # define AO_char_fetch_and_add_read(addr, val) \ AO_char_fetch_and_add_full(addr, val) # define AO_HAVE_char_fetch_and_add_read # endif #endif /* AO_HAVE_char_fetch_and_add_full */ #if !defined(AO_HAVE_char_fetch_and_add) && \ defined(AO_HAVE_char_fetch_and_add_release) # define AO_char_fetch_and_add(addr, val) \ AO_char_fetch_and_add_release(addr, val) # define AO_HAVE_char_fetch_and_add #endif #if !defined(AO_HAVE_char_fetch_and_add) && \ defined(AO_HAVE_char_fetch_and_add_acquire) # define AO_char_fetch_and_add(addr, val) \ AO_char_fetch_and_add_acquire(addr, val) # define AO_HAVE_char_fetch_and_add #endif #if !defined(AO_HAVE_char_fetch_and_add) && \ defined(AO_HAVE_char_fetch_and_add_write) # define AO_char_fetch_and_add(addr, val) \ AO_char_fetch_and_add_write(addr, val) # define AO_HAVE_char_fetch_and_add #endif #if !defined(AO_HAVE_char_fetch_and_add) && \ defined(AO_HAVE_char_fetch_and_add_read) # define AO_char_fetch_and_add(addr, val) \ AO_char_fetch_and_add_read(addr, val) # define AO_HAVE_char_fetch_and_add #endif #if defined(AO_HAVE_char_fetch_and_add_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_char_fetch_and_add_full) # define AO_char_fetch_and_add_full(addr, val) \ (AO_nop_full(), AO_char_fetch_and_add_acquire(addr, val)) #endif #if !defined(AO_HAVE_char_fetch_and_add_release_write) && \ defined(AO_HAVE_char_fetch_and_add_write) # define AO_char_fetch_and_add_release_write(addr, val) \ AO_char_fetch_and_add_write(addr, val) # define AO_HAVE_char_fetch_and_add_release_write #endif #if !defined(AO_HAVE_char_fetch_and_add_release_write) && \ defined(AO_HAVE_char_fetch_and_add_release) # define AO_char_fetch_and_add_release_write(addr, val) \ AO_char_fetch_and_add_release(addr, val) # define AO_HAVE_char_fetch_and_add_release_write #endif #if !defined(AO_HAVE_char_fetch_and_add_acquire_read) && \ defined(AO_HAVE_char_fetch_and_add_read) # define AO_char_fetch_and_add_acquire_read(addr, val) \ AO_char_fetch_and_add_read(addr, val) # define AO_HAVE_char_fetch_and_add_acquire_read #endif #if !defined(AO_HAVE_char_fetch_and_add_acquire_read) && \ defined(AO_HAVE_char_fetch_and_add_acquire) # define AO_char_fetch_and_add_acquire_read(addr, val) \ AO_char_fetch_and_add_acquire(addr, val) # define AO_HAVE_char_fetch_and_add_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_char_fetch_and_add_acquire_read) # define AO_char_fetch_and_add_dd_acquire_read(addr, val) \ AO_char_fetch_and_add_acquire_read(addr, val) # define AO_HAVE_char_fetch_and_add_dd_acquire_read # endif #else # if defined(AO_HAVE_char_fetch_and_add) # define AO_char_fetch_and_add_dd_acquire_read(addr, val) \ AO_char_fetch_and_add(addr, val) # define AO_HAVE_char_fetch_and_add_dd_acquire_read # endif #endif /* char_fetch_and_add1 */ #if defined(AO_HAVE_char_fetch_and_add_full) &&\ !defined(AO_HAVE_char_fetch_and_add1_full) # define AO_char_fetch_and_add1_full(addr) \ AO_char_fetch_and_add_full(addr,1) # define AO_HAVE_char_fetch_and_add1_full #endif #if defined(AO_HAVE_char_fetch_and_add_release) &&\ !defined(AO_HAVE_char_fetch_and_add1_release) # define AO_char_fetch_and_add1_release(addr) \ AO_char_fetch_and_add_release(addr,1) # define AO_HAVE_char_fetch_and_add1_release #endif #if defined(AO_HAVE_char_fetch_and_add_acquire) &&\ !defined(AO_HAVE_char_fetch_and_add1_acquire) # define AO_char_fetch_and_add1_acquire(addr) \ AO_char_fetch_and_add_acquire(addr,1) # define AO_HAVE_char_fetch_and_add1_acquire #endif #if defined(AO_HAVE_char_fetch_and_add_write) &&\ !defined(AO_HAVE_char_fetch_and_add1_write) # define AO_char_fetch_and_add1_write(addr) \ AO_char_fetch_and_add_write(addr,1) # define AO_HAVE_char_fetch_and_add1_write #endif #if defined(AO_HAVE_char_fetch_and_add_read) &&\ !defined(AO_HAVE_char_fetch_and_add1_read) # define AO_char_fetch_and_add1_read(addr) \ AO_char_fetch_and_add_read(addr,1) # define AO_HAVE_char_fetch_and_add1_read #endif #if defined(AO_HAVE_char_fetch_and_add_release_write) &&\ !defined(AO_HAVE_char_fetch_and_add1_release_write) # define AO_char_fetch_and_add1_release_write(addr) \ AO_char_fetch_and_add_release_write(addr,1) # define AO_HAVE_char_fetch_and_add1_release_write #endif #if defined(AO_HAVE_char_fetch_and_add_acquire_read) &&\ !defined(AO_HAVE_char_fetch_and_add1_acquire_read) # define AO_char_fetch_and_add1_acquire_read(addr) \ AO_char_fetch_and_add_acquire_read(addr,1) # define AO_HAVE_char_fetch_and_add1_acquire_read #endif #if defined(AO_HAVE_char_fetch_and_add) &&\ !defined(AO_HAVE_char_fetch_and_add1) # define AO_char_fetch_and_add1(addr) \ AO_char_fetch_and_add(addr,1) # define AO_HAVE_char_fetch_and_add1 #endif #if defined(AO_HAVE_char_fetch_and_add1_full) # if !defined(AO_HAVE_char_fetch_and_add1_release) # define AO_char_fetch_and_add1_release(addr) \ AO_char_fetch_and_add1_full(addr) # define AO_HAVE_char_fetch_and_add1_release # endif # if !defined(AO_HAVE_char_fetch_and_add1_acquire) # define AO_char_fetch_and_add1_acquire(addr) \ AO_char_fetch_and_add1_full(addr) # define AO_HAVE_char_fetch_and_add1_acquire # endif # if !defined(AO_HAVE_char_fetch_and_add1_write) # define AO_char_fetch_and_add1_write(addr) \ AO_char_fetch_and_add1_full(addr) # define AO_HAVE_char_fetch_and_add1_write # endif # if !defined(AO_HAVE_char_fetch_and_add1_read) # define AO_char_fetch_and_add1_read(addr) \ AO_char_fetch_and_add1_full(addr) # define AO_HAVE_char_fetch_and_add1_read # endif #endif /* AO_HAVE_char_fetch_and_add1_full */ #if !defined(AO_HAVE_char_fetch_and_add1) && \ defined(AO_HAVE_char_fetch_and_add1_release) # define AO_char_fetch_and_add1(addr) \ AO_char_fetch_and_add1_release(addr) # define AO_HAVE_char_fetch_and_add1 #endif #if !defined(AO_HAVE_char_fetch_and_add1) && \ defined(AO_HAVE_char_fetch_and_add1_acquire) # define AO_char_fetch_and_add1(addr) \ AO_char_fetch_and_add1_acquire(addr) # define AO_HAVE_char_fetch_and_add1 #endif #if !defined(AO_HAVE_char_fetch_and_add1) && \ defined(AO_HAVE_char_fetch_and_add1_write) # define AO_char_fetch_and_add1(addr) \ AO_char_fetch_and_add1_write(addr) # define AO_HAVE_char_fetch_and_add1 #endif #if !defined(AO_HAVE_char_fetch_and_add1) && \ defined(AO_HAVE_char_fetch_and_add1_read) # define AO_char_fetch_and_add1(addr) \ AO_char_fetch_and_add1_read(addr) # define AO_HAVE_char_fetch_and_add1 #endif #if defined(AO_HAVE_char_fetch_and_add1_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_char_fetch_and_add1_full) # define AO_char_fetch_and_add1_full(addr) \ (AO_nop_full(), AO_char_fetch_and_add1_acquire(addr)) # define AO_HAVE_char_fetch_and_add1_full #endif #if !defined(AO_HAVE_char_fetch_and_add1_release_write) && \ defined(AO_HAVE_char_fetch_and_add1_write) # define AO_char_fetch_and_add1_release_write(addr) \ AO_char_fetch_and_add1_write(addr) # define AO_HAVE_char_fetch_and_add1_release_write #endif #if !defined(AO_HAVE_char_fetch_and_add1_release_write) && \ defined(AO_HAVE_char_fetch_and_add1_release) # define AO_char_fetch_and_add1_release_write(addr) \ AO_char_fetch_and_add1_release(addr) # define AO_HAVE_char_fetch_and_add1_release_write #endif #if !defined(AO_HAVE_char_fetch_and_add1_acquire_read) && \ defined(AO_HAVE_char_fetch_and_add1_read) # define AO_char_fetch_and_add1_acquire_read(addr) \ AO_char_fetch_and_add1_read(addr) # define AO_HAVE_char_fetch_and_add1_acquire_read #endif #if !defined(AO_HAVE_char_fetch_and_add1_acquire_read) && \ defined(AO_HAVE_char_fetch_and_add1_acquire) # define AO_char_fetch_and_add1_acquire_read(addr) \ AO_char_fetch_and_add1_acquire(addr) # define AO_HAVE_char_fetch_and_add1_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_char_fetch_and_add1_acquire_read) # define AO_char_fetch_and_add1_dd_acquire_read(addr) \ AO_char_fetch_and_add1_acquire_read(addr) # define AO_HAVE_char_fetch_and_add1_dd_acquire_read # endif #else # if defined(AO_HAVE_char_fetch_and_add1) # define AO_char_fetch_and_add1_dd_acquire_read(addr) \ AO_char_fetch_and_add1(addr) # define AO_HAVE_char_fetch_and_add1_dd_acquire_read # endif #endif /* char_fetch_and_sub1 */ #if defined(AO_HAVE_char_fetch_and_add_full) &&\ !defined(AO_HAVE_char_fetch_and_sub1_full) # define AO_char_fetch_and_sub1_full(addr) \ AO_char_fetch_and_add_full(addr,(unsigned char)(-1)) # define AO_HAVE_char_fetch_and_sub1_full #endif #if defined(AO_HAVE_char_fetch_and_add_release) &&\ !defined(AO_HAVE_char_fetch_and_sub1_release) # define AO_char_fetch_and_sub1_release(addr) \ AO_char_fetch_and_add_release(addr,(unsigned char)(-1)) # define AO_HAVE_char_fetch_and_sub1_release #endif #if defined(AO_HAVE_char_fetch_and_add_acquire) &&\ !defined(AO_HAVE_char_fetch_and_sub1_acquire) # define AO_char_fetch_and_sub1_acquire(addr) \ AO_char_fetch_and_add_acquire(addr,(unsigned char)(-1)) # define AO_HAVE_char_fetch_and_sub1_acquire #endif #if defined(AO_HAVE_char_fetch_and_add_write) &&\ !defined(AO_HAVE_char_fetch_and_sub1_write) # define AO_char_fetch_and_sub1_write(addr) \ AO_char_fetch_and_add_write(addr,(unsigned char)(-1)) # define AO_HAVE_char_fetch_and_sub1_write #endif #if defined(AO_HAVE_char_fetch_and_add_read) &&\ !defined(AO_HAVE_char_fetch_and_sub1_read) # define AO_char_fetch_and_sub1_read(addr) \ AO_char_fetch_and_add_read(addr,(unsigned char)(-1)) # define AO_HAVE_char_fetch_and_sub1_read #endif #if defined(AO_HAVE_char_fetch_and_add_release_write) &&\ !defined(AO_HAVE_char_fetch_and_sub1_release_write) # define AO_char_fetch_and_sub1_release_write(addr) \ AO_char_fetch_and_add_release_write(addr,(unsigned char)(-1)) # define AO_HAVE_char_fetch_and_sub1_release_write #endif #if defined(AO_HAVE_char_fetch_and_add_acquire_read) &&\ !defined(AO_HAVE_char_fetch_and_sub1_acquire_read) # define AO_char_fetch_and_sub1_acquire_read(addr) \ AO_char_fetch_and_add_acquire_read(addr,(unsigned char)(-1)) # define AO_HAVE_char_fetch_and_sub1_acquire_read #endif #if defined(AO_HAVE_char_fetch_and_add) &&\ !defined(AO_HAVE_char_fetch_and_sub1) # define AO_char_fetch_and_sub1(addr) \ AO_char_fetch_and_add(addr,(unsigned char)(-1)) # define AO_HAVE_char_fetch_and_sub1 #endif #if defined(AO_HAVE_char_fetch_and_sub1_full) # if !defined(AO_HAVE_char_fetch_and_sub1_release) # define AO_char_fetch_and_sub1_release(addr) \ AO_char_fetch_and_sub1_full(addr) # define AO_HAVE_char_fetch_and_sub1_release # endif # if !defined(AO_HAVE_char_fetch_and_sub1_acquire) # define AO_char_fetch_and_sub1_acquire(addr) \ AO_char_fetch_and_sub1_full(addr) # define AO_HAVE_char_fetch_and_sub1_acquire # endif # if !defined(AO_HAVE_char_fetch_and_sub1_write) # define AO_char_fetch_and_sub1_write(addr) \ AO_char_fetch_and_sub1_full(addr) # define AO_HAVE_char_fetch_and_sub1_write # endif # if !defined(AO_HAVE_char_fetch_and_sub1_read) # define AO_char_fetch_and_sub1_read(addr) \ AO_char_fetch_and_sub1_full(addr) # define AO_HAVE_char_fetch_and_sub1_read # endif #endif /* AO_HAVE_char_fetch_and_sub1_full */ #if !defined(AO_HAVE_char_fetch_and_sub1) && \ defined(AO_HAVE_char_fetch_and_sub1_release) # define AO_char_fetch_and_sub1(addr) \ AO_char_fetch_and_sub1_release(addr) # define AO_HAVE_char_fetch_and_sub1 #endif #if !defined(AO_HAVE_char_fetch_and_sub1) && \ defined(AO_HAVE_char_fetch_and_sub1_acquire) # define AO_char_fetch_and_sub1(addr) \ AO_char_fetch_and_sub1_acquire(addr) # define AO_HAVE_char_fetch_and_sub1 #endif #if !defined(AO_HAVE_char_fetch_and_sub1) && \ defined(AO_HAVE_char_fetch_and_sub1_write) # define AO_char_fetch_and_sub1(addr) \ AO_char_fetch_and_sub1_write(addr) # define AO_HAVE_char_fetch_and_sub1 #endif #if !defined(AO_HAVE_char_fetch_and_sub1) && \ defined(AO_HAVE_char_fetch_and_sub1_read) # define AO_char_fetch_and_sub1(addr) \ AO_char_fetch_and_sub1_read(addr) # define AO_HAVE_char_fetch_and_sub1 #endif #if defined(AO_HAVE_char_fetch_and_sub1_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_char_fetch_and_sub1_full) # define AO_char_fetch_and_sub1_full(addr) \ (AO_nop_full(), AO_char_fetch_and_sub1_acquire(addr)) # define AO_HAVE_char_fetch_and_sub1_full #endif #if !defined(AO_HAVE_char_fetch_and_sub1_release_write) && \ defined(AO_HAVE_char_fetch_and_sub1_write) # define AO_char_fetch_and_sub1_release_write(addr) \ AO_char_fetch_and_sub1_write(addr) # define AO_HAVE_char_fetch_and_sub1_release_write #endif #if !defined(AO_HAVE_char_fetch_and_sub1_release_write) && \ defined(AO_HAVE_char_fetch_and_sub1_release) # define AO_char_fetch_and_sub1_release_write(addr) \ AO_char_fetch_and_sub1_release(addr) # define AO_HAVE_char_fetch_and_sub1_release_write #endif #if !defined(AO_HAVE_char_fetch_and_sub1_acquire_read) && \ defined(AO_HAVE_char_fetch_and_sub1_read) # define AO_char_fetch_and_sub1_acquire_read(addr) \ AO_char_fetch_and_sub1_read(addr) # define AO_HAVE_char_fetch_and_sub1_acquire_read #endif #if !defined(AO_HAVE_char_fetch_and_sub1_acquire_read) && \ defined(AO_HAVE_char_fetch_and_sub1_acquire) # define AO_char_fetch_and_sub1_acquire_read(addr) \ AO_char_fetch_and_sub1_acquire(addr) # define AO_HAVE_char_fetch_and_sub1_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_char_fetch_and_sub1_acquire_read) # define AO_char_fetch_and_sub1_dd_acquire_read(addr) \ AO_char_fetch_and_sub1_acquire_read(addr) # define AO_HAVE_char_fetch_and_sub1_dd_acquire_read # endif #else # if defined(AO_HAVE_char_fetch_and_sub1) # define AO_char_fetch_and_sub1_dd_acquire_read(addr) \ AO_char_fetch_and_sub1(addr) # define AO_HAVE_char_fetch_and_sub1_dd_acquire_read # endif #endif /* short_load */ #if defined(AO_HAVE_short_load_acquire) && !defined(AO_HAVE_short_load) # define AO_short_load(addr) AO_short_load_acquire(addr) # define AO_HAVE_short_load #endif #if defined(AO_HAVE_short_load_full) && !defined(AO_HAVE_short_load_acquire) # define AO_short_load_acquire(addr) AO_short_load_full(addr) # define AO_HAVE_short_load_acquire #endif #if defined(AO_HAVE_short_load_full) && !defined(AO_HAVE_short_load_read) # define AO_short_load_read(addr) AO_short_load_full(addr) # define AO_HAVE_short_load_read #endif #if !defined(AO_HAVE_short_load_acquire_read) && defined(AO_HAVE_short_load_acquire) # define AO_short_load_acquire_read(addr) AO_short_load_acquire(addr) # define AO_HAVE_short_load_acquire_read #endif #if defined(AO_HAVE_short_load) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_short_load_acquire) AO_INLINE unsigned short AO_short_load_acquire(volatile unsigned short *addr) { unsigned short result = AO_short_load(addr); /* Acquire barrier would be useless, since the load could be delayed */ /* beyond it. */ AO_nop_full(); return result; } # define AO_HAVE_short_load_acquire #endif #if defined(AO_HAVE_short_load) && defined(AO_HAVE_nop_read) && \ !defined(AO_HAVE_short_load_read) AO_INLINE unsigned short AO_short_load_read(volatile unsigned short *addr) { unsigned short result = AO_short_load(addr); /* Acquire barrier would be useless, since the load could be delayed */ /* beyond it. */ AO_nop_read(); return result; } # define AO_HAVE_short_load_read #endif #if defined(AO_HAVE_short_load_acquire) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_short_load_full) # define AO_short_load_full(addr) (AO_nop_full(), AO_short_load_acquire(addr)) # define AO_HAVE_short_load_full #endif #if !defined(AO_HAVE_short_load_acquire_read) && defined(AO_HAVE_short_load_read) # define AO_short_load_acquire_read(addr) AO_short_load_read(addr) # define AO_HAVE_short_load_acquire_read #endif #if defined(AO_HAVE_short_load_acquire_read) && !defined(AO_HAVE_short_load) # define AO_short_load(addr) AO_short_load_acquire_read(addr) # define AO_HAVE_short_load #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_short_load_acquire_read) # define AO_short_load_dd_acquire_read(addr) \ AO_short_load_acquire_read(addr) # define AO_HAVE_short_load_dd_acquire_read # endif #else # if defined(AO_HAVE_short_load) # define AO_short_load_dd_acquire_read(addr) \ AO_short_load(addr) # define AO_HAVE_short_load_dd_acquire_read # endif #endif /* short_store */ #if defined(AO_HAVE_short_store_release) && !defined(AO_HAVE_short_store) # define AO_short_store(addr, val) AO_short_store_release(addr,val) # define AO_HAVE_short_store #endif #if defined(AO_HAVE_short_store_full) && !defined(AO_HAVE_short_store_release) # define AO_short_store_release(addr,val) AO_short_store_full(addr,val) # define AO_HAVE_short_store_release #endif #if defined(AO_HAVE_short_store_full) && !defined(AO_HAVE_short_store_write) # define AO_short_store_write(addr,val) AO_short_store_full(addr,val) # define AO_HAVE_short_store_write #endif #if defined(AO_HAVE_short_store_release) && \ !defined(AO_HAVE_short_store_release_write) # define AO_short_store_release_write(addr, val) \ AO_short_store_release(addr,val) # define AO_HAVE_short_store_release_write #endif #if defined(AO_HAVE_short_store_write) && !defined(AO_HAVE_short_store) # define AO_short_store(addr, val) AO_short_store_write(addr,val) # define AO_HAVE_short_store #endif #if defined(AO_HAVE_short_store) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_short_store_release) # define AO_short_store_release(addr,val) \ (AO_nop_full(), AO_short_store(addr,val)) # define AO_HAVE_short_store_release #endif #if defined(AO_HAVE_nop_write) && defined(AO_HAVE_short_store) && \ !defined(AO_HAVE_short_store_write) # define AO_short_store_write(addr, val) \ (AO_nop_write(), AO_short_store(addr,val)) # define AO_HAVE_short_store_write #endif #if defined(AO_HAVE_short_store_write) && \ !defined(AO_HAVE_short_store_release_write) # define AO_short_store_release_write(addr, val) AO_short_store_write(addr,val) # define AO_HAVE_short_store_release_write #endif #if defined(AO_HAVE_short_store_release) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_short_store_full) # define AO_short_store_full(addr, val) \ (AO_short_store_release(addr, val), AO_nop_full()) # define AO_HAVE_short_store_full #endif /* short_fetch_and_add */ #if defined(AO_HAVE_short_compare_and_swap_full) && \ !defined(AO_HAVE_short_fetch_and_add_full) AO_INLINE AO_t AO_short_fetch_and_add_full(volatile unsigned short *addr, unsigned short incr) { unsigned short old; do { old = *addr; } while (!AO_short_compare_and_swap_full(addr, old, old+incr)); return old; } # define AO_HAVE_short_fetch_and_add_full #endif #if defined(AO_HAVE_short_compare_and_swap_acquire) && \ !defined(AO_HAVE_short_fetch_and_add_acquire) AO_INLINE AO_t AO_short_fetch_and_add_acquire(volatile unsigned short *addr, unsigned short incr) { unsigned short old; do { old = *addr; } while (!AO_short_compare_and_swap_acquire(addr, old, old+incr)); return old; } # define AO_HAVE_short_fetch_and_add_acquire #endif #if defined(AO_HAVE_short_compare_and_swap_release) && \ !defined(AO_HAVE_short_fetch_and_add_release) AO_INLINE AO_t AO_short_fetch_and_add_release(volatile unsigned short *addr, unsigned short incr) { unsigned short old; do { old = *addr; } while (!AO_short_compare_and_swap_release(addr, old, old+incr)); return old; } # define AO_HAVE_short_fetch_and_add_release #endif #if defined(AO_HAVE_short_fetch_and_add_full) # if !defined(AO_HAVE_short_fetch_and_add_release) # define AO_short_fetch_and_add_release(addr, val) \ AO_short_fetch_and_add_full(addr, val) # define AO_HAVE_short_fetch_and_add_release # endif # if !defined(AO_HAVE_short_fetch_and_add_acquire) # define AO_short_fetch_and_add_acquire(addr, val) \ AO_short_fetch_and_add_full(addr, val) # define AO_HAVE_short_fetch_and_add_acquire # endif # if !defined(AO_HAVE_short_fetch_and_add_write) # define AO_short_fetch_and_add_write(addr, val) \ AO_short_fetch_and_add_full(addr, val) # define AO_HAVE_short_fetch_and_add_write # endif # if !defined(AO_HAVE_short_fetch_and_add_read) # define AO_short_fetch_and_add_read(addr, val) \ AO_short_fetch_and_add_full(addr, val) # define AO_HAVE_short_fetch_and_add_read # endif #endif /* AO_HAVE_short_fetch_and_add_full */ #if !defined(AO_HAVE_short_fetch_and_add) && \ defined(AO_HAVE_short_fetch_and_add_release) # define AO_short_fetch_and_add(addr, val) \ AO_short_fetch_and_add_release(addr, val) # define AO_HAVE_short_fetch_and_add #endif #if !defined(AO_HAVE_short_fetch_and_add) && \ defined(AO_HAVE_short_fetch_and_add_acquire) # define AO_short_fetch_and_add(addr, val) \ AO_short_fetch_and_add_acquire(addr, val) # define AO_HAVE_short_fetch_and_add #endif #if !defined(AO_HAVE_short_fetch_and_add) && \ defined(AO_HAVE_short_fetch_and_add_write) # define AO_short_fetch_and_add(addr, val) \ AO_short_fetch_and_add_write(addr, val) # define AO_HAVE_short_fetch_and_add #endif #if !defined(AO_HAVE_short_fetch_and_add) && \ defined(AO_HAVE_short_fetch_and_add_read) # define AO_short_fetch_and_add(addr, val) \ AO_short_fetch_and_add_read(addr, val) # define AO_HAVE_short_fetch_and_add #endif #if defined(AO_HAVE_short_fetch_and_add_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_short_fetch_and_add_full) # define AO_short_fetch_and_add_full(addr, val) \ (AO_nop_full(), AO_short_fetch_and_add_acquire(addr, val)) #endif #if !defined(AO_HAVE_short_fetch_and_add_release_write) && \ defined(AO_HAVE_short_fetch_and_add_write) # define AO_short_fetch_and_add_release_write(addr, val) \ AO_short_fetch_and_add_write(addr, val) # define AO_HAVE_short_fetch_and_add_release_write #endif #if !defined(AO_HAVE_short_fetch_and_add_release_write) && \ defined(AO_HAVE_short_fetch_and_add_release) # define AO_short_fetch_and_add_release_write(addr, val) \ AO_short_fetch_and_add_release(addr, val) # define AO_HAVE_short_fetch_and_add_release_write #endif #if !defined(AO_HAVE_short_fetch_and_add_acquire_read) && \ defined(AO_HAVE_short_fetch_and_add_read) # define AO_short_fetch_and_add_acquire_read(addr, val) \ AO_short_fetch_and_add_read(addr, val) # define AO_HAVE_short_fetch_and_add_acquire_read #endif #if !defined(AO_HAVE_short_fetch_and_add_acquire_read) && \ defined(AO_HAVE_short_fetch_and_add_acquire) # define AO_short_fetch_and_add_acquire_read(addr, val) \ AO_short_fetch_and_add_acquire(addr, val) # define AO_HAVE_short_fetch_and_add_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_short_fetch_and_add_acquire_read) # define AO_short_fetch_and_add_dd_acquire_read(addr, val) \ AO_short_fetch_and_add_acquire_read(addr, val) # define AO_HAVE_short_fetch_and_add_dd_acquire_read # endif #else # if defined(AO_HAVE_short_fetch_and_add) # define AO_short_fetch_and_add_dd_acquire_read(addr, val) \ AO_short_fetch_and_add(addr, val) # define AO_HAVE_short_fetch_and_add_dd_acquire_read # endif #endif /* short_fetch_and_add1 */ #if defined(AO_HAVE_short_fetch_and_add_full) &&\ !defined(AO_HAVE_short_fetch_and_add1_full) # define AO_short_fetch_and_add1_full(addr) \ AO_short_fetch_and_add_full(addr,1) # define AO_HAVE_short_fetch_and_add1_full #endif #if defined(AO_HAVE_short_fetch_and_add_release) &&\ !defined(AO_HAVE_short_fetch_and_add1_release) # define AO_short_fetch_and_add1_release(addr) \ AO_short_fetch_and_add_release(addr,1) # define AO_HAVE_short_fetch_and_add1_release #endif #if defined(AO_HAVE_short_fetch_and_add_acquire) &&\ !defined(AO_HAVE_short_fetch_and_add1_acquire) # define AO_short_fetch_and_add1_acquire(addr) \ AO_short_fetch_and_add_acquire(addr,1) # define AO_HAVE_short_fetch_and_add1_acquire #endif #if defined(AO_HAVE_short_fetch_and_add_write) &&\ !defined(AO_HAVE_short_fetch_and_add1_write) # define AO_short_fetch_and_add1_write(addr) \ AO_short_fetch_and_add_write(addr,1) # define AO_HAVE_short_fetch_and_add1_write #endif #if defined(AO_HAVE_short_fetch_and_add_read) &&\ !defined(AO_HAVE_short_fetch_and_add1_read) # define AO_short_fetch_and_add1_read(addr) \ AO_short_fetch_and_add_read(addr,1) # define AO_HAVE_short_fetch_and_add1_read #endif #if defined(AO_HAVE_short_fetch_and_add_release_write) &&\ !defined(AO_HAVE_short_fetch_and_add1_release_write) # define AO_short_fetch_and_add1_release_write(addr) \ AO_short_fetch_and_add_release_write(addr,1) # define AO_HAVE_short_fetch_and_add1_release_write #endif #if defined(AO_HAVE_short_fetch_and_add_acquire_read) &&\ !defined(AO_HAVE_short_fetch_and_add1_acquire_read) # define AO_short_fetch_and_add1_acquire_read(addr) \ AO_short_fetch_and_add_acquire_read(addr,1) # define AO_HAVE_short_fetch_and_add1_acquire_read #endif #if defined(AO_HAVE_short_fetch_and_add) &&\ !defined(AO_HAVE_short_fetch_and_add1) # define AO_short_fetch_and_add1(addr) \ AO_short_fetch_and_add(addr,1) # define AO_HAVE_short_fetch_and_add1 #endif #if defined(AO_HAVE_short_fetch_and_add1_full) # if !defined(AO_HAVE_short_fetch_and_add1_release) # define AO_short_fetch_and_add1_release(addr) \ AO_short_fetch_and_add1_full(addr) # define AO_HAVE_short_fetch_and_add1_release # endif # if !defined(AO_HAVE_short_fetch_and_add1_acquire) # define AO_short_fetch_and_add1_acquire(addr) \ AO_short_fetch_and_add1_full(addr) # define AO_HAVE_short_fetch_and_add1_acquire # endif # if !defined(AO_HAVE_short_fetch_and_add1_write) # define AO_short_fetch_and_add1_write(addr) \ AO_short_fetch_and_add1_full(addr) # define AO_HAVE_short_fetch_and_add1_write # endif # if !defined(AO_HAVE_short_fetch_and_add1_read) # define AO_short_fetch_and_add1_read(addr) \ AO_short_fetch_and_add1_full(addr) # define AO_HAVE_short_fetch_and_add1_read # endif #endif /* AO_HAVE_short_fetch_and_add1_full */ #if !defined(AO_HAVE_short_fetch_and_add1) && \ defined(AO_HAVE_short_fetch_and_add1_release) # define AO_short_fetch_and_add1(addr) \ AO_short_fetch_and_add1_release(addr) # define AO_HAVE_short_fetch_and_add1 #endif #if !defined(AO_HAVE_short_fetch_and_add1) && \ defined(AO_HAVE_short_fetch_and_add1_acquire) # define AO_short_fetch_and_add1(addr) \ AO_short_fetch_and_add1_acquire(addr) # define AO_HAVE_short_fetch_and_add1 #endif #if !defined(AO_HAVE_short_fetch_and_add1) && \ defined(AO_HAVE_short_fetch_and_add1_write) # define AO_short_fetch_and_add1(addr) \ AO_short_fetch_and_add1_write(addr) # define AO_HAVE_short_fetch_and_add1 #endif #if !defined(AO_HAVE_short_fetch_and_add1) && \ defined(AO_HAVE_short_fetch_and_add1_read) # define AO_short_fetch_and_add1(addr) \ AO_short_fetch_and_add1_read(addr) # define AO_HAVE_short_fetch_and_add1 #endif #if defined(AO_HAVE_short_fetch_and_add1_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_short_fetch_and_add1_full) # define AO_short_fetch_and_add1_full(addr) \ (AO_nop_full(), AO_short_fetch_and_add1_acquire(addr)) # define AO_HAVE_short_fetch_and_add1_full #endif #if !defined(AO_HAVE_short_fetch_and_add1_release_write) && \ defined(AO_HAVE_short_fetch_and_add1_write) # define AO_short_fetch_and_add1_release_write(addr) \ AO_short_fetch_and_add1_write(addr) # define AO_HAVE_short_fetch_and_add1_release_write #endif #if !defined(AO_HAVE_short_fetch_and_add1_release_write) && \ defined(AO_HAVE_short_fetch_and_add1_release) # define AO_short_fetch_and_add1_release_write(addr) \ AO_short_fetch_and_add1_release(addr) # define AO_HAVE_short_fetch_and_add1_release_write #endif #if !defined(AO_HAVE_short_fetch_and_add1_acquire_read) && \ defined(AO_HAVE_short_fetch_and_add1_read) # define AO_short_fetch_and_add1_acquire_read(addr) \ AO_short_fetch_and_add1_read(addr) # define AO_HAVE_short_fetch_and_add1_acquire_read #endif #if !defined(AO_HAVE_short_fetch_and_add1_acquire_read) && \ defined(AO_HAVE_short_fetch_and_add1_acquire) # define AO_short_fetch_and_add1_acquire_read(addr) \ AO_short_fetch_and_add1_acquire(addr) # define AO_HAVE_short_fetch_and_add1_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_short_fetch_and_add1_acquire_read) # define AO_short_fetch_and_add1_dd_acquire_read(addr) \ AO_short_fetch_and_add1_acquire_read(addr) # define AO_HAVE_short_fetch_and_add1_dd_acquire_read # endif #else # if defined(AO_HAVE_short_fetch_and_add1) # define AO_short_fetch_and_add1_dd_acquire_read(addr) \ AO_short_fetch_and_add1(addr) # define AO_HAVE_short_fetch_and_add1_dd_acquire_read # endif #endif /* short_fetch_and_sub1 */ #if defined(AO_HAVE_short_fetch_and_add_full) &&\ !defined(AO_HAVE_short_fetch_and_sub1_full) # define AO_short_fetch_and_sub1_full(addr) \ AO_short_fetch_and_add_full(addr,(unsigned short)(-1)) # define AO_HAVE_short_fetch_and_sub1_full #endif #if defined(AO_HAVE_short_fetch_and_add_release) &&\ !defined(AO_HAVE_short_fetch_and_sub1_release) # define AO_short_fetch_and_sub1_release(addr) \ AO_short_fetch_and_add_release(addr,(unsigned short)(-1)) # define AO_HAVE_short_fetch_and_sub1_release #endif #if defined(AO_HAVE_short_fetch_and_add_acquire) &&\ !defined(AO_HAVE_short_fetch_and_sub1_acquire) # define AO_short_fetch_and_sub1_acquire(addr) \ AO_short_fetch_and_add_acquire(addr,(unsigned short)(-1)) # define AO_HAVE_short_fetch_and_sub1_acquire #endif #if defined(AO_HAVE_short_fetch_and_add_write) &&\ !defined(AO_HAVE_short_fetch_and_sub1_write) # define AO_short_fetch_and_sub1_write(addr) \ AO_short_fetch_and_add_write(addr,(unsigned short)(-1)) # define AO_HAVE_short_fetch_and_sub1_write #endif #if defined(AO_HAVE_short_fetch_and_add_read) &&\ !defined(AO_HAVE_short_fetch_and_sub1_read) # define AO_short_fetch_and_sub1_read(addr) \ AO_short_fetch_and_add_read(addr,(unsigned short)(-1)) # define AO_HAVE_short_fetch_and_sub1_read #endif #if defined(AO_HAVE_short_fetch_and_add_release_write) &&\ !defined(AO_HAVE_short_fetch_and_sub1_release_write) # define AO_short_fetch_and_sub1_release_write(addr) \ AO_short_fetch_and_add_release_write(addr,(unsigned short)(-1)) # define AO_HAVE_short_fetch_and_sub1_release_write #endif #if defined(AO_HAVE_short_fetch_and_add_acquire_read) &&\ !defined(AO_HAVE_short_fetch_and_sub1_acquire_read) # define AO_short_fetch_and_sub1_acquire_read(addr) \ AO_short_fetch_and_add_acquire_read(addr,(unsigned short)(-1)) # define AO_HAVE_short_fetch_and_sub1_acquire_read #endif #if defined(AO_HAVE_short_fetch_and_add) &&\ !defined(AO_HAVE_short_fetch_and_sub1) # define AO_short_fetch_and_sub1(addr) \ AO_short_fetch_and_add(addr,(unsigned short)(-1)) # define AO_HAVE_short_fetch_and_sub1 #endif #if defined(AO_HAVE_short_fetch_and_sub1_full) # if !defined(AO_HAVE_short_fetch_and_sub1_release) # define AO_short_fetch_and_sub1_release(addr) \ AO_short_fetch_and_sub1_full(addr) # define AO_HAVE_short_fetch_and_sub1_release # endif # if !defined(AO_HAVE_short_fetch_and_sub1_acquire) # define AO_short_fetch_and_sub1_acquire(addr) \ AO_short_fetch_and_sub1_full(addr) # define AO_HAVE_short_fetch_and_sub1_acquire # endif # if !defined(AO_HAVE_short_fetch_and_sub1_write) # define AO_short_fetch_and_sub1_write(addr) \ AO_short_fetch_and_sub1_full(addr) # define AO_HAVE_short_fetch_and_sub1_write # endif # if !defined(AO_HAVE_short_fetch_and_sub1_read) # define AO_short_fetch_and_sub1_read(addr) \ AO_short_fetch_and_sub1_full(addr) # define AO_HAVE_short_fetch_and_sub1_read # endif #endif /* AO_HAVE_short_fetch_and_sub1_full */ #if !defined(AO_HAVE_short_fetch_and_sub1) && \ defined(AO_HAVE_short_fetch_and_sub1_release) # define AO_short_fetch_and_sub1(addr) \ AO_short_fetch_and_sub1_release(addr) # define AO_HAVE_short_fetch_and_sub1 #endif #if !defined(AO_HAVE_short_fetch_and_sub1) && \ defined(AO_HAVE_short_fetch_and_sub1_acquire) # define AO_short_fetch_and_sub1(addr) \ AO_short_fetch_and_sub1_acquire(addr) # define AO_HAVE_short_fetch_and_sub1 #endif #if !defined(AO_HAVE_short_fetch_and_sub1) && \ defined(AO_HAVE_short_fetch_and_sub1_write) # define AO_short_fetch_and_sub1(addr) \ AO_short_fetch_and_sub1_write(addr) # define AO_HAVE_short_fetch_and_sub1 #endif #if !defined(AO_HAVE_short_fetch_and_sub1) && \ defined(AO_HAVE_short_fetch_and_sub1_read) # define AO_short_fetch_and_sub1(addr) \ AO_short_fetch_and_sub1_read(addr) # define AO_HAVE_short_fetch_and_sub1 #endif #if defined(AO_HAVE_short_fetch_and_sub1_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_short_fetch_and_sub1_full) # define AO_short_fetch_and_sub1_full(addr) \ (AO_nop_full(), AO_short_fetch_and_sub1_acquire(addr)) # define AO_HAVE_short_fetch_and_sub1_full #endif #if !defined(AO_HAVE_short_fetch_and_sub1_release_write) && \ defined(AO_HAVE_short_fetch_and_sub1_write) # define AO_short_fetch_and_sub1_release_write(addr) \ AO_short_fetch_and_sub1_write(addr) # define AO_HAVE_short_fetch_and_sub1_release_write #endif #if !defined(AO_HAVE_short_fetch_and_sub1_release_write) && \ defined(AO_HAVE_short_fetch_and_sub1_release) # define AO_short_fetch_and_sub1_release_write(addr) \ AO_short_fetch_and_sub1_release(addr) # define AO_HAVE_short_fetch_and_sub1_release_write #endif #if !defined(AO_HAVE_short_fetch_and_sub1_acquire_read) && \ defined(AO_HAVE_short_fetch_and_sub1_read) # define AO_short_fetch_and_sub1_acquire_read(addr) \ AO_short_fetch_and_sub1_read(addr) # define AO_HAVE_short_fetch_and_sub1_acquire_read #endif #if !defined(AO_HAVE_short_fetch_and_sub1_acquire_read) && \ defined(AO_HAVE_short_fetch_and_sub1_acquire) # define AO_short_fetch_and_sub1_acquire_read(addr) \ AO_short_fetch_and_sub1_acquire(addr) # define AO_HAVE_short_fetch_and_sub1_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_short_fetch_and_sub1_acquire_read) # define AO_short_fetch_and_sub1_dd_acquire_read(addr) \ AO_short_fetch_and_sub1_acquire_read(addr) # define AO_HAVE_short_fetch_and_sub1_dd_acquire_read # endif #else # if defined(AO_HAVE_short_fetch_and_sub1) # define AO_short_fetch_and_sub1_dd_acquire_read(addr) \ AO_short_fetch_and_sub1(addr) # define AO_HAVE_short_fetch_and_sub1_dd_acquire_read # endif #endif /* int_load */ #if defined(AO_HAVE_int_load_acquire) && !defined(AO_HAVE_int_load) # define AO_int_load(addr) AO_int_load_acquire(addr) # define AO_HAVE_int_load #endif #if defined(AO_HAVE_int_load_full) && !defined(AO_HAVE_int_load_acquire) # define AO_int_load_acquire(addr) AO_int_load_full(addr) # define AO_HAVE_int_load_acquire #endif #if defined(AO_HAVE_int_load_full) && !defined(AO_HAVE_int_load_read) # define AO_int_load_read(addr) AO_int_load_full(addr) # define AO_HAVE_int_load_read #endif #if !defined(AO_HAVE_int_load_acquire_read) && defined(AO_HAVE_int_load_acquire) # define AO_int_load_acquire_read(addr) AO_int_load_acquire(addr) # define AO_HAVE_int_load_acquire_read #endif #if defined(AO_HAVE_int_load) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_int_load_acquire) AO_INLINE unsigned int AO_int_load_acquire(volatile unsigned int *addr) { unsigned int result = AO_int_load(addr); /* Acquire barrier would be useless, since the load could be delayed */ /* beyond it. */ AO_nop_full(); return result; } # define AO_HAVE_int_load_acquire #endif #if defined(AO_HAVE_int_load) && defined(AO_HAVE_nop_read) && \ !defined(AO_HAVE_int_load_read) AO_INLINE unsigned int AO_int_load_read(volatile unsigned int *addr) { unsigned int result = AO_int_load(addr); /* Acquire barrier would be useless, since the load could be delayed */ /* beyond it. */ AO_nop_read(); return result; } # define AO_HAVE_int_load_read #endif #if defined(AO_HAVE_int_load_acquire) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_int_load_full) # define AO_int_load_full(addr) (AO_nop_full(), AO_int_load_acquire(addr)) # define AO_HAVE_int_load_full #endif #if !defined(AO_HAVE_int_load_acquire_read) && defined(AO_HAVE_int_load_read) # define AO_int_load_acquire_read(addr) AO_int_load_read(addr) # define AO_HAVE_int_load_acquire_read #endif #if defined(AO_HAVE_int_load_acquire_read) && !defined(AO_HAVE_int_load) # define AO_int_load(addr) AO_int_load_acquire_read(addr) # define AO_HAVE_int_load #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_int_load_acquire_read) # define AO_int_load_dd_acquire_read(addr) \ AO_int_load_acquire_read(addr) # define AO_HAVE_int_load_dd_acquire_read # endif #else # if defined(AO_HAVE_int_load) # define AO_int_load_dd_acquire_read(addr) \ AO_int_load(addr) # define AO_HAVE_int_load_dd_acquire_read # endif #endif /* int_store */ #if defined(AO_HAVE_int_store_release) && !defined(AO_HAVE_int_store) # define AO_int_store(addr, val) AO_int_store_release(addr,val) # define AO_HAVE_int_store #endif #if defined(AO_HAVE_int_store_full) && !defined(AO_HAVE_int_store_release) # define AO_int_store_release(addr,val) AO_int_store_full(addr,val) # define AO_HAVE_int_store_release #endif #if defined(AO_HAVE_int_store_full) && !defined(AO_HAVE_int_store_write) # define AO_int_store_write(addr,val) AO_int_store_full(addr,val) # define AO_HAVE_int_store_write #endif #if defined(AO_HAVE_int_store_release) && \ !defined(AO_HAVE_int_store_release_write) # define AO_int_store_release_write(addr, val) \ AO_int_store_release(addr,val) # define AO_HAVE_int_store_release_write #endif #if defined(AO_HAVE_int_store_write) && !defined(AO_HAVE_int_store) # define AO_int_store(addr, val) AO_int_store_write(addr,val) # define AO_HAVE_int_store #endif #if defined(AO_HAVE_int_store) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_int_store_release) # define AO_int_store_release(addr,val) \ (AO_nop_full(), AO_int_store(addr,val)) # define AO_HAVE_int_store_release #endif #if defined(AO_HAVE_nop_write) && defined(AO_HAVE_int_store) && \ !defined(AO_HAVE_int_store_write) # define AO_int_store_write(addr, val) \ (AO_nop_write(), AO_int_store(addr,val)) # define AO_HAVE_int_store_write #endif #if defined(AO_HAVE_int_store_write) && \ !defined(AO_HAVE_int_store_release_write) # define AO_int_store_release_write(addr, val) AO_int_store_write(addr,val) # define AO_HAVE_int_store_release_write #endif #if defined(AO_HAVE_int_store_release) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_int_store_full) # define AO_int_store_full(addr, val) \ (AO_int_store_release(addr, val), AO_nop_full()) # define AO_HAVE_int_store_full #endif /* int_fetch_and_add */ #if defined(AO_HAVE_int_compare_and_swap_full) && \ !defined(AO_HAVE_int_fetch_and_add_full) AO_INLINE AO_t AO_int_fetch_and_add_full(volatile unsigned int *addr, unsigned int incr) { unsigned int old; do { old = *addr; } while (!AO_int_compare_and_swap_full(addr, old, old+incr)); return old; } # define AO_HAVE_int_fetch_and_add_full #endif #if defined(AO_HAVE_int_compare_and_swap_acquire) && \ !defined(AO_HAVE_int_fetch_and_add_acquire) AO_INLINE AO_t AO_int_fetch_and_add_acquire(volatile unsigned int *addr, unsigned int incr) { unsigned int old; do { old = *addr; } while (!AO_int_compare_and_swap_acquire(addr, old, old+incr)); return old; } # define AO_HAVE_int_fetch_and_add_acquire #endif #if defined(AO_HAVE_int_compare_and_swap_release) && \ !defined(AO_HAVE_int_fetch_and_add_release) AO_INLINE AO_t AO_int_fetch_and_add_release(volatile unsigned int *addr, unsigned int incr) { unsigned int old; do { old = *addr; } while (!AO_int_compare_and_swap_release(addr, old, old+incr)); return old; } # define AO_HAVE_int_fetch_and_add_release #endif #if defined(AO_HAVE_int_fetch_and_add_full) # if !defined(AO_HAVE_int_fetch_and_add_release) # define AO_int_fetch_and_add_release(addr, val) \ AO_int_fetch_and_add_full(addr, val) # define AO_HAVE_int_fetch_and_add_release # endif # if !defined(AO_HAVE_int_fetch_and_add_acquire) # define AO_int_fetch_and_add_acquire(addr, val) \ AO_int_fetch_and_add_full(addr, val) # define AO_HAVE_int_fetch_and_add_acquire # endif # if !defined(AO_HAVE_int_fetch_and_add_write) # define AO_int_fetch_and_add_write(addr, val) \ AO_int_fetch_and_add_full(addr, val) # define AO_HAVE_int_fetch_and_add_write # endif # if !defined(AO_HAVE_int_fetch_and_add_read) # define AO_int_fetch_and_add_read(addr, val) \ AO_int_fetch_and_add_full(addr, val) # define AO_HAVE_int_fetch_and_add_read # endif #endif /* AO_HAVE_int_fetch_and_add_full */ #if !defined(AO_HAVE_int_fetch_and_add) && \ defined(AO_HAVE_int_fetch_and_add_release) # define AO_int_fetch_and_add(addr, val) \ AO_int_fetch_and_add_release(addr, val) # define AO_HAVE_int_fetch_and_add #endif #if !defined(AO_HAVE_int_fetch_and_add) && \ defined(AO_HAVE_int_fetch_and_add_acquire) # define AO_int_fetch_and_add(addr, val) \ AO_int_fetch_and_add_acquire(addr, val) # define AO_HAVE_int_fetch_and_add #endif #if !defined(AO_HAVE_int_fetch_and_add) && \ defined(AO_HAVE_int_fetch_and_add_write) # define AO_int_fetch_and_add(addr, val) \ AO_int_fetch_and_add_write(addr, val) # define AO_HAVE_int_fetch_and_add #endif #if !defined(AO_HAVE_int_fetch_and_add) && \ defined(AO_HAVE_int_fetch_and_add_read) # define AO_int_fetch_and_add(addr, val) \ AO_int_fetch_and_add_read(addr, val) # define AO_HAVE_int_fetch_and_add #endif #if defined(AO_HAVE_int_fetch_and_add_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_int_fetch_and_add_full) # define AO_int_fetch_and_add_full(addr, val) \ (AO_nop_full(), AO_int_fetch_and_add_acquire(addr, val)) #endif #if !defined(AO_HAVE_int_fetch_and_add_release_write) && \ defined(AO_HAVE_int_fetch_and_add_write) # define AO_int_fetch_and_add_release_write(addr, val) \ AO_int_fetch_and_add_write(addr, val) # define AO_HAVE_int_fetch_and_add_release_write #endif #if !defined(AO_HAVE_int_fetch_and_add_release_write) && \ defined(AO_HAVE_int_fetch_and_add_release) # define AO_int_fetch_and_add_release_write(addr, val) \ AO_int_fetch_and_add_release(addr, val) # define AO_HAVE_int_fetch_and_add_release_write #endif #if !defined(AO_HAVE_int_fetch_and_add_acquire_read) && \ defined(AO_HAVE_int_fetch_and_add_read) # define AO_int_fetch_and_add_acquire_read(addr, val) \ AO_int_fetch_and_add_read(addr, val) # define AO_HAVE_int_fetch_and_add_acquire_read #endif #if !defined(AO_HAVE_int_fetch_and_add_acquire_read) && \ defined(AO_HAVE_int_fetch_and_add_acquire) # define AO_int_fetch_and_add_acquire_read(addr, val) \ AO_int_fetch_and_add_acquire(addr, val) # define AO_HAVE_int_fetch_and_add_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_int_fetch_and_add_acquire_read) # define AO_int_fetch_and_add_dd_acquire_read(addr, val) \ AO_int_fetch_and_add_acquire_read(addr, val) # define AO_HAVE_int_fetch_and_add_dd_acquire_read # endif #else # if defined(AO_HAVE_int_fetch_and_add) # define AO_int_fetch_and_add_dd_acquire_read(addr, val) \ AO_int_fetch_and_add(addr, val) # define AO_HAVE_int_fetch_and_add_dd_acquire_read # endif #endif /* int_fetch_and_add1 */ #if defined(AO_HAVE_int_fetch_and_add_full) &&\ !defined(AO_HAVE_int_fetch_and_add1_full) # define AO_int_fetch_and_add1_full(addr) \ AO_int_fetch_and_add_full(addr,1) # define AO_HAVE_int_fetch_and_add1_full #endif #if defined(AO_HAVE_int_fetch_and_add_release) &&\ !defined(AO_HAVE_int_fetch_and_add1_release) # define AO_int_fetch_and_add1_release(addr) \ AO_int_fetch_and_add_release(addr,1) # define AO_HAVE_int_fetch_and_add1_release #endif #if defined(AO_HAVE_int_fetch_and_add_acquire) &&\ !defined(AO_HAVE_int_fetch_and_add1_acquire) # define AO_int_fetch_and_add1_acquire(addr) \ AO_int_fetch_and_add_acquire(addr,1) # define AO_HAVE_int_fetch_and_add1_acquire #endif #if defined(AO_HAVE_int_fetch_and_add_write) &&\ !defined(AO_HAVE_int_fetch_and_add1_write) # define AO_int_fetch_and_add1_write(addr) \ AO_int_fetch_and_add_write(addr,1) # define AO_HAVE_int_fetch_and_add1_write #endif #if defined(AO_HAVE_int_fetch_and_add_read) &&\ !defined(AO_HAVE_int_fetch_and_add1_read) # define AO_int_fetch_and_add1_read(addr) \ AO_int_fetch_and_add_read(addr,1) # define AO_HAVE_int_fetch_and_add1_read #endif #if defined(AO_HAVE_int_fetch_and_add_release_write) &&\ !defined(AO_HAVE_int_fetch_and_add1_release_write) # define AO_int_fetch_and_add1_release_write(addr) \ AO_int_fetch_and_add_release_write(addr,1) # define AO_HAVE_int_fetch_and_add1_release_write #endif #if defined(AO_HAVE_int_fetch_and_add_acquire_read) &&\ !defined(AO_HAVE_int_fetch_and_add1_acquire_read) # define AO_int_fetch_and_add1_acquire_read(addr) \ AO_int_fetch_and_add_acquire_read(addr,1) # define AO_HAVE_int_fetch_and_add1_acquire_read #endif #if defined(AO_HAVE_int_fetch_and_add) &&\ !defined(AO_HAVE_int_fetch_and_add1) # define AO_int_fetch_and_add1(addr) \ AO_int_fetch_and_add(addr,1) # define AO_HAVE_int_fetch_and_add1 #endif #if defined(AO_HAVE_int_fetch_and_add1_full) # if !defined(AO_HAVE_int_fetch_and_add1_release) # define AO_int_fetch_and_add1_release(addr) \ AO_int_fetch_and_add1_full(addr) # define AO_HAVE_int_fetch_and_add1_release # endif # if !defined(AO_HAVE_int_fetch_and_add1_acquire) # define AO_int_fetch_and_add1_acquire(addr) \ AO_int_fetch_and_add1_full(addr) # define AO_HAVE_int_fetch_and_add1_acquire # endif # if !defined(AO_HAVE_int_fetch_and_add1_write) # define AO_int_fetch_and_add1_write(addr) \ AO_int_fetch_and_add1_full(addr) # define AO_HAVE_int_fetch_and_add1_write # endif # if !defined(AO_HAVE_int_fetch_and_add1_read) # define AO_int_fetch_and_add1_read(addr) \ AO_int_fetch_and_add1_full(addr) # define AO_HAVE_int_fetch_and_add1_read # endif #endif /* AO_HAVE_int_fetch_and_add1_full */ #if !defined(AO_HAVE_int_fetch_and_add1) && \ defined(AO_HAVE_int_fetch_and_add1_release) # define AO_int_fetch_and_add1(addr) \ AO_int_fetch_and_add1_release(addr) # define AO_HAVE_int_fetch_and_add1 #endif #if !defined(AO_HAVE_int_fetch_and_add1) && \ defined(AO_HAVE_int_fetch_and_add1_acquire) # define AO_int_fetch_and_add1(addr) \ AO_int_fetch_and_add1_acquire(addr) # define AO_HAVE_int_fetch_and_add1 #endif #if !defined(AO_HAVE_int_fetch_and_add1) && \ defined(AO_HAVE_int_fetch_and_add1_write) # define AO_int_fetch_and_add1(addr) \ AO_int_fetch_and_add1_write(addr) # define AO_HAVE_int_fetch_and_add1 #endif #if !defined(AO_HAVE_int_fetch_and_add1) && \ defined(AO_HAVE_int_fetch_and_add1_read) # define AO_int_fetch_and_add1(addr) \ AO_int_fetch_and_add1_read(addr) # define AO_HAVE_int_fetch_and_add1 #endif #if defined(AO_HAVE_int_fetch_and_add1_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_int_fetch_and_add1_full) # define AO_int_fetch_and_add1_full(addr) \ (AO_nop_full(), AO_int_fetch_and_add1_acquire(addr)) # define AO_HAVE_int_fetch_and_add1_full #endif #if !defined(AO_HAVE_int_fetch_and_add1_release_write) && \ defined(AO_HAVE_int_fetch_and_add1_write) # define AO_int_fetch_and_add1_release_write(addr) \ AO_int_fetch_and_add1_write(addr) # define AO_HAVE_int_fetch_and_add1_release_write #endif #if !defined(AO_HAVE_int_fetch_and_add1_release_write) && \ defined(AO_HAVE_int_fetch_and_add1_release) # define AO_int_fetch_and_add1_release_write(addr) \ AO_int_fetch_and_add1_release(addr) # define AO_HAVE_int_fetch_and_add1_release_write #endif #if !defined(AO_HAVE_int_fetch_and_add1_acquire_read) && \ defined(AO_HAVE_int_fetch_and_add1_read) # define AO_int_fetch_and_add1_acquire_read(addr) \ AO_int_fetch_and_add1_read(addr) # define AO_HAVE_int_fetch_and_add1_acquire_read #endif #if !defined(AO_HAVE_int_fetch_and_add1_acquire_read) && \ defined(AO_HAVE_int_fetch_and_add1_acquire) # define AO_int_fetch_and_add1_acquire_read(addr) \ AO_int_fetch_and_add1_acquire(addr) # define AO_HAVE_int_fetch_and_add1_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_int_fetch_and_add1_acquire_read) # define AO_int_fetch_and_add1_dd_acquire_read(addr) \ AO_int_fetch_and_add1_acquire_read(addr) # define AO_HAVE_int_fetch_and_add1_dd_acquire_read # endif #else # if defined(AO_HAVE_int_fetch_and_add1) # define AO_int_fetch_and_add1_dd_acquire_read(addr) \ AO_int_fetch_and_add1(addr) # define AO_HAVE_int_fetch_and_add1_dd_acquire_read # endif #endif /* int_fetch_and_sub1 */ #if defined(AO_HAVE_int_fetch_and_add_full) &&\ !defined(AO_HAVE_int_fetch_and_sub1_full) # define AO_int_fetch_and_sub1_full(addr) \ AO_int_fetch_and_add_full(addr,(unsigned int)(-1)) # define AO_HAVE_int_fetch_and_sub1_full #endif #if defined(AO_HAVE_int_fetch_and_add_release) &&\ !defined(AO_HAVE_int_fetch_and_sub1_release) # define AO_int_fetch_and_sub1_release(addr) \ AO_int_fetch_and_add_release(addr,(unsigned int)(-1)) # define AO_HAVE_int_fetch_and_sub1_release #endif #if defined(AO_HAVE_int_fetch_and_add_acquire) &&\ !defined(AO_HAVE_int_fetch_and_sub1_acquire) # define AO_int_fetch_and_sub1_acquire(addr) \ AO_int_fetch_and_add_acquire(addr,(unsigned int)(-1)) # define AO_HAVE_int_fetch_and_sub1_acquire #endif #if defined(AO_HAVE_int_fetch_and_add_write) &&\ !defined(AO_HAVE_int_fetch_and_sub1_write) # define AO_int_fetch_and_sub1_write(addr) \ AO_int_fetch_and_add_write(addr,(unsigned int)(-1)) # define AO_HAVE_int_fetch_and_sub1_write #endif #if defined(AO_HAVE_int_fetch_and_add_read) &&\ !defined(AO_HAVE_int_fetch_and_sub1_read) # define AO_int_fetch_and_sub1_read(addr) \ AO_int_fetch_and_add_read(addr,(unsigned int)(-1)) # define AO_HAVE_int_fetch_and_sub1_read #endif #if defined(AO_HAVE_int_fetch_and_add_release_write) &&\ !defined(AO_HAVE_int_fetch_and_sub1_release_write) # define AO_int_fetch_and_sub1_release_write(addr) \ AO_int_fetch_and_add_release_write(addr,(unsigned int)(-1)) # define AO_HAVE_int_fetch_and_sub1_release_write #endif #if defined(AO_HAVE_int_fetch_and_add_acquire_read) &&\ !defined(AO_HAVE_int_fetch_and_sub1_acquire_read) # define AO_int_fetch_and_sub1_acquire_read(addr) \ AO_int_fetch_and_add_acquire_read(addr,(unsigned int)(-1)) # define AO_HAVE_int_fetch_and_sub1_acquire_read #endif #if defined(AO_HAVE_int_fetch_and_add) &&\ !defined(AO_HAVE_int_fetch_and_sub1) # define AO_int_fetch_and_sub1(addr) \ AO_int_fetch_and_add(addr,(unsigned int)(-1)) # define AO_HAVE_int_fetch_and_sub1 #endif #if defined(AO_HAVE_int_fetch_and_sub1_full) # if !defined(AO_HAVE_int_fetch_and_sub1_release) # define AO_int_fetch_and_sub1_release(addr) \ AO_int_fetch_and_sub1_full(addr) # define AO_HAVE_int_fetch_and_sub1_release # endif # if !defined(AO_HAVE_int_fetch_and_sub1_acquire) # define AO_int_fetch_and_sub1_acquire(addr) \ AO_int_fetch_and_sub1_full(addr) # define AO_HAVE_int_fetch_and_sub1_acquire # endif # if !defined(AO_HAVE_int_fetch_and_sub1_write) # define AO_int_fetch_and_sub1_write(addr) \ AO_int_fetch_and_sub1_full(addr) # define AO_HAVE_int_fetch_and_sub1_write # endif # if !defined(AO_HAVE_int_fetch_and_sub1_read) # define AO_int_fetch_and_sub1_read(addr) \ AO_int_fetch_and_sub1_full(addr) # define AO_HAVE_int_fetch_and_sub1_read # endif #endif /* AO_HAVE_int_fetch_and_sub1_full */ #if !defined(AO_HAVE_int_fetch_and_sub1) && \ defined(AO_HAVE_int_fetch_and_sub1_release) # define AO_int_fetch_and_sub1(addr) \ AO_int_fetch_and_sub1_release(addr) # define AO_HAVE_int_fetch_and_sub1 #endif #if !defined(AO_HAVE_int_fetch_and_sub1) && \ defined(AO_HAVE_int_fetch_and_sub1_acquire) # define AO_int_fetch_and_sub1(addr) \ AO_int_fetch_and_sub1_acquire(addr) # define AO_HAVE_int_fetch_and_sub1 #endif #if !defined(AO_HAVE_int_fetch_and_sub1) && \ defined(AO_HAVE_int_fetch_and_sub1_write) # define AO_int_fetch_and_sub1(addr) \ AO_int_fetch_and_sub1_write(addr) # define AO_HAVE_int_fetch_and_sub1 #endif #if !defined(AO_HAVE_int_fetch_and_sub1) && \ defined(AO_HAVE_int_fetch_and_sub1_read) # define AO_int_fetch_and_sub1(addr) \ AO_int_fetch_and_sub1_read(addr) # define AO_HAVE_int_fetch_and_sub1 #endif #if defined(AO_HAVE_int_fetch_and_sub1_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_int_fetch_and_sub1_full) # define AO_int_fetch_and_sub1_full(addr) \ (AO_nop_full(), AO_int_fetch_and_sub1_acquire(addr)) # define AO_HAVE_int_fetch_and_sub1_full #endif #if !defined(AO_HAVE_int_fetch_and_sub1_release_write) && \ defined(AO_HAVE_int_fetch_and_sub1_write) # define AO_int_fetch_and_sub1_release_write(addr) \ AO_int_fetch_and_sub1_write(addr) # define AO_HAVE_int_fetch_and_sub1_release_write #endif #if !defined(AO_HAVE_int_fetch_and_sub1_release_write) && \ defined(AO_HAVE_int_fetch_and_sub1_release) # define AO_int_fetch_and_sub1_release_write(addr) \ AO_int_fetch_and_sub1_release(addr) # define AO_HAVE_int_fetch_and_sub1_release_write #endif #if !defined(AO_HAVE_int_fetch_and_sub1_acquire_read) && \ defined(AO_HAVE_int_fetch_and_sub1_read) # define AO_int_fetch_and_sub1_acquire_read(addr) \ AO_int_fetch_and_sub1_read(addr) # define AO_HAVE_int_fetch_and_sub1_acquire_read #endif #if !defined(AO_HAVE_int_fetch_and_sub1_acquire_read) && \ defined(AO_HAVE_int_fetch_and_sub1_acquire) # define AO_int_fetch_and_sub1_acquire_read(addr) \ AO_int_fetch_and_sub1_acquire(addr) # define AO_HAVE_int_fetch_and_sub1_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_int_fetch_and_sub1_acquire_read) # define AO_int_fetch_and_sub1_dd_acquire_read(addr) \ AO_int_fetch_and_sub1_acquire_read(addr) # define AO_HAVE_int_fetch_and_sub1_dd_acquire_read # endif #else # if defined(AO_HAVE_int_fetch_and_sub1) # define AO_int_fetch_and_sub1_dd_acquire_read(addr) \ AO_int_fetch_and_sub1(addr) # define AO_HAVE_int_fetch_and_sub1_dd_acquire_read # endif #endif synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/0000775000076400007640000000000011172123233025421 5ustar stefanstefan././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootsynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/int_aligned_atomic_load_store.hsynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/int_aligned_atomic_load_store0000664000076400007640000000336411104702317033377 0ustar stefanstefan/* * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * Definitions for architecturs on which loads and stores of unsigned int are * atomic fo all legal alignments. */ AO_INLINE unsigned int AO_int_load(volatile unsigned int *addr) { assert(((size_t)addr & (sizeof(unsigned int) - 1)) == 0); /* Cast away the volatile for architectures like IA64 where */ /* volatile adds barrier semantics. */ return (*(unsigned int *)addr); } #define AO_HAVE_int_load AO_INLINE void AO_int_store(volatile unsigned int *addr, unsigned int new_val) { assert(((size_t)addr & (sizeof(unsigned int) - 1)) == 0); (*(unsigned int *)addr) = new_val; } #define AO_HAVE_int_store synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/short_atomic_load_store.h0000664000076400007640000000323311104702317032502 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * 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. */ /* * Definitions for architecturs on which loads and stores of unsigned short are * atomic for all legal alignments. */ AO_INLINE unsigned short AO_short_load(volatile unsigned short *addr) { /* Cast away the volatile for architectures like IA64 where */ /* volatile adds barrier semantics. */ return (*(unsigned short *)addr); } #define AO_HAVE_short_load AO_INLINE void AO_short_store(volatile unsigned short *addr, unsigned short new_val) { (*(unsigned short *)addr) = new_val; } #define AO_HAVE_short_store synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/sunc/0000775000076400007640000000000011172123233026371 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/sunc/sparc.S0000664000076400007640000000013311104702317027623 0ustar stefanstefan .seg "text" .globl AO_test_and_set_full AO_test_and_set_full: retl ldstub [%o0],%o0 synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/sunc/sparc.h0000664000076400007640000000311011104702317027646 0ustar stefanstefan/* * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. * * 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 "../all_atomic_load_store.h" /* Real SPARC code uses TSO: */ #include "../ordered_except_wr.h" /* Test_and_set location is just a byte. */ #include "../test_and_set_t_is_char.h" extern AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr); /* Implemented in separate .S file, for now. */ #define AO_HAVE_test_and_set_full /* FIXME: Like the gcc version, this needs to be extended for V8 */ /* and V9. */ synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/atomic_load_store.h0000664000076400007640000000306411104702317031265 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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. */ /* * Definitions for architecturs on which loads and stores of AO_t are * atomic fo all legal alignments. */ AO_INLINE AO_t AO_load(volatile AO_t *addr) { /* Cast away the volatile for architectures like IA64 where */ /* volatile adds barrier semantics. */ return (*(AO_t *)addr); } #define AO_HAVE_load AO_INLINE void AO_store(volatile AO_t *addr, AO_t new_val) { (*(AO_t *)addr) = new_val; } #define AO_HAVE_store synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/test_and_set_t_is_char.h0000664000076400007640000000306411104702317032265 0ustar stefanstefan/* * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * These are common definitions for architectures on which test_and_set * operates on byte sized quantities, the "clear" value contains * all zeroes, and the "set" value contains all ones. */ #define AO_TS_t unsigned char typedef enum {AO_BYTE_TS_clear = 0, AO_BYTE_TS_set = 0xff} AO_BYTE_TS_val; #define AO_TS_VAL_t AO_BYTE_TS_val #define AO_TS_CLEAR AO_BYTE_TS_clear #define AO_TS_SET AO_BYTE_TS_set #define AO_CHAR_TS_T 1 synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/int_atomic_load_store.h0000664000076400007640000000320511104702317032134 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * 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. */ /* * Definitions for architecturs on which loads and stores of unsigned int are * atomic for all legal alignments. */ AO_INLINE unsigned int AO_int_load(volatile unsigned int *addr) { /* Cast away the volatile for architectures like IA64 where */ /* volatile adds barrier semantics. */ return (*(unsigned int *)addr); } #define AO_HAVE_int_load AO_INLINE void AO_int_store(volatile unsigned int *addr, unsigned int new_val) { (*(unsigned int *)addr) = new_val; } #define AO_HAVE_int_store synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/README0000664000076400007640000000054111104702317026302 0ustar stefanstefanThere are two kinds of entities in this directory: - Subdirectories corresponding to specific compilers (or compiler/OS combinations). Each of these includes one or more architecture-specific headers. - More generic header files corresponding to a particular ordering and/or atomicity property that might be shared by multiple hardware platforms. ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootsynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/int_acquire_release_volatile.hsynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/int_acquire_release_volatile.0000664000076400007640000000367511104702317033340 0ustar stefanstefan/* * Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * This file adds definitions appropriate for environments in which an unsigned * int volatile load has acquire semantics, and an unsigned short volatile * store has release semantics. This is true with the standard Itanium ABI. */ #if !defined(AO_GCC_BARRIER) # if defined(__GNUC__) # define AO_GCC_BARRIER() AO_compiler_barrier() # else # define AO_GCC_BARRIER() # endif #endif AO_INLINE unsigned int AO_int_load_acquire(volatile unsigned int *p) { unsigned int result = *p; /* A normal volatile load generates an ld.acq */ AO_GCC_BARRIER(); return result; } #define AO_HAVE_int_load_acquire AO_INLINE void AO_int_store_release(volatile unsigned int *p, unsigned int val) { AO_GCC_BARRIER(); /* A normal volatile store generates an st.rel */ *p = val; } #define AO_HAVE_int_store_release synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/emul_cas.h0000664000076400007640000000576011104702317027373 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * 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. */ /* * Ensure, if at all possible, that AO_compare_and_swap_full() is * available. The emulation should be brute-force signal-safe, even * though it actually blocks. * Including this file will generate an error if AO_compare_and_swap_full() * cannot be made available. * This will be included from platform-specific atomic_ops files * id appropriate, and if AO_FORCE_CAS is defined. It should not be * included directly, especially since it affects the implementation * of other atomic update primitives. * The implementation assumes that only AO_store_XXX and AO_test_and_set_XXX * variants are defined, and that AO_test_and_set_XXX is not used to * operate on compare_and_swap locations. */ #if !defined(ATOMIC_OPS_H) # error This file should not be included directly. #endif #ifndef AO_HAVE_double_t # include "standard_ao_double_t.h" #endif int AO_compare_and_swap_emulation(volatile AO_t *addr, AO_t old, AO_t new_val); int AO_compare_double_and_swap_double_emulation(volatile AO_double_t *addr, AO_t old_val1, AO_t old_val2, AO_t new_val1, AO_t new_val2); void AO_store_full_emulation(volatile AO_t *addr, AO_t val); #define AO_compare_and_swap_full(addr, old, newval) \ AO_compare_and_swap_emulation(addr, old, newval) #define AO_HAVE_compare_and_swap_full #ifndef AO_HAVE_compare_double_and_swap_double # define AO_compare_double_and_swap_double_full(addr, old1, old2, \ newval1, newval2) \ AO_compare_double_and_swap_double_emulation(addr, old1, old2, \ newval1, newval2) # define AO_HAVE_compare_double_and_swap_double_full #endif #undef AO_store #undef AO_HAVE_store #undef AO_store_write #undef AO_HAVE_store_write #undef AO_store_release #undef AO_HAVE_store_release #undef AO_store_full #undef AO_HAVE_store_full #define AO_store_full(addr, val) AO_store_full_emulation(addr, val) #define AO_HAVE_store_full synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ibmc/0000775000076400007640000000000011172123233026333 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ibmc/powerpc.h0000664000076400007640000000647211104702317030175 0ustar stefanstefan/* FIXME. This is only a placeholder for the AIX compiler. */ /* It doesn't work. Please send a patch. */ /* Memory model documented at http://www-106.ibm.com/developerworks/ */ /* eserver/articles/archguide.html and (clearer) */ /* http://www-106.ibm.com/developerworks/eserver/articles/powerpc.html. */ /* There appears to be no implicit ordering between any kind of */ /* independent memory references. */ /* Architecture enforces some ordering based on control dependence. */ /* I don't know if that could help. */ /* Data-dependent loads are always ordered. */ /* Based on the above references, eieio is intended for use on */ /* uncached memory, which we don't support. It does not order loads */ /* from cached memory. */ /* Thanks to Maged Michael, Doug Lea, and Roger Hoover for helping to */ /* track some of this down and correcting my misunderstandings. -HB */ #include "../all_aligned_atomic_load_store.h" void AO_sync(void); #pragma mc_func AO_sync { "7c0004ac" } void AO_lwsync(void); #pragma mc_func AO_lwsync { "7c2004ac" } #define AO_nop_write() AO_lwsync() #define AO_HAVE_nop_write #define AO_nop_read() AO_lwsync() #define AO_HAVE_nop_read /* We explicitly specify load_acquire and store_release, since these */ /* rely on the fact that lwsync is also a LoadStore barrier. */ AO_INLINE AO_t AO_load_acquire(volatile AO_t *addr) { AO_t result = *addr; AO_lwsync(); return result; } #define AO_HAVE_load_acquire AO_INLINE void AO_store_release(volatile AO_t *addr, AO_t value) { AO_lwsync(); *addr = value; } #define AO_HAVE_load_acquire /* This is similar to the code in the garbage collector. Deleting */ /* this and having it synthesized from compare_and_swap would probably */ /* only cost us a load immediate instruction. */ AO_INLINE AO_TS_VAL_t AO_test_and_set(volatile AO_TS_t *addr) { # error Implement me } #define AO_have_test_and_set AO_INLINE AO_TS_VAL_t AO_test_and_set_acquire(volatile AO_TS_t *addr) { AO_TS_VAL_t result = AO_test_and_set(addr); AO_lwsync(); return result; } #define AO_HAVE_test_and_set_acquire AO_INLINE AO_TS_VAL_t AO_test_and_set_release(volatile AO_TS_t *addr) { AO_lwsync(); return AO_test_and_set(addr); } #define AO_HAVE_test_and_set_release AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { AO_TS_VAL_t result; AO_lwsync(); result = AO_test_and_set(addr); AO_lwsync(); return result; } #define AO_HAVE_test_and_set_full AO_INLINE AO_t AO_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val) { # error Implement me } #define AO_HAVE_compare_and_swap AO_INLINE AO_t AO_compare_and_swap_acquire(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t result = AO_compare_and_swap(addr, old, new_val); AO_lwsync(); return result; } #define AO_HAVE_compare_and_swap_acquire AO_INLINE AO_t AO_compare_and_swap_release(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_lwsync(); return AO_compare_and_swap(addr, old, new_val); } #define AO_HAVE_compare_and_swap_release AO_INLINE AO_t AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t result; AO_lwsync(); result = AO_compare_and_swap(addr, old, new_val); AO_lwsync(); return result; } #define AO_HAVE_compare_and_swap_full /* FIXME: We should also implement fetch_and_add and or primitives */ /* directly. */ synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/read_ordered.h0000664000076400007640000000535211104702317030217 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * 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. */ /* * These are common definitions for architectures that provide processor * ordered memory operations except that a later read may pass an * earlier write. Real x86 implementations seem to be in this category, * except apparently for some IDT WinChips, which we ignore. */ AO_INLINE void AO_nop_read() { AO_compiler_barrier(); } #define AO_HAVE_NOP_READ #ifdef AO_HAVE_load AO_INLINE AO_t AO_load_read(volatile AO_t *addr) { AO_t result = AO_load(addr); AO_compiler_barrier(); return result; } #define AO_HAVE_load_read #define AO_load_acquire(addr) AO_load_read(addr) #define AO_HAVE_load_acquire #endif /* AO_HAVE_load */ #ifdef AO_HAVE_char_load AO_INLINE AO_t AO_char_load_read(volatile unsigned char *addr) { AO_t result = AO_char_load(addr); AO_compiler_barrier(); return result; } #define AO_HAVE_char_load_read #define AO_char_load_acquire(addr) AO_char_load_read(addr) #define AO_HAVE_char_load_acquire #endif /* AO_HAVE_char_load */ #ifdef AO_HAVE_short_load AO_INLINE AO_t AO_short_load_read(volatile unsigned short *addr) { AO_t result = AO_short_load(addr); AO_compiler_barrier(); return result; } #define AO_HAVE_short_load_read #define AO_short_load_acquire(addr) AO_short_load_read(addr) #define AO_HAVE_short_load_acquire #endif /* AO_HAVE_short_load */ #ifdef AO_HAVE_int_load AO_INLINE AO_t AO_int_load_read(volatile unsigned int *addr) { AO_t result = AO_int_load(addr); AO_compiler_barrier(); return result; } #define AO_HAVE_int_load_read #define AO_int_load_acquire(addr) AO_int_load_read(addr) #define AO_HAVE_int_load_acquire #endif /* AO_HAVE_int_load */ synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/generic_pthread.h0000664000076400007640000001545411104702317030727 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * 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. */ /* The following is useful primarily for debugging and documentation. */ /* We define various atomic operations by acquiring a global pthread */ /* lock. The resulting implementation will perform poorly, but should */ /* be correct unless it is used from signal handlers. */ /* We assume that all pthread operations act like full memory barriers. */ /* (We believe that is the intent of the specification.) */ #include #include "test_and_set_t_is_ao_t.h" /* This is not necessarily compatible with the native */ /* implementation. But those can't be safely mixed anyway. */ /* We define only the full barrier variants, and count on the */ /* generalization section below to fill in the rest. */ extern pthread_mutex_t AO_pt_lock; AO_INLINE void AO_nop_full() { pthread_mutex_lock(&AO_pt_lock); pthread_mutex_unlock(&AO_pt_lock); } #define AO_HAVE_nop_full AO_INLINE AO_t AO_load_full(volatile AO_t *addr) { AO_t result; pthread_mutex_lock(&AO_pt_lock); result = *addr; pthread_mutex_unlock(&AO_pt_lock); return result; } #define AO_HAVE_load_full AO_INLINE void AO_store_full(volatile AO_t *addr, AO_t val) { pthread_mutex_lock(&AO_pt_lock); *addr = val; pthread_mutex_unlock(&AO_pt_lock); } #define AO_HAVE_store_full AO_INLINE unsigned char AO_char_load_full(volatile unsigned char *addr) { unsigned char result; pthread_mutex_lock(&AO_pt_lock); result = *addr; pthread_mutex_unlock(&AO_pt_lock); return result; } #define AO_HAVE_char_load_full AO_INLINE void AO_char_store_full(volatile unsigned char *addr, unsigned char val) { pthread_mutex_lock(&AO_pt_lock); *addr = val; pthread_mutex_unlock(&AO_pt_lock); } #define AO_HAVE_char_store_full AO_INLINE unsigned short AO_short_load_full(volatile unsigned short *addr) { unsigned short result; pthread_mutex_lock(&AO_pt_lock); result = *addr; pthread_mutex_unlock(&AO_pt_lock); return result; } #define AO_HAVE_short_load_full AO_INLINE void AO_short_store_full(volatile unsigned short *addr, unsigned short val) { pthread_mutex_lock(&AO_pt_lock); *addr = val; pthread_mutex_unlock(&AO_pt_lock); } #define AO_HAVE_short_store_full AO_INLINE unsigned int AO_int_load_full(volatile unsigned int *addr) { unsigned int result; pthread_mutex_lock(&AO_pt_lock); result = *addr; pthread_mutex_unlock(&AO_pt_lock); return result; } #define AO_HAVE_int_load_full AO_INLINE void AO_int_store_full(volatile unsigned int *addr, unsigned int val) { pthread_mutex_lock(&AO_pt_lock); *addr = val; pthread_mutex_unlock(&AO_pt_lock); } #define AO_HAVE_int_store_full AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { AO_TS_VAL_t result; pthread_mutex_lock(&AO_pt_lock); result = (AO_TS_VAL_t)(*addr); *addr = AO_TS_SET; pthread_mutex_unlock(&AO_pt_lock); assert(result == AO_TS_SET || result == AO_TS_CLEAR); return result; } #define AO_HAVE_test_and_set_full AO_INLINE AO_t AO_fetch_and_add_full(volatile AO_t *p, AO_t incr) { AO_t tmp; pthread_mutex_lock(&AO_pt_lock); tmp = *p; *p = tmp + incr; pthread_mutex_unlock(&AO_pt_lock); return tmp; } #define AO_HAVE_fetch_and_add_full AO_INLINE unsigned char AO_char_fetch_and_add_full(volatile unsigned char *p, unsigned char incr) { unsigned char tmp; pthread_mutex_lock(&AO_pt_lock); tmp = *p; *p = tmp + incr; pthread_mutex_unlock(&AO_pt_lock); return tmp; } #define AO_HAVE_char_fetch_and_add_full AO_INLINE unsigned short AO_short_fetch_and_add_full(volatile unsigned short *p, unsigned short incr) { unsigned short tmp; pthread_mutex_lock(&AO_pt_lock); tmp = *p; *p = tmp + incr; pthread_mutex_unlock(&AO_pt_lock); return tmp; } #define AO_HAVE_short_fetch_and_add_full AO_INLINE unsigned int AO_int_fetch_and_add_full(volatile unsigned int *p, unsigned int incr) { unsigned int tmp; pthread_mutex_lock(&AO_pt_lock); tmp = *p; *p = tmp + incr; pthread_mutex_unlock(&AO_pt_lock); return tmp; } #define AO_HAVE_int_fetch_and_add_full AO_INLINE void AO_or_full(volatile AO_t *p, AO_t incr) { AO_t tmp; pthread_mutex_lock(&AO_pt_lock); tmp = *p; *p = (tmp | incr); pthread_mutex_unlock(&AO_pt_lock); } #define AO_HAVE_or_full AO_INLINE int AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) { pthread_mutex_lock(&AO_pt_lock); if (*addr == old) { *addr = new_val; pthread_mutex_unlock(&AO_pt_lock); return 1; } else pthread_mutex_unlock(&AO_pt_lock); return 0; } #define AO_HAVE_compare_and_swap_full /* Unlike real architectures, we define both double-width CAS variants. */ typedef struct { AO_t AO_val1; AO_t AO_val2; } AO_double_t; #define AO_HAVE_double_t AO_INLINE int AO_compare_double_and_swap_double_full(volatile AO_double_t *addr, AO_t old1, AO_t old2, AO_t new1, AO_t new2) { pthread_mutex_lock(&AO_pt_lock); if (addr -> AO_val1 == old1 && addr -> AO_val2 == old2) { addr -> AO_val1 = new1; addr -> AO_val2 = new2; pthread_mutex_unlock(&AO_pt_lock); return 1; } else pthread_mutex_unlock(&AO_pt_lock); return 0; } #define AO_HAVE_compare_double_and_swap_double_full AO_INLINE int AO_compare_and_swap_double_full(volatile AO_double_t *addr, AO_t old1, AO_t new1, AO_t new2) { pthread_mutex_lock(&AO_pt_lock); if (addr -> AO_val1 == old1) { addr -> AO_val1 = new1; addr -> AO_val2 = new2; pthread_mutex_unlock(&AO_pt_lock); return 1; } else pthread_mutex_unlock(&AO_pt_lock); return 0; } #define AO_HAVE_compare_and_swap_double_full /* We can't use hardware loads and stores, since they don't */ /* interact correctly with atomic updates. */ synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ordered.h0000664000076400007640000000254511104702317027225 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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. */ /* * These are common definitions for architectures that provide processor * ordered memory operations. */ #include "ordered_except_wr.h" AO_INLINE void AO_nop_full() { AO_compiler_barrier(); } #define AO_HAVE_nop_full synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/hpc/0000775000076400007640000000000011172123233026173 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/hpc/ia64.h0000664000076400007640000001153211104702317027112 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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. */ /* * This file specifies Itanimum primitives for use with the HP compiler * unde HP/UX. We use intrinsics instead of the inline assembly code in the * gcc file. */ #include "../all_atomic_load_store.h" #include "../all_acquire_release_volatile.h" #include "../test_and_set_t_is_char.h" #include #ifdef __LP64__ # define AO_T_FASIZE _FASZ_D # define AO_T_SIZE _SZ_D #else # define AO_T_FASIZE _FASZ_W # define AO_T_SIZE _SZ_W #endif AO_INLINE void AO_nop_full() { _Asm_mf(); } #define AO_HAVE_nop_full AO_INLINE AO_t AO_fetch_and_add1_acquire (volatile AO_t *p) { return _Asm_fetchadd(AO_T_FASIZE, _SEM_ACQ, p, 1, _LDHINT_NONE, _DOWN_MEM_FENCE); } #define AO_HAVE_fetch_and_add1_acquire AO_INLINE AO_t AO_fetch_and_add1_release (volatile AO_t *p) { return _Asm_fetchadd(AO_T_FASIZE, _SEM_REL, p, 1, _LDHINT_NONE, _UP_MEM_FENCE); } #define AO_HAVE_fetch_and_add1_release AO_INLINE AO_t AO_fetch_and_sub1_acquire (volatile AO_t *p) { return _Asm_fetchadd(AO_T_FASIZE, _SEM_ACQ, p, -1, _LDHINT_NONE, _DOWN_MEM_FENCE); } #define AO_HAVE_fetch_and_sub1_acquire AO_INLINE AO_t AO_fetch_and_sub1_release (volatile AO_t *p) { return _Asm_fetchadd(AO_T_FASIZE, _SEM_REL, p, -1, _LDHINT_NONE, _UP_MEM_FENCE); } #define AO_HAVE_fetch_and_sub1_release AO_INLINE int AO_compare_and_swap_acquire(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t oldval; _Asm_mov_to_ar(_AREG_CCV, old, _DOWN_MEM_FENCE); oldval = _Asm_cmpxchg(AO_T_SIZE, _SEM_ACQ, addr, new_val, _LDHINT_NONE, _DOWN_MEM_FENCE); return (oldval == old); } #define AO_HAVE_compare_and_swap_acquire AO_INLINE int AO_compare_and_swap_release(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t oldval; _Asm_mov_to_ar(_AREG_CCV, old, _UP_MEM_FENCE); oldval = _Asm_cmpxchg(AO_T_SIZE, _SEM_REL, addr, new_val, _LDHINT_NONE, _UP_MEM_FENCE); /* Hopefully the compiler knows not to reorder the above two? */ return (oldval == old); } #define AO_HAVE_compare_and_swap_release AO_INLINE int AO_char_compare_and_swap_acquire(volatile unsigned char *addr, unsigned char old, unsigned char new_val) { unsigned char oldval; _Asm_mov_to_ar(_AREG_CCV, old, _DOWN_MEM_FENCE); oldval = _Asm_cmpxchg(_SZ_B, _SEM_ACQ, addr, new_val, _LDHINT_NONE, _DOWN_MEM_FENCE); return (oldval == old); } #define AO_HAVE_char_compare_and_swap_acquire AO_INLINE int AO_char_compare_and_swap_release(volatile unsigned char *addr, unsigned char old, unsigned char new_val) { unsigned char oldval; _Asm_mov_to_ar(_AREG_CCV, old, _UP_MEM_FENCE); oldval = _Asm_cmpxchg(_SZ_B, _SEM_REL, addr, new_val, _LDHINT_NONE, _UP_MEM_FENCE); /* Hopefully the compiler knows not to reorder the above two? */ return (oldval == old); } #define AO_HAVE_char_compare_and_swap_release AO_INLINE int AO_short_compare_and_swap_acquire(volatile unsigned short *addr, unsigned short old, unsigned short new_val) { unsigned short oldval; _Asm_mov_to_ar(_AREG_CCV, old, _DOWN_MEM_FENCE); oldval = _Asm_cmpxchg(_SZ_B, _SEM_ACQ, addr, new_val, _LDHINT_NONE, _DOWN_MEM_FENCE); return (oldval == old); } #define AO_HAVE_short_compare_and_swap_acquire AO_INLINE int AO_short_compare_and_swap_release(volatile unsigned short *addr, unsigned short old, unsigned short new_val) { unsigned short oldval; _Asm_mov_to_ar(_AREG_CCV, old, _UP_MEM_FENCE); oldval = _Asm_cmpxchg(_SZ_B, _SEM_REL, addr, new_val, _LDHINT_NONE, _UP_MEM_FENCE); /* Hopefully the compiler knows not to reorder the above two? */ return (oldval == old); } #define AO_HAVE_short_compare_and_swap_release #ifndef __LP64__ # include "../ao_t_is_int.h" #endif synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/hpc/hppa.h0000664000076400007640000000732011104702317027277 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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. * * Derived from the corresponsing header file for gcc. * */ #include "../atomic_load_store.h" /* Some architecture set descriptions include special "ordered" memory */ /* operations. As far as we can tell, no existing processors actually */ /* require those. Nor does it appear likely that future processors */ /* will. */ /* FIXME: */ /* The PA emulator on Itanium may obey weaker restrictions. */ /* There should be a mode in which we don't assume sequential */ /* consistency here. */ #include "../ordered.h" #include /* GCC will not guarantee the alignment we need, use four lock words */ /* and select the correctly aligned datum. See the glibc 2.3.2 */ /* linuxthread port for the original implementation. */ struct AO_pa_clearable_loc { int data[4]; }; #undef AO_TS_INITIALIZER #define AO_TS_t struct AO_pa_clearable_loc #define AO_TS_INITIALIZER {1,1,1,1} /* Switch meaning of set and clear, since we only have an atomic clear */ /* instruction. */ typedef enum {AO_PA_TS_set = 0, AO_PA_TS_clear = 1} AO_PA_TS_val; #define AO_TS_VAL_t AO_PA_TS_val #define AO_TS_CLEAR AO_PA_TS_clear #define AO_TS_SET AO_PA_TS_set /* The hppa only has one atomic read and modify memory operation, */ /* load and clear, so hppa spinlocks must use zero to signify that */ /* someone is holding the lock. The address used for the ldcw */ /* semaphore must be 16-byte aligned. */ #define __ldcw(a, ret) \ _LDCWX(0 /* index */, 0 /* s */, a /* base */, ret); /* Because malloc only guarantees 8-byte alignment for malloc'd data, */ /* and GCC only guarantees 8-byte alignment for stack locals, we can't */ /* be assured of 16-byte alignment for atomic lock data even if we */ /* specify "__attribute ((aligned(16)))" in the type declaration. So, */ /* we use a struct containing an array of four ints for the atomic lock */ /* type and dynamically select the 16-byte aligned int from the array */ /* for the semaphore. */ #define __PA_LDCW_ALIGNMENT 16 #define __ldcw_align(a, ret) { \ ret = (unsigned long) a; \ ret += __PA_LDCW_ALIGNMENT - 1; \ ret &= ~(__PA_LDCW_ALIGNMENT - 1); \ } /* Works on PA 1.1 and PA 2.0 systems */ AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t * addr) { register unsigned int ret; register unsigned long a; __ldcw_align (addr, a); __ldcw (a, ret); return ret; } AO_INLINE void AO_pa_clear(volatile AO_TS_t * addr) { unsigned long a; __ldcw_align (addr,a); AO_compiler_barrier(); *(volatile unsigned int *)a = 1; } #define AO_CLEAR(addr) AO_pa_clear(addr) #define AO_HAVE_test_and_set_full ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootsynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/all_aligned_atomic_load_store.hsynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/all_aligned_atomic_load_store0000664000076400007640000000270611104702317033354 0ustar stefanstefan/* * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * Describes architectures on which AO_t, unsigned char, unsigned short, * and unsigned int loads and strores are atomic for all normally legal alignments. */ #include "aligned_atomic_load_store.h" #include "char_atomic_load_store.h" #include "short_aligned_atomic_load_store.h" #include "int_aligned_atomic_load_store.h" ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootsynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/short_acquire_release_volatile.hsynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/short_acquire_release_volatil0000664000076400007640000000372111104702317033452 0ustar stefanstefan/* * Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * This file adds definitions appropriate for environments in which an unsigned short * volatile load has acquire semantics, and an unsigned short volatile store has release * semantics. This is true with the standard Itanium ABI. */ #if !defined(AO_GCC_BARRIER) # if defined(__GNUC__) # define AO_GCC_BARRIER() AO_compiler_barrier() # else # define AO_GCC_BARRIER() # endif #endif AO_INLINE unsigned short AO_short_load_acquire(volatile unsigned short *p) { unsigned short result = *p; /* A normal volatile load generates an ld.acq */ AO_GCC_BARRIER(); return result; } #define AO_HAVE_short_load_acquire AO_INLINE void AO_short_store_release(volatile unsigned short *p, unsigned short val) { AO_GCC_BARRIER(); /* A normal volatile store generates an st.rel */ *p = val; } #define AO_HAVE_short_store_release synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/all_atomic_load_store.h0000664000076400007640000000266111104702317032117 0ustar stefanstefan/* * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * Describes architectures on which AO_t, unsigned char, unsigned short, * and unsigned int loads and strores are atomic for all normally legal * alignments. */ #include "atomic_load_store.h" #include "char_atomic_load_store.h" #include "short_atomic_load_store.h" #include "int_atomic_load_store.h" synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/msftc/0000775000076400007640000000000011172123233026535 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/msftc/x86_64.h0000664000076400007640000001071411104702317027650 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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. */ /* The following really assume we have a 486 or better. */ /* If ASSUME_WINDOWS98 is defined, we assume Windows 98 or newer. */ #include "../all_aligned_atomic_load_store.h" /* Real X86 implementations, except for some old WinChips, appear */ /* to enforce ordering between memory operations, EXCEPT that a later */ /* read can pass earlier writes, presumably due to the visible */ /* presence of store buffers. */ /* We ignore both the WinChips, and the fact that the official specs */ /* seem to be much weaker (and arguably too weak to be usable). */ #include "../ordered_except_wr.h" #if 0 FIXME: Need to reimplement testandset #include "../test_and_set_t_is_char.h" #else #include "../test_and_set_t_is_ao_t.h" #endif #include /* Seems like over-kill, but that's what MSDN recommends. */ /* And apparently winbase.h is not always self-contained. */ #include #pragma intrinsic (_ReadWriteBarrier) #ifdef __cplusplus extern "C" { #endif LONGLONG __cdecl _InterlockedIncrement64(LONGLONG volatile *Addend); LONGLONG __cdecl _InterlockedDecrement64(LONGLONG volatile *Addend); LONGLONG __cdecl _InterlockedExchangeAdd64(LONGLONG volatile* Target, LONGLONG Addend); LONGLONG __cdecl _InterlockedExchange64(LONGLONG volatile* Target, LONGLONG Value); LONGLONG __cdecl _InterlockedCompareExchange64(LONGLONG volatile* Dest, LONGLONG Exchange, LONGLONG Comp); #ifdef __cplusplus } #endif #pragma intrinsic (_InterlockedIncrement64) #pragma intrinsic (_InterlockedDecrement64) #pragma intrinsic (_InterlockedExchange64) #pragma intrinsic (_InterlockedExchangeAdd64) #pragma intrinsic (_InterlockedCompareExchange64) /* As far as we can tell, the lfence and sfence instructions are not */ /* currently needed or useful for cached memory accesses. */ /* Unfortunately mfence doesn't exist everywhere. */ /* IsProcessorFeaturePresent(PF_COMPARE_EXCHANGE128) is */ /* probably a conservative test for it? */ #if defined(AO_USE_PENTIUM4_INSTRS) AO_INLINE void AO_nop_full() { __asm { mfence } } #define AO_HAVE_nop_full #else /* We could use the cpuid instruction. But that seems to be slower */ /* than the default implementation based on test_and_set_full. Thus */ /* we omit that bit of misinformation here. */ #endif AO_INLINE AO_t AO_fetch_and_add_full (volatile AO_t *p, AO_t incr) { return _InterlockedExchangeAdd64((LONGLONG volatile *)p, (LONGLONG)incr); } #define AO_HAVE_fetch_and_add_full AO_INLINE AO_t AO_fetch_and_add1_full (volatile AO_t *p) { return _InterlockedIncrement64((LONGLONG volatile *)p) - 1; } #define AO_HAVE_fetch_and_add1_full AO_INLINE AO_t AO_fetch_and_sub1_full (volatile AO_t *p) { return _InterlockedDecrement64((LONGLONG volatile *)p) + 1; } #define AO_HAVE_fetch_and_sub1_full AO_INLINE int AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) { return _InterlockedCompareExchange64((LONGLONG volatile *)addr, (LONGLONG)new_val, (LONGLONG)old) == (LONGLONG)old; } #define AO_HAVE_compare_and_swap_full #if 0 FIXME: (__asm not supported) AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { __asm { mov eax,AO_TS_SET ; mov ebx,addr ; xchg byte ptr [ebx],al ; } } #define AO_HAVE_test_and_set_full #endif synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/msftc/x86.h0000664000076400007640000001127011104702317027335 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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. */ /* The following really assume we have a 486 or better. */ /* If ASSUME_WINDOWS98 is defined, we assume Windows 98 or newer. */ #include "../all_aligned_atomic_load_store.h" /* Real X86 implementations, except for some old WinChips, appear */ /* to enforce ordering between memory operations, EXCEPT that a later */ /* read can pass earlier writes, presumably due to the visible */ /* presence of store buffers. */ /* We ignore both the WinChips, and the fact that the official specs */ /* seem to be much weaker (and arguably too weak to be usable). */ #include "../ordered_except_wr.h" #include "../test_and_set_t_is_char.h" #include /* Seems like over-kill, but that's what MSDN recommends. */ /* And apparently winbase.h is not always self-contained. */ #if _MSC_VER < 1310 #define _InterlockedIncrement InterlockedIncrement #define _InterlockedDecrement InterlockedDecrement #define _InterlockedExchange InterlockedExchange #define _InterlockedCompareExchange InterlockedCompareExchange #else #if _MSC_VER >= 1400 #include #pragma intrinsic (_ReadWriteBarrier) #else #ifdef __cplusplus extern "C" { #endif LONG __cdecl _InterlockedIncrement(LONG volatile *Addend); LONG __cdecl _InterlockedDecrement(LONG volatile *Addend); LONG __cdecl _InterlockedExchangeAdd(LONG volatile* Target, LONG Addend); LONG __cdecl _InterlockedExchange(LONG volatile* Target, LONG Value); LONG __cdecl _InterlockedCompareExchange(LONG volatile* Dest, LONG Exchange, LONG Comp); #ifdef __cplusplus } #endif #endif /* _MSC_VER >= 1400 */ #pragma intrinsic (_InterlockedIncrement) #pragma intrinsic (_InterlockedDecrement) #pragma intrinsic (_InterlockedExchange) #pragma intrinsic (_InterlockedExchangeAdd) #pragma intrinsic (_InterlockedCompareExchange) #endif /* _MSC_VER < 1310 */ /* As far as we can tell, the lfence and sfence instructions are not */ /* currently needed or useful for cached memory accesses. */ /* Unfortunately mfence doesn't exist everywhere. */ /* IsProcessorFeaturePresent(PF_COMPARE_EXCHANGE128) is */ /* probably a conservative test for it? */ #if defined(AO_USE_PENTIUM4_INSTRS) AO_INLINE void AO_nop_full() { __asm { mfence } } #define AO_HAVE_nop_full #else /* We could use the cpuid instruction. But that seems to be slower */ /* than the default implementation based on test_and_set_full. Thus */ /* we omit that bit of misinformation here. */ #endif AO_INLINE AO_t AO_fetch_and_add_full (volatile AO_t *p, AO_t incr) { return _InterlockedExchangeAdd((LONG volatile*)p, (LONG)incr); } #define AO_HAVE_fetch_and_add_full AO_INLINE AO_t AO_fetch_and_add1_full (volatile AO_t *p) { return _InterlockedIncrement((LONG volatile *)p) - 1; } #define AO_HAVE_fetch_and_add1_full AO_INLINE AO_t AO_fetch_and_sub1_full (volatile AO_t *p) { return _InterlockedDecrement((LONG volatile *)p) + 1; } #define AO_HAVE_fetch_and_sub1_full AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { __asm { mov eax,AO_TS_SET ; mov ebx,addr ; xchg byte ptr [ebx],al ; } } #define AO_HAVE_test_and_set_full #ifdef AO_ASSUME_WINDOWS98 /* Returns nonzero if the comparison succeeded. */ AO_INLINE int AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) { return _InterlockedCompareExchange((LONG volatile *)addr, (LONG)new_val, (LONG)old) == (LONG)old; } #define AO_HAVE_compare_and_swap_full #endif /* ASSUME_WINDOWS98 */ #ifdef _WIN64 # error wrong architecture #endif #include "../ao_t_is_int.h" synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc/0000775000076400007640000000000011172123233026155 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc/m68k.h0000664000076400007640000000263511104702317027122 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved. * * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */ /* FIXME. Very incomplete. */ #include "../all_aligned_atomic_load_store.h" /* Are there any m68k multiprocessors still around? */ /* AFAIK, Alliants were sequentially consistent. */ #include "../ordered.h" #include "../test_and_set_t_is_ao_t.h" /* Contributed by Tony Mantler or new. Should be changed to MIT license? */ AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { int oldval; /* The return value is semi-phony. */ /* 'tas' sets bit 7 while the return */ /* value pretends bit 0 was set */ __asm__ __volatile__( "tas %1@; sne %0; negb %0" : "=d" (oldval) : "a" (addr) : "memory"); return oldval; } #define AO_HAVE_test_and_set_full synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc/x86_64.h0000664000076400007640000001015311104702317027265 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved. * * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * * Some of the machine specific code was borrowed from our GC distribution. */ /* The following really assume we have a 486 or better. Unfortunately */ /* gcc doesn't define a suitable feature test macro based on command */ /* line options. */ /* We should perhaps test dynamically. */ #include "../all_aligned_atomic_load_store.h" /* Real X86 implementations, except for some old WinChips, appear */ /* to enforce ordering between memory operations, EXCEPT that a later */ /* read can pass earlier writes, presumably due to the visible */ /* presence of store buffers. */ /* We ignore both the WinChips, and the fact that the official specs */ /* seem to be much weaker (and arguably too weak to be usable). */ #include "../ordered_except_wr.h" #include "../test_and_set_t_is_char.h" #if defined(AO_USE_PENTIUM4_INSTRS) AO_INLINE void AO_nop_full() { __asm__ __volatile__("mfence" : : : "memory"); } #define AO_HAVE_nop_full #else /* We could use the cpuid instruction. But that seems to be slower */ /* than the default implementation based on test_and_set_full. Thus */ /* we omit that bit of misinformation here. */ #endif /* As far as we can tell, the lfence and sfence instructions are not */ /* currently needed or useful for cached memory accesses. */ /* Really only works for 486 and later */ AO_INLINE AO_t AO_fetch_and_add_full (volatile AO_t *p, AO_t incr) { AO_t result; __asm__ __volatile__ ("lock; xaddq %0, %1" : "=r" (result), "=m" (*p) : "0" (incr), "m" (*p) : "memory"); return result; } #define AO_HAVE_fetch_and_add_full AO_INLINE unsigned char AO_char_fetch_and_add_full (volatile unsigned char *p, unsigned char incr) { unsigned char result; __asm__ __volatile__ ("lock; xaddb %0, %1" : "=q" (result), "=m" (*p) : "0" (incr), "m" (*p) : "memory"); return result; } #define AO_HAVE_char_fetch_and_add_full AO_INLINE unsigned short AO_short_fetch_and_add_full (volatile unsigned short *p, unsigned short incr) { unsigned short result; __asm__ __volatile__ ("lock; xaddw %0, %1" : "=r" (result), "=m" (*p) : "0" (incr), "m" (*p) : "memory"); return result; } #define AO_HAVE_short_fetch_and_add_full AO_INLINE unsigned short AO_int_fetch_and_add_full (volatile unsigned int *p, unsigned int incr) { unsigned int result; __asm__ __volatile__ ("lock; xaddl %0, %1" : "=r" (result), "=m" (*p) : "0" (incr), "m" (*p) : "memory"); return result; } #define AO_HAVE_int_fetch_and_add_full /* Really only works for 486 and later */ AO_INLINE void AO_or_full (volatile AO_t *p, AO_t incr) { __asm__ __volatile__ ("lock; orq %1, %0" : "=m" (*p) : "r" (incr), "m" (*p) : "memory"); } #define AO_HAVE_or_full AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { unsigned char oldval; /* Note: the "xchg" instruction does not need a "lock" prefix */ __asm__ __volatile__("xchgb %0, %1" : "=q"(oldval), "=m"(*addr) : "0"(0xff), "m"(*addr) : "memory"); return (AO_TS_VAL_t)oldval; } #define AO_HAVE_test_and_set_full /* Returns nonzero if the comparison succeeded. */ AO_INLINE int AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) { char result; __asm__ __volatile__("lock; cmpxchgq %3, %0; setz %1" : "=m"(*addr), "=q"(result) : "m"(*addr), "r" (new_val), "a"(old) : "memory"); return (int) result; } #define AO_HAVE_compare_and_swap_full /* FIXME: The Intel version has a 16byte CAS instruction. */ synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc/alpha.h0000664000076400007640000000355311104702317027422 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved. * * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */ #include "../atomic_load_store.h" #include "../test_and_set_t_is_ao_t.h" #define AO_NO_DD_ORDERING /* Data dependence does not imply read ordering. */ AO_INLINE void AO_nop_full() { __asm__ __volatile__("mb" : : : "memory"); } #define AO_HAVE_nop_full AO_INLINE void AO_nop_write() { __asm__ __volatile__("wmb" : : : "memory"); } #define AO_HAVE_nop_write /* mb should be used for AO_nop_read(). That's the default. */ /* We believe that ldq_l ... stq_c does not imply any memory barrier. */ /* We should add an explicit fetch_and_add definition. */ AO_INLINE int AO_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val) { unsigned long was_equal; unsigned long temp; __asm__ __volatile__( "1: ldq_l %0,%1\n" " cmpeq %0,%4,%2\n" " mov %3,%0\n" " beq %2,2f\n" " stq_c %0,%1\n" " beq %0,1b\n" "2:\n" :"=&r" (temp), "=m" (*addr), "=&r" (was_equal) : "r" (new_val), "Ir" (old) :"memory"); return was_equal; } #define AO_HAVE_compare_and_swap synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc/arm.h0000664000076400007640000000366111104702317027114 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved. * * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */ /* There exist multiprocessor SoC ARM processors, so this matters. */ /* This needs to be augmented for later ARM (e.g. V7) procesors. */ /* I found a slide set that, if I read it correctly, claims that */ /* Loads followed by either a Load or Store are ordered, but nothing */ /* else is. */ /* It appears that SWP is the only simple memory barrier. */ #include "../all_atomic_load_store.h" #include "../read_ordered.h" #include "../test_and_set_t_is_ao_t.h" /* Probably suboptimal */ AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { AO_TS_VAL_t oldval; /* SWP on ARM is very similar to XCHG on x86. */ /* The first operand is the result, the second the value */ /* to be stored. Both registers must be different from addr. */ /* Make the address operand an early clobber output so it */ /* doesn't overlap with the other operands. The early clobber*/ /* on oldval is neccessary to prevent the compiler allocating */ /* them to the same register if they are both unused. */ __asm__ __volatile__("swp %0, %2, [%3]" : "=&r"(oldval), "=&r"(addr) : "r"(1), "1"(addr) : "memory"); return oldval; } #define AO_HAVE_test_and_set_full synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc/powerpc.h0000664000076400007640000002045111104702317030010 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P. * * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */ /* FIXME. Incomplete. No support for 64 bits. */ /* Memory model documented at http://www-106.ibm.com/developerworks/ */ /* eserver/articles/archguide.html and (clearer) */ /* http://www-106.ibm.com/developerworks/eserver/articles/powerpc.html. */ /* There appears to be no implicit ordering between any kind of */ /* independent memory references. */ /* Architecture enforces some ordering based on control dependence. */ /* I don't know if that could help. */ /* Data-dependent loads are always ordered. */ /* Based on the above references, eieio is intended for use on */ /* uncached memory, which we don't support. It does not order loads */ /* from cached memory. */ /* Thanks to Maged Michael, Doug Lea, and Roger Hoover for helping to */ /* track some of this down and correcting my misunderstandings. -HB */ #include "../all_aligned_atomic_load_store.h" #include "../test_and_set_t_is_ao_t.h" /* There seems to be no byte equivalent of lwarx, so this */ /* may really be what we want, at least in the 32-bit case. */ AO_INLINE void AO_nop_full() { __asm__ __volatile__("sync" : : : "memory"); } #define AO_HAVE_nop_full /* lwsync apparently works for everything but a StoreLoad barrier. */ AO_INLINE void AO_lwsync() { __asm__ __volatile__("lwsync" : : : "memory"); } #define AO_nop_write() AO_lwsync() #define AO_HAVE_nop_write #define AO_nop_read() AO_lwsync() #define AO_HAVE_nop_read /* We explicitly specify load_acquire, since it is important, and can */ /* be implemented relatively cheaply. It could be implemented */ /* with an ordinary load followed by a lwsync. But the general wisdom */ /* seems to be that a data dependent branch followed by an isync is */ /* cheaper. And the documentation is fairly explicit that this also */ /* has acquire semantics. */ /* ppc64 uses ld not lwz */ #if defined(__powerpc64__) || defined(__ppc64__) || defined(__64BIT__) AO_INLINE AO_t AO_load_acquire(volatile AO_t *addr) { AO_t result; /* FIXME: We should get gcc to allocate one of the condition */ /* registers. I always got "impossible constraint" when I */ /* tried the "y" constraint. */ __asm__ __volatile__ ( "ld %0,%1\n" "cmpw cr7,%0,%0\n" "bne- cr7,1f\n" "1: isync\n" : "=r" (result) : "m"(*addr) : "memory", "cc"); return result; } #else AO_INLINE AO_t AO_load_acquire(volatile AO_t *addr) { AO_t result; /* FIXME: We should get gcc to allocate one of the condition */ /* registers. I always got "impossible constraint" when I */ /* tried the "y" constraint. */ __asm__ __volatile__ ( "lwz %0,%1\n" "cmpw cr7,%0,%0\n" "bne- cr7,1f\n" "1: isync\n" : "=r" (result) : "m"(*addr) : "memory", "cc"); return result; } #endif #define AO_HAVE_load_acquire /* We explicitly specify store_release, since it relies */ /* on the fact that lwsync is also a LoadStore barrier. */ AO_INLINE void AO_store_release(volatile AO_t *addr, AO_t value) { AO_lwsync(); *addr = value; } #define AO_HAVE_load_acquire /* This is similar to the code in the garbage collector. Deleting */ /* this and having it synthesized from compare_and_swap would probably */ /* only cost us a load immediate instruction. */ #if defined(__powerpc64__) || defined(__ppc64__) || defined(__64BIT__) /* Completely untested. And we should be using smaller objects anyway. */ AO_INLINE AO_TS_VAL_t AO_test_and_set(volatile AO_TS_t *addr) { unsigned long oldval; unsigned long temp = 1; /* locked value */ __asm__ __volatile__( "1:ldarx %0,0,%1\n" /* load and reserve */ "cmpdi %0, 0\n" /* if load is */ "bne 2f\n" /* non-zero, return already set */ "stdcx. %2,0,%1\n" /* else store conditional */ "bne- 1b\n" /* retry if lost reservation */ "2:\n" /* oldval is zero if we set */ : "=&r"(oldval) : "r"(addr), "r"(temp) : "memory", "cc"); return (AO_TS_VAL_t)oldval; } #else AO_INLINE AO_TS_VAL_t AO_test_and_set(volatile AO_TS_t *addr) { int oldval; int temp = 1; /* locked value */ __asm__ __volatile__( "1:lwarx %0,0,%1\n" /* load and reserve */ "cmpwi %0, 0\n" /* if load is */ "bne 2f\n" /* non-zero, return already set */ "stwcx. %2,0,%1\n" /* else store conditional */ "bne- 1b\n" /* retry if lost reservation */ "2:\n" /* oldval is zero if we set */ : "=&r"(oldval) : "r"(addr), "r"(temp) : "memory", "cc"); return (AO_TS_VAL_t)oldval; } #endif #define AO_have_test_and_set AO_INLINE AO_TS_VAL_t AO_test_and_set_acquire(volatile AO_TS_t *addr) { AO_TS_VAL_t result = AO_test_and_set(addr); AO_lwsync(); return result; } #define AO_HAVE_test_and_set_acquire AO_INLINE AO_TS_VAL_t AO_test_and_set_release(volatile AO_TS_t *addr) { AO_lwsync(); return AO_test_and_set(addr); } #define AO_HAVE_test_and_set_release AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { AO_TS_VAL_t result; AO_lwsync(); result = AO_test_and_set(addr); AO_lwsync(); return result; } #define AO_HAVE_test_and_set_full #if defined(__powerpc64__) || defined(__ppc64__) || defined(__64BIT__) /* FIXME: Completely untested. */ AO_INLINE int AO_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t oldval; int result = 0; __asm__ __volatile__( "1:ldarx %0,0,%2\n" /* load and reserve */ "cmpd %0, %4\n" /* if load is not equal to */ "bne 2f\n" /* old, fail */ "stdcx. %3,0,%2\n" /* else store conditional */ "bne- 1b\n" /* retry if lost reservation */ "li %1,1\n" /* result = 1; */ "2:\n" : "=&r"(oldval), "=&r"(result) : "r"(addr), "r"(new_val), "r"(old), "1"(result) : "memory", "cc"); return result; } #else AO_INLINE int AO_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t oldval; int result = 0; __asm__ __volatile__( "1:lwarx %0,0,%2\n" /* load and reserve */ "cmpw %0, %4\n" /* if load is not equal to */ "bne 2f\n" /* old, fail */ "stwcx. %3,0,%2\n" /* else store conditional */ "bne- 1b\n" /* retry if lost reservation */ "li %1,1\n" /* result = 1; */ "2:\n" : "=&r"(oldval), "=&r"(result) : "r"(addr), "r"(new_val), "r"(old), "1"(result) : "memory", "cc"); return result; } #endif #define AO_HAVE_compare_and_swap AO_INLINE int AO_compare_and_swap_acquire(volatile AO_t *addr, AO_t old, AO_t new_val) { int result = AO_compare_and_swap(addr, old, new_val); AO_lwsync(); return result; } #define AO_HAVE_compare_and_swap_acquire AO_INLINE int AO_compare_and_swap_release(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_lwsync(); return AO_compare_and_swap(addr, old, new_val); } #define AO_HAVE_compare_and_swap_release AO_INLINE int AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t result; AO_lwsync(); result = AO_compare_and_swap(addr, old, new_val); AO_lwsync(); return result; } #define AO_HAVE_compare_and_swap_full /* FIXME: We should also implement fetch_and_add and or primitives */ /* directly. */ synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc/ia64.h0000664000076400007640000002055011104702317027074 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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 "../all_atomic_load_store.h" #include "../all_acquire_release_volatile.h" #include "../test_and_set_t_is_char.h" #ifdef _ILP32 /* 32-bit HP/UX code. */ /* This requires pointer "swizzling". Pointers need to be expanded */ /* to 64 bits using the addp4 instruction before use. This makes it */ /* hard to share code, but we try anyway. */ # define AO_LEN "4" /* We assume that addr always appears in argument position 1 in asm */ /* code. If it is clobbered due to swizzling, we also need it in */ /* second position. Any later arguments are referenced symbolically, */ /* so that we don't have to worry about their position. This requires*/ /* gcc 3.1, but you shouldn't be using anything older than that on */ /* IA64 anyway. */ /* The AO_MASK macro is a workaround for the fact that HP/UX gcc */ /* appears to otherwise store 64-bit pointers in ar.ccv, i.e. it */ /* doesn't appear to clear high bits in a pointer value we pass into */ /* assembly code, even if it is supposedly of type AO_t. */ # define AO_IN_ADDR "1"(addr) # define AO_OUT_ADDR , "=r"(addr) # define AO_SWIZZLE "addp4 %1=0,%1;;\n" # define AO_MASK(ptr) __asm__("zxt4 %1=%1": "=r"(ptr) : "0"(ptr)); #else # define AO_LEN "8" # define AO_IN_ADDR "r"(addr) # define AO_OUT_ADDR # define AO_SWIZZLE # define AO_MASK(ptr) #endif AO_INLINE void AO_nop_full() { __asm__ __volatile__("mf" : : : "memory"); } #define AO_HAVE_nop_full AO_INLINE AO_t AO_fetch_and_add1_acquire (volatile AO_t *addr) { AO_t result; __asm__ __volatile__ (AO_SWIZZLE "fetchadd" AO_LEN ".acq %0=[%1],1": "=r" (result) AO_OUT_ADDR: AO_IN_ADDR :"memory"); return result; } #define AO_HAVE_fetch_and_add1_acquire AO_INLINE AO_t AO_fetch_and_add1_release (volatile AO_t *addr) { AO_t result; __asm__ __volatile__ (AO_SWIZZLE "fetchadd" AO_LEN ".rel %0=[%1],1": "=r" (result) AO_OUT_ADDR: AO_IN_ADDR :"memory"); return result; } #define AO_HAVE_fetch_and_add1_release AO_INLINE AO_t AO_fetch_and_sub1_acquire (volatile AO_t *addr) { AO_t result; __asm__ __volatile__ (AO_SWIZZLE "fetchadd" AO_LEN ".acq %0=[%1],-1": "=r" (result) AO_OUT_ADDR: AO_IN_ADDR :"memory"); return result; } #define AO_HAVE_fetch_and_sub1_acquire AO_INLINE AO_t AO_fetch_and_sub1_release (volatile AO_t *addr) { AO_t result; __asm__ __volatile__ (AO_SWIZZLE "fetchadd" AO_LEN ".rel %0=[%1],-1": "=r" (result) AO_OUT_ADDR: AO_IN_ADDR :"memory"); return result; } #define AO_HAVE_fetch_and_sub1_release #ifndef _ILP32 AO_INLINE unsigned int AO_int_fetch_and_add1_acquire (volatile unsigned int *addr) { unsigned int result; __asm__ __volatile__ ("fetchadd4.acq %0=[%1],1": "=r" (result): AO_IN_ADDR :"memory"); return result; } #define AO_HAVE_int_fetch_and_add1_acquire AO_INLINE unsigned int AO_int_fetch_and_add1_release (volatile unsigned int *addr) { unsigned int result; __asm__ __volatile__ ("fetchadd4.rel %0=[%1],1": "=r" (result): AO_IN_ADDR :"memory"); return result; } #define AO_HAVE_int_fetch_and_add1_release AO_INLINE unsigned int AO_int_fetch_and_sub1_acquire (volatile unsigned int *addr) { unsigned int result; __asm__ __volatile__ ("fetchadd4.acq %0=[%1],-1": "=r" (result): AO_IN_ADDR :"memory"); return result; } #define AO_HAVE_int_fetch_and_sub1_acquire AO_INLINE unsigned int AO_int_fetch_and_sub1_release (volatile unsigned int *addr) { unsigned int result; __asm__ __volatile__ ("fetchadd4.rel %0=[%1],-1": "=r" (result): AO_IN_ADDR :"memory"); return result; } #define AO_HAVE_int_fetch_and_sub1_release #endif /* !_ILP32 */ AO_INLINE int AO_compare_and_swap_acquire(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t oldval; AO_MASK(old); __asm__ __volatile__(AO_SWIZZLE "mov ar.ccv=%[old] ;; cmpxchg" AO_LEN ".acq %0=[%1],%[new_val],ar.ccv" : "=r"(oldval) AO_OUT_ADDR : AO_IN_ADDR, [new_val]"r"(new_val), [old]"r"(old) : "memory"); return (oldval == old); } #define AO_HAVE_compare_and_swap_acquire AO_INLINE int AO_compare_and_swap_release(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t oldval; AO_MASK(old); __asm__ __volatile__(AO_SWIZZLE "mov ar.ccv=%[old] ;; cmpxchg" AO_LEN ".rel %0=[%1],%[new_val],ar.ccv" : "=r"(oldval) AO_OUT_ADDR : AO_IN_ADDR, [new_val]"r"(new_val), [old]"r"(old) : "memory"); return (oldval == old); } #define AO_HAVE_compare_and_swap_release AO_INLINE int AO_char_compare_and_swap_acquire(volatile unsigned char *addr, unsigned char old, unsigned char new_val) { unsigned char oldval; __asm__ __volatile__(AO_SWIZZLE "mov ar.ccv=%[old] ;; cmpxchg1.acq %0=[%1],%[new_val],ar.ccv" : "=r"(oldval) AO_OUT_ADDR : AO_IN_ADDR, [new_val]"r"(new_val), [old]"r"((AO_t)old) : "memory"); return (oldval == old); } #define AO_HAVE_char_compare_and_swap_acquire AO_INLINE int AO_char_compare_and_swap_release(volatile unsigned char *addr, unsigned char old, unsigned char new_val) { unsigned char oldval; __asm__ __volatile__(AO_SWIZZLE "mov ar.ccv=%[old] ;; cmpxchg1.rel %0=[%1],%[new_val],ar.ccv" : "=r"(oldval) AO_OUT_ADDR : AO_IN_ADDR, [new_val]"r"(new_val), [old]"r"((AO_t)old) : "memory"); return (oldval == old); } #define AO_HAVE_char_compare_and_swap_release AO_INLINE int AO_short_compare_and_swap_acquire(volatile unsigned short *addr, unsigned short old, unsigned short new_val) { unsigned short oldval; __asm__ __volatile__(AO_SWIZZLE "mov ar.ccv=%[old] ;; cmpxchg2.acq %0=[%1],%[new_val],ar.ccv" : "=r"(oldval) AO_OUT_ADDR : AO_IN_ADDR, [new_val]"r"(new_val), [old]"r"((AO_t)old) : "memory"); return (oldval == old); } #define AO_HAVE_short_compare_and_swap_acquire AO_INLINE int AO_short_compare_and_swap_release(volatile unsigned short *addr, unsigned short old, unsigned short new_val) { unsigned short oldval; __asm__ __volatile__(AO_SWIZZLE "mov ar.ccv=%[old] ;; cmpxchg2.rel %0=[%1],%[new_val],ar.ccv" : "=r"(oldval) AO_OUT_ADDR : AO_IN_ADDR, [new_val]"r"(new_val), [old]"r"((AO_t)old) : "memory"); return (oldval == old); } #define AO_HAVE_short_compare_and_swap_release #ifndef _ILP32 AO_INLINE int AO_int_compare_and_swap_acquire(volatile unsigned int *addr, unsigned int old, unsigned int new_val) { unsigned int oldval; __asm__ __volatile__("mov ar.ccv=%3 ;; cmpxchg4.acq %0=[%1],%2,ar.ccv" : "=r"(oldval) : AO_IN_ADDR, "r"(new_val), "r"((AO_t)old) : "memory"); return (oldval == old); } #define AO_HAVE_int_compare_and_swap_acquire AO_INLINE int AO_int_compare_and_swap_release(volatile unsigned int *addr, unsigned int old, unsigned int new_val) { unsigned int oldval; __asm__ __volatile__("mov ar.ccv=%3 ;; cmpxchg4.rel %0=[%1],%2,ar.ccv" : "=r"(oldval) : AO_IN_ADDR, "r"(new_val), "r"((AO_t)old) : "memory"); return (oldval == old); } #define AO_HAVE_int_compare_and_swap_release #endif /* !_ILP32 */ /* FIXME: Add compare_and_swap_double as soon as there is widely */ /* available hardware that implements it. */ /* FIXME: Add compare_double_and_swap_double for the _ILP32 case. */ #ifdef _ILP32 # include "../ao_t_is_int.h" #endif synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc/s390.h0000664000076400007640000000444311104702317027032 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved. * * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */ /* FIXME: untested. */ /* The relevant documentation appears to be at */ /* http://publibz.boulder.ibm.com/epubs/pdf/dz9zr003.pdf */ /* around page 5-96. Apparently: */ /* - Memory references in general are atomic only for a single */ /* byte. But it appears that the most common load/store */ /* instructions also guarantee atomicity for aligned */ /* operands of standard types. WE FOOLISHLY ASSUME that */ /* compilers only generate those. If that turns out to be */ /* wrong, we need inline assembly code for AO_load and */ /* AO_store. */ /* - A store followed by a load is unordered since the store */ /* may be delayed. Otherwise everything is ordered. */ /* - There is a hardware compare-and-swap (CS) instruction. */ #include "ordered_except_wr.h" #include "all_aligned_atomic_load_store.h" #include "../test_and_set_t_is_ao_t.h" /* FIXME: Is there a way to do byte-sized test-and-set? */ /* FIXME: AO_nop_full should probably be implemented directly. */ /* It appears that certain BCR instructions have that effect. */ /* Presumably they're cheaper than CS? */ AO_INLINE AO_t AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) { int retval; __asm__ __volatile__ ( # ifndef __s390x__ " cs %1,%2,0(%3)\n" # else " csg %1,%2,0(%3)\n" # endif " ipm %0\n" " srl %0,28\n" : "=&d" (retval), "+d" (old) : "d" (new_val), "a" (addr) : "cc", "memory"); return retval == 0; } #define AO_HAVE_compare_and_swap_full /* FIXME: Add double-wide compare-and-swap for 32-bit executables. */ synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc/x86.h0000664000076400007640000001057611104702317026765 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved. * * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * * Some of the machine specific code was borrowed from our GC distribution. */ /* The following really assume we have a 486 or better. Unfortunately */ /* gcc doesn't define a suitable feature test macro based on command */ /* line options. */ /* We should perhaps test dynamically. */ #include "../all_aligned_atomic_load_store.h" /* Real X86 implementations, except for some old WinChips, appear */ /* to enforce ordering between memory operations, EXCEPT that a later */ /* read can pass earlier writes, presumably due to the visible */ /* presence of store buffers. */ /* We ignore both the WinChips, and the fact that the official specs */ /* seem to be much weaker (and arguably too weak to be usable). */ #include "../ordered_except_wr.h" #include "../test_and_set_t_is_char.h" #include "../standard_ao_double_t.h" #if defined(AO_USE_PENTIUM4_INSTRS) AO_INLINE void AO_nop_full() { __asm__ __volatile__("mfence" : : : "memory"); } #define AO_HAVE_nop_full #else /* We could use the cpuid instruction. But that seems to be slower */ /* than the default implementation based on test_and_set_full. Thus */ /* we omit that bit of misinformation here. */ #endif /* As far as we can tell, the lfence and sfence instructions are not */ /* currently needed or useful for cached memory accesses. */ /* Really only works for 486 and later */ AO_INLINE AO_t AO_fetch_and_add_full (volatile AO_t *p, AO_t incr) { AO_t result; __asm__ __volatile__ ("lock; xaddl %0, %1" : "=r" (result), "=m" (*p) : "0" (incr), "m" (*p) : "memory"); return result; } #define AO_HAVE_fetch_and_add_full AO_INLINE unsigned char AO_char_fetch_and_add_full (volatile unsigned char *p, unsigned char incr) { unsigned char result; __asm__ __volatile__ ("lock; xaddb %0, %1" : "=q" (result), "=m" (*p) : "0" (incr), "m" (*p) : "memory"); return result; } #define AO_HAVE_char_fetch_and_add_full AO_INLINE unsigned short AO_short_fetch_and_add_full (volatile unsigned short *p, unsigned short incr) { unsigned short result; __asm__ __volatile__ ("lock; xaddw %0, %1" : "=r" (result), "=m" (*p) : "0" (incr), "m" (*p) : "memory"); return result; } #define AO_HAVE_short_fetch_and_add_full /* Really only works for 486 and later */ AO_INLINE void AO_or_full (volatile AO_t *p, AO_t incr) { __asm__ __volatile__ ("lock; orl %1, %0" : "=m" (*p) : "r" (incr), "m" (*p) : "memory"); } #define AO_HAVE_or_full AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { unsigned char oldval; /* Note: the "xchg" instruction does not need a "lock" prefix */ __asm__ __volatile__("xchgb %0, %1" : "=q"(oldval), "=m"(*addr) : "0"(0xff), "m"(*addr) : "memory"); return (AO_TS_VAL_t)oldval; } #define AO_HAVE_test_and_set_full /* Returns nonzero if the comparison succeeded. */ AO_INLINE int AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) { char result; __asm__ __volatile__("lock; cmpxchgl %3, %0; setz %1" : "=m"(*addr), "=q"(result) : "m"(*addr), "r" (new_val), "a"(old) : "memory"); return (int) result; } #define AO_HAVE_compare_and_swap_full /* Returns nonzero if the comparison succeeded. */ /* Really requires at least a Pentium. */ AO_INLINE int AO_compare_double_and_swap_double_full(volatile AO_double_t *addr, AO_t old_val1, AO_t old_val2, AO_t new_val1, AO_t new_val2) { char result; __asm__ __volatile__("lock; cmpxchg8b %0; setz %1" : "=m"(*addr), "=q"(result) : "m"(*addr), "d" (old_val1), "a" (old_val2), "c" (new_val1), "b" (new_val2) : "memory"); return (int) result; } #define AO_HAVE_double_compare_and_swap_full #include "../ao_t_is_int.h" synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc/cris.h0000664000076400007640000000547411104702317027301 0ustar stefanstefan/* * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. * * 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. * * Most of this code originally comes from Hans-Peter Nilsson. It is included * here with his permission. * * This version has not been tested. It was coped here from a GC * patch so that we wouldn't lose the code in the upgrade to gc7. */ #include "../all_atomic_load_store.h" #include "../ordered.h" /* There are no multiprocessor implementations. */ #include "../test_and_set_t_is_ao_t.h" /* * The architecture apparently supports an "f" flag which is * set on preemption. This essentially gives us load-locked, * store-conditional primitives, though I'm not quite sure how * this would work on a hypothetical multiprocessor. -HB * * For details, see * http://developer.axis.com/doc/hardware/etrax100lx/prog_man/ * 1_architectural_description.pdf * * Presumably many other primitives (notably CAS, including the double- * width versions) could be implemented in this manner, if someone got * around to it. */ AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { /* Ripped from linuxthreads/sysdeps/cris/pt-machine.h */ register unsigned long int ret; /* Note the use of a dummy output of *addr to expose the write. The memory barrier is to stop *other* writes being moved past this code. */ __asm__ __volatile__("clearf\n" "0:\n\t" "movu.b [%2],%0\n\t" "ax\n\t" "move.b %3,[%2]\n\t" "bwf 0b\n\t" "clearf" : "=&r" (ret), "=m" (*addr) : "r" (addr), "r" ((int) 1), "m" (*addr) : "memory"); return ret; } #define AO_HAVE_test_and_set_full synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc/hppa.h0000664000076400007640000000723211104702317027263 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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. * * Modified by Carlos O'Donell , 2003 * - Added self-aligning lock. * */ #include "../all_atomic_load_store.h" /* Some architecture set descriptions include special "ordered" memory */ /* operations. As far as we can tell, no existing processors actually */ /* require those. Nor does it appear likely that future processors */ /* will. */ #include "../ordered.h" /* GCC will not guarantee the alignment we need, use four lock words */ /* and select the correctly aligned datum. See the glibc 2.3.2 */ /* linuxthread port for the original implementation. */ struct AO_pa_clearable_loc { int data[4]; }; #undef AO_TS_INITIALIZER #define AO_TS_t struct AO_pa_clearable_loc #define AO_TS_INITIALIZER {1,1,1,1} /* Switch meaning of set and clear, since we only have an atomic clear */ /* instruction. */ typedef enum {AO_PA_TS_set = 0, AO_PA_TS_clear = 1} AO_PA_TS_val; #define AO_TS_VAL_t AO_PA_TS_val #define AO_TS_CLEAR AO_PA_TS_clear #define AO_TS_SET AO_PA_TS_set /* The hppa only has one atomic read and modify memory operation, */ /* load and clear, so hppa spinlocks must use zero to signify that */ /* someone is holding the lock. The address used for the ldcw */ /* semaphore must be 16-byte aligned. */ #define __ldcw(a) ({ \ volatile unsigned int __ret; \ __asm__ __volatile__("ldcw 0(%2),%0" \ : "=r" (__ret), "=m" (*(a)) : "r" (a)); \ __ret; \ }) /* Because malloc only guarantees 8-byte alignment for malloc'd data, */ /* and GCC only guarantees 8-byte alignment for stack locals, we can't */ /* be assured of 16-byte alignment for atomic lock data even if we */ /* specify "__attribute ((aligned(16)))" in the type declaration. So, */ /* we use a struct containing an array of four ints for the atomic lock */ /* type and dynamically select the 16-byte aligned int from the array */ /* for the semaphore. */ #define __PA_LDCW_ALIGNMENT 16 #define __ldcw_align(a) ({ \ unsigned long __ret = (unsigned long) a; \ __ret += __PA_LDCW_ALIGNMENT - 1; \ __ret &= ~(__PA_LDCW_ALIGNMENT - 1); \ (volatile unsigned int *) __ret; \ }) /* Works on PA 1.1 and PA 2.0 systems */ AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t * addr) { volatile unsigned int *a = __ldcw_align (addr); return (AO_TS_VAL_t) __ldcw (a); } AO_INLINE void AO_pa_clear(volatile AO_TS_t * addr) { volatile unsigned int *a = __ldcw_align (addr); AO_compiler_barrier(); *a = 1; } #define AO_CLEAR(addr) AO_pa_clear(addr) #define AO_HAVE_test_and_set_full synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc/sparc.h0000664000076400007640000000304211104702317027436 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved. * * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */ /* FIXME. Very incomplete. No support for sparc64. */ /* Non-ancient SPARCs provide compare-and-swap (casa). */ /* We should make that available. */ #include "../all_atomic_load_store.h" /* Real SPARC code uses TSO: */ #include "../ordered_except_wr.h" /* Test_and_set location is just a byte. */ #include "../test_and_set_t_is_char.h" AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { int oldval; __asm__ __volatile__("ldstub %1,%0" : "=r"(oldval), "=m"(*addr) : "m"(*addr) : "memory"); return oldval; } #define AO_HAVE_test_and_set_full /* FIXME: This needs to be extended for SPARC v8 and v9. */ /* SPARC V8 also has swap. V9 has CAS. */ /* There are barriers like membar #LoadStore. */ /* CASA (32-bit) and CASXA(64-bit) instructions were */ /* added in V9. */ ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootsynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/char_acquire_release_volatile.hsynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/char_acquire_release_volatile0000664000076400007640000000370611104702317033400 0ustar stefanstefan/* * Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * This file adds definitions appropriate for environments in which an unsigned char * volatile load has acquire semantics, and an unsigned char volatile store has release * semantics. This is true with the standard Itanium ABI. */ #if !defined(AO_GCC_BARRIER) # if defined(__GNUC__) # define AO_GCC_BARRIER() AO_compiler_barrier() # else # define AO_GCC_BARRIER() # endif #endif AO_INLINE unsigned char AO_char_load_acquire(volatile unsigned char *p) { unsigned char result = *p; /* A normal volatile load generates an ld.acq */ AO_GCC_BARRIER(); return result; } #define AO_HAVE_char_load_acquire AO_INLINE void AO_char_store_release(volatile unsigned char *p, unsigned char val) { AO_GCC_BARRIER(); /* A normal volatile store generates an st.rel */ *p = val; } #define AO_HAVE_char_store_release synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/standard_ao_double_t.h0000664000076400007640000000030711104702317031727 0ustar stefanstefantypedef union { unsigned long long AO_whole; struct {AO_t AO_v1; AO_t AO_v2;} AO_parts; } AO_double_t; #define AO_HAVE_double_t #define AO_val1 AO_parts.AO_v1 #define AO_val2 AO_parts.AO_v2 ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootsynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/short_aligned_atomic_load_store.hsynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/short_aligned_atomic_load_sto0000664000076400007640000000341611104702317033413 0ustar stefanstefan/* * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * Definitions for architecturs on which loads and stores of unsigned short are * atomic fo all legal alignments. */ AO_INLINE unsigned short AO_short_load(volatile unsigned short *addr) { assert(((size_t)addr & (sizeof(unsigned short) - 1)) == 0); /* Cast away the volatile for architectures like IA64 where */ /* volatile adds barrier semantics. */ return (*(unsigned short *)addr); } #define AO_HAVE_short_load AO_INLINE void AO_short_store(volatile unsigned short *addr, unsigned short new_val) { assert(((size_t)addr & (sizeof(unsigned short) - 1)) == 0); (*(unsigned short *)addr) = new_val; } #define AO_HAVE_short_store synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h0000664000076400007640000000312311104702317032266 0ustar stefanstefan/* * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * These are common definitions for architectures on which test_and_set * operates on pointer-sized quantities, the "clear" value contains * all zeroes, and the "set" value contains all ones. * This can be used if test_and_set is synthesized from compare_and_swap. */ typedef enum {AO_TS_clear = 0, AO_TS_set = 1} AO_TS_val; #define AO_TS_VAL_t AO_TS_val #define AO_TS_CLEAR AO_TS_clear #define AO_TS_SET AO_TS_set #define AO_TS_t AO_t #define AO_AO_TS_T 1 synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ao_t_is_int.h0000664000076400007640000001160411104702317030064 0ustar stefanstefan/* * Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * Inclusion of this file signifies that AO_t is in fact int. Hence * any AO_... operations can also server as AO_int_... operations. * We currently define only the more important ones here, and allow for * the normal generalization process to define the others. * We should probably add others in the future. */ #if defined(AO_HAVE_compare_and_swap_full) && \ !defined(AO_HAVE_int_compare_and_swap_full) # define AO_int_compare_and_swap_full(addr, old, new_val) \ AO_compare_and_swap_full((volatile AO_t *)addr, \ (AO_t) old, (AO_t)new_val) # define AO_HAVE_int_compare_and_swap_full # endif #if defined(AO_HAVE_compare_and_swap_acquire) && \ !defined(AO_HAVE_int_compare_and_swap_acquire) # define AO_int_compare_and_swap_acquire(addr, old, new_val) \ AO_compare_and_swap_acquire((volatile AO_t *)addr, \ (AO_t) old, (AO_t)new_val) # define AO_HAVE_int_compare_and_swap_acquire # endif #if defined(AO_HAVE_compare_and_swap_release) && \ !defined(AO_HAVE_int_compare_and_swap_release) # define AO_int_compare_and_swap_release(addr, old, new_val) \ AO_compare_and_swap_release((volatile AO_t *)addr, \ (AO_t) old, (AO_t)new_val) # define AO_HAVE_int_compare_and_swap_release # endif #if defined(AO_HAVE_compare_and_swap_write) && \ !defined(AO_HAVE_int_compare_and_swap_write) # define AO_int_compare_and_swap_write(addr, old, new_val) \ AO_compare_and_swap_write((volatile AO_t *)addr, \ (AO_t) old, (AO_t)new_val) # define AO_HAVE_int_compare_and_swap_write # endif #if defined(AO_HAVE_compare_and_swap_read) && \ !defined(AO_HAVE_int_compare_and_swap_read) # define AO_int_compare_and_swap_read(addr, old, new_val) \ AO_compare_and_swap_read((volatile AO_t *)addr, \ (AO_t) old, (AO_t)new_val) # define AO_HAVE_int_compare_and_swap_read # endif #if defined(AO_HAVE_compare_and_swap) && \ !defined(AO_HAVE_int_compare_and_swap) # define AO_int_compare_and_swap(addr, old, new_val) \ AO_compare_and_swap((volatile AO_t *)addr, \ (AO_t) old, (AO_t)new_val) # define AO_HAVE_int_compare_and_swap # endif #if defined(AO_HAVE_load_acquire) && \ !defined(AO_HAVE_int_load_acquire) # define AO_int_load_acquire(addr) (int)AO_load_acquire((volatile AO_t *)addr) # define AO_HAVE_int_load_acquire # endif #if defined(AO_HAVE_store_release) && \ !defined(AO_HAVE_int_store_release) # define AO_int_store_release(addr, val) \ AO_store_release((volatile AO_t *)addr, (AO_t)val) # define AO_HAVE_int_store_release # endif #if defined(AO_HAVE_fetch_and_add_full) && \ !defined(AO_HAVE_int_fetch_and_add_full) # define AO_int_fetch_and_add_full(addr, incr) \ (int)AO_fetch_and_add_full((volatile AO_t *)addr, (AO_t)incr) # define AO_HAVE_int_fetch_and_add_full # endif #if defined(AO_HAVE_fetch_and_add1_acquire) && \ !defined(AO_HAVE_int_fetch_and_add1_acquire) # define AO_int_fetch_and_add1_acquire(addr) \ (int)AO_fetch_and_add1_acquire((volatile AO_t *)addr) # define AO_HAVE_int_fetch_and_add1_acquire # endif #if defined(AO_HAVE_fetch_and_add1_release) && \ !defined(AO_HAVE_int_fetch_and_add1_release) # define AO_int_fetch_and_add1_release(addr) \ (int)AO_fetch_and_add1_release((volatile AO_t *)addr) # define AO_HAVE_int_fetch_and_add1_release # endif #if defined(AO_HAVE_fetch_and_sub1_acquire) && \ !defined(AO_HAVE_int_fetch_and_sub1_acquire) # define AO_int_fetch_and_sub1_acquire(addr) \ (int)AO_fetch_and_sub1_acquire((volatile AO_t *)addr) # define AO_HAVE_int_fetch_and_sub1_acquire # endif #if defined(AO_HAVE_fetch_and_sub1_release) && \ !defined(AO_HAVE_int_fetch_and_sub1_release) # define AO_int_fetch_and_sub1_release(addr) \ (int)AO_fetch_and_sub1_release((volatile AO_t *)addr) # define AO_HAVE_int_fetch_and_sub1_release # endif synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/Makefile.in0000664000076400007640000003032611104702317027473 0ustar stefanstefan# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = src/atomic_ops/sysdeps DIST_COMMON = README $(nobase_sysdep_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(sysdepdir)" nobase_sysdepHEADERS_INSTALL = $(install_sh_DATA) HEADERS = $(nobase_sysdep_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@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ NEED_ASM_FALSE = @NEED_ASM_FALSE@ NEED_ASM_TRUE = @NEED_ASM_TRUE@ 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@ PICFLAG = @PICFLAG@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_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@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ #General sysdep utility headers, followed by the arch-specific ones nobase_sysdep_HEADERS = generic_pthread.h \ atomic_load_store.h \ aligned_atomic_load_store.h \ acquire_release_volatile.h \ char_acquire_release_volatile.h \ char_atomic_load_store.h \ short_acquire_release_volatile.h \ short_aligned_atomic_load_store.h \ short_atomic_load_store.h \ int_acquire_release_volatile.h \ int_aligned_atomic_load_store.h \ int_atomic_load_store.h \ all_acquire_release_volatile.h \ all_aligned_atomic_load_store.h \ all_atomic_load_store.h \ read_ordered.h \ ordered_except_wr.h \ ordered.h \ ao_t_is_int.h \ test_and_set_t_is_ao_t.h \ test_and_set_t_is_char.h \ emul_cas.h \ standard_ao_double_t.h \ README \ \ gcc/alpha.h gcc/arm.h gcc/x86.h \ gcc/hppa.h gcc/ia64.h \ gcc/powerpc.h gcc/sparc.h \ gcc/hppa.h gcc/m68k.h gcc/s390.h \ gcc/ia64.h gcc/x86_64.h gcc/cris.h \ \ icc/ia64.h \ \ msftc/x86.h \ msftc/x86_64.h \ \ hpc/ia64.h hpc/hppa.h \ \ sunc/sparc.h \ \ ibmc/powerpc.h sysdepdir = ${includedir}/atomic_ops/sysdeps # A few architectures require special .S files EXTRA_DIST = sunc/sparc.S all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/atomic_ops/sysdeps/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/atomic_ops/sysdeps/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-nobase_sysdepHEADERS: $(nobase_sysdep_HEADERS) @$(NORMAL_INSTALL) test -z "$(sysdepdir)" || $(mkdir_p) "$(DESTDIR)$(sysdepdir)" @$(am__vpath_adj_setup) \ list='$(nobase_sysdep_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ $(am__vpath_adj) \ echo " $(nobase_sysdepHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sysdepdir)/$$f'"; \ $(nobase_sysdepHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sysdepdir)/$$f"; \ done uninstall-nobase_sysdepHEADERS: @$(NORMAL_UNINSTALL) @$(am__vpath_adj_setup) \ list='$(nobase_sysdep_HEADERS)'; for p in $$list; do \ $(am__vpath_adj) \ echo " rm -f '$(DESTDIR)$(sysdepdir)/$$f'"; \ rm -f "$(DESTDIR)$(sysdepdir)/$$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) $(mkdir_p) $(distdir)/gcc $(distdir)/hpc $(distdir)/ibmc $(distdir)/icc $(distdir)/msftc $(distdir)/sunc @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 $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sysdepdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-nobase_sysdepHEADERS install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am uninstall-nobase_sysdepHEADERS .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ ctags distclean distclean-generic distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-exec install-exec-am \ install-info install-info-am install-man \ install-nobase_sysdepHEADERS install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am \ uninstall-nobase_sysdepHEADERS # 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: synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/icc/0000775000076400007640000000000011172123233026157 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/icc/ia64.h0000664000076400007640000001363611104702317027105 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * 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. */ /* * This file specifies Itanimum primitives for use with the Intel (ecc) * compiler. We use intrinsics instead of the inline assembly code in the * gcc file. */ #include "../all_atomic_load_store.h" #include "../test_and_set_t_is_char.h" #include /* The acquire release semantics of volatile can be turned off. And volatile */ /* operations in icc9 don't imply ordering with respect to other nonvolatile */ /* operations. */ #define AO_INTEL_PTR_t void * AO_INLINE AO_t AO_load_acquire(volatile AO_t *p) { return (AO_t)(__ld8_acq((AO_INTEL_PTR_t)p)); } #define AO_HAVE_load_acquire AO_INLINE void AO_store_release(volatile AO_t *p, AO_t val) { __st8_rel((AO_INTEL_PTR_t)p, (__int64)val); } #define AO_HAVE_store_release AO_INLINE unsigned char AO_char_load_acquire(volatile unsigned char *p) { /* A normal volatile load generates an ld.acq */ return (__ld1_acq((AO_INTEL_PTR_t)p)); } #define AO_HAVE_char_load_acquire AO_INLINE void AO_char_store_release(volatile unsigned char *p, unsigned char val) { __st1_rel((AO_INTEL_PTR_t)p, val); } #define AO_HAVE_char_store_release AO_INLINE unsigned short AO_short_load_acquire(volatile unsigned short *p) { /* A normal volatile load generates an ld.acq */ return (__ld2_acq((AO_INTEL_PTR_t)p)); } #define AO_HAVE_short_load_acquire AO_INLINE void AO_short_store_release(volatile unsigned short *p, unsigned short val) { __st2_rel((AO_INTEL_PTR_t)p, val); } #define AO_HAVE_short_store_release AO_INLINE unsigned int AO_int_load_acquire(volatile unsigned int *p) { /* A normal volatile load generates an ld.acq */ return (__ld4_acq((AO_INTEL_PTR_t)p)); } #define AO_HAVE_int_load_acquire AO_INLINE void AO_int_store_release(volatile unsigned int *p, unsigned int val) { __st4_rel((AO_INTEL_PTR_t)p, val); } #define AO_HAVE_int_store_release AO_INLINE void AO_nop_full() { __mf(); } #define AO_HAVE_nop_full AO_INLINE AO_t AO_fetch_and_add1_acquire (volatile AO_t *p) { return __fetchadd8_acq((unsigned __int64 *)p, 1); } #define AO_HAVE_fetch_and_add1_acquire AO_INLINE AO_t AO_fetch_and_add1_release (volatile AO_t *p) { return __fetchadd8_rel((unsigned __int64 *)p, 1); } #define AO_HAVE_fetch_and_add1_release AO_INLINE AO_t AO_fetch_and_sub1_acquire (volatile AO_t *p) { return __fetchadd8_acq((unsigned __int64 *)p, -1); } #define AO_HAVE_fetch_and_sub1_acquire AO_INLINE AO_t AO_fetch_and_sub1_release (volatile AO_t *p) { return __fetchadd8_rel((unsigned __int64 *)p, -1); } #define AO_HAVE_fetch_and_sub1_release AO_INLINE int AO_compare_and_swap_acquire(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t oldval; oldval = _InterlockedCompareExchange64_acq(addr, new_val, old); return (oldval == old); } #define AO_HAVE_compare_and_swap_acquire AO_INLINE int AO_compare_and_swap_release(volatile AO_t *addr, AO_t old, AO_t new_val) { AO_t oldval; oldval = _InterlockedCompareExchange64_rel(addr, new_val, old); return (oldval == old); } #define AO_HAVE_compare_and_swap_release AO_INLINE int AO_char_compare_and_swap_acquire(volatile unsigned char *addr, unsigned char old, unsigned char new_val) { unsigned char oldval; oldval = _InterlockedCompareExchange8_acq(addr, new_val, old); return (oldval == old); } #define AO_HAVE_char_compare_and_swap_acquire AO_INLINE int AO_char_compare_and_swap_release(volatile unsigned char *addr, unsigned char old, unsigned char new_val) { unsigned char oldval; oldval = _InterlockedCompareExchange8_rel(addr, new_val, old); return (oldval == old); } #define AO_HAVE_char_compare_and_swap_release AO_INLINE int AO_short_compare_and_swap_acquire(volatile unsigned short *addr, unsigned short old, unsigned short new_val) { unsigned short oldval; oldval = _InterlockedCompareExchange16_acq(addr, new_val, old); return (oldval == old); } #define AO_HAVE_short_compare_and_swap_acquire AO_INLINE int AO_short_compare_and_swap_release(volatile unsigned short *addr, unsigned short old, unsigned short new_val) { unsigned short oldval; oldval = _InterlockedCompareExchange16_rel(addr, new_val, old); return (oldval == old); } #define AO_HAVE_short_compare_and_swap_release AO_INLINE int AO_int_compare_and_swap_acquire(volatile unsigned int *addr, unsigned int old, unsigned int new_val) { unsigned int oldval; oldval = _InterlockedCompareExchange_acq(addr, new_val, old); return (oldval == old); } #define AO_HAVE_int_compare_and_swap_acquire AO_INLINE int AO_int_compare_and_swap_release(volatile unsigned int *addr, unsigned int old, unsigned int new_val) { unsigned int oldval; oldval = _InterlockedCompareExchange_rel(addr, new_val, old); return (oldval == old); } #define AO_HAVE_int_compare_and_swap_release ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootsynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/all_acquire_release_volatile.hsynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/all_acquire_release_volatile.0000664000076400007640000000275111104702317033310 0ustar stefanstefan/* * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * Describes architectures on which volatile AO_t, unsigned char, unsigned * short, and unsigned int loads and stores have acquire/release semantics for * all normally legal alignments. */ #include "acquire_release_volatile.h" #include "char_acquire_release_volatile.h" #include "short_acquire_release_volatile.h" #include "int_acquire_release_volatile.h" synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/acquire_release_volatile.h0000664000076400007640000000437611104702317032635 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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. */ /* * This file adds definitions appropriate for environments in which an AO_t * volatile load has acquire semantics, and an AO_t volatile store has release * semantics. This is arguably supposed to be true with the standard Itanium * software conventions. */ /* * Empirically gcc/ia64 does some reordering of ordinary operations around volatiles * even when we think it shouldn't. Gcc 3.3 and earlier could reorder a volatile store * with another store. As of March 2005, gcc pre-4 reused previously computed * common subexpressions across a volatile load. * Hence we now add compiler barriers for gcc. */ #if !defined(AO_GCC_BARRIER) # if defined(__GNUC__) # define AO_GCC_BARRIER() AO_compiler_barrier() # else # define AO_GCC_BARRIER() # endif #endif AO_INLINE AO_t AO_load_acquire(volatile AO_t *p) { AO_t result = *p; /* A normal volatile load generates an ld.acq */ AO_GCC_BARRIER(); return result; } #define AO_HAVE_load_acquire AO_INLINE void AO_store_release(volatile AO_t *p, AO_t val) { AO_GCC_BARRIER(); /* A normal volatile store generates an st.rel */ *p = val; } #define AO_HAVE_store_release synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/char_atomic_load_store.h0000664000076400007640000000322011104702317032254 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * 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. */ /* * Definitions for architecturs on which loads and stores of unsigned char are * atomic for all legal alignments. */ AO_INLINE unsigned char AO_char_load(volatile unsigned char *addr) { /* Cast away the volatile for architectures like IA64 where */ /* volatile adds barrier semantics. */ return (*(unsigned char *)addr); } #define AO_HAVE_char_load AO_INLINE void AO_char_store(volatile unsigned char *addr, unsigned char new_val) { (*(unsigned char *)addr) = new_val; } #define AO_HAVE_char_store synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/Makefile.am0000664000076400007640000000226111104702317027457 0ustar stefanstefan#General sysdep utility headers, followed by the arch-specific ones nobase_sysdep_HEADERS= generic_pthread.h \ atomic_load_store.h \ aligned_atomic_load_store.h \ acquire_release_volatile.h \ char_acquire_release_volatile.h \ char_atomic_load_store.h \ short_acquire_release_volatile.h \ short_aligned_atomic_load_store.h \ short_atomic_load_store.h \ int_acquire_release_volatile.h \ int_aligned_atomic_load_store.h \ int_atomic_load_store.h \ all_acquire_release_volatile.h \ all_aligned_atomic_load_store.h \ all_atomic_load_store.h \ read_ordered.h \ ordered_except_wr.h \ ordered.h \ ao_t_is_int.h \ test_and_set_t_is_ao_t.h \ test_and_set_t_is_char.h \ emul_cas.h \ standard_ao_double_t.h \ README \ \ gcc/alpha.h gcc/arm.h gcc/x86.h \ gcc/hppa.h gcc/ia64.h \ gcc/powerpc.h gcc/sparc.h \ gcc/hppa.h gcc/m68k.h gcc/s390.h \ gcc/ia64.h gcc/x86_64.h gcc/cris.h \ \ icc/ia64.h \ \ msftc/x86.h \ msftc/x86_64.h \ \ hpc/ia64.h hpc/hppa.h \ \ sunc/sparc.h \ \ ibmc/powerpc.h sysdepdir= ${includedir}/atomic_ops/sysdeps # A few architectures require special .S files EXTRA_DIST = sunc/sparc.S synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/aligned_atomic_load_store.h0000664000076400007640000000322111104702317032743 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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. */ /* * Definitions for architecturs on which loads and stores of AO_t are * atomic fo all legal alignments. */ AO_INLINE AO_t AO_load(volatile AO_t *addr) { assert(((size_t)addr & (sizeof(AO_t) - 1)) == 0); /* Cast away the volatile for architectures where */ /* volatile adds barrier semantics. */ return *(AO_t *)addr; } #define AO_HAVE_load AO_INLINE void AO_store(volatile AO_t *addr, AO_t new_val) { assert(((size_t)addr & (sizeof(AO_t) - 1)) == 0); (*(AO_t *)addr) = new_val; } #define AO_HAVE_store synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ordered_except_wr.h0000664000076400007640000000567711104702317031316 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * 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. */ /* * These are common definitions for architectures that provide processor * ordered memory operations except that a later read may pass an * earlier write. Real x86 implementations seem to be in this category, * except apparently for some IDT WinChips, which we ignore. */ #include "read_ordered.h" AO_INLINE void AO_nop_write() { AO_compiler_barrier(); /* sfence according to Intel docs. Pentium 3 and up. */ /* Unnecessary for cached accesses? */ } #define AO_HAVE_NOP_WRITE #if defined(AO_HAVE_store) AO_INLINE void AO_store_write(volatile AO_t *addr, AO_t val) { AO_compiler_barrier(); AO_store(addr, val); } # define AO_HAVE_store_write # define AO_store_release(addr, val) AO_store_write(addr, val) # define AO_HAVE_store_release #endif /* AO_HAVE_store */ #if defined(AO_HAVE_char_store) AO_INLINE void AO_char_store_write(volatile unsigned char *addr, unsigned char val) { AO_compiler_barrier(); AO_char_store(addr, val); } # define AO_HAVE_char_store_write # define AO_char_store_release(addr, val) AO_char_store_write(addr, val) # define AO_HAVE_char_store_release #endif /* AO_HAVE_char_store */ #if defined(AO_HAVE_short_store) AO_INLINE void AO_short_store_write(volatile unsigned short *addr, unsigned short val) { AO_compiler_barrier(); AO_short_store(addr, val); } # define AO_HAVE_short_store_write # define AO_short_store_release(addr, val) AO_short_store_write(addr, val) # define AO_HAVE_short_store_release #endif /* AO_HAVE_short_store */ #if defined(AO_HAVE_int_store) AO_INLINE void AO_int_store_write(volatile unsigned int *addr, unsigned int val) { AO_compiler_barrier(); AO_int_store(addr, val); } # define AO_HAVE_int_store_write # define AO_int_store_release(addr, val) AO_int_store_write(addr, val) # define AO_HAVE_int_store_release #endif /* AO_HAVE_int_store */ synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/Makefile.in0000664000076400007640000003523011104702317026000 0ustar stefanstefan# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 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@ target_triplet = @target@ subdir = src/atomic_ops DIST_COMMON = $(private_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(privatedir)" privateHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(private_HEADERS) ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ NEED_ASM_FALSE = @NEED_ASM_FALSE@ NEED_ASM_TRUE = @NEED_ASM_TRUE@ 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@ PICFLAG = @PICFLAG@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ 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__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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ SUBDIRS = sysdeps EXTRA_DIST = generalize-small.template #Private Headers private_HEADERS = generalize.h generalize-small.h privatedir = ${includedir}/atomic_ops/ all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/atomic_ops/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/atomic_ops/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-privateHEADERS: $(private_HEADERS) @$(NORMAL_INSTALL) test -z "$(privatedir)" || $(mkdir_p) "$(DESTDIR)$(privatedir)" @list='$(private_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(privateHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(privatedir)/$$f'"; \ $(privateHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(privatedir)/$$f"; \ done uninstall-privateHEADERS: @$(NORMAL_UNINSTALL) @list='$(private_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(privatedir)/$$f'"; \ rm -f "$(DESTDIR)$(privatedir)/$$f"; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done 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) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ 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) $(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 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 check-am: all-am check: check-recursive all-am: Makefile $(HEADERS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(privatedir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-privateHEADERS install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-info-am uninstall-privateHEADERS uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ clean clean-generic clean-recursive ctags ctags-recursive \ distclean distclean-generic distclean-recursive 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-privateHEADERS install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic maintainer-clean-recursive \ mostlyclean mostlyclean-generic mostlyclean-recursive pdf \ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ uninstall-info-am uninstall-privateHEADERS generalize-small.h: generalize-small.template sed -e s:XSIZE:char:g -e s:XCTYPE:char:g $? > $@ sed -e s:XSIZE:short:g -e s:XCTYPE:short:g $? >> $@ sed -e s:XSIZE:int:g -e s:XCTYPE:int:g $? >> $@ # 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: synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/Makefile.am0000664000076400007640000000054411104702317025767 0ustar stefanstefanSUBDIRS=sysdeps EXTRA_DIST=generalize-small.template #Private Headers private_HEADERS=generalize.h generalize-small.h privatedir=${includedir}/atomic_ops/ generalize-small.h: generalize-small.template sed -e s:XSIZE:char:g -e s:XCTYPE:char:g $? > $@ sed -e s:XSIZE:short:g -e s:XCTYPE:short:g $? >> $@ sed -e s:XSIZE:int:g -e s:XCTYPE:int:g $? >> $@ synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops/generalize.h0000664000076400007640000013056011104702317026233 0ustar stefanstefan/* * Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P. * * 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. */ /* * Generalize atomic operations for atomic_ops.h. * Should not be included directly. * * We make no attempt to define useless operations, such as * AO_nop_acquire * AO_nop_release * * We have also so far neglected to define some others, which * do not appear likely to be useful, e.g. stores with acquire * or read barriers. * * This file is sometimes included twice by atomic_ops.h. * All definitions include explicit checks that we are not replacing * an earlier definition. In general, more desirable expansions * appear earlier so that we are more likely to use them. * * We only make safe generalizations, except that by default we define * the ...dd_acquire_read operations to be equivalent to those without * a barrier. On platforms for which this is unsafe, the platform-specific * file must define AO_NO_DD_ORDERING. */ #ifndef ATOMIC_OPS_H # error Atomic_ops_generalize.h should not be included directly. #endif #if AO_CHAR_TS_T # define AO_TS_COMPARE_AND_SWAP_FULL(a,o,n) \ AO_char_compare_and_swap_full(a,o,n) # define AO_TS_COMPARE_AND_SWAP_ACQUIRE(a,o,n) \ AO_char_compare_and_swap_acquire(a,o,n) # define AO_TS_COMPARE_AND_SWAP_RELEASE(a,o,n) \ AO_char_compare_and_swap_release(a,o,n) # define AO_TS_COMPARE_AND_SWAP(a,o,n) \ AO_char_compare_and_swap(a,o,n) #endif #if AO_AO_TS_T # define AO_TS_COMPARE_AND_SWAP_FULL(a,o,n) \ AO_compare_and_swap_full(a,o,n) # define AO_TS_COMPARE_AND_SWAP_ACQUIRE(a,o,n) \ AO_compare_and_swap_acquire(a,o,n) # define AO_TS_COMPARE_AND_SWAP_RELEASE(a,o,n) \ AO_compare_and_swap_release(a,o,n) # define AO_TS_COMPARE_AND_SWAP(a,o,n) \ AO_compare_and_swap(a,o,n) #endif /* Generate test_and_set_full, if necessary and possible. */ #if !defined(AO_HAVE_test_and_set) && \ !defined(AO_HAVE_test_and_set_release) && \ !defined(AO_HAVE_test_and_set_acquire) && \ !defined(AO_HAVE_test_and_set_read) && \ !defined(AO_HAVE_test_and_set_full) # if AO_AO_TS_T && defined(AO_HAVE_compare_and_swap_full) || \ AO_CHAR_TS_T && defined(AO_HAVE_char_compare_and_swap_full) AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { if (AO_TS_COMPARE_AND_SWAP_FULL(addr, AO_TS_CLEAR, AO_TS_SET)) return AO_TS_CLEAR; else return AO_TS_SET; } # define AO_HAVE_test_and_set_full # endif /* AO_HAVE_compare_and_swap_full */ # if AO_AO_TS_T && defined(AO_HAVE_compare_and_swap_acquire) || \ AO_CHAR_TS_T && defined(AO_HAVE_char_compare_and_swap_acquire) AO_INLINE AO_TS_VAL_t AO_test_and_set_acquire(volatile AO_TS_t *addr) { if (AO_TS_COMPARE_AND_SWAP_ACQUIRE(addr, AO_TS_CLEAR, AO_TS_SET)) return AO_TS_CLEAR; else return AO_TS_SET; } # define AO_HAVE_test_and_set_acquire # endif /* AO_HAVE_compare_and_swap_acquire */ # if AO_AO_TS_T && defined(AO_HAVE_compare_and_swap_release) || \ AO_CHAR_TS_T && defined(AO_HAVE_char_compare_and_swap_release) AO_INLINE AO_TS_VAL_t AO_test_and_set_release(volatile AO_TS_t *addr) { if (AO_TS_COMPARE_AND_SWAP_RELEASE(addr, AO_TS_CLEAR, AO_TS_SET)) return AO_TS_CLEAR; else return AO_TS_SET; } # define AO_HAVE_test_and_set_release # endif /* AO_HAVE_compare_and_swap_release */ # if AO_AO_TS_T && defined(AO_HAVE_compare_and_swap) || \ AO_CHAR_TS_T && defined(AO_HAVE_char_compare_and_swap) AO_INLINE AO_TS_VAL_t AO_test_and_set(volatile AO_TS_t *addr) { if (AO_TS_COMPARE_AND_SWAP(addr, AO_TS_CLEAR, AO_TS_SET)) return AO_TS_CLEAR; else return AO_TS_SET; } # define AO_HAVE_test_and_set # endif /* AO_HAVE_compare_and_swap */ # if defined(AO_HAVE_test_and_set) && defined(AO_HAVE_nop_full) \ && !defined(AO_HAVE_test_and_set_acquire) AO_INLINE AO_TS_VAL_t AO_test_and_set_acquire(volatile AO_TS_t *addr) { AO_TS_VAL_t result = AO_test_and_set(addr); AO_nop_full(); return result; } # define AO_HAVE_test_and_set_acquire # endif #endif /* No prior test and set */ /* Nop */ #if !defined(AO_HAVE_nop) AO_INLINE void AO_nop(void) {} # define AO_HAVE_nop #endif #if defined(AO_HAVE_test_and_set_full) && !defined(AO_HAVE_nop_full) AO_INLINE void AO_nop_full() { AO_TS_t dummy = AO_TS_INITIALIZER; AO_test_and_set_full(&dummy); } # define AO_HAVE_nop_full #endif #if defined(AO_HAVE_nop_acquire) # error AO_nop_acquire is useless: dont define. #endif #if defined(AO_HAVE_nop_release) # error AO_nop_release is useless: dont define. #endif #if defined(AO_HAVE_nop_full) && !defined(AO_HAVE_nop_read) # define AO_nop_read() AO_nop_full() # define AO_HAVE_nop_read #endif #if defined(AO_HAVE_nop_full) && !defined(AO_HAVE_nop_write) # define AO_nop_write() AO_nop_full() # define AO_HAVE_nop_write #endif /* Load */ #if defined(AO_HAVE_load_full) && !defined(AO_HAVE_load_acquire) # define AO_load_acquire(addr) AO_load_full(addr) # define AO_HAVE_load_acquire #endif #if defined(AO_HAVE_load_acquire) && !defined(AO_HAVE_load) # define AO_load(addr) AO_load_acquire(addr) # define AO_HAVE_load #endif #if defined(AO_HAVE_load_full) && !defined(AO_HAVE_load_read) # define AO_load_read(addr) AO_load_full(addr) # define AO_HAVE_load_read #endif #if !defined(AO_HAVE_load_acquire_read) && defined(AO_HAVE_load_acquire) # define AO_load_acquire_read(addr) AO_load_acquire(addr) # define AO_HAVE_load_acquire_read #endif #if defined(AO_HAVE_load) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_load_acquire) AO_INLINE AO_t AO_load_acquire(volatile AO_t *addr) { AO_t result = AO_load(addr); /* Acquire barrier would be useless, since the load could be delayed */ /* beyond it. */ AO_nop_full(); return result; } # define AO_HAVE_load_acquire #endif #if defined(AO_HAVE_load) && defined(AO_HAVE_nop_read) && \ !defined(AO_HAVE_load_read) AO_INLINE AO_t AO_load_read(volatile AO_t *addr) { AO_t result = AO_load(addr); /* Acquire barrier would be useless, since the load could be delayed */ /* beyond it. */ AO_nop_read(); return result; } # define AO_HAVE_load_read #endif #if defined(AO_HAVE_load_acquire) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_load_full) # define AO_load_full(addr) (AO_nop_full(), AO_load_acquire(addr)) # define AO_HAVE_load_full #endif #if !defined(AO_HAVE_load_acquire_read) && defined(AO_HAVE_load_read) # define AO_load_acquire_read(addr) AO_load_read(addr) # define AO_HAVE_load_acquire_read #endif #if defined(AO_HAVE_load_acquire_read) && !defined(AO_HAVE_load) # define AO_load(addr) AO_load_acquire_read(addr) # define AO_HAVE_load #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_load_acquire_read) # define AO_load_dd_acquire_read(addr) AO_load_acquire_read(addr) # define AO_HAVE_load_dd_acquire_read # endif #else # if defined(AO_HAVE_load) # define AO_load_dd_acquire_read(addr) AO_load(addr) # define AO_HAVE_load_dd_acquire_read # endif #endif /* Store */ #if defined(AO_HAVE_store_full) && !defined(AO_HAVE_store_release) # define AO_store_release(addr,val) AO_store_full(addr,val) # define AO_HAVE_store_release #endif #if defined(AO_HAVE_store_release) && !defined(AO_HAVE_store) # define AO_store(addr, val) AO_store_release(addr,val) # define AO_HAVE_store #endif #if defined(AO_HAVE_store_full) && !defined(AO_HAVE_store_write) # define AO_store_write(addr,val) AO_store_full(addr,val) # define AO_HAVE_store_write #endif #if defined(AO_HAVE_store_release) && !defined(AO_HAVE_store_release_write) # define AO_store_release_write(addr, val) AO_store_release(addr,val) # define AO_HAVE_store_release_write #endif #if defined(AO_HAVE_store_write) && !defined(AO_HAVE_store) # define AO_store(addr, val) AO_store_write(addr,val) # define AO_HAVE_store #endif #if defined(AO_HAVE_store) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_store_release) # define AO_store_release(addr,val) (AO_nop_full(), AO_store(addr,val)) # define AO_HAVE_store_release #endif #if defined(AO_HAVE_nop_write) && defined(AO_HAVE_store) && \ !defined(AO_HAVE_store_write) # define AO_store_write(addr, val) (AO_nop_write(), AO_store(addr,val)) # define AO_HAVE_store_write #endif #if defined(AO_HAVE_store_write) && !defined(AO_HAVE_store_release_write) # define AO_store_release_write(addr, val) AO_store_write(addr,val) # define AO_HAVE_store_release_write #endif #if defined(AO_HAVE_store_release) && defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_store_full) # define AO_store_full(addr, val) (AO_store_release(addr, val), AO_nop_full()) # define AO_HAVE_store_full #endif /* Fetch_and_add */ /* We first try to implement fetch_and_add variants in terms */ /* of the corresponding compare_and_swap variants to minimize */ /* adding barriers. */ #if defined(AO_HAVE_compare_and_swap_full) && \ !defined(AO_HAVE_fetch_and_add_full) AO_INLINE AO_t AO_fetch_and_add_full(volatile AO_t *addr, AO_t incr) { AO_t old; do { old = *addr; } while (!AO_compare_and_swap_full(addr, old, old+incr)); return old; } # define AO_HAVE_fetch_and_add_full #endif #if defined(AO_HAVE_compare_and_swap_acquire) && \ !defined(AO_HAVE_fetch_and_add_acquire) AO_INLINE AO_t AO_fetch_and_add_acquire(volatile AO_t *addr, AO_t incr) { AO_t old; do { old = *addr; } while (!AO_compare_and_swap_acquire(addr, old, old+incr)); return old; } # define AO_HAVE_fetch_and_add_acquire #endif #if defined(AO_HAVE_compare_and_swap_release) && \ !defined(AO_HAVE_fetch_and_add_release) AO_INLINE AO_t AO_fetch_and_add_release(volatile AO_t *addr, AO_t incr) { AO_t old; do { old = *addr; } while (!AO_compare_and_swap_release(addr, old, old+incr)); return old; } # define AO_HAVE_fetch_and_add_release #endif #if defined(AO_HAVE_compare_and_swap) && \ !defined(AO_HAVE_fetch_and_add) AO_INLINE AO_t AO_fetch_and_add(volatile AO_t *addr, AO_t incr) { AO_t old; do { old = *addr; } while (!AO_compare_and_swap(addr, old, old+incr)); return old; } # define AO_HAVE_fetch_and_add #endif #if defined(AO_HAVE_fetch_and_add_full) # if !defined(AO_HAVE_fetch_and_add_release) # define AO_fetch_and_add_release(addr, val) \ AO_fetch_and_add_full(addr, val) # define AO_HAVE_fetch_and_add_release # endif # if !defined(AO_HAVE_fetch_and_add_acquire) # define AO_fetch_and_add_acquire(addr, val) \ AO_fetch_and_add_full(addr, val) # define AO_HAVE_fetch_and_add_acquire # endif # if !defined(AO_HAVE_fetch_and_add_write) # define AO_fetch_and_add_write(addr, val) \ AO_fetch_and_add_full(addr, val) # define AO_HAVE_fetch_and_add_write # endif # if !defined(AO_HAVE_fetch_and_add_read) # define AO_fetch_and_add_read(addr, val) \ AO_fetch_and_add_full(addr, val) # define AO_HAVE_fetch_and_add_read # endif #endif /* AO_HAVE_fetch_and_add_full */ #if !defined(AO_HAVE_fetch_and_add) && \ defined(AO_HAVE_fetch_and_add_release) # define AO_fetch_and_add(addr, val) \ AO_fetch_and_add_release(addr, val) # define AO_HAVE_fetch_and_add #endif #if !defined(AO_HAVE_fetch_and_add) && \ defined(AO_HAVE_fetch_and_add_acquire) # define AO_fetch_and_add(addr, val) \ AO_fetch_and_add_acquire(addr, val) # define AO_HAVE_fetch_and_add #endif #if !defined(AO_HAVE_fetch_and_add) && \ defined(AO_HAVE_fetch_and_add_write) # define AO_fetch_and_add(addr, val) \ AO_fetch_and_add_write(addr, val) # define AO_HAVE_fetch_and_add #endif #if !defined(AO_HAVE_fetch_and_add) && \ defined(AO_HAVE_fetch_and_add_read) # define AO_fetch_and_add(addr, val) \ AO_fetch_and_add_read(addr, val) # define AO_HAVE_fetch_and_add #endif #if defined(AO_HAVE_fetch_and_add_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_fetch_and_add_full) # define AO_fetch_and_add_full(addr, val) \ (AO_nop_full(), AO_fetch_and_add_acquire(addr, val)) # define AO_HAVE_fetch_and_add_full #endif #if !defined(AO_HAVE_fetch_and_add_release_write) && \ defined(AO_HAVE_fetch_and_add_write) # define AO_fetch_and_add_release_write(addr, val) \ AO_fetch_and_add_write(addr, val) # define AO_HAVE_fetch_and_add_release_write #endif #if !defined(AO_HAVE_fetch_and_add_release_write) && \ defined(AO_HAVE_fetch_and_add_release) # define AO_fetch_and_add_release_write(addr, val) \ AO_fetch_and_add_release(addr, val) # define AO_HAVE_fetch_and_add_release_write #endif #if !defined(AO_HAVE_fetch_and_add_acquire_read) && \ defined(AO_HAVE_fetch_and_add_read) # define AO_fetch_and_add_acquire_read(addr, val) \ AO_fetch_and_add_read(addr, val) # define AO_HAVE_fetch_and_add_acquire_read #endif #if !defined(AO_HAVE_fetch_and_add_acquire_read) && \ defined(AO_HAVE_fetch_and_add_acquire) # define AO_fetch_and_add_acquire_read(addr, val) \ AO_fetch_and_add_acquire(addr, val) # define AO_HAVE_fetch_and_add_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_fetch_and_add_acquire_read) # define AO_fetch_and_add_dd_acquire_read(addr, val) \ AO_fetch_and_add_acquire_read(addr, val) # define AO_HAVE_fetch_and_add_dd_acquire_read # endif #else # if defined(AO_HAVE_fetch_and_add) # define AO_fetch_and_add_dd_acquire_read(addr, val) \ AO_fetch_and_add(addr, val) # define AO_HAVE_fetch_and_add_dd_acquire_read # endif #endif /* Fetch_and_add1 */ #if defined(AO_HAVE_fetch_and_add_full) &&\ !defined(AO_HAVE_fetch_and_add1_full) # define AO_fetch_and_add1_full(addr) AO_fetch_and_add_full(addr,1) # define AO_HAVE_fetch_and_add1_full #endif #if defined(AO_HAVE_fetch_and_add_release) &&\ !defined(AO_HAVE_fetch_and_add1_release) # define AO_fetch_and_add1_release(addr) AO_fetch_and_add_release(addr,1) # define AO_HAVE_fetch_and_add1_release #endif #if defined(AO_HAVE_fetch_and_add_acquire) &&\ !defined(AO_HAVE_fetch_and_add1_acquire) # define AO_fetch_and_add1_acquire(addr) AO_fetch_and_add_acquire(addr,1) # define AO_HAVE_fetch_and_add1_acquire #endif #if defined(AO_HAVE_fetch_and_add_write) &&\ !defined(AO_HAVE_fetch_and_add1_write) # define AO_fetch_and_add1_write(addr) AO_fetch_and_add_write(addr,1) # define AO_HAVE_fetch_and_add1_write #endif #if defined(AO_HAVE_fetch_and_add_read) &&\ !defined(AO_HAVE_fetch_and_add1_read) # define AO_fetch_and_add1_read(addr) AO_fetch_and_add_read(addr,1) # define AO_HAVE_fetch_and_add1_read #endif #if defined(AO_HAVE_fetch_and_add_release_write) &&\ !defined(AO_HAVE_fetch_and_add1_release_write) # define AO_fetch_and_add1_release_write(addr) \ AO_fetch_and_add_release_write(addr,1) # define AO_HAVE_fetch_and_add1_release_write #endif #if defined(AO_HAVE_fetch_and_add_acquire_read) &&\ !defined(AO_HAVE_fetch_and_add1_acquire_read) # define AO_fetch_and_add1_acquire_read(addr) \ AO_fetch_and_add_acquire_read(addr,1) # define AO_HAVE_fetch_and_add1_acquire_read #endif #if defined(AO_HAVE_fetch_and_add) &&\ !defined(AO_HAVE_fetch_and_add1) # define AO_fetch_and_add1(addr) \ AO_fetch_and_add(addr,1) # define AO_HAVE_fetch_and_add1 #endif #if defined(AO_HAVE_fetch_and_add1_full) # if !defined(AO_HAVE_fetch_and_add1_release) # define AO_fetch_and_add1_release(addr) \ AO_fetch_and_add1_full(addr) # define AO_HAVE_fetch_and_add1_release # endif # if !defined(AO_HAVE_fetch_and_add1_acquire) # define AO_fetch_and_add1_acquire(addr) \ AO_fetch_and_add1_full(addr) # define AO_HAVE_fetch_and_add1_acquire # endif # if !defined(AO_HAVE_fetch_and_add1_write) # define AO_fetch_and_add1_write(addr) \ AO_fetch_and_add1_full(addr) # define AO_HAVE_fetch_and_add1_write # endif # if !defined(AO_HAVE_fetch_and_add1_read) # define AO_fetch_and_add1_read(addr) \ AO_fetch_and_add1_full(addr) # define AO_HAVE_fetch_and_add1_read # endif #endif /* AO_HAVE_fetch_and_add1_full */ #if !defined(AO_HAVE_fetch_and_add1) && \ defined(AO_HAVE_fetch_and_add1_release) # define AO_fetch_and_add1(addr) \ AO_fetch_and_add1_release(addr) # define AO_HAVE_fetch_and_add1 #endif #if !defined(AO_HAVE_fetch_and_add1) && \ defined(AO_HAVE_fetch_and_add1_acquire) # define AO_fetch_and_add1(addr) \ AO_fetch_and_add1_acquire(addr) # define AO_HAVE_fetch_and_add1 #endif #if !defined(AO_HAVE_fetch_and_add1) && \ defined(AO_HAVE_fetch_and_add1_write) # define AO_fetch_and_add1(addr) \ AO_fetch_and_add1_write(addr) # define AO_HAVE_fetch_and_add1 #endif #if !defined(AO_HAVE_fetch_and_add1) && \ defined(AO_HAVE_fetch_and_add1_read) # define AO_fetch_and_add1(addr) \ AO_fetch_and_add1_read(addr) # define AO_HAVE_fetch_and_add1 #endif #if defined(AO_HAVE_fetch_and_add1_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_fetch_and_add1_full) # define AO_fetch_and_add1_full(addr) \ (AO_nop_full(), AO_fetch_and_add1_acquire(addr)) # define AO_HAVE_fetch_and_add1_full #endif #if !defined(AO_HAVE_fetch_and_add1_release_write) && \ defined(AO_HAVE_fetch_and_add1_write) # define AO_fetch_and_add1_release_write(addr) \ AO_fetch_and_add1_write(addr) # define AO_HAVE_fetch_and_add1_release_write #endif #if !defined(AO_HAVE_fetch_and_add1_release_write) && \ defined(AO_HAVE_fetch_and_add1_release) # define AO_fetch_and_add1_release_write(addr) \ AO_fetch_and_add1_release(addr) # define AO_HAVE_fetch_and_add1_release_write #endif #if !defined(AO_HAVE_fetch_and_add1_acquire_read) && \ defined(AO_HAVE_fetch_and_add1_read) # define AO_fetch_and_add1_acquire_read(addr) \ AO_fetch_and_add1_read(addr) # define AO_HAVE_fetch_and_add1_acquire_read #endif #if !defined(AO_HAVE_fetch_and_add1_acquire_read) && \ defined(AO_HAVE_fetch_and_add1_acquire) # define AO_fetch_and_add1_acquire_read(addr) \ AO_fetch_and_add1_acquire(addr) # define AO_HAVE_fetch_and_add1_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_fetch_and_add1_acquire_read) # define AO_fetch_and_add1_dd_acquire_read(addr) \ AO_fetch_and_add1_acquire_read(addr) # define AO_HAVE_fetch_and_add1_dd_acquire_read # endif #else # if defined(AO_HAVE_fetch_and_add1) # define AO_fetch_and_add1_dd_acquire_read(addr) AO_fetch_and_add1(addr) # define AO_HAVE_fetch_and_add1_dd_acquire_read # endif #endif /* Fetch_and_sub1 */ #if defined(AO_HAVE_fetch_and_add_full) &&\ !defined(AO_HAVE_fetch_and_sub1_full) # define AO_fetch_and_sub1_full(addr) AO_fetch_and_add_full(addr,(AO_t)(-1)) # define AO_HAVE_fetch_and_sub1_full #endif #if defined(AO_HAVE_fetch_and_add_release) &&\ !defined(AO_HAVE_fetch_and_sub1_release) # define AO_fetch_and_sub1_release(addr) \ AO_fetch_and_add_release(addr,(AO_t)(-1)) # define AO_HAVE_fetch_and_sub1_release #endif #if defined(AO_HAVE_fetch_and_add_acquire) &&\ !defined(AO_HAVE_fetch_and_sub1_acquire) # define AO_fetch_and_sub1_acquire(addr) \ AO_fetch_and_add_acquire(addr,(AO_t)(-1)) # define AO_HAVE_fetch_and_sub1_acquire #endif #if defined(AO_HAVE_fetch_and_add_write) &&\ !defined(AO_HAVE_fetch_and_sub1_write) # define AO_fetch_and_sub1_write(addr) \ AO_fetch_and_add_write(addr,(AO_t)(-1)) # define AO_HAVE_fetch_and_sub1_write #endif #if defined(AO_HAVE_fetch_and_add_read) &&\ !defined(AO_HAVE_fetch_and_sub1_read) # define AO_fetch_and_sub1_read(addr) \ AO_fetch_and_add_read(addr,(AO_t)(-1)) # define AO_HAVE_fetch_and_sub1_read #endif #if defined(AO_HAVE_fetch_and_add_release_write) &&\ !defined(AO_HAVE_fetch_and_sub1_release_write) # define AO_fetch_and_sub1_release_write(addr) \ AO_fetch_and_add_release_write(addr,(AO_t)(-1)) # define AO_HAVE_fetch_and_sub1_release_write #endif #if defined(AO_HAVE_fetch_and_add_acquire_read) &&\ !defined(AO_HAVE_fetch_and_sub1_acquire_read) # define AO_fetch_and_sub1_acquire_read(addr) \ AO_fetch_and_add_acquire_read(addr,(AO_t)(-1)) # define AO_HAVE_fetch_and_sub1_acquire_read #endif #if defined(AO_HAVE_fetch_and_add) &&\ !defined(AO_HAVE_fetch_and_sub1) # define AO_fetch_and_sub1(addr) \ AO_fetch_and_add(addr,(AO_t)(-1)) # define AO_HAVE_fetch_and_sub1 #endif #if defined(AO_HAVE_fetch_and_sub1_full) # if !defined(AO_HAVE_fetch_and_sub1_release) # define AO_fetch_and_sub1_release(addr) \ AO_fetch_and_sub1_full(addr) # define AO_HAVE_fetch_and_sub1_release # endif # if !defined(AO_HAVE_fetch_and_sub1_acquire) # define AO_fetch_and_sub1_acquire(addr) \ AO_fetch_and_sub1_full(addr) # define AO_HAVE_fetch_and_sub1_acquire # endif # if !defined(AO_HAVE_fetch_and_sub1_write) # define AO_fetch_and_sub1_write(addr) \ AO_fetch_and_sub1_full(addr) # define AO_HAVE_fetch_and_sub1_write # endif # if !defined(AO_HAVE_fetch_and_sub1_read) # define AO_fetch_and_sub1_read(addr) \ AO_fetch_and_sub1_full(addr) # define AO_HAVE_fetch_and_sub1_read # endif #endif /* AO_HAVE_fetch_and_sub1_full */ #if !defined(AO_HAVE_fetch_and_sub1) && \ defined(AO_HAVE_fetch_and_sub1_release) # define AO_fetch_and_sub1(addr) \ AO_fetch_and_sub1_release(addr) # define AO_HAVE_fetch_and_sub1 #endif #if !defined(AO_HAVE_fetch_and_sub1) && \ defined(AO_HAVE_fetch_and_sub1_acquire) # define AO_fetch_and_sub1(addr) \ AO_fetch_and_sub1_acquire(addr) # define AO_HAVE_fetch_and_sub1 #endif #if !defined(AO_HAVE_fetch_and_sub1) && \ defined(AO_HAVE_fetch_and_sub1_write) # define AO_fetch_and_sub1(addr) \ AO_fetch_and_sub1_write(addr) # define AO_HAVE_fetch_and_sub1 #endif #if !defined(AO_HAVE_fetch_and_sub1) && \ defined(AO_HAVE_fetch_and_sub1_read) # define AO_fetch_and_sub1(addr) \ AO_fetch_and_sub1_read(addr) # define AO_HAVE_fetch_and_sub1 #endif #if defined(AO_HAVE_fetch_and_sub1_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_fetch_and_sub1_full) # define AO_fetch_and_sub1_full(addr) \ (AO_nop_full(), AO_fetch_and_sub1_acquire(addr)) # define AO_HAVE_fetch_and_sub1_full #endif #if !defined(AO_HAVE_fetch_and_sub1_release_write) && \ defined(AO_HAVE_fetch_and_sub1_write) # define AO_fetch_and_sub1_release_write(addr) \ AO_fetch_and_sub1_write(addr) # define AO_HAVE_fetch_and_sub1_release_write #endif #if !defined(AO_HAVE_fetch_and_sub1_release_write) && \ defined(AO_HAVE_fetch_and_sub1_release) # define AO_fetch_and_sub1_release_write(addr) \ AO_fetch_and_sub1_release(addr) # define AO_HAVE_fetch_and_sub1_release_write #endif #if !defined(AO_HAVE_fetch_and_sub1_acquire_read) && \ defined(AO_HAVE_fetch_and_sub1_read) # define AO_fetch_and_sub1_acquire_read(addr) \ AO_fetch_and_sub1_read(addr) # define AO_HAVE_fetch_and_sub1_acquire_read #endif #if !defined(AO_HAVE_fetch_and_sub1_acquire_read) && \ defined(AO_HAVE_fetch_and_sub1_acquire) # define AO_fetch_and_sub1_acquire_read(addr) \ AO_fetch_and_sub1_acquire(addr) # define AO_HAVE_fetch_and_sub1_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_fetch_and_sub1_acquire_read) # define AO_fetch_and_sub1_dd_acquire_read(addr) \ AO_fetch_and_sub1_acquire_read(addr) # define AO_HAVE_fetch_and_sub1_dd_acquire_read # endif #else # if defined(AO_HAVE_fetch_and_sub1) # define AO_fetch_and_sub1_dd_acquire_read(addr) AO_fetch_and_sub1(addr) # define AO_HAVE_fetch_and_sub1_dd_acquire_read # endif #endif /* Atomic or */ #if defined(AO_HAVE_compare_and_swap_full) && \ !defined(AO_HAVE_or_full) AO_INLINE void AO_or_full(volatile AO_t *addr, AO_t incr) { AO_t old; do { old = *addr; } while (!AO_compare_and_swap_full(addr, old, (old | incr))); } # define AO_HAVE_or_full #endif #if defined(AO_HAVE_or_full) # if !defined(AO_HAVE_or_release) # define AO_or_release(addr, val) \ AO_or_full(addr, val) # define AO_HAVE_or_release # endif # if !defined(AO_HAVE_or_acquire) # define AO_or_acquire(addr, val) \ AO_or_full(addr, val) # define AO_HAVE_or_acquire # endif # if !defined(AO_HAVE_or_write) # define AO_or_write(addr, val) \ AO_or_full(addr, val) # define AO_HAVE_or_write # endif # if !defined(AO_HAVE_or_read) # define AO_or_read(addr, val) \ AO_or_full(addr, val) # define AO_HAVE_or_read # endif #endif /* AO_HAVE_or_full */ #if !defined(AO_HAVE_or) && \ defined(AO_HAVE_or_release) # define AO_or(addr, val) \ AO_or_release(addr, val) # define AO_HAVE_or #endif #if !defined(AO_HAVE_or) && \ defined(AO_HAVE_or_acquire) # define AO_or(addr, val) \ AO_or_acquire(addr, val) # define AO_HAVE_or #endif #if !defined(AO_HAVE_or) && \ defined(AO_HAVE_or_write) # define AO_or(addr, val) \ AO_or_write(addr, val) # define AO_HAVE_or #endif #if !defined(AO_HAVE_or) && \ defined(AO_HAVE_or_read) # define AO_or(addr, val) \ AO_or_read(addr, val) # define AO_HAVE_or #endif #if defined(AO_HAVE_or_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_or_full) # define AO_or_full(addr, val) \ (AO_nop_full(), AO_or_acquire(addr, val)) #endif #if !defined(AO_HAVE_or_release_write) && \ defined(AO_HAVE_or_write) # define AO_or_release_write(addr, val) \ AO_or_write(addr, val) # define AO_HAVE_or_release_write #endif #if !defined(AO_HAVE_or_release_write) && \ defined(AO_HAVE_or_release) # define AO_or_release_write(addr, val) \ AO_or_release(addr, val) # define AO_HAVE_or_release_write #endif #if !defined(AO_HAVE_or_acquire_read) && \ defined(AO_HAVE_or_read) # define AO_or_acquire_read(addr, val) \ AO_or_read(addr, val) # define AO_HAVE_or_acquire_read #endif #if !defined(AO_HAVE_or_acquire_read) && \ defined(AO_HAVE_or_acquire) # define AO_or_acquire_read(addr, val) \ AO_or_acquire(addr, val) # define AO_HAVE_or_acquire_read #endif /* dd_aquire_read is meaningless. */ /* Test_and_set */ #if defined(AO_HAVE_test_and_set_full) # if !defined(AO_HAVE_test_and_set_release) # define AO_test_and_set_release(addr) \ AO_test_and_set_full(addr) # define AO_HAVE_test_and_set_release # endif # if !defined(AO_HAVE_test_and_set_acquire) # define AO_test_and_set_acquire(addr) \ AO_test_and_set_full(addr) # define AO_HAVE_test_and_set_acquire # endif # if !defined(AO_HAVE_test_and_set_write) # define AO_test_and_set_write(addr) \ AO_test_and_set_full(addr) # define AO_HAVE_test_and_set_write # endif # if !defined(AO_HAVE_test_and_set_read) # define AO_test_and_set_read(addr) \ AO_test_and_set_full(addr) # define AO_HAVE_test_and_set_read # endif #endif /* AO_HAVE_test_and_set_full */ #if !defined(AO_HAVE_test_and_set) && \ defined(AO_HAVE_test_and_set_release) # define AO_test_and_set(addr) \ AO_test_and_set_release(addr) # define AO_HAVE_test_and_set #endif #if !defined(AO_HAVE_test_and_set) && \ defined(AO_HAVE_test_and_set_acquire) # define AO_test_and_set(addr) \ AO_test_and_set_acquire(addr) # define AO_HAVE_test_and_set #endif #if !defined(AO_HAVE_test_and_set) && \ defined(AO_HAVE_test_and_set_write) # define AO_test_and_set(addr) \ AO_test_and_set_write(addr) # define AO_HAVE_test_and_set #endif #if !defined(AO_HAVE_test_and_set) && \ defined(AO_HAVE_test_and_set_read) # define AO_test_and_set(addr) \ AO_test_and_set_read(addr) # define AO_HAVE_test_and_set #endif #if defined(AO_HAVE_test_and_set_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_test_and_set_full) # define AO_test_and_set_full(addr) \ (AO_nop_full(), AO_test_and_set_acquire(addr)) # define AO_HAVE_test_and_set_full #endif #if !defined(AO_HAVE_test_and_set_release_write) && \ defined(AO_HAVE_test_and_set_write) # define AO_test_and_set_release_write(addr) \ AO_test_and_set_write(addr) # define AO_HAVE_test_and_set_release_write #endif #if !defined(AO_HAVE_test_and_set_release_write) && \ defined(AO_HAVE_test_and_set_release) # define AO_test_and_set_release_write(addr) \ AO_test_and_set_release(addr) # define AO_HAVE_test_and_set_release_write #endif #if !defined(AO_HAVE_test_and_set_acquire_read) && \ defined(AO_HAVE_test_and_set_read) # define AO_test_and_set_acquire_read(addr) \ AO_test_and_set_read(addr) # define AO_HAVE_test_and_set_acquire_read #endif #if !defined(AO_HAVE_test_and_set_acquire_read) && \ defined(AO_HAVE_test_and_set_acquire) # define AO_test_and_set_acquire_read(addr) \ AO_test_and_set_acquire(addr) # define AO_HAVE_test_and_set_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_test_and_set_acquire_read) # define AO_test_and_set_dd_acquire_read(addr) \ AO_test_and_set_acquire_read(addr) # define AO_HAVE_test_and_set_dd_acquire_read # endif #else # if defined(AO_HAVE_test_and_set) # define AO_test_and_set_dd_acquire_read(addr) AO_test_and_set(addr) # define AO_HAVE_test_and_set_dd_acquire_read # endif #endif /* Compare_and_swap */ #if defined(AO_HAVE_compare_and_swap) && defined(AO_HAVE_nop_full)\ && !defined(AO_HAVE_compare_and_swap_acquire) AO_INLINE int AO_compare_and_swap_acquire(volatile AO_t *addr, AO_t old, AO_t new_val) { int result = AO_compare_and_swap(addr, old, new_val); AO_nop_full(); return result; } # define AO_HAVE_compare_and_swap_acquire #endif #if defined(AO_HAVE_compare_and_swap) && defined(AO_HAVE_nop_full)\ && !defined(AO_HAVE_compare_and_swap_release) # define AO_compare_and_swap_release(addr, old, new_val) \ (AO_nop_full(), AO_compare_and_swap(addr, old, new_val)) # define AO_HAVE_compare_and_swap_release #endif #if defined(AO_HAVE_compare_and_swap_full) # if !defined(AO_HAVE_compare_and_swap_release) # define AO_compare_and_swap_release(addr, old, new_val) \ AO_compare_and_swap_full(addr, old, new_val) # define AO_HAVE_compare_and_swap_release # endif # if !defined(AO_HAVE_compare_and_swap_acquire) # define AO_compare_and_swap_acquire(addr, old, new_val) \ AO_compare_and_swap_full(addr, old, new_val) # define AO_HAVE_compare_and_swap_acquire # endif # if !defined(AO_HAVE_compare_and_swap_write) # define AO_compare_and_swap_write(addr, old, new_val) \ AO_compare_and_swap_full(addr, old, new_val) # define AO_HAVE_compare_and_swap_write # endif # if !defined(AO_HAVE_compare_and_swap_read) # define AO_compare_and_swap_read(addr, old, new_val) \ AO_compare_and_swap_full(addr, old, new_val) # define AO_HAVE_compare_and_swap_read # endif #endif /* AO_HAVE_compare_and_swap_full */ #if !defined(AO_HAVE_compare_and_swap) && \ defined(AO_HAVE_compare_and_swap_release) # define AO_compare_and_swap(addr, old, new_val) \ AO_compare_and_swap_release(addr, old, new_val) # define AO_HAVE_compare_and_swap #endif #if !defined(AO_HAVE_compare_and_swap) && \ defined(AO_HAVE_compare_and_swap_acquire) # define AO_compare_and_swap(addr, old, new_val) \ AO_compare_and_swap_acquire(addr, old, new_val) # define AO_HAVE_compare_and_swap #endif #if !defined(AO_HAVE_compare_and_swap) && \ defined(AO_HAVE_compare_and_swap_write) # define AO_compare_and_swap(addr, old, new_val) \ AO_compare_and_swap_write(addr, old, new_val) # define AO_HAVE_compare_and_swap #endif #if !defined(AO_HAVE_compare_and_swap) && \ defined(AO_HAVE_compare_and_swap_read) # define AO_compare_and_swap(addr, old, new_val) \ AO_compare_and_swap_read(addr, old, new_val) # define AO_HAVE_compare_and_swap #endif #if defined(AO_HAVE_compare_and_swap_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_compare_and_swap_full) # define AO_compare_and_swap_full(addr, old, new_val) \ (AO_nop_full(), AO_compare_and_swap_acquire(addr, old, new_val)) # define AO_HAVE_compare_and_swap_full #endif #if !defined(AO_HAVE_compare_and_swap_release_write) && \ defined(AO_HAVE_compare_and_swap_write) # define AO_compare_and_swap_release_write(addr, old, new_val) \ AO_compare_and_swap_write(addr, old, new_val) # define AO_HAVE_compare_and_swap_release_write #endif #if !defined(AO_HAVE_compare_and_swap_release_write) && \ defined(AO_HAVE_compare_and_swap_release) # define AO_compare_and_swap_release_write(addr, old, new_val) \ AO_compare_and_swap_release(addr, old, new_val) # define AO_HAVE_compare_and_swap_release_write #endif #if !defined(AO_HAVE_compare_and_swap_acquire_read) && \ defined(AO_HAVE_compare_and_swap_read) # define AO_compare_and_swap_acquire_read(addr, old, new_val) \ AO_compare_and_swap_read(addr, old, new_val) # define AO_HAVE_compare_and_swap_acquire_read #endif #if !defined(AO_HAVE_compare_and_swap_acquire_read) && \ defined(AO_HAVE_compare_and_swap_acquire) # define AO_compare_and_swap_acquire_read(addr, old, new_val) \ AO_compare_and_swap_acquire(addr, old, new_val) # define AO_HAVE_compare_and_swap_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_compare_and_swap_acquire_read) # define AO_compare_and_swap_dd_acquire_read(addr, old, new_val) \ AO_compare_and_swap_acquire_read(addr, old, new_val) # define AO_HAVE_compare_and_swap_dd_acquire_read # endif #else # if defined(AO_HAVE_compare_and_swap) # define AO_compare_and_swap_dd_acquire_read(addr, old, new_val) \ AO_compare_and_swap(addr, old, new_val) # define AO_HAVE_compare_and_swap_dd_acquire_read # endif #endif #include "generalize-small.h" /* Compare_double_and_swap_double */ #if defined(AO_HAVE_compare_double_and_swap_double) && defined(AO_HAVE_nop_full)\ && !defined(AO_HAVE_compare_double_and_swap_double_acquire) AO_INLINE int AO_compare_double_and_swap_double_acquire(volatile AO_double_t *addr, AO_t o1, AO_t o2, AO_t n1, AO_t n2) { int result = AO_compare_double_and_swap_double(addr, o1, o2, n1, n2); AO_nop_full(); return result; } # define AO_HAVE_compare_double_and_swap_double_acquire #endif #if defined(AO_HAVE_compare_double_and_swap_double) \ && defined(AO_HAVE_nop_full)\ && !defined(AO_HAVE_compare_double_and_swap_double_release) # define AO_compare_double_and_swap_double_release(addr, o1, o2, n1, n2) \ (AO_nop_full(), AO_compare_double_and_swap_double(addr, o1, o2, n1, n2)) # define AO_HAVE_compare_double_and_swap_double_release #endif #if defined(AO_HAVE_compare_double_and_swap_double_full) # if !defined(AO_HAVE_compare_double_and_swap_double_release) # define AO_compare_double_and_swap_double_release(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_full(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double_release # endif # if !defined(AO_HAVE_compare_double_and_swap_double_acquire) # define AO_compare_double_and_swap_double_acquire(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_full(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double_acquire # endif # if !defined(AO_HAVE_compare_double_and_swap_double_write) # define AO_compare_double_and_swap_double_write(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_full(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double_write # endif # if !defined(AO_HAVE_compare_double_and_swap_double_read) # define AO_compare_double_and_swap_double_read(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_full(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double_read # endif #endif /* AO_HAVE_compare_double_and_swap_double_full */ #if !defined(AO_HAVE_compare_double_and_swap_double) && \ defined(AO_HAVE_compare_double_and_swap_double_release) # define AO_compare_double_and_swap_double(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_release(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double #endif #if !defined(AO_HAVE_compare_double_and_swap_double) && \ defined(AO_HAVE_compare_double_and_swap_double_acquire) # define AO_compare_double_and_swap_double(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_acquire(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double #endif #if !defined(AO_HAVE_compare_double_and_swap_double) && \ defined(AO_HAVE_compare_double_and_swap_double_write) # define AO_compare_double_and_swap_double(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_write(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double #endif #if !defined(AO_HAVE_compare_double_and_swap_double) && \ defined(AO_HAVE_compare_double_and_swap_double_read) # define AO_compare_double_and_swap_double(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_read(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double #endif #if defined(AO_HAVE_compare_double_and_swap_double_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_compare_double_and_swap_double_full) # define AO_compare_double_and_swap_double_full(addr, o1, o2, n1, n2) \ (AO_nop_full(), AO_compare_double_and_swap_double_acquire(addr, o1, o2, n1, n2)) # define AO_HAVE_compare_double_and_swap_double_full #endif #if !defined(AO_HAVE_compare_double_and_swap_double_release_write) && \ defined(AO_HAVE_compare_double_and_swap_double_write) # define AO_compare_double_and_swap_double_release_write(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_write(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double_release_write #endif #if !defined(AO_HAVE_compare_double_and_swap_double_release_write) && \ defined(AO_HAVE_compare_double_and_swap_double_release) # define AO_compare_double_and_swap_double_release_write(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_release(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double_release_write #endif #if !defined(AO_HAVE_compare_double_and_swap_double_acquire_read) && \ defined(AO_HAVE_compare_double_and_swap_double_read) # define AO_compare_double_and_swap_double_acquire_read(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_read(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double_acquire_read #endif #if !defined(AO_HAVE_compare_double_and_swap_double_acquire_read) && \ defined(AO_HAVE_compare_double_and_swap_double_acquire) # define AO_compare_double_and_swap_double_acquire_read(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_acquire(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_compare_double_and_swap_double_acquire_read) # define AO_compare_double_and_swap_double_dd_acquire_read(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double_acquire_read(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double_dd_acquire_read # endif #else # if defined(AO_HAVE_compare_double_and_swap_double) # define AO_compare_double_and_swap_double_dd_acquire_read(addr, o1, o2, n1, n2) \ AO_compare_double_and_swap_double(addr, o1, o2, n1, n2) # define AO_HAVE_compare_double_and_swap_double_dd_acquire_read # endif #endif /* Compare_and_swap_double */ #if defined(AO_HAVE_compare_and_swap_double) && defined(AO_HAVE_nop_full)\ && !defined(AO_HAVE_compare_and_swap_double_acquire) AO_INLINE int AO_compare_and_swap_double_acquire(volatile AO_double_t *addr, AO_t o1, AO_t o2, AO_t n1, AO_t n2) { int result = AO_compare_and_swap_double(addr, o1, n1, n2); AO_nop_full(); return result; } # define AO_HAVE_compare_and_swap_double_acquire #endif #if defined(AO_HAVE_compare_and_swap_double) \ && defined(AO_HAVE_nop_full)\ && !defined(AO_HAVE_compare_and_swap_double_release) # define AO_compare_and_swap_double_release(addr, o1, n1, n2) \ (AO_nop_full(), AO_compare_and_swap_double(addr, o1, n1, n2)) # define AO_HAVE_compare_and_swap_double_release #endif #if defined(AO_HAVE_compare_and_swap_double_full) # if !defined(AO_HAVE_compare_and_swap_double_release) # define AO_compare_and_swap_double_release(addr, o1, n1, n2) \ AO_compare_and_swap_double_full(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double_release # endif # if !defined(AO_HAVE_compare_and_swap_double_acquire) # define AO_compare_and_swap_double_acquire(addr, o1, n1, n2) \ AO_compare_and_swap_double_full(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double_acquire # endif # if !defined(AO_HAVE_compare_and_swap_double_write) # define AO_compare_and_swap_double_write(addr, o1, n1, n2) \ AO_compare_and_swap_double_full(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double_write # endif # if !defined(AO_HAVE_compare_and_swap_double_read) # define AO_compare_and_swap_double_read(addr, o1, n1, n2) \ AO_compare_and_swap_double_full(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double_read # endif #endif /* AO_HAVE_compare_and_swap_double_full */ #if !defined(AO_HAVE_compare_and_swap_double) && \ defined(AO_HAVE_compare_and_swap_double_release) # define AO_compare_and_swap_double(addr, o1, n1, n2) \ AO_compare_and_swap_double_release(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double #endif #if !defined(AO_HAVE_compare_and_swap_double) && \ defined(AO_HAVE_compare_and_swap_double_acquire) # define AO_compare_and_swap_double(addr, o1, n1, n2) \ AO_compare_and_swap_double_acquire(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double #endif #if !defined(AO_HAVE_compare_and_swap_double) && \ defined(AO_HAVE_compare_and_swap_double_write) # define AO_compare_and_swap_double(addr, o1, n1, n2) \ AO_compare_and_swap_double_write(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double #endif #if !defined(AO_HAVE_compare_and_swap_double) && \ defined(AO_HAVE_compare_and_swap_double_read) # define AO_compare_and_swap_double(addr, o1, n1, n2) \ AO_compare_and_swap_double_read(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double #endif #if defined(AO_HAVE_compare_and_swap_double_acquire) &&\ defined(AO_HAVE_nop_full) && \ !defined(AO_HAVE_compare_and_swap_double_full) # define AO_compare_and_swap_double_full(addr, o1, n1, n2) \ (AO_nop_full(), AO_compare_and_swap_double_acquire(addr, o1, n1, n2)) # define AO_HAVE_compare_and_swap_double_full #endif #if !defined(AO_HAVE_compare_and_swap_double_release_write) && \ defined(AO_HAVE_compare_and_swap_double_write) # define AO_compare_and_swap_double_release_write(addr, o1, n1, n2) \ AO_compare_and_swap_double_write(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double_release_write #endif #if !defined(AO_HAVE_compare_and_swap_double_release_write) && \ defined(AO_HAVE_compare_and_swap_double_release) # define AO_compare_and_swap_double_release_write(addr, o1, n1, n2) \ AO_compare_and_swap_double_release(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double_release_write #endif #if !defined(AO_HAVE_compare_and_swap_double_acquire_read) && \ defined(AO_HAVE_compare_and_swap_double_read) # define AO_compare_and_swap_double_acquire_read(addr, o1, n1, n2) \ AO_compare_and_swap_double_read(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double_acquire_read #endif #if !defined(AO_HAVE_compare_and_swap_double_acquire_read) && \ defined(AO_HAVE_compare_and_swap_double_acquire) # define AO_compare_and_swap_double_acquire_read(addr, o1, n1, n2) \ AO_compare_and_swap_double_acquire(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double_acquire_read #endif #ifdef AO_NO_DD_ORDERING # if defined(AO_HAVE_compare_and_swap_double_acquire_read) # define AO_compare_and_swap_double_dd_acquire_read(addr, o1, n1, n2) \ AO_compare_and_swap_double_acquire_read(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double_dd_acquire_read # endif #else # if defined(AO_HAVE_compare_and_swap_double) # define AO_compare_and_swap_double_dd_acquire_read(addr, o1, n1, n2) \ AO_compare_and_swap_double(addr, o1, n1, n2) # define AO_HAVE_compare_and_swap_double_dd_acquire_read # endif #endif synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops_malloc.h0000664000076400007640000000315411104702317025433 0ustar stefanstefan/* * Copyright (c) 2005 Hewlett-Packard Development Company, L.P. * * 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. */ /* Almost lock-free malloc implementation based on stack implementation. */ /* See README.malloc file for detailed usage rules. */ #ifndef AO_ATOMIC_H #define AO_ATOMIC_H #include /* For size_t */ #include "atomic_ops_stack.h" #ifdef AO_STACK_IS_LOCK_FREE # define AO_MALLOC_IS_LOCK_FREE #endif void AO_free(void *); void * AO_malloc(size_t); /* Allow use of mmpa to grow the heap. No-op on some platforms. */ void AO_malloc_enable_mmap(void); #endif /* !AO_ATOMIC_H */ synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops_stack.h0000664000076400007640000001427411104702317025276 0ustar stefanstefan/* * The implementation of the routines described here is covered by the GPL. * This header file is covered by the following license: */ /* * Copyright (c) 2005 Hewlett-Packard Development Company, L.P. * * 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. */ /* Almost lock-free LIFO linked lists (linked stacks). */ #ifndef AO_STACK_H #define AO_STACK_H #include "atomic_ops.h" #if !defined(AO_HAVE_compare_double_and_swap_double) \ && !defined(AO_HAVE_compare_double_and_swap) \ && defined(AO_HAVE_compare_and_swap) # define AO_USE_ALMOST_LOCK_FREE #else /* If we have no compare-and-swap operation defined, we assume */ /* that we will actually be using CAS emulation. If we do that, */ /* it's cheaper to use the version-based implementation. */ # define AO_STACK_IS_LOCK_FREE #endif /* * These are not guaranteed to be completely lock-free. * List insertion may spin under extremely unlikely conditions. * It cannot deadlock due to recursive reentry unless AO_list_remove * is called while at least AO_BL_SIZE activations of * AO_list_remove are currently active in the same thread, i.e. * we must have at least AO_BL_SIZE recursive signal handler * invocations. * * All operations take an AO_list_aux argument. It is safe to * share a single AO_list_aux structure among all lists, but that * may increase contention. Any given list must always be accessed * with the same AO_list_aux structure. * * We make some machine-dependent assumptions: * - We have a compare-and-swap operation. * - At least _AO_N_BITS low order bits in pointers are * zero and normally unused. * - size_t and pointers have the same size. * * We do use a fully lock-free implementation if double-width * compare-and-swap operations are available. */ #ifdef AO_USE_ALMOST_LOCK_FREE /* The number of low order pointer bits we can use for a small */ /* version number. */ # if defined(__LP64__) || defined(_LP64) || defined(_WIN64) /* WIN64 isn't really supported yet. */ # define AO_N_BITS 3 # else # define AO_N_BITS 2 # endif # define AO_BIT_MASK ((1 << AO_N_BITS) - 1) /* * AO_stack_aux should be treated as opaque. * It is fully defined here, so it can be allocated, and to facilitate * debugging. */ #ifndef AO_BL_SIZE # define AO_BL_SIZE 2 #endif #if AO_BL_SIZE > (1 << AO_N_BITS) # error AO_BL_SIZE too big #endif typedef struct AO__stack_aux { volatile AO_t AO_stack_bl[AO_BL_SIZE]; } AO_stack_aux; /* The stack implementation knows only about the lecation of */ /* link fields in nodes, and nothing about the rest of the */ /* stack elements. Link fields hold an AO_t, which is not */ /* necessarily a real pointer. This converts the AO_t to a */ /* real (AO_t *) which is either o, or points at the link */ /* field in the next node. */ #define AO_REAL_NEXT_PTR(x) (AO_t *)((x) & ~AO_BIT_MASK) /* The following two routines should not normally be used directly. */ /* We make them visible here for the rare cases in which it makes sense */ /* to share the an AO_stack_aux between stacks. */ void AO_stack_push_explicit_aux_release(volatile AO_t *list, AO_t *x, AO_stack_aux *); AO_t * AO_stack_pop_explicit_aux_acquire(volatile AO_t *list, AO_stack_aux *); /* And now AO_stack_t for the real interface: */ typedef struct AO__stack { volatile AO_t AO_ptr; AO_stack_aux AO_aux; } AO_stack_t; #define AO_STACK_INITIALIZER {0} AO_INLINE void AO_stack_init(AO_stack_t *list) { # if AO_BL_SIZE == 2 list -> AO_aux.AO_stack_bl[0] = 0; list -> AO_aux.AO_stack_bl[1] = 0; # else int i; for (i = 0; i < AO_BL_SIZE; ++i) list -> AO_aux.AO_stack_bl[i] = 0; # endif list -> AO_ptr = 0; } /* Convert an AO_stack_t to a pointer to the link field in */ /* the first element. */ #define AO_REAL_HEAD_PTR(x) AO_REAL_NEXT_PTR((x).AO_ptr) #define AO_stack_push_release(l, e) \ AO_stack_push_explicit_aux_release(&((l)->AO_ptr), e, &((l)->AO_aux)) #define AO_HAVE_stack_push_release #define AO_stack_pop_acquire(l) \ AO_stack_pop_explicit_aux_acquire(&((l)->AO_ptr), &((l)->AO_aux)) #define AO_HAVE_stack_pop_acquire # else /* Use fully non-blocking data structure, wide CAS */ #ifndef AO_HAVE_double_t /* Can happen if we're using CAS emulation, since we don't want to */ /* force that here, in case other atomic_ops clients don't want it. */ # include "atomic_ops/sysdeps/standard_ao_double_t.h" #endif typedef volatile AO_double_t AO_stack_t; /* AO_val1 is version, AO_val2 is pointer. */ #define AO_STACK_INITIALIZER {0} AO_INLINE void AO_stack_init(AO_stack_t *list) { list -> AO_val1 = 0; list -> AO_val2 = 0; } #define AO_REAL_HEAD_PTR(x) (AO_t *)((x).AO_val2) #define AO_REAL_NEXT_PTR(x) (AO_t *)(x) void AO_stack_push_release(AO_stack_t *list, AO_t *new_element); #define AO_HAVE_stack_push_release AO_t * AO_stack_pop_acquire(AO_stack_t *list); #define AO_HAVE_stack_pop_acquire #endif /* Wide CAS case */ #if defined(AO_HAVE_stack_push_release) && !defined(AO_HAVE_stack_push) # define AO_stack_push(l, e) AO_stack_push_release(l, e) # define AO_HAVE_stack_push #endif #if defined(AO_HAVE_stack_pop_acquire) && !defined(AO_HAVE_stack_pop) # define AO_stack_pop(l) AO_stack_pop_acquire(l) # define AO_HAVE_stack_pop #endif #endif /* !AO_STACK_H */ synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/Makefile.msft0000664000076400007640000000265711104702317024215 0ustar stefanstefan# # Copyright (c) 2003-2005 Hewlett-Packard Developlment Company, L.P. # # The really trivial win32/VC++ Makefile. Note that atomic_ops.c isn't useful. # And we rely on a pre-built test_atomic_include.h and generalize-small.h, # since we can't rely on sed. # Win32 clients only need to include the header files. # To install, copy atomic_ops.h and the atomic_ops/... tree to your favorite # include directory. #MY_CPU=X86 #CPU=$(MY_CPU) #!include LIB_OBJS=atomic_ops_stack.obj atomic_ops_malloc.obj all: check atomic_ops_stack.obj: cl -O2 -c -DAO_ASSUME_WINDOWS98 atomic_ops_stack.c atomic_ops_malloc.obj: cl -O2 -c -DAO_ASSUME_WINDOWS98 atomic_ops_malloc.c test_atomic: ..\tests\test_atomic.c ..\tests\test_atomic_include.h cl -O2 -I. -DAO_ASSUME_WINDOWS98 ..\tests\test_atomic.c -o test_atomic test_atomic_w95: ..\tests\test_atomic.c ..\tests\test_atomic_include.h cl -O2 -I. ..\tests\test_atomic.c -o test_atomic_w95 test_malloc: ..\tests\test_malloc.c ..\tests\test_atomic_include.h \ libatomic_ops_gpl.lib cl -O2 -DAO_ASSUME_WINDOWS98 -I. ..\tests\test_malloc.c -o test_malloc libatomic_ops_gpl.lib libatomic_ops_gpl.lib: $(LIB_OBJS) lib /MACHINE:i386 /out:libatomic_ops_gpl.lib $(LIB_OBJS) check: test_atomic test_atomic_w95 test_malloc echo The following will print lots of \"Missing ...\" messages. test_atomic_w95 echo The following will print some \"Missing ...\" messages. test_atomic test_malloc synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops_stack.c0000664000076400007640000002167411104702317025273 0ustar stefanstefan/* * Copyright (c) 2005 Hewlett-Packard Development Company, L.P. * Original Author: Hans Boehm * * This file may be redistributed and/or modified 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. * * It is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License in the * file doc/COPYING for more details. */ #if defined(HAVE_CONFIG_H) # include "config.h" #endif #include #include #include #define AO_REQUIRE_CAS #include "atomic_ops_stack.h" #if defined(_MSC_VER) \ || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__) /* AO_pause not defined elsewhere */ /* FIXME: At least AO_spin should be factored out. */ #include AO_t dummy; /* Spin for 2**n units. */ static void AO_spin(int n) { int i; AO_T j = AO_load(&dummy); for (i = 0; i < (2 << n); ++i) { j *= 5; j -= 4; } AO_store(&dummy, j); } void AO_pause(int n) { if (n < 12) AO_spin(n); else { DWORD msecs; /* Short async-signal-safe sleep. */ msecs = (n > 18? 100 : (1 << (n - 12))); Sleep(msecs); } } #else /* AO_pause is available elsewhere */ extern void AO_pause(int); #endif #ifdef AO_USE_ALMOST_LOCK_FREE /* LIFO linked lists based on compare-and-swap. We need to avoid */ /* the case of a node deleton and reinsertion while I'm deleting */ /* it, since that may cause my CAS to succeed eventhough the next */ /* pointer is now wrong. Our solution is not fully lock-free, but it */ /* is good enough for signal handlers, provided we have a suitably low */ /* bound on the number of recursive signal handler reentries. */ /* A list consists of a first pointer and a blacklist */ /* of pointer values that are currently being removed. No list element */ /* on the blacklist may be inserted. If we would otherwise do so, we */ /* are allowed to insert a variant that differs only in the least */ /* significant, ignored, bits. If the list is full, we wait. */ /* Crucial observation: A particular padded pointer x (i.e. pointer */ /* plus arbitrary low order bits) can never be newly inserted into */ /* a list while it's in the corresponding auxiliary data structure. */ /* The second argument is a pointer to the link field of the element */ /* to be inserted. */ /* Both list headers and link fields contain "perturbed" pointers, i.e. */ /* pointers with extra bits "or"ed into the low order bits. */ void AO_stack_push_explicit_aux_release(volatile AO_t *list, AO_t *x, AO_stack_aux *a) { int i; AO_t x_bits = (AO_t)x; AO_t next; /* No deletions of x can start here, since x is not currently in the */ /* list. */ retry: # if AO_BL_SIZE == 2 { /* Start all loads as close to concurrently as possible. */ AO_t entry1 = AO_load(a -> AO_stack_bl); AO_t entry2 = AO_load(a -> AO_stack_bl + 1); if (entry1 == x_bits || entry2 == x_bits) { /* Entry is currently being removed. Change it a little. */ ++x_bits; if ((x_bits & AO_BIT_MASK) == 0) /* Version count overflowed; */ /* EXTREMELY unlikely, but possible. */ x_bits = (AO_t)x; goto retry; } } # else for (i = 0; i < AO_BL_SIZE; ++i) { if (AO_load(a -> AO_stack_bl + i) == x_bits) { /* Entry is currently being removed. Change it a little. */ ++x_bits; if ((x_bits & AO_BIT_MASK) == 0) /* Version count overflowed; */ /* EXTREMELY unlikely, but possible. */ x_bits = (AO_t)x; goto retry; } } # endif /* x_bits is not currently being deleted */ do { next = AO_load(list); *x = next; } while(!AO_compare_and_swap_release(list, next, x_bits)); } /* * I concluded experimentally that checking a value first before * performing a compare-and-swap is usually beneficial on X86, but * slows things down appreciably with contention on Itanium. * ince the Itanium behavior makes more sense to me (more cache line * movement unless we're mostly reading, but back-off should guard * against that), we take Itanium as the default. Measurements on * other multiprocessor architectures would be useful. (On a uniprocessor, * the initial check is almost certainly a very small loss.) - HB */ #ifdef __i386__ # define PRECHECK(a) (a) == 0 && #else # define PRECHECK(a) #endif AO_t * AO_stack_pop_explicit_aux_acquire(volatile AO_t *list, AO_stack_aux * a) { unsigned i; int j = 0; AO_t first; AO_t * first_ptr; AO_t next; retry: first = AO_load(list); if (0 == first) return 0; /* Insert first into aux black list. */ /* This may spin if more than AO_BL_SIZE removals using auxiliary */ /* structure a are currently in progress. */ for (i = 0; ; ) { if (PRECHECK(a -> AO_stack_bl[i]) AO_compare_and_swap_acquire(a->AO_stack_bl+i, 0, first)) break; ++i; if ( i >= AO_BL_SIZE ) { i = 0; AO_pause(++j); } } assert(i >= 0 && i < AO_BL_SIZE); assert(a -> AO_stack_bl[i] == first); /* First is on the auxiliary black list. It may be removed by */ /* another thread before we get to it, but a new insertion of x */ /* cannot be started here. */ /* Only we can remove it from the black list. */ /* We need to make sure that first is still the first entry on the */ /* list. Otherwise it's possible that a reinsertion of it was */ /* already started before we added the black list entry. */ if (first != AO_load(list)) { AO_store_release(a->AO_stack_bl+i, 0); goto retry; } first_ptr = AO_REAL_NEXT_PTR(first); next = AO_load(first_ptr); if (!AO_compare_and_swap_release(list, first, next)) { AO_store_release(a->AO_stack_bl+i, 0); goto retry; } assert(*list != first); /* Since we never insert an entry on the black list, this cannot have */ /* succeeded unless first remained on the list while we were running. */ /* Thus its next link cannot have changed out from under us, and we */ /* removed exactly one entry and preserved the rest of the list. */ /* Note that it is quite possible that an additional entry was */ /* inserted and removed while we were running; this is OK since the */ /* part of the list following first must have remained unchanged, and */ /* first must again have been at the head of the list when the */ /* compare_and_swap succeeded. */ AO_store_release(a->AO_stack_bl+i, 0); return first_ptr; } #else /* ! USE_ALMOST_LOCK_FREE */ /* Better names for fields in AO_stack_t */ #define ptr AO_val2 #define version AO_val1 #if defined(AO_HAVE_compare_double_and_swap_double) void AO_stack_push_release(AO_stack_t *list, AO_t *element) { AO_t next; do { next = AO_load(&(list -> ptr)); *element = next; } while (!AO_compare_and_swap_release ( &(list -> ptr), next, (AO_t) element)); /* This uses a narrow CAS here, an old optimization suggested */ /* by Treiber. Pop is still safe, since we run into the ABA */ /* problem only if there were both interveining "pop"s and "push"es.*/ /* Inthat case we still see a change inthe version number. */ } AO_t *AO_stack_pop_acquire(AO_stack_t *list) { AO_t *cptr; AO_t next; AO_t cversion; do { /* Version must be loaded first. */ cversion = AO_load_acquire(&(list -> version)); cptr = (AO_t *)AO_load(&(list -> ptr)); if (cptr == 0) return 0; next = *cptr; } while (!AO_compare_double_and_swap_double_release (list, cversion, (AO_t) cptr, cversion+1, (AO_t) next)); return cptr; } #elif defined(AO_HAVE_compare_and_swap_double) /* Needed for future IA64 processors. No current clients? */ #error Untested! Probably doesnt work. /* We have a wide CAS, but only does an AO_t-wide comparison. */ /* We can't use the Treiber optimization, since we only check */ /* for an unchanged version number, not an unchanged pointer. */ void AO_stack_push_release(AO_stack_t *list, AO_t *element) { AO_t version; AO_t next_ptr; do { /* Again version must be loaded first, for different reason. */ version = AO_load_acquire(&(list -> version)); next_ptr = AO_load(&(list -> ptr)); *element = next_ptr; } while (!AO_compare_and_swap_double_release( list, version, version+1, (AO_t) element)); } AO_t *AO_stack_pop_acquire(AO_stack_t *list) { AO_t *cptr; AO_t next; AO_t cversion; do { cversion = AO_load_acquire(&(list -> version)); cptr = (AO_t *)AO_load(&(list -> ptr)); if (cptr == 0) return 0; next = *cptr; } while (!AO_compare_double_and_swap_double_release (list, cversion, (AO_t) cptr, cversion+1, next)); return cptr; } #endif /* AO_HAVE_compare_and_swap_double */ #endif /* ! USE_ALMOST_LOCK_FREE */ synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops.h0000644000076400007640000002672211104702317024110 0ustar stefanstefan/* * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. * * 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 ATOMIC_OPS_H #define ATOMIC_OPS_H #include #include /* We define various atomic operations on memory in a */ /* machine-specific way. Unfortunately, this is complicated */ /* by the fact that these may or may not be combined with */ /* various memory barriers. Thus the actual operations we */ /* define have the form AO__, for all */ /* plausible combinations of and . */ /* This of course results in a mild combinatorial explosion. */ /* To deal with it, we try to generate derived */ /* definitions for as many of the combinations as we can, as */ /* automatically as possible. */ /* */ /* Our assumption throughout is that the programmer will */ /* specify the least demanding operation and memory barrier */ /* that will guarantee correctness for the implementation. */ /* Our job is to find the least expensive way to implement it */ /* on the applicable hardware. In many cases that will */ /* involve, for example, a stronger memory barrier, or a */ /* combination of hardware primitives. */ /* */ /* Conventions: */ /* "plain" atomic operations are not guaranteed to include */ /* a barrier. The suffix in the name specifies the barrier */ /* type. Suffixes are: */ /* _release: Earlier operations may not be delayed past it. */ /* _acquire: Later operations may not move ahead of it. */ /* _read: Subsequent reads must follow this operation and */ /* preceding reads. */ /* _write: Earlier writes precede both this operation and */ /* later writes. */ /* _full: Ordered with respect to both earlier and later memops.*/ /* _release_write: Ordered with respect to earlier writes. */ /* _acquire_read: Ordered with repsect to later reads. */ /* */ /* Currently we try to define the following atomic memory */ /* operations, in combination with the above barriers: */ /* AO_nop */ /* AO_load */ /* AO_store */ /* AO_test_and_set (binary) */ /* AO_fetch_and_add */ /* AO_fetch_and_add1 */ /* AO_fetch_and_sub1 */ /* AO_or */ /* AO_compare_and_swap */ /* */ /* Note that atomicity guarantees are valid only if both */ /* readers and writers use AO_ operations to access the */ /* shared value, while ordering constraints are intended to */ /* apply all memory operations. If a location can potentially */ /* be accessed simultaneously from multiple threads, and one of */ /* those accesses may be a write access, then all such */ /* accesses to that location should be through AO_ primitives. */ /* However if AO_ operations enforce sufficient ordering to */ /* ensure that a location x cannot be accessed concurrently, */ /* or can only be read concurrently, then x can be accessed */ /* via ordinary references and assignments. */ /* */ /* Compare_and_exchange takes an address and an expected old */ /* value and a new value, and returns an int. Nonzero */ /* indicates that it succeeded. */ /* Test_and_set takes an address, atomically replaces it by */ /* AO_TS_SET, and returns the prior value. */ /* An AO_TS_t location can be reset with the */ /* AO_CLEAR macro, which normally uses AO_store_release. */ /* AO_fetch_and_add takes an address and an AO_t increment */ /* value. The AO_fetch_and_add1 and AO_fetch_and_sub1 variants */ /* are provided, since they allow faster implementations on */ /* some hardware. AO_or atomically ors an AO_t value into a */ /* memory location, but does not provide access to the original.*/ /* */ /* We expect this list to grow slowly over time. */ /* */ /* Note that AO_nop_full is a full memory barrier. */ /* */ /* Note that if some data is initialized with */ /* data.x = ...; data.y = ...; ... */ /* AO_store_release_write(&data_is_initialized, 1) */ /* then data is guaranteed to be initialized after the test */ /* if (AO_load_release_read(&data_is_initialized)) ... */ /* succeeds. Furthermore, this should generate near-optimal */ /* code on all common platforms. */ /* */ /* All operations operate on unsigned AO_t, which */ /* is the natural word size, and usually unsigned long. */ /* It is possible to check whether a particular operation op */ /* is available on a particular platform by checking whether */ /* AO_HAVE_op is defined. We make heavy use of these macros */ /* internally. */ /* The rest of this file basically has three sections: */ /* */ /* Some utility and default definitions. */ /* */ /* The architecture dependent section: */ /* This defines atomic operations that have direct hardware */ /* support on a particular platform, mostly by uncluding the */ /* appropriate compiler- and hardware-dependent file. */ /* */ /* The synthesis section: */ /* This tries to define other atomic operations in terms of */ /* those that are explicitly available on the platform. */ /* This section is hardware independent. */ /* We make no attempt to synthesize operations in ways that */ /* effectively introduce locks, except for the debugging/demo */ /* pthread-based implementation at the beginning. A more */ /* relistic implementation that falls back to locks could be */ /* added as a higher layer. But that would sacrifice */ /* usability from signal handlers. */ /* The synthesis section is implemented almost entirely in */ /* atomic_ops_generalize.h. */ /* Some common defaults. Overridden for some architectures. */ #define AO_t size_t /* The test_and_set primitive returns an AO_TS_VAL_t value. */ /* AO_TS_t is the type of an in-memory test-and-set location. */ #define AO_TS_INITIALIZER (AO_t)AO_TS_CLEAR /* Platform-dependent stuff: */ #if defined(__GNUC__) || defined(_MSC_VER) || defined(__INTEL_COMPILER) # define AO_INLINE static __inline #else # define AO_INLINE static #endif #if defined(__GNUC__) && !defined(__INTEL_COMPILER) # define AO_compiler_barrier() __asm__ __volatile__("" : : : "memory") #elif defined(_MSC_VER) # if defined(_AMD64_) # pragma intrinsic(_ReadWriteBarrier) # define AO_compiler_barrier() _ReadWriteBarrier() /* We assume this does not generate a fence instruction. */ /* The documentation is a bit unclear. */ # else # define AO_compiler_barrier() __asm { } /* The preceding implementation may be preferable here too. */ /* But the documentation warns about VC++ 2003 and earlier. */ # endif #elif defined(__INTEL_COMPILER) # define AO_compiler_barrier() __memory_barrier() /* Too strong? IA64-only? */ #elif defined(_HPUX_SOURCE) # if defined(__ia64) # include # define AO_compiler_barrier() _Asm_sched_fence() # else /* FIXME - We dont know how to do this. This is a guess. */ /* And probably a bad one. */ static volatile int AO_barrier_dummy; # define AO_compiler_barrier() AO_barrier_dummy = AO_barrier_dummy # endif #else /* We conjecture that the following usually gives us the right */ /* semantics or an error. */ # define AO_compiler_barrier() asm("") #endif #if defined(AO_USE_PTHREAD_DEFS) # include "atomic_ops/sysdeps/generic_pthread.h" #endif /* AO_USE_PTHREAD_DEFS */ #if defined(__GNUC__) && !defined(AO_USE_PTHREAD_DEFS) \ && !defined(__INTEL_COMPILER) # if defined(__i386__) # include "atomic_ops/sysdeps/gcc/x86.h" # endif /* __i386__ */ # if defined(__x86_64__) # include "atomic_ops/sysdeps/gcc/x86_64.h" # endif /* __i386__ */ # if defined(__ia64__) # include "atomic_ops/sysdeps/gcc/ia64.h" # define AO_GENERALIZE_TWICE # endif /* __ia64__ */ # if defined(__hppa__) # include "atomic_ops/sysdeps/gcc/hppa.h" # define AO_CAN_EMUL_CAS # endif /* __hppa__ */ # if defined(__alpha__) # include "atomic_ops/sysdeps/gcc/alpha.h" # define AO_GENERALIZE_TWICE # endif /* __alpha__ */ # if defined(__s390__) # include "atomic_ops/sysdeps/gcc/s390.h" # endif /* __s390__ */ # if defined(__sparc__) # include "atomic_ops/sysdeps/gcc/sparc.h" # define AO_CAN_EMUL_CAS # endif /* __sparc__ */ # if defined(__m68k__) # include "atomic_ops/sysdeps/gcc/m68k.h" # endif /* __m68k__ */ # if defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) # include "atomic_ops/sysdeps/gcc/powerpc.h" # endif /* __powerpc__ */ # if defined(__arm__) && !defined(AO_USE_PTHREAD_DEFS) # include "atomic_ops/sysdeps/gcc/arm.h" # define AO_CAN_EMUL_CAS # endif /* __arm__ */ # if defined(__cris__) || defined(CRIS) # include "atomic_ops/sysdeps/gcc/cris.h" # endif #endif /* __GNUC__ && !AO_USE_PTHREAD_DEFS */ #if defined(__INTEL_COMPILER) && !defined(AO_USE_PTHREAD_DEFS) # if defined(__ia64__) # include "atomic_ops/sysdeps/icc/ia64.h" # define AO_GENERALIZE_TWICE # endif #endif #if defined(_HPUX_SOURCE) && !defined(__GNUC__) && !defined(AO_USE_PTHREAD_DEFS) # if defined(__ia64) # include "atomic_ops/sysdeps/hpc/ia64.h" # define AO_GENERALIZE_TWICE # else # include "atomic_ops/sysdeps/hpc/hppa.h" # define AO_CAN_EMUL_CAS # endif #endif #if !defined(__GNUC__) && (defined(sparc) || defined(__sparc)) \ && !defined(AO_USE_PTHREAD_DEFS) # include "atomic_ops/sysdeps/sunc/sparc.h" # define AO_CAN_EMUL_CAS #endif #if defined(_MSC_VER) # if defined(_AMD64_) # include "atomic_ops/sysdeps/msftc/x86_64.h" # elif _M_IX86 >= 400 # include "atomic_ops/sysdeps/msftc/x86.h" # endif #endif #if defined(AO_REQUIRE_CAS) && !defined(AO_HAVE_compare_and_swap) \ && !defined(AO_HAVE_compare_and_swap_full) \ && !defined(AO_HAVE_compare_and_swap_acquire) # if defined(AO_CAN_EMUL_CAS) # include "atomic_ops/sysdeps/emul_cas.h" # else # error Cannot implement AO_compare_and_swap_full on this architecture. # endif #endif /* AO_REQUIRE_CAS && !AO_HAVE_compare_and_swap ... */ /* The most common way to clear a test-and-set location */ /* at the end of a critical section. */ #if AO_AO_TS_T && !defined(AO_CLEAR) # define AO_CLEAR(addr) AO_store_release((AO_TS_t *)addr, AO_TS_CLEAR) #endif #if AO_CHAR_TS_T && !defined(AO_CLEAR) # define AO_CLEAR(addr) AO_char_store_release((AO_TS_t *)addr, AO_TS_CLEAR) #endif /* * The generalization section. * Theoretically this should repeatedly include atomic_ops_generalize.h. * In fact, we observe that this converges after a small fixed number * of iterations, usually one. */ #include "atomic_ops/generalize.h" #ifdef AO_GENERALIZE_TWICE # include "atomic_ops/generalize.h" #endif /* For compatibility with version 0.4 and earlier */ #define AO_TS_T AO_TS_t #define AO_T AO_t #define AO_TS_VAL AO_TS_VAL_t #endif /* ATOMIC_OPS_H */ synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/Makefile.in0000664000076400007640000004641311104702317023650 0ustar stefanstefan# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 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 = $(libatomic_ops_a_SOURCES) $(libatomic_ops_gpl_a_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@ target_triplet = @target@ subdir = src DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" libLIBRARIES_INSTALL = $(INSTALL_DATA) LIBRARIES = $(lib_LIBRARIES) AR = ar ARFLAGS = cru libatomic_ops_a_AR = $(AR) $(ARFLAGS) libatomic_ops_a_LIBADD = am__libatomic_ops_a_SOURCES_DIST = atomic_ops.c atomic_ops_sysdeps.S @NEED_ASM_FALSE@am_libatomic_ops_a_OBJECTS = atomic_ops.$(OBJEXT) @NEED_ASM_TRUE@am_libatomic_ops_a_OBJECTS = atomic_ops.$(OBJEXT) \ @NEED_ASM_TRUE@ atomic_ops_sysdeps.$(OBJEXT) libatomic_ops_a_OBJECTS = $(am_libatomic_ops_a_OBJECTS) libatomic_ops_gpl_a_AR = $(AR) $(ARFLAGS) libatomic_ops_gpl_a_LIBADD = am_libatomic_ops_gpl_a_OBJECTS = atomic_ops_stack.$(OBJEXT) \ atomic_ops_malloc.$(OBJEXT) libatomic_ops_gpl_a_OBJECTS = $(am_libatomic_ops_gpl_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I. depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libatomic_ops_a_SOURCES) $(libatomic_ops_gpl_a_SOURCES) DIST_SOURCES = $(am__libatomic_ops_a_SOURCES_DIST) \ $(libatomic_ops_gpl_a_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 includeHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(include_HEADERS) ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ NEED_ASM_FALSE = @NEED_ASM_FALSE@ NEED_ASM_TRUE = @NEED_ASM_TRUE@ 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@ PICFLAG = @PICFLAG@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ 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__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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ SUBDIRS = atomic_ops AM_CFLAGS = @PICFLAG@ include_HEADERS = atomic_ops.h atomic_ops_stack.h atomic_ops_malloc.h lib_LIBRARIES = libatomic_ops.a libatomic_ops_gpl.a @NEED_ASM_FALSE@libatomic_ops_a_SOURCES = atomic_ops.c @NEED_ASM_TRUE@libatomic_ops_a_SOURCES = atomic_ops.c atomic_ops_sysdeps.S libatomic_ops_gpl_a_SOURCES = atomic_ops_stack.c atomic_ops_malloc.c EXTRA_DIST = Makefile.msft all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .S .c .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 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 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 src/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 install-libLIBRARIES: $(lib_LIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done @$(POST_INSTALL) @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ p=$(am__strip_dir) \ echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \ $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \ else :; fi; \ done uninstall-libLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \ rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLIBRARIES: -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) libatomic_ops.a: $(libatomic_ops_a_OBJECTS) $(libatomic_ops_a_DEPENDENCIES) -rm -f libatomic_ops.a $(libatomic_ops_a_AR) libatomic_ops.a $(libatomic_ops_a_OBJECTS) $(libatomic_ops_a_LIBADD) $(RANLIB) libatomic_ops.a libatomic_ops_gpl.a: $(libatomic_ops_gpl_a_OBJECTS) $(libatomic_ops_gpl_a_DEPENDENCIES) -rm -f libatomic_ops_gpl.a $(libatomic_ops_gpl_a_AR) libatomic_ops_gpl.a $(libatomic_ops_gpl_a_OBJECTS) $(libatomic_ops_gpl_a_LIBADD) $(RANLIB) libatomic_ops_gpl.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atomic_ops.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atomic_ops_malloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atomic_ops_stack.Po@am__quote@ .S.o: $(CCASCOMPILE) -c $< .S.obj: $(CCASCOMPILE) -c `$(CYGPATH_W) '$<'` .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` uninstall-info-am: install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)" @list='$(include_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ rm -f "$(DESTDIR)$(includedir)/$$f"; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done 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) @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 check-am: all-am check: check-recursive all-am: Makefile $(LIBRARIES) $(HEADERS) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libLIBRARIES mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-includeHEADERS install-exec-am: install-libLIBRARIES install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-includeHEADERS uninstall-info-am \ uninstall-libLIBRARIES uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ clean clean-generic clean-libLIBRARIES clean-recursive ctags \ ctags-recursive distclean distclean-compile distclean-generic \ distclean-hdr distclean-recursive 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-includeHEADERS install-info install-info-am \ install-libLIBRARIES install-man install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic maintainer-clean-recursive \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-includeHEADERS \ uninstall-info-am uninstall-libLIBRARIES # 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: synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/Makefile.am0000664000076400007640000000057411104702317023635 0ustar stefanstefanSUBDIRS=atomic_ops AM_CFLAGS=@PICFLAG@ include_HEADERS=atomic_ops.h atomic_ops_stack.h atomic_ops_malloc.h lib_LIBRARIES = libatomic_ops.a libatomic_ops_gpl.a if NEED_ASM libatomic_ops_a_SOURCES = atomic_ops.c atomic_ops_sysdeps.S else libatomic_ops_a_SOURCES = atomic_ops.c endif libatomic_ops_gpl_a_SOURCES = atomic_ops_stack.c atomic_ops_malloc.c EXTRA_DIST=Makefile.msft synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/src/atomic_ops_sysdeps.S0000664000076400007640000000046211104702317025630 0ustar stefanstefan/* * Include the appropriate system-dependent assembly file, if any. * This is used only if the platform supports neither inline assembly * code, nor appropriate compiler intrinsics. */ #if !defined(__GNUC__) && (defined(sparc) || defined(__sparc)) # include "atomic_ops/sysdeps/sunc/sparc.S" #endif synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/depcomp0000775000076400007640000003710011104702317022362 0ustar stefanstefan#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2005-07-09.11 # 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., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by 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 -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/AUTHORS0000664000076400007640000000023011104702317022047 0ustar stefanstefanOriginally written by Hans Boehm, with some platform-dependent code imported from the Boehm-Demers-Weiser GC, where it was contributed by many others. synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/config.sub0000775000076400007640000007726411104702317023007 0ustar stefanstefan#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2006-06-06' # 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., 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. # 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, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xscalee[bl] | 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) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ | 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 ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; 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 ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; 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 ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; 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 ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -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 spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/compile0000775000076400007640000000717311104702320022364 0ustar stefanstefan#! /bin/sh # Wrapper for compilers which do not understand `-c -o'. scriptversion=2005-05-14.22 # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand `-c -o'. Remove `-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file `INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; esac ofile= cfile= eat= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as `compile cc -o foo foo.c'. # So we strip `-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no `-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # `.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'` # Create the lock directory. # Note: use `[/.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/missing0000775000076400007640000002540611104702317022412 0ustar stefanstefan#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2005-06-08.21 # 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., 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. 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 # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/Makefile.in0000664000076400007640000004307511104702317023062 0ustar stefanstefan# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 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@ target_triplet = @target@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \ ChangeLog INSTALL NEWS compile config.guess config.sub depcomp \ install-sh missing mkinstalldirs subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/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 = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ NEED_ASM_FALSE = @NEED_ASM_FALSE@ NEED_ASM_TRUE = @NEED_ASM_TRUE@ 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@ PICFLAG = @PICFLAG@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ 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__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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ SUBDIRS = src doc tests all: 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) 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): @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done 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) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ 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) $(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) $(am__remove_distdir) mkdir $(distdir) @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 installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ check-am clean clean-generic clean-recursive ctags \ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \ dist-tarZ dist-zip distcheck distclean distclean-generic \ distclean-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-recursive pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-info-am #distclean-local: # 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: synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/configure.ac0000664000076400007640000000256711104702320023276 0ustar stefanstefan# Process this file with autoconf to produce a configure script. AC_INIT([libatomic_ops],[1.2]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR(src/atomic_ops.c) AM_INIT_AUTOMAKE AC_PROG_RANLIB AM_CONFIG_HEADER(src/config.h) # Checks for programs. AC_PROG_CC AM_PROG_AS # Checks for functions. AC_FUNC_MMAP # Checks for header files. AC_HEADER_STDC # AC_CHECK_HEADERS([ ]) # Determine PIC flag, adjust default CFLAGS need_asm=false PICFLAG= AC_MSG_CHECKING(Determining PIC compiler flag) if test "$GCC" = yes; then AC_MSG_RESULT(-fPIC) PICFLAG=-fPIC else case "$host" in *-*-hpux*) AC_MSG_RESULT("+Z") PICFLAG="+Z" if test "$GCC" != yes; then CFLAGS="$CFLAGS +O2 -mt" fi ;; *-*-solaris*) AC_MSG_RESULT(-Kpic) PICFLAG=-Kpic if test "$GCC" != yes; then CFLAGS="$CFLAGS -O" need_asm=true fi ;; *-*-linux*) AC_MSG_RESULT(-fPIC) PICFLAG=-fPIC # Any Linux compiler had better be gcc compatible. ;; *) AC_MSG_RESULT("") ;; esac fi CFLAGS="$CFLAGS -DNDEBUG" AC_SUBST(PICFLAG) AC_SUBST(DEFS) AM_CONDITIONAL(NEED_ASM, test x$need_asm = xtrue) AC_CONFIG_FILES([Makefile src/Makefile src/atomic_ops/Makefile src/atomic_ops/sysdeps/Makefile doc/Makefile tests/Makefile]) AC_CONFIG_COMMANDS([default],[[]],[[PICFLAG=${PICFLAG} CC=${CC} DEFS=${DEFS}]]) AC_OUTPUT synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/tests/0000775000076400007640000000000011172123233022145 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/tests/test_stack.c0000664000076400007640000001357111104702320024457 0ustar stefanstefan/* * Copyright (c) 2005 Hewlett-Packard Development Company, L.P. * Original Author: Hans Boehm * * This file may be redistributed and/or modified 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. * * It is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License in the * file doc/COPYING for more details. */ #if defined(HAVE_CONFIG_H) # include "config.h" #endif #include #include #include #include "atomic_ops.h" #include "atomic_ops_stack.h" #define MAX_NTHREADS 100 #ifndef NO_TIMES #include #include /* Need 64-bit long long support */ long long get_msecs(void) { struct timeval tv; gettimeofday(&tv, 0); return (long long)tv.tv_sec * 1000 + tv.tv_usec/1000; } #else # define get_msecs() 0 #endif typedef struct le { AO_t next; int data; } list_element; AO_stack_t the_list = AO_STACK_INITIALIZER; void add_elements(int n) { list_element * le; if (n == 0) return; add_elements(n-1); le = malloc(sizeof(list_element)); le -> data = n; AO_stack_push(&the_list, (AO_t *)le); } void print_list() { list_element *p; for (p = (list_element *)AO_REAL_HEAD_PTR(the_list); p != 0; p = (list_element *)AO_REAL_NEXT_PTR(p -> next)) printf("%d\n", p -> data); } static char marks[MAX_NTHREADS * MAX_NTHREADS]; void check_list(int n) { list_element *p; int i; for (i = 1; i <= n; ++i) marks[i] = 0; for (p = (list_element *)AO_REAL_HEAD_PTR(the_list); p != 0; p = (list_element *)AO_REAL_NEXT_PTR(p -> next)) { if (p -> data > n || p -> data <= 0) fprintf(stderr, "Found erroneous list element %d\n", p -> data); if (marks[p -> data] != 0) fprintf(stderr, "Found duplicate list element %d\n", p -> data); marks[p -> data] = 1; } for (i = 1; i <= n; ++i) if (marks[i] != 1) fprintf(stderr, "Missing list element %d\n", i); } volatile AO_t ops_performed = 0; #define LIMIT 1000000 /* Total number of push/pop ops in all threads per test. */ #ifdef AO_HAVE_fetch_and_add # define fetch_and_add(addr, val) AO_fetch_and_add(addr, val) #else /* Fake it. This is really quite unacceptable for timing */ /* purposes. But as a correctness test, it should be OK. */ AO_INLINE AO_t fetch_and_add(volatile AO_t * addr, AO_t val) { AO_t result = AO_load(addr); AO_store(addr, result + val); return result; } #endif void * run_one_test(void * arg) { list_element * t[MAX_NTHREADS + 1]; list_element * aux; long index = (long)arg; int i; int j = 0; # ifdef VERBOSE printf("starting thread %d\n", index); # endif while (fetch_and_add(&ops_performed, index + 1) + index + 1 < LIMIT) { for (i = 0; i < index + 1; ++i) { t[i] = (list_element *)AO_stack_pop(&the_list); if (0 == t[i]) { fprintf(stderr, "FAILED\n"); abort(); } } for (i = 0; i < index + 1; ++i) { AO_stack_push(&the_list, (AO_t *)t[i]); } j += (index + 1); } # ifdef VERBOSE printf("finished thread %d: %d total ops\n", index, j); # endif return 0; } #define N_EXPERIMENTS 1 unsigned long times[MAX_NTHREADS + 1][N_EXPERIMENTS]; int main(int argc, char **argv) { int nthreads; int max_nthreads; int exper_n; if (1 == argc) max_nthreads = 4; else if (2 == argc) { max_nthreads = atoi(argv[1]); if (max_nthreads < 1 || max_nthreads > MAX_NTHREADS) { fprintf(stderr, "Invalid max # of threads argument\n"); exit(1); } } else { fprintf(stderr, "Usage: %s [max # of threads]\n", argv[0]); exit(1); } for (exper_n = 0; exper_n < N_EXPERIMENTS; ++ exper_n) for (nthreads = 1; nthreads <= max_nthreads; ++nthreads) { int i; pthread_t thread[MAX_NTHREADS]; int list_length = nthreads*(nthreads+1)/2; long long start_time; add_elements(list_length); # ifdef VERBOSE printf("Initial list (nthreads = %d):\n", nthreads); print_list(); # endif ops_performed = 0; start_time = get_msecs(); for (i = 1; i < nthreads; ++i) { int code; if ((code = pthread_create(thread+i, 0, run_one_test, (void *)(long)i)) != 0) { fprintf(stderr, "Thread creation failed %u\n", code); exit(1); } } /* We use the main thread to run one test. This allows gprof */ /* profiling to work, for example. */ run_one_test(0); for (i = 1; i < nthreads; ++i) { int code; if ((code = pthread_join(thread[i], 0)) != 0) { fprintf(stderr, "Thread join failed %u\n", code); } } times[nthreads][exper_n] = (unsigned long)(get_msecs() - start_time); # ifdef VERBOSE printf("%d %lu\n", nthreads, (unsigned long)(get_msecs() - start_time)); printf("final list (should be reordered initial list):\n"); print_list(); # endif check_list(list_length); while ((list_element *)AO_stack_pop(&the_list)); } # ifndef NO_TIMES for (nthreads = 1; nthreads <= max_nthreads; ++nthreads) { unsigned long sum = 0; printf("About %d pushes + %d pops in %d threads:", LIMIT, LIMIT, nthreads); for (exper_n = 0; exper_n < N_EXPERIMENTS; ++exper_n) { # if defined(VERBOSE) printf("[%lu] ", times[nthreads][exper_n]); # endif sum += times[nthreads][exper_n]; } printf(" %lu msecs\n", (sum + N_EXPERIMENTS/2)/N_EXPERIMENTS); } # endif /* NO_TIMES */ return 0; } synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/tests/test_atomic_include.h0000664000076400007640000013165411104702320026341 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ void test_atomic(void); void test_atomic_release(void); void test_atomic_acquire(void); void test_atomic_read(void); void test_atomic_write(void); void test_atomic_full(void); void test_atomic_release_write(void); void test_atomic_acquire_read(void); /* Some basic sanity tests. These do not test the barrier semantics. */ #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: )\n", \ __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ fprintf(stderr, "Missing: %s\n", #name "") void test_atomic(void) { AO_t x; unsigned char b; unsigned short s; unsigned int zz; # if defined(AO_HAVE_test_and_set) AO_TS_t z = AO_TS_INITIALIZER; # endif # if defined(AO_HAVE_double_t) AO_double_t w; w.AO_val1 = 0; w.AO_val2 = 0; # endif # if defined(AO_HAVE_nop) AO_nop(); # else MISSING(AO_nop); # endif # if defined(AO_HAVE_store) AO_store(&x, 13); TA_assert (x == 13); # else MISSING(AO_store); x = 13; # endif # if defined(AO_HAVE_load) TA_assert(AO_load(&x) == 13); # else MISSING(AO_load); # endif # if defined(AO_HAVE_test_and_set) assert(AO_test_and_set(&z) == AO_TS_CLEAR); assert(AO_test_and_set(&z) == AO_TS_SET); assert(AO_test_and_set(&z) == AO_TS_SET); AO_CLEAR(&z); # else MISSING(AO_test_and_set); # endif # if defined(AO_HAVE_fetch_and_add) TA_assert(AO_fetch_and_add(&x, 42) == 13); TA_assert(AO_fetch_and_add(&x, -42) == 55); # else MISSING(AO_fetch_and_add); # endif # if defined(AO_HAVE_fetch_and_add1) TA_assert(AO_fetch_and_add1(&x) == 13); # else MISSING(AO_fetch_and_add1); ++x; # endif # if defined(AO_HAVE_fetch_and_sub1) TA_assert(AO_fetch_and_sub1(&x) == 14); # else MISSING(AO_fetch_and_sub1); --x; # endif # if defined(AO_HAVE_short_store) AO_short_store(&s, 13); # else MISSING(AO_short_store); s = 13; # endif # if defined(AO_HAVE_short_load) TA_assert(AO_short_load(&s) == 13); # else MISSING(AO_short_load); # endif # if defined(AO_HAVE_short_fetch_and_add) TA_assert(AO_short_fetch_and_add(&s, 42) == 13); TA_assert(AO_short_fetch_and_add(&s, -42) == 55); # else MISSING(AO_short_fetch_and_add); # endif # if defined(AO_HAVE_short_fetch_and_add1) TA_assert(AO_short_fetch_and_add1(&s) == 13); # else MISSING(AO_short_fetch_and_add1); ++s; # endif # if defined(AO_HAVE_short_fetch_and_sub1) TA_assert(AO_short_fetch_and_sub1(&s) == 14); # else MISSING(AO_short_fetch_and_sub1); --s; # endif # if defined(AO_HAVE_char_store) AO_char_store(&b, 13); # else MISSING(AO_char_store); b = 13; # endif # if defined(AO_HAVE_char_load) TA_assert(AO_char_load(&b) == 13); # else MISSING(AO_char_load); # endif # if defined(AO_HAVE_char_fetch_and_add) TA_assert(AO_char_fetch_and_add(&b, 42) == 13); TA_assert(AO_char_fetch_and_add(&b, -42) == 55); # else MISSING(AO_char_fetch_and_add); # endif # if defined(AO_HAVE_char_fetch_and_add1) TA_assert(AO_char_fetch_and_add1(&b) == 13); # else MISSING(AO_char_fetch_and_add1); ++b; # endif # if defined(AO_HAVE_char_fetch_and_sub1) TA_assert(AO_char_fetch_and_sub1(&b) == 14); # else MISSING(AO_char_fetch_and_sub1); --b; # endif # if defined(AO_HAVE_int_store) AO_int_store(&zz, 13); # else MISSING(AO_int_store); zz = 13; # endif # if defined(AO_HAVE_int_load) TA_assert(AO_int_load(&zz) == 13); # else MISSING(AO_int_load); # endif # if defined(AO_HAVE_int_fetch_and_add) TA_assert(AO_int_fetch_and_add(&zz, 42) == 13); TA_assert(AO_int_fetch_and_add(&zz, -42) == 55); # else MISSING(AO_int_fetch_and_add); # endif # if defined(AO_HAVE_int_fetch_and_add1) TA_assert(AO_int_fetch_and_add1(&zz) == 13); # else MISSING(AO_int_fetch_and_add1); ++zz; # endif # if defined(AO_HAVE_int_fetch_and_sub1) TA_assert(AO_int_fetch_and_sub1(&zz) == 14); # else MISSING(AO_int_fetch_and_sub1); --zz; # endif # if defined(AO_HAVE_compare_and_swap) TA_assert(!AO_compare_and_swap(&x, 14, 42)); TA_assert(x == 13); TA_assert(AO_compare_and_swap(&x, 13, 42)); TA_assert(x == 42); # else MISSING(AO_compare_and_swap); # endif # if defined(AO_HAVE_or) AO_or(&x, 66); TA_assert(x == 106); # else MISSING(AO_or); x |= 34; # endif # if defined(AO_HAVE_compare_double_and_swap_double) TA_assert(!AO_compare_double_and_swap_double(&w, 17, 42, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_double_and_swap_double(&w, 0, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_double_and_swap_double(&w, 12, 13, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); w.AO_val1 = 0; w.AO_val2 = 0; # else MISSING(AO_compare_double_and_swap_double); # endif # if defined(AO_HAVE_compare_and_swap_double) TA_assert(!AO_compare_and_swap_double(&w, 17, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_and_swap_double(&w, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_and_swap_double(&w, 12, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); # else MISSING(AO_compare_and_swap_double); # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* Some basic sanity tests. These do not test the barrier semantics. */ #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _release)\n", \ __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ fprintf(stderr, "Missing: %s\n", #name "_release") void test_atomic_release(void) { AO_t x; unsigned char b; unsigned short s; unsigned int zz; # if defined(AO_HAVE_test_and_set_release) AO_TS_t z = AO_TS_INITIALIZER; # endif # if defined(AO_HAVE_double_t) AO_double_t w; w.AO_val1 = 0; w.AO_val2 = 0; # endif # if defined(AO_HAVE_nop_release) AO_nop_release(); # else MISSING(AO_nop); # endif # if defined(AO_HAVE_store_release) AO_store_release(&x, 13); TA_assert (x == 13); # else MISSING(AO_store); x = 13; # endif # if defined(AO_HAVE_load_release) TA_assert(AO_load_release(&x) == 13); # else MISSING(AO_load); # endif # if defined(AO_HAVE_test_and_set_release) assert(AO_test_and_set_release(&z) == AO_TS_CLEAR); assert(AO_test_and_set_release(&z) == AO_TS_SET); assert(AO_test_and_set_release(&z) == AO_TS_SET); AO_CLEAR(&z); # else MISSING(AO_test_and_set); # endif # if defined(AO_HAVE_fetch_and_add_release) TA_assert(AO_fetch_and_add_release(&x, 42) == 13); TA_assert(AO_fetch_and_add_release(&x, -42) == 55); # else MISSING(AO_fetch_and_add); # endif # if defined(AO_HAVE_fetch_and_add1_release) TA_assert(AO_fetch_and_add1_release(&x) == 13); # else MISSING(AO_fetch_and_add1); ++x; # endif # if defined(AO_HAVE_fetch_and_sub1_release) TA_assert(AO_fetch_and_sub1_release(&x) == 14); # else MISSING(AO_fetch_and_sub1); --x; # endif # if defined(AO_HAVE_short_store_release) AO_short_store_release(&s, 13); # else MISSING(AO_short_store); s = 13; # endif # if defined(AO_HAVE_short_load_release) TA_assert(AO_short_load(&s) == 13); # else MISSING(AO_short_load); # endif # if defined(AO_HAVE_short_fetch_and_add_release) TA_assert(AO_short_fetch_and_add_release(&s, 42) == 13); TA_assert(AO_short_fetch_and_add_release(&s, -42) == 55); # else MISSING(AO_short_fetch_and_add); # endif # if defined(AO_HAVE_short_fetch_and_add1_release) TA_assert(AO_short_fetch_and_add1_release(&s) == 13); # else MISSING(AO_short_fetch_and_add1); ++s; # endif # if defined(AO_HAVE_short_fetch_and_sub1_release) TA_assert(AO_short_fetch_and_sub1_release(&s) == 14); # else MISSING(AO_short_fetch_and_sub1); --s; # endif # if defined(AO_HAVE_char_store_release) AO_char_store_release(&b, 13); # else MISSING(AO_char_store); b = 13; # endif # if defined(AO_HAVE_char_load_release) TA_assert(AO_char_load(&b) == 13); # else MISSING(AO_char_load); # endif # if defined(AO_HAVE_char_fetch_and_add_release) TA_assert(AO_char_fetch_and_add_release(&b, 42) == 13); TA_assert(AO_char_fetch_and_add_release(&b, -42) == 55); # else MISSING(AO_char_fetch_and_add); # endif # if defined(AO_HAVE_char_fetch_and_add1_release) TA_assert(AO_char_fetch_and_add1_release(&b) == 13); # else MISSING(AO_char_fetch_and_add1); ++b; # endif # if defined(AO_HAVE_char_fetch_and_sub1_release) TA_assert(AO_char_fetch_and_sub1_release(&b) == 14); # else MISSING(AO_char_fetch_and_sub1); --b; # endif # if defined(AO_HAVE_int_store_release) AO_int_store_release(&zz, 13); # else MISSING(AO_int_store); zz = 13; # endif # if defined(AO_HAVE_int_load_release) TA_assert(AO_int_load(&zz) == 13); # else MISSING(AO_int_load); # endif # if defined(AO_HAVE_int_fetch_and_add_release) TA_assert(AO_int_fetch_and_add_release(&zz, 42) == 13); TA_assert(AO_int_fetch_and_add_release(&zz, -42) == 55); # else MISSING(AO_int_fetch_and_add); # endif # if defined(AO_HAVE_int_fetch_and_add1_release) TA_assert(AO_int_fetch_and_add1_release(&zz) == 13); # else MISSING(AO_int_fetch_and_add1); ++zz; # endif # if defined(AO_HAVE_int_fetch_and_sub1_release) TA_assert(AO_int_fetch_and_sub1_release(&zz) == 14); # else MISSING(AO_int_fetch_and_sub1); --zz; # endif # if defined(AO_HAVE_compare_and_swap_release) TA_assert(!AO_compare_and_swap_release(&x, 14, 42)); TA_assert(x == 13); TA_assert(AO_compare_and_swap_release(&x, 13, 42)); TA_assert(x == 42); # else MISSING(AO_compare_and_swap); # endif # if defined(AO_HAVE_or_release) AO_or_release(&x, 66); TA_assert(x == 106); # else MISSING(AO_or); x |= 34; # endif # if defined(AO_HAVE_compare_double_and_swap_double_release) TA_assert(!AO_compare_double_and_swap_double_release(&w, 17, 42, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_double_and_swap_double_release(&w, 0, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_double_and_swap_double_release(&w, 12, 13, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); w.AO_val1 = 0; w.AO_val2 = 0; # else MISSING(AO_compare_double_and_swap_double); # endif # if defined(AO_HAVE_compare_and_swap_double_release) TA_assert(!AO_compare_and_swap_double_release(&w, 17, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_and_swap_double_release(&w, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_and_swap_double_release(&w, 12, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); # else MISSING(AO_compare_and_swap_double); # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* Some basic sanity tests. These do not test the barrier semantics. */ #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _acquire)\n", \ __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ fprintf(stderr, "Missing: %s\n", #name "_acquire") void test_atomic_acquire(void) { AO_t x; unsigned char b; unsigned short s; unsigned int zz; # if defined(AO_HAVE_test_and_set_acquire) AO_TS_t z = AO_TS_INITIALIZER; # endif # if defined(AO_HAVE_double_t) AO_double_t w; w.AO_val1 = 0; w.AO_val2 = 0; # endif # if defined(AO_HAVE_nop_acquire) AO_nop_acquire(); # else MISSING(AO_nop); # endif # if defined(AO_HAVE_store_acquire) AO_store_acquire(&x, 13); TA_assert (x == 13); # else MISSING(AO_store); x = 13; # endif # if defined(AO_HAVE_load_acquire) TA_assert(AO_load_acquire(&x) == 13); # else MISSING(AO_load); # endif # if defined(AO_HAVE_test_and_set_acquire) assert(AO_test_and_set_acquire(&z) == AO_TS_CLEAR); assert(AO_test_and_set_acquire(&z) == AO_TS_SET); assert(AO_test_and_set_acquire(&z) == AO_TS_SET); AO_CLEAR(&z); # else MISSING(AO_test_and_set); # endif # if defined(AO_HAVE_fetch_and_add_acquire) TA_assert(AO_fetch_and_add_acquire(&x, 42) == 13); TA_assert(AO_fetch_and_add_acquire(&x, -42) == 55); # else MISSING(AO_fetch_and_add); # endif # if defined(AO_HAVE_fetch_and_add1_acquire) TA_assert(AO_fetch_and_add1_acquire(&x) == 13); # else MISSING(AO_fetch_and_add1); ++x; # endif # if defined(AO_HAVE_fetch_and_sub1_acquire) TA_assert(AO_fetch_and_sub1_acquire(&x) == 14); # else MISSING(AO_fetch_and_sub1); --x; # endif # if defined(AO_HAVE_short_store_acquire) AO_short_store_acquire(&s, 13); # else MISSING(AO_short_store); s = 13; # endif # if defined(AO_HAVE_short_load_acquire) TA_assert(AO_short_load(&s) == 13); # else MISSING(AO_short_load); # endif # if defined(AO_HAVE_short_fetch_and_add_acquire) TA_assert(AO_short_fetch_and_add_acquire(&s, 42) == 13); TA_assert(AO_short_fetch_and_add_acquire(&s, -42) == 55); # else MISSING(AO_short_fetch_and_add); # endif # if defined(AO_HAVE_short_fetch_and_add1_acquire) TA_assert(AO_short_fetch_and_add1_acquire(&s) == 13); # else MISSING(AO_short_fetch_and_add1); ++s; # endif # if defined(AO_HAVE_short_fetch_and_sub1_acquire) TA_assert(AO_short_fetch_and_sub1_acquire(&s) == 14); # else MISSING(AO_short_fetch_and_sub1); --s; # endif # if defined(AO_HAVE_char_store_acquire) AO_char_store_acquire(&b, 13); # else MISSING(AO_char_store); b = 13; # endif # if defined(AO_HAVE_char_load_acquire) TA_assert(AO_char_load(&b) == 13); # else MISSING(AO_char_load); # endif # if defined(AO_HAVE_char_fetch_and_add_acquire) TA_assert(AO_char_fetch_and_add_acquire(&b, 42) == 13); TA_assert(AO_char_fetch_and_add_acquire(&b, -42) == 55); # else MISSING(AO_char_fetch_and_add); # endif # if defined(AO_HAVE_char_fetch_and_add1_acquire) TA_assert(AO_char_fetch_and_add1_acquire(&b) == 13); # else MISSING(AO_char_fetch_and_add1); ++b; # endif # if defined(AO_HAVE_char_fetch_and_sub1_acquire) TA_assert(AO_char_fetch_and_sub1_acquire(&b) == 14); # else MISSING(AO_char_fetch_and_sub1); --b; # endif # if defined(AO_HAVE_int_store_acquire) AO_int_store_acquire(&zz, 13); # else MISSING(AO_int_store); zz = 13; # endif # if defined(AO_HAVE_int_load_acquire) TA_assert(AO_int_load(&zz) == 13); # else MISSING(AO_int_load); # endif # if defined(AO_HAVE_int_fetch_and_add_acquire) TA_assert(AO_int_fetch_and_add_acquire(&zz, 42) == 13); TA_assert(AO_int_fetch_and_add_acquire(&zz, -42) == 55); # else MISSING(AO_int_fetch_and_add); # endif # if defined(AO_HAVE_int_fetch_and_add1_acquire) TA_assert(AO_int_fetch_and_add1_acquire(&zz) == 13); # else MISSING(AO_int_fetch_and_add1); ++zz; # endif # if defined(AO_HAVE_int_fetch_and_sub1_acquire) TA_assert(AO_int_fetch_and_sub1_acquire(&zz) == 14); # else MISSING(AO_int_fetch_and_sub1); --zz; # endif # if defined(AO_HAVE_compare_and_swap_acquire) TA_assert(!AO_compare_and_swap_acquire(&x, 14, 42)); TA_assert(x == 13); TA_assert(AO_compare_and_swap_acquire(&x, 13, 42)); TA_assert(x == 42); # else MISSING(AO_compare_and_swap); # endif # if defined(AO_HAVE_or_acquire) AO_or_acquire(&x, 66); TA_assert(x == 106); # else MISSING(AO_or); x |= 34; # endif # if defined(AO_HAVE_compare_double_and_swap_double_acquire) TA_assert(!AO_compare_double_and_swap_double_acquire(&w, 17, 42, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_double_and_swap_double_acquire(&w, 0, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_double_and_swap_double_acquire(&w, 12, 13, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); w.AO_val1 = 0; w.AO_val2 = 0; # else MISSING(AO_compare_double_and_swap_double); # endif # if defined(AO_HAVE_compare_and_swap_double_acquire) TA_assert(!AO_compare_and_swap_double_acquire(&w, 17, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_and_swap_double_acquire(&w, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_and_swap_double_acquire(&w, 12, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); # else MISSING(AO_compare_and_swap_double); # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* Some basic sanity tests. These do not test the barrier semantics. */ #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _read)\n", \ __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ fprintf(stderr, "Missing: %s\n", #name "_read") void test_atomic_read(void) { AO_t x; unsigned char b; unsigned short s; unsigned int zz; # if defined(AO_HAVE_test_and_set_read) AO_TS_t z = AO_TS_INITIALIZER; # endif # if defined(AO_HAVE_double_t) AO_double_t w; w.AO_val1 = 0; w.AO_val2 = 0; # endif # if defined(AO_HAVE_nop_read) AO_nop_read(); # else MISSING(AO_nop); # endif # if defined(AO_HAVE_store_read) AO_store_read(&x, 13); TA_assert (x == 13); # else MISSING(AO_store); x = 13; # endif # if defined(AO_HAVE_load_read) TA_assert(AO_load_read(&x) == 13); # else MISSING(AO_load); # endif # if defined(AO_HAVE_test_and_set_read) assert(AO_test_and_set_read(&z) == AO_TS_CLEAR); assert(AO_test_and_set_read(&z) == AO_TS_SET); assert(AO_test_and_set_read(&z) == AO_TS_SET); AO_CLEAR(&z); # else MISSING(AO_test_and_set); # endif # if defined(AO_HAVE_fetch_and_add_read) TA_assert(AO_fetch_and_add_read(&x, 42) == 13); TA_assert(AO_fetch_and_add_read(&x, -42) == 55); # else MISSING(AO_fetch_and_add); # endif # if defined(AO_HAVE_fetch_and_add1_read) TA_assert(AO_fetch_and_add1_read(&x) == 13); # else MISSING(AO_fetch_and_add1); ++x; # endif # if defined(AO_HAVE_fetch_and_sub1_read) TA_assert(AO_fetch_and_sub1_read(&x) == 14); # else MISSING(AO_fetch_and_sub1); --x; # endif # if defined(AO_HAVE_short_store_read) AO_short_store_read(&s, 13); # else MISSING(AO_short_store); s = 13; # endif # if defined(AO_HAVE_short_load_read) TA_assert(AO_short_load(&s) == 13); # else MISSING(AO_short_load); # endif # if defined(AO_HAVE_short_fetch_and_add_read) TA_assert(AO_short_fetch_and_add_read(&s, 42) == 13); TA_assert(AO_short_fetch_and_add_read(&s, -42) == 55); # else MISSING(AO_short_fetch_and_add); # endif # if defined(AO_HAVE_short_fetch_and_add1_read) TA_assert(AO_short_fetch_and_add1_read(&s) == 13); # else MISSING(AO_short_fetch_and_add1); ++s; # endif # if defined(AO_HAVE_short_fetch_and_sub1_read) TA_assert(AO_short_fetch_and_sub1_read(&s) == 14); # else MISSING(AO_short_fetch_and_sub1); --s; # endif # if defined(AO_HAVE_char_store_read) AO_char_store_read(&b, 13); # else MISSING(AO_char_store); b = 13; # endif # if defined(AO_HAVE_char_load_read) TA_assert(AO_char_load(&b) == 13); # else MISSING(AO_char_load); # endif # if defined(AO_HAVE_char_fetch_and_add_read) TA_assert(AO_char_fetch_and_add_read(&b, 42) == 13); TA_assert(AO_char_fetch_and_add_read(&b, -42) == 55); # else MISSING(AO_char_fetch_and_add); # endif # if defined(AO_HAVE_char_fetch_and_add1_read) TA_assert(AO_char_fetch_and_add1_read(&b) == 13); # else MISSING(AO_char_fetch_and_add1); ++b; # endif # if defined(AO_HAVE_char_fetch_and_sub1_read) TA_assert(AO_char_fetch_and_sub1_read(&b) == 14); # else MISSING(AO_char_fetch_and_sub1); --b; # endif # if defined(AO_HAVE_int_store_read) AO_int_store_read(&zz, 13); # else MISSING(AO_int_store); zz = 13; # endif # if defined(AO_HAVE_int_load_read) TA_assert(AO_int_load(&zz) == 13); # else MISSING(AO_int_load); # endif # if defined(AO_HAVE_int_fetch_and_add_read) TA_assert(AO_int_fetch_and_add_read(&zz, 42) == 13); TA_assert(AO_int_fetch_and_add_read(&zz, -42) == 55); # else MISSING(AO_int_fetch_and_add); # endif # if defined(AO_HAVE_int_fetch_and_add1_read) TA_assert(AO_int_fetch_and_add1_read(&zz) == 13); # else MISSING(AO_int_fetch_and_add1); ++zz; # endif # if defined(AO_HAVE_int_fetch_and_sub1_read) TA_assert(AO_int_fetch_and_sub1_read(&zz) == 14); # else MISSING(AO_int_fetch_and_sub1); --zz; # endif # if defined(AO_HAVE_compare_and_swap_read) TA_assert(!AO_compare_and_swap_read(&x, 14, 42)); TA_assert(x == 13); TA_assert(AO_compare_and_swap_read(&x, 13, 42)); TA_assert(x == 42); # else MISSING(AO_compare_and_swap); # endif # if defined(AO_HAVE_or_read) AO_or_read(&x, 66); TA_assert(x == 106); # else MISSING(AO_or); x |= 34; # endif # if defined(AO_HAVE_compare_double_and_swap_double_read) TA_assert(!AO_compare_double_and_swap_double_read(&w, 17, 42, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_double_and_swap_double_read(&w, 0, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_double_and_swap_double_read(&w, 12, 13, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); w.AO_val1 = 0; w.AO_val2 = 0; # else MISSING(AO_compare_double_and_swap_double); # endif # if defined(AO_HAVE_compare_and_swap_double_read) TA_assert(!AO_compare_and_swap_double_read(&w, 17, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_and_swap_double_read(&w, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_and_swap_double_read(&w, 12, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); # else MISSING(AO_compare_and_swap_double); # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* Some basic sanity tests. These do not test the barrier semantics. */ #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _write)\n", \ __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ fprintf(stderr, "Missing: %s\n", #name "_write") void test_atomic_write(void) { AO_t x; unsigned char b; unsigned short s; unsigned int zz; # if defined(AO_HAVE_test_and_set_write) AO_TS_t z = AO_TS_INITIALIZER; # endif # if defined(AO_HAVE_double_t) AO_double_t w; w.AO_val1 = 0; w.AO_val2 = 0; # endif # if defined(AO_HAVE_nop_write) AO_nop_write(); # else MISSING(AO_nop); # endif # if defined(AO_HAVE_store_write) AO_store_write(&x, 13); TA_assert (x == 13); # else MISSING(AO_store); x = 13; # endif # if defined(AO_HAVE_load_write) TA_assert(AO_load_write(&x) == 13); # else MISSING(AO_load); # endif # if defined(AO_HAVE_test_and_set_write) assert(AO_test_and_set_write(&z) == AO_TS_CLEAR); assert(AO_test_and_set_write(&z) == AO_TS_SET); assert(AO_test_and_set_write(&z) == AO_TS_SET); AO_CLEAR(&z); # else MISSING(AO_test_and_set); # endif # if defined(AO_HAVE_fetch_and_add_write) TA_assert(AO_fetch_and_add_write(&x, 42) == 13); TA_assert(AO_fetch_and_add_write(&x, -42) == 55); # else MISSING(AO_fetch_and_add); # endif # if defined(AO_HAVE_fetch_and_add1_write) TA_assert(AO_fetch_and_add1_write(&x) == 13); # else MISSING(AO_fetch_and_add1); ++x; # endif # if defined(AO_HAVE_fetch_and_sub1_write) TA_assert(AO_fetch_and_sub1_write(&x) == 14); # else MISSING(AO_fetch_and_sub1); --x; # endif # if defined(AO_HAVE_short_store_write) AO_short_store_write(&s, 13); # else MISSING(AO_short_store); s = 13; # endif # if defined(AO_HAVE_short_load_write) TA_assert(AO_short_load(&s) == 13); # else MISSING(AO_short_load); # endif # if defined(AO_HAVE_short_fetch_and_add_write) TA_assert(AO_short_fetch_and_add_write(&s, 42) == 13); TA_assert(AO_short_fetch_and_add_write(&s, -42) == 55); # else MISSING(AO_short_fetch_and_add); # endif # if defined(AO_HAVE_short_fetch_and_add1_write) TA_assert(AO_short_fetch_and_add1_write(&s) == 13); # else MISSING(AO_short_fetch_and_add1); ++s; # endif # if defined(AO_HAVE_short_fetch_and_sub1_write) TA_assert(AO_short_fetch_and_sub1_write(&s) == 14); # else MISSING(AO_short_fetch_and_sub1); --s; # endif # if defined(AO_HAVE_char_store_write) AO_char_store_write(&b, 13); # else MISSING(AO_char_store); b = 13; # endif # if defined(AO_HAVE_char_load_write) TA_assert(AO_char_load(&b) == 13); # else MISSING(AO_char_load); # endif # if defined(AO_HAVE_char_fetch_and_add_write) TA_assert(AO_char_fetch_and_add_write(&b, 42) == 13); TA_assert(AO_char_fetch_and_add_write(&b, -42) == 55); # else MISSING(AO_char_fetch_and_add); # endif # if defined(AO_HAVE_char_fetch_and_add1_write) TA_assert(AO_char_fetch_and_add1_write(&b) == 13); # else MISSING(AO_char_fetch_and_add1); ++b; # endif # if defined(AO_HAVE_char_fetch_and_sub1_write) TA_assert(AO_char_fetch_and_sub1_write(&b) == 14); # else MISSING(AO_char_fetch_and_sub1); --b; # endif # if defined(AO_HAVE_int_store_write) AO_int_store_write(&zz, 13); # else MISSING(AO_int_store); zz = 13; # endif # if defined(AO_HAVE_int_load_write) TA_assert(AO_int_load(&zz) == 13); # else MISSING(AO_int_load); # endif # if defined(AO_HAVE_int_fetch_and_add_write) TA_assert(AO_int_fetch_and_add_write(&zz, 42) == 13); TA_assert(AO_int_fetch_and_add_write(&zz, -42) == 55); # else MISSING(AO_int_fetch_and_add); # endif # if defined(AO_HAVE_int_fetch_and_add1_write) TA_assert(AO_int_fetch_and_add1_write(&zz) == 13); # else MISSING(AO_int_fetch_and_add1); ++zz; # endif # if defined(AO_HAVE_int_fetch_and_sub1_write) TA_assert(AO_int_fetch_and_sub1_write(&zz) == 14); # else MISSING(AO_int_fetch_and_sub1); --zz; # endif # if defined(AO_HAVE_compare_and_swap_write) TA_assert(!AO_compare_and_swap_write(&x, 14, 42)); TA_assert(x == 13); TA_assert(AO_compare_and_swap_write(&x, 13, 42)); TA_assert(x == 42); # else MISSING(AO_compare_and_swap); # endif # if defined(AO_HAVE_or_write) AO_or_write(&x, 66); TA_assert(x == 106); # else MISSING(AO_or); x |= 34; # endif # if defined(AO_HAVE_compare_double_and_swap_double_write) TA_assert(!AO_compare_double_and_swap_double_write(&w, 17, 42, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_double_and_swap_double_write(&w, 0, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_double_and_swap_double_write(&w, 12, 13, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); w.AO_val1 = 0; w.AO_val2 = 0; # else MISSING(AO_compare_double_and_swap_double); # endif # if defined(AO_HAVE_compare_and_swap_double_write) TA_assert(!AO_compare_and_swap_double_write(&w, 17, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_and_swap_double_write(&w, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_and_swap_double_write(&w, 12, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); # else MISSING(AO_compare_and_swap_double); # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* Some basic sanity tests. These do not test the barrier semantics. */ #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _full)\n", \ __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ fprintf(stderr, "Missing: %s\n", #name "_full") void test_atomic_full(void) { AO_t x; unsigned char b; unsigned short s; unsigned int zz; # if defined(AO_HAVE_test_and_set_full) AO_TS_t z = AO_TS_INITIALIZER; # endif # if defined(AO_HAVE_double_t) AO_double_t w; w.AO_val1 = 0; w.AO_val2 = 0; # endif # if defined(AO_HAVE_nop_full) AO_nop_full(); # else MISSING(AO_nop); # endif # if defined(AO_HAVE_store_full) AO_store_full(&x, 13); TA_assert (x == 13); # else MISSING(AO_store); x = 13; # endif # if defined(AO_HAVE_load_full) TA_assert(AO_load_full(&x) == 13); # else MISSING(AO_load); # endif # if defined(AO_HAVE_test_and_set_full) assert(AO_test_and_set_full(&z) == AO_TS_CLEAR); assert(AO_test_and_set_full(&z) == AO_TS_SET); assert(AO_test_and_set_full(&z) == AO_TS_SET); AO_CLEAR(&z); # else MISSING(AO_test_and_set); # endif # if defined(AO_HAVE_fetch_and_add_full) TA_assert(AO_fetch_and_add_full(&x, 42) == 13); TA_assert(AO_fetch_and_add_full(&x, -42) == 55); # else MISSING(AO_fetch_and_add); # endif # if defined(AO_HAVE_fetch_and_add1_full) TA_assert(AO_fetch_and_add1_full(&x) == 13); # else MISSING(AO_fetch_and_add1); ++x; # endif # if defined(AO_HAVE_fetch_and_sub1_full) TA_assert(AO_fetch_and_sub1_full(&x) == 14); # else MISSING(AO_fetch_and_sub1); --x; # endif # if defined(AO_HAVE_short_store_full) AO_short_store_full(&s, 13); # else MISSING(AO_short_store); s = 13; # endif # if defined(AO_HAVE_short_load_full) TA_assert(AO_short_load(&s) == 13); # else MISSING(AO_short_load); # endif # if defined(AO_HAVE_short_fetch_and_add_full) TA_assert(AO_short_fetch_and_add_full(&s, 42) == 13); TA_assert(AO_short_fetch_and_add_full(&s, -42) == 55); # else MISSING(AO_short_fetch_and_add); # endif # if defined(AO_HAVE_short_fetch_and_add1_full) TA_assert(AO_short_fetch_and_add1_full(&s) == 13); # else MISSING(AO_short_fetch_and_add1); ++s; # endif # if defined(AO_HAVE_short_fetch_and_sub1_full) TA_assert(AO_short_fetch_and_sub1_full(&s) == 14); # else MISSING(AO_short_fetch_and_sub1); --s; # endif # if defined(AO_HAVE_char_store_full) AO_char_store_full(&b, 13); # else MISSING(AO_char_store); b = 13; # endif # if defined(AO_HAVE_char_load_full) TA_assert(AO_char_load(&b) == 13); # else MISSING(AO_char_load); # endif # if defined(AO_HAVE_char_fetch_and_add_full) TA_assert(AO_char_fetch_and_add_full(&b, 42) == 13); TA_assert(AO_char_fetch_and_add_full(&b, -42) == 55); # else MISSING(AO_char_fetch_and_add); # endif # if defined(AO_HAVE_char_fetch_and_add1_full) TA_assert(AO_char_fetch_and_add1_full(&b) == 13); # else MISSING(AO_char_fetch_and_add1); ++b; # endif # if defined(AO_HAVE_char_fetch_and_sub1_full) TA_assert(AO_char_fetch_and_sub1_full(&b) == 14); # else MISSING(AO_char_fetch_and_sub1); --b; # endif # if defined(AO_HAVE_int_store_full) AO_int_store_full(&zz, 13); # else MISSING(AO_int_store); zz = 13; # endif # if defined(AO_HAVE_int_load_full) TA_assert(AO_int_load(&zz) == 13); # else MISSING(AO_int_load); # endif # if defined(AO_HAVE_int_fetch_and_add_full) TA_assert(AO_int_fetch_and_add_full(&zz, 42) == 13); TA_assert(AO_int_fetch_and_add_full(&zz, -42) == 55); # else MISSING(AO_int_fetch_and_add); # endif # if defined(AO_HAVE_int_fetch_and_add1_full) TA_assert(AO_int_fetch_and_add1_full(&zz) == 13); # else MISSING(AO_int_fetch_and_add1); ++zz; # endif # if defined(AO_HAVE_int_fetch_and_sub1_full) TA_assert(AO_int_fetch_and_sub1_full(&zz) == 14); # else MISSING(AO_int_fetch_and_sub1); --zz; # endif # if defined(AO_HAVE_compare_and_swap_full) TA_assert(!AO_compare_and_swap_full(&x, 14, 42)); TA_assert(x == 13); TA_assert(AO_compare_and_swap_full(&x, 13, 42)); TA_assert(x == 42); # else MISSING(AO_compare_and_swap); # endif # if defined(AO_HAVE_or_full) AO_or_full(&x, 66); TA_assert(x == 106); # else MISSING(AO_or); x |= 34; # endif # if defined(AO_HAVE_compare_double_and_swap_double_full) TA_assert(!AO_compare_double_and_swap_double_full(&w, 17, 42, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_double_and_swap_double_full(&w, 0, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_double_and_swap_double_full(&w, 12, 13, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); w.AO_val1 = 0; w.AO_val2 = 0; # else MISSING(AO_compare_double_and_swap_double); # endif # if defined(AO_HAVE_compare_and_swap_double_full) TA_assert(!AO_compare_and_swap_double_full(&w, 17, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_and_swap_double_full(&w, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_and_swap_double_full(&w, 12, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); # else MISSING(AO_compare_and_swap_double); # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* Some basic sanity tests. These do not test the barrier semantics. */ #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _release_write)\n", \ __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ fprintf(stderr, "Missing: %s\n", #name "_release_write") void test_atomic_release_write(void) { AO_t x; unsigned char b; unsigned short s; unsigned int zz; # if defined(AO_HAVE_test_and_set_release_write) AO_TS_t z = AO_TS_INITIALIZER; # endif # if defined(AO_HAVE_double_t) AO_double_t w; w.AO_val1 = 0; w.AO_val2 = 0; # endif # if defined(AO_HAVE_nop_release_write) AO_nop_release_write(); # else MISSING(AO_nop); # endif # if defined(AO_HAVE_store_release_write) AO_store_release_write(&x, 13); TA_assert (x == 13); # else MISSING(AO_store); x = 13; # endif # if defined(AO_HAVE_load_release_write) TA_assert(AO_load_release_write(&x) == 13); # else MISSING(AO_load); # endif # if defined(AO_HAVE_test_and_set_release_write) assert(AO_test_and_set_release_write(&z) == AO_TS_CLEAR); assert(AO_test_and_set_release_write(&z) == AO_TS_SET); assert(AO_test_and_set_release_write(&z) == AO_TS_SET); AO_CLEAR(&z); # else MISSING(AO_test_and_set); # endif # if defined(AO_HAVE_fetch_and_add_release_write) TA_assert(AO_fetch_and_add_release_write(&x, 42) == 13); TA_assert(AO_fetch_and_add_release_write(&x, -42) == 55); # else MISSING(AO_fetch_and_add); # endif # if defined(AO_HAVE_fetch_and_add1_release_write) TA_assert(AO_fetch_and_add1_release_write(&x) == 13); # else MISSING(AO_fetch_and_add1); ++x; # endif # if defined(AO_HAVE_fetch_and_sub1_release_write) TA_assert(AO_fetch_and_sub1_release_write(&x) == 14); # else MISSING(AO_fetch_and_sub1); --x; # endif # if defined(AO_HAVE_short_store_release_write) AO_short_store_release_write(&s, 13); # else MISSING(AO_short_store); s = 13; # endif # if defined(AO_HAVE_short_load_release_write) TA_assert(AO_short_load(&s) == 13); # else MISSING(AO_short_load); # endif # if defined(AO_HAVE_short_fetch_and_add_release_write) TA_assert(AO_short_fetch_and_add_release_write(&s, 42) == 13); TA_assert(AO_short_fetch_and_add_release_write(&s, -42) == 55); # else MISSING(AO_short_fetch_and_add); # endif # if defined(AO_HAVE_short_fetch_and_add1_release_write) TA_assert(AO_short_fetch_and_add1_release_write(&s) == 13); # else MISSING(AO_short_fetch_and_add1); ++s; # endif # if defined(AO_HAVE_short_fetch_and_sub1_release_write) TA_assert(AO_short_fetch_and_sub1_release_write(&s) == 14); # else MISSING(AO_short_fetch_and_sub1); --s; # endif # if defined(AO_HAVE_char_store_release_write) AO_char_store_release_write(&b, 13); # else MISSING(AO_char_store); b = 13; # endif # if defined(AO_HAVE_char_load_release_write) TA_assert(AO_char_load(&b) == 13); # else MISSING(AO_char_load); # endif # if defined(AO_HAVE_char_fetch_and_add_release_write) TA_assert(AO_char_fetch_and_add_release_write(&b, 42) == 13); TA_assert(AO_char_fetch_and_add_release_write(&b, -42) == 55); # else MISSING(AO_char_fetch_and_add); # endif # if defined(AO_HAVE_char_fetch_and_add1_release_write) TA_assert(AO_char_fetch_and_add1_release_write(&b) == 13); # else MISSING(AO_char_fetch_and_add1); ++b; # endif # if defined(AO_HAVE_char_fetch_and_sub1_release_write) TA_assert(AO_char_fetch_and_sub1_release_write(&b) == 14); # else MISSING(AO_char_fetch_and_sub1); --b; # endif # if defined(AO_HAVE_int_store_release_write) AO_int_store_release_write(&zz, 13); # else MISSING(AO_int_store); zz = 13; # endif # if defined(AO_HAVE_int_load_release_write) TA_assert(AO_int_load(&zz) == 13); # else MISSING(AO_int_load); # endif # if defined(AO_HAVE_int_fetch_and_add_release_write) TA_assert(AO_int_fetch_and_add_release_write(&zz, 42) == 13); TA_assert(AO_int_fetch_and_add_release_write(&zz, -42) == 55); # else MISSING(AO_int_fetch_and_add); # endif # if defined(AO_HAVE_int_fetch_and_add1_release_write) TA_assert(AO_int_fetch_and_add1_release_write(&zz) == 13); # else MISSING(AO_int_fetch_and_add1); ++zz; # endif # if defined(AO_HAVE_int_fetch_and_sub1_release_write) TA_assert(AO_int_fetch_and_sub1_release_write(&zz) == 14); # else MISSING(AO_int_fetch_and_sub1); --zz; # endif # if defined(AO_HAVE_compare_and_swap_release_write) TA_assert(!AO_compare_and_swap_release_write(&x, 14, 42)); TA_assert(x == 13); TA_assert(AO_compare_and_swap_release_write(&x, 13, 42)); TA_assert(x == 42); # else MISSING(AO_compare_and_swap); # endif # if defined(AO_HAVE_or_release_write) AO_or_release_write(&x, 66); TA_assert(x == 106); # else MISSING(AO_or); x |= 34; # endif # if defined(AO_HAVE_compare_double_and_swap_double_release_write) TA_assert(!AO_compare_double_and_swap_double_release_write(&w, 17, 42, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_double_and_swap_double_release_write(&w, 0, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_double_and_swap_double_release_write(&w, 12, 13, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); w.AO_val1 = 0; w.AO_val2 = 0; # else MISSING(AO_compare_double_and_swap_double); # endif # if defined(AO_HAVE_compare_and_swap_double_release_write) TA_assert(!AO_compare_and_swap_double_release_write(&w, 17, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_and_swap_double_release_write(&w, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_and_swap_double_release_write(&w, 12, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); # else MISSING(AO_compare_and_swap_double); # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* Some basic sanity tests. These do not test the barrier semantics. */ #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _acquire_read)\n", \ __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ fprintf(stderr, "Missing: %s\n", #name "_acquire_read") void test_atomic_acquire_read(void) { AO_t x; unsigned char b; unsigned short s; unsigned int zz; # if defined(AO_HAVE_test_and_set_acquire_read) AO_TS_t z = AO_TS_INITIALIZER; # endif # if defined(AO_HAVE_double_t) AO_double_t w; w.AO_val1 = 0; w.AO_val2 = 0; # endif # if defined(AO_HAVE_nop_acquire_read) AO_nop_acquire_read(); # else MISSING(AO_nop); # endif # if defined(AO_HAVE_store_acquire_read) AO_store_acquire_read(&x, 13); TA_assert (x == 13); # else MISSING(AO_store); x = 13; # endif # if defined(AO_HAVE_load_acquire_read) TA_assert(AO_load_acquire_read(&x) == 13); # else MISSING(AO_load); # endif # if defined(AO_HAVE_test_and_set_acquire_read) assert(AO_test_and_set_acquire_read(&z) == AO_TS_CLEAR); assert(AO_test_and_set_acquire_read(&z) == AO_TS_SET); assert(AO_test_and_set_acquire_read(&z) == AO_TS_SET); AO_CLEAR(&z); # else MISSING(AO_test_and_set); # endif # if defined(AO_HAVE_fetch_and_add_acquire_read) TA_assert(AO_fetch_and_add_acquire_read(&x, 42) == 13); TA_assert(AO_fetch_and_add_acquire_read(&x, -42) == 55); # else MISSING(AO_fetch_and_add); # endif # if defined(AO_HAVE_fetch_and_add1_acquire_read) TA_assert(AO_fetch_and_add1_acquire_read(&x) == 13); # else MISSING(AO_fetch_and_add1); ++x; # endif # if defined(AO_HAVE_fetch_and_sub1_acquire_read) TA_assert(AO_fetch_and_sub1_acquire_read(&x) == 14); # else MISSING(AO_fetch_and_sub1); --x; # endif # if defined(AO_HAVE_short_store_acquire_read) AO_short_store_acquire_read(&s, 13); # else MISSING(AO_short_store); s = 13; # endif # if defined(AO_HAVE_short_load_acquire_read) TA_assert(AO_short_load(&s) == 13); # else MISSING(AO_short_load); # endif # if defined(AO_HAVE_short_fetch_and_add_acquire_read) TA_assert(AO_short_fetch_and_add_acquire_read(&s, 42) == 13); TA_assert(AO_short_fetch_and_add_acquire_read(&s, -42) == 55); # else MISSING(AO_short_fetch_and_add); # endif # if defined(AO_HAVE_short_fetch_and_add1_acquire_read) TA_assert(AO_short_fetch_and_add1_acquire_read(&s) == 13); # else MISSING(AO_short_fetch_and_add1); ++s; # endif # if defined(AO_HAVE_short_fetch_and_sub1_acquire_read) TA_assert(AO_short_fetch_and_sub1_acquire_read(&s) == 14); # else MISSING(AO_short_fetch_and_sub1); --s; # endif # if defined(AO_HAVE_char_store_acquire_read) AO_char_store_acquire_read(&b, 13); # else MISSING(AO_char_store); b = 13; # endif # if defined(AO_HAVE_char_load_acquire_read) TA_assert(AO_char_load(&b) == 13); # else MISSING(AO_char_load); # endif # if defined(AO_HAVE_char_fetch_and_add_acquire_read) TA_assert(AO_char_fetch_and_add_acquire_read(&b, 42) == 13); TA_assert(AO_char_fetch_and_add_acquire_read(&b, -42) == 55); # else MISSING(AO_char_fetch_and_add); # endif # if defined(AO_HAVE_char_fetch_and_add1_acquire_read) TA_assert(AO_char_fetch_and_add1_acquire_read(&b) == 13); # else MISSING(AO_char_fetch_and_add1); ++b; # endif # if defined(AO_HAVE_char_fetch_and_sub1_acquire_read) TA_assert(AO_char_fetch_and_sub1_acquire_read(&b) == 14); # else MISSING(AO_char_fetch_and_sub1); --b; # endif # if defined(AO_HAVE_int_store_acquire_read) AO_int_store_acquire_read(&zz, 13); # else MISSING(AO_int_store); zz = 13; # endif # if defined(AO_HAVE_int_load_acquire_read) TA_assert(AO_int_load(&zz) == 13); # else MISSING(AO_int_load); # endif # if defined(AO_HAVE_int_fetch_and_add_acquire_read) TA_assert(AO_int_fetch_and_add_acquire_read(&zz, 42) == 13); TA_assert(AO_int_fetch_and_add_acquire_read(&zz, -42) == 55); # else MISSING(AO_int_fetch_and_add); # endif # if defined(AO_HAVE_int_fetch_and_add1_acquire_read) TA_assert(AO_int_fetch_and_add1_acquire_read(&zz) == 13); # else MISSING(AO_int_fetch_and_add1); ++zz; # endif # if defined(AO_HAVE_int_fetch_and_sub1_acquire_read) TA_assert(AO_int_fetch_and_sub1_acquire_read(&zz) == 14); # else MISSING(AO_int_fetch_and_sub1); --zz; # endif # if defined(AO_HAVE_compare_and_swap_acquire_read) TA_assert(!AO_compare_and_swap_acquire_read(&x, 14, 42)); TA_assert(x == 13); TA_assert(AO_compare_and_swap_acquire_read(&x, 13, 42)); TA_assert(x == 42); # else MISSING(AO_compare_and_swap); # endif # if defined(AO_HAVE_or_acquire_read) AO_or_acquire_read(&x, 66); TA_assert(x == 106); # else MISSING(AO_or); x |= 34; # endif # if defined(AO_HAVE_compare_double_and_swap_double_acquire_read) TA_assert(!AO_compare_double_and_swap_double_acquire_read(&w, 17, 42, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_double_and_swap_double_acquire_read(&w, 0, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_double_and_swap_double_acquire_read(&w, 12, 13, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); w.AO_val1 = 0; w.AO_val2 = 0; # else MISSING(AO_compare_double_and_swap_double); # endif # if defined(AO_HAVE_compare_and_swap_double_acquire_read) TA_assert(!AO_compare_and_swap_double_acquire_read(&w, 17, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_and_swap_double_acquire_read(&w, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_and_swap_double_acquire_read(&w, 12, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); # else MISSING(AO_compare_and_swap_double); # endif } synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/tests/test_atomic.template0000664000076400007640000001237611104702320026221 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* Some basic sanity tests. These do not test the barrier semantics. */ #undef TA_assert #define TA_assert(e) \ if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: XX)\n", \ __FILE__, __LINE__), exit(1); } #undef MISSING #define MISSING(name) \ fprintf(stderr, "Missing: %s\n", #name "XX") void test_atomicXX(void) { AO_t x; unsigned char b; unsigned short s; unsigned int zz; # if defined(AO_HAVE_test_and_setXX) AO_TS_t z = AO_TS_INITIALIZER; # endif # if defined(AO_HAVE_double_t) AO_double_t w; w.AO_val1 = 0; w.AO_val2 = 0; # endif # if defined(AO_HAVE_nopXX) AO_nopXX(); # else MISSING(AO_nop); # endif # if defined(AO_HAVE_storeXX) AO_storeXX(&x, 13); TA_assert (x == 13); # else MISSING(AO_store); x = 13; # endif # if defined(AO_HAVE_loadXX) TA_assert(AO_loadXX(&x) == 13); # else MISSING(AO_load); # endif # if defined(AO_HAVE_test_and_setXX) assert(AO_test_and_setXX(&z) == AO_TS_CLEAR); assert(AO_test_and_setXX(&z) == AO_TS_SET); assert(AO_test_and_setXX(&z) == AO_TS_SET); AO_CLEAR(&z); # else MISSING(AO_test_and_set); # endif # if defined(AO_HAVE_fetch_and_addXX) TA_assert(AO_fetch_and_addXX(&x, 42) == 13); TA_assert(AO_fetch_and_addXX(&x, -42) == 55); # else MISSING(AO_fetch_and_add); # endif # if defined(AO_HAVE_fetch_and_add1XX) TA_assert(AO_fetch_and_add1XX(&x) == 13); # else MISSING(AO_fetch_and_add1); ++x; # endif # if defined(AO_HAVE_fetch_and_sub1XX) TA_assert(AO_fetch_and_sub1XX(&x) == 14); # else MISSING(AO_fetch_and_sub1); --x; # endif # if defined(AO_HAVE_short_storeXX) AO_short_storeXX(&s, 13); # else MISSING(AO_short_store); s = 13; # endif # if defined(AO_HAVE_short_loadXX) TA_assert(AO_short_load(&s) == 13); # else MISSING(AO_short_load); # endif # if defined(AO_HAVE_short_fetch_and_addXX) TA_assert(AO_short_fetch_and_addXX(&s, 42) == 13); TA_assert(AO_short_fetch_and_addXX(&s, -42) == 55); # else MISSING(AO_short_fetch_and_add); # endif # if defined(AO_HAVE_short_fetch_and_add1XX) TA_assert(AO_short_fetch_and_add1XX(&s) == 13); # else MISSING(AO_short_fetch_and_add1); ++s; # endif # if defined(AO_HAVE_short_fetch_and_sub1XX) TA_assert(AO_short_fetch_and_sub1XX(&s) == 14); # else MISSING(AO_short_fetch_and_sub1); --s; # endif # if defined(AO_HAVE_char_storeXX) AO_char_storeXX(&b, 13); # else MISSING(AO_char_store); b = 13; # endif # if defined(AO_HAVE_char_loadXX) TA_assert(AO_char_load(&b) == 13); # else MISSING(AO_char_load); # endif # if defined(AO_HAVE_char_fetch_and_addXX) TA_assert(AO_char_fetch_and_addXX(&b, 42) == 13); TA_assert(AO_char_fetch_and_addXX(&b, -42) == 55); # else MISSING(AO_char_fetch_and_add); # endif # if defined(AO_HAVE_char_fetch_and_add1XX) TA_assert(AO_char_fetch_and_add1XX(&b) == 13); # else MISSING(AO_char_fetch_and_add1); ++b; # endif # if defined(AO_HAVE_char_fetch_and_sub1XX) TA_assert(AO_char_fetch_and_sub1XX(&b) == 14); # else MISSING(AO_char_fetch_and_sub1); --b; # endif # if defined(AO_HAVE_int_storeXX) AO_int_storeXX(&zz, 13); # else MISSING(AO_int_store); zz = 13; # endif # if defined(AO_HAVE_int_loadXX) TA_assert(AO_int_load(&zz) == 13); # else MISSING(AO_int_load); # endif # if defined(AO_HAVE_int_fetch_and_addXX) TA_assert(AO_int_fetch_and_addXX(&zz, 42) == 13); TA_assert(AO_int_fetch_and_addXX(&zz, -42) == 55); # else MISSING(AO_int_fetch_and_add); # endif # if defined(AO_HAVE_int_fetch_and_add1XX) TA_assert(AO_int_fetch_and_add1XX(&zz) == 13); # else MISSING(AO_int_fetch_and_add1); ++zz; # endif # if defined(AO_HAVE_int_fetch_and_sub1XX) TA_assert(AO_int_fetch_and_sub1XX(&zz) == 14); # else MISSING(AO_int_fetch_and_sub1); --zz; # endif # if defined(AO_HAVE_compare_and_swapXX) TA_assert(!AO_compare_and_swapXX(&x, 14, 42)); TA_assert(x == 13); TA_assert(AO_compare_and_swapXX(&x, 13, 42)); TA_assert(x == 42); # else MISSING(AO_compare_and_swap); # endif # if defined(AO_HAVE_orXX) AO_orXX(&x, 66); TA_assert(x == 106); # else MISSING(AO_or); x |= 34; # endif # if defined(AO_HAVE_compare_double_and_swap_doubleXX) TA_assert(!AO_compare_double_and_swap_doubleXX(&w, 17, 42, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_double_and_swap_doubleXX(&w, 0, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_double_and_swap_doubleXX(&w, 12, 13, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); w.AO_val1 = 0; w.AO_val2 = 0; # else MISSING(AO_compare_double_and_swap_double); # endif # if defined(AO_HAVE_compare_and_swap_doubleXX) TA_assert(!AO_compare_and_swap_doubleXX(&w, 17, 12, 13)); TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); TA_assert(AO_compare_and_swap_doubleXX(&w, 0, 12, 13)); TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); TA_assert(AO_compare_and_swap_doubleXX(&w, 12, 17, 42)); TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); # else MISSING(AO_compare_and_swap_double); # endif } synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/tests/list_atomic.template0000664000076400007640000000312511104702320026205 0ustar stefanstefan/* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* This generates a compilable program. But it is really meant to be */ /* be used only with cc -E, to inspect the expensions generated by */ /* primitives. */ /* The result will not link or run. */ void list_atomicXX(void) { AO_T *addr, val, newval, oldval; AO_TS_T tsaddr; long incr; # if defined(AO_HAVE_nopXX) "AO_nopXX(): "; AO_nopXX(); # else "No AO_nopXX"; # endif # if defined(AO_HAVE_loadXX) "AO_loadXX(addr):"; AO_loadXX(addr); # else "No AO_loadXX"; # endif # if defined(AO_HAVE_storeXX) "AO_storeXX(addr, val):"; AO_storeXX(addr, val); # else "No AO_storeXX"; # endif # if defined(AO_HAVE_test_and_setXX) "AO_test_and_setXX(tsaddr):"; AO_test_and_setXX(tsaddr); # else "No AO_test_and_setXX"; # endif # if defined(AO_HAVE_fetch_and_add1XX) "AO_fetch_and_add1XX(addr):"; AO_fetch_and_add1XX(addr); # else "No AO_fetch_and_add1XX"; # endif # if defined(AO_HAVE_fetch_and_sub1XX) "AO_fetch_and_sub1XX(addr):"; AO_fetch_and_sub1XX(addr); # else "No AO_fetch_and_sub1XX"; # endif # if defined(AO_HAVE_fetch_and_addXX) "AO_fetch_and_addXX(addr, incr):"; AO_fetch_and_addXX(addr, incr); # else "No AO_fetch_and_addXX"; # endif # if defined(AO_HAVE_compare_and_swapXX) "AO_compare_and_swapXX(addr, oldval, newval):"; AO_compare_and_swapXX(addr, oldval, newval); # else "No AO_compare_and_swapXX"; # endif } synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/tests/test_atomic.c0000664000076400007640000001073211104702320024622 0ustar stefanstefan/* * Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P. * Original Author: Hans Boehm * * This file may be redistributed and/or modified 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. * * It is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License in the * file doc/COPYING for more details. */ #if defined(HAVE_CONFIG_H) # include "config.h" #endif #include "run_parallel.inc" #include "test_atomic_include.h" #ifdef AO_USE_PTHREAD_DEFS # define NITERS 100000 #else # define NITERS 10000000 #endif void * add1sub1_thr(void * id); int add1sub1_test(void); void * acqrel_thr(void *id); int acqrel_test(void); void * test_and_set_thr(void * id); int test_and_set_test(void); #if defined(AO_HAVE_fetch_and_add1) && defined(AO_HAVE_fetch_and_sub1) AO_t counter = 0; void * add1sub1_thr(void * id) { int me = (int)(long)id; int i; for (i = 0; i < NITERS; ++i) if (me & 1) AO_fetch_and_sub1(&counter); else AO_fetch_and_add1(&counter); return 0; } int add1sub1_test(void) { return counter == 0; } #endif /* defined(AO_HAVE_fetch_and_add1) && defined(AO_HAVE_fetch_and_sub1) */ #if defined(AO_HAVE_store_release_write) && defined(AO_HAVE_load_acquire_read) /* Invariant: counter1 >= counter2 */ AO_t counter1 = 0; AO_t counter2 = 0; void * acqrel_thr(void *id) { int me = (int)(long)id; int i; for (i = 0; i < NITERS; ++i) if (me & 1) { AO_t my_counter1; if (me != 1) fprintf(stderr, "acqrel test: too many threads\n"); my_counter1 = AO_load(&counter1); AO_store(&counter1, my_counter1 + 1); AO_store_release_write(&counter2, my_counter1 + 1); } else { AO_t my_counter1a, my_counter2a; AO_t my_counter1b, my_counter2b; my_counter2a = AO_load_acquire_read(&counter2); my_counter1a = AO_load(&counter1); /* Redo this, to make sure that the second load of counter1 */ /* is not viewed as a common subexpression. */ my_counter2b = AO_load_acquire_read(&counter2); my_counter1b = AO_load(&counter1); if (my_counter1a < my_counter2a) { fprintf(stderr, "Saw release store out of order: %lu < %lu\n", (unsigned long)my_counter1a, (unsigned long)my_counter2a); abort(); } if (my_counter1b < my_counter2b) { fprintf(stderr, "Saw release store out of order (bad CSE?): %lu < %lu\n", (unsigned long)my_counter1b, (unsigned long)my_counter2b); abort(); } } return 0; } int acqrel_test(void) { return counter1 == NITERS && counter2 == NITERS; } #endif /* AO_HAVE_store_release_write && AO_HAVE_load_acquire_read */ #if defined(AO_HAVE_test_and_set_acquire) AO_TS_T lock = AO_TS_INITIALIZER; unsigned long locked_counter; volatile unsigned long junk = 13; void * test_and_set_thr(void * id) { unsigned long i; for (i = 0; i < NITERS/10; ++i) { while (AO_test_and_set_acquire(&lock) != AO_TS_CLEAR); ++locked_counter; if (locked_counter != 1) { fprintf(stderr, "Test and set failure 1, counter = %ld\n", locked_counter); abort(); } locked_counter *= 2; locked_counter -= 1; locked_counter *= 5; locked_counter -= 4; if (locked_counter != 1) { fprintf(stderr, "Test and set failure 2, counter = %ld\n", locked_counter); abort(); } --locked_counter; AO_CLEAR(&lock); /* Spend a bit of time outside the lock. */ junk *= 17; junk *= 17; } return 0; } int test_and_set_test(void) { return locked_counter == 0; } #endif /* defined(AO_HAVE_test_and_set_acquire) */ int main() { test_atomic(); test_atomic_acquire(); test_atomic_release(); test_atomic_read(); test_atomic_write(); test_atomic_full(); test_atomic_release_write(); test_atomic_acquire_read(); # if defined(AO_HAVE_fetch_and_add1) && defined(AO_HAVE_fetch_and_sub1) run_parallel(4, add1sub1_thr, add1sub1_test, "add1/sub1"); # endif # if defined(AO_HAVE_store_release_write) && defined(AO_HAVE_load_acquire_read) run_parallel(3, acqrel_thr, acqrel_test, "store_release_write/load_acquire_read"); # endif # if defined(AO_HAVE_test_and_set_acquire) run_parallel(5, test_and_set_thr, test_and_set_test, "test_and_set"); # endif return 0; } synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/tests/test_malloc.c0000664000076400007640000001001111104702320024603 0ustar stefanstefan/* * Copyright (c) 2005 Hewlett-Packard Development Company, L.P. * Original Author: Hans Boehm * * This file may be redistributed and/or modified 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. * * It is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License in the * file doc/COPYING for more details. */ #if defined(HAVE_CONFIG_H) # include "config.h" #endif #include "run_parallel.inc" #include #include #include "atomic_ops_malloc.h" #define MAX_NTHREADS 100 #define N_REVERSALS 1000 /* must be even */ #define LENGTH 1000 #ifdef USE_STANDARD_MALLOC # define AO_malloc(n) malloc(n) # define AO_free(p) free(p) # define AO_malloc_enable_mmap() #endif typedef struct list_node { struct list_node *next; int data; } ln; ln *cons(int d, ln *tail) { static size_t extra = 0; size_t my_extra = extra; ln *result; int * extras; int i; if (my_extra > 100) extra = my_extra = 0; else ++extra; result = AO_malloc(sizeof(ln) + sizeof(int)*my_extra); if (result == 0) { fprintf(stderr, "Out of memory\n"); /* Normal for more than about 10 threads without mmap? */ abort(); } result -> data = d; result -> next = tail; extras = (int *)(result+1); for (i = 0; i < my_extra; ++i) extras[i] = 42; return result; } void print_list(ln *l) { ln *p; for (p = l; p != 0; p = p -> next) { fprintf(stderr, "%d, ", p -> data); } fprintf(stderr, "\n"); } /* Check that l contains numbers from m to n inclusive in ascending order */ void check_list(ln *l, int m, int n) { ln *p; int i; for (p = l, i = m; p != 0; p = p -> next, ++i) { if (i != p -> data) { fprintf(stderr, "Found %d, expected %d\n", p -> data, i); abort(); } } } /* Create a list of integers from m to n */ ln * make_list(int m, int n) { if (m > n) return 0; return cons(m, make_list(m+1, n)); } /* Reverse list x, and concatenate it to y, deallocating no longer needed */ /* nodes in x. */ ln * reverse(ln *x, ln *y) { ln * result; if (x == 0) return y; result = reverse(x -> next, cons(x -> data, y)); AO_free(x); return result; } int dummy_test(void) { return 1; } #define LARGE 200000 void * run_one_test(void * arg) { ln * x = make_list(1, LENGTH); int i; char *p = AO_malloc(LARGE); char *q; if (0 == p) { fprintf(stderr, "AO_malloc(%d) failed: This is normal without mmap\n", LARGE); AO_free(p); } else { p[0] = p[LARGE/2] = p[LARGE-1] = 'a'; q = AO_malloc(LARGE); q[0] = q[LARGE/2] = q[LARGE-1] = 'b'; if (p[0] != 'a' || p[LARGE/2] != 'a' || p[LARGE-1] != 'a') { fprintf(stderr, "First large allocation smashed\n"); abort(); } AO_free(p); if (q[0] != 'b' || q[LARGE/2] != 'b' || q[LARGE-1] != 'b') { fprintf(stderr, "Second large allocation smashed\n"); abort(); } AO_free(q); } # if 0 /* enable for debugging */ x = reverse(x, 0); print_list(x); x = reverse(x, 0); print_list(x); # endif for (i = 0; i < N_REVERSALS; ++i) { x = reverse(x, 0); } check_list(x, 1, LENGTH); return 0; } int main(int argc, char **argv) { int nthreads; int exper_n; if (1 == argc) { # if !defined(HAVE_MMAP) nthreads = 3; # else nthreads = 10; # endif } else if (2 == argc) { nthreads = atoi(argv[1]); if (nthreads < 1 || nthreads > MAX_NTHREADS) { fprintf(stderr, "Invalid # of threads argument\n"); exit(1); } } else { fprintf(stderr, "Usage: %s [# of threads]\n", argv[0]); exit(1); } printf("Performing %d reversals of %d element lists in %d threads\n", N_REVERSALS, LENGTH, nthreads); AO_malloc_enable_mmap(); run_parallel(nthreads, run_one_test, dummy_test, "AO_malloc/AO_free"); return 0; } synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/tests/run_parallel.inc0000664000076400007640000001043711104702320025320 0ustar stefanstefan/* * Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ #if defined(_MSC_VER) || \ defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__) || \ defined(_WIN32_WINCE) # define USE_WINTHREADS #elif defined(__vxworks) # define USE_VXTHREADS #else # define USE_PTHREADS #endif #include #include #ifdef USE_PTHREADS # include #endif #ifdef USE_VXTHREADS # include # include #endif #ifdef USE_WINTHREADS # include #endif #include "atomic_ops.h" typedef void * (* thr_func)(void *); typedef int (* test_func)(void); /* Returns != 0 on success */ void * run_parallel(int nthreads, thr_func f1, test_func t, const char *name); #ifdef USE_PTHREADS void * run_parallel(int nthreads, thr_func f1, test_func t, const char *name) { pthread_attr_t attr; pthread_t thr[100]; int i; int code; fprintf(stderr, "Testing %s\n", name); if (nthreads > 100) { fprintf(stderr, "run_parallel: requested too many threads\n"); abort(); } # ifdef _HPUX_SOURCE /* Default stack size is too small, especially with the 64 bit ABI */ /* Increase it. */ if (pthread_default_stacksize_np(1024*1024, 0) != 0) { fprintf(stderr, "pthread_default_stacksize_np failed. " "OK after first call.\n"); } # endif pthread_attr_init(&attr); for (i = 0; i < nthreads; ++i) { if ((code = pthread_create(thr + i, &attr, f1, (void *)(long)i)) != 0) { perror("Thread creation failed"); fprintf(stderr, "Pthread_create returned %d, thread %d\n", code, i); abort(); } } for (i = 0; i < nthreads; ++i) { if ((code = pthread_join(thr[i], NULL)) != 0) { perror("Thread join failed"); fprintf(stderr, "Pthread_join returned %d, thread %d\n", code, i); abort(); } } if (t()) { fprintf(stderr, "Succeeded\n"); } else { fprintf(stderr, "Failed\n"); abort(); } return 0; } #endif /* USE_PTHREADS */ #ifdef USE_VXTHREADS void * run_parallel(int nthreads, thr_func f1, test_func t, const char *name) { int thr[100]; int i; fprintf(stderr, "Testing %s\n", name); if (nthreads > 100) { fprintf(stderr, "run_parallel: requested too many threads\n"); taskSuspend(0); } for (i = 0; i < nthreads; ++i) { thr[i] = taskSpawn((char*) name, 180, 0, 32768, (FUNCPTR) f1, i, 1, 2, 3, 4, 5, 6, 7, 8, 9); if (thr[i] == ERROR) { fprintf(stderr, "taskSpawn failed with %d, thread %d\n", errno, i); taskSuspend(0); } } for (i = 0; i < nthreads; ++i) { while (taskIdVerify(thr[i]) == OK) taskDelay(60); } if (t()) { fprintf(stderr, "Succeeded\n"); } else { fprintf(stderr, "Failed\n"); taskSuspend(0); } return 0; } #endif /* USE_VXTHREADS */ #ifdef USE_WINTHREADS struct tramp_args { thr_func fn; long arg; }; DWORD WINAPI tramp(LPVOID param) { struct tramp_args *args = (struct tramp_args *)param; return (DWORD)(args -> fn)((LPVOID)(args -> arg)); } void * run_parallel(int nthreads, thr_func f1, test_func t, const char *name) { HANDLE thr[100]; struct tramp_args args[100]; int i; DWORD code; fprintf(stderr, "Testing %s\n", name); if (nthreads > 100) { fprintf(stderr, "run_parallel: requested too many threads\n"); abort(); } for (i = 0; i < nthreads; ++i) { args[i].fn = f1; args[i].arg = i; if ((thr[i] = CreateThread(NULL, 0, tramp, (LPVOID)(args+i), 0, NULL)) == NULL) { perror("Thread creation failed"); fprintf(stderr, "CreateThread failed with %d, thread %d\n", GetLastError(), i); abort(); } } for (i = 0; i < nthreads; ++i) { if ((code = WaitForSingleObject(thr[i], INFINITE)) != WAIT_OBJECT_0) { perror("Thread join failed"); fprintf(stderr, "WaitForSingleObject returned %d, thread %d\n", code, i); abort(); } } if (t()) { fprintf(stderr, "Succeeded\n"); } else { fprintf(stderr, "Failed\n"); abort(); } return 0; } #endif /* USE_WINTHREADS */ synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/tests/Makefile.in0000664000076400007640000004646011104702320024217 0ustar stefanstefan# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 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 = $(test_atomic_SOURCES) $(test_atomic_pthreads_SOURCES) $(test_malloc_SOURCES) $(test_stack_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@ target_triplet = @target@ check_PROGRAMS = test_atomic$(EXEEXT) test_atomic_pthreads$(EXEEXT) \ test_stack$(EXEEXT) test_malloc$(EXEEXT) subdir = tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = am_test_atomic_OBJECTS = test_atomic.$(OBJEXT) test_atomic_OBJECTS = $(am_test_atomic_OBJECTS) test_atomic_DEPENDENCIES = ../src/libatomic_ops.a am_test_atomic_pthreads_OBJECTS = \ test_atomic_pthreads-test_atomic.$(OBJEXT) test_atomic_pthreads_OBJECTS = $(am_test_atomic_pthreads_OBJECTS) test_atomic_pthreads_DEPENDENCIES = ../src/libatomic_ops.a am_test_malloc_OBJECTS = test_malloc.$(OBJEXT) test_malloc_OBJECTS = $(am_test_malloc_OBJECTS) test_malloc_DEPENDENCIES = ../src/libatomic_ops_gpl.a \ ../src/libatomic_ops.a am_test_stack_OBJECTS = test_stack.$(OBJEXT) test_stack_OBJECTS = $(am_test_stack_OBJECTS) test_stack_DEPENDENCIES = ../src/libatomic_ops_gpl.a \ ../src/libatomic_ops.a DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(test_atomic_SOURCES) $(test_atomic_pthreads_SOURCES) \ $(test_malloc_SOURCES) $(test_stack_SOURCES) DIST_SOURCES = $(test_atomic_SOURCES) $(test_atomic_pthreads_SOURCES) \ $(test_malloc_SOURCES) $(test_stack_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ NEED_ASM_FALSE = @NEED_ASM_FALSE@ NEED_ASM_TRUE = @NEED_ASM_TRUE@ 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@ PICFLAG = @PICFLAG@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ 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__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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ EXTRA_DIST = test_atomic.template list_atomic.template run_parallel.inc \ test_atomic_include.h # We distribute test_atomic_include.h, since it's hard to regenerate # on Windows without sed. BUILT_SOURCES = test_atomic_include.h list_atomic.i CLEANFILES = test_atomic_include.h list_atomic.c list_atomic.i AM_CPPFLAGS = -I$(srcdir)/../src TESTS = test_atomic test_atomic_pthreads test_stack test_malloc test_atomic_SOURCES = test_atomic.c test_atomic_LDADD = -lpthread ../src/libatomic_ops.a test_atomic_pthreads_SOURCES = test_atomic.c test_atomic_pthreads_CPPFLAGS = -DAO_USE_PTHREAD_DEFS $(AM_CPPFLAGS) test_atomic_pthreads_LDADD = -lpthread ../src/libatomic_ops.a test_stack_SOURCES = test_stack.c test_stack_LDADD = -lpthread ../src/libatomic_ops_gpl.a ../src/libatomic_ops.a test_malloc_SOURCES = test_malloc.c test_malloc_LDADD = -lpthread ../src/libatomic_ops_gpl.a ../src/libatomic_ops.a all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .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 tests/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-checkPROGRAMS: -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) test_atomic$(EXEEXT): $(test_atomic_OBJECTS) $(test_atomic_DEPENDENCIES) @rm -f test_atomic$(EXEEXT) $(LINK) $(test_atomic_LDFLAGS) $(test_atomic_OBJECTS) $(test_atomic_LDADD) $(LIBS) test_atomic_pthreads$(EXEEXT): $(test_atomic_pthreads_OBJECTS) $(test_atomic_pthreads_DEPENDENCIES) @rm -f test_atomic_pthreads$(EXEEXT) $(LINK) $(test_atomic_pthreads_LDFLAGS) $(test_atomic_pthreads_OBJECTS) $(test_atomic_pthreads_LDADD) $(LIBS) test_malloc$(EXEEXT): $(test_malloc_OBJECTS) $(test_malloc_DEPENDENCIES) @rm -f test_malloc$(EXEEXT) $(LINK) $(test_malloc_LDFLAGS) $(test_malloc_OBJECTS) $(test_malloc_LDADD) $(LIBS) test_stack$(EXEEXT): $(test_stack_OBJECTS) $(test_stack_DEPENDENCIES) @rm -f test_stack$(EXEEXT) $(LINK) $(test_stack_LDFLAGS) $(test_stack_OBJECTS) $(test_stack_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_atomic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_atomic_pthreads-test_atomic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_malloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_stack.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` test_atomic_pthreads-test_atomic.o: test_atomic.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_atomic_pthreads_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_atomic_pthreads-test_atomic.o -MD -MP -MF "$(DEPDIR)/test_atomic_pthreads-test_atomic.Tpo" -c -o test_atomic_pthreads-test_atomic.o `test -f 'test_atomic.c' || echo '$(srcdir)/'`test_atomic.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test_atomic_pthreads-test_atomic.Tpo" "$(DEPDIR)/test_atomic_pthreads-test_atomic.Po"; else rm -f "$(DEPDIR)/test_atomic_pthreads-test_atomic.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_atomic.c' object='test_atomic_pthreads-test_atomic.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_atomic_pthreads_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_atomic_pthreads-test_atomic.o `test -f 'test_atomic.c' || echo '$(srcdir)/'`test_atomic.c test_atomic_pthreads-test_atomic.obj: test_atomic.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_atomic_pthreads_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_atomic_pthreads-test_atomic.obj -MD -MP -MF "$(DEPDIR)/test_atomic_pthreads-test_atomic.Tpo" -c -o test_atomic_pthreads-test_atomic.obj `if test -f 'test_atomic.c'; then $(CYGPATH_W) 'test_atomic.c'; else $(CYGPATH_W) '$(srcdir)/test_atomic.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test_atomic_pthreads-test_atomic.Tpo" "$(DEPDIR)/test_atomic_pthreads-test_atomic.Po"; else rm -f "$(DEPDIR)/test_atomic_pthreads-test_atomic.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_atomic.c' object='test_atomic_pthreads-test_atomic.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_atomic_pthreads_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_atomic_pthreads-test_atomic.obj `if test -f 'test_atomic.c'; then $(CYGPATH_W) 'test_atomic.c'; else $(CYGPATH_W) '$(srcdir)/test_atomic.c'; fi` 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 check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list='$(TESTS)'; \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *" $$tst "*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ echo "XPASS: $$tst"; \ ;; \ *) \ echo "PASS: $$tst"; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *" $$tst "*) \ xfail=`expr $$xfail + 1`; \ echo "XFAIL: $$tst"; \ ;; \ *) \ failed=`expr $$failed + 1`; \ echo "FAIL: $$tst"; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ echo "SKIP: $$tst"; \ fi; \ done; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="All $$all tests passed"; \ else \ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all tests failed"; \ else \ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ skipped="($$skip tests were not run)"; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ echo "$$dashes"; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; 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 $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile installdirs: install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-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 pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic ctags distclean \ distclean-compile distclean-generic distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am test_atomic_include.h: test_atomic.template sed -e s/XX// $? > $@ sed -e s/XX/_release/ $? >> $@ sed -e s/XX/_acquire/ $? >> $@ sed -e s/XX/_read/ $? >> $@ sed -e s/XX/_write/ $? >> $@ sed -e s/XX/_full/ $? >> $@ sed -e s/XX/_release_write/ $? >> $@ sed -e s/XX/_acquire_read/ $? >> $@ list_atomic.c: list_atomic.template echo "#include \"atomic_ops.h\" " > $@ sed -e s/XX// $? >> $@ sed -e s/XX/_release/ $? >> $@ sed -e s/XX/_acquire/ $? >> $@ sed -e s/XX/_read/ $? >> $@ sed -e s/XX/_write/ $? >> $@ sed -e s/XX/_full/ $? >> $@ sed -e s/XX/_release_write/ $? >> $@ sed -e s/XX/_acquire_read/ $? >> $@ list_atomic.i: list_atomic.c $(COMPILE) $? -E > list_atomic.i # 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: synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/tests/list_atomic.c0000664000076400007640000003411411104702320024616 0ustar stefanstefan#include "atomic_ops.h" /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* This generates a compilable program. But it is really meant to be */ /* be used only with cc -E, to inspect the expensions generated by */ /* primitives. */ /* The result will not link or run. */ void list_atomic(void) { AO_T *addr, val, newval, oldval; AO_TS_T tsaddr; long incr; # if defined(AO_HAVE_nop) "AO_nop(): "; AO_nop(); # else "No AO_nop"; # endif # if defined(AO_HAVE_load) "AO_load(addr):"; AO_load(addr); # else "No AO_load"; # endif # if defined(AO_HAVE_store) "AO_store(addr, val):"; AO_store(addr, val); # else "No AO_store"; # endif # if defined(AO_HAVE_test_and_set) "AO_test_and_set(tsaddr):"; AO_test_and_set(tsaddr); # else "No AO_test_and_set"; # endif # if defined(AO_HAVE_fetch_and_add1) "AO_fetch_and_add1(addr):"; AO_fetch_and_add1(addr); # else "No AO_fetch_and_add1"; # endif # if defined(AO_HAVE_fetch_and_sub1) "AO_fetch_and_sub1(addr):"; AO_fetch_and_sub1(addr); # else "No AO_fetch_and_sub1"; # endif # if defined(AO_HAVE_fetch_and_add) "AO_fetch_and_add(addr, incr):"; AO_fetch_and_add(addr, incr); # else "No AO_fetch_and_add"; # endif # if defined(AO_HAVE_compare_and_swap) "AO_compare_and_swap(addr, oldval, newval):"; AO_compare_and_swap(addr, oldval, newval); # else "No AO_compare_and_swap"; # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* This generates a compilable program. But it is really meant to be */ /* be used only with cc -E, to inspect the expensions generated by */ /* primitives. */ /* The result will not link or run. */ void list_atomic_release(void) { AO_T *addr, val, newval, oldval; AO_TS_T tsaddr; long incr; # if defined(AO_HAVE_nop_release) "AO_nop_release(): "; AO_nop_release(); # else "No AO_nop_release"; # endif # if defined(AO_HAVE_load_release) "AO_load_release(addr):"; AO_load_release(addr); # else "No AO_load_release"; # endif # if defined(AO_HAVE_store_release) "AO_store_release(addr, val):"; AO_store_release(addr, val); # else "No AO_store_release"; # endif # if defined(AO_HAVE_test_and_set_release) "AO_test_and_set_release(tsaddr):"; AO_test_and_set_release(tsaddr); # else "No AO_test_and_set_release"; # endif # if defined(AO_HAVE_fetch_and_add1_release) "AO_fetch_and_add1_release(addr):"; AO_fetch_and_add1_release(addr); # else "No AO_fetch_and_add1_release"; # endif # if defined(AO_HAVE_fetch_and_sub1_release) "AO_fetch_and_sub1_release(addr):"; AO_fetch_and_sub1_release(addr); # else "No AO_fetch_and_sub1_release"; # endif # if defined(AO_HAVE_fetch_and_add_release) "AO_fetch_and_add_release(addr, incr):"; AO_fetch_and_add_release(addr, incr); # else "No AO_fetch_and_add_release"; # endif # if defined(AO_HAVE_compare_and_swap_release) "AO_compare_and_swap_release(addr, oldval, newval):"; AO_compare_and_swap_release(addr, oldval, newval); # else "No AO_compare_and_swap_release"; # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* This generates a compilable program. But it is really meant to be */ /* be used only with cc -E, to inspect the expensions generated by */ /* primitives. */ /* The result will not link or run. */ void list_atomic_acquire(void) { AO_T *addr, val, newval, oldval; AO_TS_T tsaddr; long incr; # if defined(AO_HAVE_nop_acquire) "AO_nop_acquire(): "; AO_nop_acquire(); # else "No AO_nop_acquire"; # endif # if defined(AO_HAVE_load_acquire) "AO_load_acquire(addr):"; AO_load_acquire(addr); # else "No AO_load_acquire"; # endif # if defined(AO_HAVE_store_acquire) "AO_store_acquire(addr, val):"; AO_store_acquire(addr, val); # else "No AO_store_acquire"; # endif # if defined(AO_HAVE_test_and_set_acquire) "AO_test_and_set_acquire(tsaddr):"; AO_test_and_set_acquire(tsaddr); # else "No AO_test_and_set_acquire"; # endif # if defined(AO_HAVE_fetch_and_add1_acquire) "AO_fetch_and_add1_acquire(addr):"; AO_fetch_and_add1_acquire(addr); # else "No AO_fetch_and_add1_acquire"; # endif # if defined(AO_HAVE_fetch_and_sub1_acquire) "AO_fetch_and_sub1_acquire(addr):"; AO_fetch_and_sub1_acquire(addr); # else "No AO_fetch_and_sub1_acquire"; # endif # if defined(AO_HAVE_fetch_and_add_acquire) "AO_fetch_and_add_acquire(addr, incr):"; AO_fetch_and_add_acquire(addr, incr); # else "No AO_fetch_and_add_acquire"; # endif # if defined(AO_HAVE_compare_and_swap_acquire) "AO_compare_and_swap_acquire(addr, oldval, newval):"; AO_compare_and_swap_acquire(addr, oldval, newval); # else "No AO_compare_and_swap_acquire"; # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* This generates a compilable program. But it is really meant to be */ /* be used only with cc -E, to inspect the expensions generated by */ /* primitives. */ /* The result will not link or run. */ void list_atomic_read(void) { AO_T *addr, val, newval, oldval; AO_TS_T tsaddr; long incr; # if defined(AO_HAVE_nop_read) "AO_nop_read(): "; AO_nop_read(); # else "No AO_nop_read"; # endif # if defined(AO_HAVE_load_read) "AO_load_read(addr):"; AO_load_read(addr); # else "No AO_load_read"; # endif # if defined(AO_HAVE_store_read) "AO_store_read(addr, val):"; AO_store_read(addr, val); # else "No AO_store_read"; # endif # if defined(AO_HAVE_test_and_set_read) "AO_test_and_set_read(tsaddr):"; AO_test_and_set_read(tsaddr); # else "No AO_test_and_set_read"; # endif # if defined(AO_HAVE_fetch_and_add1_read) "AO_fetch_and_add1_read(addr):"; AO_fetch_and_add1_read(addr); # else "No AO_fetch_and_add1_read"; # endif # if defined(AO_HAVE_fetch_and_sub1_read) "AO_fetch_and_sub1_read(addr):"; AO_fetch_and_sub1_read(addr); # else "No AO_fetch_and_sub1_read"; # endif # if defined(AO_HAVE_fetch_and_add_read) "AO_fetch_and_add_read(addr, incr):"; AO_fetch_and_add_read(addr, incr); # else "No AO_fetch_and_add_read"; # endif # if defined(AO_HAVE_compare_and_swap_read) "AO_compare_and_swap_read(addr, oldval, newval):"; AO_compare_and_swap_read(addr, oldval, newval); # else "No AO_compare_and_swap_read"; # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* This generates a compilable program. But it is really meant to be */ /* be used only with cc -E, to inspect the expensions generated by */ /* primitives. */ /* The result will not link or run. */ void list_atomic_write(void) { AO_T *addr, val, newval, oldval; AO_TS_T tsaddr; long incr; # if defined(AO_HAVE_nop_write) "AO_nop_write(): "; AO_nop_write(); # else "No AO_nop_write"; # endif # if defined(AO_HAVE_load_write) "AO_load_write(addr):"; AO_load_write(addr); # else "No AO_load_write"; # endif # if defined(AO_HAVE_store_write) "AO_store_write(addr, val):"; AO_store_write(addr, val); # else "No AO_store_write"; # endif # if defined(AO_HAVE_test_and_set_write) "AO_test_and_set_write(tsaddr):"; AO_test_and_set_write(tsaddr); # else "No AO_test_and_set_write"; # endif # if defined(AO_HAVE_fetch_and_add1_write) "AO_fetch_and_add1_write(addr):"; AO_fetch_and_add1_write(addr); # else "No AO_fetch_and_add1_write"; # endif # if defined(AO_HAVE_fetch_and_sub1_write) "AO_fetch_and_sub1_write(addr):"; AO_fetch_and_sub1_write(addr); # else "No AO_fetch_and_sub1_write"; # endif # if defined(AO_HAVE_fetch_and_add_write) "AO_fetch_and_add_write(addr, incr):"; AO_fetch_and_add_write(addr, incr); # else "No AO_fetch_and_add_write"; # endif # if defined(AO_HAVE_compare_and_swap_write) "AO_compare_and_swap_write(addr, oldval, newval):"; AO_compare_and_swap_write(addr, oldval, newval); # else "No AO_compare_and_swap_write"; # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* This generates a compilable program. But it is really meant to be */ /* be used only with cc -E, to inspect the expensions generated by */ /* primitives. */ /* The result will not link or run. */ void list_atomic_full(void) { AO_T *addr, val, newval, oldval; AO_TS_T tsaddr; long incr; # if defined(AO_HAVE_nop_full) "AO_nop_full(): "; AO_nop_full(); # else "No AO_nop_full"; # endif # if defined(AO_HAVE_load_full) "AO_load_full(addr):"; AO_load_full(addr); # else "No AO_load_full"; # endif # if defined(AO_HAVE_store_full) "AO_store_full(addr, val):"; AO_store_full(addr, val); # else "No AO_store_full"; # endif # if defined(AO_HAVE_test_and_set_full) "AO_test_and_set_full(tsaddr):"; AO_test_and_set_full(tsaddr); # else "No AO_test_and_set_full"; # endif # if defined(AO_HAVE_fetch_and_add1_full) "AO_fetch_and_add1_full(addr):"; AO_fetch_and_add1_full(addr); # else "No AO_fetch_and_add1_full"; # endif # if defined(AO_HAVE_fetch_and_sub1_full) "AO_fetch_and_sub1_full(addr):"; AO_fetch_and_sub1_full(addr); # else "No AO_fetch_and_sub1_full"; # endif # if defined(AO_HAVE_fetch_and_add_full) "AO_fetch_and_add_full(addr, incr):"; AO_fetch_and_add_full(addr, incr); # else "No AO_fetch_and_add_full"; # endif # if defined(AO_HAVE_compare_and_swap_full) "AO_compare_and_swap_full(addr, oldval, newval):"; AO_compare_and_swap_full(addr, oldval, newval); # else "No AO_compare_and_swap_full"; # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* This generates a compilable program. But it is really meant to be */ /* be used only with cc -E, to inspect the expensions generated by */ /* primitives. */ /* The result will not link or run. */ void list_atomic_release_write(void) { AO_T *addr, val, newval, oldval; AO_TS_T tsaddr; long incr; # if defined(AO_HAVE_nop_release_write) "AO_nop_release_write(): "; AO_nop_release_write(); # else "No AO_nop_release_write"; # endif # if defined(AO_HAVE_load_release_write) "AO_load_release_write(addr):"; AO_load_release_write(addr); # else "No AO_load_release_write"; # endif # if defined(AO_HAVE_store_release_write) "AO_store_release_write(addr, val):"; AO_store_release_write(addr, val); # else "No AO_store_release_write"; # endif # if defined(AO_HAVE_test_and_set_release_write) "AO_test_and_set_release_write(tsaddr):"; AO_test_and_set_release_write(tsaddr); # else "No AO_test_and_set_release_write"; # endif # if defined(AO_HAVE_fetch_and_add1_release_write) "AO_fetch_and_add1_release_write(addr):"; AO_fetch_and_add1_release_write(addr); # else "No AO_fetch_and_add1_release_write"; # endif # if defined(AO_HAVE_fetch_and_sub1_release_write) "AO_fetch_and_sub1_release_write(addr):"; AO_fetch_and_sub1_release_write(addr); # else "No AO_fetch_and_sub1_release_write"; # endif # if defined(AO_HAVE_fetch_and_add_release_write) "AO_fetch_and_add_release_write(addr, incr):"; AO_fetch_and_add_release_write(addr, incr); # else "No AO_fetch_and_add_release_write"; # endif # if defined(AO_HAVE_compare_and_swap_release_write) "AO_compare_and_swap_release_write(addr, oldval, newval):"; AO_compare_and_swap_release_write(addr, oldval, newval); # else "No AO_compare_and_swap_release_write"; # endif } /* * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. * * This file is covered by the GNU general public license, version 2. * see doc/COPYING for details. */ /* This generates a compilable program. But it is really meant to be */ /* be used only with cc -E, to inspect the expensions generated by */ /* primitives. */ /* The result will not link or run. */ void list_atomic_acquire_read(void) { AO_T *addr, val, newval, oldval; AO_TS_T tsaddr; long incr; # if defined(AO_HAVE_nop_acquire_read) "AO_nop_acquire_read(): "; AO_nop_acquire_read(); # else "No AO_nop_acquire_read"; # endif # if defined(AO_HAVE_load_acquire_read) "AO_load_acquire_read(addr):"; AO_load_acquire_read(addr); # else "No AO_load_acquire_read"; # endif # if defined(AO_HAVE_store_acquire_read) "AO_store_acquire_read(addr, val):"; AO_store_acquire_read(addr, val); # else "No AO_store_acquire_read"; # endif # if defined(AO_HAVE_test_and_set_acquire_read) "AO_test_and_set_acquire_read(tsaddr):"; AO_test_and_set_acquire_read(tsaddr); # else "No AO_test_and_set_acquire_read"; # endif # if defined(AO_HAVE_fetch_and_add1_acquire_read) "AO_fetch_and_add1_acquire_read(addr):"; AO_fetch_and_add1_acquire_read(addr); # else "No AO_fetch_and_add1_acquire_read"; # endif # if defined(AO_HAVE_fetch_and_sub1_acquire_read) "AO_fetch_and_sub1_acquire_read(addr):"; AO_fetch_and_sub1_acquire_read(addr); # else "No AO_fetch_and_sub1_acquire_read"; # endif # if defined(AO_HAVE_fetch_and_add_acquire_read) "AO_fetch_and_add_acquire_read(addr, incr):"; AO_fetch_and_add_acquire_read(addr, incr); # else "No AO_fetch_and_add_acquire_read"; # endif # if defined(AO_HAVE_compare_and_swap_acquire_read) "AO_compare_and_swap_acquire_read(addr, oldval, newval):"; AO_compare_and_swap_acquire_read(addr, oldval, newval); # else "No AO_compare_and_swap_acquire_read"; # endif } synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/tests/Makefile.am0000664000076400007640000000322511104702320024176 0ustar stefanstefanEXTRA_DIST=test_atomic.template list_atomic.template run_parallel.inc \ test_atomic_include.h # We distribute test_atomic_include.h, since it's hard to regenerate # on Windows without sed. BUILT_SOURCES = test_atomic_include.h list_atomic.i CLEANFILES = test_atomic_include.h list_atomic.c list_atomic.i AM_CPPFLAGS=-I$(srcdir)/../src TESTS=test_atomic test_atomic_pthreads test_stack test_malloc #create the test_atomic test program check_PROGRAMS=test_atomic test_atomic_pthreads test_stack test_malloc test_atomic_SOURCES=test_atomic.c test_atomic_LDADD=-lpthread ../src/libatomic_ops.a test_atomic_pthreads_SOURCES=test_atomic.c test_atomic_pthreads_CPPFLAGS=-DAO_USE_PTHREAD_DEFS $(AM_CPPFLAGS) test_atomic_pthreads_LDADD=-lpthread ../src/libatomic_ops.a test_stack_SOURCES=test_stack.c test_stack_LDADD=-lpthread ../src/libatomic_ops_gpl.a ../src/libatomic_ops.a test_malloc_SOURCES=test_malloc.c test_malloc_LDADD=-lpthread ../src/libatomic_ops_gpl.a ../src/libatomic_ops.a test_atomic_include.h: test_atomic.template sed -e s/XX// $? > $@ sed -e s/XX/_release/ $? >> $@ sed -e s/XX/_acquire/ $? >> $@ sed -e s/XX/_read/ $? >> $@ sed -e s/XX/_write/ $? >> $@ sed -e s/XX/_full/ $? >> $@ sed -e s/XX/_release_write/ $? >> $@ sed -e s/XX/_acquire_read/ $? >> $@ list_atomic.c: list_atomic.template echo "#include \"atomic_ops.h\" " > $@ sed -e s/XX// $? >> $@ sed -e s/XX/_release/ $? >> $@ sed -e s/XX/_acquire/ $? >> $@ sed -e s/XX/_read/ $? >> $@ sed -e s/XX/_write/ $? >> $@ sed -e s/XX/_full/ $? >> $@ sed -e s/XX/_release_write/ $? >> $@ sed -e s/XX/_acquire_read/ $? >> $@ list_atomic.i: list_atomic.c $(COMPILE) $? -E > list_atomic.i synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/aclocal.m40000664000076400007640000010125011126175477022662 0ustar stefanstefan# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(AC_AUTOCONF_VERSION, [2.61],, [m4_warning([this file was generated for autoconf 2.61. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.10' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.10.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.10.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) # Figure out how to run the assembler. -*- Autoconf -*- # Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_PROG_AS # ---------- AC_DEFUN([AM_PROG_AS], [# By default we simply use the C compiler to build assembly code. AC_REQUIRE([AC_PROG_CC]) test "${CCAS+set}" = set || CCAS=$CC test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS AC_ARG_VAR([CCAS], [assembler compiler command (defaults to CC)]) AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)]) _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl ]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # 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 8 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 13 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.60])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) ]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/Makefile.am0000664000076400007640000000005311104702317023036 0ustar stefanstefanSUBDIRS = src doc tests #distclean-local: synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/doc/0000775000076400007640000000000011172123233021550 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/doc/README_win32.txt0000664000076400007640000000260311104702320024264 0ustar stefanstefanMost of the atomic_ops functionality is available under Win32 with the Microsoft tools, but the build process currently is considerably more primitive than on Linux/Unix platforms. To build: 1) Go to the src directory in the distribution. 2) Make sure the Microsoft command-line tools (e.g. nmake) are available. 3) Run "nmake -f Makefile.msft". This should run some tests, which may print warnings about the types of the "Interlocked" functions. I haven't been able to make all versions of VC++ happy. If you know how to, please send a patch. 4) To compile applications, you will need to retain or copy the following pieces from the resulting src directory contents: "atomic_ops.h" - Header file defining low-level primitives. This includes files from: "atomic_ops"- Subdirectory containing implementation header files. "atomic_ops_stack.h" - Header file describing almost lock-free stack. "atomic_ops_malloc.h" - Header file describing almost lock-free malloc. "libatomic_ops_gpl.lib" - Library containing implementation of the above two. The atomic_ops.h implementation is entirely in the header files in Win32. Most clients of atomic_ops.h will need to define AO_ASSUME_WINDOWS98 before including it. Compare_and_swap is otherwise not available. Note that the library is covered by the GNU General Public License, while the top 2 of these pieces allow use in proprietary code. synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/doc/LICENSING.txt0000664000076400007640000000536211104702320023625 0ustar stefanstefanOur intent is to make it easy to use libatomic_ops, in both free and proprietary software. Hence most code that we expect to be linked into a client application is covered by an MIT-style license. A few library routines are covered by the GNU General Public License. These are put into a separate library, libatomic_ops_gpl.a . The low-level part of the library is mostly covered by the following license: ---------------------------------------- Copyright (c) ... 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. -------------------------------- A few files in the sysdeps directory were inherited in part from the Boehm-Demers-Weiser conservative garbage collector, and are covered by its license, which is similar in spirit: -------------------------------- Copyright (c) ... THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. Permission is hereby granted to use or copy this program for any purpose, provided the above notices are retained on all copies. Permission to modify the code and to distribute modified code is granted, provided the above notices are retained, and a notice that the code was modified is included with the above copyright notice. ---------------------------------- A few files are covered by the GNU General Public License. (See file "COPYING".) This applies only to test code, sample applications, and the libatomic_ops_gpl portion of the library. Thus libatomic_ops_gpl should generally not be linked into proprietary code. (This distinction was motivated by patent considerations.) It is possible that the license of the GPL pieces may be changed for future versions to make them more consistent with the rest of the package. If you submit patches, and have strong preferences about licensing, please express them. synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/doc/COPYING0000664000076400007640000004311011104702320022575 0ustar stefanstefan 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. synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/doc/README_malloc.txt0000664000076400007640000000601411104702320024571 0ustar stefanstefanThe libatomic_ops_gpl includes a simple almost-lock-free malloc implementation. This is intended as a safe way to allocate memory from a signal handler, or to allocate memory in the context of a library that does not know what thread library it will be used with. In either case locking is impossible. Note that the operations are only guaranteed to be 1-lock-free, i.e. a single blocked thread will not prevent progress, but multiple blocked threads may. To safely use these operations in a signal handler, the handler should be non-reentrant, i.e. it should not be interruptable by another handler using these operations. Furthermore use outside of signal handlers in a multithreaded application should be protected by a lock, so that at most one invocation may be interrupted by a signal. The header will define the macro "AO_MALLOC_IS_LOCK_FREE" on platforms on which malloc is completely lock-free, and hence these restrictions do not apply. In the presence of threads, but absence of contention, the time performance of this package should be as good, or slightly better than, most system malloc implementations. Its space performance is theoretically optimal (to within a constant factor), but probably quite poor in practice. In particular, no attempt is made to coalesce free small memory blocks. Something like Doug Lea's malloc is likely to use significantly less memory for complex applications. Perfomance on platforms without an efficient compare-and-swap implementation will be poor. This package was not designed for processor-scalability in the face of high allocation rates. If all threads happen to allocate different-sized objects, you might get lucky. Otherwise expect contention and false-sharing problems. If this is an issue, something like Maged Michael's algorithm (PLDI 2004) would be technically a far better choice. If you are concerned only with scalablity, and not signal-safety, you might also consider using Hoard instead. We have seen a factor of 3 to 4 slowdown from the standard glibc malloc implementation with contention, even when the performance without contention was faster. (To make the implementation more scalable, one would need to replicate at least the free list headers, so that concurrent access is possible without cache conflicts.) Unfortunately there is no portable async-signal-safe way to obtain large chunks of memory from the OS. Based on reading of the source code, mmap-based allocation appears safe under Linux, and probably BSD variants. It is probably unsafe for operating systems built on Mach, such as Apple's Darwin. Without use of mmap, the allocator is limited to a fixed size, statically preallocated heap (2MB by default), and will fail to allocate objects above a certain size (just under 64K by default). Use of mmap to circumvent these limitations requires an explicit call. The entire interface to the AO_malloc package currently consists of: #include /* includes atomic_ops.h */ void *AO_malloc(size_t sz); void AO_free(void *p); void AO_malloc_enable_mmap(void); synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/doc/Makefile.in0000664000076400007640000002240011104702320023606 0ustar stefanstefan# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 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@ target_triplet = @target@ subdir = doc DIST_COMMON = $(dist_pkgdata_DATA) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in COPYING ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(pkgdatadir)" dist_pkgdataDATA_INSTALL = $(INSTALL_DATA) DATA = $(dist_pkgdata_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ NEED_ASM_FALSE = @NEED_ASM_FALSE@ NEED_ASM_TRUE = @NEED_ASM_TRUE@ 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@ PICFLAG = @PICFLAG@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ 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__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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ # installed documentation # dist_pkgdata_DATA = COPYING LICENSING.txt README.txt COPYING README_stack.txt README_malloc.txt README_win32.txt all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-dist_pkgdataDATA: $(dist_pkgdata_DATA) @$(NORMAL_INSTALL) test -z "$(pkgdatadir)" || $(mkdir_p) "$(DESTDIR)$(pkgdatadir)" @list='$(dist_pkgdata_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(dist_pkgdataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgdatadir)/$$f'"; \ $(dist_pkgdataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgdatadir)/$$f"; \ done uninstall-dist_pkgdataDATA: @$(NORMAL_UNINSTALL) @list='$(dist_pkgdata_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \ rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(pkgdatadir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-dist_pkgdataDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-dist_pkgdataDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-dist_pkgdataDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am uninstall uninstall-am \ uninstall-dist_pkgdataDATA uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/doc/README.txt0000664000076400007640000002545311104702320023252 0ustar stefanstefanUsage: 0) If possible, do this on a multiprocessor, especially if you are planning on modifying or enhancing the package. It will work on a uniprocessor, but the tests are much more likely to pass in the presence of serious problems. 1) Type ./configure --prefix=; make; make check in the directory containing unpacked source. The usual GNU build machinery is used, except that only static, but position-independent, libraries are normally built. On Windows, read README_win32.txt instead. 2) Applications should include atomic_ops.h. Nearly all operations are implemented by header files included from it. It is sometimes necessary, and always recommended to also link against libatomic_ops.a. To use the almost non-blocking stack or malloc implementations, see the corresponding README files, and also link against libatomic_gpl.a before linking against libatomic_ops.a. OVERVIEW: Atomic_ops.h defines a large collection of operations, each one of which is a combination of an (optional) atomic memory operation, and a memory barrier. Also defines associated feature-test macros to determine whether a particular operation is available on the current target hardware (either directly or by synthesis). This is an attempt to replace various existing files with similar goals, since they usually do not handle differences in memory barrier styles with sufficient generality. If this is included after defining AO_REQUIRE_CAS, then the package will make an attempt to emulate compare-and-swap in a way that (at least on Linux) should still be async-signal-safe. As a result, most other atomic operations will then be defined using the compare-and-swap emulation. This emulation is slow, since it needs to disable signals. And it needs to block in case of contention. If you care about performance on a platform that can't directly provide compare-and-swap, there are probably better alternatives. But this allows easy ports to some such platforms (e.g. PA_RISC). The option is ignored if compare-and-swap can be implemented directly. If atomic_ops.h is included after defining AO_USE_PTHREAD_DEFS, then all atomic operations will be emulated with pthread locking. This is NOT async-signal-safe. And it is slow. It is intended primarily for debugging of the atomic_ops package itself. Note that the implementation reflects our understanding of real processor behavior. This occasionally diverges from the documented behavior. (E.g. the documented X86 behavior seems to be weak enough that it is impractical to use. Current real implementations appear to be much better behaved.) We of course are in no position to guarantee that future processors (even HPs) will continue to behave this way, though we hope they will. This is a work in progress. Corrections/additions for other platforms are greatly appreciated. It passes rudimentary tests on X86, Itanium, and Alpha. OPERATIONS: Most operations operate on values of type AO_t, which are unsigned integers whose size matches that of pointers on the given architecture. Exceptions are: - AO_test_and_set operates on AO_TS_t, which is whatever size the hardware supports with good performance. In some cases this is the length of a cache line. In some cases it is a byte. In many cases it is equivalent to AO_t. - A few operations are implemented on smaller or larger size integers. Such operations are indicated by the appropriate prefix: AO_char_... Operates on unsigned char values. AO_short_... Operates on unsigned short values. AO_int_... Operates on unsigned int values. (Currently a very limited selection of these is implemented. We're working on it.) The defined operations are all of the form AO_[_](). The component specifies an atomic memory operation. It may be one of the following, where the corresponding argument and result types are also specified: void nop() No atomic operation. The barrier may still be useful. AO_t load(volatile AO_t * addr) Atomic load of *addr. void store(volatile AO_t * addr, AO_t new_val) Atomically store new_val to *addr. AO_t fetch_and_add(volatile AO_t *addr, AO_t incr) Atomically add incr to *addr, and return the original value of *addr. AO_t fetch_and_add1(volatile AO_t *addr) Equivalent to AO_fetch_and_add(addr, 1). AO_t fetch_and_sub1(volatile AO_t *addr) Equivalent to AO_fetch_and_add(addr, (AO_t)(-1)). void or(volatile AO_t *addr, AO_t incr) Atomically or incr into *addr. int compare_and_swap(volatile AO_t * addr, AO_t old_val, AO_t new_val) Atomically compare *addr to old_val, and replace *addr by new_val if the first comparison succeeds. Returns nonzero if the comparison succeeded and *addr was updated. AO_TS_VAL_t test_and_set(volatile AO_TS_t * addr) Atomically read the binary value at *addr, and set it. AO_TS_VAL_t is an enumeration type which includes the two values AO_TS_SET and and AO_TS_CLEAR. An AO_TS_t location is capable of holding an AO_TS_VAL_t, but may be much larger, as dictated by hardware constraints. Test_and_set logically sets the value to AO_TS_SET. It may be reset to AO_TS_CLEAR with the AO_CLEAR(AO_TS_t *) macro. AO_TS_t locations should be initialized to AO_TS_INITIALIZER. The values of AO_TS_SET and AO_TS_CLEAR are hardware dependent. (On PA-RISC, AO_TS_SET is zero!) Test_and_set is a more limited version of compare_and_swap. Its only advantage is that it is more easily implementable on some hardware. It should thus be used if only binary test-and-set functionality is needed. If available, we also provide compare_and_swap operations that operate on wider values. Since standard data types for double width values may not be available, these explicitly take pairs of arguments for the new and/or old value. Unfortunately, there are two common variants, neither of which can easily and efficiently emulate the other. The first performs a comparison against the entire value being replaced, where the second replaces a double-width replacement, but performs a single-width comparison: int compare_double_and_swap_double(volatile AO_double_t * addr, AO_t old_val1, AO_t old_val2, AO_t new_val1, AO_t new_val2); int compare_and_swap_double(volatile AO_double_t * addr, AO_t old_val1, AO_t new_val1, AO_t new_val2); where AO_double_t is a structure containing AO_val1 and AO_val2 fields, both of type AO_t. For compare_and_swap_double, we compare against the val1 field. AO_double_t exists only if AO_HAVE_double_t is defined. ORDERING CONSTRAINTS: Each operation name also includes a suffix that specifies the associated ordering semantics. The ordering constraint limits reordering of this operation with repsect to other atomic operations and ordinary memory references. The current implementation assumes that all memory references are to ordinary cacheable memory; the ordering guarantee is with respect to other threads or processes, not I/O devices. (Whether or not this distinction is important is platform-dependent.) Ordering suffixes are one of the following: : No memory barrier. A plain AO_nop() really does nothing. _release: Earlier operations must become visible to other threads before the atomic operation. _acquire: Later operations must become visible after this operation. _read: Subsequent reads must become visible after reads included in the atomic operation or preceding it. Rarely useful for clients? _write: Earlier writes become visible before writes during or after the atomic operation. Rarely useful for clients? _full: Ordered with respect to both earlier and later memops. _release_write: Ordered with respect to earlier writes. This is normally implemented as either a _write or _release barrier. _dd_acquire_read: Ordered with respect to later reads that are data dependent on this one. This is needed on a pointer read, which is later dereferenced to read a second value, with the expectation that the second read is ordered after the first one. On most architectures, this is equivalent to no barrier. (This is very hard to define precisely. It should probably be avoided.) _release_read: Ordered with respect to earlier reads. Useful for implementing read locks. Can be implemented as _release, but not as _read, since _read groups the current operation with the earlier ones. We assume that if a store is data-dependent on an a previous load, then the two are always implicitly ordered. It is possible to test whether AO_ is available on the current platform by checking whether AO_HAVE__ is defined as a macro. Note that we generally don't implement operations that are either meaningless (e.g. AO_nop_acquire, AO_nop_release) or which appear to have no clear use (e.g. AO_load_release, AO_store_acquire, AO_load_write, AO_store_read). On some platforms (e.g. PA-RISC) many operations will remain undefined unless AO_REQUIRE_CAS is defined before including the package. When typed in the package build directory, the following command will print operations that are unimplemented on the platform: make test_atomic; ./test_atomic The following command generates a file "list_atomic.i" containing the macro expansions of all implemented operations on the platform: make list_atomic.i Future directions: It currently appears that something roughly analogous to this is very likely to become part of the C++0x standard. That effort has pointed out a number of issues that we expect to address there. Since some of the solutions really require compiler support, they may not be completely addressed here. Known issues include: We should be more precise in defining the semantics of the ordering constraints, and if and how we can guarantee sequential consistency. Dd_acquire_read is very hard or impossible to define in a way that cannot be invalidated by reasonably standard compiler transformations. There is probably no good reason to provide operations on standard integer types, since those may have the wrong alignment constraints. Example: If you want to initialize an object, and then "publish" a pointer to it in a global location p, such that other threads reading the new value of p are guaranteed to see an initialized object, it suffices to use AO_release_write(p, ...) to write the pointer to the object, and to retrieve it in other threads with AO_acquire_read(p). Platform notes: All X86: We quietly assume 486 or better. Windows: Currently AO_REQUIRE_CAS is not supported. Microsoft compilers: Define AO_ASSUME_WINDOWS98 to get access to hardware compare-and-swap functionality. This relies on the InterlockedCompareExchange() function which was apparently not supported in Windows95. (There may be a better way to get access to this.) Currently only X86(32 bit) is supported for Windows. Gcc on x86: Define AO_USE_PENTIUM4_INSTRS to use the Pentium 4 mfence instruction. Currently this is appears to be of marginal benefit. synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/doc/README_stack.txt0000664000076400007640000000766311104702320024442 0ustar stefanstefanNote that the AO_stack implementation is licensed under the GPL, unlike the lower level routines. The header file atomic_ops_stack.h defines a linked stack abstraction. Stacks may be accessed by multiple concurrent threads. The implementation is 1-lock-free, i.e. it will continue to make progress if at most one thread becomes inactive while operating on the data structure. (The implementation can be built to be N-lock-free for any given N. But that seems to rarely be useful, especially since larger N involve some slowdown.) This makes it safe to access these data structures from non-reentrant signal handlers, provided at most one non-signal-handler thread is accessing the data structure at once. This latter condition can be ensured by acquiring an ordinary lock around the non-hndler accesses to the data structure. For details see: Hans-J. Boehm, "An Almost Non-Blocking Stack", PODC 2004, http://portal.acm.org/citation.cfm?doid=1011767.1011774, or http://www.hpl.hp.com/techreports/2004/HPL-2004-105.html (This is not exactly the implementation described there, since the interface was cleaned up in the interim. But it should perform very similarly.) We use a fully lock-free implementation when the underlying hardware makes that less expensive, i.e. when we have a double-wide compare-and-swap operation available. (The fully lock-free implementation uses an AO_t- sized version count, and assumes it does not wrap during the time any given operation is active. This seems reasonably safe on 32-bit hardware, and very safe on 64-bit hardware.) If a fully lock-free implementation is used, the macro AO_STACK_IS_LOCK_FREE will be defined. The implementation is interesting only because it allows reuse of existing nodes. This is necessary, for example, to implement a memory allocator. Since we want to leave the precise stack node type up to the client, we insist only that each stack node contains a link field of type AO_t. When a new node is pushed on the stack, the push operation expects to be passed the pointer to this link field, which will then be overwritten by this link field. Similarly, the pop operation returns a pointer to the link field of the object that previously was on the top of the stack. The cleanest way to use these routines is probably to define the stack node type with an initial AO_t link field, so that the conversion between the link-field pointer and the stack element pointer is just a compile-time cast. But other possibilities exist. (This would be cleaner in C++ with templates.) A stack is represented by an AO_stack_t structure. (This is normally 2 or 3 times the size of a pointer.) It may be statically initialized by setting it to AO_STACK_INITIALIZER, or dynamically initialized to an empty stack with AO_stack_init. There are only three operations for accessing stacks: void AO_stack_init(AO_stack_t *list); void AO_stack_push_release(AO_stack_t *list, AO_t *new_element); AO_t * AO_stack_pop_acquire(volatile AO_stack_t *list); We require that the objects pushed as list elements remain addressable as long as any push or pop operation are in progress. (It is OK for an object to be "pop"ped off a stack and "deallocated" with a concurrent "pop" on the same stack still in progress, but only if "deallocation" leaves the object addressable. The second "pop" may still read the object, but the value it reads will not matter.) We require that the headers (AO_stack objects) remain allocated and valid as long as any operations on them are still in-flight. We also provide macros AO_REAL_HEAD_PTR that converts an AO_stack_t to a pointer to the link field in the next element, and AO_REAL_NEXT_PTR that converts a link field to a real, dereferencable, pointer to the link field in the next element. This is intended only for debugging, or to traverse the list after modification has ceased. There is otherwise no guarantee that walking a stack using this macro will produce any kind of consistent picture of the data structure. synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/doc/Makefile.am0000664000076400007640000000021311104702320023573 0ustar stefanstefan# installed documentation # dist_pkgdata_DATA=COPYING LICENSING.txt README.txt COPYING README_stack.txt README_malloc.txt README_win32.txt synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/INSTALL0000664000076400007640000000133411104702317022036 0ustar stefanstefanThe configuration and build scripts for this package were generated by automake/autoconf. "configure --prefix=; make; make install" in this directory should work. Note that much of the content of this library is in the header files. However two small libraries are built and installed: - libatomic_ops.a is a support library, which is not needed on some platforms. This is intended to be usable, under some mild restrictions, in free or proprietary code, as are all the header files. See doc/LICENSING.txt. - libatomic_ops_gpl.a contains some higher level facilities. This code is currently covered by the GPL. The contents currently correspond to the headers atomic_ops_stack.h and atomic_ops_malloc.h. synopsis-0.12/src/Synopsis/gc/libatomic_ops-1.2/NEWS0000664000076400007640000000000111104702317021472 0ustar stefanstefan synopsis-0.12/src/Synopsis/gc/ptr_chck.c0000664000076400007640000002044111104702315017622 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* * These are checking routines calls to which could be inserted by a * preprocessor to validate C pointer arithmetic. */ #include "private/gc_pmark.h" void GC_default_same_obj_print_proc(void * p, void * q) { GC_err_printf("%p and %p are not in the same object\n", p, q); ABORT("GC_same_obj test failed"); } void (*GC_same_obj_print_proc) (void *, void *) = GC_default_same_obj_print_proc; /* Check that p and q point to the same object. Call */ /* *GC_same_obj_print_proc if they don't. */ /* Returns the first argument. (Return value may be hard */ /* to use,due to typing issues. But if we had a suitable */ /* preprocessor ...) */ /* Succeeds if neither p nor q points to the heap. */ /* We assume this is performance critical. (It shouldn't */ /* be called by production code, but this can easily make */ /* debugging intolerably slow.) */ void * GC_same_obj(void *p, void *q) { struct hblk *h; hdr *hhdr; ptr_t base, limit; word sz; if (!GC_is_initialized) GC_init(); hhdr = HDR((word)p); if (hhdr == 0) { if (divHBLKSZ((word)p) != divHBLKSZ((word)q) && HDR((word)q) != 0) { goto fail; } return(p); } /* If it's a pointer to the middle of a large object, move it */ /* to the beginning. */ if (IS_FORWARDING_ADDR_OR_NIL(hhdr)) { h = HBLKPTR(p) - (word)hhdr; hhdr = HDR(h); while (IS_FORWARDING_ADDR_OR_NIL(hhdr)) { h = FORWARDED_ADDR(h, hhdr); hhdr = HDR(h); } limit = (ptr_t)h + hhdr -> hb_sz; if ((ptr_t)p >= limit || (ptr_t)q >= limit || (ptr_t)q < (ptr_t)h ) { goto fail; } return(p); } sz = hhdr -> hb_sz; if (sz > MAXOBJBYTES) { base = (ptr_t)HBLKPTR(p); limit = base + sz; if ((ptr_t)p >= limit) { goto fail; } } else { size_t offset; size_t pdispl = HBLKDISPL(p); offset = pdispl % sz; if (HBLKPTR(p) != HBLKPTR(q)) goto fail; /* W/o this check, we might miss an error if */ /* q points to the first object on a page, and */ /* points just before the page. */ base = (ptr_t)p - offset; limit = base + sz; } /* [base, limit) delimits the object containing p, if any. */ /* If p is not inside a valid object, then either q is */ /* also outside any valid object, or it is outside */ /* [base, limit). */ if ((ptr_t)q >= limit || (ptr_t)q < base) { goto fail; } return(p); fail: (*GC_same_obj_print_proc)((ptr_t)p, (ptr_t)q); return(p); } void GC_default_is_valid_displacement_print_proc (void *p) { GC_err_printf("%p does not point to valid object displacement\n", p); ABORT("GC_is_valid_displacement test failed"); } void (*GC_is_valid_displacement_print_proc)(void *) = GC_default_is_valid_displacement_print_proc; /* Check that if p is a pointer to a heap page, then it points to */ /* a valid displacement within a heap object. */ /* Uninteresting with GC_all_interior_pointers. */ /* Always returns its argument. */ /* Note that we don't lock, since nothing relevant about the header */ /* should change while we have a valid object pointer to the block. */ void * GC_is_valid_displacement(void *p) { hdr *hhdr; word pdispl; word offset; struct hblk *h; word sz; if (!GC_is_initialized) GC_init(); hhdr = HDR((word)p); if (hhdr == 0) return(p); h = HBLKPTR(p); if (GC_all_interior_pointers) { while (IS_FORWARDING_ADDR_OR_NIL(hhdr)) { h = FORWARDED_ADDR(h, hhdr); hhdr = HDR(h); } } if (IS_FORWARDING_ADDR_OR_NIL(hhdr)) { goto fail; } sz = hhdr -> hb_sz; pdispl = HBLKDISPL(p); offset = pdispl % sz; if ((sz > MAXOBJBYTES && (ptr_t)p >= (ptr_t)h + sz) || !GC_valid_offsets[offset] || (ptr_t)p - offset + sz > (ptr_t)(h + 1)) { goto fail; } return(p); fail: (*GC_is_valid_displacement_print_proc)((ptr_t)p); return(p); } void GC_default_is_visible_print_proc(void * p) { GC_err_printf("%p is not a GC visible pointer location\n", p); ABORT("GC_is_visible test failed"); } void (*GC_is_visible_print_proc)(void * p) = GC_default_is_visible_print_proc; /* Could p be a stack address? */ GC_bool GC_on_stack(ptr_t p) { # ifdef THREADS return(TRUE); # else int dummy; # ifdef STACK_GROWS_DOWN if ((ptr_t)p >= (ptr_t)(&dummy) && (ptr_t)p < GC_stackbottom ) { return(TRUE); } # else if ((ptr_t)p <= (ptr_t)(&dummy) && (ptr_t)p > GC_stackbottom ) { return(TRUE); } # endif return(FALSE); # endif } /* Check that p is visible */ /* to the collector as a possibly pointer containing location. */ /* If it isn't invoke *GC_is_visible_print_proc. */ /* Returns the argument in all cases. May erroneously succeed */ /* in hard cases. (This is intended for debugging use with */ /* untyped allocations. The idea is that it should be possible, though */ /* slow, to add such a call to all indirect pointer stores.) */ /* Currently useless for multithreaded worlds. */ void * GC_is_visible(void *p) { hdr *hhdr; if ((word)p & (ALIGNMENT - 1)) goto fail; if (!GC_is_initialized) GC_init(); # ifdef THREADS hhdr = HDR((word)p); if (hhdr != 0 && GC_base(p) == 0) { goto fail; } else { /* May be inside thread stack. We can't do much. */ return(p); } # else /* Check stack first: */ if (GC_on_stack(p)) return(p); hhdr = HDR((word)p); if (hhdr == 0) { GC_bool result; if (GC_is_static_root(p)) return(p); /* Else do it again correctly: */ # if (defined(DYNAMIC_LOADING) || defined(MSWIN32) || \ defined(MSWINCE) || defined(PCR)) GC_register_dynamic_libraries(); result = GC_is_static_root(p); if (result) return(p); # endif goto fail; } else { /* p points to the heap. */ word descr; ptr_t base = GC_base(p); /* Should be manually inlined? */ if (base == 0) goto fail; if (HBLKPTR(base) != HBLKPTR(p)) hhdr = HDR((word)p); descr = hhdr -> hb_descr; retry: switch(descr & GC_DS_TAGS) { case GC_DS_LENGTH: if ((word)((ptr_t)p - (ptr_t)base) > (word)descr) goto fail; break; case GC_DS_BITMAP: if ((ptr_t)p - (ptr_t)base >= WORDS_TO_BYTES(BITMAP_BITS) || ((word)p & (sizeof(word) - 1))) goto fail; if (!((1 << (WORDSZ - ((ptr_t)p - (ptr_t)base) - 1)) & descr)) goto fail; break; case GC_DS_PROC: /* We could try to decipher this partially. */ /* For now we just punt. */ break; case GC_DS_PER_OBJECT: if ((signed_word)descr >= 0) { descr = *(word *)((ptr_t)base + (descr & ~GC_DS_TAGS)); } else { ptr_t type_descr = *(ptr_t *)base; descr = *(word *)(type_descr - (descr - (GC_DS_PER_OBJECT - GC_INDIR_PER_OBJ_BIAS))); } goto retry; } return(p); } # endif fail: (*GC_is_visible_print_proc)((ptr_t)p); return(p); } void * GC_pre_incr (void **p, size_t how_much) { void * initial = *p; void * result = GC_same_obj((void *)((word)initial + how_much), initial); if (!GC_all_interior_pointers) { (void) GC_is_valid_displacement(result); } return (*p = result); } void * GC_post_incr (void **p, size_t how_much) { void * initial = *p; void * result = GC_same_obj((void *)((word)initial + how_much), initial); if (!GC_all_interior_pointers) { (void) GC_is_valid_displacement(result); } *p = result; return(initial); } synopsis-0.12/src/Synopsis/gc/mips_sgi_mach_dep.s0000664000076400007640000000236311104702320021476 0ustar stefanstefan#include #include /* This file must be preprocessed. But the SGI assembler always does */ /* that. Furthermore, a generic preprocessor won't do, since some of */ /* the SGI-supplied include files rely on behavior of the MIPS */ /* assembler. Hence we treat and name this file as though it required */ /* no preprocessing. */ # define call_push(x) move $4,x; jal GC_push_one .option pic2 .text /* Mark from machine registers that are saved by C compiler */ # define FRAMESZ 32 # define RAOFF FRAMESZ-SZREG # define GPOFF FRAMESZ-(2*SZREG) NESTED(GC_push_regs, FRAMESZ, ra) .mask 0x80000000,-SZREG # inform debugger of saved ra loc move t0,gp SETUP_GPX(t8) PTR_SUBU sp,FRAMESZ # ifdef SETUP_GP64 SETUP_GP64(GPOFF, GC_push_regs) # endif SAVE_GP(GPOFF) REG_S ra,RAOFF(sp) # if (_MIPS_SIM == _MIPS_SIM_ABI32) call_push($2) call_push($3) # endif call_push($16) call_push($17) call_push($18) call_push($19) call_push($20) call_push($21) call_push($22) call_push($23) call_push($30) REG_L ra,RAOFF(sp) # ifdef RESTORE_GP64 RESTORE_GP64 # endif PTR_ADDU sp,FRAMESZ j ra .end GC_push_regs synopsis-0.12/src/Synopsis/gc/win32_threads.c0000644000076400007640000013456211104702315020511 0ustar stefanstefan#include "private/gc_priv.h" #if defined(GC_WIN32_THREADS) #include #ifdef THREAD_LOCAL_ALLOC # include "private/thread_local_alloc.h" #endif /* THREAD_LOCAL_ALLOC */ /* Allocation lock declarations. */ #if !defined(USE_PTHREAD_LOCKS) # if defined(GC_DLL) __declspec(dllexport) CRITICAL_SECTION GC_allocate_ml; # else CRITICAL_SECTION GC_allocate_ml; # endif DWORD GC_lock_holder = NO_THREAD; /* Thread id for current holder of allocation lock */ #else pthread_mutex_t GC_allocate_ml = PTHREAD_MUTEX_INITIALIZER; unsigned long GC_lock_holder = NO_THREAD; #endif #ifdef GC_PTHREADS # include /* GC_DLL should not normally be defined, especially since we often do turn */ /* on THREAD_LOCAL_ALLOC, which is currently incompatible. */ /* It might be possible to get GC_DLL and DllMain-based thread registration */ /* to work with Cygwin, but if you try you are on your own. */ #ifdef GC_DLL # error GC_DLL untested with Cygwin #endif /* Cygwin-specific forward decls */ # undef pthread_create # undef pthread_sigmask # undef pthread_join # undef pthread_detach # undef dlopen # ifdef DEBUG_THREADS # ifdef CYGWIN32 # define DEBUG_CYGWIN_THREADS 1 # define DEBUG_WIN32_PTHREADS 0 # else # define DEBUG_WIN32_PTHREADS 1 # define DEBUG_CYGWIN_THREADS 0 # endif # else # define DEBUG_CYGWIN_THREADS 0 # define DEBUG_WIN32_PTHREADS 0 # endif void * GC_pthread_start(void * arg); void GC_thread_exit_proc(void *arg); # include #else # ifdef DEBUG_THREADS # define DEBUG_WIN32_THREADS 1 # else # define DEBUG_WIN32_THREADS 0 # endif # undef CreateThread # undef ExitThread # undef _beginthreadex # undef _endthreadex # undef _beginthread # ifdef DEBUG_THREADS # define DEBUG_WIN32_THREADS 1 # else # define DEBUG_WIN32_THREADS 0 # endif # include /* For _beginthreadex, _endthreadex */ #endif #if defined(GC_DLL) && !defined(MSWINCE) static GC_bool GC_win32_dll_threads = FALSE; /* This code operates in two distinct modes, depending on */ /* the setting of GC_win32_dll_threads. If */ /* GC_win32_dll_threads is set, all threads in the process */ /* are implicitly registered with the GC by DllMain. */ /* No explicit registration is required, and attempts at */ /* explicit registration are ignored. This mode is */ /* very different from the Posix operation of the collector. */ /* In this mode access to the thread table is lock-free. */ /* Hence there is a static limit on the number of threads. */ /* If GC_win32_dll_threads is FALSE, or the collector is */ /* built without GC_DLL defined, things operate in a way */ /* that is very similar to Posix platforms, and new threads */ /* must be registered with the collector, e.g. by using */ /* preprocessor-based interception of the thread primitives. */ /* In this case, we use a real data structure for the thread */ /* table. Note that there is no equivalent of linker-based */ /* call interception, since we don't have ELF-like */ /* facilities. The Windows analog appears to be "API */ /* hooking", which really seems to be a standard way to */ /* do minor binary rewriting (?). I'd prefer not to have */ /* the basic collector rely on such facilities, but an */ /* optional package that intercepts thread calls this way */ /* would probably be nice. */ /* GC_win32_dll_threads must be set at initialization time, */ /* i.e. before any collector or thread calls. We make it a */ /* "dynamic" option only to avoid multiple library versions. */ #else # define GC_win32_dll_threads FALSE #endif /* We have two versions of the thread table. Which one */ /* we us depends on whether or not GC_win32_dll_threads */ /* is set. Note that before initialization, we don't */ /* add any entries to either table, even if DllMain is */ /* called. The main thread will be added on */ /* initialization. */ /* The type of the first argument to InterlockedExchange. */ /* Documented to be LONG volatile *, but at least gcc likes */ /* this better. */ typedef LONG * IE_t; GC_bool GC_thr_initialized = FALSE; GC_bool GC_need_to_lock = FALSE; static GC_bool parallel_initialized = FALSE; void GC_init_parallel(void); #ifdef GC_DLL /* Turn on GC_win32_dll_threads */ GC_API void GC_use_DllMain(void) { # ifdef THREAD_LOCAL_ALLOC ABORT("Cannot use thread local allocation with DllMain-based " "thread registration."); /* Thread-local allocation really wants to lock at thread */ /* entry and exit. */ # endif GC_ASSERT(!parallel_initialized); GC_win32_dll_threads = TRUE; } #else GC_API void GC_use_DllMain(void) { ABORT("GC not configured as DLL"); } #endif DWORD GC_main_thread = 0; struct GC_Thread_Rep { union { AO_t tm_in_use; /* Updated without lock. */ /* We assert that unused */ /* entries have invalid ids of */ /* zero and zero stack fields. */ /* Used only with GC_win32_dll_threads. */ struct GC_Thread_Rep * tm_next; /* Hash table link without */ /* GC_win32_dll_threads. */ /* More recently allocated threads */ /* with a given pthread id come */ /* first. (All but the first are */ /* guaranteed to be dead, but we may */ /* not yet have registered the join.) */ } table_management; # define in_use table_management.tm_in_use # define next table_management.tm_next DWORD id; HANDLE handle; ptr_t stack_base; /* The cold end of the stack. */ /* 0 ==> entry not valid. */ /* !in_use ==> stack_base == 0 */ GC_bool suspended; # ifdef GC_PTHREADS void *status; /* hold exit value until join in case it's a pointer */ pthread_t pthread_id; short flags; /* Protected by GC lock. */ # define FINISHED 1 /* Thread has exited. */ # define DETACHED 2 /* Thread is intended to be detached. */ # define KNOWN_FINISHED(t) (((t) -> flags) & FINISHED) # else # define KNOWN_FINISHED(t) 0 # endif # ifdef THREAD_LOCAL_ALLOC struct thread_local_freelists tlfs; # endif }; typedef struct GC_Thread_Rep * GC_thread; typedef volatile struct GC_Thread_Rep * GC_vthread; /* * We assumed that volatile ==> memory ordering, at least among * volatiles. This code should consistently use atomic_ops. */ volatile GC_bool GC_please_stop = FALSE; /* * We track thread attachments while the world is supposed to be stopped. * Unfortunately, we can't stop them from starting, since blocking in * DllMain seems to cause the world to deadlock. Thus we have to recover * If we notice this in the middle of marking. */ AO_t GC_attached_thread = FALSE; /* Return TRUE if an thread was attached since we last asked or */ /* since GC_attached_thread was explicitly reset. */ GC_bool GC_started_thread_while_stopped(void) { AO_t result; if (GC_win32_dll_threads) { AO_nop_full(); /* Prior heap reads need to complete earlier. */ result = AO_load(&GC_attached_thread); if (result) { AO_store(&GC_attached_thread, FALSE); } return ((GC_bool)result); } else { return FALSE; } } /* Thread table used if GC_win32_dll_threads is set. */ /* This is a fixed size array. */ /* Since we use runtime conditionals, both versions */ /* are always defined. */ # ifndef MAX_THREADS # define MAX_THREADS 512 # endif /* Things may get quite slow for large numbers of threads, */ /* since we look them up with sequential search. */ volatile struct GC_Thread_Rep dll_thread_table[MAX_THREADS]; volatile LONG GC_max_thread_index = 0; /* Largest index in dll_thread_table */ /* that was ever used. */ /* And now the version used if GC_win32_dll_threads is not set. */ /* This is a chained hash table, with much of the code borrowed */ /* From the Posix implementation. */ # define THREAD_TABLE_SZ 256 /* Must be power of 2 */ GC_thread GC_threads[THREAD_TABLE_SZ]; /* Add a thread to GC_threads. We assume it wasn't already there. */ /* Caller holds allocation lock. */ /* Unlike the pthreads version, the id field is set by the caller. */ GC_thread GC_new_thread(DWORD id) { word hv = ((word)id) % THREAD_TABLE_SZ; GC_thread result; /* It may not be safe to allocate when we register the first thread. */ static struct GC_Thread_Rep first_thread; static GC_bool first_thread_used = FALSE; GC_ASSERT(I_HOLD_LOCK()); if (!first_thread_used) { result = &first_thread; first_thread_used = TRUE; } else { GC_ASSERT(!GC_win32_dll_threads); result = (struct GC_Thread_Rep *) GC_INTERNAL_MALLOC(sizeof(struct GC_Thread_Rep), NORMAL); # ifdef GC_PTHREADS /* result can be NULL -> segfault */ GC_ASSERT(result -> flags == 0); # endif } if (result == 0) return(0); /* result -> id = id; Done by caller. */ result -> next = GC_threads[hv]; GC_threads[hv] = result; # ifdef GC_PTHREADS GC_ASSERT(result -> flags == 0 /* && result -> thread_blocked == 0 */); # endif return(result); } extern LONG WINAPI GC_write_fault_handler(struct _EXCEPTION_POINTERS *exc_info); #if defined(GWW_VDB) && defined(MPROTECT_VDB) extern GC_bool GC_gww_dirty_init(void); /* Defined in os_dep.c. Returns TRUE if GetWriteWatch is available. */ /* may be called repeatedly. */ #endif GC_bool GC_in_thread_creation = FALSE; /* Protected by allocation lock. */ /* * This may be called from DllMain, and hence operates under unusual * constraints. In particular, it must be lock-free if GC_win32_dll_threads * is set. Always called from the thread being added. * If GC_win32_dll_threads is not set, we already hold the allocation lock, * except possibly during single-threaded start-up code. */ static GC_thread GC_register_my_thread_inner(struct GC_stack_base *sb, DWORD thread_id) { GC_vthread me; /* The following should be a noop according to the win32 */ /* documentation. There is empirical evidence that it */ /* isn't. - HB */ # if defined(MPROTECT_VDB) # if defined(GWW_VDB) if (GC_incremental && !GC_gww_dirty_init()) SetUnhandledExceptionFilter(GC_write_fault_handler); # else if (GC_incremental) SetUnhandledExceptionFilter(GC_write_fault_handler); # endif # endif if (GC_win32_dll_threads) { int i; /* It appears to be unsafe to acquire a lock here, since this */ /* code is apparently not preeemptible on some systems. */ /* (This is based on complaints, not on Microsoft's official */ /* documentation, which says this should perform "only simple */ /* initialization tasks".) */ /* Hence we make do with nonblocking synchronization. */ /* It has been claimed that DllMain is really only executed with */ /* a particular system lock held, and thus careful use of locking */ /* around code that doesn't call back into the system libraries */ /* might be OK. But this hasn't been tested across all win32 */ /* variants. */ /* cast away volatile qualifier */ for (i = 0; InterlockedExchange((IE_t)&dll_thread_table[i].in_use,1) != 0; i++) { /* Compare-and-swap would make this cleaner, but that's not */ /* supported before Windows 98 and NT 4.0. In Windows 2000, */ /* InterlockedExchange is supposed to be replaced by */ /* InterlockedExchangePointer, but that's not really what I */ /* want here. */ /* FIXME: We should eventually declare Win95 dead and use AO_ */ /* primitives here. */ if (i == MAX_THREADS - 1) ABORT("too many threads"); } /* Update GC_max_thread_index if necessary. The following is safe, */ /* and unlike CompareExchange-based solutions seems to work on all */ /* Windows95 and later platforms. */ /* Unfortunately, GC_max_thread_index may be temporarily out of */ /* bounds, so readers have to compensate. */ while (i > GC_max_thread_index) { InterlockedIncrement((IE_t)&GC_max_thread_index); } if (GC_max_thread_index >= MAX_THREADS) { /* We overshot due to simultaneous increments. */ /* Setting it to MAX_THREADS-1 is always safe. */ GC_max_thread_index = MAX_THREADS - 1; } me = dll_thread_table + i; } else /* Not using DllMain */ { GC_ASSERT(I_HOLD_LOCK()); GC_in_thread_creation = TRUE; /* OK to collect from unknown thread. */ me = GC_new_thread(thread_id); GC_in_thread_creation = FALSE; } # ifdef GC_PTHREADS /* me can be NULL -> segfault */ me -> pthread_id = pthread_self(); # endif if (!DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), (HANDLE*)&(me -> handle), 0, 0, DUPLICATE_SAME_ACCESS)) { DWORD last_error = GetLastError(); GC_err_printf("Last error code: %d\n", last_error); ABORT("DuplicateHandle failed"); } me -> stack_base = sb -> mem_base; /* Up until this point, GC_push_all_stacks considers this thread */ /* invalid. */ /* Up until this point, this entry is viewed as reserved but invalid */ /* by GC_delete_thread. */ me -> id = thread_id; # if defined(THREAD_LOCAL_ALLOC) GC_init_thread_local((GC_tlfs)(&(me->tlfs))); # endif if (me -> stack_base == NULL) ABORT("Bad stack base in GC_register_my_thread_inner"); if (GC_win32_dll_threads) { if (GC_please_stop) { AO_store(&GC_attached_thread, TRUE); AO_nop_full(); // Later updates must become visible after this. } /* We'd like to wait here, but can't, since waiting in DllMain */ /* provokes deadlocks. */ /* Thus we force marking to be restarted instead. */ } else { GC_ASSERT(!GC_please_stop); /* Otherwise both we and the thread stopping code would be */ /* holding the allocation lock. */ } return (GC_thread)(me); } /* * GC_max_thread_index may temporarily be larger than MAX_THREADS. * To avoid subscript errors, we check on access. */ #ifdef __GNUC__ __inline__ #endif LONG GC_get_max_thread_index() { LONG my_max = GC_max_thread_index; if (my_max >= MAX_THREADS) return MAX_THREADS-1; return my_max; } /* Return the GC_thread corresponding to a thread id. May be called */ /* without a lock, but should be called in contexts in which the */ /* requested thread cannot be asynchronously deleted, e.g. from the */ /* thread itself. */ /* This version assumes that either GC_win32_dll_threads is set, or */ /* we hold the allocator lock. */ /* Also used (for assertion checking only) from thread_local_alloc.c. */ GC_thread GC_lookup_thread_inner(DWORD thread_id) { if (GC_win32_dll_threads) { int i; LONG my_max = GC_get_max_thread_index(); for (i = 0; i <= my_max && (!AO_load_acquire(&(dll_thread_table[i].in_use)) || dll_thread_table[i].id != thread_id); /* Must still be in_use, since nobody else can store our thread_id. */ i++) {} if (i > my_max) { return 0; } else { return (GC_thread)(dll_thread_table + i); } } else { word hv = ((word)thread_id) % THREAD_TABLE_SZ; register GC_thread p = GC_threads[hv]; GC_ASSERT(I_HOLD_LOCK()); while (p != 0 && p -> id != thread_id) p = p -> next; return(p); } } /* A version of the above that acquires the lock if necessary. Note */ /* that the identically named function for pthreads is different, and */ /* just assumes we hold the lock. */ /* Also used (for assertion checking only) from thread_local_alloc.c. */ static GC_thread GC_lookup_thread(DWORD thread_id) { if (GC_win32_dll_threads) { return GC_lookup_thread_inner(thread_id); } else { GC_thread result; LOCK(); result = GC_lookup_thread_inner(thread_id); UNLOCK(); return result; } } /* If a thread has been joined, but we have not yet */ /* been notified, then there may be more than one thread */ /* in the table with the same win32 id. */ /* This is OK, but we need a way to delete a specific one. */ /* Assumes we hold the allocation lock unless */ /* GC_win32_dll_threads is set. */ /* If GC_win32_dll_threads is set it should be called from the */ /* thread being deleted. */ void GC_delete_gc_thread(GC_vthread gc_id) { if (GC_win32_dll_threads) { /* This is intended to be lock-free. */ /* It is either called synchronously from the thread being deleted, */ /* or by the joining thread. */ /* In this branch asynchronosu changes to *gc_id are possible. */ CloseHandle(gc_id->handle); gc_id -> stack_base = 0; gc_id -> id = 0; # ifdef CYGWIN32 gc_id -> pthread_id = 0; # endif /* CYGWIN32 */ # ifdef GC_WIN32_PTHREADS gc_id -> pthread_id.p = NULL; # endif /* GC_WIN32_PTHREADS */ AO_store_release(&(gc_id->in_use), FALSE); } else { /* Cast away volatile qualifier, since we have lock. */ GC_thread gc_nvid = (GC_thread)gc_id; DWORD id = gc_nvid -> id; word hv = ((word)id) % THREAD_TABLE_SZ; register GC_thread p = GC_threads[hv]; register GC_thread prev = 0; GC_ASSERT(I_HOLD_LOCK()); while (p != gc_nvid) { prev = p; p = p -> next; } if (prev == 0) { GC_threads[hv] = p -> next; } else { prev -> next = p -> next; } GC_INTERNAL_FREE(p); } } /* Delete a thread from GC_threads. We assume it is there. */ /* (The code intentionally traps if it wasn't.) */ /* Assumes we hold the allocation lock unless */ /* GC_win32_dll_threads is set. */ /* If GC_win32_dll_threads is set it should be called from the */ /* thread being deleted. */ void GC_delete_thread(DWORD id) { if (GC_win32_dll_threads) { GC_thread t = GC_lookup_thread_inner(id); if (0 == t) { WARN("Removing nonexistent thread %ld\n", (GC_word)id); } else { GC_delete_gc_thread(t); } } else { word hv = ((word)id) % THREAD_TABLE_SZ; register GC_thread p = GC_threads[hv]; register GC_thread prev = 0; GC_ASSERT(I_HOLD_LOCK()); while (p -> id != id) { prev = p; p = p -> next; } if (prev == 0) { GC_threads[hv] = p -> next; } else { prev -> next = p -> next; } GC_INTERNAL_FREE(p); } } int GC_register_my_thread(struct GC_stack_base *sb) { DWORD t = GetCurrentThreadId(); if (0 == GC_lookup_thread(t)) { /* We lock here, since we want to wait for an ongoing GC. */ LOCK(); GC_register_my_thread_inner(sb, t); UNLOCK(); return GC_SUCCESS; } else { return GC_DUPLICATE; } } int GC_unregister_my_thread(void) { DWORD t = GetCurrentThreadId(); # if defined(THREAD_LOCAL_ALLOC) LOCK(); { GC_thread me = GC_lookup_thread_inner(t); GC_destroy_thread_local(&(me->tlfs)); } UNLOCK(); # endif if (GC_win32_dll_threads) { /* Should we just ignore this? */ GC_delete_thread(t); } else { LOCK(); GC_delete_thread(t); UNLOCK(); } return GC_SUCCESS; } #ifdef GC_PTHREADS /* A quick-and-dirty cache of the mapping between pthread_t */ /* and win32 thread id. */ #define PTHREAD_MAP_SIZE 512 DWORD GC_pthread_map_cache[PTHREAD_MAP_SIZE]; #define HASH(pthread_id) ((NUMERIC_THREAD_ID(pthread_id) >> 5) % PTHREAD_MAP_SIZE) /* It appears pthread_t is really a pointer type ... */ #define SET_PTHREAD_MAP_CACHE(pthread_id, win32_id) \ GC_pthread_map_cache[HASH(pthread_id)] = (win32_id); #define GET_PTHREAD_MAP_CACHE(pthread_id) \ GC_pthread_map_cache[HASH(pthread_id)] /* Return a GC_thread corresponding to a given pthread_t. */ /* Returns 0 if it's not there. */ /* We assume that this is only called for pthread ids that */ /* have not yet terminated or are still joinable, and */ /* cannot be concurrently terminated. */ /* Assumes we do NOT hold the allocation lock. */ static GC_thread GC_lookup_pthread(pthread_t id) { if (GC_win32_dll_threads) { int i; LONG my_max = GC_get_max_thread_index(); for (i = 0; i <= my_max && (!AO_load_acquire(&(dll_thread_table[i].in_use)) || THREAD_EQUAL(dll_thread_table[i].pthread_id, id)); /* Must still be in_use, since nobody else can store our thread_id. */ i++); if (i > my_max) return 0; return (GC_thread)(dll_thread_table + i); } else { /* We first try the cache. If that fails, we use a very slow */ /* approach. */ int hv_guess = GET_PTHREAD_MAP_CACHE(id) % THREAD_TABLE_SZ; int hv; GC_thread p; LOCK(); for (p = GC_threads[hv_guess]; 0 != p; p = p -> next) { if (THREAD_EQUAL(p -> pthread_id, id)) goto foundit; } for (hv = 0; hv < THREAD_TABLE_SZ; ++hv) { for (p = GC_threads[hv]; 0 != p; p = p -> next) { if (THREAD_EQUAL(p -> pthread_id, id)) goto foundit; } } p = 0; foundit: UNLOCK(); return p; } } #endif /* GC_PTHREADS */ void GC_push_thread_structures(void) { GC_ASSERT(I_HOLD_LOCK()); if (GC_win32_dll_threads) { /* Unlike the other threads implementations, the thread table here */ /* contains no pointers to the collectable heap. Thus we have */ /* no private structures we need to preserve. */ # ifdef GC_PTHREADS { int i; /* pthreads may keep a pointer in the thread exit value */ LONG my_max = GC_get_max_thread_index(); for (i = 0; i <= my_max; i++) if (dll_thread_table[i].in_use) GC_push_all((ptr_t)&(dll_thread_table[i].status), (ptr_t)(&(dll_thread_table[i].status)+1)); } # endif } else { GC_push_all((ptr_t)(GC_threads), (ptr_t)(GC_threads)+sizeof(GC_threads)); } # if defined(THREAD_LOCAL_ALLOC) GC_push_all((ptr_t)(&GC_thread_key), (ptr_t)(&GC_thread_key)+sizeof(&GC_thread_key)); /* Just in case we ever use our own TLS implementation. */ # endif } /* Suspend the given thread, if it's still active. */ void GC_suspend(GC_thread t) { # ifdef MSWINCE /* SuspendThread will fail if thread is running kernel code */ while (SuspendThread(t -> handle) == (DWORD)-1) Sleep(10); # else /* Apparently the Windows 95 GetOpenFileName call creates */ /* a thread that does not properly get cleaned up, and */ /* SuspendThread on its descriptor may provoke a crash. */ /* This reduces the probability of that event, though it still */ /* appears there's a race here. */ DWORD exitCode; if (GetExitCodeThread(t -> handle, &exitCode) && exitCode != STILL_ACTIVE) { t -> stack_base = 0; /* prevent stack from being pushed */ # ifndef GC_PTHREADS /* this breaks pthread_join on Cygwin, which is guaranteed to */ /* only see user pthreads */ AO_store(&(t -> in_use), FALSE); CloseHandle(t -> handle); # endif return; } if (SuspendThread(t -> handle) == (DWORD)-1) ABORT("SuspendThread failed"); # endif t -> suspended = TRUE; } /* Defined in misc.c */ #ifndef CYGWIN32 extern CRITICAL_SECTION GC_write_cs; #endif void GC_stop_world(void) { DWORD thread_id = GetCurrentThreadId(); int i; if (!GC_thr_initialized) ABORT("GC_stop_world() called before GC_thr_init()"); GC_ASSERT(I_HOLD_LOCK()); GC_please_stop = TRUE; # ifndef CYGWIN32 EnterCriticalSection(&GC_write_cs); # endif if (GC_win32_dll_threads) { /* Any threads being created during this loop will end up setting */ /* GC_attached_thread when they start. This will force marking to */ /* restart. */ /* This is not ideal, but hopefully correct. */ GC_attached_thread = FALSE; for (i = 0; i <= GC_get_max_thread_index(); i++) { GC_vthread t = dll_thread_table + i; if (t -> stack_base != 0 && t -> id != thread_id) { GC_suspend((GC_thread)t); } } } else { GC_thread t; int i; for (i = 0; i < THREAD_TABLE_SZ; i++) { for (t = GC_threads[i]; t != 0; t = t -> next) { if (t -> stack_base != 0 && !KNOWN_FINISHED(t) && t -> id != thread_id) { GC_suspend(t); } } } } # ifndef CYGWIN32 LeaveCriticalSection(&GC_write_cs); # endif } void GC_start_world(void) { DWORD thread_id = GetCurrentThreadId(); int i; LONG my_max = GC_get_max_thread_index(); GC_ASSERT(I_HOLD_LOCK()); if (GC_win32_dll_threads) { for (i = 0; i <= my_max; i++) { GC_thread t = (GC_thread)(dll_thread_table + i); if (t -> stack_base != 0 && t -> suspended && t -> id != thread_id) { if (ResumeThread(t -> handle) == (DWORD)-1) ABORT("ResumeThread failed"); t -> suspended = FALSE; } } } else { GC_thread t; int i; for (i = 0; i < THREAD_TABLE_SZ; i++) { for (t = GC_threads[i]; t != 0; t = t -> next) { if (t -> stack_base != 0 && t -> suspended && t -> id != thread_id) { if (ResumeThread(t -> handle) == (DWORD)-1) ABORT("ResumeThread failed"); t -> suspended = FALSE; } } } } GC_please_stop = FALSE; } # ifdef MSWINCE /* The VirtualQuery calls below won't work properly on WinCE, but */ /* since each stack is restricted to an aligned 64K region of */ /* virtual memory we can just take the next lowest multiple of 64K. */ # define GC_get_stack_min(s) \ ((ptr_t)(((DWORD)(s) - 1) & 0xFFFF0000)) # else static ptr_t GC_get_stack_min(ptr_t s) { ptr_t bottom; MEMORY_BASIC_INFORMATION info; VirtualQuery(s, &info, sizeof(info)); do { bottom = info.BaseAddress; VirtualQuery(bottom - 1, &info, sizeof(info)); } while ((info.Protect & PAGE_READWRITE) && !(info.Protect & PAGE_GUARD)); return(bottom); } # endif void GC_push_stack_for(GC_thread thread) { int dummy; ptr_t sp, stack_min; DWORD me = GetCurrentThreadId(); if (thread -> stack_base) { if (thread -> id == me) { sp = (ptr_t) &dummy; } else { CONTEXT context; context.ContextFlags = CONTEXT_INTEGER|CONTEXT_CONTROL; if (!GetThreadContext(thread -> handle, &context)) ABORT("GetThreadContext failed"); /* Push all registers that might point into the heap. Frame */ /* pointer registers are included in case client code was */ /* compiled with the 'omit frame pointer' optimisation. */ # define PUSH1(reg) GC_push_one((word)context.reg) # define PUSH2(r1,r2) PUSH1(r1), PUSH1(r2) # define PUSH4(r1,r2,r3,r4) PUSH2(r1,r2), PUSH2(r3,r4) # if defined(I386) PUSH4(Edi,Esi,Ebx,Edx), PUSH2(Ecx,Eax), PUSH1(Ebp); sp = (ptr_t)context.Esp; # elif defined(X86_64) PUSH4(Rax,Rcx,Rdx,Rbx); PUSH2(Rbp, Rsi); PUSH1(Rdi); PUSH4(R8, R9, R10, R11); PUSH4(R12, R13, R14, R15); sp = (ptr_t)context.Rsp; # elif defined(ARM32) PUSH4(R0,R1,R2,R3),PUSH4(R4,R5,R6,R7),PUSH4(R8,R9,R10,R11),PUSH1(R12); sp = (ptr_t)context.Sp; # elif defined(SHx) PUSH4(R0,R1,R2,R3), PUSH4(R4,R5,R6,R7), PUSH4(R8,R9,R10,R11); PUSH2(R12,R13), PUSH1(R14); sp = (ptr_t)context.R15; # elif defined(MIPS) PUSH4(IntAt,IntV0,IntV1,IntA0), PUSH4(IntA1,IntA2,IntA3,IntT0); PUSH4(IntT1,IntT2,IntT3,IntT4), PUSH4(IntT5,IntT6,IntT7,IntS0); PUSH4(IntS1,IntS2,IntS3,IntS4), PUSH4(IntS5,IntS6,IntS7,IntT8); PUSH4(IntT9,IntK0,IntK1,IntS8); sp = (ptr_t)context.IntSp; # elif defined(PPC) PUSH4(Gpr0, Gpr3, Gpr4, Gpr5), PUSH4(Gpr6, Gpr7, Gpr8, Gpr9); PUSH4(Gpr10,Gpr11,Gpr12,Gpr14), PUSH4(Gpr15,Gpr16,Gpr17,Gpr18); PUSH4(Gpr19,Gpr20,Gpr21,Gpr22), PUSH4(Gpr23,Gpr24,Gpr25,Gpr26); PUSH4(Gpr27,Gpr28,Gpr29,Gpr30), PUSH1(Gpr31); sp = (ptr_t)context.Gpr1; # elif defined(ALPHA) PUSH4(IntV0,IntT0,IntT1,IntT2), PUSH4(IntT3,IntT4,IntT5,IntT6); PUSH4(IntT7,IntS0,IntS1,IntS2), PUSH4(IntS3,IntS4,IntS5,IntFp); PUSH4(IntA0,IntA1,IntA2,IntA3), PUSH4(IntA4,IntA5,IntT8,IntT9); PUSH4(IntT10,IntT11,IntT12,IntAt); sp = (ptr_t)context.IntSp; # else # error "architecture is not supported" # endif } /* ! current thread */ stack_min = GC_get_stack_min(thread->stack_base); if (sp >= stack_min && sp < thread->stack_base) { # if DEBUG_WIN32_PTHREADS || DEBUG_WIN32_THREADS \ || DEBUG_CYGWIN_THREADS GC_printf("Pushing thread from %p to %p for 0x%x from 0x%x\n", sp, thread -> stack_base, thread -> id, me); # endif GC_push_all_stack(sp, thread->stack_base); } else { WARN("Thread stack pointer 0x%lx out of range, pushing everything\n", (unsigned long)(size_t)sp); GC_push_all_stack(stack_min, thread->stack_base); } } /* thread looks live */ } void GC_push_all_stacks(void) { DWORD me = GetCurrentThreadId(); GC_bool found_me = FALSE; size_t nthreads = 0; if (GC_win32_dll_threads) { int i; LONG my_max = GC_get_max_thread_index(); for (i = 0; i <= my_max; i++) { GC_thread t = (GC_thread)(dll_thread_table + i); if (t -> in_use) { ++nthreads; GC_push_stack_for(t); if (t -> id == me) found_me = TRUE; } } } else { GC_thread t; int i; for (i = 0; i < THREAD_TABLE_SZ; i++) { for (t = GC_threads[i]; t != 0; t = t -> next) { ++nthreads; if (!KNOWN_FINISHED(t)) GC_push_stack_for(t); if (t -> id == me) found_me = TRUE; } } } if (GC_print_stats == VERBOSE) { GC_log_printf("Pushed %d thread stacks ", nthreads); if (GC_win32_dll_threads) { GC_log_printf("based on DllMain thread tracking\n"); } else { GC_log_printf("\n"); } } if (!found_me && !GC_in_thread_creation) ABORT("Collecting from unknown thread."); } void GC_get_next_stack(char *start, char **lo, char **hi) { int i; # define ADDR_LIMIT (char *)(-1L) char * current_min = ADDR_LIMIT; if (GC_win32_dll_threads) { LONG my_max = GC_get_max_thread_index(); for (i = 0; i <= my_max; i++) { ptr_t s = (ptr_t)(dll_thread_table[i].stack_base); if (0 != s && s > start && s < current_min) { current_min = s; } } } else { for (i = 0; i < THREAD_TABLE_SZ; i++) { GC_thread t; for (t = GC_threads[i]; t != 0; t = t -> next) { ptr_t s = (ptr_t)(t -> stack_base); if (0 != s && s > start && s < current_min) { current_min = s; } } } } *hi = current_min; if (current_min == ADDR_LIMIT) { *lo = ADDR_LIMIT; return; } *lo = GC_get_stack_min(current_min); if (*lo < start) *lo = start; } #ifndef GC_PTHREADS /* We have no DllMain to take care of new threads. Thus we */ /* must properly intercept thread creation. */ typedef struct { LPTHREAD_START_ROUTINE start; LPVOID param; } thread_args; static DWORD WINAPI thread_start(LPVOID arg); void * GC_win32_start_inner(struct GC_stack_base *sb, LPVOID arg) { void * ret; thread_args *args = (thread_args *)arg; # if DEBUG_WIN32_THREADS GC_printf("thread 0x%x starting...\n", GetCurrentThreadId()); # endif GC_register_my_thread(sb); /* This waits for an in-progress GC. */ /* Clear the thread entry even if we exit with an exception. */ /* This is probably pointless, since an uncaught exception is */ /* supposed to result in the process being killed. */ #ifndef __GNUC__ __try { #endif /* __GNUC__ */ ret = (void *)(size_t)args->start (args->param); #ifndef __GNUC__ } __finally { #endif /* __GNUC__ */ GC_unregister_my_thread(); GC_free(args); #ifndef __GNUC__ } #endif /* __GNUC__ */ # if DEBUG_WIN32_THREADS GC_printf("thread 0x%x returned from start routine.\n", GetCurrentThreadId()); # endif return ret; } DWORD WINAPI GC_win32_start(LPVOID arg) { return (DWORD)(size_t)GC_call_with_stack_base(GC_win32_start_inner, arg); } GC_API HANDLE WINAPI GC_CreateThread( LPSECURITY_ATTRIBUTES lpThreadAttributes, DWORD dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId ) { HANDLE thread_h = NULL; thread_args *args; if (!parallel_initialized) GC_init_parallel(); /* make sure GC is initialized (i.e. main thread is attached, tls initialized) */ # if DEBUG_WIN32_THREADS GC_printf("About to create a thread from 0x%x\n", GetCurrentThreadId()); # endif if (GC_win32_dll_threads) { return CreateThread(lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId); } else { args = GC_malloc_uncollectable(sizeof(thread_args)); /* Handed off to and deallocated by child thread. */ if (0 == args) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); return NULL; } /* set up thread arguments */ args -> start = lpStartAddress; args -> param = lpParameter; GC_need_to_lock = TRUE; thread_h = CreateThread(lpThreadAttributes, dwStackSize, GC_win32_start, args, dwCreationFlags, lpThreadId); if( thread_h == 0 ) GC_free( args ); return thread_h; } } void WINAPI GC_ExitThread(DWORD dwExitCode) { GC_unregister_my_thread(); ExitThread(dwExitCode); } uintptr_t GC_beginthreadex( void *security, unsigned stack_size, unsigned ( __stdcall *start_address )( void * ), void *arglist, unsigned initflag, unsigned *thrdaddr) { uintptr_t thread_h = -1L; thread_args *args; if (!parallel_initialized) GC_init_parallel(); /* make sure GC is initialized (i.e. main thread is attached, tls initialized) */ # if DEBUG_WIN32_THREADS GC_printf("About to create a thread from 0x%x\n", GetCurrentThreadId()); # endif if (GC_win32_dll_threads) { return _beginthreadex(security, stack_size, start_address, arglist, initflag, thrdaddr); } else { args = GC_malloc_uncollectable(sizeof(thread_args)); /* Handed off to and deallocated by child thread. */ if (0 == args) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); return (uintptr_t)(-1); } /* set up thread arguments */ args -> start = (LPTHREAD_START_ROUTINE)start_address; args -> param = arglist; GC_need_to_lock = TRUE; thread_h = _beginthreadex(security, stack_size, (unsigned (__stdcall *) (void *))GC_win32_start, args, initflag, thrdaddr); if( thread_h == 0 ) GC_free( args ); return thread_h; } } void GC_endthreadex(unsigned retval) { GC_unregister_my_thread(); _endthreadex(retval); } #endif /* !GC_PTHREADS */ #ifdef MSWINCE typedef struct { HINSTANCE hInstance; HINSTANCE hPrevInstance; LPWSTR lpCmdLine; int nShowCmd; } main_thread_args; DWORD WINAPI main_thread_start(LPVOID arg); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd) { DWORD exit_code = 1; main_thread_args args = { hInstance, hPrevInstance, lpCmdLine, nShowCmd }; HANDLE thread_h; DWORD thread_id; /* initialize everything */ GC_init(); /* start the main thread */ thread_h = GC_CreateThread( NULL, 0, main_thread_start, &args, 0, &thread_id); if (thread_h != NULL) { WaitForSingleObject (thread_h, INFINITE); GetExitCodeThread (thread_h, &exit_code); CloseHandle (thread_h); } GC_deinit(); DeleteCriticalSection(&GC_allocate_ml); return (int) exit_code; } DWORD WINAPI main_thread_start(LPVOID arg) { main_thread_args * args = (main_thread_args *) arg; return (DWORD) GC_WinMain (args->hInstance, args->hPrevInstance, args->lpCmdLine, args->nShowCmd); } # else /* !MSWINCE */ /* Called by GC_init() - we hold the allocation lock. */ void GC_thr_init(void) { struct GC_stack_base sb; int sb_result; GC_ASSERT(I_HOLD_LOCK()); if (GC_thr_initialized) return; GC_main_thread = GetCurrentThreadId(); GC_thr_initialized = TRUE; /* Add the initial thread, so we can stop it. */ sb_result = GC_get_stack_base(&sb); GC_ASSERT(sb_result == GC_SUCCESS); GC_register_my_thread(&sb); } #ifdef GC_PTHREADS struct start_info { void *(*start_routine)(void *); void *arg; GC_bool detached; }; int GC_pthread_join(pthread_t pthread_id, void **retval) { int result; int i; GC_thread joinee; # if DEBUG_CYGWIN_THREADS GC_printf("thread 0x%x(0x%x) is joining thread 0x%x.\n", (int)pthread_self(), GetCurrentThreadId(), (int)pthread_id); # endif # if DEBUG_WIN32_PTHREADS GC_printf("thread 0x%x(0x%x) is joining thread 0x%x.\n", (int)(pthread_self()).p, GetCurrentThreadId(), pthread_id.p); # endif if (!parallel_initialized) GC_init_parallel(); /* Thread being joined might not have registered itself yet. */ /* After the join,thread id may have been recycled. */ /* FIXME: It would be better if this worked more like */ /* pthread_support.c. */ #ifndef GC_WIN32_PTHREADS while ((joinee = GC_lookup_pthread(pthread_id)) == 0) Sleep(10); #endif result = pthread_join(pthread_id, retval); #ifdef GC_WIN32_PTHREADS /* win32_pthreads id are unique */ joinee = GC_lookup_pthread(pthread_id); #endif if (!GC_win32_dll_threads) { LOCK(); GC_delete_gc_thread(joinee); UNLOCK(); } /* otherwise dllmain handles it. */ # if DEBUG_CYGWIN_THREADS GC_printf("thread 0x%x(0x%x) completed join with thread 0x%x.\n", (int)pthread_self(), GetCurrentThreadId(), (int)pthread_id); # endif # if DEBUG_WIN32_PTHREADS GC_printf("thread 0x%x(0x%x) completed join with thread 0x%x.\n", (int)(pthread_self()).p, GetCurrentThreadId(), pthread_id.p); # endif return result; } /* Cygwin-pthreads calls CreateThread internally, but it's not * easily interceptible by us.. * so intercept pthread_create instead */ int GC_pthread_create(pthread_t *new_thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg) { int result; struct start_info * si; if (!parallel_initialized) GC_init_parallel(); /* make sure GC is initialized (i.e. main thread is attached) */ if (GC_win32_dll_threads) { return pthread_create(new_thread, attr, start_routine, arg); } /* This is otherwise saved only in an area mmapped by the thread */ /* library, which isn't visible to the collector. */ si = GC_malloc_uncollectable(sizeof(struct start_info)); if (0 == si) return(EAGAIN); si -> start_routine = start_routine; si -> arg = arg; if (attr != 0 && pthread_attr_getdetachstate(attr, &si->detached) == PTHREAD_CREATE_DETACHED) { si->detached = TRUE; } # if DEBUG_CYGWIN_THREADS GC_printf("About to create a thread from 0x%x(0x%x)\n", (int)pthread_self(), GetCurrentThreadId); # endif # if DEBUG_WIN32_PTHREADS GC_printf("About to create a thread from 0x%x(0x%x)\n", (int)(pthread_self()).p, GetCurrentThreadId()); # endif GC_need_to_lock = TRUE; result = pthread_create(new_thread, attr, GC_pthread_start, si); if (result) { /* failure */ GC_free(si); } return(result); } void * GC_pthread_start_inner(struct GC_stack_base *sb, void * arg) { struct start_info * si = arg; void * result; void *(*start)(void *); void *start_arg; DWORD thread_id = GetCurrentThreadId(); pthread_t pthread_id = pthread_self(); GC_thread me; GC_bool detached; int i; # if DEBUG_CYGWIN_THREADS GC_printf("thread 0x%x(0x%x) starting...\n",(int)pthread_id, thread_id); # endif # if DEBUG_WIN32_PTHREADS GC_printf("thread 0x%x(0x%x) starting...\n",(int) pthread_id.p, thread_id); # endif GC_ASSERT(!GC_win32_dll_threads); /* If a GC occurs before the thread is registered, that GC will */ /* ignore this thread. That's fine, since it will block trying to */ /* acquire the allocation lock, and won't yet hold interesting */ /* pointers. */ LOCK(); /* We register the thread here instead of in the parent, so that */ /* we don't need to hold the allocation lock during pthread_create. */ me = GC_register_my_thread_inner(sb, thread_id); SET_PTHREAD_MAP_CACHE(pthread_id, thread_id); UNLOCK(); start = si -> start_routine; start_arg = si -> arg; if (si-> detached) me -> flags |= DETACHED; me -> pthread_id = pthread_id; GC_free(si); /* was allocated uncollectable */ pthread_cleanup_push(GC_thread_exit_proc, (void *)me); result = (*start)(start_arg); me -> status = result; pthread_cleanup_pop(1); # if DEBUG_CYGWIN_THREADS GC_printf("thread 0x%x(0x%x) returned from start routine.\n", (int)pthread_self(),GetCurrentThreadId()); # endif # if DEBUG_WIN32_PTHREADS GC_printf("thread 0x%x(0x%x) returned from start routine.\n", (int)(pthread_self()).p, GetCurrentThreadId()); # endif return(result); } void * GC_pthread_start(void * arg) { return GC_call_with_stack_base(GC_pthread_start_inner, arg); } void GC_thread_exit_proc(void *arg) { GC_thread me = (GC_thread)arg; int i; GC_ASSERT(!GC_win32_dll_threads); # if DEBUG_CYGWIN_THREADS GC_printf("thread 0x%x(0x%x) called pthread_exit().\n", (int)pthread_self(),GetCurrentThreadId()); # endif # if DEBUG_WIN32_PTHREADS GC_printf("thread 0x%x(0x%x) called pthread_exit().\n", (int)(pthread_self()).p,GetCurrentThreadId()); # endif LOCK(); # if defined(THREAD_LOCAL_ALLOC) GC_destroy_thread_local(&(me->tlfs)); # endif if (me -> flags & DETACHED) { GC_delete_thread(GetCurrentThreadId()); } else { /* deallocate it as part of join */ me -> flags |= FINISHED; } UNLOCK(); } #ifndef GC_WIN32_PTHREADS /* win32 pthread does not support sigmask */ /* nothing required here... */ int GC_pthread_sigmask(int how, const sigset_t *set, sigset_t *oset) { if (!parallel_initialized) GC_init_parallel(); return pthread_sigmask(how, set, oset); } #endif int GC_pthread_detach(pthread_t thread) { int result; GC_thread thread_gc_id; if (!parallel_initialized) GC_init_parallel(); LOCK(); thread_gc_id = GC_lookup_pthread(thread); UNLOCK(); result = pthread_detach(thread); if (result == 0) { LOCK(); thread_gc_id -> flags |= DETACHED; /* Here the pthread thread id may have been recycled. */ if (thread_gc_id -> flags & FINISHED) { GC_delete_gc_thread(thread_gc_id); } UNLOCK(); } return result; } #else /* !GC_PTHREADS */ /* * We avoid acquiring locks here, since this doesn't seem to be preemptable. * This may run with an uninitialized collector, in which case we don't do much. * This implies that no threads other than the main one should be created * with an uninitialized collector. (The alternative of initializing * the collector here seems dangerous, since DllMain is limited in what it * can do.) */ #ifdef GC_DLL GC_API BOOL WINAPI DllMain(HINSTANCE inst, ULONG reason, LPVOID reserved) { struct GC_stack_base sb; DWORD thread_id; int sb_result; static int entry_count = 0; if (parallel_initialized && !GC_win32_dll_threads) return TRUE; switch (reason) { case DLL_THREAD_ATTACH: GC_ASSERT(entry_count == 0 || parallel_initialized); ++entry_count; /* and fall through: */ case DLL_PROCESS_ATTACH: /* This may run with the collector uninitialized. */ thread_id = GetCurrentThreadId(); if (parallel_initialized && GC_main_thread != thread_id) { /* Don't lock here. */ sb_result = GC_get_stack_base(&sb); GC_ASSERT(sb_result == GC_SUCCESS); # ifdef THREAD_LOCAL_ALLOC ABORT("Cannot initialize thread local cache from DllMain"); # endif GC_register_my_thread_inner(&sb, thread_id); } /* o.w. we already did it during GC_thr_init(), called by GC_init() */ break; case DLL_THREAD_DETACH: /* We are hopefully running in the context of the exiting thread. */ GC_ASSERT(parallel_initialized); if (!GC_win32_dll_threads) return TRUE; GC_delete_thread(GetCurrentThreadId()); break; case DLL_PROCESS_DETACH: { int i; if (!GC_win32_dll_threads) return TRUE; for (i = 0; i <= GC_get_max_thread_index(); ++i) { if (AO_load(&(dll_thread_table[i].in_use))) GC_delete_gc_thread(dll_thread_table + i); } GC_deinit(); DeleteCriticalSection(&GC_allocate_ml); } break; } return TRUE; } #endif /* GC_DLL */ #endif /* !GC_PTHREADS */ # endif /* !MSWINCE */ /* Perform all initializations, including those that */ /* may require allocation. */ /* Called without allocation lock. */ /* Must be called before a second thread is created. */ void GC_init_parallel(void) { if (parallel_initialized) return; parallel_initialized = TRUE; /* GC_init() calls us back, so set flag first. */ if (!GC_is_initialized) GC_init(); if (GC_win32_dll_threads) { GC_need_to_lock = TRUE; /* Cannot intercept thread creation. Hence we don't know if other */ /* threads exist. However, client is not allowed to create other */ /* threads before collector initialization. Thus it's OK not to */ /* lock before this. */ } /* Initialize thread local free lists if used. */ # if defined(THREAD_LOCAL_ALLOC) LOCK(); GC_init_thread_local(&(GC_lookup_thread(GetCurrentThreadId())->tlfs)); UNLOCK(); # endif } #if defined(USE_PTHREAD_LOCKS) /* Support for pthread locking code. */ /* Pthread_mutex_try_lock may not win here, */ /* due to builtinsupport for spinning first? */ volatile GC_bool GC_collecting = 0; /* A hint that we're in the collector and */ /* holding the allocation lock for an */ /* extended period. */ void GC_lock(void) { pthread_mutex_lock(&GC_allocate_ml); } #endif /* USE_PTHREAD ... */ # if defined(THREAD_LOCAL_ALLOC) /* Add thread-local allocation support. Microsoft uses __declspec(thread) */ /* We must explicitly mark ptrfree and gcj free lists, since the free */ /* list links wouldn't otherwise be found. We also set them in the */ /* normal free lists, since that involves touching less memory than if */ /* we scanned them normally. */ void GC_mark_thread_local_free_lists(void) { int i; GC_thread p; for (i = 0; i < THREAD_TABLE_SZ; ++i) { for (p = GC_threads[i]; 0 != p; p = p -> next) { GC_mark_thread_local_fls_for(&(p->tlfs)); } } } #if defined(GC_ASSERTIONS) /* Check that all thread-local free-lists are completely marked. */ /* also check that thread-specific-data structures are marked. */ void GC_check_tls(void) { int i; GC_thread p; for (i = 0; i < THREAD_TABLE_SZ; ++i) { for (p = GC_threads[i]; 0 != p; p = p -> next) { GC_check_tls_for(&(p->tlfs)); } } # if defined(USE_CUSTOM_SPECIFIC) if (GC_thread_key != 0) GC_check_tsd_marks(GC_thread_key); # endif } #endif /* GC_ASSERTIONS */ #endif /* THREAD_LOCAL_ALLOC ... */ #endif /* GC_WIN32_THREADS */ synopsis-0.12/src/Synopsis/gc/backgraph.c0000664000076400007640000003557411104702316017765 0ustar stefanstefan/* * Copyright (c) 2001 by Hewlett-Packard Company. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */ /* * This implements a full, though not well-tuned, representation of the * backwards points-to graph. This is used to test for non-GC-robust * data structures; the code is not used during normal garbage collection. * * One restriction is that we drop all back-edges from nodes with very * high in-degree, and simply add them add them to a list of such * nodes. They are then treated as permanent roots. Id this by itself * doesn't introduce a space leak, then such nodes can't contribute to * a growing space leak. */ #ifdef MAKE_BACK_GRAPH #define MAX_IN 10 /* Maximum in-degree we handle directly */ #include "private/dbg_mlc.h" #include #if !defined(DBG_HDRS_ALL) || (ALIGNMENT != CPP_WORDSZ/8) || !defined(UNIX_LIKE) # error Configuration doesnt support MAKE_BACK_GRAPH #endif /* We store single back pointers directly in the object's oh_bg_ptr field. */ /* If there is more than one ptr to an object, we store q | FLAG_MANY, */ /* where q is a pointer to a back_edges object. */ /* Every once in a while we use a back_edges object even for a single */ /* pointer, since we need the other fields in the back_edges structure to */ /* be present in some fraction of the objects. Otherwise we get serious */ /* performance issues. */ #define FLAG_MANY 2 typedef struct back_edges_struct { word n_edges; /* Number of edges, including those in continuation */ /* structures. */ unsigned short flags; # define RETAIN 1 /* Directly points to a reachable object; */ /* retain for next GC. */ unsigned short height_gc_no; /* If height > 0, then the GC_gc_no value when it */ /* was computed. If it was computed this cycle, then */ /* it is current. If it was computed during the */ /* last cycle, then it represents the old height, */ /* which is only saved for live objects referenced by */ /* dead ones. This may grow due to refs from newly */ /* dead objects. */ signed_word height; /* Longest path through unreachable nodes to this node */ /* that we found using depth first search. */ # define HEIGHT_UNKNOWN ((signed_word)(-2)) # define HEIGHT_IN_PROGRESS ((signed_word)(-1)) ptr_t edges[MAX_IN]; struct back_edges_struct *cont; /* Pointer to continuation structure; we use only the */ /* edges field in the continuation. */ /* also used as free list link. */ } back_edges; /* Allocate a new back edge structure. Should be more sophisticated */ /* if this were production code. */ #define MAX_BACK_EDGE_STRUCTS 100000 static back_edges *back_edge_space = 0; int GC_n_back_edge_structs = 0; /* Serves as pointer to never used */ /* back_edges space. */ static back_edges *avail_back_edges = 0; /* Pointer to free list of deallocated */ /* back_edges structures. */ static back_edges * new_back_edges(void) { if (0 == back_edge_space) { back_edge_space = (back_edges *) GET_MEM(MAX_BACK_EDGE_STRUCTS*sizeof(back_edges)); } if (0 != avail_back_edges) { back_edges * result = avail_back_edges; avail_back_edges = result -> cont; result -> cont = 0; return result; } if (GC_n_back_edge_structs >= MAX_BACK_EDGE_STRUCTS - 1) { ABORT("needed too much space for back edges: adjust " "MAX_BACK_EDGE_STRUCTS"); } return back_edge_space + (GC_n_back_edge_structs++); } /* Deallocate p and its associated continuation structures. */ static void deallocate_back_edges(back_edges *p) { back_edges *last = p; while (0 != last -> cont) last = last -> cont; last -> cont = avail_back_edges; avail_back_edges = p; } /* Table of objects that are currently on the depth-first search */ /* stack. Only objects with in-degree one are in this table. */ /* Other objects are identified using HEIGHT_IN_PROGRESS. */ /* FIXME: This data structure NEEDS IMPROVEMENT. */ #define INITIAL_IN_PROGRESS 10000 static ptr_t * in_progress_space = 0; static size_t in_progress_size = 0; static size_t n_in_progress = 0; static void push_in_progress(ptr_t p) { if (n_in_progress >= in_progress_size) if (in_progress_size == 0) { in_progress_size = INITIAL_IN_PROGRESS; in_progress_space = (ptr_t *)GET_MEM(in_progress_size * sizeof(ptr_t)); } else { ptr_t * new_in_progress_space; in_progress_size *= 2; new_in_progress_space = (ptr_t *) GET_MEM(in_progress_size * sizeof(ptr_t)); BCOPY(in_progress_space, new_in_progress_space, n_in_progress * sizeof(ptr_t)); in_progress_space = new_in_progress_space; /* FIXME: This just drops the old space. */ } if (in_progress_space == 0) ABORT("MAKE_BACK_GRAPH: Out of in-progress space: " "Huge linear data structure?"); in_progress_space[n_in_progress++] = p; } static GC_bool is_in_progress(ptr_t p) { int i; for (i = 0; i < n_in_progress; ++i) { if (in_progress_space[i] == p) return TRUE; } return FALSE; } static void pop_in_progress(ptr_t p) { --n_in_progress; GC_ASSERT(in_progress_space[n_in_progress] == p); } #define GET_OH_BG_PTR(p) \ (ptr_t)REVEAL_POINTER(((oh *)(p)) -> oh_bg_ptr) #define SET_OH_BG_PTR(p,q) (((oh *)(p)) -> oh_bg_ptr) = HIDE_POINTER(q) /* Execute s once for each predecessor q of p in the points-to graph. */ /* s should be a bracketed statement. We declare q. */ #define FOR_EACH_PRED(q, p, s) \ { \ ptr_t q = GET_OH_BG_PTR(p); \ if (!((word)q & FLAG_MANY)) { \ if (q && !((word)q & 1)) s \ /* !((word)q & 1) checks for a misnterpreted freelist link */ \ } else { \ back_edges *orig_be_ = (back_edges *)((word)q & ~FLAG_MANY); \ back_edges *be_ = orig_be_; \ int total_, local_; \ int n_edges_ = be_ -> n_edges; \ for (total_ = 0, local_ = 0; total_ < n_edges_; ++local_, ++total_) { \ if (local_ == MAX_IN) { \ be_ = be_ -> cont; \ local_ = 0; \ } \ q = be_ -> edges[local_]; s \ } \ } \ } /* Ensure that p has a back_edges structure associated with it. */ static void ensure_struct(ptr_t p) { ptr_t old_back_ptr = GET_OH_BG_PTR(p); if (!((word)old_back_ptr & FLAG_MANY)) { back_edges *be = new_back_edges(); be -> flags = 0; if (0 == old_back_ptr) { be -> n_edges = 0; } else { be -> n_edges = 1; be -> edges[0] = old_back_ptr; } be -> height = HEIGHT_UNKNOWN; be -> height_gc_no = GC_gc_no - 1; GC_ASSERT(be >= back_edge_space); SET_OH_BG_PTR(p, (word)be | FLAG_MANY); } } /* Add the (forward) edge from p to q to the backward graph. Both p */ /* q are pointers to the object base, i.e. pointers to an oh. */ static void add_edge(ptr_t p, ptr_t q) { ptr_t old_back_ptr = GET_OH_BG_PTR(q); back_edges * be, *be_cont; word i; static unsigned random_number = 13; # define GOT_LUCKY_NUMBER (((++random_number) & 0x7f) == 0) /* A not very random number we use to occasionally allocate a */ /* back_edges structure even for a single backward edge. This */ /* prevents us from repeatedly tracing back through very long */ /* chains, since we will have some place to store height and */ /* in_progress flags along the way. */ GC_ASSERT(p == GC_base(p) && q == GC_base(q)); if (!GC_HAS_DEBUG_INFO(q) || !GC_HAS_DEBUG_INFO(p)) { /* This is really a misinterpreted free list link, since we saw */ /* a pointer to a free list. Dont overwrite it! */ return; } if (0 == old_back_ptr) { SET_OH_BG_PTR(q, p); if (GOT_LUCKY_NUMBER) ensure_struct(q); return; } /* Check whether it was already in the list of predecessors. */ FOR_EACH_PRED(pred, q, { if (p == pred) return; }); ensure_struct(q); old_back_ptr = GET_OH_BG_PTR(q); be = (back_edges *)((word)old_back_ptr & ~FLAG_MANY); for (i = be -> n_edges, be_cont = be; i > MAX_IN; be_cont = be_cont -> cont, i -= MAX_IN) {} if (i == MAX_IN) { be_cont -> cont = new_back_edges(); be_cont = be_cont -> cont; i = 0; } be_cont -> edges[i] = p; be -> n_edges++; if (be -> n_edges == 100) { # if 0 if (GC_print_stats) { GC_err_printf("The following object has in-degree >= 100:\n"); GC_print_heap_obj(q); } # endif } } typedef void (*per_object_func)(ptr_t p, size_t n_bytes, word gc_descr); static void per_object_helper(struct hblk *h, word fn) { hdr * hhdr = HDR(h); size_t sz = hhdr -> hb_sz; word descr = hhdr -> hb_descr; per_object_func f = (per_object_func)fn; int i = 0; do { f((ptr_t)(h -> hb_body + i), sz, descr); i += sz; } while (i + sz <= BYTES_TO_WORDS(HBLKSIZE)); } void GC_apply_to_each_object(per_object_func f) { GC_apply_to_all_blocks(per_object_helper, (word)f); } static void reset_back_edge(ptr_t p, size_t n_bytes, word gc_descr) { /* Skip any free list links, or dropped blocks */ if (GC_HAS_DEBUG_INFO(p)) { ptr_t old_back_ptr = GET_OH_BG_PTR(p); if ((word)old_back_ptr & FLAG_MANY) { back_edges *be = (back_edges *)((word)old_back_ptr & ~FLAG_MANY); if (!(be -> flags & RETAIN)) { deallocate_back_edges(be); SET_OH_BG_PTR(p, 0); } else { word *currentp; GC_ASSERT(GC_is_marked(p)); /* Back edges may point to objects that will not be retained. */ /* Delete them for now, but remember the height. */ /* Some will be added back at next GC. */ be -> n_edges = 0; if (0 != be -> cont) { deallocate_back_edges(be -> cont); be -> cont = 0; } GC_ASSERT(GC_is_marked(p)); /* We only retain things for one GC cycle at a time. */ be -> flags &= ~RETAIN; } } else /* Simple back pointer */ { /* Clear to avoid dangling pointer. */ SET_OH_BG_PTR(p, 0); } } } static void add_back_edges(ptr_t p, size_t n_bytes, word gc_descr) { word *currentp = (word *)(p + sizeof(oh)); /* For now, fix up non-length descriptors conservatively. */ if((gc_descr & GC_DS_TAGS) != GC_DS_LENGTH) { gc_descr = n_bytes; } while (currentp < (word *)(p + gc_descr)) { word current = *currentp++; FIXUP_POINTER(current); if (current >= (word)GC_least_plausible_heap_addr && current <= (word)GC_greatest_plausible_heap_addr) { ptr_t target = GC_base((void *)current); if (0 != target) { add_edge(p, target); } } } } /* Rebuild the representation of the backward reachability graph. */ /* Does not examine mark bits. Can be called before GC. */ void GC_build_back_graph(void) { GC_apply_to_each_object(add_back_edges); } /* Return an approximation to the length of the longest simple path */ /* through unreachable objects to p. We refer to this as the height */ /* of p. */ static word backwards_height(ptr_t p) { word result; ptr_t back_ptr = GET_OH_BG_PTR(p); back_edges *be; if (0 == back_ptr) return 1; if (!((word)back_ptr & FLAG_MANY)) { if (is_in_progress(p)) return 0; /* DFS back edge, i.e. we followed */ /* an edge to an object already */ /* on our stack: ignore */ push_in_progress(p); result = backwards_height(back_ptr)+1; pop_in_progress(p); return result; } be = (back_edges *)((word)back_ptr & ~FLAG_MANY); if (be -> height >= 0 && be -> height_gc_no == GC_gc_no) return be -> height; /* Ignore back edges in DFS */ if (be -> height == HEIGHT_IN_PROGRESS) return 0; result = (be -> height > 0? be -> height : 1); be -> height = HEIGHT_IN_PROGRESS; FOR_EACH_PRED(q, p, { word this_height; if (GC_is_marked(q) && !(FLAG_MANY & (word)GET_OH_BG_PTR(p))) { if (GC_print_stats) GC_log_printf("Found bogus pointer from 0x%lx to 0x%lx\n", q, p); /* Reachable object "points to" unreachable one. */ /* Could be caused by our lax treatment of GC descriptors. */ this_height = 1; } else { this_height = backwards_height(q); } if (this_height >= result) result = this_height + 1; }); be -> height = result; be -> height_gc_no = GC_gc_no; return result; } word GC_max_height; ptr_t GC_deepest_obj; /* Compute the maximum height of every unreachable predecessor p of a */ /* reachable object. Arrange to save the heights of all such objects p */ /* so that they can be used in calculating the height of objects in the */ /* next GC. */ /* Set GC_max_height to be the maximum height we encounter, and */ /* GC_deepest_obj to be the corresponding object. */ static void update_max_height(ptr_t p, size_t n_bytes, word gc_descr) { if (GC_is_marked(p) && GC_HAS_DEBUG_INFO(p)) { int i; word p_height = 0; ptr_t p_deepest_obj = 0; ptr_t back_ptr; back_edges *be = 0; /* If we remembered a height last time, use it as a minimum. */ /* It may have increased due to newly unreachable chains pointing */ /* to p, but it can't have decreased. */ back_ptr = GET_OH_BG_PTR(p); if (0 != back_ptr && ((word)back_ptr & FLAG_MANY)) { be = (back_edges *)((word)back_ptr & ~FLAG_MANY); if (be -> height != HEIGHT_UNKNOWN) p_height = be -> height; } FOR_EACH_PRED(q, p, { if (!GC_is_marked(q) && GC_HAS_DEBUG_INFO(q)) { word q_height; q_height = backwards_height(q); if (q_height > p_height) { p_height = q_height; p_deepest_obj = q; } } }); if (p_height > 0) { /* Remember the height for next time. */ if (be == 0) { ensure_struct(p); back_ptr = GET_OH_BG_PTR(p); be = (back_edges *)((word)back_ptr & ~FLAG_MANY); } be -> flags |= RETAIN; be -> height = p_height; be -> height_gc_no = GC_gc_no; } if (p_height > GC_max_height) { GC_max_height = p_height; GC_deepest_obj = p_deepest_obj; } } } word GC_max_max_height = 0; void GC_traverse_back_graph(void) { GC_max_height = 0; GC_apply_to_each_object(update_max_height); if (0 != GC_deepest_obj) GC_set_mark_bit(GC_deepest_obj); /* Keep it until we can print it. */ } void GC_print_back_graph_stats(void) { GC_printf("Maximum backwards height of reachable objects at GC %lu is %ld\n", (unsigned long) GC_gc_no, (unsigned long)GC_max_height); if (GC_max_height > GC_max_max_height) { GC_max_max_height = GC_max_height; GC_printf("The following unreachable object is last in a longest chain " "of unreachable objects:\n"); GC_print_heap_obj(GC_deepest_obj); } if (GC_print_stats) { GC_log_printf("Needed max total of %ld back-edge structs\n", GC_n_back_edge_structs); } GC_apply_to_each_object(reset_back_edge); GC_deepest_obj = 0; } #endif /* MAKE_BACK_GRAPH */ synopsis-0.12/src/Synopsis/gc/allchblk.c0000664000076400007640000006254111104702316017611 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1998-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999 by Hewlett-Packard Company. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* #define DEBUG */ #include #include "private/gc_priv.h" GC_bool GC_use_entire_heap = 0; /* * Free heap blocks are kept on one of several free lists, * depending on the size of the block. Each free list is doubly linked. * Adjacent free blocks are coalesced. */ # define MAX_BLACK_LIST_ALLOC (2*HBLKSIZE) /* largest block we will allocate starting on a black */ /* listed block. Must be >= HBLKSIZE. */ # define UNIQUE_THRESHOLD 32 /* Sizes up to this many HBLKs each have their own free list */ # define HUGE_THRESHOLD 256 /* Sizes of at least this many heap blocks are mapped to a */ /* single free list. */ # define FL_COMPRESSION 8 /* In between sizes map this many distinct sizes to a single */ /* bin. */ # define N_HBLK_FLS (HUGE_THRESHOLD - UNIQUE_THRESHOLD)/FL_COMPRESSION \ + UNIQUE_THRESHOLD struct hblk * GC_hblkfreelist[N_HBLK_FLS+1] = { 0 }; #ifndef USE_MUNMAP word GC_free_bytes[N_HBLK_FLS+1] = { 0 }; /* Number of free bytes on each list. */ /* Is bytes + the number of free bytes on lists n .. N_HBLK_FLS */ /* > GC_max_large_allocd_bytes? */ # ifdef __GNUC__ __inline__ # endif static GC_bool GC_enough_large_bytes_left(word bytes, int n) { int i; for (i = N_HBLK_FLS; i >= n; --i) { bytes += GC_free_bytes[i]; if (bytes > GC_max_large_allocd_bytes) return TRUE; } return FALSE; } # define INCR_FREE_BYTES(n, b) GC_free_bytes[n] += (b); # define FREE_ASSERT(e) GC_ASSERT(e) #else /* USE_MUNMAP */ # define INCR_FREE_BYTES(n, b) # define FREE_ASSERT(e) #endif /* USE_MUNMAP */ /* Map a number of blocks to the appropriate large block free list index. */ int GC_hblk_fl_from_blocks(word blocks_needed) { if (blocks_needed <= UNIQUE_THRESHOLD) return (int)blocks_needed; if (blocks_needed >= HUGE_THRESHOLD) return N_HBLK_FLS; return (int)(blocks_needed - UNIQUE_THRESHOLD)/FL_COMPRESSION + UNIQUE_THRESHOLD; } # define PHDR(hhdr) HDR(hhdr -> hb_prev) # define NHDR(hhdr) HDR(hhdr -> hb_next) # ifdef USE_MUNMAP # define IS_MAPPED(hhdr) (((hhdr) -> hb_flags & WAS_UNMAPPED) == 0) # else /* !USE_MMAP */ # define IS_MAPPED(hhdr) 1 # endif /* USE_MUNMAP */ # if !defined(NO_DEBUGGING) void GC_print_hblkfreelist() { struct hblk * h; word total_free = 0; hdr * hhdr; word sz; unsigned i; for (i = 0; i <= N_HBLK_FLS; ++i) { h = GC_hblkfreelist[i]; # ifdef USE_MUNMAP if (0 != h) GC_printf("Free list %ld:\n", (unsigned long)i); # else if (0 != h) GC_printf("Free list %lu (Total size %lu):\n", i, (unsigned long)GC_free_bytes[i]); # endif while (h != 0) { hhdr = HDR(h); sz = hhdr -> hb_sz; GC_printf("\t%p size %lu ", h, (unsigned long)sz); total_free += sz; if (GC_is_black_listed(h, HBLKSIZE) != 0) { GC_printf("start black listed\n"); } else if (GC_is_black_listed(h, hhdr -> hb_sz) != 0) { GC_printf("partially black listed\n"); } else { GC_printf("not black listed\n"); } h = hhdr -> hb_next; } } # ifndef USE_MUNMAP if (total_free != GC_large_free_bytes) { GC_printf("GC_large_free_bytes = %lu (INCONSISTENT!!)\n", (unsigned long) GC_large_free_bytes); } # endif GC_printf("Total of %lu bytes on free list\n", (unsigned long)total_free); } /* Return the free list index on which the block described by the header */ /* appears, or -1 if it appears nowhere. */ int free_list_index_of(hdr *wanted) { struct hblk * h; hdr * hhdr; int i; for (i = 0; i <= N_HBLK_FLS; ++i) { h = GC_hblkfreelist[i]; while (h != 0) { hhdr = HDR(h); if (hhdr == wanted) return i; h = hhdr -> hb_next; } } return -1; } void GC_dump_regions() { unsigned i; ptr_t start, end; ptr_t p; size_t bytes; hdr *hhdr; for (i = 0; i < GC_n_heap_sects; ++i) { start = GC_heap_sects[i].hs_start; bytes = GC_heap_sects[i].hs_bytes; end = start + bytes; /* Merge in contiguous sections. */ while (i+1 < GC_n_heap_sects && GC_heap_sects[i+1].hs_start == end) { ++i; end = GC_heap_sects[i].hs_start + GC_heap_sects[i].hs_bytes; } GC_printf("***Section from %p to %p\n", start, end); for (p = start; p < end;) { hhdr = HDR(p); GC_printf("\t%p ", p); if (IS_FORWARDING_ADDR_OR_NIL(hhdr)) { GC_printf("Missing header!!(%d)\n", hhdr); p += HBLKSIZE; continue; } if (HBLK_IS_FREE(hhdr)) { int correct_index = GC_hblk_fl_from_blocks( divHBLKSZ(hhdr -> hb_sz)); int actual_index; GC_printf("\tfree block of size 0x%lx bytes", (unsigned long)(hhdr -> hb_sz)); if (IS_MAPPED(hhdr)) { GC_printf("\n"); } else { GC_printf("(unmapped)\n"); } actual_index = free_list_index_of(hhdr); if (-1 == actual_index) { GC_printf("\t\tBlock not on free list %d!!\n", correct_index); } else if (correct_index != actual_index) { GC_printf("\t\tBlock on list %d, should be on %d!!\n", actual_index, correct_index); } p += hhdr -> hb_sz; } else { GC_printf("\tused for blocks of size 0x%lx bytes\n", (unsigned long)(hhdr -> hb_sz)); p += HBLKSIZE * OBJ_SZ_TO_BLOCKS(hhdr -> hb_sz); } } } } # endif /* NO_DEBUGGING */ /* Initialize hdr for a block containing the indicated size and */ /* kind of objects. */ /* Return FALSE on failure. */ static GC_bool setup_header(hdr * hhdr, struct hblk *block, size_t byte_sz, int kind, unsigned flags) { word descr; size_t granules; /* Set size, kind and mark proc fields */ hhdr -> hb_sz = byte_sz; hhdr -> hb_obj_kind = (unsigned char)kind; hhdr -> hb_flags = (unsigned char)flags; hhdr -> hb_block = block; descr = GC_obj_kinds[kind].ok_descriptor; if (GC_obj_kinds[kind].ok_relocate_descr) descr += byte_sz; hhdr -> hb_descr = descr; # ifdef MARK_BIT_PER_OBJ /* Set hb_inv_sz as portably as possible. */ /* We set it to the smallest value such that sz * inv_sz > 2**32 */ /* This may be more precision than necessary. */ if (byte_sz > MAXOBJBYTES) { hhdr -> hb_inv_sz = LARGE_INV_SZ; } else { word inv_sz; # if CPP_WORDSZ == 64 inv_sz = ((word)1 << 32)/byte_sz; if (((inv_sz*byte_sz) >> 32) == 0) ++inv_sz; # else /* 32 bit words */ GC_ASSERT(byte_sz >= 4); inv_sz = ((unsigned)1 << 31)/byte_sz; inv_sz *= 2; while (inv_sz*byte_sz > byte_sz) ++inv_sz; # endif hhdr -> hb_inv_sz = inv_sz; } # else /* MARK_BIT_PER_GRANULE */ hhdr -> hb_large_block = (unsigned char)(byte_sz > MAXOBJBYTES); granules = BYTES_TO_GRANULES(byte_sz); if (EXPECT(!GC_add_map_entry(granules), FALSE)) { /* Make it look like a valid block. */ hhdr -> hb_sz = HBLKSIZE; hhdr -> hb_descr = 0; hhdr -> hb_large_block = TRUE; hhdr -> hb_map = 0; return FALSE; } else { size_t index = (hhdr -> hb_large_block? 0 : granules); hhdr -> hb_map = GC_obj_map[index]; } # endif /* MARK_BIT_PER_GRANULE */ /* Clear mark bits */ GC_clear_hdr_marks(hhdr); hhdr -> hb_last_reclaimed = (unsigned short)GC_gc_no; return(TRUE); } #define FL_UNKNOWN -1 /* * Remove hhdr from the appropriate free list. * We assume it is on the nth free list, or on the size * appropriate free list if n is FL_UNKNOWN. */ void GC_remove_from_fl(hdr *hhdr, int n) { int index; GC_ASSERT(((hhdr -> hb_sz) & (HBLKSIZE-1)) == 0); # ifndef USE_MUNMAP /* We always need index to mainatin free counts. */ if (FL_UNKNOWN == n) { index = GC_hblk_fl_from_blocks(divHBLKSZ(hhdr -> hb_sz)); } else { index = n; } # endif if (hhdr -> hb_prev == 0) { # ifdef USE_MUNMAP if (FL_UNKNOWN == n) { index = GC_hblk_fl_from_blocks(divHBLKSZ(hhdr -> hb_sz)); } else { index = n; } # endif GC_ASSERT(HDR(GC_hblkfreelist[index]) == hhdr); GC_hblkfreelist[index] = hhdr -> hb_next; } else { hdr *phdr; GET_HDR(hhdr -> hb_prev, phdr); phdr -> hb_next = hhdr -> hb_next; } FREE_ASSERT(GC_free_bytes[index] >= hhdr -> hb_sz); INCR_FREE_BYTES(index, - (signed_word)(hhdr -> hb_sz)); if (0 != hhdr -> hb_next) { hdr * nhdr; GC_ASSERT(!IS_FORWARDING_ADDR_OR_NIL(NHDR(hhdr))); GET_HDR(hhdr -> hb_next, nhdr); nhdr -> hb_prev = hhdr -> hb_prev; } } /* * Return a pointer to the free block ending just before h, if any. */ struct hblk * GC_free_block_ending_at(struct hblk *h) { struct hblk * p = h - 1; hdr * phdr; GET_HDR(p, phdr); while (0 != phdr && IS_FORWARDING_ADDR_OR_NIL(phdr)) { p = FORWARDED_ADDR(p,phdr); phdr = HDR(p); } if (0 != phdr) { if(HBLK_IS_FREE(phdr)) { return p; } else { return 0; } } p = GC_prev_block(h - 1); if (0 != p) { phdr = HDR(p); if (HBLK_IS_FREE(phdr) && (ptr_t)p + phdr -> hb_sz == (ptr_t)h) { return p; } } return 0; } /* * Add hhdr to the appropriate free list. * We maintain individual free lists sorted by address. */ void GC_add_to_fl(struct hblk *h, hdr *hhdr) { int index = GC_hblk_fl_from_blocks(divHBLKSZ(hhdr -> hb_sz)); struct hblk *second = GC_hblkfreelist[index]; hdr * second_hdr; # ifdef GC_ASSERTIONS struct hblk *next = (struct hblk *)((word)h + hhdr -> hb_sz); hdr * nexthdr = HDR(next); struct hblk *prev = GC_free_block_ending_at(h); hdr * prevhdr = HDR(prev); GC_ASSERT(nexthdr == 0 || !HBLK_IS_FREE(nexthdr) || !IS_MAPPED(nexthdr)); GC_ASSERT(prev == 0 || !HBLK_IS_FREE(prevhdr) || !IS_MAPPED(prevhdr)); # endif GC_ASSERT(((hhdr -> hb_sz) & (HBLKSIZE-1)) == 0); GC_hblkfreelist[index] = h; INCR_FREE_BYTES(index, hhdr -> hb_sz); FREE_ASSERT(GC_free_bytes[index] <= GC_large_free_bytes) hhdr -> hb_next = second; hhdr -> hb_prev = 0; if (0 != second) { GET_HDR(second, second_hdr); second_hdr -> hb_prev = h; } hhdr -> hb_flags |= FREE_BLK; } #ifdef USE_MUNMAP /* Unmap blocks that haven't been recently touched. This is the only way */ /* way blocks are ever unmapped. */ void GC_unmap_old(void) { struct hblk * h; hdr * hhdr; word sz; unsigned short last_rec, threshold; int i; # define UNMAP_THRESHOLD 6 for (i = 0; i <= N_HBLK_FLS; ++i) { for (h = GC_hblkfreelist[i]; 0 != h; h = hhdr -> hb_next) { hhdr = HDR(h); if (!IS_MAPPED(hhdr)) continue; threshold = (unsigned short)(GC_gc_no - UNMAP_THRESHOLD); last_rec = hhdr -> hb_last_reclaimed; if ((last_rec > GC_gc_no || last_rec < threshold) && threshold < GC_gc_no /* not recently wrapped */) { sz = hhdr -> hb_sz; GC_unmap((ptr_t)h, sz); hhdr -> hb_flags |= WAS_UNMAPPED; } } } } /* Merge all unmapped blocks that are adjacent to other free */ /* blocks. This may involve remapping, since all blocks are either */ /* fully mapped or fully unmapped. */ void GC_merge_unmapped(void) { struct hblk * h, *next; hdr * hhdr, *nexthdr; word size, nextsize; int i; for (i = 0; i <= N_HBLK_FLS; ++i) { h = GC_hblkfreelist[i]; while (h != 0) { GET_HDR(h, hhdr); size = hhdr->hb_sz; next = (struct hblk *)((word)h + size); GET_HDR(next, nexthdr); /* Coalesce with successor, if possible */ if (0 != nexthdr && HBLK_IS_FREE(nexthdr)) { nextsize = nexthdr -> hb_sz; if (IS_MAPPED(hhdr)) { GC_ASSERT(!IS_MAPPED(nexthdr)); /* make both consistent, so that we can merge */ if (size > nextsize) { GC_remap((ptr_t)next, nextsize); } else { GC_unmap((ptr_t)h, size); hhdr -> hb_flags |= WAS_UNMAPPED; } } else if (IS_MAPPED(nexthdr)) { GC_ASSERT(!IS_MAPPED(hhdr)); if (size > nextsize) { GC_unmap((ptr_t)next, nextsize); } else { GC_remap((ptr_t)h, size); hhdr -> hb_flags &= ~WAS_UNMAPPED; hhdr -> hb_last_reclaimed = nexthdr -> hb_last_reclaimed; } } else { /* Unmap any gap in the middle */ GC_unmap_gap((ptr_t)h, size, (ptr_t)next, nexthdr -> hb_sz); } /* If they are both unmapped, we merge, but leave unmapped. */ GC_remove_from_fl(hhdr, i); GC_remove_from_fl(nexthdr, FL_UNKNOWN); hhdr -> hb_sz += nexthdr -> hb_sz; GC_remove_header(next); GC_add_to_fl(h, hhdr); /* Start over at beginning of list */ h = GC_hblkfreelist[i]; } else /* not mergable with successor */ { h = hhdr -> hb_next; } } /* while (h != 0) ... */ } /* for ... */ } #endif /* USE_MUNMAP */ /* * Return a pointer to a block starting at h of length bytes. * Memory for the block is mapped. * Remove the block from its free list, and return the remainder (if any) * to its appropriate free list. * May fail by returning 0. * The header for the returned block must be set up by the caller. * If the return value is not 0, then hhdr is the header for it. */ struct hblk * GC_get_first_part(struct hblk *h, hdr *hhdr, size_t bytes, int index) { word total_size = hhdr -> hb_sz; struct hblk * rest; hdr * rest_hdr; GC_ASSERT((total_size & (HBLKSIZE-1)) == 0); GC_remove_from_fl(hhdr, index); if (total_size == bytes) return h; rest = (struct hblk *)((word)h + bytes); rest_hdr = GC_install_header(rest); if (0 == rest_hdr) { /* FIXME: This is likely to be very bad news ... */ WARN("Header allocation failed: Dropping block.\n", 0); return(0); } rest_hdr -> hb_sz = total_size - bytes; rest_hdr -> hb_flags = 0; # ifdef GC_ASSERTIONS /* Mark h not free, to avoid assertion about adjacent free blocks. */ hhdr -> hb_flags &= ~FREE_BLK; # endif GC_add_to_fl(rest, rest_hdr); return h; } /* * H is a free block. N points at an address inside it. * A new header for n has already been set up. Fix up h's header * to reflect the fact that it is being split, move it to the * appropriate free list. * N replaces h in the original free list. * * Nhdr is not completely filled in, since it is about to allocated. * It may in fact end up on the wrong free list for its size. * (Hence adding it to a free list is silly. But this path is hopefully * rare enough that it doesn't matter. The code is cleaner this way.) */ void GC_split_block(struct hblk *h, hdr *hhdr, struct hblk *n, hdr *nhdr, int index /* Index of free list */) { word total_size = hhdr -> hb_sz; word h_size = (word)n - (word)h; struct hblk *prev = hhdr -> hb_prev; struct hblk *next = hhdr -> hb_next; /* Replace h with n on its freelist */ nhdr -> hb_prev = prev; nhdr -> hb_next = next; nhdr -> hb_sz = total_size - h_size; nhdr -> hb_flags = 0; if (0 != prev) { HDR(prev) -> hb_next = n; } else { GC_hblkfreelist[index] = n; } if (0 != next) { HDR(next) -> hb_prev = n; } INCR_FREE_BYTES(index, -(signed_word)h_size); FREE_ASSERT(GC_free_bytes[index] > 0); # ifdef GC_ASSERTIONS nhdr -> hb_flags &= ~FREE_BLK; /* Don't fail test for consecutive */ /* free blocks in GC_add_to_fl. */ # endif # ifdef USE_MUNMAP hhdr -> hb_last_reclaimed = (unsigned short)GC_gc_no; # endif hhdr -> hb_sz = h_size; GC_add_to_fl(h, hhdr); nhdr -> hb_flags |= FREE_BLK; } struct hblk * GC_allochblk_nth(size_t sz/* bytes */, int kind, unsigned flags, int n); /* * Allocate (and return pointer to) a heap block * for objects of size sz bytes, searching the nth free list. * * NOTE: We set obj_map field in header correctly. * Caller is responsible for building an object freelist in block. * * The client is responsible for clearing the block, if necessary. */ struct hblk * GC_allochblk(size_t sz, int kind, unsigned flags/* IGNORE_OFF_PAGE or 0 */) { word blocks; int start_list; int i; GC_ASSERT((sz & (GRANULE_BYTES - 1)) == 0); blocks = OBJ_SZ_TO_BLOCKS(sz); start_list = GC_hblk_fl_from_blocks(blocks); for (i = start_list; i <= N_HBLK_FLS; ++i) { struct hblk * result = GC_allochblk_nth(sz, kind, flags, i); if (0 != result) { return result; } } return 0; } /* * The same, but with search restricted to nth free list. * Flags is IGNORE_OFF_PAGE or zero. * Unlike the above, sz is in bytes. */ struct hblk * GC_allochblk_nth(size_t sz, int kind, unsigned flags, int n) { struct hblk *hbp; hdr * hhdr; /* Header corr. to hbp */ /* Initialized after loop if hbp !=0 */ /* Gcc uninitialized use warning is bogus. */ struct hblk *thishbp; hdr * thishdr; /* Header corr. to hbp */ signed_word size_needed; /* number of bytes in requested objects */ signed_word size_avail; /* bytes available in this block */ size_needed = HBLKSIZE * OBJ_SZ_TO_BLOCKS(sz); /* search for a big enough block in free list */ hbp = GC_hblkfreelist[n]; for(; 0 != hbp; hbp = hhdr -> hb_next) { GET_HDR(hbp, hhdr); size_avail = hhdr->hb_sz; if (size_avail < size_needed) continue; if (size_avail != size_needed && !GC_use_entire_heap && !GC_dont_gc && USED_HEAP_SIZE >= GC_requested_heapsize && !TRUE_INCREMENTAL && GC_should_collect()) { # ifdef USE_MUNMAP continue; # else /* If we have enough large blocks left to cover any */ /* previous request for large blocks, we go ahead */ /* and split. Assuming a steady state, that should */ /* be safe. It means that we can use the full */ /* heap if we allocate only small objects. */ if (!GC_enough_large_bytes_left(GC_large_allocd_bytes, n)) { continue; } /* If we are deallocating lots of memory from */ /* finalizers, fail and collect sooner rather */ /* than later. */ if (GC_finalizer_bytes_freed > (GC_heapsize >> 4)) { continue; } # endif /* !USE_MUNMAP */ } /* If the next heap block is obviously better, go on. */ /* This prevents us from disassembling a single large block */ /* to get tiny blocks. */ { signed_word next_size; thishbp = hhdr -> hb_next; if (thishbp != 0) { GET_HDR(thishbp, thishdr); next_size = (signed_word)(thishdr -> hb_sz); if (next_size < size_avail && next_size >= size_needed && !GC_is_black_listed(thishbp, (word)size_needed)) { continue; } } } if ( !IS_UNCOLLECTABLE(kind) && (kind != PTRFREE || size_needed > MAX_BLACK_LIST_ALLOC)) { struct hblk * lasthbp = hbp; ptr_t search_end = (ptr_t)hbp + size_avail - size_needed; signed_word orig_avail = size_avail; signed_word eff_size_needed = ((flags & IGNORE_OFF_PAGE)? HBLKSIZE : size_needed); while ((ptr_t)lasthbp <= search_end && (thishbp = GC_is_black_listed(lasthbp, (word)eff_size_needed)) != 0) { lasthbp = thishbp; } size_avail -= (ptr_t)lasthbp - (ptr_t)hbp; thishbp = lasthbp; if (size_avail >= size_needed) { if (thishbp != hbp && 0 != (thishdr = GC_install_header(thishbp))) { /* Make sure it's mapped before we mangle it. */ # ifdef USE_MUNMAP if (!IS_MAPPED(hhdr)) { GC_remap((ptr_t)hbp, hhdr -> hb_sz); hhdr -> hb_flags &= ~WAS_UNMAPPED; } # endif /* Split the block at thishbp */ GC_split_block(hbp, hhdr, thishbp, thishdr, n); /* Advance to thishbp */ hbp = thishbp; hhdr = thishdr; /* We must now allocate thishbp, since it may */ /* be on the wrong free list. */ } } else if (size_needed > (signed_word)BL_LIMIT && orig_avail - size_needed > (signed_word)BL_LIMIT) { /* Punt, since anything else risks unreasonable heap growth. */ if (++GC_large_alloc_warn_suppressed >= GC_large_alloc_warn_interval) { WARN("Repeated allocation of very large block " "(appr. size %ld):\n" "\tMay lead to memory leak and poor performance.\n", size_needed); GC_large_alloc_warn_suppressed = 0; } size_avail = orig_avail; } else if (size_avail == 0 && size_needed == HBLKSIZE && IS_MAPPED(hhdr)) { if (!GC_find_leak) { static unsigned count = 0; /* The block is completely blacklisted. We need */ /* to drop some such blocks, since otherwise we spend */ /* all our time traversing them if pointerfree */ /* blocks are unpopular. */ /* A dropped block will be reconsidered at next GC. */ if ((++count & 3) == 0) { /* Allocate and drop the block in small chunks, to */ /* maximize the chance that we will recover some */ /* later. */ word total_size = hhdr -> hb_sz; struct hblk * limit = hbp + divHBLKSZ(total_size); struct hblk * h; struct hblk * prev = hhdr -> hb_prev; GC_large_free_bytes -= total_size; GC_remove_from_fl(hhdr, n); for (h = hbp; h < limit; h++) { if (h == hbp || 0 != (hhdr = GC_install_header(h))) { (void) setup_header( hhdr, h, HBLKSIZE, PTRFREE, 0); /* Cant fail */ if (GC_debugging_started) { BZERO(h, HBLKSIZE); } } } /* Restore hbp to point at free block */ hbp = prev; if (0 == hbp) { return GC_allochblk_nth(sz, kind, flags, n); } hhdr = HDR(hbp); } } } } if( size_avail >= size_needed ) { # ifdef USE_MUNMAP if (!IS_MAPPED(hhdr)) { GC_remap((ptr_t)hbp, hhdr -> hb_sz); hhdr -> hb_flags &= ~WAS_UNMAPPED; } # endif /* hbp may be on the wrong freelist; the parameter n */ /* is important. */ hbp = GC_get_first_part(hbp, hhdr, size_needed, n); break; } } if (0 == hbp) return 0; /* Add it to map of valid blocks */ if (!GC_install_counts(hbp, (word)size_needed)) return(0); /* This leaks memory under very rare conditions. */ /* Set up header */ if (!setup_header(hhdr, hbp, sz, kind, flags)) { GC_remove_counts(hbp, (word)size_needed); return(0); /* ditto */ } /* Notify virtual dirty bit implementation that we are about to write. */ /* Ensure that pointerfree objects are not protected if it's avoidable. */ GC_remove_protection(hbp, divHBLKSZ(size_needed), (hhdr -> hb_descr == 0) /* pointer-free */); /* We just successfully allocated a block. Restart count of */ /* consecutive failures. */ { extern unsigned GC_fail_count; GC_fail_count = 0; } GC_large_free_bytes -= size_needed; GC_ASSERT(IS_MAPPED(hhdr)); return( hbp ); } struct hblk * GC_freehblk_ptr = 0; /* Search position hint for GC_freehblk */ /* * Free a heap block. * * Coalesce the block with its neighbors if possible. * * All mark words are assumed to be cleared. */ void GC_freehblk(struct hblk *hbp) { struct hblk *next, *prev; hdr *hhdr, *prevhdr, *nexthdr; signed_word size; GET_HDR(hbp, hhdr); size = hhdr->hb_sz; size = HBLKSIZE * OBJ_SZ_TO_BLOCKS(size); GC_remove_counts(hbp, (word)size); hhdr->hb_sz = size; # ifdef USE_MUNMAP hhdr -> hb_last_reclaimed = (unsigned short)GC_gc_no; # endif /* Check for duplicate deallocation in the easy case */ if (HBLK_IS_FREE(hhdr)) { GC_printf("Duplicate large block deallocation of %p\n", hbp); ABORT("Duplicate large block deallocation"); } GC_ASSERT(IS_MAPPED(hhdr)); hhdr -> hb_flags |= FREE_BLK; next = (struct hblk *)((word)hbp + size); GET_HDR(next, nexthdr); prev = GC_free_block_ending_at(hbp); /* Coalesce with successor, if possible */ if(0 != nexthdr && HBLK_IS_FREE(nexthdr) && IS_MAPPED(nexthdr)) { GC_remove_from_fl(nexthdr, FL_UNKNOWN); hhdr -> hb_sz += nexthdr -> hb_sz; GC_remove_header(next); } /* Coalesce with predecessor, if possible. */ if (0 != prev) { prevhdr = HDR(prev); if (IS_MAPPED(prevhdr)) { GC_remove_from_fl(prevhdr, FL_UNKNOWN); prevhdr -> hb_sz += hhdr -> hb_sz; # ifdef USE_MUNMAP prevhdr -> hb_last_reclaimed = (unsigned short)GC_gc_no; # endif GC_remove_header(hbp); hbp = prev; hhdr = prevhdr; } } /* FIXME: It is not clear we really always want to do these merges */ /* with -DUSE_MUNMAP, since it updates ages and hence prevents */ /* unmapping. */ GC_large_free_bytes += size; GC_add_to_fl(hbp, hhdr); } synopsis-0.12/src/Synopsis/gc/alloc.c0000664000076400007640000007443011104702321017123 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1996 by Xerox Corporation. All rights reserved. * Copyright (c) 1998 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */ # include "private/gc_priv.h" # include # if !defined(MACOS) && !defined(MSWINCE) # include # include # endif /* * Separate free lists are maintained for different sized objects * up to MAXOBJBYTES. * The call GC_allocobj(i,k) ensures that the freelist for * kind k objects of size i points to a non-empty * free list. It returns a pointer to the first entry on the free list. * In a single-threaded world, GC_allocobj may be called to allocate * an object of (small) size i as follows: * * opp = &(GC_objfreelist[i]); * if (*opp == 0) GC_allocobj(i, NORMAL); * ptr = *opp; * *opp = obj_link(ptr); * * Note that this is very fast if the free list is non-empty; it should * only involve the execution of 4 or 5 simple instructions. * All composite objects on freelists are cleared, except for * their first word. */ /* * The allocator uses GC_allochblk to allocate large chunks of objects. * These chunks all start on addresses which are multiples of * HBLKSZ. Each allocated chunk has an associated header, * which can be located quickly based on the address of the chunk. * (See headers.c for details.) * This makes it possible to check quickly whether an * arbitrary address corresponds to an object administered by the * allocator. */ word GC_non_gc_bytes = 0; /* Number of bytes not intended to be collected */ word GC_gc_no = 0; #ifndef SMALL_CONFIG int GC_incremental = 0; /* By default, stop the world. */ #endif int GC_parallel = FALSE; /* By default, parallel GC is off. */ int GC_full_freq = 19; /* Every 20th collection is a full */ /* collection, whether we need it */ /* or not. */ GC_bool GC_need_full_gc = FALSE; /* Need full GC do to heap growth. */ #ifdef THREADS GC_bool GC_world_stopped = FALSE; # define IF_THREADS(x) x #else # define IF_THREADS(x) #endif word GC_used_heap_size_after_full = 0; char * GC_copyright[] = {"Copyright 1988,1989 Hans-J. Boehm and Alan J. Demers ", "Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved. ", "Copyright (c) 1996-1998 by Silicon Graphics. All rights reserved. ", "Copyright (c) 1999-2001 by Hewlett-Packard Company. All rights reserved. ", "THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY", " EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK.", "See source code for details." }; # include "version.h" /* some more variables */ extern signed_word GC_bytes_found; /* Number of reclaimed bytes */ /* after garbage collection */ GC_bool GC_dont_expand = 0; word GC_free_space_divisor = 3; extern GC_bool GC_collection_in_progress(); /* Collection is in progress, or was abandoned. */ int GC_never_stop_func (void) { return(0); } unsigned long GC_time_limit = TIME_LIMIT; CLOCK_TYPE GC_start_time; /* Time at which we stopped world. */ /* used only in GC_timeout_stop_func. */ int GC_n_attempts = 0; /* Number of attempts at finishing */ /* collection within GC_time_limit. */ #if defined(SMALL_CONFIG) || defined(NO_CLOCK) # define GC_timeout_stop_func GC_never_stop_func #else int GC_timeout_stop_func (void) { CLOCK_TYPE current_time; static unsigned count = 0; unsigned long time_diff; if ((count++ & 3) != 0) return(0); GET_TIME(current_time); time_diff = MS_TIME_DIFF(current_time,GC_start_time); if (time_diff >= GC_time_limit) { if (GC_print_stats) { GC_log_printf("Abandoning stopped marking after "); GC_log_printf("%lu msecs", time_diff); GC_log_printf("(attempt %d)\n", GC_n_attempts); } return(1); } return(0); } #endif /* !SMALL_CONFIG */ /* Return the minimum number of words that must be allocated between */ /* collections to amortize the collection cost. */ static word min_bytes_allocd() { # ifdef THREADS /* We punt, for now. */ signed_word stack_size = 10000; # else int dummy; signed_word stack_size = (ptr_t)(&dummy) - GC_stackbottom; # endif word total_root_size; /* includes double stack size, */ /* since the stack is expensive */ /* to scan. */ word scan_size; /* Estimate of memory to be scanned */ /* during normal GC. */ if (stack_size < 0) stack_size = -stack_size; total_root_size = 2 * stack_size + GC_root_size; scan_size = 2 * GC_composite_in_use + GC_atomic_in_use + total_root_size; if (TRUE_INCREMENTAL) { return scan_size / (2 * GC_free_space_divisor); } else { return scan_size / GC_free_space_divisor; } } /* Return the number of bytes allocated, adjusted for explicit storage */ /* management, etc.. This number is used in deciding when to trigger */ /* collections. */ word GC_adj_bytes_allocd(void) { signed_word result; signed_word expl_managed = (signed_word)GC_non_gc_bytes - (signed_word)GC_non_gc_bytes_at_gc; /* Don't count what was explicitly freed, or newly allocated for */ /* explicit management. Note that deallocating an explicitly */ /* managed object should not alter result, assuming the client */ /* is playing by the rules. */ result = (signed_word)GC_bytes_allocd - (signed_word)GC_bytes_freed + (signed_word)GC_finalizer_bytes_freed - expl_managed; if (result > (signed_word)GC_bytes_allocd) { result = GC_bytes_allocd; /* probably client bug or unfortunate scheduling */ } result += GC_bytes_finalized; /* We count objects enqueued for finalization as though they */ /* had been reallocated this round. Finalization is user */ /* visible progress. And if we don't count this, we have */ /* stability problems for programs that finalize all objects. */ if (result < (signed_word)(GC_bytes_allocd >> 3)) { /* Always count at least 1/8 of the allocations. We don't want */ /* to collect too infrequently, since that would inhibit */ /* coalescing of free storage blocks. */ /* This also makes us partially robust against client bugs. */ return(GC_bytes_allocd >> 3); } else { return(result); } } /* Clear up a few frames worth of garbage left at the top of the stack. */ /* This is used to prevent us from accidentally treating garbade left */ /* on the stack by other parts of the collector as roots. This */ /* differs from the code in misc.c, which actually tries to keep the */ /* stack clear of long-lived, client-generated garbage. */ void GC_clear_a_few_frames() { # define NWORDS 64 word frames[NWORDS]; int i; for (i = 0; i < NWORDS; i++) frames[i] = 0; } /* Heap size at which we need a collection to avoid expanding past */ /* limits used by blacklisting. */ static word GC_collect_at_heapsize = (word)(-1); /* Have we allocated enough to amortize a collection? */ GC_bool GC_should_collect(void) { return(GC_adj_bytes_allocd() >= min_bytes_allocd() || GC_heapsize >= GC_collect_at_heapsize); } void GC_notify_full_gc(void) { if (GC_start_call_back != (void (*) (void))0) { (*GC_start_call_back)(); } } GC_bool GC_is_full_gc = FALSE; /* * Initiate a garbage collection if appropriate. * Choose judiciously * between partial, full, and stop-world collections. * Assumes lock held, signals disabled. */ void GC_maybe_gc(void) { static int n_partial_gcs = 0; if (GC_should_collect()) { if (!GC_incremental) { GC_gcollect_inner(); n_partial_gcs = 0; return; } else { # ifdef PARALLEL_MARK GC_wait_for_reclaim(); # endif if (GC_need_full_gc || n_partial_gcs >= GC_full_freq) { if (GC_print_stats) { GC_log_printf( "***>Full mark for collection %lu after %ld allocd bytes\n", (unsigned long)GC_gc_no+1, (long)GC_bytes_allocd); } GC_promote_black_lists(); (void)GC_reclaim_all((GC_stop_func)0, TRUE); GC_clear_marks(); n_partial_gcs = 0; GC_notify_full_gc(); GC_is_full_gc = TRUE; } else { n_partial_gcs++; } } /* We try to mark with the world stopped. */ /* If we run out of time, this turns into */ /* incremental marking. */ # ifndef NO_CLOCK if (GC_time_limit != GC_TIME_UNLIMITED) { GET_TIME(GC_start_time); } # endif if (GC_stopped_mark(GC_time_limit == GC_TIME_UNLIMITED? GC_never_stop_func : GC_timeout_stop_func)) { # ifdef SAVE_CALL_CHAIN GC_save_callers(GC_last_stack); # endif GC_finish_collection(); } else { if (!GC_is_full_gc) { /* Count this as the first attempt */ GC_n_attempts++; } } } } /* * Stop the world garbage collection. Assumes lock held, signals disabled. * If stop_func is not GC_never_stop_func, then abort if stop_func returns TRUE. * Return TRUE if we successfully completed the collection. */ GC_bool GC_try_to_collect_inner(GC_stop_func stop_func) { CLOCK_TYPE start_time, current_time; if (GC_dont_gc) return FALSE; if (GC_incremental && GC_collection_in_progress()) { if (GC_print_stats) { GC_log_printf( "GC_try_to_collect_inner: finishing collection in progress\n"); } /* Just finish collection already in progress. */ while(GC_collection_in_progress()) { if (stop_func()) return(FALSE); GC_collect_a_little_inner(1); } } if (stop_func == GC_never_stop_func) GC_notify_full_gc(); if (GC_print_stats) { GET_TIME(start_time); GC_log_printf( "Initiating full world-stop collection %lu after %ld allocd bytes\n", (unsigned long)GC_gc_no+1, (long)GC_bytes_allocd); } GC_promote_black_lists(); /* Make sure all blocks have been reclaimed, so sweep routines */ /* don't see cleared mark bits. */ /* If we're guaranteed to finish, then this is unnecessary. */ /* In the find_leak case, we have to finish to guarantee that */ /* previously unmarked objects are not reported as leaks. */ # ifdef PARALLEL_MARK GC_wait_for_reclaim(); # endif if ((GC_find_leak || stop_func != GC_never_stop_func) && !GC_reclaim_all(stop_func, FALSE)) { /* Aborted. So far everything is still consistent. */ return(FALSE); } GC_invalidate_mark_state(); /* Flush mark stack. */ GC_clear_marks(); # ifdef SAVE_CALL_CHAIN GC_save_callers(GC_last_stack); # endif GC_is_full_gc = TRUE; if (!GC_stopped_mark(stop_func)) { if (!GC_incremental) { /* We're partially done and have no way to complete or use */ /* current work. Reestablish invariants as cheaply as */ /* possible. */ GC_invalidate_mark_state(); GC_unpromote_black_lists(); } /* else we claim the world is already still consistent. We'll */ /* finish incrementally. */ return(FALSE); } GC_finish_collection(); if (GC_print_stats) { GET_TIME(current_time); GC_log_printf("Complete collection took %lu msecs\n", MS_TIME_DIFF(current_time,start_time)); } return(TRUE); } /* * Perform n units of garbage collection work. A unit is intended to touch * roughly GC_RATE pages. Every once in a while, we do more than that. * This needs to be a fairly large number with our current incremental * GC strategy, since otherwise we allocate too much during GC, and the * cleanup gets expensive. */ # define GC_RATE 10 # define MAX_PRIOR_ATTEMPTS 1 /* Maximum number of prior attempts at world stop marking */ /* A value of 1 means that we finish the second time, no matter */ /* how long it takes. Doesn't count the initial root scan */ /* for a full GC. */ int GC_deficit = 0; /* The number of extra calls to GC_mark_some */ /* that we have made. */ void GC_collect_a_little_inner(int n) { int i; if (GC_dont_gc) return; if (GC_incremental && GC_collection_in_progress()) { for (i = GC_deficit; i < GC_RATE*n; i++) { if (GC_mark_some((ptr_t)0)) { /* Need to finish a collection */ # ifdef SAVE_CALL_CHAIN GC_save_callers(GC_last_stack); # endif # ifdef PARALLEL_MARK GC_wait_for_reclaim(); # endif if (GC_n_attempts < MAX_PRIOR_ATTEMPTS && GC_time_limit != GC_TIME_UNLIMITED) { GET_TIME(GC_start_time); if (!GC_stopped_mark(GC_timeout_stop_func)) { GC_n_attempts++; break; } } else { (void)GC_stopped_mark(GC_never_stop_func); } GC_finish_collection(); break; } } if (GC_deficit > 0) GC_deficit -= GC_RATE*n; if (GC_deficit < 0) GC_deficit = 0; } else { GC_maybe_gc(); } } int GC_collect_a_little(void) { int result; DCL_LOCK_STATE; LOCK(); GC_collect_a_little_inner(1); result = (int)GC_collection_in_progress(); UNLOCK(); if (!result && GC_debugging_started) GC_print_all_smashed(); return(result); } /* * Assumes lock is held, signals are disabled. * We stop the world. * If stop_func() ever returns TRUE, we may fail and return FALSE. * Increment GC_gc_no if we succeed. */ GC_bool GC_stopped_mark(GC_stop_func stop_func) { unsigned i; int dummy; CLOCK_TYPE start_time, current_time; if (GC_print_stats) GET_TIME(start_time); # if defined(REGISTER_LIBRARIES_EARLY) GC_cond_register_dynamic_libraries(); # endif STOP_WORLD(); IF_THREADS(GC_world_stopped = TRUE); if (GC_print_stats) { GC_log_printf("--> Marking for collection %lu ", (unsigned long)GC_gc_no + 1); GC_log_printf("after %lu allocd bytes\n", (unsigned long) GC_bytes_allocd); } # ifdef MAKE_BACK_GRAPH if (GC_print_back_height) { GC_build_back_graph(); } # endif /* Mark from all roots. */ /* Minimize junk left in my registers and on the stack */ GC_clear_a_few_frames(); GC_noop(0,0,0,0,0,0); GC_initiate_gc(); for(i = 0;;i++) { if ((*stop_func)()) { if (GC_print_stats) { GC_log_printf("Abandoned stopped marking after "); GC_log_printf("%u iterations\n", i); } GC_deficit = i; /* Give the mutator a chance. */ IF_THREADS(GC_world_stopped = FALSE); START_WORLD(); return(FALSE); } if (GC_mark_some((ptr_t)(&dummy))) break; } GC_gc_no++; if (GC_print_stats) { GC_log_printf("Collection %lu reclaimed %ld bytes", (unsigned long)GC_gc_no - 1, (long)GC_bytes_found); GC_log_printf(" ---> heapsize = %lu bytes\n", (unsigned long) GC_heapsize); /* Printf arguments may be pushed in funny places. Clear the */ /* space. */ GC_log_printf(""); } /* Check all debugged objects for consistency */ if (GC_debugging_started) { (*GC_check_heap)(); } IF_THREADS(GC_world_stopped = FALSE); START_WORLD(); if (GC_print_stats) { GET_TIME(current_time); GC_log_printf("World-stopped marking took %lu msecs\n", MS_TIME_DIFF(current_time,start_time)); } return(TRUE); } /* Set all mark bits for the free list whose first entry is q */ void GC_set_fl_marks(ptr_t q) { ptr_t p; struct hblk * h, * last_h = 0; hdr *hhdr; /* gcc "might be uninitialized" warning is bogus. */ IF_PER_OBJ(size_t sz;) unsigned bit_no; for (p = q; p != 0; p = obj_link(p)){ h = HBLKPTR(p); if (h != last_h) { last_h = h; hhdr = HDR(h); IF_PER_OBJ(sz = hhdr->hb_sz;) } bit_no = MARK_BIT_NO((ptr_t)p - (ptr_t)h, sz); if (!mark_bit_from_hdr(hhdr, bit_no)) { set_mark_bit_from_hdr(hhdr, bit_no); ++hhdr -> hb_n_marks; } } } #ifdef GC_ASSERTIONS /* Check that all mark bits for the free list whose first entry is q */ /* are set. */ void GC_check_fl_marks(ptr_t q) { ptr_t p; for (p = q; p != 0; p = obj_link(p)){ if (!GC_is_marked(p)) { GC_err_printf("Unmarked object %p on list %p\n", p, q); ABORT("Unmarked local free list entry."); } } } #endif /* Clear all mark bits for the free list whose first entry is q */ /* Decrement GC_bytes_found by number of bytes on free list. */ void GC_clear_fl_marks(ptr_t q) { ptr_t p; struct hblk * h, * last_h = 0; hdr *hhdr; size_t sz; unsigned bit_no; for (p = q; p != 0; p = obj_link(p)){ h = HBLKPTR(p); if (h != last_h) { last_h = h; hhdr = HDR(h); sz = hhdr->hb_sz; /* Normally set only once. */ } bit_no = MARK_BIT_NO((ptr_t)p - (ptr_t)h, sz); if (mark_bit_from_hdr(hhdr, bit_no)) { size_t n_marks = hhdr -> hb_n_marks - 1; clear_mark_bit_from_hdr(hhdr, bit_no); # ifdef PARALLEL_MARK /* Appr. count, don't decrement to zero! */ if (0 != n_marks) { hhdr -> hb_n_marks = n_marks; } # else hhdr -> hb_n_marks = n_marks; # endif } GC_bytes_found -= sz; } } #if defined(GC_ASSERTIONS) && defined(THREADS) && defined(THREAD_LOCAL_ALLOC) extern void GC_check_tls(void); #endif /* Finish up a collection. Assumes lock is held, signals are disabled, */ /* but the world is otherwise running. */ void GC_finish_collection() { CLOCK_TYPE start_time; CLOCK_TYPE finalize_time; CLOCK_TYPE done_time; # if defined(GC_ASSERTIONS) && defined(THREADS) \ && defined(THREAD_LOCAL_ALLOC) && !defined(DBG_HDRS_ALL) /* Check that we marked some of our own data. */ /* FIXME: Add more checks. */ GC_check_tls(); # endif if (GC_print_stats) GET_TIME(start_time); GC_bytes_found = 0; # if defined(LINUX) && defined(__ELF__) && !defined(SMALL_CONFIG) if (getenv("GC_PRINT_ADDRESS_MAP") != 0) { GC_print_address_map(); } # endif COND_DUMP; if (GC_find_leak) { /* Mark all objects on the free list. All objects should be */ /* marked when we're done. */ { word size; /* current object size */ unsigned kind; ptr_t q; for (kind = 0; kind < GC_n_kinds; kind++) { for (size = 1; size <= MAXOBJGRANULES; size++) { q = GC_obj_kinds[kind].ok_freelist[size]; if (q != 0) GC_set_fl_marks(q); } } } GC_start_reclaim(TRUE); /* The above just checks; it doesn't really reclaim anything. */ } GC_finalize(); # ifdef STUBBORN_ALLOC GC_clean_changing_list(); # endif if (GC_print_stats) GET_TIME(finalize_time); if (GC_print_back_height) { # ifdef MAKE_BACK_GRAPH GC_traverse_back_graph(); # else # ifndef SMALL_CONFIG GC_err_printf("Back height not available: " "Rebuild collector with -DMAKE_BACK_GRAPH\n"); # endif # endif } /* Clear free list mark bits, in case they got accidentally marked */ /* (or GC_find_leak is set and they were intentionally marked). */ /* Also subtract memory remaining from GC_bytes_found count. */ /* Note that composite objects on free list are cleared. */ /* Thus accidentally marking a free list is not a problem; only */ /* objects on the list itself will be marked, and that's fixed here. */ { word size; /* current object size */ ptr_t q; /* pointer to current object */ unsigned kind; for (kind = 0; kind < GC_n_kinds; kind++) { for (size = 1; size <= MAXOBJGRANULES; size++) { q = GC_obj_kinds[kind].ok_freelist[size]; if (q != 0) GC_clear_fl_marks(q); } } } if (GC_print_stats == VERBOSE) GC_log_printf("Bytes recovered before sweep - f.l. count = %ld\n", (long)GC_bytes_found); /* Reconstruct free lists to contain everything not marked */ GC_start_reclaim(FALSE); if (GC_print_stats) { GC_log_printf("Heap contains %lu pointer-containing " "+ %lu pointer-free reachable bytes\n", (unsigned long)GC_composite_in_use, (unsigned long)GC_atomic_in_use); } if (GC_is_full_gc) { GC_used_heap_size_after_full = USED_HEAP_SIZE; GC_need_full_gc = FALSE; } else { GC_need_full_gc = USED_HEAP_SIZE - GC_used_heap_size_after_full > min_bytes_allocd(); } if (GC_print_stats == VERBOSE) { GC_log_printf( "Immediately reclaimed %ld bytes in heap of size %lu bytes", (long)GC_bytes_found, (unsigned long)GC_heapsize); # ifdef USE_MUNMAP GC_log_printf("(%lu unmapped)", (unsigned long)GC_unmapped_bytes); # endif GC_log_printf("\n"); } /* Reset or increment counters for next cycle */ GC_n_attempts = 0; GC_is_full_gc = FALSE; GC_bytes_allocd_before_gc += GC_bytes_allocd; GC_non_gc_bytes_at_gc = GC_non_gc_bytes; GC_bytes_allocd = 0; GC_bytes_freed = 0; GC_finalizer_bytes_freed = 0; # ifdef USE_MUNMAP GC_unmap_old(); # endif if (GC_print_stats) { GET_TIME(done_time); GC_log_printf("Finalize + initiate sweep took %lu + %lu msecs\n", MS_TIME_DIFF(finalize_time,start_time), MS_TIME_DIFF(done_time,finalize_time)); } } /* Externally callable routine to invoke full, stop-world collection */ int GC_try_to_collect(GC_stop_func stop_func) { int result; DCL_LOCK_STATE; if (!GC_is_initialized) GC_init(); if (GC_debugging_started) GC_print_all_smashed(); GC_INVOKE_FINALIZERS(); LOCK(); ENTER_GC(); if (!GC_is_initialized) GC_init_inner(); /* Minimize junk left in my registers */ GC_noop(0,0,0,0,0,0); result = (int)GC_try_to_collect_inner(stop_func); EXIT_GC(); UNLOCK(); if(result) { if (GC_debugging_started) GC_print_all_smashed(); GC_INVOKE_FINALIZERS(); } return(result); } void GC_gcollect(void) { (void)GC_try_to_collect(GC_never_stop_func); if (GC_have_errors) GC_print_all_errors(); } word GC_n_heap_sects = 0; /* Number of sections currently in heap. */ /* * Use the chunk of memory starting at p of size bytes as part of the heap. * Assumes p is HBLKSIZE aligned, and bytes is a multiple of HBLKSIZE. */ void GC_add_to_heap(struct hblk *p, size_t bytes) { hdr * phdr; if (GC_n_heap_sects >= MAX_HEAP_SECTS) { ABORT("Too many heap sections: Increase MAXHINCR or MAX_HEAP_SECTS"); } phdr = GC_install_header(p); if (0 == phdr) { /* This is extremely unlikely. Can't add it. This will */ /* almost certainly result in a 0 return from the allocator, */ /* which is entirely appropriate. */ return; } GC_heap_sects[GC_n_heap_sects].hs_start = (ptr_t)p; GC_heap_sects[GC_n_heap_sects].hs_bytes = bytes; GC_n_heap_sects++; phdr -> hb_sz = bytes; phdr -> hb_flags = 0; GC_freehblk(p); GC_heapsize += bytes; if ((ptr_t)p <= (ptr_t)GC_least_plausible_heap_addr || GC_least_plausible_heap_addr == 0) { GC_least_plausible_heap_addr = (void *)((ptr_t)p - sizeof(word)); /* Making it a little smaller than necessary prevents */ /* us from getting a false hit from the variable */ /* itself. There's some unintentional reflection */ /* here. */ } if ((ptr_t)p + bytes >= (ptr_t)GC_greatest_plausible_heap_addr) { GC_greatest_plausible_heap_addr = (void *)((ptr_t)p + bytes); } } # if !defined(NO_DEBUGGING) void GC_print_heap_sects(void) { unsigned i; GC_printf("Total heap size: %lu\n", (unsigned long) GC_heapsize); for (i = 0; i < GC_n_heap_sects; i++) { ptr_t start = GC_heap_sects[i].hs_start; size_t len = GC_heap_sects[i].hs_bytes; struct hblk *h; unsigned nbl = 0; GC_printf("Section %d from %p to %p ", i, start, start + len); for (h = (struct hblk *)start; h < (struct hblk *)(start + len); h++) { if (GC_is_black_listed(h, HBLKSIZE)) nbl++; } GC_printf("%lu/%lu blacklisted\n", (unsigned long)nbl, (unsigned long)(len/HBLKSIZE)); } } # endif void * GC_least_plausible_heap_addr = (void *)ONES; void * GC_greatest_plausible_heap_addr = 0; static INLINE ptr_t GC_max(ptr_t x, ptr_t y) { return(x > y? x : y); } static INLINE ptr_t GC_min(ptr_t x, ptr_t y) { return(x < y? x : y); } void GC_set_max_heap_size(GC_word n) { GC_max_heapsize = n; } GC_word GC_max_retries = 0; /* * this explicitly increases the size of the heap. It is used * internally, but may also be invoked from GC_expand_hp by the user. * The argument is in units of HBLKSIZE. * Tiny values of n are rounded up. * Returns FALSE on failure. */ GC_bool GC_expand_hp_inner(word n) { word bytes; struct hblk * space; word expansion_slop; /* Number of bytes by which we expect the */ /* heap to expand soon. */ if (n < MINHINCR) n = MINHINCR; bytes = n * HBLKSIZE; /* Make sure bytes is a multiple of GC_page_size */ { word mask = GC_page_size - 1; bytes += mask; bytes &= ~mask; } if (GC_max_heapsize != 0 && GC_heapsize + bytes > GC_max_heapsize) { /* Exceeded self-imposed limit */ return(FALSE); } space = GET_MEM(bytes); if( space == 0 ) { if (GC_print_stats) { GC_log_printf("Failed to expand heap by %ld bytes\n", (unsigned long)bytes); } return(FALSE); } if (GC_print_stats) { GC_log_printf("Increasing heap size by %lu after %lu allocated bytes\n", (unsigned long)bytes, (unsigned long)GC_bytes_allocd); } expansion_slop = min_bytes_allocd() + 4*MAXHINCR*HBLKSIZE; if ((GC_last_heap_addr == 0 && !((word)space & SIGNB)) || (GC_last_heap_addr != 0 && GC_last_heap_addr < (ptr_t)space)) { /* Assume the heap is growing up */ GC_greatest_plausible_heap_addr = (void *)GC_max((ptr_t)GC_greatest_plausible_heap_addr, (ptr_t)space + bytes + expansion_slop); } else { /* Heap is growing down */ GC_least_plausible_heap_addr = (void *)GC_min((ptr_t)GC_least_plausible_heap_addr, (ptr_t)space - expansion_slop); } # if defined(LARGE_CONFIG) if (((ptr_t)GC_greatest_plausible_heap_addr <= (ptr_t)space + bytes || (ptr_t)GC_least_plausible_heap_addr >= (ptr_t)space) && GC_heapsize > 0) { /* GC_add_to_heap will fix this, but ... */ WARN("Too close to address space limit: blacklisting ineffective\n", 0); } # endif GC_prev_heap_addr = GC_last_heap_addr; GC_last_heap_addr = (ptr_t)space; GC_add_to_heap(space, bytes); /* Force GC before we are likely to allocate past expansion_slop */ GC_collect_at_heapsize = GC_heapsize + expansion_slop - 2*MAXHINCR*HBLKSIZE; # if defined(LARGE_CONFIG) if (GC_collect_at_heapsize < GC_heapsize /* wrapped */) GC_collect_at_heapsize = (word)(-1); # endif return(TRUE); } /* Really returns a bool, but it's externally visible, so that's clumsy. */ /* Arguments is in bytes. */ int GC_expand_hp(size_t bytes) { int result; DCL_LOCK_STATE; LOCK(); if (!GC_is_initialized) GC_init_inner(); result = (int)GC_expand_hp_inner(divHBLKSZ((word)bytes)); if (result) GC_requested_heapsize += bytes; UNLOCK(); return(result); } unsigned GC_fail_count = 0; /* How many consecutive GC/expansion failures? */ /* Reset by GC_allochblk. */ GC_bool GC_collect_or_expand(word needed_blocks, GC_bool ignore_off_page) { if (!GC_incremental && !GC_dont_gc && ((GC_dont_expand && GC_bytes_allocd > 0) || GC_should_collect())) { GC_gcollect_inner(); } else { word blocks_to_get = GC_heapsize/(HBLKSIZE*GC_free_space_divisor) + needed_blocks; if (blocks_to_get > MAXHINCR) { word slop; /* Get the minimum required to make it likely that we */ /* can satisfy the current request in the presence of black- */ /* listing. This will probably be more than MAXHINCR. */ if (ignore_off_page) { slop = 4; } else { slop = 2*divHBLKSZ(BL_LIMIT); if (slop > needed_blocks) slop = needed_blocks; } if (needed_blocks + slop > MAXHINCR) { blocks_to_get = needed_blocks + slop; } else { blocks_to_get = MAXHINCR; } } if (!GC_expand_hp_inner(blocks_to_get) && !GC_expand_hp_inner(needed_blocks)) { if (GC_fail_count++ < GC_max_retries) { WARN("Out of Memory! Trying to continue ...\n", 0); GC_gcollect_inner(); } else { # if !defined(AMIGA) || !defined(GC_AMIGA_FASTALLOC) WARN("Out of Memory! Returning NIL!\n", 0); # endif return(FALSE); } } else { if (GC_fail_count && GC_print_stats) { GC_printf("Memory available again ...\n"); } } } return(TRUE); } /* * Make sure the object free list for size gran (in granules) is not empty. * Return a pointer to the first object on the free list. * The object MUST BE REMOVED FROM THE FREE LIST BY THE CALLER. * Assumes we hold the allocator lock and signals are disabled. * */ ptr_t GC_allocobj(size_t gran, int kind) { void ** flh = &(GC_obj_kinds[kind].ok_freelist[gran]); GC_bool tried_minor = FALSE; if (gran == 0) return(0); while (*flh == 0) { ENTER_GC(); /* Do our share of marking work */ if(TRUE_INCREMENTAL) GC_collect_a_little_inner(1); /* Sweep blocks for objects of this size */ GC_continue_reclaim(gran, kind); EXIT_GC(); if (*flh == 0) { GC_new_hblk(gran, kind); } if (*flh == 0) { ENTER_GC(); if (GC_incremental && GC_time_limit == GC_TIME_UNLIMITED && ! tried_minor ) { GC_collect_a_little_inner(1); tried_minor = TRUE; } else { if (!GC_collect_or_expand((word)1,FALSE)) { EXIT_GC(); return(0); } } EXIT_GC(); } } /* Successful allocation; reset failure count. */ GC_fail_count = 0; return(*flh); } synopsis-0.12/src/Synopsis/gc/bdw-gc.pc.in0000664000076400007640000000040511104702316017754 0ustar stefanstefanprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: Boehm-Demers-Weiser Conservative Garbage Collector Description: A garbage collector for C and C++ Version: @PACKAGE_VERSION@ Libs: -L${libdir} -lgc Cflags: -I${includedir} synopsis-0.12/src/Synopsis/gc/NT_THREADS_MAKEFILE0000664000076400007640000015255311104702316020547 0ustar stefanstefan# Microsoft Developer Studio Generated NMAKE File, Format Version 4.10 # This has been hand-edited way too many times. # A clean, manually generated makefile would be an improvement. # TARGTYPE "Win32 (x86) Application" 0x0101 # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 AO_VERSION=1.2 !IF "$(CFG)" == "" CFG=gctest - Win32 Release !MESSAGE No configuration specified. Defaulting to cord - Win32 Debug. !ENDIF !IF "$(CFG)" != "gc - Win32 Release" && "$(CFG)" != "gc - Win32 Debug" &&\ "$(CFG)" != "gctest - Win32 Release" && "$(CFG)" != "gctest - Win32 Debug" &&\ "$(CFG)" != "cord - Win32 Release" && "$(CFG)" != "cord - Win32 Debug" !MESSAGE Invalid configuration "$(CFG)" specified. !MESSAGE You can specify a configuration when running NMAKE on this makefile !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "gc.mak" CFG="cord - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "gc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "gc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "gctest - Win32 Release" (based on "Win32 (x86) Application") !MESSAGE "gctest - Win32 Debug" (based on "Win32 (x86) Application") !MESSAGE "cord - Win32 Release" (based on "Win32 (x86) Application") !MESSAGE "cord - Win32 Debug" (based on "Win32 (x86) Application") !MESSAGE !ERROR An invalid configuration is specified. !ENDIF !IF "$(OS)" == "Windows_NT" NULL= !ELSE NULL=nul !ENDIF ################################################################################ # Begin Project # PROP Target_Last_Scanned "gctest - Win32 Debug" !IF "$(CFG)" == "gc - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Target_Dir "" OUTDIR=.\Release INTDIR=.\Release ALL : ".\Release\gc.dll" ".\Release\gc.bsc" CLEAN : -@erase ".\Release\allchblk.obj" -@erase ".\Release\allchblk.sbr" -@erase ".\Release\alloc.obj" -@erase ".\Release\alloc.sbr" -@erase ".\Release\blacklst.obj" -@erase ".\Release\blacklst.sbr" -@erase ".\Release\checksums.obj" -@erase ".\Release\checksums.sbr" -@erase ".\Release\dbg_mlc.obj" -@erase ".\Release\dbg_mlc.sbr" -@erase ".\Release\dyn_load.obj" -@erase ".\Release\dyn_load.sbr" -@erase ".\Release\finalize.obj" -@erase ".\Release\finalize.sbr" -@erase ".\Release\gc.bsc" -@erase ".\Release\gc_cpp.obj" -@erase ".\Release\gc_cpp.sbr" -@erase ".\Release\gc.dll" -@erase ".\Release\gc.exp" -@erase ".\Release\gc.lib" -@erase ".\Release\headers.obj" -@erase ".\Release\headers.sbr" -@erase ".\Release\mach_dep.obj" -@erase ".\Release\mach_dep.sbr" -@erase ".\Release\malloc.obj" -@erase ".\Release\malloc.sbr" -@erase ".\Release\mallocx.obj" -@erase ".\Release\mallocx.sbr" -@erase ".\Release\mark.obj" -@erase ".\Release\mark.sbr" -@erase ".\Release\mark_rts.obj" -@erase ".\Release\mark_rts.sbr" -@erase ".\Release\misc.obj" -@erase ".\Release\misc.sbr" -@erase ".\Release\new_hblk.obj" -@erase ".\Release\new_hblk.sbr" -@erase ".\Release\obj_map.obj" -@erase ".\Release\obj_map.sbr" -@erase ".\Release\os_dep.obj" -@erase ".\Release\os_dep.sbr" -@erase ".\Release\ptr_chck.obj" -@erase ".\Release\ptr_chck.sbr" -@erase ".\Release\reclaim.obj" -@erase ".\Release\reclaim.sbr" -@erase ".\Release\stubborn.obj" -@erase ".\Release\stubborn.sbr" -@erase ".\Release\typd_mlc.obj" -@erase ".\Release\typd_mlc.sbr" -@erase ".\Release\win32_threads.obj" -@erase ".\Release\win32_threads.sbr" -@erase ".\Release\msvc_dbg.obj" -@erase ".\Release\msvc_dbg.sbr" "$(OUTDIR)" : if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" CPP=cl.exe # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c # ADD CPP /nologo /MD /W3 /GX /O2 /I include /D "NDEBUG" /D "GC_BUILD" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "GC_WIN32_THREADS" /FR /YX /c CPP_PROJ=/nologo /MD /W3 /GX /O2 /I include /D "NDEBUG" /D "GC_BUILD" /D\ "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D\ "GC_WIN32_THREADS" /FR"$(INTDIR)/" /Fp"$(INTDIR)/gc.pch" \ /Ilibatomic_ops-$(AO_VERSION)/src /YX /Fo"$(INTDIR)/" /c CPP_OBJS=.\Release/ CPP_SBRS=.\Release/ .c{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .c{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< MTL=mktyplib.exe # ADD BASE MTL /nologo /D "NDEBUG" /win32 # ADD MTL /nologo /D "NDEBUG" /win32 MTL_PROJ=/nologo /D "NDEBUG" /win32 RSC=rc.exe # ADD BASE RSC /l 0x809 /d "NDEBUG" # ADD RSC /l 0x809 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo BSC32_FLAGS=/nologo /o"$(OUTDIR)/gc.bsc" BSC32_SBRS= \ ".\Release\allchblk.sbr" \ ".\Release\alloc.sbr" \ ".\Release\blacklst.sbr" \ ".\Release\checksums.sbr" \ ".\Release\dbg_mlc.sbr" \ ".\Release\dyn_load.sbr" \ ".\Release\finalize.sbr" \ ".\Release\gc_cpp.sbr" \ ".\Release\headers.sbr" \ ".\Release\mach_dep.sbr" \ ".\Release\malloc.sbr" \ ".\Release\mallocx.sbr" \ ".\Release\mark.sbr" \ ".\Release\mark_rts.sbr" \ ".\Release\misc.sbr" \ ".\Release\new_hblk.sbr" \ ".\Release\obj_map.sbr" \ ".\Release\os_dep.sbr" \ ".\Release\ptr_chck.sbr" \ ".\Release\reclaim.sbr" \ ".\Release\stubborn.sbr" \ ".\Release\typd_mlc.sbr" \ ".\Release\msvc_dbg.sbr" \ ".\Release\win32_threads.sbr" ".\Release\gc.bsc" : "$(OUTDIR)" $(BSC32_SBRS) $(BSC32) @<< $(BSC32_FLAGS) $(BSC32_SBRS) << LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ odbccp32.lib /nologo /subsystem:windows /dll /incremental:no\ /pdb:"$(OUTDIR)/gc.pdb" /machine:I386 /out:"$(OUTDIR)/gc.dll"\ /implib:"$(OUTDIR)/gc.lib" LINK32_OBJS= \ ".\Release\allchblk.obj" \ ".\Release\alloc.obj" \ ".\Release\blacklst.obj" \ ".\Release\checksums.obj" \ ".\Release\dbg_mlc.obj" \ ".\Release\dyn_load.obj" \ ".\Release\finalize.obj" \ ".\Release\gc_cpp.obj" \ ".\Release\headers.obj" \ ".\Release\mach_dep.obj" \ ".\Release\malloc.obj" \ ".\Release\mallocx.obj" \ ".\Release\mark.obj" \ ".\Release\mark_rts.obj" \ ".\Release\misc.obj" \ ".\Release\new_hblk.obj" \ ".\Release\obj_map.obj" \ ".\Release\os_dep.obj" \ ".\Release\ptr_chck.obj" \ ".\Release\reclaim.obj" \ ".\Release\stubborn.obj" \ ".\Release\typd_mlc.obj" \ ".\Release\msvc_dbg.obj" \ ".\Release\win32_threads.obj" ".\Release\gc.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) $(LINK32) @<< $(LINK32_FLAGS) $(LINK32_OBJS) << !ELSEIF "$(CFG)" == "gc - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" OUTDIR=.\Debug INTDIR=.\Debug ALL : ".\Debug\gc.dll" ".\Debug\gc.bsc" CLEAN : -@erase ".\Debug\allchblk.obj" -@erase ".\Debug\allchblk.sbr" -@erase ".\Debug\alloc.obj" -@erase ".\Debug\alloc.sbr" -@erase ".\Debug\blacklst.obj" -@erase ".\Debug\blacklst.sbr" -@erase ".\Debug\checksums.obj" -@erase ".\Debug\checksums.sbr" -@erase ".\Debug\dbg_mlc.obj" -@erase ".\Debug\dbg_mlc.sbr" -@erase ".\Debug\dyn_load.obj" -@erase ".\Debug\dyn_load.sbr" -@erase ".\Debug\finalize.obj" -@erase ".\Debug\finalize.sbr" -@erase ".\Debug\gc_cpp.obj" -@erase ".\Debug\gc_cpp.sbr" -@erase ".\Debug\gc.bsc" -@erase ".\Debug\gc.dll" -@erase ".\Debug\gc.exp" -@erase ".\Debug\gc.lib" -@erase ".\Debug\gc.map" -@erase ".\Debug\gc.pdb" -@erase ".\Debug\headers.obj" -@erase ".\Debug\headers.sbr" -@erase ".\Debug\mach_dep.obj" -@erase ".\Debug\mach_dep.sbr" -@erase ".\Debug\malloc.obj" -@erase ".\Debug\malloc.sbr" -@erase ".\Debug\mallocx.obj" -@erase ".\Debug\mallocx.sbr" -@erase ".\Debug\mark.obj" -@erase ".\Debug\mark.sbr" -@erase ".\Debug\mark_rts.obj" -@erase ".\Debug\mark_rts.sbr" -@erase ".\Debug\misc.obj" -@erase ".\Debug\misc.sbr" -@erase ".\Debug\new_hblk.obj" -@erase ".\Debug\new_hblk.sbr" -@erase ".\Debug\obj_map.obj" -@erase ".\Debug\obj_map.sbr" -@erase ".\Debug\os_dep.obj" -@erase ".\Debug\os_dep.sbr" -@erase ".\Debug\ptr_chck.obj" -@erase ".\Debug\ptr_chck.sbr" -@erase ".\Debug\reclaim.obj" -@erase ".\Debug\reclaim.sbr" -@erase ".\Debug\stubborn.obj" -@erase ".\Debug\stubborn.sbr" -@erase ".\Debug\typd_mlc.obj" -@erase ".\Debug\typd_mlc.sbr" -@erase ".\Debug\vc40.idb" -@erase ".\Debug\vc40.pdb" -@erase ".\Debug\win32_threads.obj" -@erase ".\Debug\win32_threads.sbr" -@erase ".\Debug\msvc_dbg.obj" -@erase ".\Debug\msvc_dbg.sbr" "$(OUTDIR)" : if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" CPP=cl.exe # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c # ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I include /D "_DEBUG" /D "GC_BUILD" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "GC_WIN32_THREADS" /FR /YX /c CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I include /D "_DEBUG" /D "GC_BUILD"\ /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" \ /D "GC_ASSERTIONS" /D "__STDC__" /D\ "GC_WIN32_THREADS" /FR"$(INTDIR)/" /Fp"$(INTDIR)/gc.pch" /YX /Fo"$(INTDIR)/"\ /Ilibatomic_ops-$(AO_VERSION)/src /Fd"$(INTDIR)/" /c CPP_OBJS=.\Debug/ CPP_SBRS=.\Debug/ .c{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .c{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< MTL=mktyplib.exe # ADD BASE MTL /nologo /D "_DEBUG" /win32 # ADD MTL /nologo /D "_DEBUG" /win32 MTL_PROJ=/nologo /D "_DEBUG" /win32 RSC=rc.exe # ADD BASE RSC /l 0x809 /d "_DEBUG" # ADD RSC /l 0x809 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo BSC32_FLAGS=/nologo /o"$(OUTDIR)/gc.bsc" BSC32_SBRS= \ ".\Debug\allchblk.sbr" \ ".\Debug\alloc.sbr" \ ".\Debug\blacklst.sbr" \ ".\Debug\checksums.sbr" \ ".\Debug\dbg_mlc.sbr" \ ".\Debug\dyn_load.sbr" \ ".\Debug\finalize.sbr" \ ".\Debug\gc_cpp.sbr" \ ".\Debug\headers.sbr" \ ".\Debug\mach_dep.sbr" \ ".\Debug\malloc.sbr" \ ".\Debug\mallocx.sbr" \ ".\Debug\mark.sbr" \ ".\Debug\mark_rts.sbr" \ ".\Debug\misc.sbr" \ ".\Debug\new_hblk.sbr" \ ".\Debug\obj_map.sbr" \ ".\Debug\os_dep.sbr" \ ".\Debug\ptr_chck.sbr" \ ".\Debug\reclaim.sbr" \ ".\Debug\stubborn.sbr" \ ".\Debug\typd_mlc.sbr" \ ".\Debug\msvc_dbg.sbr" \ ".\Debug\win32_threads.sbr" ".\Debug\gc.bsc" : "$(OUTDIR)" $(BSC32_SBRS) $(BSC32) @<< $(BSC32_FLAGS) $(BSC32_SBRS) << LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ odbccp32.lib /nologo /subsystem:windows /dll /incremental:no\ /pdb:"$(OUTDIR)/gc.pdb" /map:"$(INTDIR)/gc.map" /debug /machine:I386\ /out:"$(OUTDIR)/gc.dll" /implib:"$(OUTDIR)/gc.lib" LINK32_OBJS= \ ".\Debug\allchblk.obj" \ ".\Debug\alloc.obj" \ ".\Debug\blacklst.obj" \ ".\Debug\checksums.obj" \ ".\Debug\dbg_mlc.obj" \ ".\Debug\dyn_load.obj" \ ".\Debug\finalize.obj" \ ".\Debug\gc_cpp.obj" \ ".\Debug\headers.obj" \ ".\Debug\mach_dep.obj" \ ".\Debug\malloc.obj" \ ".\Debug\mallocx.obj" \ ".\Debug\mark.obj" \ ".\Debug\mark_rts.obj" \ ".\Debug\misc.obj" \ ".\Debug\new_hblk.obj" \ ".\Debug\obj_map.obj" \ ".\Debug\os_dep.obj" \ ".\Debug\ptr_chck.obj" \ ".\Debug\reclaim.obj" \ ".\Debug\stubborn.obj" \ ".\Debug\typd_mlc.obj" \ ".\Debug\msvc_dbg.obj" \ ".\Debug\win32_threads.obj" ".\Debug\gc.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) $(LINK32) @<< $(LINK32_FLAGS) $(LINK32_OBJS) << !ELSEIF "$(CFG)" == "gctest - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "gctest\Release" # PROP BASE Intermediate_Dir "gctest\Release" # PROP BASE Target_Dir "gctest" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "gctest\Release" # PROP Intermediate_Dir "gctest\Release" # PROP Target_Dir "gctest" OUTDIR=.\gctest\Release INTDIR=.\gctest\Release ALL : "gc - Win32 Release" ".\Release\gctest.exe" CLEAN : -@erase ".\gctest\Release\test.obj" -@erase ".\Release\gctest.exe" "$(OUTDIR)" : if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" test.c : tests\test.c copy tests\test.c test.c CPP=cl.exe # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c # ADD CPP /nologo /MD /W3 /GX /O2 /I include /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "GC_WIN32_THREADS" /YX /c CPP_PROJ=/nologo /MD /W3 /GX /O2 /I include /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D\ "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "GC_WIN32_THREADS"\ /Ilibatomic_ops-$(AO_VERSION)/src /Fp"$(INTDIR)/gctest.pch" \ /YX /Fo"$(INTDIR)/" /c CPP_OBJS=.\gctest\Release/ CPP_SBRS=.\. .c{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .c{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< MTL=mktyplib.exe # ADD BASE MTL /nologo /D "NDEBUG" /win32 # ADD MTL /nologo /D "NDEBUG" /win32 MTL_PROJ=/nologo /D "NDEBUG" /win32 RSC=rc.exe # ADD BASE RSC /l 0x809 /d "NDEBUG" # ADD RSC /l 0x809 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo BSC32_FLAGS=/nologo /o"$(OUTDIR)/gctest.bsc" BSC32_SBRS= \ LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"Release/gctest.exe" LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ odbccp32.lib /nologo /subsystem:windows /incremental:no\ /pdb:"$(OUTDIR)/gctest.pdb" /machine:I386 /out:"Release/gctest.exe" LINK32_OBJS= \ ".\gctest\Release\test.obj" \ ".\Release\gc.lib" ".\Release\gctest.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) $(LINK32) @<< $(LINK32_FLAGS) $(LINK32_OBJS) << !ELSEIF "$(CFG)" == "gctest - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "gctest\Debug" # PROP BASE Intermediate_Dir "gctest\Debug" # PROP BASE Target_Dir "gctest" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "gctest\Debug" # PROP Intermediate_Dir "gctest\Debug" # PROP Target_Dir "gctest" OUTDIR=.\gctest\Debug INTDIR=.\gctest\Debug ALL : "gc - Win32 Debug" ".\Debug\gctest.exe" ".\gctest\Debug\gctest.bsc" CLEAN : -@erase ".\Debug\gctest.exe" -@erase ".\gctest\Debug\gctest.bsc" -@erase ".\gctest\Debug\gctest.map" -@erase ".\gctest\Debug\gctest.pdb" -@erase ".\gctest\Debug\test.obj" -@erase ".\gctest\Debug\test.sbr" -@erase ".\gctest\Debug\vc40.idb" -@erase ".\gctest\Debug\vc40.pdb" "$(OUTDIR)" : if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" CPP=cl.exe # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c # ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "GC_WIN32_THREADS" /FR /YX /c CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I include /D "_DEBUG" /D "WIN32" /D "_WINDOWS"\ /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "GC_WIN32_THREADS" /FR"$(INTDIR)/"\ /Ilibatomic_ops-$(AO_VERSION)/src /Fp"$(INTDIR)/gctest.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c CPP_OBJS=.\gctest\Debug/ CPP_SBRS=.\gctest\Debug/ .c{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .c{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< MTL=mktyplib.exe # ADD BASE MTL /nologo /D "_DEBUG" /win32 # ADD MTL /nologo /D "_DEBUG" /win32 MTL_PROJ=/nologo /D "_DEBUG" /win32 RSC=rc.exe # ADD BASE RSC /l 0x809 /d "_DEBUG" # ADD RSC /l 0x809 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo BSC32_FLAGS=/nologo /o"$(OUTDIR)/gctest.bsc" BSC32_SBRS= \ ".\gctest\Debug\test.sbr" ".\gctest\Debug\gctest.bsc" : "$(OUTDIR)" $(BSC32_SBRS) $(BSC32) @<< $(BSC32_FLAGS) $(BSC32_SBRS) << LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:no /map /debug /machine:I386 /out:"Debug/gctest.exe" LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ odbccp32.lib /nologo /subsystem:windows /incremental:no\ /pdb:"$(OUTDIR)/gctest.pdb" /map:"$(INTDIR)/gctest.map" /debug /machine:I386\ /out:"Debug/gctest.exe" LINK32_OBJS= \ ".\Debug\gc.lib" \ ".\gctest\Debug\test.obj" ".\Debug\gctest.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) $(LINK32) @<< $(LINK32_FLAGS) $(LINK32_OBJS) << !ELSEIF "$(CFG)" == "cord - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "cord\Release" # PROP BASE Intermediate_Dir "cord\Release" # PROP BASE Target_Dir "cord" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "cord\Release" # PROP Intermediate_Dir "cord\Release" # PROP Target_Dir "cord" OUTDIR=.\cord\Release INTDIR=.\cord\Release ALL : "gc - Win32 Release" ".\Release\de.exe" CLEAN : -@erase ".\cord\Release\cordbscs.obj" -@erase ".\cord\Release\cordxtra.obj" -@erase ".\cord\Release\de.obj" -@erase ".\cord\Release\de_win.obj" -@erase ".\cord\Release\de_win.res" -@erase ".\Release\de.exe" "$(OUTDIR)" : if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" CPP=cl.exe # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c # ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /YX /c CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "." /I include /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D\ /Ilibatomic_ops-$(AO_VERSION)/src "ALL_INTERIOR_POINTERS" /Fp"$(INTDIR)/cord.pch" /YX /Fo"$(INTDIR)/" /c CPP_OBJS=.\cord\Release/ CPP_SBRS=.\. .c{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .c{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< MTL=mktyplib.exe # ADD BASE MTL /nologo /D "NDEBUG" /win32 # ADD MTL /nologo /D "NDEBUG" /win32 MTL_PROJ=/nologo /D "NDEBUG" /win32 RSC=rc.exe # ADD BASE RSC /l 0x809 /d "NDEBUG" # ADD RSC /l 0x809 /d "NDEBUG" RSC_PROJ=/l 0x809 /fo"$(INTDIR)/de_win.res" /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo BSC32_FLAGS=/nologo /o"$(OUTDIR)/cord.bsc" BSC32_SBRS= \ LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"Release/de.exe" LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ odbccp32.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)/de.pdb"\ /machine:I386 /out:"Release/de.exe" LINK32_OBJS= \ ".\cord\Release\cordbscs.obj" \ ".\cord\Release\cordxtra.obj" \ ".\cord\Release\de.obj" \ ".\cord\Release\de_win.obj" \ ".\cord\Release\de_win.res" \ ".\Release\gc.lib" ".\Release\de.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) $(LINK32) @<< $(LINK32_FLAGS) $(LINK32_OBJS) << !ELSEIF "$(CFG)" == "cord - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "cord\Debug" # PROP BASE Intermediate_Dir "cord\Debug" # PROP BASE Target_Dir "cord" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "cord\Debug" # PROP Intermediate_Dir "cord\Debug" # PROP Target_Dir "cord" OUTDIR=.\cord\Debug INTDIR=.\cord\Debug ALL : "gc - Win32 Debug" ".\Debug\de.exe" CLEAN : -@erase ".\cord\Debug\cordbscs.obj" -@erase ".\cord\Debug\cordxtra.obj" -@erase ".\cord\Debug\de.obj" -@erase ".\cord\Debug\de.pdb" -@erase ".\cord\Debug\de_win.obj" -@erase ".\cord\Debug\de_win.res" -@erase ".\cord\Debug\vc40.idb" -@erase ".\cord\Debug\vc40.pdb" -@erase ".\Debug\de.exe" -@erase ".\Debug\de.ilk" "$(OUTDIR)" : if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" CPP=cl.exe # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c # ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /YX /c CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I include /D "_DEBUG" /D "WIN32" /D\ "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /Fp"$(INTDIR)/cord.pch" /YX\ /Ilibatomic_ops-$(AO_VERSION)/src /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c CPP_OBJS=.\cord\Debug/ CPP_SBRS=.\. .c{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .c{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< MTL=mktyplib.exe # ADD BASE MTL /nologo /D "_DEBUG" /win32 # ADD MTL /nologo /D "_DEBUG" /win32 MTL_PROJ=/nologo /D "_DEBUG" /win32 RSC=rc.exe # ADD BASE RSC /l 0x809 /d "_DEBUG" # ADD RSC /l 0x809 /d "_DEBUG" RSC_PROJ=/l 0x809 /fo"$(INTDIR)/de_win.res" /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo BSC32_FLAGS=/nologo /o"$(OUTDIR)/cord.bsc" BSC32_SBRS= \ LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /out:"Debug/de.exe" LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ odbccp32.lib /nologo /subsystem:windows /incremental:yes\ /pdb:"$(OUTDIR)/de.pdb" /debug /machine:I386 /out:"Debug/de.exe" LINK32_OBJS= \ ".\cord\Debug\cordbscs.obj" \ ".\cord\Debug\cordxtra.obj" \ ".\cord\Debug\de.obj" \ ".\cord\Debug\de_win.obj" \ ".\cord\Debug\de_win.res" \ ".\Debug\gc.lib" ".\Debug\de.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) $(LINK32) @<< $(LINK32_FLAGS) $(LINK32_OBJS) << !ENDIF ################################################################################ # Begin Target # Name "gc - Win32 Release" # Name "gc - Win32 Debug" !IF "$(CFG)" == "gc - Win32 Release" !ELSEIF "$(CFG)" == "gc - Win32 Debug" !ENDIF ################################################################################ # Begin Source File SOURCE=.\gc_cpp.cpp !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_RECLA=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ ".\include\gc_cpp.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_RECLA=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\gc_cpp.obj" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)" ".\Release\gc_cpp.sbr" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_RECLA=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ ".\include\gc_cpp.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_RECLA=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\gc_cpp.obj" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)" ".\Debug\gc_cpp.sbr" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\reclaim.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_RECLA=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_RECLA=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\reclaim.obj" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)" ".\Release\reclaim.sbr" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_RECLA=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_RECLA=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\reclaim.obj" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)" ".\Debug\reclaim.sbr" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\os_dep.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_OS_DE=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\STAT.H"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_OS_DE=\ ".\il\PCR_IL.h"\ ".\mm\PCR_MM.h"\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\vd\PCR_VD.h"\ ".\Release\os_dep.obj" : $(SOURCE) $(DEP_CPP_OS_DE) "$(INTDIR)" ".\Release\os_dep.sbr" : $(SOURCE) $(DEP_CPP_OS_DE) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_OS_DE=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\STAT.H"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_OS_DE=\ ".\il\PCR_IL.h"\ ".\mm\PCR_MM.h"\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\vd\PCR_VD.h"\ ".\Debug\os_dep.obj" : $(SOURCE) $(DEP_CPP_OS_DE) "$(INTDIR)" ".\Debug\os_dep.sbr" : $(SOURCE) $(DEP_CPP_OS_DE) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\misc.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_MISC_=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MISC_=\ ".\il\PCR_IL.h"\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\misc.obj" : $(SOURCE) $(DEP_CPP_MISC_) "$(INTDIR)" ".\Release\misc.sbr" : $(SOURCE) $(DEP_CPP_MISC_) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_MISC_=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MISC_=\ ".\il\PCR_IL.h"\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\misc.obj" : $(SOURCE) $(DEP_CPP_MISC_) "$(INTDIR)" ".\Debug\misc.sbr" : $(SOURCE) $(DEP_CPP_MISC_) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\mark_rts.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_MARK_=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MARK_=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\mark_rts.obj" : $(SOURCE) $(DEP_CPP_MARK_) "$(INTDIR)" ".\Release\mark_rts.sbr" : $(SOURCE) $(DEP_CPP_MARK_) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_MARK_=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MARK_=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\mark_rts.obj" : $(SOURCE) $(DEP_CPP_MARK_) "$(INTDIR)" ".\Debug\mark_rts.sbr" : $(SOURCE) $(DEP_CPP_MARK_) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\mach_dep.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_MACH_=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MACH_=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\mach_dep.obj" : $(SOURCE) $(DEP_CPP_MACH_) "$(INTDIR)" ".\Release\mach_dep.sbr" : $(SOURCE) $(DEP_CPP_MACH_) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_MACH_=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MACH_=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\mach_dep.obj" : $(SOURCE) $(DEP_CPP_MACH_) "$(INTDIR)" ".\Debug\mach_dep.sbr" : $(SOURCE) $(DEP_CPP_MACH_) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\headers.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_HEADE=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_HEADE=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\headers.obj" : $(SOURCE) $(DEP_CPP_HEADE) "$(INTDIR)" ".\Release\headers.sbr" : $(SOURCE) $(DEP_CPP_HEADE) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_HEADE=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_HEADE=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\headers.obj" : $(SOURCE) $(DEP_CPP_HEADE) "$(INTDIR)" ".\Debug\headers.sbr" : $(SOURCE) $(DEP_CPP_HEADE) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\alloc.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_ALLOC=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_ALLOC=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\alloc.obj" : $(SOURCE) $(DEP_CPP_ALLOC) "$(INTDIR)" ".\Release\alloc.sbr" : $(SOURCE) $(DEP_CPP_ALLOC) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_ALLOC=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_ALLOC=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\alloc.obj" : $(SOURCE) $(DEP_CPP_ALLOC) "$(INTDIR)" ".\Debug\alloc.sbr" : $(SOURCE) $(DEP_CPP_ALLOC) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\allchblk.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_ALLCH=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_ALLCH=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\allchblk.obj" : $(SOURCE) $(DEP_CPP_ALLCH) "$(INTDIR)" ".\Release\allchblk.sbr" : $(SOURCE) $(DEP_CPP_ALLCH) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_ALLCH=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_ALLCH=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\allchblk.obj" : $(SOURCE) $(DEP_CPP_ALLCH) "$(INTDIR)" ".\Debug\allchblk.sbr" : $(SOURCE) $(DEP_CPP_ALLCH) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\stubborn.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_STUBB=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_STUBB=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\stubborn.obj" : $(SOURCE) $(DEP_CPP_STUBB) "$(INTDIR)" ".\Release\stubborn.sbr" : $(SOURCE) $(DEP_CPP_STUBB) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_STUBB=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_STUBB=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\stubborn.obj" : $(SOURCE) $(DEP_CPP_STUBB) "$(INTDIR)" ".\Debug\stubborn.sbr" : $(SOURCE) $(DEP_CPP_STUBB) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\obj_map.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_OBJ_M=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_OBJ_M=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\obj_map.obj" : $(SOURCE) $(DEP_CPP_OBJ_M) "$(INTDIR)" ".\Release\obj_map.sbr" : $(SOURCE) $(DEP_CPP_OBJ_M) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_OBJ_M=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_OBJ_M=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\obj_map.obj" : $(SOURCE) $(DEP_CPP_OBJ_M) "$(INTDIR)" ".\Debug\obj_map.sbr" : $(SOURCE) $(DEP_CPP_OBJ_M) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\new_hblk.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_NEW_H=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_NEW_H=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\new_hblk.obj" : $(SOURCE) $(DEP_CPP_NEW_H) "$(INTDIR)" ".\Release\new_hblk.sbr" : $(SOURCE) $(DEP_CPP_NEW_H) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_NEW_H=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_NEW_H=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\new_hblk.obj" : $(SOURCE) $(DEP_CPP_NEW_H) "$(INTDIR)" ".\Debug\new_hblk.sbr" : $(SOURCE) $(DEP_CPP_NEW_H) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\mark.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_MARK_C=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_pmark.h"\ ".\include\gc_mark.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MARK_C=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\mark.obj" : $(SOURCE) $(DEP_CPP_MARK_C) "$(INTDIR)" ".\Release\mark.sbr" : $(SOURCE) $(DEP_CPP_MARK_C) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_MARK_C=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_pmark.h"\ ".\include\gc_mark.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MARK_C=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\mark.obj" : $(SOURCE) $(DEP_CPP_MARK_C) "$(INTDIR)" ".\Debug\mark.sbr" : $(SOURCE) $(DEP_CPP_MARK_C) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\malloc.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_MALLO=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MALLO=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\malloc.obj" : $(SOURCE) $(DEP_CPP_MALLO) "$(INTDIR)" ".\Release\malloc.sbr" : $(SOURCE) $(DEP_CPP_MALLO) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_MALLO=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MALLO=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\malloc.obj" : $(SOURCE) $(DEP_CPP_MALLO) "$(INTDIR)" ".\Debug\malloc.sbr" : $(SOURCE) $(DEP_CPP_MALLO) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\mallocx.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_MALLX=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MALLX=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\mallocx.obj" : $(SOURCE) $(DEP_CPP_MALLX) "$(INTDIR)" ".\Release\mallocx.sbr" : $(SOURCE) $(DEP_CPP_MALLX) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_MALLX=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MALLX=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\mallocx.obj" : $(SOURCE) $(DEP_CPP_MALLX) "$(INTDIR)" ".\Debug\mallocx.sbr" : $(SOURCE) $(DEP_CPP_MALLX) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\finalize.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_FINAL=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_pmark.h"\ ".\include\gc_mark.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_FINAL=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\finalize.obj" : $(SOURCE) $(DEP_CPP_FINAL) "$(INTDIR)" ".\Release\finalize.sbr" : $(SOURCE) $(DEP_CPP_FINAL) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_FINAL=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_pmark.h"\ ".\include\gc_mark.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_FINAL=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\finalize.obj" : $(SOURCE) $(DEP_CPP_FINAL) "$(INTDIR)" ".\Debug\finalize.sbr" : $(SOURCE) $(DEP_CPP_FINAL) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\dbg_mlc.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_DBG_M=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_DBG_M=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\dbg_mlc.obj" : $(SOURCE) $(DEP_CPP_DBG_M) "$(INTDIR)" ".\Release\dbg_mlc.sbr" : $(SOURCE) $(DEP_CPP_DBG_M) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_DBG_M=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_DBG_M=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\dbg_mlc.obj" : $(SOURCE) $(DEP_CPP_DBG_M) "$(INTDIR)" ".\Debug\dbg_mlc.sbr" : $(SOURCE) $(DEP_CPP_DBG_M) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\blacklst.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_BLACK=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_BLACK=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\blacklst.obj" : $(SOURCE) $(DEP_CPP_BLACK) "$(INTDIR)" ".\Release\blacklst.sbr" : $(SOURCE) $(DEP_CPP_BLACK) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_BLACK=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_BLACK=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\blacklst.obj" : $(SOURCE) $(DEP_CPP_BLACK) "$(INTDIR)" ".\Debug\blacklst.sbr" : $(SOURCE) $(DEP_CPP_BLACK) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\typd_mlc.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_TYPD_=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_pmark.h"\ ".\include\gc_mark.h"\ ".\include\private\gc_priv.h"\ ".\include\gc_typed.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_TYPD_=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\typd_mlc.obj" : $(SOURCE) $(DEP_CPP_TYPD_) "$(INTDIR)" ".\Release\typd_mlc.sbr" : $(SOURCE) $(DEP_CPP_TYPD_) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_TYPD_=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_pmark.h"\ ".\include\gc_mark.h"\ ".\include\private\gc_priv.h"\ ".\include\gc_typed.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_TYPD_=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\typd_mlc.obj" : $(SOURCE) $(DEP_CPP_TYPD_) "$(INTDIR)" ".\Debug\typd_mlc.sbr" : $(SOURCE) $(DEP_CPP_TYPD_) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\ptr_chck.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_PTR_C=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_pmark.h"\ ".\include\gc_mark.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_PTR_C=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\ptr_chck.obj" : $(SOURCE) $(DEP_CPP_PTR_C) "$(INTDIR)" ".\Release\ptr_chck.sbr" : $(SOURCE) $(DEP_CPP_PTR_C) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_PTR_C=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_pmark.h"\ ".\include\gc_mark.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_PTR_C=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\ptr_chck.obj" : $(SOURCE) $(DEP_CPP_PTR_C) "$(INTDIR)" ".\Debug\ptr_chck.sbr" : $(SOURCE) $(DEP_CPP_PTR_C) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\dyn_load.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_DYN_L=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\STAT.H"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_DYN_L=\ ".\il\PCR_IL.h"\ ".\mm\PCR_MM.h"\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\dyn_load.obj" : $(SOURCE) $(DEP_CPP_DYN_L) "$(INTDIR)" ".\Release\dyn_load.sbr" : $(SOURCE) $(DEP_CPP_DYN_L) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_DYN_L=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\STAT.H"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_DYN_L=\ ".\il\PCR_IL.h"\ ".\mm\PCR_MM.h"\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\dyn_load.obj" : $(SOURCE) $(DEP_CPP_DYN_L) "$(INTDIR)" ".\Debug\dyn_load.sbr" : $(SOURCE) $(DEP_CPP_DYN_L) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\win32_threads.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_WIN32=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_WIN32=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\win32_threads.obj" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)" ".\Release\win32_threads.sbr" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_WIN32=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_WIN32=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\win32_threads.obj" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)" ".\Debug\win32_threads.sbr" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\msvc_dbg.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_WIN32=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ ".\include\private\msvc_dbg.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_WIN32=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\msvc_dbg.obj" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)" ".\Release\msvc_dbg.sbr" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_WIN32=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ ".\include\private\msvc_dbg.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_WIN32=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\msvc_dbg.obj" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)" ".\Debug\msvc_dbg.sbr" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\checksums.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_CHECK=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_CHECK=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\checksums.obj" : $(SOURCE) $(DEP_CPP_CHECK) "$(INTDIR)" ".\Release\checksums.sbr" : $(SOURCE) $(DEP_CPP_CHECK) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_CHECK=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_CHECK=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\checksums.obj" : $(SOURCE) $(DEP_CPP_CHECK) "$(INTDIR)" ".\Debug\checksums.sbr" : $(SOURCE) $(DEP_CPP_CHECK) "$(INTDIR)" !ENDIF # End Source File # End Target ################################################################################ # Begin Target # Name "gctest - Win32 Release" # Name "gctest - Win32 Debug" !IF "$(CFG)" == "gctest - Win32 Release" !ELSEIF "$(CFG)" == "gctest - Win32 Debug" !ENDIF ################################################################################ # Begin Project Dependency # Project_Dep_Name "gc" !IF "$(CFG)" == "gctest - Win32 Release" "gc - Win32 Release" : $(MAKE) /$(MAKEFLAGS) /F ".\gc.mak" CFG="gc - Win32 Release" !ELSEIF "$(CFG)" == "gctest - Win32 Debug" "gc - Win32 Debug" : $(MAKE) /$(MAKEFLAGS) /F ".\gc.mak" CFG="gc - Win32 Debug" !ENDIF # End Project Dependency ################################################################################ # Begin Source File SOURCE=.\tests\test.c DEP_CPP_TEST_=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ ".\include\gc_typed.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_TEST_=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ !IF "$(CFG)" == "gctest - Win32 Release" ".\gctest\Release\test.obj" : $(SOURCE) $(DEP_CPP_TEST_) "$(INTDIR)" !ELSEIF "$(CFG)" == "gctest - Win32 Debug" ".\gctest\Debug\test.obj" : $(SOURCE) $(DEP_CPP_TEST_) "$(INTDIR)" ".\gctest\Debug\test.sbr" : $(SOURCE) $(DEP_CPP_TEST_) "$(INTDIR)" !ENDIF # End Source File # End Target ################################################################################ # Begin Target # Name "cord - Win32 Release" # Name "cord - Win32 Debug" !IF "$(CFG)" == "cord - Win32 Release" !ELSEIF "$(CFG)" == "cord - Win32 Debug" !ENDIF ################################################################################ # Begin Project Dependency # Project_Dep_Name "gc" !IF "$(CFG)" == "cord - Win32 Release" "gc - Win32 Release" : $(MAKE) /$(MAKEFLAGS) /F ".\gc.mak" CFG="gc - Win32 Release" !ELSEIF "$(CFG)" == "cord - Win32 Debug" "gc - Win32 Debug" : $(MAKE) /$(MAKEFLAGS) /F ".\gc.mak" CFG="gc - Win32 Debug" !ENDIF # End Project Dependency ################################################################################ # Begin Source File SOURCE=.\cord\de_win.c DEP_CPP_DE_WI=\ ".\include\cord.h"\ ".\cord\de_cmds.h"\ ".\cord\de_win.h"\ ".\include\private\cord_pos.h"\ NODEP_CPP_DE_WI=\ ".\include\gc.h"\ !IF "$(CFG)" == "cord - Win32 Release" ".\cord\Release\de_win.obj" : $(SOURCE) $(DEP_CPP_DE_WI) "$(INTDIR)" $(CPP) $(CPP_PROJ) $(SOURCE) !ELSEIF "$(CFG)" == "cord - Win32 Debug" ".\cord\Debug\de_win.obj" : $(SOURCE) $(DEP_CPP_DE_WI) "$(INTDIR)" $(CPP) $(CPP_PROJ) $(SOURCE) !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\cord\de.c DEP_CPP_DE_C2e=\ ".\include\cord.h"\ ".\cord\de_cmds.h"\ ".\cord\de_win.h"\ ".\include\private\cord_pos.h"\ NODEP_CPP_DE_C2e=\ ".\include\gc.h"\ !IF "$(CFG)" == "cord - Win32 Release" ".\cord\Release\de.obj" : $(SOURCE) $(DEP_CPP_DE_C2e) "$(INTDIR)" $(CPP) $(CPP_PROJ) $(SOURCE) !ELSEIF "$(CFG)" == "cord - Win32 Debug" ".\cord\Debug\de.obj" : $(SOURCE) $(DEP_CPP_DE_C2e) "$(INTDIR)" $(CPP) $(CPP_PROJ) $(SOURCE) !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\cord\cordxtra.c DEP_CPP_CORDX=\ ".\include\cord.h"\ ".\include\ec.h"\ ".\include\private\cord_pos.h"\ NODEP_CPP_CORDX=\ ".\include\gc.h"\ !IF "$(CFG)" == "cord - Win32 Release" ".\cord\Release\cordxtra.obj" : $(SOURCE) $(DEP_CPP_CORDX) "$(INTDIR)" $(CPP) $(CPP_PROJ) $(SOURCE) !ELSEIF "$(CFG)" == "cord - Win32 Debug" ".\cord\Debug\cordxtra.obj" : $(SOURCE) $(DEP_CPP_CORDX) "$(INTDIR)" $(CPP) $(CPP_PROJ) $(SOURCE) !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\cord\cordbscs.c DEP_CPP_CORDB=\ ".\include\cord.h"\ ".\include\private\cord_pos.h"\ NODEP_CPP_CORDB=\ ".\include\gc.h"\ !IF "$(CFG)" == "cord - Win32 Release" ".\cord\Release\cordbscs.obj" : $(SOURCE) $(DEP_CPP_CORDB) "$(INTDIR)" $(CPP) $(CPP_PROJ) $(SOURCE) !ELSEIF "$(CFG)" == "cord - Win32 Debug" ".\cord\Debug\cordbscs.obj" : $(SOURCE) $(DEP_CPP_CORDB) "$(INTDIR)" $(CPP) $(CPP_PROJ) $(SOURCE) !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\cord\de_win.RC !IF "$(CFG)" == "cord - Win32 Release" ".\cord\Release\de_win.res" : $(SOURCE) "$(INTDIR)" $(RSC) /l 0x809 /fo"$(INTDIR)/de_win.res" /i "cord" /d "NDEBUG" $(SOURCE) !ELSEIF "$(CFG)" == "cord - Win32 Debug" ".\cord\Debug\de_win.res" : $(SOURCE) "$(INTDIR)" $(RSC) /l 0x809 /fo"$(INTDIR)/de_win.res" /i "cord" /d "_DEBUG" $(SOURCE) !ENDIF # End Source File # End Target # End Project ################################################################################ synopsis-0.12/src/Synopsis/gc/dyn_load.c0000664000076400007640000010653511104702316017630 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1997 by Silicon Graphics. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * * Original author: Bill Janssen * Heavily modified by Hans Boehm and others */ /* * This is incredibly OS specific code for tracking down data sections in * dynamic libraries. There appears to be no way of doing this quickly * without groveling through undocumented data structures. We would argue * that this is a bug in the design of the dlopen interface. THIS CODE * MAY BREAK IN FUTURE OS RELEASES. If this matters to you, don't hesitate * to let your vendor know ... * * None of this is safe with dlclose and incremental collection. * But then not much of anything is safe in the presence of dlclose. */ #if (defined(__linux__) || defined(__GLIBC__) || defined(__GNU__)) \ && !defined(_GNU_SOURCE) /* Can't test LINUX, since this must be defined before other includes */ # define _GNU_SOURCE #endif #if !defined(MACOS) && !defined(_WIN32_WCE) # include #endif #include "private/gc_priv.h" /* BTL: avoid circular redefinition of dlopen if GC_SOLARIS_THREADS defined */ # if (defined(GC_PTHREADS) || defined(GC_SOLARIS_THREADS)) \ && defined(dlopen) && !defined(GC_USE_LD_WRAP) /* To support threads in Solaris, gc.h interposes on dlopen by */ /* defining "dlopen" to be "GC_dlopen", which is implemented below. */ /* However, both GC_FirstDLOpenedLinkMap() and GC_dlopen() use the */ /* real system dlopen() in their implementation. We first remove */ /* gc.h's dlopen definition and restore it later, after GC_dlopen(). */ # undef dlopen # define GC_must_restore_redefined_dlopen # else # undef GC_must_restore_redefined_dlopen # endif /* A user-supplied routine that is called to determine if a DSO must be scanned by the gc. */ static int (*GC_has_static_roots)(const char *, void *, size_t); #if (defined(DYNAMIC_LOADING) || defined(MSWIN32) || defined(MSWINCE)) \ && !defined(PCR) #if !defined(SOLARISDL) && !defined(IRIX5) && \ !defined(MSWIN32) && !defined(MSWINCE) && \ !(defined(ALPHA) && defined(OSF1)) && \ !defined(HPUX) && !(defined(LINUX) && defined(__ELF__)) && \ !defined(AIX) && !defined(SCO_ELF) && !defined(DGUX) && \ !(defined(FREEBSD) && defined(__ELF__)) && \ !(defined(NETBSD) && defined(__ELF__)) && !defined(HURD) && \ !defined(DARWIN) && !defined(CYGWIN32) --> We only know how to find data segments of dynamic libraries for the --> above. Additional SVR4 variants might not be too --> hard to add. #endif #include #ifdef SOLARISDL # include # include # include #endif #if defined(NETBSD) # include # define ELFSIZE ARCH_ELFSIZE #endif #if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \ (defined(FREEBSD) && defined(__ELF__)) || defined(DGUX) || \ (defined(NETBSD) && defined(__ELF__)) || defined(HURD) # include # include # include #endif /* Newer versions of GNU/Linux define this macro. We * define it similarly for any ELF systems that don't. */ # ifndef ElfW # if defined(FREEBSD) # if __ELF_WORD_SIZE == 32 # define ElfW(type) Elf32_##type # else # define ElfW(type) Elf64_##type # endif # elif defined(NETBSD) # if ELFSIZE == 32 # define ElfW(type) Elf32_##type # else # define ElfW(type) Elf64_##type # endif # else # if !defined(ELF_CLASS) || ELF_CLASS == ELFCLASS32 # define ElfW(type) Elf32_##type # else # define ElfW(type) Elf64_##type # endif # endif # endif #if defined(SOLARISDL) && !defined(USE_PROC_FOR_LIBRARIES) #ifdef LINT Elf32_Dyn _DYNAMIC; #endif static struct link_map * GC_FirstDLOpenedLinkMap() { extern ElfW(Dyn) _DYNAMIC; ElfW(Dyn) *dp; struct r_debug *r; static struct link_map * cachedResult = 0; static ElfW(Dyn) *dynStructureAddr = 0; /* BTL: added to avoid Solaris 5.3 ld.so _DYNAMIC bug */ # ifdef SUNOS53_SHARED_LIB /* BTL: Avoid the Solaris 5.3 bug that _DYNAMIC isn't being set */ /* up properly in dynamically linked .so's. This means we have */ /* to use its value in the set of original object files loaded */ /* at program startup. */ if( dynStructureAddr == 0 ) { void* startupSyms = dlopen(0, RTLD_LAZY); dynStructureAddr = (ElfW(Dyn)*)dlsym(startupSyms, "_DYNAMIC"); } # else dynStructureAddr = &_DYNAMIC; # endif if( dynStructureAddr == 0) { return(0); } if( cachedResult == 0 ) { int tag; for( dp = ((ElfW(Dyn) *)(&_DYNAMIC)); (tag = dp->d_tag) != 0; dp++ ) { if( tag == DT_DEBUG ) { struct link_map *lm = ((struct r_debug *)(dp->d_un.d_ptr))->r_map; if( lm != 0 ) cachedResult = lm->l_next; /* might be NIL */ break; } } } return cachedResult; } #endif /* SOLARISDL ... */ /* BTL: added to fix circular dlopen definition if GC_SOLARIS_THREADS defined */ # if defined(GC_must_restore_redefined_dlopen) # define dlopen GC_dlopen # endif # if defined(SOLARISDL) /* Add dynamic library data sections to the root set. */ # if !defined(PCR) && !defined(GC_SOLARIS_THREADS) && defined(THREADS) --> fix mutual exclusion with dlopen # endif # ifndef USE_PROC_FOR_LIBRARIES void GC_register_dynamic_libraries() { struct link_map *lm = GC_FirstDLOpenedLinkMap(); for (lm = GC_FirstDLOpenedLinkMap(); lm != (struct link_map *) 0; lm = lm->l_next) { ElfW(Ehdr) * e; ElfW(Phdr) * p; unsigned long offset; char * start; register int i; e = (ElfW(Ehdr) *) lm->l_addr; p = ((ElfW(Phdr) *)(((char *)(e)) + e->e_phoff)); offset = ((unsigned long)(lm->l_addr)); for( i = 0; i < (int)(e->e_phnum); ((i++),(p++)) ) { switch( p->p_type ) { case PT_LOAD: { if( !(p->p_flags & PF_W) ) break; start = ((char *)(p->p_vaddr)) + offset; GC_add_roots_inner( start, start + p->p_memsz, TRUE ); } break; default: break; } } } } # endif /* !USE_PROC ... */ # endif /* SOLARISDL */ #if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \ (defined(FREEBSD) && defined(__ELF__)) || defined(DGUX) || \ (defined(NETBSD) && defined(__ELF__)) || defined(HURD) #ifdef USE_PROC_FOR_LIBRARIES #include #include #include #include #define MAPS_BUF_SIZE (32*1024) extern ssize_t GC_repeat_read(int fd, char *buf, size_t count); /* Repeatedly read until buffer is filled, or EOF is encountered */ /* Defined in os_dep.c. */ char *GC_parse_map_entry(char *buf_ptr, ptr_t *start, ptr_t *end, char **prot, unsigned int *maj_dev, char **mapping_name); char *GC_get_maps(void); /* From os_dep.c */ word GC_register_map_entries(char *maps) { char *prot; char *buf_ptr = maps; int count; ptr_t start, end; unsigned int maj_dev; ptr_t least_ha, greatest_ha; unsigned i; ptr_t datastart = (ptr_t)(DATASTART); /* Compute heap bounds. FIXME: Should work if heap and roots are */ /* interleaved? */ least_ha = (ptr_t)(word)(-1); greatest_ha = 0; for (i = 0; i < GC_n_heap_sects; ++i) { ptr_t sect_start = GC_heap_sects[i].hs_start; ptr_t sect_end = sect_start + GC_heap_sects[i].hs_bytes; if (sect_start < least_ha) least_ha = sect_start; if (sect_end > greatest_ha) greatest_ha = sect_end; } if (greatest_ha < (ptr_t)GC_scratch_last_end_ptr) greatest_ha = (ptr_t)GC_scratch_last_end_ptr; for (;;) { buf_ptr = GC_parse_map_entry(buf_ptr, &start, &end, &prot, &maj_dev, 0); if (buf_ptr == NULL) return 1; if (prot[1] == 'w') { /* This is a writable mapping. Add it to */ /* the root set unless it is already otherwise */ /* accounted for. */ if (start <= GC_stackbottom && end >= GC_stackbottom) { /* Stack mapping; discard */ continue; } # ifdef THREADS /* This may fail, since a thread may already be */ /* unregistered, but its thread stack may still be there. */ /* That can fail because the stack may disappear while */ /* we're marking. Thus the marker is, and has to be */ /* prepared to recover from segmentation faults. */ if (GC_segment_is_thread_stack(start, end)) continue; /* FIXME: REDIRECT_MALLOC actually works with threads on */ /* LINUX/IA64 if we omit this check. The problem is that */ /* thread stacks contain pointers to dynamic thread */ /* vectors, which may be reused due to thread caching. */ /* Currently they may not be marked if the thread is */ /* still live. */ /* For dead threads, we trace the whole stack, which is */ /* very suboptimal for performance reasons. */ # endif /* We no longer exclude the main data segment. */ if (start < least_ha && end > least_ha) { end = least_ha; } if (start < greatest_ha && end > greatest_ha) { start = greatest_ha; } if (start >= least_ha && end <= greatest_ha) continue; GC_add_roots_inner((char *)start, (char *)end, TRUE); } } return 1; } void GC_register_dynamic_libraries() { if (!GC_register_map_entries(GC_get_maps())) ABORT("Failed to read /proc for library registration."); } /* We now take care of the main data segment ourselves: */ GC_bool GC_register_main_static_data() { return FALSE; } # define HAVE_REGISTER_MAIN_STATIC_DATA #endif /* USE_PROC_FOR_LIBRARIES */ #if !defined(USE_PROC_FOR_LIBRARIES) /* The following is the preferred way to walk dynamic libraries */ /* For glibc 2.2.4+. Unfortunately, it doesn't work for older */ /* versions. Thanks to Jakub Jelinek for most of the code. */ # if (defined(LINUX) || defined (__GLIBC__)) /* Are others OK here, too? */ \ && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \ || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG))) /* We have the header files for a glibc that includes dl_iterate_phdr. */ /* It may still not be available in the library on the target system. */ /* Thus we also treat it as a weak symbol. */ #define HAVE_DL_ITERATE_PHDR static int GC_register_dynlib_callback(info, size, ptr) struct dl_phdr_info * info; size_t size; void * ptr; { const ElfW(Phdr) * p; char * start; register int i; /* Make sure struct dl_phdr_info is at least as big as we need. */ if (size < offsetof (struct dl_phdr_info, dlpi_phnum) + sizeof (info->dlpi_phnum)) return -1; p = info->dlpi_phdr; for( i = 0; i < (int)(info->dlpi_phnum); ((i++),(p++)) ) { switch( p->p_type ) { case PT_LOAD: { if( !(p->p_flags & PF_W) ) break; start = ((char *)(p->p_vaddr)) + info->dlpi_addr; if (GC_has_static_roots && !GC_has_static_roots(info->dlpi_name, start, p->p_memsz)) break; GC_add_roots_inner(start, start + p->p_memsz, TRUE); } break; default: break; } } * (int *)ptr = 1; /* Signal that we were called */ return 0; } /* Return TRUE if we succeed, FALSE if dl_iterate_phdr wasn't there. */ #pragma weak dl_iterate_phdr GC_bool GC_register_dynamic_libraries_dl_iterate_phdr() { if (dl_iterate_phdr) { int did_something = 0; dl_iterate_phdr(GC_register_dynlib_callback, &did_something); if (!did_something) { /* dl_iterate_phdr may forget the static data segment in */ /* statically linked executables. */ GC_add_roots_inner(DATASTART, (char *)(DATAEND), TRUE); # if defined(DATASTART2) GC_add_roots_inner(DATASTART2, (char *)(DATAEND2), TRUE); # endif } return TRUE; } else { return FALSE; } } /* Do we need to separately register the main static data segment? */ GC_bool GC_register_main_static_data() { return (dl_iterate_phdr == 0); } #define HAVE_REGISTER_MAIN_STATIC_DATA # else /* !LINUX || version(glibc) < 2.2.4 */ /* Dynamic loading code for Linux running ELF. Somewhat tested on * Linux/x86, untested but hopefully should work on Linux/Alpha. * This code was derived from the Solaris/ELF support. Thanks to * whatever kind soul wrote that. - Patrick Bridges */ /* This doesn't necessarily work in all cases, e.g. with preloaded * dynamic libraries. */ #if defined(NETBSD) # include /* for compatibility with 1.4.x */ # ifndef DT_DEBUG # define DT_DEBUG 21 # endif # ifndef PT_LOAD # define PT_LOAD 1 # endif # ifndef PF_W # define PF_W 2 # endif #else # include #endif #include # endif #ifdef __GNUC__ # pragma weak _DYNAMIC #endif extern ElfW(Dyn) _DYNAMIC[]; static struct link_map * GC_FirstDLOpenedLinkMap() { ElfW(Dyn) *dp; static struct link_map *cachedResult = 0; if( _DYNAMIC == 0) { return(0); } if( cachedResult == 0 ) { int tag; for( dp = _DYNAMIC; (tag = dp->d_tag) != 0; dp++ ) { if( tag == DT_DEBUG ) { struct link_map *lm = ((struct r_debug *)(dp->d_un.d_ptr))->r_map; if( lm != 0 ) cachedResult = lm->l_next; /* might be NIL */ break; } } } return cachedResult; } void GC_register_dynamic_libraries() { struct link_map *lm; # ifdef HAVE_DL_ITERATE_PHDR if (GC_register_dynamic_libraries_dl_iterate_phdr()) { return; } # endif lm = GC_FirstDLOpenedLinkMap(); for (lm = GC_FirstDLOpenedLinkMap(); lm != (struct link_map *) 0; lm = lm->l_next) { ElfW(Ehdr) * e; ElfW(Phdr) * p; unsigned long offset; char * start; register int i; e = (ElfW(Ehdr) *) lm->l_addr; p = ((ElfW(Phdr) *)(((char *)(e)) + e->e_phoff)); offset = ((unsigned long)(lm->l_addr)); for( i = 0; i < (int)(e->e_phnum); ((i++),(p++)) ) { switch( p->p_type ) { case PT_LOAD: { if( !(p->p_flags & PF_W) ) break; start = ((char *)(p->p_vaddr)) + offset; GC_add_roots_inner(start, start + p->p_memsz, TRUE); } break; default: break; } } } } #endif /* !USE_PROC_FOR_LIBRARIES */ #endif /* LINUX */ #if defined(IRIX5) || (defined(USE_PROC_FOR_LIBRARIES) && !defined(LINUX)) #include #include #include #include #include #include /* Only for the following test. */ #ifndef _sigargs # define IRIX6 #endif extern void * GC_roots_present(); /* The type is a lie, since the real type doesn't make sense here, */ /* and we only test for NULL. */ /* We use /proc to track down all parts of the address space that are */ /* mapped by the process, and throw out regions we know we shouldn't */ /* worry about. This may also work under other SVR4 variants. */ void GC_register_dynamic_libraries() { static int fd = -1; char buf[30]; static prmap_t * addr_map = 0; static int current_sz = 0; /* Number of records currently in addr_map */ static int needed_sz; /* Required size of addr_map */ int i; long flags; ptr_t start; ptr_t limit; ptr_t heap_start = (ptr_t)HEAP_START; ptr_t heap_end = heap_start; # ifdef SOLARISDL # define MA_PHYS 0 # endif /* SOLARISDL */ if (fd < 0) { sprintf(buf, "/proc/%d", getpid()); /* The above generates a lint complaint, since pid_t varies. */ /* It's unclear how to improve this. */ fd = open(buf, O_RDONLY); if (fd < 0) { ABORT("/proc open failed"); } } if (ioctl(fd, PIOCNMAP, &needed_sz) < 0) { GC_err_printf("fd = %d, errno = %d\n", fd, errno); ABORT("/proc PIOCNMAP ioctl failed"); } if (needed_sz >= current_sz) { current_sz = needed_sz * 2 + 1; /* Expansion, plus room for 0 record */ addr_map = (prmap_t *)GC_scratch_alloc((word) (current_sz * sizeof(prmap_t))); } if (ioctl(fd, PIOCMAP, addr_map) < 0) { GC_err_printf("fd = %d, errno = %d, needed_sz = %d, addr_map = 0x%X\n", fd, errno, needed_sz, addr_map); ABORT("/proc PIOCMAP ioctl failed"); }; if (GC_n_heap_sects > 0) { heap_end = GC_heap_sects[GC_n_heap_sects-1].hs_start + GC_heap_sects[GC_n_heap_sects-1].hs_bytes; if (heap_end < GC_scratch_last_end_ptr) heap_end = GC_scratch_last_end_ptr; } for (i = 0; i < needed_sz; i++) { flags = addr_map[i].pr_mflags; if ((flags & (MA_BREAK | MA_STACK | MA_PHYS | MA_FETCHOP | MA_NOTCACHED)) != 0) goto irrelevant; if ((flags & (MA_READ | MA_WRITE)) != (MA_READ | MA_WRITE)) goto irrelevant; /* The latter test is empirically useless in very old Irix */ /* versions. Other than the */ /* main data and stack segments, everything appears to be */ /* mapped readable, writable, executable, and shared(!!). */ /* This makes no sense to me. - HB */ start = (ptr_t)(addr_map[i].pr_vaddr); if (GC_roots_present(start)) goto irrelevant; if (start < heap_end && start >= heap_start) goto irrelevant; # ifdef MMAP_STACKS if (GC_is_thread_stack(start)) goto irrelevant; # endif /* MMAP_STACKS */ limit = start + addr_map[i].pr_size; /* The following seemed to be necessary for very old versions */ /* of Irix, but it has been reported to discard relevant */ /* segments under Irix 6.5. */ # ifndef IRIX6 if (addr_map[i].pr_off == 0 && strncmp(start, ELFMAG, 4) == 0) { /* Discard text segments, i.e. 0-offset mappings against */ /* executable files which appear to have ELF headers. */ caddr_t arg; int obj; # define MAP_IRR_SZ 10 static ptr_t map_irr[MAP_IRR_SZ]; /* Known irrelevant map entries */ static int n_irr = 0; struct stat buf; register int i; for (i = 0; i < n_irr; i++) { if (map_irr[i] == start) goto irrelevant; } arg = (caddr_t)start; obj = ioctl(fd, PIOCOPENM, &arg); if (obj >= 0) { fstat(obj, &buf); close(obj); if ((buf.st_mode & 0111) != 0) { if (n_irr < MAP_IRR_SZ) { map_irr[n_irr++] = start; } goto irrelevant; } } } # endif /* !IRIX6 */ GC_add_roots_inner(start, limit, TRUE); irrelevant: ; } /* Dont keep cached descriptor, for now. Some kernels don't like us */ /* to keep a /proc file descriptor around during kill -9. */ if (close(fd) < 0) ABORT("Couldnt close /proc file"); fd = -1; } # endif /* USE_PROC || IRIX5 */ # if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32) # define WIN32_LEAN_AND_MEAN # define NOSERVICE # include # include /* We traverse the entire address space and register all segments */ /* that could possibly have been written to. */ extern GC_bool GC_is_heap_base (ptr_t p); # ifdef GC_WIN32_THREADS extern void GC_get_next_stack(char *start, char **lo, char **hi); void GC_cond_add_roots(char *base, char * limit) { char * curr_base = base; char * next_stack_lo; char * next_stack_hi; if (base == limit) return; for(;;) { GC_get_next_stack(curr_base, &next_stack_lo, &next_stack_hi); if (next_stack_lo >= limit) break; GC_add_roots_inner(curr_base, next_stack_lo, TRUE); curr_base = next_stack_hi; } if (curr_base < limit) GC_add_roots_inner(curr_base, limit, TRUE); } # else void GC_cond_add_roots(char *base, char * limit) { char dummy; char * stack_top = (char *) ((word)(&dummy) & ~(GC_sysinfo.dwAllocationGranularity-1)); if (base == limit) return; if (limit > stack_top && base < GC_stackbottom) { /* Part of the stack; ignore it. */ return; } GC_add_roots_inner(base, limit, TRUE); } # endif # ifdef MSWINCE /* Do we need to separately register the main static data segment? */ GC_bool GC_register_main_static_data() { return FALSE; } # else /* win32 */ extern GC_bool GC_no_win32_dlls; GC_bool GC_register_main_static_data() { return GC_no_win32_dlls; } # endif /* win32 */ # define HAVE_REGISTER_MAIN_STATIC_DATA # ifdef DEBUG_VIRTUALQUERY void GC_dump_meminfo(MEMORY_BASIC_INFORMATION *buf) { GC_printf("BaseAddress = %lx, AllocationBase = %lx, RegionSize = %lx(%lu)\n", buf -> BaseAddress, buf -> AllocationBase, buf -> RegionSize, buf -> RegionSize); GC_printf("\tAllocationProtect = %lx, State = %lx, Protect = %lx, " "Type = %lx\n", buf -> AllocationProtect, buf -> State, buf -> Protect, buf -> Type); } # endif /* DEBUG_VIRTUALQUERY */ extern GC_bool GC_wnt; /* Is Windows NT derivative. */ /* Defined and set in os_dep.c. */ void GC_register_dynamic_libraries() { MEMORY_BASIC_INFORMATION buf; size_t result; DWORD protect; LPVOID p; char * base; char * limit, * new_limit; # ifdef MSWIN32 if (GC_no_win32_dlls) return; # endif base = limit = p = GC_sysinfo.lpMinimumApplicationAddress; # if defined(MSWINCE) && !defined(_WIN32_WCE_EMULATION) /* Only the first 32 MB of address space belongs to the current process */ while (p < (LPVOID)0x02000000) { result = VirtualQuery(p, &buf, sizeof(buf)); if (result == 0) { /* Page is free; advance to the next possible allocation base */ new_limit = (char *) (((DWORD) p + GC_sysinfo.dwAllocationGranularity) & ~(GC_sysinfo.dwAllocationGranularity-1)); } else # else while (p < GC_sysinfo.lpMaximumApplicationAddress) { result = VirtualQuery(p, &buf, sizeof(buf)); # endif { if (result != sizeof(buf)) { ABORT("Weird VirtualQuery result"); } new_limit = (char *)p + buf.RegionSize; protect = buf.Protect; if (buf.State == MEM_COMMIT && (protect == PAGE_EXECUTE_READWRITE || protect == PAGE_READWRITE) && !GC_is_heap_base(buf.AllocationBase) /* There is some evidence that we cannot always * ignore MEM_PRIVATE sections under Windows ME * and predecessors. Hence we now also check for * that case. */ && (buf.Type == MEM_IMAGE || !GC_wnt && buf.Type == MEM_PRIVATE)) { # ifdef DEBUG_VIRTUALQUERY GC_dump_meminfo(&buf); # endif if ((char *)p != limit) { GC_cond_add_roots(base, limit); base = p; } limit = new_limit; } } if (p > (LPVOID)new_limit /* overflow */) break; p = (LPVOID)new_limit; } GC_cond_add_roots(base, limit); } #endif /* MSWIN32 || MSWINCE || CYGWIN32 */ #if defined(ALPHA) && defined(OSF1) #include void GC_register_dynamic_libraries() { int status; ldr_process_t mypid; /* module */ ldr_module_t moduleid = LDR_NULL_MODULE; ldr_module_info_t moduleinfo; size_t moduleinfosize = sizeof(moduleinfo); size_t modulereturnsize; /* region */ ldr_region_t region; ldr_region_info_t regioninfo; size_t regioninfosize = sizeof(regioninfo); size_t regionreturnsize; /* Obtain id of this process */ mypid = ldr_my_process(); /* For each module */ while (TRUE) { /* Get the next (first) module */ status = ldr_next_module(mypid, &moduleid); /* Any more modules? */ if (moduleid == LDR_NULL_MODULE) break; /* No more modules */ /* Check status AFTER checking moduleid because */ /* of a bug in the non-shared ldr_next_module stub */ if (status != 0 ) { GC_printf("dynamic_load: status = %d\n", status); { extern char *sys_errlist[]; extern int sys_nerr; extern int errno; if (errno <= sys_nerr) { GC_printf("dynamic_load: %s\n", sys_errlist[errno]); } else { GC_printf("dynamic_load: %d\n", errno); } } ABORT("ldr_next_module failed"); } /* Get the module information */ status = ldr_inq_module(mypid, moduleid, &moduleinfo, moduleinfosize, &modulereturnsize); if (status != 0 ) ABORT("ldr_inq_module failed"); /* is module for the main program (i.e. nonshared portion)? */ if (moduleinfo.lmi_flags & LDR_MAIN) continue; /* skip the main module */ # ifdef DL_VERBOSE GC_printf("---Module---\n"); GC_printf("Module ID = %16ld\n", moduleinfo.lmi_modid); GC_printf("Count of regions = %16d\n", moduleinfo.lmi_nregion); GC_printf("flags for module = %16lx\n", moduleinfo.lmi_flags); GC_printf("pathname of module = \"%s\"\n", moduleinfo.lmi_name); # endif /* For each region in this module */ for (region = 0; region < moduleinfo.lmi_nregion; region++) { /* Get the region information */ status = ldr_inq_region(mypid, moduleid, region, ®ioninfo, regioninfosize, ®ionreturnsize); if (status != 0 ) ABORT("ldr_inq_region failed"); /* only process writable (data) regions */ if (! (regioninfo.lri_prot & LDR_W)) continue; # ifdef DL_VERBOSE GC_printf("--- Region ---\n"); GC_printf("Region number = %16ld\n", regioninfo.lri_region_no); GC_printf("Protection flags = %016x\n", regioninfo.lri_prot); GC_printf("Virtual address = %16p\n", regioninfo.lri_vaddr); GC_printf("Mapped address = %16p\n", regioninfo.lri_mapaddr); GC_printf("Region size = %16ld\n", regioninfo.lri_size); GC_printf("Region name = \"%s\"\n", regioninfo.lri_name); # endif /* register region as a garbage collection root */ GC_add_roots_inner ( (char *)regioninfo.lri_mapaddr, (char *)regioninfo.lri_mapaddr + regioninfo.lri_size, TRUE); } } } #endif #if defined(HPUX) #include #include extern char *sys_errlist[]; extern int sys_nerr; void GC_register_dynamic_libraries() { int status; int index = 1; /* Ordinal position in shared library search list */ struct shl_descriptor *shl_desc; /* Shared library info, see dl.h */ /* For each dynamic library loaded */ while (TRUE) { /* Get info about next shared library */ status = shl_get(index, &shl_desc); /* Check if this is the end of the list or if some error occured */ if (status != 0) { # ifdef GC_HPUX_THREADS /* I've seen errno values of 0. The man page is not clear */ /* as to whether errno should get set on a -1 return. */ break; # else if (errno == EINVAL) { break; /* Moved past end of shared library list --> finished */ } else { if (errno <= sys_nerr) { GC_printf("dynamic_load: %s\n", sys_errlist[errno]); } else { GC_printf("dynamic_load: %d\n", errno); } ABORT("shl_get failed"); } # endif } # ifdef DL_VERBOSE GC_printf("---Shared library---\n"); GC_printf("\tfilename = \"%s\"\n", shl_desc->filename); GC_printf("\tindex = %d\n", index); GC_printf("\thandle = %08x\n", (unsigned long) shl_desc->handle); GC_printf("\ttext seg. start = %08x\n", shl_desc->tstart); GC_printf("\ttext seg. end = %08x\n", shl_desc->tend); GC_printf("\tdata seg. start = %08x\n", shl_desc->dstart); GC_printf("\tdata seg. end = %08x\n", shl_desc->dend); GC_printf("\tref. count = %lu\n", shl_desc->ref_count); # endif /* register shared library's data segment as a garbage collection root */ GC_add_roots_inner((char *) shl_desc->dstart, (char *) shl_desc->dend, TRUE); index++; } } #endif /* HPUX */ #ifdef AIX #pragma alloca #include #include void GC_register_dynamic_libraries() { int len; char *ldibuf; int ldibuflen; struct ld_info *ldi; ldibuf = alloca(ldibuflen = 8192); while ( (len = loadquery(L_GETINFO,ldibuf,ldibuflen)) < 0) { if (errno != ENOMEM) { ABORT("loadquery failed"); } ldibuf = alloca(ldibuflen *= 2); } ldi = (struct ld_info *)ldibuf; while (ldi) { len = ldi->ldinfo_next; GC_add_roots_inner( ldi->ldinfo_dataorg, (ptr_t)(unsigned long)ldi->ldinfo_dataorg + ldi->ldinfo_datasize, TRUE); ldi = len ? (struct ld_info *)((char *)ldi + len) : 0; } } #endif /* AIX */ #ifdef DARWIN /* __private_extern__ hack required for pre-3.4 gcc versions. */ #ifndef __private_extern__ # define __private_extern__ extern # include # undef __private_extern__ #else # include #endif #include /*#define DARWIN_DEBUG*/ const static struct { const char *seg; const char *sect; } GC_dyld_sections[] = { { SEG_DATA, SECT_DATA }, { SEG_DATA, SECT_BSS }, { SEG_DATA, SECT_COMMON } }; #ifdef DARWIN_DEBUG static const char *GC_dyld_name_for_hdr(const struct GC_MACH_HEADER *hdr) { unsigned long i,c; c = _dyld_image_count(); for(i=0;isize == 0) continue; start = slide + sec->addr; end = start + sec->size; # ifdef DARWIN_DEBUG GC_printf("Adding section at %p-%p (%lu bytes) from image %s\n", start,end,sec->size,GC_dyld_name_for_hdr(hdr)); # endif GC_add_roots((char*)start,(char*)end); } # ifdef DARWIN_DEBUG GC_print_static_roots(); # endif } /* This should never be called by a thread holding the lock */ static void GC_dyld_image_remove(const struct GC_MACH_HEADER *hdr, intptr_t slide) { unsigned long start,end,i; const struct GC_MACH_SECTION *sec; for(i=0;isize == 0) continue; start = slide + sec->addr; end = start + sec->size; # ifdef DARWIN_DEBUG GC_printf("Removing section at %p-%p (%lu bytes) from image %s\n", start,end,sec->size,GC_dyld_name_for_hdr(hdr)); # endif GC_remove_roots((char*)start,(char*)end); } # ifdef DARWIN_DEBUG GC_print_static_roots(); # endif } void GC_register_dynamic_libraries() { /* Currently does nothing. The callbacks are setup by GC_init_dyld() The dyld library takes it from there. */ } /* The _dyld_* functions have an internal lock so no _dyld functions can be called while the world is stopped without the risk of a deadlock. Because of this we MUST setup callbacks BEFORE we ever stop the world. This should be called BEFORE any thread in created and WITHOUT the allocation lock held. */ void GC_init_dyld() { static GC_bool initialized = FALSE; char *bind_fully_env = NULL; if(initialized) return; # ifdef DARWIN_DEBUG GC_printf("Registering dyld callbacks...\n"); # endif /* Apple's Documentation: When you call _dyld_register_func_for_add_image, the dynamic linker runtime calls the specified callback (func) once for each of the images that is currently loaded into the program. When a new image is added to the program, your callback is called again with the mach_header for the new image, and the virtual memory slide amount of the new image. This WILL properly register already linked libraries and libraries linked in the future */ _dyld_register_func_for_add_image(GC_dyld_image_add); _dyld_register_func_for_remove_image(GC_dyld_image_remove); /* Set this early to avoid reentrancy issues. */ initialized = TRUE; bind_fully_env = getenv("DYLD_BIND_AT_LAUNCH"); if (bind_fully_env == NULL) { # ifdef DARWIN_DEBUG GC_printf("Forcing full bind of GC code...\n"); # endif if(!_dyld_bind_fully_image_containing_address((unsigned long*)GC_malloc)) GC_abort("_dyld_bind_fully_image_containing_address failed"); } } #define HAVE_REGISTER_MAIN_STATIC_DATA GC_bool GC_register_main_static_data() { /* Already done through dyld callbacks */ return FALSE; } #endif /* DARWIN */ #else /* !DYNAMIC_LOADING */ #ifdef PCR # include "il/PCR_IL.h" # include "th/PCR_ThCtl.h" # include "mm/PCR_MM.h" void GC_register_dynamic_libraries() { /* Add new static data areas of dynamically loaded modules. */ { PCR_IL_LoadedFile * p = PCR_IL_GetLastLoadedFile(); PCR_IL_LoadedSegment * q; /* Skip uncommited files */ while (p != NIL && !(p -> lf_commitPoint)) { /* The loading of this file has not yet been committed */ /* Hence its description could be inconsistent. */ /* Furthermore, it hasn't yet been run. Hence its data */ /* segments can't possibly reference heap allocated */ /* objects. */ p = p -> lf_prev; } for (; p != NIL; p = p -> lf_prev) { for (q = p -> lf_ls; q != NIL; q = q -> ls_next) { if ((q -> ls_flags & PCR_IL_SegFlags_Traced_MASK) == PCR_IL_SegFlags_Traced_on) { GC_add_roots_inner ((char *)(q -> ls_addr), (char *)(q -> ls_addr) + q -> ls_bytes, TRUE); } } } } } #else /* !PCR */ void GC_register_dynamic_libraries(){} int GC_no_dynamic_loading; #endif /* !PCR */ #endif /* !DYNAMIC_LOADING */ #ifndef HAVE_REGISTER_MAIN_STATIC_DATA /* Do we need to separately register the main static data segment? */ GC_bool GC_register_main_static_data() { return TRUE; } /* Register a routine to filter dynamic library registration. */ void GC_register_has_static_roots_callback (int (*callback)(const char *, void *, size_t)) { GC_has_static_roots = callback; } #endif /* HAVE_REGISTER_MAIN_STATIC_DATA */ synopsis-0.12/src/Synopsis/gc/gc_dlopen.c0000664000076400007640000000607711104702320017764 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1997 by Silicon Graphics. All rights reserved. * Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * * Original author: Bill Janssen * Heavily modified by Hans Boehm and others */ /* * This used to be in dyn_load.c. It was extracted into a separate file * to avoid having to link against libdl.{a,so} if the client doesn't call * dlopen. Of course this fails if the collector is in a dynamic * library. -HB */ #include "private/gc_priv.h" # if (defined(GC_PTHREADS) && !defined(GC_DARWIN_THREADS)) && !defined(GC_WIN32_PTHREADS)\ || defined(GC_SOLARIS_THREADS) # if defined(dlopen) && !defined(GC_USE_LD_WRAP) /* To support various threads pkgs, gc.h interposes on dlopen by */ /* defining "dlopen" to be "GC_dlopen", which is implemented below. */ /* However, both GC_FirstDLOpenedLinkMap() and GC_dlopen() use the */ /* real system dlopen() in their implementation. We first remove */ /* gc.h's dlopen definition and restore it later, after GC_dlopen(). */ # undef dlopen # endif /* Make sure we're not in the middle of a collection, and make */ /* sure we don't start any. Returns previous value of GC_dont_gc. */ /* This is invoked prior to a dlopen call to avoid synchronization */ /* issues. We can't just acquire the allocation lock, since startup */ /* code in dlopen may try to allocate. */ /* This solution risks heap growth in the presence of many dlopen */ /* calls in either a multithreaded environment, or if the library */ /* initialization code allocates substantial amounts of GC'ed memory. */ /* But I don't know of a better solution. */ static void disable_gc_for_dlopen() { LOCK(); while (GC_incremental && GC_collection_in_progress()) { GC_collect_a_little_inner(1000); } ++GC_dont_gc; UNLOCK(); } /* Redefine dlopen to guarantee mutual exclusion with */ /* GC_register_dynamic_libraries. */ /* Should probably happen for other operating systems, too. */ #include #ifdef GC_USE_LD_WRAP void * __wrap_dlopen(const char *path, int mode) #else void * GC_dlopen(const char *path, int mode) #endif { void * result; # ifndef USE_PROC_FOR_LIBRARIES disable_gc_for_dlopen(); # endif # ifdef GC_USE_LD_WRAP result = (void *)__real_dlopen(path, mode); # else result = dlopen(path, mode); # endif # ifndef USE_PROC_FOR_LIBRARIES GC_enable(); /* undoes disable_gc_for_dlopen */ # endif return(result); } # endif /* GC_PTHREADS || GC_SOLARIS_THREADS ... */ synopsis-0.12/src/Synopsis/gc/specific.c0000664000076400007640000001314211104702320017606 0ustar stefanstefan/* * Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ #include "private/gc_priv.h" /* For configuration, pthreads.h. */ #include "private/thread_local_alloc.h" /* To determine type of tsd impl. */ /* Includes private/specific.h */ /* if needed. */ #if defined(USE_CUSTOM_SPECIFIC) #include "atomic_ops.h" static tse invalid_tse = {INVALID_QTID, 0, 0, INVALID_THREADID}; /* A thread-specific data entry which will never */ /* appear valid to a reader. Used to fill in empty */ /* cache entries to avoid a check for 0. */ int PREFIXED(key_create) (tsd ** key_ptr, void (* destructor)(void *)) { int i; tsd * result = (tsd *)MALLOC_CLEAR(sizeof (tsd)); /* A quick alignment check, since we need atomic stores */ GC_ASSERT((unsigned long)(&invalid_tse.next) % sizeof(tse *) == 0); if (0 == result) return ENOMEM; pthread_mutex_init(&(result -> lock), NULL); for (i = 0; i < TS_CACHE_SIZE; ++i) { result -> cache[i] = &invalid_tse; } # ifdef GC_ASSERTIONS for (i = 0; i < TS_HASH_SIZE; ++i) { GC_ASSERT(result -> hash[i] == 0); } # endif *key_ptr = result; return 0; } int PREFIXED(setspecific) (tsd * key, void * value) { pthread_t self = pthread_self(); int hash_val = HASH(self); volatile tse * entry = (volatile tse *)MALLOC_CLEAR(sizeof (tse)); GC_ASSERT(self != INVALID_THREADID); if (0 == entry) return ENOMEM; pthread_mutex_lock(&(key -> lock)); /* Could easily check for an existing entry here. */ entry -> next = key -> hash[hash_val]; entry -> thread = self; entry -> value = value; GC_ASSERT(entry -> qtid == INVALID_QTID); /* There can only be one writer at a time, but this needs to be */ /* atomic with respect to concurrent readers. */ AO_store_release((volatile AO_t *)(key -> hash + hash_val), (AO_t)entry); pthread_mutex_unlock(&(key -> lock)); return 0; } /* Remove thread-specific data for this thread. Should be called on */ /* thread exit. */ void PREFIXED(remove_specific) (tsd * key) { pthread_t self = pthread_self(); unsigned hash_val = HASH(self); tse *entry; tse **link = key -> hash + hash_val; pthread_mutex_lock(&(key -> lock)); entry = *link; while (entry != NULL && entry -> thread != self) { link = &(entry -> next); entry = *link; } /* Invalidate qtid field, since qtids may be reused, and a later */ /* cache lookup could otherwise find this entry. */ entry -> qtid = INVALID_QTID; if (entry != NULL) { *link = entry -> next; /* Atomic! concurrent accesses still work. */ /* They must, since readers don't lock. */ /* We shouldn't need a volatile access here, */ /* since both this and the preceding write */ /* should become visible no later than */ /* the pthread_mutex_unlock() call. */ } /* If we wanted to deallocate the entry, we'd first have to clear */ /* any cache entries pointing to it. That probably requires */ /* additional synchronization, since we can't prevent a concurrent */ /* cache lookup, which should still be examining deallocated memory.*/ /* This can only happen if the concurrent access is from another */ /* thread, and hence has missed the cache, but still... */ /* With GC, we're done, since the pointers from the cache will */ /* be overwritten, all local pointers to the entries will be */ /* dropped, and the entry will then be reclaimed. */ pthread_mutex_unlock(&(key -> lock)); } /* Note that even the slow path doesn't lock. */ void * PREFIXED(slow_getspecific) (tsd * key, unsigned long qtid, tse * volatile * cache_ptr) { pthread_t self = pthread_self(); unsigned hash_val = HASH(self); tse *entry = key -> hash[hash_val]; GC_ASSERT(qtid != INVALID_QTID); while (entry != NULL && entry -> thread != self) { entry = entry -> next; } if (entry == NULL) return NULL; /* Set cache_entry. */ entry -> qtid = qtid; /* It's safe to do this asynchronously. Either value */ /* is safe, though may produce spurious misses. */ /* We're replacing one qtid with another one for the */ /* same thread. */ *cache_ptr = entry; /* Again this is safe since pointer assignments are */ /* presumed atomic, and either pointer is valid. */ return entry -> value; } #ifdef GC_ASSERTIONS /* Check that that all elements of the data structure associated */ /* with key are marked. */ void PREFIXED(check_tsd_marks) (tsd *key) { int i; tse *p; if (!GC_is_marked(GC_base(key))) { ABORT("Unmarked thread-specific-data table"); } for (i = 0; i < TS_HASH_SIZE; ++i) { for (p = key -> hash[i]; p != 0; p = p -> next) { if (!GC_is_marked(GC_base(p))) { GC_err_printf( "Thread-specific-data entry at %p not marked\n",p); ABORT("Unmarked tse"); } } } for (i = 0; i < TS_CACHE_SIZE; ++i) { p = key -> cache[i]; if (p != &invalid_tse && !GC_is_marked(GC_base(p))) { GC_err_printf( "Cached thread-specific-data entry at %p not marked\n",p); ABORT("Unmarked cached tse"); } } } #endif #endif /* USE_CUSTOM_SPECIFIC */ synopsis-0.12/src/Synopsis/gc/AmigaOS.c0000644000076400007640000003447711104702321017316 0ustar stefanstefan /****************************************************************** AmigaOS-spesific routines for GC. This file is normally included from os_dep.c ******************************************************************/ #if !defined(GC_AMIGA_DEF) && !defined(GC_AMIGA_SB) && !defined(GC_AMIGA_DS) && !defined(GC_AMIGA_AM) # include "gc_priv.h" # include # include # define GC_AMIGA_DEF # define GC_AMIGA_SB # define GC_AMIGA_DS # define GC_AMIGA_AM #endif #ifdef GC_AMIGA_DEF # ifndef __GNUC__ # include # endif # include # include # include # include #endif #ifdef GC_AMIGA_SB /****************************************************************** Find the base of the stack. ******************************************************************/ ptr_t GC_get_main_stack_base() { struct Process *proc = (struct Process*)SysBase->ThisTask; /* Reference: Amiga Guru Book Pages: 42,567,574 */ if (proc->pr_Task.tc_Node.ln_Type==NT_PROCESS && proc->pr_CLI != NULL) { /* first ULONG is StackSize */ /*longPtr = proc->pr_ReturnAddr; size = longPtr[0];*/ return (char *)proc->pr_ReturnAddr + sizeof(ULONG); } else { return (char *)proc->pr_Task.tc_SPUpper; } } #if 0 /* old version */ ptr_t GC_get_stack_base() { extern struct WBStartup *_WBenchMsg; extern long __base; extern long __stack; struct Task *task; struct Process *proc; struct CommandLineInterface *cli; long size; if ((task = FindTask(0)) == 0) { GC_err_puts("Cannot find own task structure\n"); ABORT("task missing"); } proc = (struct Process *)task; cli = BADDR(proc->pr_CLI); if (_WBenchMsg != 0 || cli == 0) { size = (char *)task->tc_SPUpper - (char *)task->tc_SPLower; } else { size = cli->cli_DefaultStack * 4; } return (ptr_t)(__base + GC_max(size, __stack)); } #endif #endif #ifdef GC_AMIGA_DS /****************************************************************** Register data segments. ******************************************************************/ void GC_register_data_segments() { struct Process *proc; struct CommandLineInterface *cli; BPTR myseglist; ULONG *data; int num; # ifdef __GNUC__ ULONG dataSegSize; GC_bool found_segment = FALSE; extern char __data_size[]; dataSegSize=__data_size+8; /* Can`t find the Location of __data_size, because it`s possible that is it, inside the segment. */ # endif proc= (struct Process*)SysBase->ThisTask; /* Reference: Amiga Guru Book Pages: 538ff,565,573 and XOper.asm */ if (proc->pr_Task.tc_Node.ln_Type==NT_PROCESS) { if (proc->pr_CLI == NULL) { myseglist = proc->pr_SegList; } else { /* ProcLoaded 'Loaded as a command: '*/ cli = BADDR(proc->pr_CLI); myseglist = cli->cli_Module; } } else { ABORT("Not a Process."); } if (myseglist == NULL) { ABORT("Arrrgh.. can't find segments, aborting"); } /* xoper hunks Shell Process */ num=0; for (data = (ULONG *)BADDR(myseglist); data != NULL; data = (ULONG *)BADDR(data[0])) { if (((ULONG) GC_register_data_segments < (ULONG) &data[1]) || ((ULONG) GC_register_data_segments > (ULONG) &data[1] + data[-1])) { # ifdef __GNUC__ if (dataSegSize == data[-1]) { found_segment = TRUE; } # endif GC_add_roots_inner((char *)&data[1], ((char *)&data[1]) + data[-1], FALSE); } ++num; } /* for */ # ifdef __GNUC__ if (!found_segment) { ABORT("Can`t find correct Segments.\nSolution: Use an newer version of ixemul.library"); } # endif } #if 0 /* old version */ void GC_register_data_segments() { extern struct WBStartup *_WBenchMsg; struct Process *proc; struct CommandLineInterface *cli; BPTR myseglist; ULONG *data; if ( _WBenchMsg != 0 ) { if ((myseglist = _WBenchMsg->sm_Segment) == 0) { GC_err_puts("No seglist from workbench\n"); return; } } else { if ((proc = (struct Process *)FindTask(0)) == 0) { GC_err_puts("Cannot find process structure\n"); return; } if ((cli = BADDR(proc->pr_CLI)) == 0) { GC_err_puts("No CLI\n"); return; } if ((myseglist = cli->cli_Module) == 0) { GC_err_puts("No seglist from CLI\n"); return; } } for (data = (ULONG *)BADDR(myseglist); data != 0; data = (ULONG *)BADDR(data[0])) { # ifdef AMIGA_SKIP_SEG if (((ULONG) GC_register_data_segments < (ULONG) &data[1]) || ((ULONG) GC_register_data_segments > (ULONG) &data[1] + data[-1])) { # else { # endif /* AMIGA_SKIP_SEG */ GC_add_roots_inner((char *)&data[1], ((char *)&data[1]) + data[-1], FALSE); } } } #endif /* old version */ #endif #ifdef GC_AMIGA_AM #ifndef GC_AMIGA_FASTALLOC void *GC_amiga_allocwrapper(size_t size,void *(*AllocFunction)(size_t size2)){ return (*AllocFunction)(size); } void *(*GC_amiga_allocwrapper_do)(size_t size,void *(*AllocFunction)(size_t size2)) =GC_amiga_allocwrapper; #else void *GC_amiga_allocwrapper_firsttime(size_t size,void *(*AllocFunction)(size_t size2)); void *(*GC_amiga_allocwrapper_do)(size_t size,void *(*AllocFunction)(size_t size2)) =GC_amiga_allocwrapper_firsttime; /****************************************************************** Amiga-spesific routines to obtain memory, and force GC to give back fast-mem whenever possible. These hacks makes gc-programs go many times faster when the amiga is low on memory, and are therefore strictly necesarry. -Kjetil S. Matheussen, 2000. ******************************************************************/ /* List-header for all allocated memory. */ struct GC_Amiga_AllocedMemoryHeader{ ULONG size; struct GC_Amiga_AllocedMemoryHeader *next; }; struct GC_Amiga_AllocedMemoryHeader *GC_AMIGAMEM=(struct GC_Amiga_AllocedMemoryHeader *)(int)~(NULL); /* Type of memory. Once in the execution of a program, this might change to MEMF_ANY|MEMF_CLEAR */ ULONG GC_AMIGA_MEMF = MEMF_FAST | MEMF_CLEAR; /* Prevents GC_amiga_get_mem from allocating memory if this one is TRUE. */ #ifndef GC_AMIGA_ONLYFAST BOOL GC_amiga_dontalloc=FALSE; #endif #ifdef GC_AMIGA_PRINTSTATS int succ=0,succ2=0; int nsucc=0,nsucc2=0; int nullretries=0; int numcollects=0; int chipa=0; int allochip=0; int allocfast=0; int cur0=0; int cur1=0; int cur10=0; int cur50=0; int cur150=0; int cur151=0; int ncur0=0; int ncur1=0; int ncur10=0; int ncur50=0; int ncur150=0; int ncur151=0; #endif /* Free everything at program-end. */ void GC_amiga_free_all_mem(void){ struct GC_Amiga_AllocedMemoryHeader *gc_am=(struct GC_Amiga_AllocedMemoryHeader *)(~(int)(GC_AMIGAMEM)); struct GC_Amiga_AllocedMemoryHeader *temp; #ifdef GC_AMIGA_PRINTSTATS printf("\n\n" "%d bytes of chip-mem, and %d bytes of fast-mem where allocated from the OS.\n", allochip,allocfast ); printf( "%d bytes of chip-mem were returned from the GC_AMIGA_FASTALLOC supported allocating functions.\n", chipa ); printf("\n"); printf("GC_gcollect was called %d times to avoid returning NULL or start allocating with the MEMF_ANY flag.\n",numcollects); printf("%d of them was a success. (the others had to use allocation from the OS.)\n",nullretries); printf("\n"); printf("Succeded forcing %d gc-allocations (%d bytes) of chip-mem to be fast-mem.\n",succ,succ2); printf("Failed forcing %d gc-allocations (%d bytes) of chip-mem to be fast-mem.\n",nsucc,nsucc2); printf("\n"); printf( "Number of retries before succeding a chip->fast force:\n" "0: %d, 1: %d, 2-9: %d, 10-49: %d, 50-149: %d, >150: %d\n", cur0,cur1,cur10,cur50,cur150,cur151 ); printf( "Number of retries before giving up a chip->fast force:\n" "0: %d, 1: %d, 2-9: %d, 10-49: %d, 50-149: %d, >150: %d\n", ncur0,ncur1,ncur10,ncur50,ncur150,ncur151 ); #endif while(gc_am!=NULL){ temp=gc_am->next; FreeMem(gc_am,gc_am->size); gc_am=(struct GC_Amiga_AllocedMemoryHeader *)(~(int)(temp)); } } #ifndef GC_AMIGA_ONLYFAST /* All memory with address lower than this one is chip-mem. */ char *chipmax; /* * Allways set to the last size of memory tried to be allocated. * Needed to ensure allocation when the size is bigger than 100000. * */ size_t latestsize; #endif /* * The actual function that is called with the GET_MEM macro. * */ void *GC_amiga_get_mem(size_t size){ struct GC_Amiga_AllocedMemoryHeader *gc_am; #ifndef GC_AMIGA_ONLYFAST if(GC_amiga_dontalloc==TRUE){ // printf("rejected, size: %d, latestsize: %d\n",size,latestsize); return NULL; } // We really don't want to use chip-mem, but if we must, then as little as possible. if(GC_AMIGA_MEMF==(MEMF_ANY|MEMF_CLEAR) && size>100000 && latestsize<50000) return NULL; #endif gc_am=AllocMem((ULONG)(size + sizeof(struct GC_Amiga_AllocedMemoryHeader)),GC_AMIGA_MEMF); if(gc_am==NULL) return NULL; gc_am->next=GC_AMIGAMEM; gc_am->size=size + sizeof(struct GC_Amiga_AllocedMemoryHeader); GC_AMIGAMEM=(struct GC_Amiga_AllocedMemoryHeader *)(~(int)(gc_am)); // printf("Allocated %d (%d) bytes at address: %x. Latest: %d\n",size,tot,gc_am,latestsize); #ifdef GC_AMIGA_PRINTSTATS if((char *)gc_amchipmax || ret==NULL){ if(ret==NULL){ nsucc++; nsucc2+=size; if(rec==0) ncur0++; if(rec==1) ncur1++; if(rec>1 && rec<10) ncur10++; if(rec>=10 && rec<50) ncur50++; if(rec>=50 && rec<150) ncur150++; if(rec>=150) ncur151++; }else{ succ++; succ2+=size; if(rec==0) cur0++; if(rec==1) cur1++; if(rec>1 && rec<10) cur10++; if(rec>=10 && rec<50) cur50++; if(rec>=50 && rec<150) cur150++; if(rec>=150) cur151++; } } #endif if (((char *)ret)<=chipmax && ret!=NULL && (rec<(size>500000?9:size/5000))){ ret=GC_amiga_rec_alloc(size,AllocFunction,rec+1); // GC_free(ret2); } return ret; } #endif /* The allocating-functions defined inside the amiga-blocks in gc.h is called * via these functions. */ void *GC_amiga_allocwrapper_any(size_t size,void *(*AllocFunction)(size_t size2)){ void *ret,*ret2; GC_amiga_dontalloc=TRUE; // Pretty tough thing to do, but its indeed necesarry. latestsize=size; ret=(*AllocFunction)(size); if(((char *)ret) <= chipmax){ if(ret==NULL){ //Give GC access to allocate memory. #ifdef GC_AMIGA_GC if(!GC_dont_gc){ GC_gcollect(); #ifdef GC_AMIGA_PRINTSTATS numcollects++; #endif ret=(*AllocFunction)(size); } #endif if(ret==NULL){ GC_amiga_dontalloc=FALSE; ret=(*AllocFunction)(size); if(ret==NULL){ WARN("Out of Memory! Returning NIL!\n", 0); } } #ifdef GC_AMIGA_PRINTSTATS else{ nullretries++; } if(ret!=NULL && (char *)ret<=chipmax) chipa+=size; #endif } #ifdef GC_AMIGA_RETRY else{ /* We got chip-mem. Better try again and again and again etc., we might get fast-mem sooner or later... */ /* Using gctest to check the effectiviness of doing this, does seldom give a very good result. */ /* However, real programs doesn't normally rapidly allocate and deallocate. */ // printf("trying to force... %d bytes... ",size); if( AllocFunction!=GC_malloc_uncollectable #ifdef ATOMIC_UNCOLLECTABLE && AllocFunction!=GC_malloc_atomic_uncollectable #endif ){ ret2=GC_amiga_rec_alloc(size,AllocFunction,0); }else{ ret2=(*AllocFunction)(size); #ifdef GC_AMIGA_PRINTSTATS if((char *)ret2chipmax){ // printf("Succeeded.\n"); GC_free(ret); ret=ret2; }else{ GC_free(ret2); // printf("But did not succeed.\n"); } } #endif } GC_amiga_dontalloc=FALSE; return ret; } void (*GC_amiga_toany)(void)=NULL; void GC_amiga_set_toany(void (*func)(void)){ GC_amiga_toany=func; } #endif // !GC_AMIGA_ONLYFAST void *GC_amiga_allocwrapper_fast(size_t size,void *(*AllocFunction)(size_t size2)){ void *ret; ret=(*AllocFunction)(size); if(ret==NULL){ // Enable chip-mem allocation. // printf("ret==NULL\n"); #ifdef GC_AMIGA_GC if(!GC_dont_gc){ GC_gcollect(); #ifdef GC_AMIGA_PRINTSTATS numcollects++; #endif ret=(*AllocFunction)(size); } #endif if(ret==NULL){ #ifndef GC_AMIGA_ONLYFAST GC_AMIGA_MEMF=MEMF_ANY | MEMF_CLEAR; if(GC_amiga_toany!=NULL) (*GC_amiga_toany)(); GC_amiga_allocwrapper_do=GC_amiga_allocwrapper_any; return GC_amiga_allocwrapper_any(size,AllocFunction); #endif } #ifdef GC_AMIGA_PRINTSTATS else{ nullretries++; } #endif } return ret; } void *GC_amiga_allocwrapper_firsttime(size_t size,void *(*AllocFunction)(size_t size2)){ atexit(&GC_amiga_free_all_mem); chipmax=(char *)SysBase->MaxLocMem; // For people still having SysBase in chip-mem, this might speed up a bit. GC_amiga_allocwrapper_do=GC_amiga_allocwrapper_fast; return GC_amiga_allocwrapper_fast(size,AllocFunction); } #endif //GC_AMIGA_FASTALLOC /* * The wrapped realloc function. * */ void *GC_amiga_realloc(void *old_object,size_t new_size_in_bytes){ #ifndef GC_AMIGA_FASTALLOC return GC_realloc(old_object,new_size_in_bytes); #else void *ret; latestsize=new_size_in_bytes; ret=GC_realloc(old_object,new_size_in_bytes); if(ret==NULL && GC_AMIGA_MEMF==(MEMF_FAST | MEMF_CLEAR)){ /* Out of fast-mem. */ #ifdef GC_AMIGA_GC if(!GC_dont_gc){ GC_gcollect(); #ifdef GC_AMIGA_PRINTSTATS numcollects++; #endif ret=GC_realloc(old_object,new_size_in_bytes); } #endif if(ret==NULL){ #ifndef GC_AMIGA_ONLYFAST GC_AMIGA_MEMF=MEMF_ANY | MEMF_CLEAR; if(GC_amiga_toany!=NULL) (*GC_amiga_toany)(); GC_amiga_allocwrapper_do=GC_amiga_allocwrapper_any; ret=GC_realloc(old_object,new_size_in_bytes); #endif } #ifdef GC_AMIGA_PRINTSTATS else{ nullretries++; } #endif } if(ret==NULL){ WARN("Out of Memory! Returning NIL!\n", 0); } #ifdef GC_AMIGA_PRINTSTATS if(((char *)ret); make; make check; make install". Link against /lib/libgc.a or /lib/libgc.so. See README.autoconf for details Under Windows 95, 98, Me, NT, or 2000: copy the appropriate makefile to MAKEFILE, read it, and type "nmake test". (Under Windows, this assumes you have Microsoft command-line tools installed, and suitably configured.) Read the machine specific README in the doc directory if one exists. If you need thread support, you will need to follow the special platform-dependent instructions (win32), or define GC_THREADS as described in Makefile (Makefile.direct), or possibly use --enable-threads=posix when running the configure script. If you wish to use the cord (structured string) library with the stand-alone Makefile.direct, type "make cords", after copying to "Makefile". (This requires an ANSI C compiler. You may need to redefine CC in the Makefile. The CORD_printf implementation in cordprnt.c is known to be less than perfectly portable. The rest of the package should still work.) If you wish to use the collector from C++, type "make c++", or use --enable-cplusplus with the configure script. With Makefile.direct, hese add further files to gc.a and to the include subdirectory. With the alternat build process,this generates libgccpp. See cord/cord.h and include/gc_cpp.h. TYPICAL USE: Include "gc.h" from the include subdirectory. Link against the appropriate library ("gc.a" under UN*X). Replace calls to malloc by calls to GC_MALLOC, and calls to realloc by calls to GC_REALLOC. If the object is known to never contain pointers, use GC_MALLOC_ATOMIC instead of GC_MALLOC. Define GC_DEBUG before including gc.h for additional checking. More documentation on the collector interface can be found at http://www.hpl.hp.com/personal/Hans_Boehm/gc/gcinterface.html, in doc/README and other files in the doc directory, and in include/gc.h . WARNINGS: Do not store the only pointer to an object in memory allocated with system malloc, since the collector usually does not scan memory allocated in this way. Use with threads may be supported on your system, but requires the collector to be built with thread support. See Makefile. The collector does not guarantee to scan thread-local storage (e.g. of the kind accessed with pthread_getspecific()). The collector does scan thread stacks though, so generally the best solution is to ensure that any pointers stored in thread-local storage are also stored on the thread's stack for the duration of their lifetime. synopsis-0.12/src/Synopsis/gc/real_malloc.c0000664000076400007640000000165111104702317020303 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* Boehm, May 19, 1994 2:04 pm PDT */ # ifdef PCR /* * This definition should go in its own file that includes no other * header files. Otherwise, we risk not getting the underlying system * malloc. */ # define PCR_NO_RENAME # include void * real_malloc(size_t size) { return(malloc(size)); } #endif /* PCR */ synopsis-0.12/src/Synopsis/gc/pcr_interface.c0000664000076400007640000001123611104702316020634 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ # include "private/gc_priv.h" # ifdef PCR /* * Note that POSIX PCR requires an ANSI C compiler. Hence we are allowed * to make the same assumption here. * We wrap all of the allocator functions to avoid questions of * compatibility between the prototyped and nonprototyped versions of the f */ # include "config/PCR_StdTypes.h" # include "mm/PCR_MM.h" # include # define MY_MAGIC 17L # define MY_DEBUGMAGIC 42L void * GC_AllocProc(size_t size, PCR_Bool ptrFree, PCR_Bool clear ) { if (ptrFree) { void * result = (void *)GC_malloc_atomic(size); if (clear && result != 0) BZERO(result, size); return(result); } else { return((void *)GC_malloc(size)); } } void * GC_DebugAllocProc(size_t size, PCR_Bool ptrFree, PCR_Bool clear ) { if (ptrFree) { void * result = (void *)GC_debug_malloc_atomic(size, __FILE__, __LINE__); if (clear && result != 0) BZERO(result, size); return(result); } else { return((void *)GC_debug_malloc(size, __FILE__, __LINE__)); } } # define GC_ReallocProc GC_realloc void * GC_DebugReallocProc(void * old_object, size_t new_size_in_bytes) { return(GC_debug_realloc(old_object, new_size_in_bytes, __FILE__, __LINE__)); } # define GC_FreeProc GC_free # define GC_DebugFreeProc GC_debug_free typedef struct { PCR_ERes (*ed_proc)(void *p, size_t size, PCR_Any data); GC_bool ed_pointerfree; PCR_ERes ed_fail_code; PCR_Any ed_client_data; } enumerate_data; void GC_enumerate_block(struct hblk *h; enumerate_data * ed) { register hdr * hhdr; register int sz; ptr_t p; ptr_t lim; word descr; # error This code was updated without testing. # error and its precursor was clearly broken. hhdr = HDR(h); descr = hhdr -> hb_descr; sz = hhdr -> hb_sz; if (descr != 0 && ed -> ed_pointerfree || descr == 0 && !(ed -> ed_pointerfree)) return; lim = (ptr_t)(h+1) - sz; p = (ptr_t)h; do { if (PCR_ERes_IsErr(ed -> ed_fail_code)) return; ed -> ed_fail_code = (*(ed -> ed_proc))(p, sz, ed -> ed_client_data); p+= sz; } while (p <= lim); } struct PCR_MM_ProcsRep * GC_old_allocator = 0; PCR_ERes GC_EnumerateProc( PCR_Bool ptrFree, PCR_ERes (*proc)(void *p, size_t size, PCR_Any data), PCR_Any data ) { enumerate_data ed; ed.ed_proc = proc; ed.ed_pointerfree = ptrFree; ed.ed_fail_code = PCR_ERes_okay; ed.ed_client_data = data; GC_apply_to_all_blocks(GC_enumerate_block, &ed); if (ed.ed_fail_code != PCR_ERes_okay) { return(ed.ed_fail_code); } else { /* Also enumerate objects allocated by my predecessors */ return((*(GC_old_allocator->mmp_enumerate))(ptrFree, proc, data)); } } void GC_DummyFreeProc(void *p) {} void GC_DummyShutdownProc(void) {} struct PCR_MM_ProcsRep GC_Rep = { MY_MAGIC, GC_AllocProc, GC_ReallocProc, GC_DummyFreeProc, /* mmp_free */ GC_FreeProc, /* mmp_unsafeFree */ GC_EnumerateProc, GC_DummyShutdownProc /* mmp_shutdown */ }; struct PCR_MM_ProcsRep GC_DebugRep = { MY_DEBUGMAGIC, GC_DebugAllocProc, GC_DebugReallocProc, GC_DummyFreeProc, /* mmp_free */ GC_DebugFreeProc, /* mmp_unsafeFree */ GC_EnumerateProc, GC_DummyShutdownProc /* mmp_shutdown */ }; GC_bool GC_use_debug = 0; void GC_pcr_install() { PCR_MM_Install((GC_use_debug? &GC_DebugRep : &GC_Rep), &GC_old_allocator); } PCR_ERes PCR_GC_Setup(void) { return PCR_ERes_okay; } PCR_ERes PCR_GC_Run(void) { if( !PCR_Base_TestPCRArg("-nogc") ) { GC_quiet = ( PCR_Base_TestPCRArg("-gctrace") ? 0 : 1 ); GC_use_debug = (GC_bool)PCR_Base_TestPCRArg("-debug_alloc"); GC_init(); if( !PCR_Base_TestPCRArg("-nogc_incremental") ) { /* * awful hack to test whether VD is implemented ... */ if( PCR_VD_Start( 0, NIL, 0) != PCR_ERes_FromErr(ENOSYS) ) { GC_enable_incremental(); } } } return PCR_ERes_okay; } void GC_push_thread_structures(void) { /* PCR doesn't work unless static roots are pushed. Can't get here. */ ABORT("In GC_push_thread_structures()"); } # endif synopsis-0.12/src/Synopsis/gc/Makefile.in0000644000076400007640000014747611104702316017747 0ustar stefanstefan# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Copyright (c) 1999-2001 by Red Hat, Inc. All rights reserved. # # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED # OR IMPLIED. ANY USE IS AT YOUR OWN RISK. # # Permission is hereby granted to use or copy this program # for any purpose, provided the above notices are retained on all copies. # Permission to modify the code and to distribute modified code is granted, # provided the above notices are retained, and a notice that the code was # modified is included with the above copyright notice. # # Original author: Tom Tromey # Severely truncated by Hans-J. Boehm # Modified by: Grzegorz Jakacki # Modified by: Petter Urkedal (2005-04) # # # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED # OR IMPLIED. ANY USE IS AT YOUR OWN RISK. # # Permission is hereby granted to use or copy this program # for any purpose, provided the above notices are retained on all copies. # Permission to modify the code and to distribute modified code is granted, # provided the above notices are retained, and a notice that the code was # modified is included with the above copyright notice. # # Modified by: Grzegorz Jakacki # Modified by: Petter Urkedal # # # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED # OR IMPLIED. ANY USE IS AT YOUR OWN RISK. # # Permission is hereby granted to use or copy this program # for any purpose, provided the above notices are retained on all copies. # Permission to modify the code and to distribute modified code is granted, # provided the above notices are retained, and a notice that the code was # modified is included with the above copyright notice. # # # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED # OR IMPLIED. ANY USE IS AT YOUR OWN RISK. # # Permission is hereby granted to use or copy this program # for any purpose, provided the above notices are retained on all copies. # Permission to modify the code and to distribute modified code is granted, # provided the above notices are retained, and a notice that the code was # modified is included with the above copyright notice. # # Modified by: Grzegorz Jakacki # Modified by: Petter Urkedal 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@ target_triplet = @target@ check_PROGRAMS = gctest$(EXEEXT) leaktest$(EXEEXT) middletest$(EXEEXT) \ $(am__EXEEXT_1) $(am__EXEEXT_2) # C Library: Architecture Dependent # --------------------------------- @PTHREADS_TRUE@am__append_1 = pthread_support.c pthread_stop_world.c @DARWIN_THREADS_TRUE@am__append_2 = darwin_stop_world.c @WIN32_THREADS_TRUE@am__append_3 = win32_threads.c # C++ Interface # ------------- @CPLUSPLUS_TRUE@am__append_4 = libgccpp.la @CPLUSPLUS_TRUE@am__append_5 = include/gc_cpp.h include/gc_allocator.h DIST_COMMON = $(am__configure_deps) $(am__pkginclude_HEADERS_DIST) \ $(dist_noinst_HEADERS) $(dist_noinst_SCRIPTS) \ $(dist_pkgconfig_DATA) $(dist_pkgdata_DATA) $(include_HEADERS) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/bdw-gc.pc.in $(srcdir)/cord/cord.am \ $(srcdir)/doc/doc.am $(srcdir)/include/include.am \ $(srcdir)/tests/tests.am $(top_srcdir)/configure ChangeLog \ compile config.guess config.sub depcomp install-sh ltmain.sh \ missing mkinstalldirs #TESTS += tracetest$(EXEEXT) #check_PROGRAMS += tracetest #tracetest_SOURCES = tests/trace_test.c #tracetest_LDADD = $(test_ldadd) @THREADS_TRUE@am__append_6 = threadleaktest$(EXEEXT) @THREADS_TRUE@am__append_7 = threadleaktest @CPLUSPLUS_TRUE@am__append_8 = test_cpp$(EXEEXT) @CPLUSPLUS_TRUE@am__append_9 = test_cpp subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/libtool.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = bdw-gc.pc 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)$(pkgconfigdir)" \ "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(includedir)" \ "$(DESTDIR)$(pkgincludedir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) libcord_la_DEPENDENCIES = $(top_builddir)/libgc.la am__dirstamp = $(am__leading_dot)dirstamp am_libcord_la_OBJECTS = cord/cordbscs.lo cord/cordprnt.lo \ cord/cordtest.lo cord/cordxtra.lo libcord_la_OBJECTS = $(am_libcord_la_OBJECTS) am__DEPENDENCIES_1 = am__libgc_la_SOURCES_DIST = allchblk.c alloc.c blacklst.c checksums.c \ dbg_mlc.c dyn_load.c finalize.c gc_dlopen.c gcj_mlc.c \ headers.c malloc.c mallocx.c mark.c mark_rts.c misc.c \ new_hblk.c obj_map.c os_dep.c pcr_interface.c ptr_chck.c \ real_malloc.c reclaim.c specific.c stubborn.c typd_mlc.c \ backgraph.c thread_local_alloc.c pthread_support.c \ pthread_stop_world.c darwin_stop_world.c win32_threads.c @PTHREADS_TRUE@am__objects_1 = pthread_support.lo \ @PTHREADS_TRUE@ pthread_stop_world.lo @DARWIN_THREADS_TRUE@am__objects_2 = darwin_stop_world.lo @WIN32_THREADS_TRUE@am__objects_3 = win32_threads.lo am_libgc_la_OBJECTS = allchblk.lo alloc.lo blacklst.lo checksums.lo \ dbg_mlc.lo dyn_load.lo finalize.lo gc_dlopen.lo gcj_mlc.lo \ headers.lo malloc.lo mallocx.lo mark.lo mark_rts.lo misc.lo \ new_hblk.lo obj_map.lo os_dep.lo pcr_interface.lo ptr_chck.lo \ real_malloc.lo reclaim.lo specific.lo stubborn.lo typd_mlc.lo \ backgraph.lo thread_local_alloc.lo $(am__objects_1) \ $(am__objects_2) $(am__objects_3) @NEED_ATOMIC_OPS_ASM_FALSE@@USE_INTERNAL_LIBATOMIC_OPS_TRUE@nodist_libgc_la_OBJECTS = atomic_ops.lo @NEED_ATOMIC_OPS_ASM_TRUE@nodist_libgc_la_OBJECTS = \ @NEED_ATOMIC_OPS_ASM_TRUE@ atomic_ops_sysdeps.lo libgc_la_OBJECTS = $(am_libgc_la_OBJECTS) $(nodist_libgc_la_OBJECTS) @CPLUSPLUS_TRUE@libgccpp_la_DEPENDENCIES = $(top_builddir)/libgc.la am__libgccpp_la_SOURCES_DIST = gc_cpp.cc @CPLUSPLUS_TRUE@am_libgccpp_la_OBJECTS = gc_cpp.lo libgccpp_la_OBJECTS = $(am_libgccpp_la_OBJECTS) @CPLUSPLUS_TRUE@am_libgccpp_la_rpath = -rpath $(libdir) @THREADS_TRUE@am__EXEEXT_1 = threadleaktest$(EXEEXT) @CPLUSPLUS_TRUE@am__EXEEXT_2 = test_cpp$(EXEEXT) am_gctest_OBJECTS = tests/test.$(OBJEXT) gctest_OBJECTS = $(am_gctest_OBJECTS) am__DEPENDENCIES_2 = $(top_builddir)/libgc.la $(am__DEPENDENCIES_1) am_leaktest_OBJECTS = tests/leak_test.$(OBJEXT) leaktest_OBJECTS = $(am_leaktest_OBJECTS) leaktest_DEPENDENCIES = $(am__DEPENDENCIES_2) am_middletest_OBJECTS = tests/middle.$(OBJEXT) middletest_OBJECTS = $(am_middletest_OBJECTS) middletest_DEPENDENCIES = $(am__DEPENDENCIES_2) am__test_cpp_SOURCES_DIST = tests/test_cpp.cc @CPLUSPLUS_TRUE@am_test_cpp_OBJECTS = tests/test_cpp.$(OBJEXT) test_cpp_OBJECTS = $(am_test_cpp_OBJECTS) @CPLUSPLUS_TRUE@test_cpp_DEPENDENCIES = libgccpp.la \ @CPLUSPLUS_TRUE@ $(am__DEPENDENCIES_2) am__threadleaktest_SOURCES_DIST = tests/thread_leak_test.c @THREADS_TRUE@am_threadleaktest_OBJECTS = \ @THREADS_TRUE@ tests/thread_leak_test.$(OBJEXT) threadleaktest_OBJECTS = $(am_threadleaktest_OBJECTS) @THREADS_TRUE@threadleaktest_DEPENDENCIES = $(am__DEPENDENCIES_2) SCRIPTS = $(dist_noinst_SCRIPTS) DEFAULT_INCLUDES = depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) LTCCASCOMPILE = $(LIBTOOL) --mode=compile $(CCAS) $(AM_CCASFLAGS) \ $(CCASFLAGS) 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 $@ 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 $@ SOURCES = $(libcord_la_SOURCES) $(libgc_la_SOURCES) \ $(EXTRA_libgc_la_SOURCES) $(nodist_libgc_la_SOURCES) \ $(libgccpp_la_SOURCES) $(gctest_SOURCES) $(leaktest_SOURCES) \ $(middletest_SOURCES) $(test_cpp_SOURCES) \ $(threadleaktest_SOURCES) DIST_SOURCES = $(libcord_la_SOURCES) $(am__libgc_la_SOURCES_DIST) \ $(EXTRA_libgc_la_SOURCES) $(am__libgccpp_la_SOURCES_DIST) \ $(gctest_SOURCES) $(leaktest_SOURCES) $(middletest_SOURCES) \ $(am__test_cpp_SOURCES_DIST) \ $(am__threadleaktest_SOURCES_DIST) 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 dist_pkgconfigDATA_INSTALL = $(INSTALL_DATA) dist_pkgdataDATA_INSTALL = $(INSTALL_DATA) DATA = $(dist_pkgconfig_DATA) $(dist_pkgdata_DATA) includeHEADERS_INSTALL = $(INSTALL_HEADER) am__pkginclude_HEADERS_DIST = include/gc_cpp.h include/gc_allocator.h \ include/gc.h include/gc_typed.h include/gc_inline.h \ include/gc_mark.h include/weakpointer.h include/new_gc_alloc.h \ include/gc_backptr.h include/gc_gcj.h include/leak_detector.h \ include/gc_amiga_redirects.h include/gc_pthread_redirects.h \ include/gc_config_macros.h include/gc_tiny_fl.h pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(dist_noinst_HEADERS) $(include_HEADERS) \ $(pkginclude_HEADERS) ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ $(DEFS) CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILER_XLC_FALSE = @COMPILER_XLC_FALSE@ COMPILER_XLC_TRUE = @COMPILER_XLC_TRUE@ CPLUSPLUS_FALSE = @CPLUSPLUS_FALSE@ CPLUSPLUS_TRUE = @CPLUSPLUS_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXXINCLUDES = @CXXINCLUDES@ CYGPATH_W = @CYGPATH_W@ DARWIN_THREADS_FALSE = @DARWIN_THREADS_FALSE@ DARWIN_THREADS_TRUE = @DARWIN_THREADS_TRUE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_GCJ_SUPPORT_FALSE = @ENABLE_GCJ_SUPPORT_FALSE@ ENABLE_GCJ_SUPPORT_TRUE = @ENABLE_GCJ_SUPPORT_TRUE@ EXEEXT = @EXEEXT@ EXTRA_TEST_LIBS = @EXTRA_TEST_LIBS@ F77 = @F77@ FFLAGS = @FFLAGS@ GC_CFLAGS = @GC_CFLAGS@ GC_VERSION = @GC_VERSION@ GREP = @GREP@ INCLUDES = @INCLUDES@ 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@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ NEED_ATOMIC_OPS_ASM_FALSE = @NEED_ATOMIC_OPS_ASM_FALSE@ NEED_ATOMIC_OPS_ASM_TRUE = @NEED_ATOMIC_OPS_ASM_TRUE@ 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@ PTHREADS_FALSE = @PTHREADS_FALSE@ PTHREADS_TRUE = @PTHREADS_TRUE@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ THREADDLLIBS = @THREADDLLIBS@ THREADS_FALSE = @THREADS_FALSE@ THREADS_TRUE = @THREADS_TRUE@ UNWINDLIBS = @UNWINDLIBS@ USE_INTERNAL_LIBATOMIC_OPS_FALSE = @USE_INTERNAL_LIBATOMIC_OPS_FALSE@ USE_INTERNAL_LIBATOMIC_OPS_TRUE = @USE_INTERNAL_LIBATOMIC_OPS_TRUE@ USE_LIBDIR_FALSE = @USE_LIBDIR_FALSE@ USE_LIBDIR_TRUE = @USE_LIBDIR_TRUE@ VERSION = @VERSION@ WIN32_THREADS_FALSE = @WIN32_THREADS_FALSE@ WIN32_THREADS_TRUE = @WIN32_THREADS_TRUE@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ addlibs = @addlibs@ addobjs = @addobjs@ 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@ atomic_ops_libs = @atomic_ops_libs@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extra_ldflags_libgc = @extra_ldflags_libgc@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ subdirs = @subdirs@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_all = @target_all@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ # We currently use the source files directly from libatomic_ops, if we # use the internal version. This is done since libatomic_ops doesn't # use libtool, since it has no real use for it. But that seems to make # it hard to use either the resulting object files or libraries. # Thus there seems too be no real reason to recusively build in the # libatomic_ops directory. # if USE_INTERNAL_LIBATOMICS_OPS # SUBDIRS = @maybe_libatomic_ops@ # else # SUBDIRS = # endif SUBDIRS = # Initialize variables so that we can declare files locally. # FIXME: If Visual C++ users use Makefile.am, this should go into # pkginclude_HEADERS with proper AM_CONDITIONALization. Otherwise # delete this comment. # documentation which is not installed # # other makefiles # :GOTCHA: deliberately we do not include 'Makefile' # files used by makefiles other than Makefile.am # # The libatomic_ops library. This is not ideal, since we pick up junk from # there. The hard-coded version number should also go. # :FIXME: why do we distribute this one??? # EXTRA_DIST = gc_cpp.cpp README.QUICK BCC_MAKEFILE NT_MAKEFILE \ NT_THREADS_MAKEFILE OS2_MAKEFILE PCR-Makefile digimars.mak \ EMX_MAKEFILE Makefile.direct Makefile.dj Makefile.DLLs \ SMakefile.amiga WCC_MAKEFILE configure_atomic_ops.sh \ NT_STATIC_THREADS_MAKEFILE NT_X64_STATIC_THREADS_MAKEFILE \ add_gc_prefix.c gcname.c if_mach.c if_not_there.c \ hpux_test_and_clear.s gc.mak MacOS.c MacProjects.sit.hqx \ mach_dep.c setjmp_t.c threadlibs.c AmigaOS.c \ Mac_files/datastart.c Mac_files/dataend.c \ Mac_files/MacOS_config.h Mac_files/MacOS_Test_config.h \ include/private/msvc_dbg.h msvc_dbg.c libatomic_ops-1.2 \ libtool.m4 cord/cordbscs.c cord/cordtest.c cord/de.c \ cord/cordprnt.c cord/cordxtra.c cord/de_cmds.h cord/de_win.h \ cord/de_win.c cord/de_win.RC cord/de_win.ICO # C Library # --------- lib_LTLIBRARIES = libgc.la $(am__append_4)# libcord.la include_HEADERS = # installed headers # pkginclude_HEADERS = $(am__append_5) include/gc.h include/gc_typed.h \ include/gc_inline.h include/gc_mark.h include/gc_cpp.h \ include/weakpointer.h include/new_gc_alloc.h \ include/gc_allocator.h include/gc_backptr.h include/gc_gcj.h \ include/leak_detector.h include/gc_amiga_redirects.h \ include/gc_pthread_redirects.h include/gc_config_macros.h \ include/gc_tiny_fl.h # headers which are not installed # (see include/include.am for more) # # headers which are not installed # dist_noinst_HEADERS = version.h include/private/gc_hdrs.h \ include/private/gc_priv.h include/private/gcconfig.h \ include/private/gc_pmark.h include/private/gc_locks.h \ include/private/dbg_mlc.h include/private/specific.h \ include/private/cord_pos.h include/private/pthread_support.h \ include/private/pthread_stop_world.h \ include/private/darwin_semaphore.h \ include/private/darwin_stop_world.h \ include/private/thread_local_alloc.h include/cord.h \ include/ec.h include/javaxfc.h TESTS = gctest$(EXEEXT) leaktest$(EXEEXT) middletest$(EXEEXT) \ $(am__append_6) $(am__append_8) pkgconfigdir = $(libdir)/pkgconfig dist_pkgconfig_DATA = bdw-gc.pc libgc_la_SOURCES = allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c \ dyn_load.c finalize.c gc_dlopen.c gcj_mlc.c headers.c malloc.c \ mallocx.c mark.c mark_rts.c misc.c new_hblk.c obj_map.c \ os_dep.c pcr_interface.c ptr_chck.c real_malloc.c reclaim.c \ specific.c stubborn.c typd_mlc.c backgraph.c \ thread_local_alloc.c $(am__append_1) $(am__append_2) \ $(am__append_3) @NEED_ATOMIC_OPS_ASM_TRUE@nodist_libgc_la_SOURCES = atomic_ops_sysdeps.S @USE_INTERNAL_LIBATOMIC_OPS_TRUE@nodist_libgc_la_SOURCES = atomic_ops.c # Include THREADDLLIBS here to ensure that the correct versions of # linuxthread semaphore functions get linked: libgc_la_LIBADD = @addobjs@ $(THREADDLLIBS) $(UNWINDLIBS) libgc_la_DEPENDENCIES = @addobjs@ libgc_la_LDFLAGS = $(extra_ldflags_libgc) -version-info 1:3:0 -no-undefined EXTRA_libgc_la_SOURCES = alpha_mach_dep.S \ mips_sgi_mach_dep.s mips_ultrix_mach_dep.s \ rs6000_mach_dep.s sparc_mach_dep.S sparc_netbsd_mach_dep.s \ sparc_sunos4_mach_dep.s ia64_save_regs_in_stack.s @CPLUSPLUS_TRUE@libgccpp_la_SOURCES = gc_cpp.cc @CPLUSPLUS_TRUE@libgccpp_la_LIBADD = $(top_builddir)/libgc.la @CPLUSPLUS_TRUE@libgccpp_la_LDFLAGS = -version-info 1:3:0 -no-undefined # Misc # ---- AM_CXXFLAGS = @GC_CFLAGS@ AM_CFLAGS = @GC_CFLAGS@ @COMPILER_XLC_FALSE@ASM_CPP_OPTIONS = -Wp,-P -x assembler-with-cpp #all_objs = @addobjs@ $(libgc_la_OBJECTS) #$(all_objs) : include/private/gcconfig.h include/private/gc_priv.h \ #include/private/gc_hdrs.h include/gc.h include/gc_gcj.h \ #include/gc_pthread_redirects.h include/gc_config_macros.h \ #include/private/thread_local_alloc.h include/private_support.h \ #include/private/pthread_stop_world.h \ #include/gc_mark.h @addincludes@ @COMPILER_XLC_TRUE@ASM_CPP_OPTIONS = dist_noinst_SCRIPTS = callprocs configure.host # this is an auxiliary shell file used by Makefile and Makefile.direct # CONFIG_STATUS_DEPENDENCIES = $(srcdir)/configure.host libcord_la_LIBADD = $(top_builddir)/libgc.la libcord_la_LDFLAGS = -version-info 1:3:0 -no-undefined libcord_la_SOURCES = \ cord/cordbscs.c \ cord/cordprnt.c \ cord/cordtest.c \ cord/cordxtra.c # Common libs to _LDADD for all tests. test_ldadd = $(top_builddir)/libgc.la $(EXTRA_TEST_LIBS) gctest_SOURCES = tests/test.c gctest_LDADD = $(test_ldadd) gctest_DEPENDENCIES = $(top_builddir)/libgc.la leaktest_SOURCES = tests/leak_test.c leaktest_LDADD = $(test_ldadd) middletest_SOURCES = tests/middle.c middletest_LDADD = $(test_ldadd) @THREADS_TRUE@threadleaktest_SOURCES = tests/thread_leak_test.c @THREADS_TRUE@threadleaktest_LDADD = $(test_ldadd) @CPLUSPLUS_TRUE@test_cpp_SOURCES = tests/test_cpp.cc @CPLUSPLUS_TRUE@test_cpp_LDADD = libgccpp.la $(test_ldadd) # installed documentation # dist_pkgdata_DATA = \ doc/barrett_diagram \ doc/debugging.html \ doc/gc.man \ doc/gcdescr.html \ doc/README \ doc/README.amiga \ doc/README.arm.cross \ doc/README.autoconf \ doc/README.changes \ doc/README.contributors \ doc/README.cords \ doc/README.DGUX386 \ doc/README.dj \ doc/README.environment \ doc/README.ews4800 \ doc/README.hp \ doc/README.linux \ doc/README.Mac \ doc/README.MacOSX \ doc/README.macros \ doc/README.OS2 \ doc/README.rs6000 \ doc/README.sgi \ doc/README.solaris2 \ doc/README.uts \ doc/README.win32 \ doc/README.win64 \ doc/overview.html \ doc/tree.html \ doc/leak.html \ doc/gcinterface.html \ doc/scale.html \ doc/README.darwin \ doc/simple_example.html \ doc/porting.html all: all-recursive .SUFFIXES: .SUFFIXES: .S .c .cc .lo .o .obj .s am--refresh: @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/include/include.am $(srcdir)/cord/cord.am $(srcdir)/tests/tests.am $(srcdir)/doc/doc.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ cd $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign 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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) bdw-gc.pc: $(top_builddir)/config.status $(srcdir)/bdw-gc.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ 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 cord/$(am__dirstamp): @$(mkdir_p) cord @: > cord/$(am__dirstamp) cord/$(DEPDIR)/$(am__dirstamp): @$(mkdir_p) cord/$(DEPDIR) @: > cord/$(DEPDIR)/$(am__dirstamp) cord/cordbscs.lo: cord/$(am__dirstamp) cord/$(DEPDIR)/$(am__dirstamp) cord/cordprnt.lo: cord/$(am__dirstamp) cord/$(DEPDIR)/$(am__dirstamp) cord/cordtest.lo: cord/$(am__dirstamp) cord/$(DEPDIR)/$(am__dirstamp) cord/cordxtra.lo: cord/$(am__dirstamp) cord/$(DEPDIR)/$(am__dirstamp) libcord.la: $(libcord_la_OBJECTS) $(libcord_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libcord_la_LDFLAGS) $(libcord_la_OBJECTS) $(libcord_la_LIBADD) $(LIBS) libgc.la: $(libgc_la_OBJECTS) $(libgc_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libgc_la_LDFLAGS) $(libgc_la_OBJECTS) $(libgc_la_LIBADD) $(LIBS) libgccpp.la: $(libgccpp_la_OBJECTS) $(libgccpp_la_DEPENDENCIES) $(CXXLINK) $(am_libgccpp_la_rpath) $(libgccpp_la_LDFLAGS) $(libgccpp_la_OBJECTS) $(libgccpp_la_LIBADD) $(LIBS) clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; for p in $$list; do \ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done tests/$(am__dirstamp): @$(mkdir_p) tests @: > tests/$(am__dirstamp) tests/$(DEPDIR)/$(am__dirstamp): @$(mkdir_p) tests/$(DEPDIR) @: > tests/$(DEPDIR)/$(am__dirstamp) tests/test.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) gctest$(EXEEXT): $(gctest_OBJECTS) $(gctest_DEPENDENCIES) @rm -f gctest$(EXEEXT) $(LINK) $(gctest_LDFLAGS) $(gctest_OBJECTS) $(gctest_LDADD) $(LIBS) tests/leak_test.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) leaktest$(EXEEXT): $(leaktest_OBJECTS) $(leaktest_DEPENDENCIES) @rm -f leaktest$(EXEEXT) $(LINK) $(leaktest_LDFLAGS) $(leaktest_OBJECTS) $(leaktest_LDADD) $(LIBS) tests/middle.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) middletest$(EXEEXT): $(middletest_OBJECTS) $(middletest_DEPENDENCIES) @rm -f middletest$(EXEEXT) $(LINK) $(middletest_LDFLAGS) $(middletest_OBJECTS) $(middletest_LDADD) $(LIBS) tests/test_cpp.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) test_cpp$(EXEEXT): $(test_cpp_OBJECTS) $(test_cpp_DEPENDENCIES) @rm -f test_cpp$(EXEEXT) $(CXXLINK) $(test_cpp_LDFLAGS) $(test_cpp_OBJECTS) $(test_cpp_LDADD) $(LIBS) tests/thread_leak_test.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) threadleaktest$(EXEEXT): $(threadleaktest_OBJECTS) $(threadleaktest_DEPENDENCIES) @rm -f threadleaktest$(EXEEXT) $(LINK) $(threadleaktest_LDFLAGS) $(threadleaktest_OBJECTS) $(threadleaktest_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f cord/cordbscs.$(OBJEXT) -rm -f cord/cordbscs.lo -rm -f cord/cordprnt.$(OBJEXT) -rm -f cord/cordprnt.lo -rm -f cord/cordtest.$(OBJEXT) -rm -f cord/cordtest.lo -rm -f cord/cordxtra.$(OBJEXT) -rm -f cord/cordxtra.lo -rm -f tests/leak_test.$(OBJEXT) -rm -f tests/middle.$(OBJEXT) -rm -f tests/test.$(OBJEXT) -rm -f tests/test_cpp.$(OBJEXT) -rm -f tests/thread_leak_test.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/allchblk.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alloc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atomic_ops.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/backgraph.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blacklst.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/checksums.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/darwin_stop_world.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbg_mlc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dyn_load.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/finalize.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gc_cpp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gc_dlopen.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gcj_mlc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/headers.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mallocx.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mark.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mark_rts.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/new_hblk.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/obj_map.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/os_dep.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcr_interface.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pthread_stop_world.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pthread_support.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ptr_chck.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/real_malloc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reclaim.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/specific.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stubborn.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread_local_alloc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/typd_mlc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/win32_threads.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@cord/$(DEPDIR)/cordbscs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@cord/$(DEPDIR)/cordprnt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@cord/$(DEPDIR)/cordtest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@cord/$(DEPDIR)/cordxtra.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/leak_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/middle.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test_cpp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/thread_leak_test.Po@am__quote@ .S.o: $(CCASCOMPILE) -c $< .S.obj: $(CCASCOMPILE) -c `$(CYGPATH_W) '$<'` .c.o: @am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`; \ @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$$depbase.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$$depbase.Tpo" "$$depbase.Po"; else rm -f "$$depbase.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 -o $@ $< .c.obj: @am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`; \ @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$$depbase.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$$depbase.Tpo" "$$depbase.Po"; else rm -f "$$depbase.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 -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`; \ @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$$depbase.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$$depbase.Tpo" "$$depbase.Plo"; else rm -f "$$depbase.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 $@ $< .cc.o: @am__fastdepCXX_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`; \ @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$$depbase.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$$depbase.Tpo" "$$depbase.Po"; else rm -f "$$depbase.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@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`; \ @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$$depbase.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCXX_TRUE@ then mv -f "$$depbase.Tpo" "$$depbase.Po"; else rm -f "$$depbase.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@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`; \ @am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$$depbase.Tpo" -c -o $@ $<; \ @am__fastdepCXX_TRUE@ then mv -f "$$depbase.Tpo" "$$depbase.Plo"; else rm -f "$$depbase.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 $@ $< .s.o: $(CCASCOMPILE) -c $< .s.obj: $(CCASCOMPILE) -c `$(CYGPATH_W) '$<'` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs -rm -rf cord/.libs cord/_libs distclean-libtool: -rm -f libtool uninstall-info-am: install-dist_pkgconfigDATA: $(dist_pkgconfig_DATA) @$(NORMAL_INSTALL) test -z "$(pkgconfigdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfigdir)" @list='$(dist_pkgconfig_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(dist_pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ $(dist_pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \ done uninstall-dist_pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(dist_pkgconfig_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \ done install-dist_pkgdataDATA: $(dist_pkgdata_DATA) @$(NORMAL_INSTALL) test -z "$(pkgdatadir)" || $(mkdir_p) "$(DESTDIR)$(pkgdatadir)" @list='$(dist_pkgdata_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(dist_pkgdataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgdatadir)/$$f'"; \ $(dist_pkgdataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgdatadir)/$$f"; \ done uninstall-dist_pkgdataDATA: @$(NORMAL_UNINSTALL) @list='$(dist_pkgdata_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \ rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \ done install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)" @list='$(include_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ rm -f "$(DESTDIR)$(includedir)/$$f"; \ done install-pkgincludeHEADERS: $(pkginclude_HEADERS) @$(NORMAL_INSTALL) test -z "$(pkgincludedir)" || $(mkdir_p) "$(DESTDIR)$(pkgincludedir)" @list='$(pkginclude_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \ $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \ done uninstall-pkgincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(pkginclude_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \ rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ 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) $(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 check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list='$(TESTS)'; \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *" $$tst "*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ echo "XPASS: $$tst"; \ ;; \ *) \ echo "PASS: $$tst"; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *" $$tst "*) \ xfail=`expr $$xfail + 1`; \ echo "XFAIL: $$tst"; \ ;; \ *) \ failed=`expr $$failed + 1`; \ echo "FAIL: $$tst"; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ echo "SKIP: $$tst"; \ fi; \ done; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="All $$all tests passed"; \ else \ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all tests failed"; \ else \ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ skipped="($$skip tests were not run)"; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ echo "$$dashes"; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) $(mkdir_p) $(distdir)/. $(distdir)/Mac_files $(distdir)/cord $(distdir)/doc $(distdir)/include $(distdir)/include/private $(distdir)/tests @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-recursive all-am: Makefile $(LTLIBRARIES) $(SCRIPTS) $(DATA) $(HEADERS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -rm -f cord/$(DEPDIR)/$(am__dirstamp) -rm -f cord/$(am__dirstamp) -rm -f tests/$(DEPDIR)/$(am__dirstamp) -rm -f tests/$(am__dirstamp) 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-checkPROGRAMS clean-generic clean-libLTLIBRARIES \ clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf ./$(DEPDIR) cord/$(DEPDIR) tests/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-dist_pkgconfigDATA install-dist_pkgdataDATA \ install-includeHEADERS install-pkgincludeHEADERS install-exec-am: install-libLTLIBRARIES 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 -rf ./$(DEPDIR) cord/$(DEPDIR) tests/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-dist_pkgconfigDATA uninstall-dist_pkgdataDATA \ uninstall-includeHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES uninstall-pkgincludeHEADERS uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ check-TESTS check-am clean clean-checkPROGRAMS clean-generic \ clean-libLTLIBRARIES clean-libtool clean-recursive ctags \ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \ dist-tarZ dist-zip distcheck distclean distclean-compile \ distclean-generic 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-dist_pkgconfigDATA \ install-dist_pkgdataDATA install-exec install-exec-am \ install-includeHEADERS install-info install-info-am \ install-libLTLIBRARIES install-man install-pkgincludeHEADERS \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ uninstall-dist_pkgconfigDATA uninstall-dist_pkgdataDATA \ uninstall-includeHEADERS uninstall-info-am \ uninstall-libLTLIBRARIES uninstall-pkgincludeHEADERS .s.lo: $(LTCOMPILE) $(ASM_CPP_OPTIONS) -c $< .S.lo: $(LTCOMPILE) $(ASM_CPP_OPTIONS) -c $< # # :GOTCHA: GNU make rule for making .s out of .S is flawed, # it will not remove dest if building fails .S.s: if $(CPP) $< >$@ ; then :; else rm -f $@; fi # Putting these at the top causes cord to be built first, and not find libgc.a # on HP/UX. There may be a better fix. # 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: synopsis-0.12/src/Synopsis/gc/configure.ac0000664000076400007640000004326311104702320020152 0ustar stefanstefan# Copyright (c) 1999-2001 by Red Hat, Inc. All rights reserved. # # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED # OR IMPLIED. ANY USE IS AT YOUR OWN RISK. # # Permission is hereby granted to use or copy this program # for any purpose, provided the above notices are retained on all copies. # Permission to modify the code and to distribute modified code is granted, # provided the above notices are retained, and a notice that the code was # modified is included with the above copyright notice. # # Original author: Tom Tromey # Modified by: Grzegorz Jakacki dnl Process this file with autoconf to produce configure. # Initialization # ============== AC_INIT(gc,7.0,Hans.Boehm@hp.com) ## version must conform to [0-9]+[.][0-9]+(alpha[0-9]+)? AC_CONFIG_SRCDIR(gcj_mlc.c) AC_CANONICAL_TARGET AC_PREREQ(2.53) AC_REVISION($Revision: 1.25 $) GC_SET_VERSION AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects nostdinc]) AM_MAINTAINER_MODE AC_SUBST(PACKAGE) AC_SUBST(GC_VERSION) AM_PROG_CC_C_O AC_PROG_CXX AM_PROG_AS ## FIXME: really needed? (AC_LIBTOOL already provides this) AC_CHECK_TOOL(AR, ar) AC_CHECK_TOOL(RANLIB, ranlib, :) # :) AC_PROG_INSTALL . ${srcdir}/configure.host GC_CFLAGS=${gc_cflags} AC_SUBST(GC_CFLAGS) AC_ARG_ENABLE(threads, [AC_HELP_STRING([--enable-threads=TYPE], [choose threading package])], THREADS=$enableval, [ AC_MSG_CHECKING([for thread model used by GCC]) THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` if test -z "$THREADS"; then THREADS=no fi AC_MSG_RESULT([$THREADS]) ]) AC_ARG_ENABLE(parallel-mark, [AC_HELP_STRING([--enable-parallel-mark], [parallelize marking and free list construction])], [case "$THREADS" in no | none | single) AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec]) ;; esac ] ) AC_ARG_ENABLE(cplusplus, [AC_HELP_STRING([--enable-cplusplus], [install C++ support])]) INCLUDES=-I${srcdir}/include THREADDLLIBS= need_atomic_ops_asm=false ## Libraries needed to support dynamic loading and/or threads. case "$THREADS" in no | none | single) THREADS=none ;; posix | pthreads) THREADS=posix THREADDLLIBS=-lpthread case "$host" in x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux*) AC_DEFINE(GC_LINUX_THREADS) AC_DEFINE(_REENTRANT) if test "${enable_parallel_mark}" = yes; then AC_DEFINE(PARALLEL_MARK) fi AC_DEFINE(THREAD_LOCAL_ALLOC) AC_MSG_WARN("Explict GC_INIT() calls may be required."); ;; *-*-linux*) AC_DEFINE(GC_LINUX_THREADS) AC_DEFINE(_REENTRANT) ;; *-*-aix*) AC_DEFINE(GC_AIX_THREADS) AC_DEFINE(_REENTRANT) ;; *-*-hpux11*) AC_MSG_WARN("Only HP/UX 11 POSIX threads are supported.") AC_DEFINE(GC_HPUX_THREADS) AC_DEFINE(_POSIX_C_SOURCE,199506L) if test "${enable_parallel_mark}" = yes; then AC_DEFINE(PARALLEL_MARK) fi AC_DEFINE(THREAD_LOCAL_ALLOC) AC_MSG_WARN("Explict GC_INIT() calls may be required."); THREADDLLIBS="-lpthread -lrt" # HPUX needs REENTRANT for the _r calls. AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads]) ;; *-*-hpux10*) AC_MSG_WARN("Only HP-UX 11 POSIX threads are supported.") ;; *-*-freebsd*) AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.") AC_DEFINE(GC_FREEBSD_THREADS) INCLUDES="$INCLUDES -pthread" ;; *-*-kfreebsd*-gnu) AC_DEFINE(GC_FREEBSD_THREADS) INCLUDES="$INCLUDES -pthread" THREADDLLIBS=-pthread AC_DEFINE(_REENTRANT) if test "${enable_parallel_mark}" = yes; then AC_DEFINE(PARALLEL_MARK) fi AC_DEFINE(THREAD_LOCAL_ALLOC) AC_DEFINE(USE_COMPILER_TLS) ;; *-*-gnu*) AC_DEFINE(GC_GNU_THREADS) AC_DEFINE(_REENTRANT) AC_DEFINE(THREAD_LOCAL_ALLOC) ;; *-*-netbsd*) AC_MSG_WARN("Only on NetBSD 2.0 or later.") AC_DEFINE(GC_NETBSD_THREADS) AC_DEFINE(_REENTRANT) AC_DEFINE(_PTHREADS) THREADDLLIBS="-lpthread -lrt" ;; *-*-solaris*) AC_DEFINE(GC_SOLARIS_THREADS) AC_DEFINE(THREAD_LOCAL_ALLOC) THREADDLLIBS="-lpthread -lrt" if test "$GCC" != yes; then CFLAGS="$CFLAGS -O" need_atomic_ops_asm=true fi ;; *-*-irix*) AC_DEFINE(GC_IRIX_THREADS) ;; *-*-cygwin*) AC_DEFINE(GC_WIN32_THREADS) AC_DEFINE(THREAD_LOCAL_ALLOC) win32_threads=true ;; *-*-darwin*) AC_DEFINE(GC_DARWIN_THREADS) AC_DEFINE(THREAD_LOCAL_ALLOC) AC_MSG_WARN("Explict GC_INIT() calls may be required."); if test "${enable_parallel_mark}" = yes; then AC_DEFINE(PARALLEL_MARK) fi darwin_threads=true ;; *-*-osf*) AC_DEFINE(GC_OSF1_THREADS) if test "${enable_parallel_mark}" = yes; then AC_DEFINE(PARALLEL_MARK) AC_DEFINE(THREAD_LOCAL_ALLOC) AC_MSG_WARN("Explict GC_INIT() calls may be required."); # May want to enable it in other cases, too. # Measurements havent yet been done. fi INCLUDES="$INCLUDES -pthread" THREADDLLIBS="-lpthread -lrt" ;; *) AC_MSG_ERROR("Pthreads not supported by the GC on this platform.") ;; esac ;; win32) AC_DEFINE(GC_WIN32_THREADS) dnl Wine getenv may not return NULL for missing entry AC_DEFINE(NO_GETENV) ;; dgux386) THREADS=dgux386 AC_MSG_RESULT($THREADDLLIBS) # Use pthread GCC switch THREADDLLIBS=-pthread if test "${enable_parallel_mark}" = yes; then AC_DEFINE(PARALLEL_MARK) fi AC_DEFINE(THREAD_LOCAL_ALLOC) AC_MSG_WARN("Explict GC_INIT() calls may be required."); AC_DEFINE(GC_DGUX386_THREADS) AC_DEFINE(DGUX_THREADS) # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread INCLUDES="-pthread $INCLUDES" ;; aix) THREADS=posix THREADDLLIBS=-lpthread AC_DEFINE(GC_AIX_THREADS) AC_DEFINE(_REENTRANT) ;; decosf1 | irix | mach | os2 | solaris | dce | vxworks) AC_MSG_ERROR(thread package $THREADS not yet supported) ;; *) AC_MSG_ERROR($THREADS is an unknown thread package) ;; esac AC_SUBST(THREADDLLIBS) AM_CONDITIONAL(THREADS, test x$THREADS != xnone) AM_CONDITIONAL(PTHREADS, test x$THREADS = xposix) AM_CONDITIONAL(DARWIN_THREADS, test x$darwin_threads = xtrue) AM_CONDITIONAL(WIN32_THREADS, test x$win32_threads = xtrue) case "$host" in powerpc-*-darwin*) powerpc_darwin=true ;; esac # Darwin needs a few extra special tests to deal with variation in the # system headers. case "$host" in powerpc*-*-darwin*) AC_CHECK_MEMBER(ppc_thread_state_t.r0, AC_DEFINE(HAS_PPC_THREAD_STATE_R0,1, [ppc_thread_state_t has field r0]),, [#include ]) AC_CHECK_MEMBER(ppc_thread_state_t.__r0, AC_DEFINE(HAS_PPC_THREAD_STATE___R0,1,dnl [ppc_thread_state_t has field __r0]),, [#include ]) AC_CHECK_MEMBER(ppc_thread_state64_t.r0, AC_DEFINE(HAS_PPC_THREAD_STATE64_R0,1,dnl [ppc_thread_state64_t has field r0]),, [#include ]) AC_CHECK_MEMBER(ppc_thread_state64_t.__r0, AC_DEFINE(HAS_PPC_THREAD_STATE64___R0,1,dnl [ppc_thread_state64_t has field __r0]),, [#include ]) ;; i?86*-*-darwin*) AC_CHECK_MEMBER(x86_thread_state32_t.eax, AC_DEFINE(HAS_X86_THREAD_STATE32_EAX,1,dnl [x86_thread_state32_t has field eax]),, [#include #include ]) AC_CHECK_MEMBER(x86_thread_state32_t.__eax, AC_DEFINE(HAS_X86_THREAD_STATE32___EAX,1,dnl [x86_thread_state32_t has field __eax]),, [#include #include ]) ;; x86_64-*-darwin*) AC_CHECK_MEMBER(x86_thread_state64_t.rax, AC_DEFINE(HAS_X86_THREAD_STATE64_RAX,1,dnl [x86_thread_state64_t has field rax]),, [#include #include ]) AC_CHECK_MEMBER(x86_thread_state64_t.__rax, AC_DEFINE(HAS_X86_THREAD_STATE64___RAX,1,dnl [x86_thread_state64_t has field __rax]),, [#include #include ]) ;; *) ;; esac AC_MSG_CHECKING(for xlc) AC_TRY_COMPILE([],[ #ifndef __xlC__ # error #endif ], [compiler_xlc=yes], [compiler_xlc=no]) AC_MSG_RESULT($compiler_xlc) AM_CONDITIONAL(COMPILER_XLC,test $compiler_xlc = yes) if test $compiler_xlc = yes -a "$powerpc_darwin" = true; then # the darwin stack-frame-walking code is completely broken on xlc AC_DEFINE(DARWIN_DONT_PARSE_STACK) fi # We never want libdl on darwin. It is a fake libdl that just ends up making # dyld calls anyway case "$host" in *-*-darwin*) ;; *) AC_CHECK_LIB(dl, dlopen, THREADDLLIBS="$THREADDLLIBS -ldl") ;; esac # extra LD Flags which are required for targets case "${host}" in *-*-darwin*) extra_ldflags_libgc=-Wl,-single_module ;; esac AC_SUBST(extra_ldflags_libgc) AC_SUBST(EXTRA_TEST_LIBS) target_all=libgc.la AC_SUBST(target_all) dnl If the target is an eCos system, use the appropriate eCos dnl I/O routines. dnl FIXME: this should not be a local option but a global target dnl system; at present there is no eCos target. TARGET_ECOS="no" AC_ARG_WITH(ecos, [ --with-ecos enable runtime eCos target support], TARGET_ECOS="$with_ecos" ) addobjs= addlibs= CXXINCLUDES= case "$TARGET_ECOS" in no) ;; *) AC_DEFINE(ECOS) CXXINCLUDES="-I${TARGET_ECOS}/include" addobjs="$addobjs ecos.lo" ;; esac AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes) AC_SUBST(CXX) AC_SUBST(INCLUDES) AC_SUBST(CXXINCLUDES) # Configuration of shared libraries # AC_MSG_CHECKING(whether to build shared libraries) AC_ENABLE_SHARED case "$host" in alpha-*-openbsd*) enable_shared=no AC_MSG_RESULT(no) ;; *) AC_MSG_RESULT(yes) ;; esac # Configuration of machine-dependent code # AC_MSG_CHECKING(which machine-dependent code should be used) machdep= case "$host" in alpha-*-openbsd*) machdep="mach_dep.lo" if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled) fi ;; alpha*-*-linux*) machdep="mach_dep.lo" ;; i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?) AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED) ;; mipstx39-*-elf*) machdep="mach_dep.lo" AC_DEFINE(STACKBASE, __stackbase) AC_DEFINE(DATASTART_IS_ETEXT) ;; mips-dec-ultrix*) machdep="mach-dep.lo" ;; mips-nec-sysv*|mips-unknown-sysv*) ;; mips*-*-linux*) ;; mips-*-*) machdep="mach_dep.lo" dnl AC_DEFINE(NO_EXECUTE_PERMISSION) dnl This is now redundant, but it is also important for incremental GC dnl performance under Irix. ;; sparc-*-netbsd*) machdep="mach_dep.lo sparc_netbsd_mach_dep.lo" ;; sparc-sun-solaris2.3) machdep="mach_dep.lo sparc_mach_dep.lo" AC_DEFINE(SUNOS53_SHARED_LIB) ;; sparc*-sun-solaris2.*) machdep="mach_dep.lo sparc_mach_dep.lo" ;; ia64-*-*) machdep="mach_dep.lo ia64_save_regs_in_stack.lo" ;; esac if test x"$machdep" = x; then AC_MSG_RESULT($machdep) machdep="mach_dep.lo" fi addobjs="$addobjs $machdep" AC_SUBST(addobjs) AC_SUBST(addlibs) AC_PROG_LIBTOOL # # Check for AViiON Machines running DGUX # ac_is_dgux=no AC_CHECK_HEADER(sys/dg_sys_info.h, [ac_is_dgux=yes;]) ## :GOTCHA: we do not check anything but sys/dg_sys_info.h if test $ac_is_dgux = yes; then if test "$enable_full_debug" = "yes"; then CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2" CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2" else CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2" CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2" fi AC_SUBST(CFLAGS) AC_SUBST(CXXFLAGS) fi dnl We use these options to decide which functions to include. AC_ARG_WITH(target-subdir, [ --with-target-subdir=SUBDIR configuring with a cross compiler]) AC_ARG_WITH(cross-host, [ --with-cross-host=HOST configuring with a cross compiler]) # automake wants to see AC_EXEEXT. But we don't need it. And having # it is actually a problem, because the compiler we're passed can't # necessarily do a full link. So we fool automake here. if false; then # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands # to nothing, so nothing would remain between `then' and `fi' if it # were not for the `:' below. : AC_EXEEXT fi dnl As of 4.13a2, the collector will not properly work on Solaris when dnl built with gcc and -O. So we remove -O in the appropriate case. dnl Not needed anymore on Solaris. AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary) case "$host" in *aix*) if test "$GCC" = yes; then AC_MSG_RESULT(yes) new_CFLAGS= for i in $CFLAGS; do case "$i" in -O*) ;; *) new_CFLAGS="$new_CFLAGS $i" ;; esac done CFLAGS="$new_CFLAGS" else AC_MSG_RESULT(no) fi ;; *) AC_MSG_RESULT(no) ;; esac dnl Include defines that have become de facto standard. dnl ALL_INTERIOR_POINTERS can be overridden in startup code. AC_DEFINE(NO_EXECUTE_PERMISSION) AC_DEFINE(ALL_INTERIOR_POINTERS) dnl Interface Selection dnl ------------------- dnl dnl By default, make the library as general as possible. dnl enable_gcj_support=no AC_ARG_ENABLE(gcj-support, [AC_HELP_STRING([--disable-gcj-support], [Disable support for gcj.])]) AM_CONDITIONAL(ENABLE_GCJ_SUPPORT, [test x"$enable_gcj_support" != xno]) if test x"$enable_gcj_support" != xno; then AC_DEFINE(GC_GCJ_SUPPORT, 1, [Define to include support for gcj]) fi AC_ARG_ENABLE(java-finalization, [AC_HELP_STRING([--disable-java-finalization], [Disable support for java finalization.])]) if test x"$enable_java_finalization" != xno; then AC_DEFINE(JAVA_FINALIZATION) fi AC_ARG_ENABLE(atomic-uncollectable, [AC_HELP_STRING([--disable-atomic-uncollectible], [Disable support for atomic uncollectible allocation.])]) if test x"$enable_atomic_uncollectible" != x"no"; then AC_DEFINE(ATOMIC_UNCOLLECTABLE, 1, [Define to enable atomic uncollectible allocation.]) fi AC_ARG_ENABLE(redirect-malloc, [AC_HELP_STRING([--enable-redirect-malloc], [Redirect malloc and friends to GC routines])]) if test "${enable_redirect_malloc}" = yes; then if test "${enable_full_debug}" = yes; then AC_DEFINE(REDIRECT_MALLOC, GC_debug_malloc_replacement) AC_DEFINE(REDIRECT_REALLOC, GC_debug_realloc_replacement) AC_DEFINE(REDIRECT_FREE, GC_debug_free) else AC_DEFINE(REDIRECT_MALLOC, GC_malloc) fi fi AC_ARG_ENABLE(large-config, [AC_HELP_STRING([--enable-large-config], [Optimize for large (> 100 MB) heap or root set])]) if test "${enable_large_config}" = yes; then AC_DEFINE(LARGE_CONFIG, 1, [Define to optimize for large heaps or root sets]) fi dnl This is something of a hack. When cross-compiling we turn off dnl some functionality. We also enable the "small" configuration. dnl These is only correct when targetting an embedded system. FIXME. if test -n "${with_cross_host}"; then AC_DEFINE(NO_CLOCK) AC_DEFINE(SMALL_CONFIG) AC_DEFINE(NO_DEBUGGING) fi dnl Debugging dnl --------- UNWINDLIBS= AC_ARG_ENABLE(gc-debug, [AC_HELP_STRING([--enable-gc-debug], [include full support for pointer backtracing etc.])], [ if test "$enable_gc_debug" = "yes"; then AC_MSG_WARN("Should define GC_DEBUG and use debug alloc. in clients.") AC_DEFINE(KEEP_BACK_PTRS) AC_DEFINE(DBG_HDRS_ALL) case $host in ia64-*-linux* ) AC_DEFINE(MAKE_BACK_GRAPH) AC_DEFINE(SAVE_CALL_COUNT, 8) AC_CHECK_LIB(unwind, backtrace, [ AC_DEFINE(GC_HAVE_BUILTIN_BACKTRACE) UNWINDLIBS=-lunwind AC_MSG_WARN("Client code may need to link against libunwind.") ]) ;; x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* ) AC_DEFINE(MAKE_BACK_GRAPH) AC_MSG_WARN("Client must not use -fomit-frame-pointer.") AC_DEFINE(SAVE_CALL_COUNT, 8) ;; i[3456]86-*-dgux*) AC_DEFINE(MAKE_BACK_GRAPH) ;; esac ] fi) AC_SUBST(UNWINDLIBS) AC_ARG_ENABLE(gc-assertions, [AC_HELP_STRING([--enable-gc-assertions], [collector-internal assertion checking])]) if test "${enable_gc_assertions}" = yes; then AC_DEFINE(GC_ASSERTIONS) fi AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host") dnl Atomic Ops dnl ---------- atomic_ops_libs=-latomic_ops AC_CHECK_HEADER(atomic_ops.h, [ AC_MSG_NOTICE([Using pre-installed libatomic_ops]) ], [ ao_dir= for candidate in ${srcdir}/libatomic_ops*; do case $candidate in *.tar.gz) ;; *install) dnl generated by alternate Makefile. ;; *) if test -e "$candidate"; then ao_dir="$candidate" fi ;; esac done if test -z "$ao_dir"; then AC_MSG_ERROR([Missig libatomic_ops.]) fi ao_version="${ao_dir#*libatomic_ops-}" AC_MSG_NOTICE([Using internal version of libatomic_ops]) dnl Automake does not accept shell variables in AC_CONFIG_SUBDIRS test -e ${srcdir}/libatomic_ops \ || ln -s ${ao_dir} ${srcdir}/libatomic_ops AC_CONFIG_SUBDIRS(libatomic_ops) dnl Also copy the source files to be linked in. test -e ${srcdir}/atomic_ops.c \ || ln -s ${srcdir}/libatomic_ops/src/atomic_ops.c \ ${srcdir}/atomic_ops.c test -e ${srcdir}/atomic_ops_sysdeps.S \ || ln -s ${srcdir}/libatomic_ops/src/atomic_ops_sysdeps.S \ ${srcdir}/atomic_ops_sysdeps.S dnl This gets the source include files, which is often close enough. dnl It also makes atomic_ops_sysdeps.S assemble. GC_CFLAGS="${GC_CFLAGS} -I \$(top_srcdir)/libatomic_ops/src" maybe_libatomic_ops="libatomic_ops" ]) AM_CONDITIONAL(USE_INTERNAL_LIBATOMIC_OPS, test -n "$maybe_libatomic_ops" -a "$THREADS" != "none") AM_CONDITIONAL(NEED_ATOMIC_OPS_ASM, test -n "$maybe_libatomic_ops" -a x$need_atomic_ops_asm = xtrue) AC_SUBST(atomic_ops_libs) dnl Produce the Files dnl ----------------- AC_CONFIG_FILES([Makefile bdw-gc.pc]) AC_CONFIG_COMMANDS([default],, [ srcdir=${srcdir} host=${host} CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} CC="${CC}" DEFS="$DEFS" ]) AC_OUTPUT synopsis-0.12/src/Synopsis/gc/rs6000_mach_dep.s0000664000076400007640000000466611104702316020633 0ustar stefanstefan .set r0,0 .set r1,1 .set r2,2 .set r3,3 .set r4,4 .set r5,5 .set r6,6 .set r7,7 .set r8,8 .set r9,9 .set r10,10 .set r11,11 .set r12,12 .set r13,13 .set r14,14 .set r15,15 .set r16,16 .set r17,17 .set r18,18 .set r19,19 .set r20,20 .set r21,21 .set r22,22 .set r23,23 .set r24,24 .set r25,25 .set r26,26 .set r27,27 .set r28,28 .set r29,29 .set r30,30 .set r31,31 .extern .GC_push_one # Mark from machine registers that are saved by C compiler .globl .GC_push_regs .csect .text[PR] .align 2 .globl GC_push_regs .globl .GC_push_regs .csect GC_push_regs[DS] GC_push_regs: .long .GC_push_regs, TOC[tc0], 0 .csect .text[PR] .GC_push_regs: stu r1,-64(r1) # reserve stack frame mflr r0 # save link register st r0,0x48(r1) oril r3,r2,0x0 # mark from r2 bl .GC_push_one cror 15,15,15 oril r3,r13,0x0 # mark from r13-r31 bl .GC_push_one cror 15,15,15 oril r3,r14,0x0 bl .GC_push_one cror 15,15,15 oril r3,r15,0x0 bl .GC_push_one cror 15,15,15 oril r3,r16,0x0 bl .GC_push_one cror 15,15,15 oril r3,r17,0x0 bl .GC_push_one cror 15,15,15 oril r3,r18,0x0 bl .GC_push_one cror 15,15,15 oril r3,r19,0x0 bl .GC_push_one cror 15,15,15 oril r3,r20,0x0 bl .GC_push_one cror 15,15,15 oril r3,r21,0x0 bl .GC_push_one cror 15,15,15 oril r3,r22,0x0 bl .GC_push_one cror 15,15,15 oril r3,r23,0x0 bl .GC_push_one cror 15,15,15 oril r3,r24,0x0 bl .GC_push_one cror 15,15,15 oril r3,r25,0x0 bl .GC_push_one cror 15,15,15 oril r3,r26,0x0 bl .GC_push_one cror 15,15,15 oril r3,r27,0x0 bl .GC_push_one cror 15,15,15 oril r3,r28,0x0 bl .GC_push_one cror 15,15,15 oril r3,r29,0x0 bl .GC_push_one cror 15,15,15 oril r3,r30,0x0 bl .GC_push_one cror 15,15,15 oril r3,r31,0x0 bl .GC_push_one cror 15,15,15 l r0,0x48(r1) mtlr r0 ai r1,r1,64 br .long 0 .byte 0,0,0,0,0,0,0,0 synopsis-0.12/src/Synopsis/gc/ia64_save_regs_in_stack.s0000664000076400007640000000040011104702315022512 0ustar stefanstefan .text .align 16 .global GC_save_regs_in_stack .proc GC_save_regs_in_stack GC_save_regs_in_stack: .body flushrs ;; mov r8=ar.bsp br.ret.sptk.few rp .endp GC_save_regs_in_stack synopsis-0.12/src/Synopsis/gc/alpha_mach_dep.S0000664000076400007640000000404111104702320020704 0ustar stefanstefan .arch ev6 .text .align 4 .globl GC_push_regs .ent GC_push_regs 2 GC_push_regs: ldgp $gp, 0($27) lda $sp, -16($sp) stq $26, 0($sp) .mask 0x04000000, 0 .frame $sp, 16, $26, 0 /* $0 integer result */ /* $1-$8 temp regs - not preserved cross calls */ /* $9-$15 call saved regs */ /* $16-$21 argument regs - not preserved cross calls */ /* $22-$28 temp regs - not preserved cross calls */ /* $29 global pointer - not preserved cross calls */ /* $30 stack pointer */ # define call_push(x) \ mov x, $16; \ jsr $26, GC_push_one; \ ldgp $gp, 0($26) call_push($9) call_push($10) call_push($11) call_push($12) call_push($13) call_push($14) call_push($15) /* $f0-$f1 floating point results */ /* $f2-$f9 call saved regs */ /* $f10-$f30 temp regs - not preserved cross calls */ /* Use the most efficient transfer method for this hardware. */ /* Bit 1 detects the FIX extension, which includes ftoit. */ amask 2, $0 bne $0, $use_stack #undef call_push #define call_push(x) \ ftoit x, $16; \ jsr $26, GC_push_one; \ ldgp $gp, 0($26) call_push($f2) call_push($f3) call_push($f4) call_push($f5) call_push($f6) call_push($f7) call_push($f8) call_push($f9) ldq $26, 0($sp) lda $sp, 16($sp) ret $31, ($26), 1 .align 4 $use_stack: #undef call_push #define call_push(x) \ stt x, 8($sp); \ ldq $16, 8($sp); \ jsr $26, GC_push_one; \ ldgp $gp, 0($26) call_push($f2) call_push($f3) call_push($f4) call_push($f5) call_push($f6) call_push($f7) call_push($f8) call_push($f9) ldq $26, 0($sp) lda $sp, 16($sp) ret $31, ($26), 1 .end GC_push_regs synopsis-0.12/src/Synopsis/gc/if_not_there.c0000664000076400007640000000153011104702320020464 0ustar stefanstefan/* Conditionally execute a command based if the file argv[1] doesn't exist */ /* Except for execvp, we stick to ANSI C. */ # include "private/gcconfig.h" # include # include # include #ifdef __DJGPP__ #include #endif /* __DJGPP__ */ int main(int argc, char **argv, char **envp) { FILE * f; #ifdef __DJGPP__ DIR * d; #endif /* __DJGPP__ */ if (argc < 3) goto Usage; if ((f = fopen(argv[1], "rb")) != 0 || (f = fopen(argv[1], "r")) != 0) { fclose(f); return(0); } #ifdef __DJGPP__ if ((d = opendir(argv[1])) != 0) { closedir(d); return(0); } #endif printf("^^^^Starting command^^^^\n"); fflush(stdout); execvp(argv[2], argv+2); exit(1); Usage: fprintf(stderr, "Usage: %s file_name command\n", argv[0]); return(1); } synopsis-0.12/src/Synopsis/gc/gc.mak0000664000076400007640000015255311104702316016757 0ustar stefanstefan# Microsoft Developer Studio Generated NMAKE File, Format Version 4.10 # This has been hand-edited way too many times. # A clean, manually generated makefile would be an improvement. # TARGTYPE "Win32 (x86) Application" 0x0101 # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 AO_VERSION=1.2 !IF "$(CFG)" == "" CFG=gctest - Win32 Release !MESSAGE No configuration specified. Defaulting to cord - Win32 Debug. !ENDIF !IF "$(CFG)" != "gc - Win32 Release" && "$(CFG)" != "gc - Win32 Debug" &&\ "$(CFG)" != "gctest - Win32 Release" && "$(CFG)" != "gctest - Win32 Debug" &&\ "$(CFG)" != "cord - Win32 Release" && "$(CFG)" != "cord - Win32 Debug" !MESSAGE Invalid configuration "$(CFG)" specified. !MESSAGE You can specify a configuration when running NMAKE on this makefile !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "gc.mak" CFG="cord - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "gc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "gc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "gctest - Win32 Release" (based on "Win32 (x86) Application") !MESSAGE "gctest - Win32 Debug" (based on "Win32 (x86) Application") !MESSAGE "cord - Win32 Release" (based on "Win32 (x86) Application") !MESSAGE "cord - Win32 Debug" (based on "Win32 (x86) Application") !MESSAGE !ERROR An invalid configuration is specified. !ENDIF !IF "$(OS)" == "Windows_NT" NULL= !ELSE NULL=nul !ENDIF ################################################################################ # Begin Project # PROP Target_Last_Scanned "gctest - Win32 Debug" !IF "$(CFG)" == "gc - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Target_Dir "" OUTDIR=.\Release INTDIR=.\Release ALL : ".\Release\gc.dll" ".\Release\gc.bsc" CLEAN : -@erase ".\Release\allchblk.obj" -@erase ".\Release\allchblk.sbr" -@erase ".\Release\alloc.obj" -@erase ".\Release\alloc.sbr" -@erase ".\Release\blacklst.obj" -@erase ".\Release\blacklst.sbr" -@erase ".\Release\checksums.obj" -@erase ".\Release\checksums.sbr" -@erase ".\Release\dbg_mlc.obj" -@erase ".\Release\dbg_mlc.sbr" -@erase ".\Release\dyn_load.obj" -@erase ".\Release\dyn_load.sbr" -@erase ".\Release\finalize.obj" -@erase ".\Release\finalize.sbr" -@erase ".\Release\gc.bsc" -@erase ".\Release\gc_cpp.obj" -@erase ".\Release\gc_cpp.sbr" -@erase ".\Release\gc.dll" -@erase ".\Release\gc.exp" -@erase ".\Release\gc.lib" -@erase ".\Release\headers.obj" -@erase ".\Release\headers.sbr" -@erase ".\Release\mach_dep.obj" -@erase ".\Release\mach_dep.sbr" -@erase ".\Release\malloc.obj" -@erase ".\Release\malloc.sbr" -@erase ".\Release\mallocx.obj" -@erase ".\Release\mallocx.sbr" -@erase ".\Release\mark.obj" -@erase ".\Release\mark.sbr" -@erase ".\Release\mark_rts.obj" -@erase ".\Release\mark_rts.sbr" -@erase ".\Release\misc.obj" -@erase ".\Release\misc.sbr" -@erase ".\Release\new_hblk.obj" -@erase ".\Release\new_hblk.sbr" -@erase ".\Release\obj_map.obj" -@erase ".\Release\obj_map.sbr" -@erase ".\Release\os_dep.obj" -@erase ".\Release\os_dep.sbr" -@erase ".\Release\ptr_chck.obj" -@erase ".\Release\ptr_chck.sbr" -@erase ".\Release\reclaim.obj" -@erase ".\Release\reclaim.sbr" -@erase ".\Release\stubborn.obj" -@erase ".\Release\stubborn.sbr" -@erase ".\Release\typd_mlc.obj" -@erase ".\Release\typd_mlc.sbr" -@erase ".\Release\win32_threads.obj" -@erase ".\Release\win32_threads.sbr" -@erase ".\Release\msvc_dbg.obj" -@erase ".\Release\msvc_dbg.sbr" "$(OUTDIR)" : if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" CPP=cl.exe # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c # ADD CPP /nologo /MD /W3 /GX /O2 /I include /D "NDEBUG" /D "GC_BUILD" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "GC_WIN32_THREADS" /FR /YX /c CPP_PROJ=/nologo /MD /W3 /GX /O2 /I include /D "NDEBUG" /D "GC_BUILD" /D\ "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D\ "GC_WIN32_THREADS" /FR"$(INTDIR)/" /Fp"$(INTDIR)/gc.pch" \ /Ilibatomic_ops-$(AO_VERSION)/src /YX /Fo"$(INTDIR)/" /c CPP_OBJS=.\Release/ CPP_SBRS=.\Release/ .c{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .c{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< MTL=mktyplib.exe # ADD BASE MTL /nologo /D "NDEBUG" /win32 # ADD MTL /nologo /D "NDEBUG" /win32 MTL_PROJ=/nologo /D "NDEBUG" /win32 RSC=rc.exe # ADD BASE RSC /l 0x809 /d "NDEBUG" # ADD RSC /l 0x809 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo BSC32_FLAGS=/nologo /o"$(OUTDIR)/gc.bsc" BSC32_SBRS= \ ".\Release\allchblk.sbr" \ ".\Release\alloc.sbr" \ ".\Release\blacklst.sbr" \ ".\Release\checksums.sbr" \ ".\Release\dbg_mlc.sbr" \ ".\Release\dyn_load.sbr" \ ".\Release\finalize.sbr" \ ".\Release\gc_cpp.sbr" \ ".\Release\headers.sbr" \ ".\Release\mach_dep.sbr" \ ".\Release\malloc.sbr" \ ".\Release\mallocx.sbr" \ ".\Release\mark.sbr" \ ".\Release\mark_rts.sbr" \ ".\Release\misc.sbr" \ ".\Release\new_hblk.sbr" \ ".\Release\obj_map.sbr" \ ".\Release\os_dep.sbr" \ ".\Release\ptr_chck.sbr" \ ".\Release\reclaim.sbr" \ ".\Release\stubborn.sbr" \ ".\Release\typd_mlc.sbr" \ ".\Release\msvc_dbg.sbr" \ ".\Release\win32_threads.sbr" ".\Release\gc.bsc" : "$(OUTDIR)" $(BSC32_SBRS) $(BSC32) @<< $(BSC32_FLAGS) $(BSC32_SBRS) << LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ odbccp32.lib /nologo /subsystem:windows /dll /incremental:no\ /pdb:"$(OUTDIR)/gc.pdb" /machine:I386 /out:"$(OUTDIR)/gc.dll"\ /implib:"$(OUTDIR)/gc.lib" LINK32_OBJS= \ ".\Release\allchblk.obj" \ ".\Release\alloc.obj" \ ".\Release\blacklst.obj" \ ".\Release\checksums.obj" \ ".\Release\dbg_mlc.obj" \ ".\Release\dyn_load.obj" \ ".\Release\finalize.obj" \ ".\Release\gc_cpp.obj" \ ".\Release\headers.obj" \ ".\Release\mach_dep.obj" \ ".\Release\malloc.obj" \ ".\Release\mallocx.obj" \ ".\Release\mark.obj" \ ".\Release\mark_rts.obj" \ ".\Release\misc.obj" \ ".\Release\new_hblk.obj" \ ".\Release\obj_map.obj" \ ".\Release\os_dep.obj" \ ".\Release\ptr_chck.obj" \ ".\Release\reclaim.obj" \ ".\Release\stubborn.obj" \ ".\Release\typd_mlc.obj" \ ".\Release\msvc_dbg.obj" \ ".\Release\win32_threads.obj" ".\Release\gc.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) $(LINK32) @<< $(LINK32_FLAGS) $(LINK32_OBJS) << !ELSEIF "$(CFG)" == "gc - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" OUTDIR=.\Debug INTDIR=.\Debug ALL : ".\Debug\gc.dll" ".\Debug\gc.bsc" CLEAN : -@erase ".\Debug\allchblk.obj" -@erase ".\Debug\allchblk.sbr" -@erase ".\Debug\alloc.obj" -@erase ".\Debug\alloc.sbr" -@erase ".\Debug\blacklst.obj" -@erase ".\Debug\blacklst.sbr" -@erase ".\Debug\checksums.obj" -@erase ".\Debug\checksums.sbr" -@erase ".\Debug\dbg_mlc.obj" -@erase ".\Debug\dbg_mlc.sbr" -@erase ".\Debug\dyn_load.obj" -@erase ".\Debug\dyn_load.sbr" -@erase ".\Debug\finalize.obj" -@erase ".\Debug\finalize.sbr" -@erase ".\Debug\gc_cpp.obj" -@erase ".\Debug\gc_cpp.sbr" -@erase ".\Debug\gc.bsc" -@erase ".\Debug\gc.dll" -@erase ".\Debug\gc.exp" -@erase ".\Debug\gc.lib" -@erase ".\Debug\gc.map" -@erase ".\Debug\gc.pdb" -@erase ".\Debug\headers.obj" -@erase ".\Debug\headers.sbr" -@erase ".\Debug\mach_dep.obj" -@erase ".\Debug\mach_dep.sbr" -@erase ".\Debug\malloc.obj" -@erase ".\Debug\malloc.sbr" -@erase ".\Debug\mallocx.obj" -@erase ".\Debug\mallocx.sbr" -@erase ".\Debug\mark.obj" -@erase ".\Debug\mark.sbr" -@erase ".\Debug\mark_rts.obj" -@erase ".\Debug\mark_rts.sbr" -@erase ".\Debug\misc.obj" -@erase ".\Debug\misc.sbr" -@erase ".\Debug\new_hblk.obj" -@erase ".\Debug\new_hblk.sbr" -@erase ".\Debug\obj_map.obj" -@erase ".\Debug\obj_map.sbr" -@erase ".\Debug\os_dep.obj" -@erase ".\Debug\os_dep.sbr" -@erase ".\Debug\ptr_chck.obj" -@erase ".\Debug\ptr_chck.sbr" -@erase ".\Debug\reclaim.obj" -@erase ".\Debug\reclaim.sbr" -@erase ".\Debug\stubborn.obj" -@erase ".\Debug\stubborn.sbr" -@erase ".\Debug\typd_mlc.obj" -@erase ".\Debug\typd_mlc.sbr" -@erase ".\Debug\vc40.idb" -@erase ".\Debug\vc40.pdb" -@erase ".\Debug\win32_threads.obj" -@erase ".\Debug\win32_threads.sbr" -@erase ".\Debug\msvc_dbg.obj" -@erase ".\Debug\msvc_dbg.sbr" "$(OUTDIR)" : if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" CPP=cl.exe # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c # ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I include /D "_DEBUG" /D "GC_BUILD" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "GC_WIN32_THREADS" /FR /YX /c CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I include /D "_DEBUG" /D "GC_BUILD"\ /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" \ /D "GC_ASSERTIONS" /D "__STDC__" /D\ "GC_WIN32_THREADS" /FR"$(INTDIR)/" /Fp"$(INTDIR)/gc.pch" /YX /Fo"$(INTDIR)/"\ /Ilibatomic_ops-$(AO_VERSION)/src /Fd"$(INTDIR)/" /c CPP_OBJS=.\Debug/ CPP_SBRS=.\Debug/ .c{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .c{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< MTL=mktyplib.exe # ADD BASE MTL /nologo /D "_DEBUG" /win32 # ADD MTL /nologo /D "_DEBUG" /win32 MTL_PROJ=/nologo /D "_DEBUG" /win32 RSC=rc.exe # ADD BASE RSC /l 0x809 /d "_DEBUG" # ADD RSC /l 0x809 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo BSC32_FLAGS=/nologo /o"$(OUTDIR)/gc.bsc" BSC32_SBRS= \ ".\Debug\allchblk.sbr" \ ".\Debug\alloc.sbr" \ ".\Debug\blacklst.sbr" \ ".\Debug\checksums.sbr" \ ".\Debug\dbg_mlc.sbr" \ ".\Debug\dyn_load.sbr" \ ".\Debug\finalize.sbr" \ ".\Debug\gc_cpp.sbr" \ ".\Debug\headers.sbr" \ ".\Debug\mach_dep.sbr" \ ".\Debug\malloc.sbr" \ ".\Debug\mallocx.sbr" \ ".\Debug\mark.sbr" \ ".\Debug\mark_rts.sbr" \ ".\Debug\misc.sbr" \ ".\Debug\new_hblk.sbr" \ ".\Debug\obj_map.sbr" \ ".\Debug\os_dep.sbr" \ ".\Debug\ptr_chck.sbr" \ ".\Debug\reclaim.sbr" \ ".\Debug\stubborn.sbr" \ ".\Debug\typd_mlc.sbr" \ ".\Debug\msvc_dbg.sbr" \ ".\Debug\win32_threads.sbr" ".\Debug\gc.bsc" : "$(OUTDIR)" $(BSC32_SBRS) $(BSC32) @<< $(BSC32_FLAGS) $(BSC32_SBRS) << LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:no /map /debug /machine:I386 LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ odbccp32.lib /nologo /subsystem:windows /dll /incremental:no\ /pdb:"$(OUTDIR)/gc.pdb" /map:"$(INTDIR)/gc.map" /debug /machine:I386\ /out:"$(OUTDIR)/gc.dll" /implib:"$(OUTDIR)/gc.lib" LINK32_OBJS= \ ".\Debug\allchblk.obj" \ ".\Debug\alloc.obj" \ ".\Debug\blacklst.obj" \ ".\Debug\checksums.obj" \ ".\Debug\dbg_mlc.obj" \ ".\Debug\dyn_load.obj" \ ".\Debug\finalize.obj" \ ".\Debug\gc_cpp.obj" \ ".\Debug\headers.obj" \ ".\Debug\mach_dep.obj" \ ".\Debug\malloc.obj" \ ".\Debug\mallocx.obj" \ ".\Debug\mark.obj" \ ".\Debug\mark_rts.obj" \ ".\Debug\misc.obj" \ ".\Debug\new_hblk.obj" \ ".\Debug\obj_map.obj" \ ".\Debug\os_dep.obj" \ ".\Debug\ptr_chck.obj" \ ".\Debug\reclaim.obj" \ ".\Debug\stubborn.obj" \ ".\Debug\typd_mlc.obj" \ ".\Debug\msvc_dbg.obj" \ ".\Debug\win32_threads.obj" ".\Debug\gc.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) $(LINK32) @<< $(LINK32_FLAGS) $(LINK32_OBJS) << !ELSEIF "$(CFG)" == "gctest - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "gctest\Release" # PROP BASE Intermediate_Dir "gctest\Release" # PROP BASE Target_Dir "gctest" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "gctest\Release" # PROP Intermediate_Dir "gctest\Release" # PROP Target_Dir "gctest" OUTDIR=.\gctest\Release INTDIR=.\gctest\Release ALL : "gc - Win32 Release" ".\Release\gctest.exe" CLEAN : -@erase ".\gctest\Release\test.obj" -@erase ".\Release\gctest.exe" "$(OUTDIR)" : if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" test.c : tests\test.c copy tests\test.c test.c CPP=cl.exe # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c # ADD CPP /nologo /MD /W3 /GX /O2 /I include /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "GC_WIN32_THREADS" /YX /c CPP_PROJ=/nologo /MD /W3 /GX /O2 /I include /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D\ "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "GC_WIN32_THREADS"\ /Ilibatomic_ops-$(AO_VERSION)/src /Fp"$(INTDIR)/gctest.pch" \ /YX /Fo"$(INTDIR)/" /c CPP_OBJS=.\gctest\Release/ CPP_SBRS=.\. .c{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .c{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< MTL=mktyplib.exe # ADD BASE MTL /nologo /D "NDEBUG" /win32 # ADD MTL /nologo /D "NDEBUG" /win32 MTL_PROJ=/nologo /D "NDEBUG" /win32 RSC=rc.exe # ADD BASE RSC /l 0x809 /d "NDEBUG" # ADD RSC /l 0x809 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo BSC32_FLAGS=/nologo /o"$(OUTDIR)/gctest.bsc" BSC32_SBRS= \ LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"Release/gctest.exe" LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ odbccp32.lib /nologo /subsystem:windows /incremental:no\ /pdb:"$(OUTDIR)/gctest.pdb" /machine:I386 /out:"Release/gctest.exe" LINK32_OBJS= \ ".\gctest\Release\test.obj" \ ".\Release\gc.lib" ".\Release\gctest.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) $(LINK32) @<< $(LINK32_FLAGS) $(LINK32_OBJS) << !ELSEIF "$(CFG)" == "gctest - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "gctest\Debug" # PROP BASE Intermediate_Dir "gctest\Debug" # PROP BASE Target_Dir "gctest" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "gctest\Debug" # PROP Intermediate_Dir "gctest\Debug" # PROP Target_Dir "gctest" OUTDIR=.\gctest\Debug INTDIR=.\gctest\Debug ALL : "gc - Win32 Debug" ".\Debug\gctest.exe" ".\gctest\Debug\gctest.bsc" CLEAN : -@erase ".\Debug\gctest.exe" -@erase ".\gctest\Debug\gctest.bsc" -@erase ".\gctest\Debug\gctest.map" -@erase ".\gctest\Debug\gctest.pdb" -@erase ".\gctest\Debug\test.obj" -@erase ".\gctest\Debug\test.sbr" -@erase ".\gctest\Debug\vc40.idb" -@erase ".\gctest\Debug\vc40.pdb" "$(OUTDIR)" : if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" CPP=cl.exe # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c # ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "GC_WIN32_THREADS" /FR /YX /c CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I include /D "_DEBUG" /D "WIN32" /D "_WINDOWS"\ /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "GC_WIN32_THREADS" /FR"$(INTDIR)/"\ /Ilibatomic_ops-$(AO_VERSION)/src /Fp"$(INTDIR)/gctest.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c CPP_OBJS=.\gctest\Debug/ CPP_SBRS=.\gctest\Debug/ .c{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .c{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< MTL=mktyplib.exe # ADD BASE MTL /nologo /D "_DEBUG" /win32 # ADD MTL /nologo /D "_DEBUG" /win32 MTL_PROJ=/nologo /D "_DEBUG" /win32 RSC=rc.exe # ADD BASE RSC /l 0x809 /d "_DEBUG" # ADD RSC /l 0x809 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo BSC32_FLAGS=/nologo /o"$(OUTDIR)/gctest.bsc" BSC32_SBRS= \ ".\gctest\Debug\test.sbr" ".\gctest\Debug\gctest.bsc" : "$(OUTDIR)" $(BSC32_SBRS) $(BSC32) @<< $(BSC32_FLAGS) $(BSC32_SBRS) << LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:no /map /debug /machine:I386 /out:"Debug/gctest.exe" LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ odbccp32.lib /nologo /subsystem:windows /incremental:no\ /pdb:"$(OUTDIR)/gctest.pdb" /map:"$(INTDIR)/gctest.map" /debug /machine:I386\ /out:"Debug/gctest.exe" LINK32_OBJS= \ ".\Debug\gc.lib" \ ".\gctest\Debug\test.obj" ".\Debug\gctest.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) $(LINK32) @<< $(LINK32_FLAGS) $(LINK32_OBJS) << !ELSEIF "$(CFG)" == "cord - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "cord\Release" # PROP BASE Intermediate_Dir "cord\Release" # PROP BASE Target_Dir "cord" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "cord\Release" # PROP Intermediate_Dir "cord\Release" # PROP Target_Dir "cord" OUTDIR=.\cord\Release INTDIR=.\cord\Release ALL : "gc - Win32 Release" ".\Release\de.exe" CLEAN : -@erase ".\cord\Release\cordbscs.obj" -@erase ".\cord\Release\cordxtra.obj" -@erase ".\cord\Release\de.obj" -@erase ".\cord\Release\de_win.obj" -@erase ".\cord\Release\de_win.res" -@erase ".\Release\de.exe" "$(OUTDIR)" : if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" CPP=cl.exe # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c # ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /YX /c CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "." /I include /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D\ /Ilibatomic_ops-$(AO_VERSION)/src "ALL_INTERIOR_POINTERS" /Fp"$(INTDIR)/cord.pch" /YX /Fo"$(INTDIR)/" /c CPP_OBJS=.\cord\Release/ CPP_SBRS=.\. .c{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .c{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< MTL=mktyplib.exe # ADD BASE MTL /nologo /D "NDEBUG" /win32 # ADD MTL /nologo /D "NDEBUG" /win32 MTL_PROJ=/nologo /D "NDEBUG" /win32 RSC=rc.exe # ADD BASE RSC /l 0x809 /d "NDEBUG" # ADD RSC /l 0x809 /d "NDEBUG" RSC_PROJ=/l 0x809 /fo"$(INTDIR)/de_win.res" /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo BSC32_FLAGS=/nologo /o"$(OUTDIR)/cord.bsc" BSC32_SBRS= \ LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"Release/de.exe" LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ odbccp32.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)/de.pdb"\ /machine:I386 /out:"Release/de.exe" LINK32_OBJS= \ ".\cord\Release\cordbscs.obj" \ ".\cord\Release\cordxtra.obj" \ ".\cord\Release\de.obj" \ ".\cord\Release\de_win.obj" \ ".\cord\Release\de_win.res" \ ".\Release\gc.lib" ".\Release\de.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) $(LINK32) @<< $(LINK32_FLAGS) $(LINK32_OBJS) << !ELSEIF "$(CFG)" == "cord - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "cord\Debug" # PROP BASE Intermediate_Dir "cord\Debug" # PROP BASE Target_Dir "cord" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "cord\Debug" # PROP Intermediate_Dir "cord\Debug" # PROP Target_Dir "cord" OUTDIR=.\cord\Debug INTDIR=.\cord\Debug ALL : "gc - Win32 Debug" ".\Debug\de.exe" CLEAN : -@erase ".\cord\Debug\cordbscs.obj" -@erase ".\cord\Debug\cordxtra.obj" -@erase ".\cord\Debug\de.obj" -@erase ".\cord\Debug\de.pdb" -@erase ".\cord\Debug\de_win.obj" -@erase ".\cord\Debug\de_win.res" -@erase ".\cord\Debug\vc40.idb" -@erase ".\cord\Debug\vc40.pdb" -@erase ".\Debug\de.exe" -@erase ".\Debug\de.ilk" "$(OUTDIR)" : if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" CPP=cl.exe # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c # ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /YX /c CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I include /D "_DEBUG" /D "WIN32" /D\ "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /Fp"$(INTDIR)/cord.pch" /YX\ /Ilibatomic_ops-$(AO_VERSION)/src /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c CPP_OBJS=.\cord\Debug/ CPP_SBRS=.\. .c{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_OBJS)}.obj: $(CPP) $(CPP_PROJ) $< .c{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cpp{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< .cxx{$(CPP_SBRS)}.sbr: $(CPP) $(CPP_PROJ) $< MTL=mktyplib.exe # ADD BASE MTL /nologo /D "_DEBUG" /win32 # ADD MTL /nologo /D "_DEBUG" /win32 MTL_PROJ=/nologo /D "_DEBUG" /win32 RSC=rc.exe # ADD BASE RSC /l 0x809 /d "_DEBUG" # ADD RSC /l 0x809 /d "_DEBUG" RSC_PROJ=/l 0x809 /fo"$(INTDIR)/de_win.res" /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo BSC32_FLAGS=/nologo /o"$(OUTDIR)/cord.bsc" BSC32_SBRS= \ LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /out:"Debug/de.exe" LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ odbccp32.lib /nologo /subsystem:windows /incremental:yes\ /pdb:"$(OUTDIR)/de.pdb" /debug /machine:I386 /out:"Debug/de.exe" LINK32_OBJS= \ ".\cord\Debug\cordbscs.obj" \ ".\cord\Debug\cordxtra.obj" \ ".\cord\Debug\de.obj" \ ".\cord\Debug\de_win.obj" \ ".\cord\Debug\de_win.res" \ ".\Debug\gc.lib" ".\Debug\de.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) $(LINK32) @<< $(LINK32_FLAGS) $(LINK32_OBJS) << !ENDIF ################################################################################ # Begin Target # Name "gc - Win32 Release" # Name "gc - Win32 Debug" !IF "$(CFG)" == "gc - Win32 Release" !ELSEIF "$(CFG)" == "gc - Win32 Debug" !ENDIF ################################################################################ # Begin Source File SOURCE=.\gc_cpp.cpp !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_RECLA=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ ".\include\gc_cpp.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_RECLA=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\gc_cpp.obj" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)" ".\Release\gc_cpp.sbr" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_RECLA=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ ".\include\gc_cpp.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_RECLA=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\gc_cpp.obj" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)" ".\Debug\gc_cpp.sbr" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\reclaim.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_RECLA=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_RECLA=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\reclaim.obj" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)" ".\Release\reclaim.sbr" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_RECLA=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_RECLA=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\reclaim.obj" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)" ".\Debug\reclaim.sbr" : $(SOURCE) $(DEP_CPP_RECLA) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\os_dep.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_OS_DE=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\STAT.H"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_OS_DE=\ ".\il\PCR_IL.h"\ ".\mm\PCR_MM.h"\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\vd\PCR_VD.h"\ ".\Release\os_dep.obj" : $(SOURCE) $(DEP_CPP_OS_DE) "$(INTDIR)" ".\Release\os_dep.sbr" : $(SOURCE) $(DEP_CPP_OS_DE) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_OS_DE=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\STAT.H"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_OS_DE=\ ".\il\PCR_IL.h"\ ".\mm\PCR_MM.h"\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\vd\PCR_VD.h"\ ".\Debug\os_dep.obj" : $(SOURCE) $(DEP_CPP_OS_DE) "$(INTDIR)" ".\Debug\os_dep.sbr" : $(SOURCE) $(DEP_CPP_OS_DE) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\misc.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_MISC_=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MISC_=\ ".\il\PCR_IL.h"\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\misc.obj" : $(SOURCE) $(DEP_CPP_MISC_) "$(INTDIR)" ".\Release\misc.sbr" : $(SOURCE) $(DEP_CPP_MISC_) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_MISC_=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MISC_=\ ".\il\PCR_IL.h"\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\misc.obj" : $(SOURCE) $(DEP_CPP_MISC_) "$(INTDIR)" ".\Debug\misc.sbr" : $(SOURCE) $(DEP_CPP_MISC_) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\mark_rts.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_MARK_=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MARK_=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\mark_rts.obj" : $(SOURCE) $(DEP_CPP_MARK_) "$(INTDIR)" ".\Release\mark_rts.sbr" : $(SOURCE) $(DEP_CPP_MARK_) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_MARK_=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MARK_=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\mark_rts.obj" : $(SOURCE) $(DEP_CPP_MARK_) "$(INTDIR)" ".\Debug\mark_rts.sbr" : $(SOURCE) $(DEP_CPP_MARK_) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\mach_dep.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_MACH_=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MACH_=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\mach_dep.obj" : $(SOURCE) $(DEP_CPP_MACH_) "$(INTDIR)" ".\Release\mach_dep.sbr" : $(SOURCE) $(DEP_CPP_MACH_) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_MACH_=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MACH_=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\mach_dep.obj" : $(SOURCE) $(DEP_CPP_MACH_) "$(INTDIR)" ".\Debug\mach_dep.sbr" : $(SOURCE) $(DEP_CPP_MACH_) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\headers.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_HEADE=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_HEADE=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\headers.obj" : $(SOURCE) $(DEP_CPP_HEADE) "$(INTDIR)" ".\Release\headers.sbr" : $(SOURCE) $(DEP_CPP_HEADE) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_HEADE=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_HEADE=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\headers.obj" : $(SOURCE) $(DEP_CPP_HEADE) "$(INTDIR)" ".\Debug\headers.sbr" : $(SOURCE) $(DEP_CPP_HEADE) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\alloc.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_ALLOC=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_ALLOC=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\alloc.obj" : $(SOURCE) $(DEP_CPP_ALLOC) "$(INTDIR)" ".\Release\alloc.sbr" : $(SOURCE) $(DEP_CPP_ALLOC) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_ALLOC=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_ALLOC=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\alloc.obj" : $(SOURCE) $(DEP_CPP_ALLOC) "$(INTDIR)" ".\Debug\alloc.sbr" : $(SOURCE) $(DEP_CPP_ALLOC) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\allchblk.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_ALLCH=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_ALLCH=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\allchblk.obj" : $(SOURCE) $(DEP_CPP_ALLCH) "$(INTDIR)" ".\Release\allchblk.sbr" : $(SOURCE) $(DEP_CPP_ALLCH) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_ALLCH=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_ALLCH=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\allchblk.obj" : $(SOURCE) $(DEP_CPP_ALLCH) "$(INTDIR)" ".\Debug\allchblk.sbr" : $(SOURCE) $(DEP_CPP_ALLCH) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\stubborn.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_STUBB=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_STUBB=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\stubborn.obj" : $(SOURCE) $(DEP_CPP_STUBB) "$(INTDIR)" ".\Release\stubborn.sbr" : $(SOURCE) $(DEP_CPP_STUBB) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_STUBB=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_STUBB=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\stubborn.obj" : $(SOURCE) $(DEP_CPP_STUBB) "$(INTDIR)" ".\Debug\stubborn.sbr" : $(SOURCE) $(DEP_CPP_STUBB) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\obj_map.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_OBJ_M=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_OBJ_M=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\obj_map.obj" : $(SOURCE) $(DEP_CPP_OBJ_M) "$(INTDIR)" ".\Release\obj_map.sbr" : $(SOURCE) $(DEP_CPP_OBJ_M) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_OBJ_M=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_OBJ_M=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\obj_map.obj" : $(SOURCE) $(DEP_CPP_OBJ_M) "$(INTDIR)" ".\Debug\obj_map.sbr" : $(SOURCE) $(DEP_CPP_OBJ_M) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\new_hblk.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_NEW_H=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_NEW_H=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\new_hblk.obj" : $(SOURCE) $(DEP_CPP_NEW_H) "$(INTDIR)" ".\Release\new_hblk.sbr" : $(SOURCE) $(DEP_CPP_NEW_H) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_NEW_H=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_NEW_H=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\new_hblk.obj" : $(SOURCE) $(DEP_CPP_NEW_H) "$(INTDIR)" ".\Debug\new_hblk.sbr" : $(SOURCE) $(DEP_CPP_NEW_H) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\mark.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_MARK_C=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_pmark.h"\ ".\include\gc_mark.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MARK_C=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\mark.obj" : $(SOURCE) $(DEP_CPP_MARK_C) "$(INTDIR)" ".\Release\mark.sbr" : $(SOURCE) $(DEP_CPP_MARK_C) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_MARK_C=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_pmark.h"\ ".\include\gc_mark.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MARK_C=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\mark.obj" : $(SOURCE) $(DEP_CPP_MARK_C) "$(INTDIR)" ".\Debug\mark.sbr" : $(SOURCE) $(DEP_CPP_MARK_C) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\malloc.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_MALLO=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MALLO=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\malloc.obj" : $(SOURCE) $(DEP_CPP_MALLO) "$(INTDIR)" ".\Release\malloc.sbr" : $(SOURCE) $(DEP_CPP_MALLO) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_MALLO=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MALLO=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\malloc.obj" : $(SOURCE) $(DEP_CPP_MALLO) "$(INTDIR)" ".\Debug\malloc.sbr" : $(SOURCE) $(DEP_CPP_MALLO) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\mallocx.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_MALLX=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MALLX=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\mallocx.obj" : $(SOURCE) $(DEP_CPP_MALLX) "$(INTDIR)" ".\Release\mallocx.sbr" : $(SOURCE) $(DEP_CPP_MALLX) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_MALLX=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_MALLX=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\mallocx.obj" : $(SOURCE) $(DEP_CPP_MALLX) "$(INTDIR)" ".\Debug\mallocx.sbr" : $(SOURCE) $(DEP_CPP_MALLX) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\finalize.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_FINAL=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_pmark.h"\ ".\include\gc_mark.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_FINAL=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\finalize.obj" : $(SOURCE) $(DEP_CPP_FINAL) "$(INTDIR)" ".\Release\finalize.sbr" : $(SOURCE) $(DEP_CPP_FINAL) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_FINAL=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_pmark.h"\ ".\include\gc_mark.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_FINAL=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\finalize.obj" : $(SOURCE) $(DEP_CPP_FINAL) "$(INTDIR)" ".\Debug\finalize.sbr" : $(SOURCE) $(DEP_CPP_FINAL) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\dbg_mlc.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_DBG_M=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_DBG_M=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\dbg_mlc.obj" : $(SOURCE) $(DEP_CPP_DBG_M) "$(INTDIR)" ".\Release\dbg_mlc.sbr" : $(SOURCE) $(DEP_CPP_DBG_M) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_DBG_M=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_DBG_M=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\dbg_mlc.obj" : $(SOURCE) $(DEP_CPP_DBG_M) "$(INTDIR)" ".\Debug\dbg_mlc.sbr" : $(SOURCE) $(DEP_CPP_DBG_M) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\blacklst.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_BLACK=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_BLACK=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\blacklst.obj" : $(SOURCE) $(DEP_CPP_BLACK) "$(INTDIR)" ".\Release\blacklst.sbr" : $(SOURCE) $(DEP_CPP_BLACK) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_BLACK=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_BLACK=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\blacklst.obj" : $(SOURCE) $(DEP_CPP_BLACK) "$(INTDIR)" ".\Debug\blacklst.sbr" : $(SOURCE) $(DEP_CPP_BLACK) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\typd_mlc.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_TYPD_=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_pmark.h"\ ".\include\gc_mark.h"\ ".\include\private\gc_priv.h"\ ".\include\gc_typed.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_TYPD_=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\typd_mlc.obj" : $(SOURCE) $(DEP_CPP_TYPD_) "$(INTDIR)" ".\Release\typd_mlc.sbr" : $(SOURCE) $(DEP_CPP_TYPD_) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_TYPD_=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_pmark.h"\ ".\include\gc_mark.h"\ ".\include\private\gc_priv.h"\ ".\include\gc_typed.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_TYPD_=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\typd_mlc.obj" : $(SOURCE) $(DEP_CPP_TYPD_) "$(INTDIR)" ".\Debug\typd_mlc.sbr" : $(SOURCE) $(DEP_CPP_TYPD_) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\ptr_chck.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_PTR_C=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_pmark.h"\ ".\include\gc_mark.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_PTR_C=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\ptr_chck.obj" : $(SOURCE) $(DEP_CPP_PTR_C) "$(INTDIR)" ".\Release\ptr_chck.sbr" : $(SOURCE) $(DEP_CPP_PTR_C) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_PTR_C=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_pmark.h"\ ".\include\gc_mark.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_PTR_C=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\ptr_chck.obj" : $(SOURCE) $(DEP_CPP_PTR_C) "$(INTDIR)" ".\Debug\ptr_chck.sbr" : $(SOURCE) $(DEP_CPP_PTR_C) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\dyn_load.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_DYN_L=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\STAT.H"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_DYN_L=\ ".\il\PCR_IL.h"\ ".\mm\PCR_MM.h"\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\dyn_load.obj" : $(SOURCE) $(DEP_CPP_DYN_L) "$(INTDIR)" ".\Release\dyn_load.sbr" : $(SOURCE) $(DEP_CPP_DYN_L) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_DYN_L=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\STAT.H"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_DYN_L=\ ".\il\PCR_IL.h"\ ".\mm\PCR_MM.h"\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\dyn_load.obj" : $(SOURCE) $(DEP_CPP_DYN_L) "$(INTDIR)" ".\Debug\dyn_load.sbr" : $(SOURCE) $(DEP_CPP_DYN_L) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\win32_threads.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_WIN32=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_WIN32=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\win32_threads.obj" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)" ".\Release\win32_threads.sbr" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_WIN32=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_WIN32=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\win32_threads.obj" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)" ".\Debug\win32_threads.sbr" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\msvc_dbg.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_WIN32=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ ".\include\private\msvc_dbg.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_WIN32=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\msvc_dbg.obj" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)" ".\Release\msvc_dbg.sbr" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_WIN32=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ ".\include\private\msvc_dbg.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_WIN32=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\msvc_dbg.obj" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)" ".\Debug\msvc_dbg.sbr" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)" !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\checksums.c !IF "$(CFG)" == "gc - Win32 Release" DEP_CPP_CHECK=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_CHECK=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Release\checksums.obj" : $(SOURCE) $(DEP_CPP_CHECK) "$(INTDIR)" ".\Release\checksums.sbr" : $(SOURCE) $(DEP_CPP_CHECK) "$(INTDIR)" !ELSEIF "$(CFG)" == "gc - Win32 Debug" DEP_CPP_CHECK=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_CHECK=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ ".\Debug\checksums.obj" : $(SOURCE) $(DEP_CPP_CHECK) "$(INTDIR)" ".\Debug\checksums.sbr" : $(SOURCE) $(DEP_CPP_CHECK) "$(INTDIR)" !ENDIF # End Source File # End Target ################################################################################ # Begin Target # Name "gctest - Win32 Release" # Name "gctest - Win32 Debug" !IF "$(CFG)" == "gctest - Win32 Release" !ELSEIF "$(CFG)" == "gctest - Win32 Debug" !ENDIF ################################################################################ # Begin Project Dependency # Project_Dep_Name "gc" !IF "$(CFG)" == "gctest - Win32 Release" "gc - Win32 Release" : $(MAKE) /$(MAKEFLAGS) /F ".\gc.mak" CFG="gc - Win32 Release" !ELSEIF "$(CFG)" == "gctest - Win32 Debug" "gc - Win32 Debug" : $(MAKE) /$(MAKEFLAGS) /F ".\gc.mak" CFG="gc - Win32 Debug" !ENDIF # End Project Dependency ################################################################################ # Begin Source File SOURCE=.\tests\test.c DEP_CPP_TEST_=\ ".\include\private\gcconfig.h"\ ".\include\gc.h"\ ".\include\private\gc_hdrs.h"\ ".\include\private\gc_priv.h"\ ".\include\gc_typed.h"\ {$(INCLUDE)}"\sys\TYPES.H"\ NODEP_CPP_TEST_=\ ".\th\PCR_Th.h"\ ".\th\PCR_ThCrSec.h"\ ".\th\PCR_ThCtl.h"\ !IF "$(CFG)" == "gctest - Win32 Release" ".\gctest\Release\test.obj" : $(SOURCE) $(DEP_CPP_TEST_) "$(INTDIR)" !ELSEIF "$(CFG)" == "gctest - Win32 Debug" ".\gctest\Debug\test.obj" : $(SOURCE) $(DEP_CPP_TEST_) "$(INTDIR)" ".\gctest\Debug\test.sbr" : $(SOURCE) $(DEP_CPP_TEST_) "$(INTDIR)" !ENDIF # End Source File # End Target ################################################################################ # Begin Target # Name "cord - Win32 Release" # Name "cord - Win32 Debug" !IF "$(CFG)" == "cord - Win32 Release" !ELSEIF "$(CFG)" == "cord - Win32 Debug" !ENDIF ################################################################################ # Begin Project Dependency # Project_Dep_Name "gc" !IF "$(CFG)" == "cord - Win32 Release" "gc - Win32 Release" : $(MAKE) /$(MAKEFLAGS) /F ".\gc.mak" CFG="gc - Win32 Release" !ELSEIF "$(CFG)" == "cord - Win32 Debug" "gc - Win32 Debug" : $(MAKE) /$(MAKEFLAGS) /F ".\gc.mak" CFG="gc - Win32 Debug" !ENDIF # End Project Dependency ################################################################################ # Begin Source File SOURCE=.\cord\de_win.c DEP_CPP_DE_WI=\ ".\include\cord.h"\ ".\cord\de_cmds.h"\ ".\cord\de_win.h"\ ".\include\private\cord_pos.h"\ NODEP_CPP_DE_WI=\ ".\include\gc.h"\ !IF "$(CFG)" == "cord - Win32 Release" ".\cord\Release\de_win.obj" : $(SOURCE) $(DEP_CPP_DE_WI) "$(INTDIR)" $(CPP) $(CPP_PROJ) $(SOURCE) !ELSEIF "$(CFG)" == "cord - Win32 Debug" ".\cord\Debug\de_win.obj" : $(SOURCE) $(DEP_CPP_DE_WI) "$(INTDIR)" $(CPP) $(CPP_PROJ) $(SOURCE) !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\cord\de.c DEP_CPP_DE_C2e=\ ".\include\cord.h"\ ".\cord\de_cmds.h"\ ".\cord\de_win.h"\ ".\include\private\cord_pos.h"\ NODEP_CPP_DE_C2e=\ ".\include\gc.h"\ !IF "$(CFG)" == "cord - Win32 Release" ".\cord\Release\de.obj" : $(SOURCE) $(DEP_CPP_DE_C2e) "$(INTDIR)" $(CPP) $(CPP_PROJ) $(SOURCE) !ELSEIF "$(CFG)" == "cord - Win32 Debug" ".\cord\Debug\de.obj" : $(SOURCE) $(DEP_CPP_DE_C2e) "$(INTDIR)" $(CPP) $(CPP_PROJ) $(SOURCE) !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\cord\cordxtra.c DEP_CPP_CORDX=\ ".\include\cord.h"\ ".\include\ec.h"\ ".\include\private\cord_pos.h"\ NODEP_CPP_CORDX=\ ".\include\gc.h"\ !IF "$(CFG)" == "cord - Win32 Release" ".\cord\Release\cordxtra.obj" : $(SOURCE) $(DEP_CPP_CORDX) "$(INTDIR)" $(CPP) $(CPP_PROJ) $(SOURCE) !ELSEIF "$(CFG)" == "cord - Win32 Debug" ".\cord\Debug\cordxtra.obj" : $(SOURCE) $(DEP_CPP_CORDX) "$(INTDIR)" $(CPP) $(CPP_PROJ) $(SOURCE) !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\cord\cordbscs.c DEP_CPP_CORDB=\ ".\include\cord.h"\ ".\include\private\cord_pos.h"\ NODEP_CPP_CORDB=\ ".\include\gc.h"\ !IF "$(CFG)" == "cord - Win32 Release" ".\cord\Release\cordbscs.obj" : $(SOURCE) $(DEP_CPP_CORDB) "$(INTDIR)" $(CPP) $(CPP_PROJ) $(SOURCE) !ELSEIF "$(CFG)" == "cord - Win32 Debug" ".\cord\Debug\cordbscs.obj" : $(SOURCE) $(DEP_CPP_CORDB) "$(INTDIR)" $(CPP) $(CPP_PROJ) $(SOURCE) !ENDIF # End Source File ################################################################################ # Begin Source File SOURCE=.\cord\de_win.RC !IF "$(CFG)" == "cord - Win32 Release" ".\cord\Release\de_win.res" : $(SOURCE) "$(INTDIR)" $(RSC) /l 0x809 /fo"$(INTDIR)/de_win.res" /i "cord" /d "NDEBUG" $(SOURCE) !ELSEIF "$(CFG)" == "cord - Win32 Debug" ".\cord\Debug\de_win.res" : $(SOURCE) "$(INTDIR)" $(RSC) /l 0x809 /fo"$(INTDIR)/de_win.res" /i "cord" /d "_DEBUG" $(SOURCE) !ENDIF # End Source File # End Target # End Project ################################################################################ synopsis-0.12/src/Synopsis/gc/acinclude.m40000664000076400007640000000347611104702316020064 0ustar stefanstefan# # # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED # OR IMPLIED. ANY USE IS AT YOUR OWN RISK. # # Permission is hereby granted to use or copy this program # for any purpose, provided the above notices are retained on all copies. # Permission to modify the code and to distribute modified code is granted, # provided the above notices are retained, and a notice that the code was # modified is included with the above copyright notice. # # Modified by: Grzegorz Jakacki # GC_SET_VERSION # sets and AC_DEFINEs GC_VERSION_MAJOR, GC_VERSION_MINOR and GC_ALPHA_VERSION # based on the contents of PACKAGE_VERSION; PACKAGE_VERSION must conform to # [0-9]+[.][0-9]+(alpha[0.9]+)? # in lex syntax; if there is no alpha number, GC_ALPHA_VERSION is empty # AC_DEFUN([GC_SET_VERSION], [ AC_MSG_CHECKING(GC version numbers) GC_VERSION_MAJOR=`echo $PACKAGE_VERSION | sed 's/^\([[0-9]][[0-9]]*\)[[.]].*$/\1/g'` GC_VERSION_MINOR=`echo $PACKAGE_VERSION | sed 's/^[[^.]]*[[.]]\([[0-9]][[0-9]]*\).*$/\1/g'` GC_ALPHA_VERSION=`echo $PACKAGE_VERSION | sed 's/^[[^.]]*[[.]][[0-9]]*//'` case "$GC_ALPHA_VERSION" in alpha*) GC_ALPHA_VERSION=`echo $GC_ALPHA_VERSION \ | sed 's/alpha\([[0-9]][[0-9]]*\)/\1/'` ;; *) GC_ALPHA_MAJOR='' ;; esac if test :$GC_VERSION_MAJOR: = :: \ -o :$GC_VERSION_MINOR: = :: ; then AC_MSG_RESULT(invalid) AC_MSG_ERROR([nonconforming PACKAGE_VERSION='$PACKAGE_VERSION']) fi AC_DEFINE_UNQUOTED(GC_VERSION_MAJOR, $GC_VERSION_MAJOR) AC_DEFINE_UNQUOTED(GC_VERSION_MINOR, $GC_VERSION_MINOR) if test :$GC_ALPHA_VERSION: != :: ; then AC_DEFINE_UNQUOTED(GC_ALPHA_VERSION, $GC_ALPHA_VERSION) fi AC_MSG_RESULT(major=$GC_VERSION_MAJOR minor=$GC_VERSION_MINOR \ ${GC_ALPHA_VERSION:+alpha=}$GC_ALPHA_VERSION) ]) sinclude(libtool.m4) synopsis-0.12/src/Synopsis/gc/new_hblk.c0000664000076400007640000001324011104702320017611 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * * This file contains the functions: * ptr_t GC_build_flXXX(h, old_fl) * void GC_new_hblk(size) */ /* Boehm, May 19, 1994 2:09 pm PDT */ # include # include "private/gc_priv.h" #ifndef SMALL_CONFIG /* * Build a free list for size 2 (words) cleared objects inside hblk h. * Set the last link to * be ofl. Return a pointer tpo the first free list entry. */ ptr_t GC_build_fl_clear2(struct hblk *h, ptr_t ofl) { word * p = (word *)(h -> hb_body); word * lim = (word *)(h + 1); p[0] = (word)ofl; p[1] = 0; p[2] = (word)p; p[3] = 0; p += 4; for (; p < lim; p += 4) { p[0] = (word)(p-2); p[1] = 0; p[2] = (word)p; p[3] = 0; }; return((ptr_t)(p-2)); } /* The same for size 4 cleared objects */ ptr_t GC_build_fl_clear4(struct hblk *h, ptr_t ofl) { word * p = (word *)(h -> hb_body); word * lim = (word *)(h + 1); p[0] = (word)ofl; p[1] = 0; p[2] = 0; p[3] = 0; p += 4; for (; p < lim; p += 4) { PREFETCH_FOR_WRITE((ptr_t)(p+64)); p[0] = (word)(p-4); p[1] = 0; CLEAR_DOUBLE(p+2); }; return((ptr_t)(p-4)); } /* The same for size 2 uncleared objects */ ptr_t GC_build_fl2(struct hblk *h, ptr_t ofl) { word * p = (word *)(h -> hb_body); word * lim = (word *)(h + 1); p[0] = (word)ofl; p[2] = (word)p; p += 4; for (; p < lim; p += 4) { p[0] = (word)(p-2); p[2] = (word)p; }; return((ptr_t)(p-2)); } /* The same for size 4 uncleared objects */ ptr_t GC_build_fl4(struct hblk *h, ptr_t ofl) { word * p = (word *)(h -> hb_body); word * lim = (word *)(h + 1); p[0] = (word)ofl; p[4] = (word)p; p += 8; for (; p < lim; p += 8) { PREFETCH_FOR_WRITE((ptr_t)(p+64)); p[0] = (word)(p-4); p[4] = (word)p; }; return((ptr_t)(p-4)); } #endif /* !SMALL_CONFIG */ /* Build a free list for objects of size sz inside heap block h. */ /* Clear objects inside h if clear is set. Add list to the end of */ /* the free list we build. Return the new free list. */ /* This could be called without the main GC lock, if we ensure that */ /* there is no concurrent collection which might reclaim objects that */ /* we have not yet allocated. */ ptr_t GC_build_fl(struct hblk *h, size_t sz, GC_bool clear, ptr_t list) { word *p, *prev; word *last_object; /* points to last object in new hblk */ /* Do a few prefetches here, just because its cheap. */ /* If we were more serious about it, these should go inside */ /* the loops. But write prefetches usually don't seem to */ /* matter much. */ PREFETCH_FOR_WRITE((ptr_t)h); PREFETCH_FOR_WRITE((ptr_t)h + 128); PREFETCH_FOR_WRITE((ptr_t)h + 256); PREFETCH_FOR_WRITE((ptr_t)h + 378); /* Handle small objects sizes more efficiently. For larger objects */ /* the difference is less significant. */ # ifndef SMALL_CONFIG switch (sz) { case 2: if (clear) { return GC_build_fl_clear2(h, list); } else { return GC_build_fl2(h, list); } case 4: if (clear) { return GC_build_fl_clear4(h, list); } else { return GC_build_fl4(h, list); } default: break; } # endif /* !SMALL_CONFIG */ /* Clear the page if necessary. */ if (clear) BZERO(h, HBLKSIZE); /* Add objects to free list */ p = (word *)(h -> hb_body) + sz; /* second object in *h */ prev = (word *)(h -> hb_body); /* One object behind p */ last_object = (word *)((char *)h + HBLKSIZE); last_object -= sz; /* Last place for last object to start */ /* make a list of all objects in *h with head as last object */ while (p <= last_object) { /* current object's link points to last object */ obj_link(p) = (ptr_t)prev; prev = p; p += sz; } p -= sz; /* p now points to last object */ /* * put p (which is now head of list of objects in *h) as first * pointer in the appropriate free list for this size. */ obj_link(h -> hb_body) = list; return ((ptr_t)p); } /* * Allocate a new heapblock for small objects of size gran granules. * Add all of the heapblock's objects to the free list for objects * of that size. * Set all mark bits if objects are uncollectable. * Will fail to do anything if we are out of memory. */ void GC_new_hblk(size_t gran, int kind) { struct hblk *h; /* the new heap block */ GC_bool clear = GC_obj_kinds[kind].ok_init; /* Ignore gcc "no effect" warning on the following: */ GC_STATIC_ASSERT((sizeof (struct hblk)) == HBLKSIZE); if (GC_debugging_started) clear = TRUE; /* Allocate a new heap block */ h = GC_allochblk(GRANULES_TO_BYTES(gran), kind, 0); if (h == 0) return; /* Mark all objects if appropriate. */ if (IS_UNCOLLECTABLE(kind)) GC_set_hdr_marks(HDR(h)); /* Build the free list */ GC_obj_kinds[kind].ok_freelist[gran] = GC_build_fl(h, GRANULES_TO_WORDS(gran), clear, GC_obj_kinds[kind].ok_freelist[gran]); } synopsis-0.12/src/Synopsis/gc/configure.host0000664000076400007640000000305411104702321020537 0ustar stefanstefan# configure.host # This shell script handles all host based configuration for the garbage # collector. # It sets various shell variables based on the the host and the # configuration options. You can modify this shell script without # needing to rerun autoconf. # This shell script should be invoked as # . configure.host # If it encounters an error, it will exit with a message. # It uses the following shell variables: # host The configuration host # host_cpu The configuration host CPU # target_optspace --enable-target-optspace ("yes", "no", "") # GCC should be "yes" if using gcc # It sets the following shell variables: # gc_cflags Special CFLAGS to use when building gc_cflags="" # We should set -fexceptions if we are using gcc and might be used # inside something like gcj. This is the zeroth approximation: if test :"$GCC": = :yes: ; then gc_cflags="${gc_cflags} -fexceptions" else case "$host" in hppa*-*-hpux* ) if test :$GCC: != :"yes": ; then gc_cflags="${gc_flags} +ESdbgasm" fi # :TODO: actaully we should check using Autoconf if # the compiler supports this option. ;; esac fi case "${target_optspace}:${host}" in yes:*) gc_cflags="${gc_cflags} -Os" ;; :m32r-* | :d10v-* | :d30v-*) gc_cflags="${gc_cflags} -Os" ;; no:* | :*) # Nothing. ;; esac # Set any host dependent compiler flags. # THIS TABLE IS SORTED. KEEP IT THAT WAY. case "${host}" in mips-tx39-*|mipstx39-unknown-*) gc_cflags="${gc_cflags} -G 0" ;; *) ;; esac synopsis-0.12/src/Synopsis/gc/msvc_dbg.c0000664000076400007640000002425511104702316017621 0ustar stefanstefan/* Copyright (c) 2004 Andrei Polushin 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 _M_AMD64 /* X86_64 is ccurrently missing some meachine-dependent code below. */ #include "private/msvc_dbg.h" #define WIN32_LEAN_AND_MEAN #include #pragma pack(push, 8) #include #pragma pack(pop) #pragma comment(lib, "dbghelp.lib") #pragma optimize("gy", off) #ifdef _WIN64 typedef ULONG_PTR ULONG_ADDR; #else typedef ULONG ULONG_ADDR; #endif static HANDLE GetSymHandle() { static HANDLE symHandle = NULL; if (!symHandle) { BOOL bRet = SymInitialize(symHandle = GetCurrentProcess(), NULL, FALSE); if (bRet) { DWORD dwOptions = SymGetOptions(); dwOptions &= ~SYMOPT_UNDNAME; dwOptions |= SYMOPT_LOAD_LINES; SymSetOptions(dwOptions); } } return symHandle; } static void* CALLBACK FunctionTableAccess(HANDLE hProcess, ULONG_ADDR dwAddrBase) { return SymFunctionTableAccess(hProcess, dwAddrBase); } static ULONG_ADDR CALLBACK GetModuleBase(HANDLE hProcess, ULONG_ADDR dwAddress) { MEMORY_BASIC_INFORMATION memoryInfo; ULONG_ADDR dwAddrBase = SymGetModuleBase(hProcess, dwAddress); if (dwAddrBase) { return dwAddrBase; } if (VirtualQueryEx(hProcess, (void*)(ULONG_PTR)dwAddress, &memoryInfo, sizeof(memoryInfo))) { char filePath[_MAX_PATH]; char curDir[_MAX_PATH]; char exePath[_MAX_PATH]; DWORD size = GetModuleFileNameA((HINSTANCE)memoryInfo.AllocationBase, filePath, sizeof(filePath)); // Save and restore current directory around SymLoadModule, see KB article Q189780 GetCurrentDirectoryA(sizeof(curDir), curDir); GetModuleFileNameA(NULL, exePath, sizeof(exePath)); strcat_s(exePath, sizeof(exePath), "\\.."); SetCurrentDirectoryA(exePath); #ifdef _DEBUG GetCurrentDirectoryA(sizeof(exePath), exePath); #endif SymLoadModule(hProcess, NULL, size ? filePath : NULL, NULL, (ULONG_ADDR)(ULONG_PTR)memoryInfo.AllocationBase, 0); SetCurrentDirectoryA(curDir); } return (ULONG_ADDR)(ULONG_PTR)memoryInfo.AllocationBase; } static ULONG_ADDR CheckAddress(void* address) { ULONG_ADDR dwAddress = (ULONG_ADDR)(ULONG_PTR)address; GetModuleBase(GetSymHandle(), dwAddress); return dwAddress; } size_t GetStackFrames(size_t skip, void* frames[], size_t maxFrames) { HANDLE hProcess = GetSymHandle(); HANDLE hThread = GetCurrentThread(); CONTEXT context; context.ContextFlags = CONTEXT_FULL; if (!GetThreadContext(hThread, &context)) { return 0; } // GetThreadContext might return invalid context for the current thread #if defined(_M_IX86) __asm mov context.Ebp, ebp #endif return GetStackFramesFromContext(hProcess, hThread, &context, skip + 1, frames, maxFrames); } size_t GetStackFramesFromContext(HANDLE hProcess, HANDLE hThread, CONTEXT* context, size_t skip, void* frames[], size_t maxFrames) { size_t frameIndex; DWORD machineType; STACKFRAME stackFrame = { 0 }; stackFrame.AddrPC.Mode = AddrModeFlat; #if defined(_M_IX86) machineType = IMAGE_FILE_MACHINE_I386; stackFrame.AddrPC.Offset = context->Eip; stackFrame.AddrStack.Mode = AddrModeFlat; stackFrame.AddrStack.Offset = context->Esp; stackFrame.AddrFrame.Mode = AddrModeFlat; stackFrame.AddrFrame.Offset = context->Ebp; #elif defined(_M_MRX000) machineType = IMAGE_FILE_MACHINE_R4000; stackFrame.AddrPC.Offset = context->Fir; #elif defined(_M_ALPHA) machineType = IMAGE_FILE_MACHINE_ALPHA; stackFrame.AddrPC.Offset = (unsigned long)context->Fir; #elif defined(_M_PPC) machineType = IMAGE_FILE_MACHINE_POWERPC; stackFrame.AddrPC.Offset = context->Iar; #elif defined(_M_IA64) machineType = IMAGE_FILE_MACHINE_IA64; stackFrame.AddrPC.Offset = context->StIIP; #elif defined(_M_ALPHA64) machineType = IMAGE_FILE_MACHINE_ALPHA64; stackFrame.AddrPC.Offset = context->Fir; #else #error Unknown CPU #endif for (frameIndex = 0; frameIndex < maxFrames; ) { BOOL bRet = StackWalk(machineType, hProcess, hThread, &stackFrame, &context, NULL, FunctionTableAccess, GetModuleBase, NULL); if (!bRet) { break; } if (skip) { skip--; } else { frames[frameIndex++] = (void*)(ULONG_PTR)stackFrame.AddrPC.Offset; } } return frameIndex; } size_t GetModuleNameFromAddress(void* address, char* moduleName, size_t size) { if (size) *moduleName = 0; { const char* sourceName; IMAGEHLP_MODULE moduleInfo = { sizeof (moduleInfo) }; if (!SymGetModuleInfo(GetSymHandle(), CheckAddress(address), &moduleInfo)) { return 0; } sourceName = strrchr(moduleInfo.ImageName, '\\'); if (sourceName) { sourceName++; } else { sourceName = moduleInfo.ImageName; } if (size) { strncpy(moduleName, sourceName, size)[size - 1] = 0; } return strlen(sourceName); } } size_t GetModuleNameFromStack(size_t skip, char* moduleName, size_t size) { void* address = NULL; GetStackFrames(skip + 1, &address, 1); if (address) { return GetModuleNameFromAddress(address, moduleName, size); } return 0; } size_t GetSymbolNameFromAddress(void* address, char* symbolName, size_t size, size_t* offsetBytes) { if (size) *symbolName = 0; if (offsetBytes) *offsetBytes = 0; __try { ULONG_ADDR dwOffset = 0; union { IMAGEHLP_SYMBOL sym; char symNameBuffer[sizeof(IMAGEHLP_SYMBOL) + MAX_SYM_NAME]; } u; u.sym.SizeOfStruct = sizeof(u.sym); u.sym.MaxNameLength = sizeof(u.symNameBuffer) - sizeof(u.sym); if (!SymGetSymFromAddr(GetSymHandle(), CheckAddress(address), &dwOffset, &u.sym)) { return 0; } else { const char* sourceName = u.sym.Name; char undName[1024]; if (UnDecorateSymbolName(u.sym.Name, undName, sizeof(undName), UNDNAME_NO_MS_KEYWORDS | UNDNAME_NO_ACCESS_SPECIFIERS)) { sourceName = undName; } else if (SymUnDName(&u.sym, undName, sizeof(undName))) { sourceName = undName; } if (offsetBytes) { *offsetBytes = dwOffset; } if (size) { strncpy(symbolName, sourceName, size)[size - 1] = 0; } return strlen(sourceName); } } __except (EXCEPTION_EXECUTE_HANDLER) { SetLastError(GetExceptionCode()); } return 0; } size_t GetSymbolNameFromStack(size_t skip, char* symbolName, size_t size, size_t* offsetBytes) { void* address = NULL; GetStackFrames(skip + 1, &address, 1); if (address) { return GetSymbolNameFromAddress(address, symbolName, size, offsetBytes); } return 0; } size_t GetFileLineFromAddress(void* address, char* fileName, size_t size, size_t* lineNumber, size_t* offsetBytes) { if (size) *fileName = 0; if (lineNumber) *lineNumber = 0; if (offsetBytes) *offsetBytes = 0; { char* sourceName; IMAGEHLP_LINE line = { sizeof (line) }; ULONG_PTR dwOffset = 0; if (!SymGetLineFromAddr(GetSymHandle(), CheckAddress(address), &dwOffset, &line)) { return 0; } if (lineNumber) { *lineNumber = line.LineNumber; } if (offsetBytes) { *offsetBytes = dwOffset; } sourceName = line.FileName; // TODO: resolve relative filenames, found in 'source directories' registered with MSVC IDE. if (size) { strncpy(fileName, sourceName, size)[size - 1] = 0; } return strlen(sourceName); } } size_t GetFileLineFromStack(size_t skip, char* fileName, size_t size, size_t* lineNumber, size_t* offsetBytes) { void* address = NULL; GetStackFrames(skip + 1, &address, 1); if (address) { return GetFileLineFromAddress(address, fileName, size, lineNumber, offsetBytes); } return 0; } size_t GetDescriptionFromAddress(void* address, const char* format, char* buffer, size_t size) { char*const begin = buffer; char*const end = buffer + size; size_t line_number = 0; char str[128]; if (size) { *buffer = 0; } buffer += GetFileLineFromAddress(address, buffer, size, &line_number, NULL); size = end < buffer ? 0 : end - buffer; if (line_number) { wsprintf(str, "(%d) : ", line_number); if (size) { strncpy(buffer, str, size)[size - 1] = 0; } buffer += strlen(str); size = end < buffer ? 0 : end - buffer; } if (size) { strncpy(buffer, "at ", size)[size - 1] = 0; } buffer += strlen("at "); size = end < buffer ? 0 : end - buffer; buffer += GetSymbolNameFromAddress(address, buffer, size, NULL); size = end < buffer ? 0 : end - buffer; if (size) { strncpy(buffer, " in ", size)[size - 1] = 0; } buffer += strlen(" in "); size = end < buffer ? 0 : end - buffer; buffer += GetModuleNameFromAddress(address, buffer, size); size = end < buffer ? 0 : end - buffer; return buffer - begin; } size_t GetDescriptionFromStack(void*const frames[], size_t count, const char* format, char* description[], size_t size) { char*const begin = (char*)description; char*const end = begin + size; char* buffer = begin + (count + 1) * sizeof(char*); size_t i; for (i = 0; i < count; ++i) { if (description) description[i] = buffer; size = end < buffer ? 0 : end - buffer; buffer += 1 + GetDescriptionFromAddress(frames[i], NULL, buffer, size); } if (description) description[count] = NULL; return buffer - begin; } /* Compatibility with */ int backtrace(void* addresses[], int count) { return GetStackFrames(1, addresses, count); } char** backtrace_symbols(void*const* addresses, int count) { size_t size = GetDescriptionFromStack(addresses, count, NULL, NULL, 0); char** symbols = (char**)malloc(size); GetDescriptionFromStack(addresses, count, NULL, symbols, size); return symbols; } #endif /* !_M_AMD64 */ synopsis-0.12/src/Synopsis/gc/obj_map.c0000664000076400007640000000550711104702316017443 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991, 1992 by Xerox Corporation. All rights reserved. * Copyright (c) 1999-2001 by Hewlett-Packard Company. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* Routines for maintaining maps describing heap block * layouts for various object sizes. Allows fast pointer validity checks * and fast location of object start locations on machines (such as SPARC) * with slow division. */ # include "private/gc_priv.h" /* Consider pointers that are offset bytes displaced from the beginning */ /* of an object to be valid. */ void GC_register_displacement(size_t offset) { DCL_LOCK_STATE; LOCK(); GC_register_displacement_inner(offset); UNLOCK(); } void GC_register_displacement_inner(size_t offset) { if (offset >= VALID_OFFSET_SZ) { ABORT("Bad argument to GC_register_displacement"); } if (!GC_valid_offsets[offset]) { GC_valid_offsets[offset] = TRUE; GC_modws_valid_offsets[offset % sizeof(word)] = TRUE; } } #ifdef MARK_BIT_PER_GRANULE /* Add a heap block map for objects of size granules to obj_map. */ /* Return FALSE on failure. */ /* A size of 0 granules is used for large objects. */ GC_bool GC_add_map_entry(size_t granules) { unsigned displ; short * new_map; if (granules > BYTES_TO_GRANULES(MAXOBJBYTES)) granules = 0; if (GC_obj_map[granules] != 0) { return(TRUE); } new_map = (short *)GC_scratch_alloc(MAP_LEN * sizeof(short)); if (new_map == 0) return(FALSE); if (GC_print_stats) GC_printf("Adding block map for size of %u granules (%u bytes)\n", (unsigned)granules, (unsigned)(GRANULES_TO_BYTES(granules))); if (granules == 0) { for (displ = 0; displ < BYTES_TO_GRANULES(HBLKSIZE); displ++) { new_map[displ] = 1; /* Nonzero to get us out of marker fast path. */ } } else { for (displ = 0; displ < BYTES_TO_GRANULES(HBLKSIZE); displ++) { new_map[displ] = (short)(displ % granules); } } GC_obj_map[granules] = new_map; return(TRUE); } #endif static GC_bool offsets_initialized = FALSE; void GC_initialize_offsets(void) { if (!offsets_initialized) { int i; if (GC_all_interior_pointers) { for (i = 0; i < VALID_OFFSET_SZ; ++i) GC_valid_offsets[i] = TRUE; } offsets_initialized = TRUE; } } synopsis-0.12/src/Synopsis/gc/dbg_mlc.c0000664000076400007640000007507711104702315017433 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved. * Copyright (c) 1997 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P. * Copyright (C) 2007 Free Software Foundation, Inc * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ #include #include #include "private/dbg_mlc.h" void GC_default_print_heap_obj_proc(); GC_API void GC_register_finalizer_no_order (void * obj, GC_finalization_proc fn, void * cd, GC_finalization_proc *ofn, void * *ocd); #ifndef SHORT_DBG_HDRS /* Check whether object with base pointer p has debugging info */ /* p is assumed to point to a legitimate object in our part */ /* of the heap. */ /* This excludes the check as to whether the back pointer is */ /* odd, which is added by the GC_HAS_DEBUG_INFO macro. */ /* Note that if DBG_HDRS_ALL is set, uncollectable objects */ /* on free lists may not have debug information set. Thus it's */ /* not always safe to return TRUE, even if the client does */ /* its part. */ GC_bool GC_has_other_debug_info(ptr_t p) { register oh * ohdr = (oh *)p; register ptr_t body = (ptr_t)(ohdr + 1); register word sz = GC_size((ptr_t) ohdr); if (HBLKPTR((ptr_t)ohdr) != HBLKPTR((ptr_t)body) || sz < DEBUG_BYTES + EXTRA_BYTES) { return(FALSE); } if (ohdr -> oh_sz == sz) { /* Object may have had debug info, but has been deallocated */ return(FALSE); } if (ohdr -> oh_sf == (START_FLAG ^ (word)body)) return(TRUE); if (((word *)ohdr)[BYTES_TO_WORDS(sz)-1] == (END_FLAG ^ (word)body)) { return(TRUE); } return(FALSE); } #endif #ifdef KEEP_BACK_PTRS # include # if defined(LINUX) || defined(SOLARIS) \ || defined(HPUX) || defined(IRIX5) || defined(OSF1) # define RANDOM() random() # else # define RANDOM() (long)rand() # endif /* Store back pointer to source in dest, if that appears to be possible. */ /* This is not completely safe, since we may mistakenly conclude that */ /* dest has a debugging wrapper. But the error probability is very */ /* small, and this shouldn't be used in production code. */ /* We assume that dest is the real base pointer. Source will usually */ /* be a pointer to the interior of an object. */ void GC_store_back_pointer(ptr_t source, ptr_t dest) { if (GC_HAS_DEBUG_INFO(dest)) { ((oh *)dest) -> oh_back_ptr = HIDE_BACK_PTR(source); } } void GC_marked_for_finalization(ptr_t dest) { GC_store_back_pointer(MARKED_FOR_FINALIZATION, dest); } /* Store information about the object referencing dest in *base_p */ /* and *offset_p. */ /* source is root ==> *base_p = address, *offset_p = 0 */ /* source is heap object ==> *base_p != 0, *offset_p = offset */ /* Returns 1 on success, 0 if source couldn't be determined. */ /* Dest can be any address within a heap object. */ GC_ref_kind GC_get_back_ptr_info(void *dest, void **base_p, size_t *offset_p) { oh * hdr = (oh *)GC_base(dest); ptr_t bp; ptr_t bp_base; if (!GC_HAS_DEBUG_INFO((ptr_t) hdr)) return GC_NO_SPACE; bp = REVEAL_POINTER(hdr -> oh_back_ptr); if (MARKED_FOR_FINALIZATION == bp) return GC_FINALIZER_REFD; if (MARKED_FROM_REGISTER == bp) return GC_REFD_FROM_REG; if (NOT_MARKED == bp) return GC_UNREFERENCED; # if ALIGNMENT == 1 /* Heuristically try to fix off by 1 errors we introduced by */ /* insisting on even addresses. */ { ptr_t alternate_ptr = bp + 1; ptr_t target = *(ptr_t *)bp; ptr_t alternate_target = *(ptr_t *)alternate_ptr; if (alternate_target >= GC_least_plausible_heap_addr && alternate_target <= GC_greatest_plausible_heap_addr && (target < GC_least_plausible_heap_addr || target > GC_greatest_plausible_heap_addr)) { bp = alternate_ptr; } } # endif bp_base = GC_base(bp); if (0 == bp_base) { *base_p = bp; *offset_p = 0; return GC_REFD_FROM_ROOT; } else { if (GC_HAS_DEBUG_INFO(bp_base)) bp_base += sizeof(oh); *base_p = bp_base; *offset_p = bp - bp_base; return GC_REFD_FROM_HEAP; } } /* Generate a random heap address. */ /* The resulting address is in the heap, but */ /* not necessarily inside a valid object. */ void *GC_generate_random_heap_address(void) { int i; long heap_offset = RANDOM(); if (GC_heapsize > RAND_MAX) { heap_offset *= RAND_MAX; heap_offset += RANDOM(); } heap_offset %= GC_heapsize; /* This doesn't yield a uniform distribution, especially if */ /* e.g. RAND_MAX = 1.5* GC_heapsize. But for typical cases, */ /* it's not too bad. */ for (i = 0; i < GC_n_heap_sects; ++ i) { size_t size = GC_heap_sects[i].hs_bytes; if (heap_offset < size) { return GC_heap_sects[i].hs_start + heap_offset; } else { heap_offset -= size; } } ABORT("GC_generate_random_heap_address: size inconsistency"); /*NOTREACHED*/ return 0; } /* Generate a random address inside a valid marked heap object. */ void *GC_generate_random_valid_address(void) { ptr_t result; ptr_t base; for (;;) { result = GC_generate_random_heap_address(); base = GC_base(result); if (0 == base) continue; if (!GC_is_marked(base)) continue; return result; } } /* Print back trace for p */ void GC_print_backtrace(void *p) { void *current = p; int i; GC_ref_kind source; size_t offset; void *base; GC_print_heap_obj(GC_base(current)); GC_err_printf("\n"); for (i = 0; ; ++i) { source = GC_get_back_ptr_info(current, &base, &offset); if (GC_UNREFERENCED == source) { GC_err_printf("Reference could not be found\n"); goto out; } if (GC_NO_SPACE == source) { GC_err_printf("No debug info in object: Can't find reference\n"); goto out; } GC_err_printf("Reachable via %d levels of pointers from ", (unsigned long)i); switch(source) { case GC_REFD_FROM_ROOT: GC_err_printf("root at %p\n\n", base); goto out; case GC_REFD_FROM_REG: GC_err_printf("root in register\n\n"); goto out; case GC_FINALIZER_REFD: GC_err_printf("list of finalizable objects\n\n"); goto out; case GC_REFD_FROM_HEAP: GC_err_printf("offset %ld in object:\n", (unsigned long)offset); /* Take GC_base(base) to get real base, i.e. header. */ GC_print_heap_obj(GC_base(base)); GC_err_printf("\n"); break; } current = base; } out:; } /* Force a garbage collection and generate a backtrace from a */ /* random heap address. */ void GC_generate_random_backtrace_no_gc(void) { void * current; current = GC_generate_random_valid_address(); GC_printf("\n****Chose address %p in object\n", current); GC_print_backtrace(current); } void GC_generate_random_backtrace(void) { GC_gcollect(); GC_generate_random_backtrace_no_gc(); } #endif /* KEEP_BACK_PTRS */ # define CROSSES_HBLK(p, sz) \ (((word)(p + sizeof(oh) + sz - 1) ^ (word)p) >= HBLKSIZE) /* Store debugging info into p. Return displaced pointer. */ /* Assumes we don't hold allocation lock. */ ptr_t GC_store_debug_info(ptr_t p, word sz, const char *string, word integer) { register word * result = (word *)((oh *)p + 1); DCL_LOCK_STATE; /* There is some argument that we should dissble signals here. */ /* But that's expensive. And this way things should only appear */ /* inconsistent while we're in the handler. */ LOCK(); GC_ASSERT(GC_size(p) >= sizeof(oh) + sz); GC_ASSERT(!(SMALL_OBJ(sz) && CROSSES_HBLK(p, sz))); # ifdef KEEP_BACK_PTRS ((oh *)p) -> oh_back_ptr = HIDE_BACK_PTR(NOT_MARKED); # endif # ifdef MAKE_BACK_GRAPH ((oh *)p) -> oh_bg_ptr = HIDE_BACK_PTR((ptr_t)0); # endif ((oh *)p) -> oh_string = string; ((oh *)p) -> oh_int = integer; # ifndef SHORT_DBG_HDRS ((oh *)p) -> oh_sz = sz; ((oh *)p) -> oh_sf = START_FLAG ^ (word)result; ((word *)p)[BYTES_TO_WORDS(GC_size(p))-1] = result[SIMPLE_ROUNDED_UP_WORDS(sz)] = END_FLAG ^ (word)result; # endif UNLOCK(); return((ptr_t)result); } #ifdef DBG_HDRS_ALL /* Store debugging info into p. Return displaced pointer. */ /* This version assumes we do hold the allocation lock. */ ptr_t GC_store_debug_info_inner(ptr_t p, word sz, char *string, word integer) { register word * result = (word *)((oh *)p + 1); /* There is some argument that we should disable signals here. */ /* But that's expensive. And this way things should only appear */ /* inconsistent while we're in the handler. */ GC_ASSERT(GC_size(p) >= sizeof(oh) + sz); GC_ASSERT(!(SMALL_OBJ(sz) && CROSSES_HBLK(p, sz))); # ifdef KEEP_BACK_PTRS ((oh *)p) -> oh_back_ptr = HIDE_BACK_PTR(NOT_MARKED); # endif # ifdef MAKE_BACK_GRAPH ((oh *)p) -> oh_bg_ptr = HIDE_BACK_PTR((ptr_t)0); # endif ((oh *)p) -> oh_string = string; ((oh *)p) -> oh_int = integer; # ifndef SHORT_DBG_HDRS ((oh *)p) -> oh_sz = sz; ((oh *)p) -> oh_sf = START_FLAG ^ (word)result; ((word *)p)[BYTES_TO_WORDS(GC_size(p))-1] = result[SIMPLE_ROUNDED_UP_WORDS(sz)] = END_FLAG ^ (word)result; # endif return((ptr_t)result); } #endif #ifndef SHORT_DBG_HDRS /* Check the object with debugging info at ohdr */ /* return NIL if it's OK. Else return clobbered */ /* address. */ ptr_t GC_check_annotated_obj(oh *ohdr) { register ptr_t body = (ptr_t)(ohdr + 1); register word gc_sz = GC_size((ptr_t)ohdr); if (ohdr -> oh_sz + DEBUG_BYTES > gc_sz) { return((ptr_t)(&(ohdr -> oh_sz))); } if (ohdr -> oh_sf != (START_FLAG ^ (word)body)) { return((ptr_t)(&(ohdr -> oh_sf))); } if (((word *)ohdr)[BYTES_TO_WORDS(gc_sz)-1] != (END_FLAG ^ (word)body)) { return((ptr_t)((word *)ohdr + BYTES_TO_WORDS(gc_sz)-1)); } if (((word *)body)[SIMPLE_ROUNDED_UP_WORDS(ohdr -> oh_sz)] != (END_FLAG ^ (word)body)) { return((ptr_t)((word *)body + SIMPLE_ROUNDED_UP_WORDS(ohdr -> oh_sz))); } return(0); } #endif /* !SHORT_DBG_HDRS */ static GC_describe_type_fn GC_describe_type_fns[MAXOBJKINDS] = {0}; void GC_register_describe_type_fn(int kind, GC_describe_type_fn fn) { GC_describe_type_fns[kind] = fn; } /* Print a type description for the object whose client-visible address */ /* is p. */ void GC_print_type(ptr_t p) { hdr * hhdr = GC_find_header(p); char buffer[GC_TYPE_DESCR_LEN + 1]; int kind = hhdr -> hb_obj_kind; if (0 != GC_describe_type_fns[kind] && GC_is_marked(GC_base(p))) { /* This should preclude free list objects except with */ /* thread-local allocation. */ buffer[GC_TYPE_DESCR_LEN] = 0; (GC_describe_type_fns[kind])(p, buffer); GC_ASSERT(buffer[GC_TYPE_DESCR_LEN] == 0); GC_err_puts(buffer); } else { switch(kind) { case PTRFREE: GC_err_puts("PTRFREE"); break; case NORMAL: GC_err_puts("NORMAL"); break; case UNCOLLECTABLE: GC_err_puts("UNCOLLECTABLE"); break; # ifdef ATOMIC_UNCOLLECTABLE case AUNCOLLECTABLE: GC_err_puts("ATOMIC UNCOLLECTABLE"); break; # endif case STUBBORN: GC_err_puts("STUBBORN"); break; default: GC_err_printf("kind %d, descr 0x%lx", kind, (unsigned long)(hhdr -> hb_descr)); } } } void GC_print_obj(ptr_t p) { register oh * ohdr = (oh *)GC_base(p); GC_ASSERT(I_DONT_HOLD_LOCK()); GC_err_printf("%p (", ((ptr_t)ohdr + sizeof(oh))); GC_err_puts(ohdr -> oh_string); # ifdef SHORT_DBG_HDRS GC_err_printf(":%ld, ", (unsigned long)(ohdr -> oh_int)); # else GC_err_printf(":%ld, sz=%ld, ", (unsigned long)(ohdr -> oh_int), (unsigned long)(ohdr -> oh_sz)); # endif GC_print_type((ptr_t)(ohdr + 1)); GC_err_puts(")\n"); PRINT_CALL_CHAIN(ohdr); } void GC_debug_print_heap_obj_proc(ptr_t p) { GC_ASSERT(I_DONT_HOLD_LOCK()); if (GC_HAS_DEBUG_INFO(p)) { GC_print_obj(p); } else { GC_default_print_heap_obj_proc(p); } } #ifndef SHORT_DBG_HDRS void GC_print_smashed_obj(ptr_t p, ptr_t clobbered_addr) { register oh * ohdr = (oh *)GC_base(p); GC_ASSERT(I_DONT_HOLD_LOCK()); GC_err_printf("%p in object at %p(", clobbered_addr, p); if (clobbered_addr <= (ptr_t)(&(ohdr -> oh_sz)) || ohdr -> oh_string == 0) { GC_err_printf(", appr. sz = %ld)\n", (GC_size((ptr_t)ohdr) - DEBUG_BYTES)); } else { if (ohdr -> oh_string[0] == '\0') { GC_err_puts("EMPTY(smashed?)"); } else { GC_err_puts(ohdr -> oh_string); } GC_err_printf(":%ld, sz=%ld)\n", (unsigned long)(ohdr -> oh_int), (unsigned long)(ohdr -> oh_sz)); PRINT_CALL_CHAIN(ohdr); } } #endif void GC_check_heap_proc (void); void GC_print_all_smashed_proc (void); void GC_do_nothing(void) {} void GC_start_debugging(void) { # ifndef SHORT_DBG_HDRS GC_check_heap = GC_check_heap_proc; GC_print_all_smashed = GC_print_all_smashed_proc; # else GC_check_heap = GC_do_nothing; GC_print_all_smashed = GC_do_nothing; # endif GC_print_heap_obj = GC_debug_print_heap_obj_proc; GC_debugging_started = TRUE; GC_register_displacement((word)sizeof(oh)); } size_t GC_debug_header_size = sizeof(oh); void GC_debug_register_displacement(size_t offset) { GC_register_displacement(offset); GC_register_displacement((word)sizeof(oh) + offset); } void * GC_debug_malloc(size_t lb, GC_EXTRA_PARAMS) { void * result = GC_malloc(lb + DEBUG_BYTES); if (result == 0) { GC_err_printf("GC_debug_malloc(%lu) returning NIL (", (unsigned long) lb); GC_err_puts(s); GC_err_printf(":%ld)\n", (unsigned long)i); return(0); } if (!GC_debugging_started) { GC_start_debugging(); } ADD_CALL_CHAIN(result, ra); return (GC_store_debug_info(result, (word)lb, s, (word)i)); } void * GC_debug_malloc_ignore_off_page(size_t lb, GC_EXTRA_PARAMS) { void * result = GC_malloc_ignore_off_page(lb + DEBUG_BYTES); if (result == 0) { GC_err_printf("GC_debug_malloc_ignore_off_page(%lu) returning NIL (", (unsigned long) lb); GC_err_puts(s); GC_err_printf(":%lu)\n", (unsigned long)i); return(0); } if (!GC_debugging_started) { GC_start_debugging(); } ADD_CALL_CHAIN(result, ra); return (GC_store_debug_info(result, (word)lb, s, (word)i)); } void * GC_debug_malloc_atomic_ignore_off_page(size_t lb, GC_EXTRA_PARAMS) { void * result = GC_malloc_atomic_ignore_off_page(lb + DEBUG_BYTES); if (result == 0) { GC_err_printf("GC_debug_malloc_atomic_ignore_off_page(%lu)" " returning NIL (", (unsigned long) lb); GC_err_puts(s); GC_err_printf(":%lu)\n", (unsigned long)i); return(0); } if (!GC_debugging_started) { GC_start_debugging(); } ADD_CALL_CHAIN(result, ra); return (GC_store_debug_info(result, (word)lb, s, (word)i)); } # ifdef DBG_HDRS_ALL /* * An allocation function for internal use. * Normally internally allocated objects do not have debug information. * But in this case, we need to make sure that all objects have debug * headers. * We assume debugging was started in collector initialization, * and we already hold the GC lock. */ void * GC_debug_generic_malloc_inner(size_t lb, int k) { void * result = GC_generic_malloc_inner(lb + DEBUG_BYTES, k); if (result == 0) { GC_err_printf("GC internal allocation (%lu bytes) returning NIL\n", (unsigned long) lb); return(0); } ADD_CALL_CHAIN(result, GC_RETURN_ADDR); return (GC_store_debug_info_inner(result, (word)lb, "INTERNAL", (word)0)); } void * GC_debug_generic_malloc_inner_ignore_off_page(size_t lb, int k) { void * result = GC_generic_malloc_inner_ignore_off_page( lb + DEBUG_BYTES, k); if (result == 0) { GC_err_printf("GC internal allocation (%lu bytes) returning NIL\n", (unsigned long) lb); return(0); } ADD_CALL_CHAIN(result, GC_RETURN_ADDR); return (GC_store_debug_info_inner(result, (word)lb, "INTERNAL", (word)0)); } # endif #ifdef STUBBORN_ALLOC void * GC_debug_malloc_stubborn(size_t lb, GC_EXTRA_PARAMS) { void * result = GC_malloc_stubborn(lb + DEBUG_BYTES); if (result == 0) { GC_err_printf("GC_debug_malloc(%lu) returning NIL (", (unsigned long) lb); GC_err_puts(s); GC_err_printf(":%lu)\n", (unsigned long)i); return(0); } if (!GC_debugging_started) { GC_start_debugging(); } ADD_CALL_CHAIN(result, ra); return (GC_store_debug_info(result, (word)lb, s, (word)i)); } void GC_debug_change_stubborn(void *p) { void * q = GC_base(p); hdr * hhdr; if (q == 0) { GC_err_printf("Bad argument: %p to GC_debug_change_stubborn\n", p); ABORT("GC_debug_change_stubborn: bad arg"); } hhdr = HDR(q); if (hhdr -> hb_obj_kind != STUBBORN) { GC_err_printf("GC_debug_change_stubborn arg not stubborn: %p\n", p); ABORT("GC_debug_change_stubborn: arg not stubborn"); } GC_change_stubborn(q); } void GC_debug_end_stubborn_change(void *p) { register void * q = GC_base(p); register hdr * hhdr; if (q == 0) { GC_err_printf("Bad argument: %p to GC_debug_end_stubborn_change\n", p); ABORT("GC_debug_end_stubborn_change: bad arg"); } hhdr = HDR(q); if (hhdr -> hb_obj_kind != STUBBORN) { GC_err_printf("debug_end_stubborn_change arg not stubborn: %p\n", p); ABORT("GC_debug_end_stubborn_change: arg not stubborn"); } GC_end_stubborn_change(q); } #else /* !STUBBORN_ALLOC */ void * GC_debug_malloc_stubborn(size_t lb, GC_EXTRA_PARAMS) { return GC_debug_malloc(lb, OPT_RA s, i); } void GC_debug_change_stubborn(void *p) { } void GC_debug_end_stubborn_change(void *p) { } #endif /* !STUBBORN_ALLOC */ void * GC_debug_malloc_atomic(size_t lb, GC_EXTRA_PARAMS) { void * result = GC_malloc_atomic(lb + DEBUG_BYTES); if (result == 0) { GC_err_printf("GC_debug_malloc_atomic(%lu) returning NIL (", (unsigned long) lb); GC_err_puts(s); GC_err_printf(":%lu)\n", (unsigned long)i); return(0); } if (!GC_debugging_started) { GC_start_debugging(); } ADD_CALL_CHAIN(result, ra); return (GC_store_debug_info(result, (word)lb, s, (word)i)); } char *GC_debug_strdup(const char *str, GC_EXTRA_PARAMS) { char *copy; if (str == NULL) return NULL; copy = GC_debug_malloc_atomic(strlen(str) + 1, OPT_RA s, i); if (copy == NULL) { errno = ENOMEM; return NULL; } strcpy(copy, str); return copy; } void * GC_debug_malloc_uncollectable(size_t lb, GC_EXTRA_PARAMS) { void * result = GC_malloc_uncollectable(lb + UNCOLLECTABLE_DEBUG_BYTES); if (result == 0) { GC_err_printf("GC_debug_malloc_uncollectable(%lu) returning NIL (", (unsigned long) lb); GC_err_puts(s); GC_err_printf(":%lu)\n", (unsigned long)i); return(0); } if (!GC_debugging_started) { GC_start_debugging(); } ADD_CALL_CHAIN(result, ra); return (GC_store_debug_info(result, (word)lb, s, (word)i)); } #ifdef ATOMIC_UNCOLLECTABLE void * GC_debug_malloc_atomic_uncollectable(size_t lb, GC_EXTRA_PARAMS) { void * result = GC_malloc_atomic_uncollectable(lb + UNCOLLECTABLE_DEBUG_BYTES); if (result == 0) { GC_err_printf( "GC_debug_malloc_atomic_uncollectable(%lu) returning NIL (", (unsigned long) lb); GC_err_puts(s); GC_err_printf(":%lu)\n", (unsigned long)i); return(0); } if (!GC_debugging_started) { GC_start_debugging(); } ADD_CALL_CHAIN(result, ra); return (GC_store_debug_info(result, (word)lb, s, (word)i)); } #endif /* ATOMIC_UNCOLLECTABLE */ void GC_debug_free(void * p) { ptr_t base; ptr_t clobbered; if (0 == p) return; base = GC_base(p); if (base == 0) { GC_err_printf("Attempt to free invalid pointer %p\n", p); ABORT("free(invalid pointer)"); } if ((ptr_t)p - (ptr_t)base != sizeof(oh)) { GC_err_printf( "GC_debug_free called on pointer %p wo debugging info\n", p); } else { # ifndef SHORT_DBG_HDRS clobbered = GC_check_annotated_obj((oh *)base); if (clobbered != 0) { if (((oh *)base) -> oh_sz == GC_size(base)) { GC_err_printf( "GC_debug_free: found previously deallocated (?) object at "); } else { GC_err_printf("GC_debug_free: found smashed location at "); } GC_print_smashed_obj(p, clobbered); } /* Invalidate size */ ((oh *)base) -> oh_sz = GC_size(base); # endif /* SHORT_DBG_HDRS */ } if (GC_find_leak) { GC_free(base); } else { hdr * hhdr = HDR(p); GC_bool uncollectable = FALSE; if (hhdr -> hb_obj_kind == UNCOLLECTABLE) { uncollectable = TRUE; } # ifdef ATOMIC_UNCOLLECTABLE if (hhdr -> hb_obj_kind == AUNCOLLECTABLE) { uncollectable = TRUE; } # endif if (uncollectable) { GC_free(base); } else { size_t i; size_t obj_sz = BYTES_TO_WORDS(hhdr -> hb_sz - sizeof(oh)); for (i = 0; i < obj_sz; ++i) ((word *)p)[i] = 0xdeadbeef; GC_ASSERT((word *)p + i == (word *)(base + hhdr -> hb_sz)); } } /* !GC_find_leak */ } #ifdef THREADS extern void GC_free_inner(void * p); /* Used internally; we assume it's called correctly. */ void GC_debug_free_inner(void * p) { GC_free_inner(GC_base(p)); } #endif void * GC_debug_realloc(void * p, size_t lb, GC_EXTRA_PARAMS) { void * base = GC_base(p); ptr_t clobbered; void * result; size_t copy_sz = lb; size_t old_sz; hdr * hhdr; if (p == 0) return(GC_debug_malloc(lb, OPT_RA s, i)); if (base == 0) { GC_err_printf("Attempt to reallocate invalid pointer %p\n", p); ABORT("realloc(invalid pointer)"); } if ((ptr_t)p - (ptr_t)base != sizeof(oh)) { GC_err_printf( "GC_debug_realloc called on pointer %p wo debugging info\n", p); return(GC_realloc(p, lb)); } hhdr = HDR(base); switch (hhdr -> hb_obj_kind) { # ifdef STUBBORN_ALLOC case STUBBORN: result = GC_debug_malloc_stubborn(lb, OPT_RA s, i); break; # endif case NORMAL: result = GC_debug_malloc(lb, OPT_RA s, i); break; case PTRFREE: result = GC_debug_malloc_atomic(lb, OPT_RA s, i); break; case UNCOLLECTABLE: result = GC_debug_malloc_uncollectable(lb, OPT_RA s, i); break; # ifdef ATOMIC_UNCOLLECTABLE case AUNCOLLECTABLE: result = GC_debug_malloc_atomic_uncollectable(lb, OPT_RA s, i); break; # endif default: GC_err_printf("GC_debug_realloc: encountered bad kind\n"); ABORT("bad kind"); } # ifdef SHORT_DBG_HDRS old_sz = GC_size(base) - sizeof(oh); # else clobbered = GC_check_annotated_obj((oh *)base); if (clobbered != 0) { GC_err_printf("GC_debug_realloc: found smashed location at "); GC_print_smashed_obj(p, clobbered); } old_sz = ((oh *)base) -> oh_sz; # endif if (old_sz < copy_sz) copy_sz = old_sz; if (result == 0) return(0); BCOPY(p, result, copy_sz); GC_debug_free(p); return(result); } #ifndef SHORT_DBG_HDRS /* List of smashed objects. We defer printing these, since we can't */ /* always print them nicely with the allocation lock held. */ /* We put them here instead of in GC_arrays, since it may be useful to */ /* be able to look at them with the debugger. */ #define MAX_SMASHED 20 ptr_t GC_smashed[MAX_SMASHED]; unsigned GC_n_smashed = 0; void GC_add_smashed(ptr_t smashed) { GC_ASSERT(GC_is_marked(GC_base(smashed))); GC_smashed[GC_n_smashed] = smashed; if (GC_n_smashed < MAX_SMASHED - 1) ++GC_n_smashed; /* In case of overflow, we keep the first MAX_SMASHED-1 */ /* entries plus the last one. */ GC_have_errors = TRUE; } /* Print all objects on the list. Clear the list. */ void GC_print_all_smashed_proc(void) { unsigned i; GC_ASSERT(I_DONT_HOLD_LOCK()); if (GC_n_smashed == 0) return; GC_err_printf("GC_check_heap_block: found smashed heap objects:\n"); for (i = 0; i < GC_n_smashed; ++i) { GC_print_smashed_obj(GC_base(GC_smashed[i]), GC_smashed[i]); GC_smashed[i] = 0; } GC_n_smashed = 0; } /* Check all marked objects in the given block for validity */ /* Avoid GC_apply_to_each_object for performance reasons. */ /*ARGSUSED*/ void GC_check_heap_block(struct hblk *hbp, word dummy) { struct hblkhdr * hhdr = HDR(hbp); size_t sz = hhdr -> hb_sz; size_t bit_no; char *p, *plim; p = hbp->hb_body; bit_no = 0; if (sz > MAXOBJBYTES) { plim = p; } else { plim = hbp->hb_body + HBLKSIZE - sz; } /* go through all words in block */ while( p <= plim ) { if( mark_bit_from_hdr(hhdr, bit_no) && GC_HAS_DEBUG_INFO((ptr_t)p)) { ptr_t clobbered = GC_check_annotated_obj((oh *)p); if (clobbered != 0) GC_add_smashed(clobbered); } bit_no += MARK_BIT_OFFSET(sz); p += sz; } } /* This assumes that all accessible objects are marked, and that */ /* I hold the allocation lock. Normally called by collector. */ void GC_check_heap_proc(void) { # ifndef SMALL_CONFIG /* Ignore gcc no effect warning on the following. */ GC_STATIC_ASSERT((sizeof(oh) & (GRANULE_BYTES - 1)) == 0); /* FIXME: Should we check for twice that alignment? */ # endif GC_apply_to_all_blocks(GC_check_heap_block, (word)0); } #endif /* !SHORT_DBG_HDRS */ struct closure { GC_finalization_proc cl_fn; void * cl_data; }; void * GC_make_closure(GC_finalization_proc fn, void * data) { struct closure * result = # ifdef DBG_HDRS_ALL (struct closure *) GC_debug_malloc(sizeof (struct closure), GC_EXTRAS); # else (struct closure *) GC_malloc(sizeof (struct closure)); # endif result -> cl_fn = fn; result -> cl_data = data; return((void *)result); } void GC_debug_invoke_finalizer(void * obj, void * data) { register struct closure * cl = (struct closure *) data; (*(cl -> cl_fn))((void *)((char *)obj + sizeof(oh)), cl -> cl_data); } /* Set ofn and ocd to reflect the values we got back. */ static void store_old (void *obj, GC_finalization_proc my_old_fn, struct closure *my_old_cd, GC_finalization_proc *ofn, void **ocd) { if (0 != my_old_fn) { if (my_old_fn != GC_debug_invoke_finalizer) { GC_err_printf("Debuggable object at %p had non-debug finalizer.\n", obj); /* This should probably be fatal. */ } else { if (ofn) *ofn = my_old_cd -> cl_fn; if (ocd) *ocd = my_old_cd -> cl_data; } } else { if (ofn) *ofn = 0; if (ocd) *ocd = 0; } } void GC_debug_register_finalizer(void * obj, GC_finalization_proc fn, void * cd, GC_finalization_proc *ofn, void * *ocd) { GC_finalization_proc my_old_fn; void * my_old_cd; ptr_t base = GC_base(obj); if (0 == base) return; if ((ptr_t)obj - base != sizeof(oh)) { GC_err_printf( "GC_debug_register_finalizer called with non-base-pointer %p\n", obj); } if (0 == fn) { GC_register_finalizer(base, 0, 0, &my_old_fn, &my_old_cd); } else { GC_register_finalizer(base, GC_debug_invoke_finalizer, GC_make_closure(fn,cd), &my_old_fn, &my_old_cd); } store_old(obj, my_old_fn, (struct closure *)my_old_cd, ofn, ocd); } void GC_debug_register_finalizer_no_order (void * obj, GC_finalization_proc fn, void * cd, GC_finalization_proc *ofn, void * *ocd) { GC_finalization_proc my_old_fn; void * my_old_cd; ptr_t base = GC_base(obj); if (0 == base) return; if ((ptr_t)obj - base != sizeof(oh)) { GC_err_printf( "GC_debug_register_finalizer_no_order called with " "non-base-pointer %p\n", obj); } if (0 == fn) { GC_register_finalizer_no_order(base, 0, 0, &my_old_fn, &my_old_cd); } else { GC_register_finalizer_no_order(base, GC_debug_invoke_finalizer, GC_make_closure(fn,cd), &my_old_fn, &my_old_cd); } store_old(obj, my_old_fn, (struct closure *)my_old_cd, ofn, ocd); } void GC_debug_register_finalizer_unreachable (void * obj, GC_finalization_proc fn, void * cd, GC_finalization_proc *ofn, void * *ocd) { GC_finalization_proc my_old_fn; void * my_old_cd; ptr_t base = GC_base(obj); if (0 == base) return; if ((ptr_t)obj - base != sizeof(oh)) { GC_err_printf( "GC_debug_register_finalizer_unreachable called with " "non-base-pointer %p\n", obj); } if (0 == fn) { GC_register_finalizer_unreachable(base, 0, 0, &my_old_fn, &my_old_cd); } else { GC_register_finalizer_unreachable(base, GC_debug_invoke_finalizer, GC_make_closure(fn,cd), &my_old_fn, &my_old_cd); } store_old(obj, my_old_fn, (struct closure *)my_old_cd, ofn, ocd); } void GC_debug_register_finalizer_ignore_self (void * obj, GC_finalization_proc fn, void * cd, GC_finalization_proc *ofn, void * *ocd) { GC_finalization_proc my_old_fn; void * my_old_cd; ptr_t base = GC_base(obj); if (0 == base) return; if ((ptr_t)obj - base != sizeof(oh)) { GC_err_printf( "GC_debug_register_finalizer_ignore_self called with " "non-base-pointer %p\n", obj); } if (0 == fn) { GC_register_finalizer_ignore_self(base, 0, 0, &my_old_fn, &my_old_cd); } else { GC_register_finalizer_ignore_self(base, GC_debug_invoke_finalizer, GC_make_closure(fn,cd), &my_old_fn, &my_old_cd); } store_old(obj, my_old_fn, (struct closure *)my_old_cd, ofn, ocd); } #ifdef GC_ADD_CALLER # define RA GC_RETURN_ADDR, #else # define RA #endif void * GC_debug_malloc_replacement(size_t lb) { return GC_debug_malloc(lb, RA "unknown", 0); } void * GC_debug_realloc_replacement(void *p, size_t lb) { return GC_debug_realloc(p, lb, RA "unknown", 0); } synopsis-0.12/src/Synopsis/gc/cord/0000775000076400007640000000000011172123233016610 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/cord/cord.am0000664000076400007640000000064011104702321020052 0ustar stefanstefan lib_LTLIBRARIES += libcord.la libcord_la_LIBADD = $(top_builddir)/libgc.la libcord_la_LDFLAGS = -version-info 1:3:0 -no-undefined libcord_la_SOURCES = \ cord/cordbscs.c \ cord/cordprnt.c \ cord/cordtest.c \ cord/cordxtra.c EXTRA_DIST += \ cord/cordbscs.c cord/cordtest.c cord/de.c \ cord/cordprnt.c cord/cordxtra.c cord/de_cmds.h \ cord/de_win.h cord/de_win.c cord/de_win.RC cord/de_win.ICO synopsis-0.12/src/Synopsis/gc/cord/de_cmds.h0000664000076400007640000000170011104702320020350 0ustar stefanstefan/* * Copyright (c) 1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* Boehm, May 19, 1994 2:24 pm PDT */ #ifndef DE_CMDS_H # define DE_CMDS_H # define UP 16 /* ^P */ # define DOWN 14 /* ^N */ # define LEFT 2 /* ^B */ # define RIGHT 6 /* ^F */ # define DEL 127 /* ^? */ # define BS 8 /* ^H */ # define UNDO 21 /* ^U */ # define WRITE 23 /* ^W */ # define QUIT 4 /* ^D */ # define REPEAT 18 /* ^R */ # define LOCATE 12 /* ^L */ # define TOP 20 /* ^T */ #endif synopsis-0.12/src/Synopsis/gc/cord/de_win.c0000664000076400007640000002464711104702320020231 0ustar stefanstefan/* * Copyright (c) 1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* Boehm, February 6, 1995 12:29 pm PST */ /* * The MS Windows specific part of de. * This started as the generic Windows application template * made available by Rob Haack (rhaack@polaris.unm.edu), but * significant parts didn't survive to the final version. * * This was written by a nonexpert windows programmer. */ #include "windows.h" #include "gc.h" #include "cord.h" #include "de_cmds.h" #include "de_win.h" int LINES = 0; int COLS = 0; char szAppName[] = "DE"; char FullAppName[] = "Demonstration Editor"; HWND hwnd; void de_error(char *s) { MessageBox( hwnd, (LPSTR) s, (LPSTR) FullAppName, MB_ICONINFORMATION | MB_OK ); InvalidateRect(hwnd, NULL, TRUE); } int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR command_line, int nCmdShow) { MSG msg; WNDCLASS wndclass; HANDLE hAccel; # ifdef THREAD_LOCAL_ALLOC GC_INIT(); /* Required if GC is built with THREAD_LOCAL_ALLOC */ /* Always safe, but this is used as a GC test. */ # endif if (!hPrevInstance) { wndclass.style = CS_HREDRAW | CS_VREDRAW; wndclass.lpfnWndProc = WndProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = DLGWINDOWEXTRA; wndclass.hInstance = hInstance; wndclass.hIcon = LoadIcon (hInstance, szAppName); wndclass.hCursor = LoadCursor (NULL, IDC_ARROW); wndclass.hbrBackground = GetStockObject(WHITE_BRUSH); wndclass.lpszMenuName = "DE"; wndclass.lpszClassName = szAppName; if (RegisterClass (&wndclass) == 0) { char buf[50]; sprintf(buf, "RegisterClass: error code: 0x%X", GetLastError()); de_error(buf); return(0); } } /* Empirically, the command line does not include the command name ... if (command_line != 0) { while (isspace(*command_line)) command_line++; while (*command_line != 0 && !isspace(*command_line)) command_line++; while (isspace(*command_line)) command_line++; } */ if (command_line == 0 || *command_line == 0) { de_error("File name argument required"); return( 0 ); } else { char *p = command_line; while (*p != 0 && !isspace(*p)) p++; arg_file_name = CORD_to_char_star( CORD_substr(command_line, 0, p - command_line)); } hwnd = CreateWindow (szAppName, FullAppName, WS_OVERLAPPEDWINDOW | WS_CAPTION, /* Window style */ CW_USEDEFAULT, 0, /* default pos. */ CW_USEDEFAULT, 0, /* default width, height */ NULL, /* No parent */ NULL, /* Window class menu */ hInstance, NULL); if (hwnd == NULL) { char buf[50]; sprintf(buf, "CreateWindow: error code: 0x%X", GetLastError()); de_error(buf); return(0); } ShowWindow (hwnd, nCmdShow); hAccel = LoadAccelerators( hInstance, szAppName ); while (GetMessage (&msg, NULL, 0, 0)) { if( !TranslateAccelerator( hwnd, hAccel, &msg ) ) { TranslateMessage (&msg); DispatchMessage (&msg); } } return msg.wParam; } /* Return the argument with all control characters replaced by blanks. */ char * plain_chars(char * text, size_t len) { char * result = GC_MALLOC_ATOMIC(len + 1); register size_t i; for (i = 0; i < len; i++) { if (iscntrl(text[i])) { result[i] = ' '; } else { result[i] = text[i]; } } result[len] = '\0'; return(result); } /* Return the argument with all non-control-characters replaced by */ /* blank, and all control characters c replaced by c + 32. */ char * control_chars(char * text, size_t len) { char * result = GC_MALLOC_ATOMIC(len + 1); register size_t i; for (i = 0; i < len; i++) { if (iscntrl(text[i])) { result[i] = text[i] + 0x40; } else { result[i] = ' '; } } result[len] = '\0'; return(result); } int char_width; int char_height; void get_line_rect(int line, int win_width, RECT * rectp) { rectp -> top = line * char_height; rectp -> bottom = rectp->top + char_height; rectp -> left = 0; rectp -> right = win_width; } int caret_visible = 0; /* Caret is currently visible. */ int screen_was_painted = 0;/* Screen has been painted at least once. */ void update_cursor(void); INT_PTR CALLBACK AboutBoxCallback( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) { switch( message ) { case WM_INITDIALOG: SetFocus( GetDlgItem( hDlg, IDOK ) ); break; case WM_COMMAND: switch( wParam ) { case IDOK: EndDialog( hDlg, TRUE ); break; } break; case WM_CLOSE: EndDialog( hDlg, TRUE ); return TRUE; } return FALSE; } LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static HANDLE hInstance; HDC dc; PAINTSTRUCT ps; RECT client_area; RECT this_line; RECT dummy; TEXTMETRIC tm; register int i; int id; switch (message) { case WM_CREATE: hInstance = ( (LPCREATESTRUCT) lParam)->hInstance; dc = GetDC(hwnd); SelectObject(dc, GetStockObject(SYSTEM_FIXED_FONT)); GetTextMetrics(dc, &tm); ReleaseDC(hwnd, dc); char_width = tm.tmAveCharWidth; char_height = tm.tmHeight + tm.tmExternalLeading; GetClientRect(hwnd, &client_area); COLS = (client_area.right - client_area.left)/char_width; LINES = (client_area.bottom - client_area.top)/char_height; generic_init(); return(0); case WM_CHAR: if (wParam == QUIT) { SendMessage( hwnd, WM_CLOSE, 0, 0L ); } else { do_command((int)wParam); } return(0); case WM_SETFOCUS: CreateCaret(hwnd, NULL, char_width, char_height); ShowCaret(hwnd); caret_visible = 1; update_cursor(); return(0); case WM_KILLFOCUS: HideCaret(hwnd); DestroyCaret(); caret_visible = 0; return(0); case WM_LBUTTONUP: { unsigned xpos = LOWORD(lParam); /* From left */ unsigned ypos = HIWORD(lParam); /* from top */ set_position( xpos/char_width, ypos/char_height ); return(0); } case WM_COMMAND: id = LOWORD(wParam); if (id & EDIT_CMD_FLAG) { if (id & REPEAT_FLAG) do_command(REPEAT); do_command(CHAR_CMD(id)); return( 0 ); } else { switch(id) { case IDM_FILEEXIT: SendMessage( hwnd, WM_CLOSE, 0, 0L ); return( 0 ); case IDM_HELPABOUT: if( DialogBox( hInstance, "ABOUTBOX", hwnd, AboutBoxCallback ) ) InvalidateRect( hwnd, NULL, TRUE ); return( 0 ); case IDM_HELPCONTENTS: de_error( "Cursor keys: ^B(left) ^F(right) ^P(up) ^N(down)\n" "Undo: ^U Write: ^W Quit:^D Repeat count: ^R[n]\n" "Top: ^T Locate (search, find): ^L text ^L\n"); return( 0 ); } } break; case WM_CLOSE: DestroyWindow( hwnd ); return 0; case WM_DESTROY: PostQuitMessage (0); GC_win32_free_heap(); return 0; case WM_PAINT: dc = BeginPaint(hwnd, &ps); GetClientRect(hwnd, &client_area); COLS = (client_area.right - client_area.left)/char_width; LINES = (client_area.bottom - client_area.top)/char_height; SelectObject(dc, GetStockObject(SYSTEM_FIXED_FONT)); for (i = 0; i < LINES; i++) { get_line_rect(i, client_area.right, &this_line); if (IntersectRect(&dummy, &this_line, &ps.rcPaint)) { CORD raw_line = retrieve_screen_line(i); size_t len = CORD_len(raw_line); char * text = CORD_to_char_star(raw_line); /* May contain embedded NULLs */ char * plain = plain_chars(text, len); char * blanks = CORD_to_char_star(CORD_chars(' ', COLS - len)); char * control = control_chars(text, len); # define RED RGB(255,0,0) SetBkMode(dc, OPAQUE); SetTextColor(dc, GetSysColor(COLOR_WINDOWTEXT)); TextOut(dc, this_line.left, this_line.top, plain, (int)len); TextOut(dc, this_line.left + (int)len * char_width, this_line.top, blanks, (int)(COLS - len)); SetBkMode(dc, TRANSPARENT); SetTextColor(dc, RED); TextOut(dc, this_line.left, this_line.top, control, (int)strlen(control)); } } EndPaint(hwnd, &ps); screen_was_painted = 1; return 0; } return DefWindowProc (hwnd, message, wParam, lParam); } int last_col; int last_line; void move_cursor(int c, int l) { last_col = c; last_line = l; if (caret_visible) update_cursor(); } void update_cursor(void) { SetCaretPos(last_col * char_width, last_line * char_height); ShowCaret(hwnd); } void invalidate_line(int i) { RECT line; if (!screen_was_painted) return; /* Invalidating a rectangle before painting seems result in a */ /* major performance problem. */ get_line_rect(i, COLS*char_width, &line); InvalidateRect(hwnd, &line, FALSE); } synopsis-0.12/src/Synopsis/gc/cord/de_win.h0000664000076400007640000000537511104702320020233 0ustar stefanstefan/* * Copyright (c) 1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* Boehm, May 19, 1994 2:25 pm PDT */ /* cord.h, de_cmds.h, and windows.h should be included before this. */ # define OTHER_FLAG 0x100 # define EDIT_CMD_FLAG 0x200 # define REPEAT_FLAG 0x400 # define CHAR_CMD(i) ((i) & 0xff) /* MENU: DE */ #define IDM_FILESAVE (EDIT_CMD_FLAG + WRITE) #define IDM_FILEEXIT (OTHER_FLAG + 1) #define IDM_HELPABOUT (OTHER_FLAG + 2) #define IDM_HELPCONTENTS (OTHER_FLAG + 3) #define IDM_EDITPDOWN (REPEAT_FLAG + EDIT_CMD_FLAG + DOWN) #define IDM_EDITPUP (REPEAT_FLAG + EDIT_CMD_FLAG + UP) #define IDM_EDITUNDO (EDIT_CMD_FLAG + UNDO) #define IDM_EDITLOCATE (EDIT_CMD_FLAG + LOCATE) #define IDM_EDITDOWN (EDIT_CMD_FLAG + DOWN) #define IDM_EDITUP (EDIT_CMD_FLAG + UP) #define IDM_EDITLEFT (EDIT_CMD_FLAG + LEFT) #define IDM_EDITRIGHT (EDIT_CMD_FLAG + RIGHT) #define IDM_EDITBS (EDIT_CMD_FLAG + BS) #define IDM_EDITDEL (EDIT_CMD_FLAG + DEL) #define IDM_EDITREPEAT (EDIT_CMD_FLAG + REPEAT) #define IDM_EDITTOP (EDIT_CMD_FLAG + TOP) /* Windows UI stuff */ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, UINT wParam, LONG lParam); LRESULT CALLBACK AboutBox( HWND hDlg, UINT message, UINT wParam, LONG lParam ); /* Screen dimensions. Maintained by de_win.c. */ extern int LINES; extern int COLS; /* File being edited. */ extern char * arg_file_name; /* Current display position in file. Maintained by de.c */ extern int dis_line; extern int dis_col; /* Current cursor position in file. */ extern int line; extern int col; /* * Calls from de_win.c to de.c */ CORD retrieve_screen_line(int i); /* Get the contents of i'th screen line. */ /* Relies on COLS. */ void set_position(int x, int y); /* Set column, row. Upper left of window = (0,0). */ void do_command(int); /* Execute an editor command. */ /* Agument is a command character or one */ /* of the IDM_ commands. */ void generic_init(void); /* OS independent initialization */ /* * Calls from de.c to de_win.c */ void move_cursor(int column, int line); /* Physically move the cursor on the display, */ /* so that it appears at */ /* (column, line). */ void invalidate_line(int line); /* Invalidate line i on the screen. */ void de_error(char *s); /* Display error message. */synopsis-0.12/src/Synopsis/gc/cord/de.c0000664000076400007640000004052011104702320017340 0ustar stefanstefan/* * Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * * Author: Hans-J. Boehm (boehm@parc.xerox.com) */ /* * A really simple-minded text editor based on cords. * Things it does right: * No size bounds. * Inbounded undo. * Shouldn't crash no matter what file you invoke it on (e.g. /vmunix) * (Make sure /vmunix is not writable before you try this.) * Scrolls horizontally. * Things it does wrong: * It doesn't handle tabs reasonably (use "expand" first). * The command set is MUCH too small. * The redisplay algorithm doesn't let curses do the scrolling. * The rule for moving the window over the file is suboptimal. */ /* Boehm, February 6, 1995 12:27 pm PST */ /* Boehm, May 19, 1994 2:20 pm PDT */ #include #include "gc.h" #include "cord.h" #ifdef THINK_C #define MACINTOSH #include #endif #if defined(__BORLANDC__) && !defined(WIN32) /* If this is DOS or win16, we'll fail anyway. */ /* Might as well assume win32. */ # define WIN32 #endif #if defined(WIN32) # include # include "de_win.h" #elif defined(MACINTOSH) # include /* curses emulation. */ # define initscr() # define endwin() # define nonl() # define noecho() csetmode(C_NOECHO, stdout) # define cbreak() csetmode(C_CBREAK, stdout) # define refresh() # define addch(c) putchar(c) # define standout() cinverse(1, stdout) # define standend() cinverse(0, stdout) # define move(line,col) cgotoxy(col + 1, line + 1, stdout) # define clrtoeol() ccleol(stdout) # define de_error(s) { fprintf(stderr, s); getchar(); } # define LINES 25 # define COLS 80 #else # include # define de_error(s) { fprintf(stderr, s); sleep(2); } #endif #include "de_cmds.h" /* List of line number to position mappings, in descending order. */ /* There may be holes. */ typedef struct LineMapRep { int line; size_t pos; struct LineMapRep * previous; } * line_map; /* List of file versions, one per edit operation */ typedef struct HistoryRep { CORD file_contents; struct HistoryRep * previous; line_map map; /* Invalid for first record "now" */ } * history; history now = 0; CORD current; /* == now -> file_contents. */ size_t current_len; /* Current file length. */ line_map current_map = 0; /* Current line no. to pos. map */ size_t current_map_size = 0; /* Number of current_map entries. */ /* Not always accurate, but reset */ /* by prune_map. */ # define MAX_MAP_SIZE 3000 /* Current display position */ int dis_line = 0; int dis_col = 0; # define ALL -1 # define NONE - 2 int need_redisplay = 0; /* Line that needs to be redisplayed. */ /* Current cursor position. Always within file. */ int line = 0; int col = 0; size_t file_pos = 0; /* Character position corresponding to cursor. */ /* Invalidate line map for lines > i */ void invalidate_map(int i) { while(current_map -> line > i) { current_map = current_map -> previous; current_map_size--; } } /* Reduce the number of map entries to save space for huge files. */ /* This also affects maps in histories. */ void prune_map() { line_map map = current_map; int start_line = map -> line; current_map_size = 0; for(; map != 0; map = map -> previous) { current_map_size++; if (map -> line < start_line - LINES && map -> previous != 0) { map -> previous = map -> previous -> previous; } } } /* Add mapping entry */ void add_map(int line, size_t pos) { line_map new_map = GC_NEW(struct LineMapRep); if (current_map_size >= MAX_MAP_SIZE) prune_map(); new_map -> line = line; new_map -> pos = pos; new_map -> previous = current_map; current_map = new_map; current_map_size++; } /* Return position of column *c of ith line in */ /* current file. Adjust *c to be within the line.*/ /* A 0 pointer is taken as 0 column. */ /* Returns CORD_NOT_FOUND if i is too big. */ /* Assumes i > dis_line. */ size_t line_pos(int i, int *c) { int j; size_t cur; size_t next; line_map map = current_map; while (map -> line > i) map = map -> previous; if (map -> line < i - 2) /* rebuild */ invalidate_map(i); for (j = map -> line, cur = map -> pos; j < i;) { cur = CORD_chr(current, cur, '\n'); if (cur == current_len-1) return(CORD_NOT_FOUND); cur++; if (++j > current_map -> line) add_map(j, cur); } if (c != 0) { next = CORD_chr(current, cur, '\n'); if (next == CORD_NOT_FOUND) next = current_len - 1; if (next < cur + *c) { *c = next - cur; } cur += *c; } return(cur); } void add_hist(CORD s) { history new_file = GC_NEW(struct HistoryRep); new_file -> file_contents = current = s; current_len = CORD_len(s); new_file -> previous = now; if (now != 0) now -> map = current_map; now = new_file; } void del_hist(void) { now = now -> previous; current = now -> file_contents; current_map = now -> map; current_len = CORD_len(current); } /* Current screen_contents; a dynamically allocated array of CORDs */ CORD * screen = 0; int screen_size = 0; # ifndef WIN32 /* Replace a line in the curses stdscr. All control characters are */ /* displayed as upper case characters in standout mode. This isn't */ /* terribly appropriate for tabs. */ void replace_line(int i, CORD s) { register int c; CORD_pos p; size_t len = CORD_len(s); if (screen == 0 || LINES > screen_size) { screen_size = LINES; screen = (CORD *)GC_MALLOC(screen_size * sizeof(CORD)); } # if !defined(MACINTOSH) /* A gross workaround for an apparent curses bug: */ if (i == LINES-1 && len == COLS) { s = CORD_substr(s, 0, CORD_len(s) - 1); } # endif if (CORD_cmp(screen[i], s) != 0) { move(i, 0); clrtoeol(); move(i,0); CORD_FOR (p, s) { c = CORD_pos_fetch(p) & 0x7f; if (iscntrl(c)) { standout(); addch(c + 0x40); standend(); } else { addch(c); } } screen[i] = s; } } #else # define replace_line(i,s) invalidate_line(i) #endif /* Return up to COLS characters of the line of s starting at pos, */ /* returning only characters after the given column. */ CORD retrieve_line(CORD s, size_t pos, unsigned column) { CORD candidate = CORD_substr(s, pos, column + COLS); /* avoids scanning very long lines */ int eol = CORD_chr(candidate, 0, '\n'); int len; if (eol == CORD_NOT_FOUND) eol = CORD_len(candidate); len = (int)eol - (int)column; if (len < 0) len = 0; return(CORD_substr(s, pos + column, len)); } # ifdef WIN32 # define refresh(); CORD retrieve_screen_line(int i) { register size_t pos; invalidate_map(dis_line + LINES); /* Prune search */ pos = line_pos(dis_line + i, 0); if (pos == CORD_NOT_FOUND) return(CORD_EMPTY); return(retrieve_line(current, pos, dis_col)); } # endif /* Display the visible section of the current file */ void redisplay(void) { register int i; invalidate_map(dis_line + LINES); /* Prune search */ for (i = 0; i < LINES; i++) { if (need_redisplay == ALL || need_redisplay == i) { register size_t pos = line_pos(dis_line + i, 0); if (pos == CORD_NOT_FOUND) break; replace_line(i, retrieve_line(current, pos, dis_col)); if (need_redisplay == i) goto done; } } for (; i < LINES; i++) replace_line(i, CORD_EMPTY); done: refresh(); need_redisplay = NONE; } int dis_granularity; /* Update dis_line, dis_col, and dis_pos to make cursor visible. */ /* Assumes line, col, dis_line, dis_pos are in bounds. */ void normalize_display() { int old_line = dis_line; int old_col = dis_col; dis_granularity = 1; if (LINES > 15 && COLS > 15) dis_granularity = 2; while (dis_line > line) dis_line -= dis_granularity; while (dis_col > col) dis_col -= dis_granularity; while (line >= dis_line + LINES) dis_line += dis_granularity; while (col >= dis_col + COLS) dis_col += dis_granularity; if (old_line != dis_line || old_col != dis_col) { need_redisplay = ALL; } } # if defined(WIN32) # elif defined(MACINTOSH) # define move_cursor(x,y) cgotoxy(x + 1, y + 1, stdout) # else # define move_cursor(x,y) move(y,x) # endif /* Adjust display so that cursor is visible; move cursor into position */ /* Update screen if necessary. */ void fix_cursor(void) { normalize_display(); if (need_redisplay != NONE) redisplay(); move_cursor(col - dis_col, line - dis_line); refresh(); # ifndef WIN32 fflush(stdout); # endif } /* Make sure line, col, and dis_pos are somewhere inside file. */ /* Recompute file_pos. Assumes dis_pos is accurate or past eof */ void fix_pos() { int my_col = col; if ((size_t)line > current_len) line = current_len; file_pos = line_pos(line, &my_col); if (file_pos == CORD_NOT_FOUND) { for (line = current_map -> line, file_pos = current_map -> pos; file_pos < current_len; line++, file_pos = CORD_chr(current, file_pos, '\n') + 1); line--; file_pos = line_pos(line, &col); } else { col = my_col; } } #if defined(WIN32) # define beep() Beep(1000 /* Hz */, 300 /* msecs */) #elif defined(MACINTOSH) # define beep() SysBeep(1) #else /* * beep() is part of some curses packages and not others. * We try to match the type of the builtin one, if any. */ #ifdef __STDC__ int beep(void) #else int beep() #endif { putc('\007', stderr); return(0); } #endif # define NO_PREFIX -1 # define BARE_PREFIX -2 int repeat_count = NO_PREFIX; /* Current command prefix. */ int locate_mode = 0; /* Currently between 2 ^Ls */ CORD locate_string = CORD_EMPTY; /* Current search string. */ char * arg_file_name; #ifdef WIN32 /* Change the current position to whatever is currently displayed at */ /* the given SCREEN coordinates. */ void set_position(int c, int l) { line = l + dis_line; col = c + dis_col; fix_pos(); move_cursor(col - dis_col, line - dis_line); } #endif /* WIN32 */ /* Perform the command associated with character c. C may be an */ /* integer > 256 denoting a windows command, one of the above control */ /* characters, or another ASCII character to be used as either a */ /* character to be inserted, a repeat count, or a search string, */ /* depending on the current state. */ void do_command(int c) { int i; int need_fix_pos; FILE * out; if ( c == '\r') c = '\n'; if (locate_mode) { size_t new_pos; if (c == LOCATE) { locate_mode = 0; locate_string = CORD_EMPTY; return; } locate_string = CORD_cat_char(locate_string, (char)c); new_pos = CORD_str(current, file_pos - CORD_len(locate_string) + 1, locate_string); if (new_pos != CORD_NOT_FOUND) { need_redisplay = ALL; new_pos += CORD_len(locate_string); for (;;) { file_pos = line_pos(line + 1, 0); if (file_pos > new_pos) break; line++; } col = new_pos - line_pos(line, 0); file_pos = new_pos; fix_cursor(); } else { locate_string = CORD_substr(locate_string, 0, CORD_len(locate_string) - 1); beep(); } return; } if (c == REPEAT) { repeat_count = BARE_PREFIX; return; } else if (c < 0x100 && isdigit(c)){ if (repeat_count == BARE_PREFIX) { repeat_count = c - '0'; return; } else if (repeat_count != NO_PREFIX) { repeat_count = 10 * repeat_count + c - '0'; return; } } if (repeat_count == NO_PREFIX) repeat_count = 1; if (repeat_count == BARE_PREFIX && (c == UP || c == DOWN)) { repeat_count = LINES - dis_granularity; } if (repeat_count == BARE_PREFIX) repeat_count = 8; need_fix_pos = 0; for (i = 0; i < repeat_count; i++) { switch(c) { case LOCATE: locate_mode = 1; break; case TOP: line = col = file_pos = 0; break; case UP: if (line != 0) { line--; need_fix_pos = 1; } break; case DOWN: line++; need_fix_pos = 1; break; case LEFT: if (col != 0) { col--; file_pos--; } break; case RIGHT: if (CORD_fetch(current, file_pos) == '\n') break; col++; file_pos++; break; case UNDO: del_hist(); need_redisplay = ALL; need_fix_pos = 1; break; case BS: if (col == 0) { beep(); break; } col--; file_pos--; /* fall through: */ case DEL: if (file_pos == current_len-1) break; /* Can't delete trailing newline */ if (CORD_fetch(current, file_pos) == '\n') { need_redisplay = ALL; need_fix_pos = 1; } else { need_redisplay = line - dis_line; } add_hist(CORD_cat( CORD_substr(current, 0, file_pos), CORD_substr(current, file_pos+1, current_len))); invalidate_map(line); break; case WRITE: { CORD name = CORD_cat(CORD_from_char_star(arg_file_name), ".new"); if ((out = fopen(CORD_to_const_char_star(name), "wb")) == NULL || CORD_put(current, out) == EOF) { de_error("Write failed\n"); need_redisplay = ALL; } else { fclose(out); } } break; default: { CORD left_part = CORD_substr(current, 0, file_pos); CORD right_part = CORD_substr(current, file_pos, current_len); add_hist(CORD_cat(CORD_cat_char(left_part, (char)c), right_part)); invalidate_map(line); if (c == '\n') { col = 0; line++; file_pos++; need_redisplay = ALL; } else { col++; file_pos++; need_redisplay = line - dis_line; } break; } } } if (need_fix_pos) fix_pos(); fix_cursor(); repeat_count = NO_PREFIX; } /* OS independent initialization */ void generic_init(void) { FILE * f; CORD initial; if ((f = fopen(arg_file_name, "rb")) == NULL) { initial = "\n"; } else { initial = CORD_from_file(f); if (initial == CORD_EMPTY || CORD_fetch(initial, CORD_len(initial)-1) != '\n') { initial = CORD_cat(initial, "\n"); } } add_map(0,0); add_hist(initial); now -> map = current_map; now -> previous = now; /* Can't back up further: beginning of the world */ need_redisplay = ALL; fix_cursor(); } #ifndef WIN32 main(argc, argv) int argc; char ** argv; { int c; #if defined(MACINTOSH) console_options.title = "\pDumb Editor"; cshow(stdout); argc = ccommand(&argv); #endif GC_INIT(); if (argc != 2) goto usage; arg_file_name = argv[1]; setvbuf(stdout, GC_MALLOC_ATOMIC(8192), _IOFBF, 8192); initscr(); noecho(); nonl(); cbreak(); generic_init(); while ((c = getchar()) != QUIT) { if (c == EOF) break; do_command(c); } done: move(LINES-1, 0); clrtoeol(); refresh(); nl(); echo(); endwin(); exit(0); usage: fprintf(stderr, "Usage: %s file\n", argv[0]); fprintf(stderr, "Cursor keys: ^B(left) ^F(right) ^P(up) ^N(down)\n"); fprintf(stderr, "Undo: ^U Write to .new: ^W"); fprintf(stderr, "Quit:^D Repeat count: ^R[n]\n"); fprintf(stderr, "Top: ^T Locate (search, find): ^L text ^L\n"); exit(1); } #endif /* !WIN32 */ synopsis-0.12/src/Synopsis/gc/cord/cordxtra.c0000664000076400007640000004146711104702320020611 0ustar stefanstefan/* * Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * * Author: Hans-J. Boehm (boehm@parc.xerox.com) */ /* * These are functions on cords that do not need to understand their * implementation. They serve also serve as example client code for * cord_basics. */ /* Boehm, December 8, 1995 1:53 pm PST */ # include # include # include # include # include "cord.h" # include "ec.h" # define I_HIDE_POINTERS /* So we get access to allocation lock. */ /* We use this for lazy file reading, */ /* so that we remain independent */ /* of the threads primitives. */ # include "gc.h" /* For now we assume that pointer reads and writes are atomic, */ /* i.e. another thread always sees the state before or after */ /* a write. This might be false on a Motorola M68K with */ /* pointers that are not 32-bit aligned. But there probably */ /* aren't too many threads packages running on those. */ # define ATOMIC_WRITE(x,y) (x) = (y) # define ATOMIC_READ(x) (*(x)) /* The standard says these are in stdio.h, but they aren't always: */ # ifndef SEEK_SET # define SEEK_SET 0 # endif # ifndef SEEK_END # define SEEK_END 2 # endif # define BUFSZ 2048 /* Size of stack allocated buffers when */ /* we want large buffers. */ typedef void (* oom_fn)(void); # define OUT_OF_MEMORY { if (CORD_oom_fn != (oom_fn) 0) (*CORD_oom_fn)(); \ ABORT("Out of memory\n"); } # define ABORT(msg) { fprintf(stderr, "%s\n", msg); abort(); } CORD CORD_cat_char(CORD x, char c) { register char * string; if (c == '\0') return(CORD_cat(x, CORD_nul(1))); string = GC_MALLOC_ATOMIC(2); if (string == 0) OUT_OF_MEMORY; string[0] = c; string[1] = '\0'; return(CORD_cat_char_star(x, string, 1)); } CORD CORD_catn(int nargs, ...) { register CORD result = CORD_EMPTY; va_list args; register int i; va_start(args, nargs); for (i = 0; i < nargs; i++) { register CORD next = va_arg(args, CORD); result = CORD_cat(result, next); } va_end(args); return(result); } typedef struct { size_t len; size_t count; char * buf; } CORD_fill_data; int CORD_fill_proc(char c, void * client_data) { register CORD_fill_data * d = (CORD_fill_data *)client_data; register size_t count = d -> count; (d -> buf)[count] = c; d -> count = ++count; if (count >= d -> len) { return(1); } else { return(0); } } int CORD_batched_fill_proc(const char * s, void * client_data) { register CORD_fill_data * d = (CORD_fill_data *)client_data; register size_t count = d -> count; register size_t max = d -> len; register char * buf = d -> buf; register const char * t = s; while((buf[count] = *t++) != '\0') { count++; if (count >= max) { d -> count = count; return(1); } } d -> count = count; return(0); } /* Fill buf with len characters starting at i. */ /* Assumes len characters are available. */ void CORD_fill_buf(CORD x, size_t i, size_t len, char * buf) { CORD_fill_data fd; fd.len = len; fd.buf = buf; fd.count = 0; (void)CORD_iter5(x, i, CORD_fill_proc, CORD_batched_fill_proc, &fd); } int CORD_cmp(CORD x, CORD y) { CORD_pos xpos; CORD_pos ypos; register size_t avail, yavail; if (y == CORD_EMPTY) return(x != CORD_EMPTY); if (x == CORD_EMPTY) return(-1); if (CORD_IS_STRING(y) && CORD_IS_STRING(x)) return(strcmp(x,y)); CORD_set_pos(xpos, x, 0); CORD_set_pos(ypos, y, 0); for(;;) { if (!CORD_pos_valid(xpos)) { if (CORD_pos_valid(ypos)) { return(-1); } else { return(0); } } if (!CORD_pos_valid(ypos)) { return(1); } if ((avail = CORD_pos_chars_left(xpos)) <= 0 || (yavail = CORD_pos_chars_left(ypos)) <= 0) { register char xcurrent = CORD_pos_fetch(xpos); register char ycurrent = CORD_pos_fetch(ypos); if (xcurrent != ycurrent) return(xcurrent - ycurrent); CORD_next(xpos); CORD_next(ypos); } else { /* process as many characters as we can */ register int result; if (avail > yavail) avail = yavail; result = strncmp(CORD_pos_cur_char_addr(xpos), CORD_pos_cur_char_addr(ypos), avail); if (result != 0) return(result); CORD_pos_advance(xpos, avail); CORD_pos_advance(ypos, avail); } } } int CORD_ncmp(CORD x, size_t x_start, CORD y, size_t y_start, size_t len) { CORD_pos xpos; CORD_pos ypos; register size_t count; register long avail, yavail; CORD_set_pos(xpos, x, x_start); CORD_set_pos(ypos, y, y_start); for(count = 0; count < len;) { if (!CORD_pos_valid(xpos)) { if (CORD_pos_valid(ypos)) { return(-1); } else { return(0); } } if (!CORD_pos_valid(ypos)) { return(1); } if ((avail = CORD_pos_chars_left(xpos)) <= 0 || (yavail = CORD_pos_chars_left(ypos)) <= 0) { register char xcurrent = CORD_pos_fetch(xpos); register char ycurrent = CORD_pos_fetch(ypos); if (xcurrent != ycurrent) return(xcurrent - ycurrent); CORD_next(xpos); CORD_next(ypos); count++; } else { /* process as many characters as we can */ register int result; if (avail > yavail) avail = yavail; count += avail; if (count > len) avail -= (count - len); result = strncmp(CORD_pos_cur_char_addr(xpos), CORD_pos_cur_char_addr(ypos), (size_t)avail); if (result != 0) return(result); CORD_pos_advance(xpos, (size_t)avail); CORD_pos_advance(ypos, (size_t)avail); } } return(0); } char * CORD_to_char_star(CORD x) { register size_t len = CORD_len(x); char * result = GC_MALLOC_ATOMIC(len + 1); if (result == 0) OUT_OF_MEMORY; CORD_fill_buf(x, 0, len, result); result[len] = '\0'; return(result); } CORD CORD_from_char_star(const char *s) { char * result; size_t len = strlen(s); if (0 == len) return(CORD_EMPTY); result = GC_MALLOC_ATOMIC(len + 1); if (result == 0) OUT_OF_MEMORY; memcpy(result, s, len+1); return(result); } const char * CORD_to_const_char_star(CORD x) { if (x == 0) return(""); if (CORD_IS_STRING(x)) return((const char *)x); return(CORD_to_char_star(x)); } char CORD_fetch(CORD x, size_t i) { CORD_pos xpos; CORD_set_pos(xpos, x, i); if (!CORD_pos_valid(xpos)) ABORT("bad index?"); return(CORD_pos_fetch(xpos)); } int CORD_put_proc(char c, void * client_data) { register FILE * f = (FILE *)client_data; return(putc(c, f) == EOF); } int CORD_batched_put_proc(const char * s, void * client_data) { register FILE * f = (FILE *)client_data; return(fputs(s, f) == EOF); } int CORD_put(CORD x, FILE * f) { if (CORD_iter5(x, 0, CORD_put_proc, CORD_batched_put_proc, f)) { return(EOF); } else { return(1); } } typedef struct { size_t pos; /* Current position in the cord */ char target; /* Character we're looking for */ } chr_data; int CORD_chr_proc(char c, void * client_data) { register chr_data * d = (chr_data *)client_data; if (c == d -> target) return(1); (d -> pos) ++; return(0); } int CORD_rchr_proc(char c, void * client_data) { register chr_data * d = (chr_data *)client_data; if (c == d -> target) return(1); (d -> pos) --; return(0); } int CORD_batched_chr_proc(const char *s, void * client_data) { register chr_data * d = (chr_data *)client_data; register char * occ = strchr(s, d -> target); if (occ == 0) { d -> pos += strlen(s); return(0); } else { d -> pos += occ - s; return(1); } } size_t CORD_chr(CORD x, size_t i, int c) { chr_data d; d.pos = i; d.target = c; if (CORD_iter5(x, i, CORD_chr_proc, CORD_batched_chr_proc, &d)) { return(d.pos); } else { return(CORD_NOT_FOUND); } } size_t CORD_rchr(CORD x, size_t i, int c) { chr_data d; d.pos = i; d.target = c; if (CORD_riter4(x, i, CORD_rchr_proc, &d)) { return(d.pos); } else { return(CORD_NOT_FOUND); } } /* Find the first occurrence of s in x at position start or later. */ /* This uses an asymptotically poor algorithm, which should typically */ /* perform acceptably. We compare the first few characters directly, */ /* and call CORD_ncmp whenever there is a partial match. */ /* This has the advantage that we allocate very little, or not at all. */ /* It's very fast if there are few close misses. */ size_t CORD_str(CORD x, size_t start, CORD s) { CORD_pos xpos; size_t xlen = CORD_len(x); size_t slen; register size_t start_len; const char * s_start; unsigned long s_buf = 0; /* The first few characters of s */ unsigned long x_buf = 0; /* Start of candidate substring. */ /* Initialized only to make compilers */ /* happy. */ unsigned long mask = 0; register size_t i; register size_t match_pos; if (s == CORD_EMPTY) return(start); if (CORD_IS_STRING(s)) { s_start = s; slen = strlen(s); } else { s_start = CORD_to_char_star(CORD_substr(s, 0, sizeof(unsigned long))); slen = CORD_len(s); } if (xlen < start || xlen - start < slen) return(CORD_NOT_FOUND); start_len = slen; if (start_len > sizeof(unsigned long)) start_len = sizeof(unsigned long); CORD_set_pos(xpos, x, start); for (i = 0; i < start_len; i++) { mask <<= 8; mask |= 0xff; s_buf <<= 8; s_buf |= (unsigned char)s_start[i]; x_buf <<= 8; x_buf |= (unsigned char)CORD_pos_fetch(xpos); CORD_next(xpos); } for (match_pos = start; ; match_pos++) { if ((x_buf & mask) == s_buf) { if (slen == start_len || CORD_ncmp(x, match_pos + start_len, s, start_len, slen - start_len) == 0) { return(match_pos); } } if ( match_pos == xlen - slen ) { return(CORD_NOT_FOUND); } x_buf <<= 8; x_buf |= (unsigned char)CORD_pos_fetch(xpos); CORD_next(xpos); } } void CORD_ec_flush_buf(CORD_ec x) { register size_t len = x[0].ec_bufptr - x[0].ec_buf; char * s; if (len == 0) return; s = GC_MALLOC_ATOMIC(len+1); memcpy(s, x[0].ec_buf, len); s[len] = '\0'; x[0].ec_cord = CORD_cat_char_star(x[0].ec_cord, s, len); x[0].ec_bufptr = x[0].ec_buf; } void CORD_ec_append_cord(CORD_ec x, CORD s) { CORD_ec_flush_buf(x); x[0].ec_cord = CORD_cat(x[0].ec_cord, s); } /*ARGSUSED*/ char CORD_nul_func(size_t i, void * client_data) { return((char)(unsigned long)client_data); } CORD CORD_chars(char c, size_t i) { return(CORD_from_fn(CORD_nul_func, (void *)(unsigned long)c, i)); } CORD CORD_from_file_eager(FILE * f) { register int c; CORD_ec ecord; CORD_ec_init(ecord); for(;;) { c = getc(f); if (c == 0) { /* Append the right number of NULs */ /* Note that any string of NULs is rpresented in 4 words, */ /* independent of its length. */ register size_t count = 1; CORD_ec_flush_buf(ecord); while ((c = getc(f)) == 0) count++; ecord[0].ec_cord = CORD_cat(ecord[0].ec_cord, CORD_nul(count)); } if (c == EOF) break; CORD_ec_append(ecord, c); } (void) fclose(f); return(CORD_balance(CORD_ec_to_cord(ecord))); } /* The state maintained for a lazily read file consists primarily */ /* of a large direct-mapped cache of previously read values. */ /* We could rely more on stdio buffering. That would have 2 */ /* disadvantages: */ /* 1) Empirically, not all fseek implementations preserve the */ /* buffer whenever they could. */ /* 2) It would fail if 2 different sections of a long cord */ /* were being read alternately. */ /* We do use the stdio buffer for read ahead. */ /* To guarantee thread safety in the presence of atomic pointer */ /* writes, cache lines are always replaced, and never modified in */ /* place. */ # define LOG_CACHE_SZ 14 # define CACHE_SZ (1 << LOG_CACHE_SZ) # define LOG_LINE_SZ 9 # define LINE_SZ (1 << LOG_LINE_SZ) typedef struct { size_t tag; char data[LINE_SZ]; /* data[i%LINE_SZ] = ith char in file if tag = i/LINE_SZ */ } cache_line; typedef struct { FILE * lf_file; size_t lf_current; /* Current file pointer value */ cache_line * volatile lf_cache[CACHE_SZ/LINE_SZ]; } lf_state; # define MOD_CACHE_SZ(n) ((n) & (CACHE_SZ - 1)) # define DIV_CACHE_SZ(n) ((n) >> LOG_CACHE_SZ) # define MOD_LINE_SZ(n) ((n) & (LINE_SZ - 1)) # define DIV_LINE_SZ(n) ((n) >> LOG_LINE_SZ) # define LINE_START(n) ((n) & ~(LINE_SZ - 1)) typedef struct { lf_state * state; size_t file_pos; /* Position of needed character. */ cache_line * new_cache; } refill_data; /* Executed with allocation lock. */ static char refill_cache(client_data) refill_data * client_data; { register lf_state * state = client_data -> state; register size_t file_pos = client_data -> file_pos; FILE *f = state -> lf_file; size_t line_start = LINE_START(file_pos); size_t line_no = DIV_LINE_SZ(MOD_CACHE_SZ(file_pos)); cache_line * new_cache = client_data -> new_cache; if (line_start != state -> lf_current && fseek(f, line_start, SEEK_SET) != 0) { ABORT("fseek failed"); } if (fread(new_cache -> data, sizeof(char), LINE_SZ, f) <= file_pos - line_start) { ABORT("fread failed"); } new_cache -> tag = DIV_LINE_SZ(file_pos); /* Store barrier goes here. */ ATOMIC_WRITE(state -> lf_cache[line_no], new_cache); state -> lf_current = line_start + LINE_SZ; return(new_cache->data[MOD_LINE_SZ(file_pos)]); } char CORD_lf_func(size_t i, void * client_data) { register lf_state * state = (lf_state *)client_data; register cache_line * volatile * cl_addr = &(state -> lf_cache[DIV_LINE_SZ(MOD_CACHE_SZ(i))]); register cache_line * cl = (cache_line *)ATOMIC_READ(cl_addr); if (cl == 0 || cl -> tag != DIV_LINE_SZ(i)) { /* Cache miss */ refill_data rd; rd.state = state; rd.file_pos = i; rd.new_cache = GC_NEW_ATOMIC(cache_line); if (rd.new_cache == 0) OUT_OF_MEMORY; return((char)(GC_word) GC_call_with_alloc_lock((GC_fn_type) refill_cache, &rd)); } return(cl -> data[MOD_LINE_SZ(i)]); } /*ARGSUSED*/ void CORD_lf_close_proc(void * obj, void * client_data) { if (fclose(((lf_state *)obj) -> lf_file) != 0) { ABORT("CORD_lf_close_proc: fclose failed"); } } CORD CORD_from_file_lazy_inner(FILE * f, size_t len) { register lf_state * state = GC_NEW(lf_state); register int i; if (state == 0) OUT_OF_MEMORY; if (len != 0) { /* Dummy read to force buffer allocation. */ /* This greatly increases the probability */ /* of avoiding deadlock if buffer allocation */ /* is redirected to GC_malloc and the */ /* world is multithreaded. */ char buf[1]; (void) fread(buf, 1, 1, f); rewind(f); } state -> lf_file = f; for (i = 0; i < CACHE_SZ/LINE_SZ; i++) { state -> lf_cache[i] = 0; } state -> lf_current = 0; GC_REGISTER_FINALIZER(state, CORD_lf_close_proc, 0, 0, 0); return(CORD_from_fn(CORD_lf_func, state, len)); } CORD CORD_from_file_lazy(FILE * f) { register long len; if (fseek(f, 0l, SEEK_END) != 0) { ABORT("Bad fd argument - fseek failed"); } if ((len = ftell(f)) < 0) { ABORT("Bad fd argument - ftell failed"); } rewind(f); return(CORD_from_file_lazy_inner(f, (size_t)len)); } # define LAZY_THRESHOLD (128*1024 + 1) CORD CORD_from_file(FILE * f) { register long len; if (fseek(f, 0l, SEEK_END) != 0) { ABORT("Bad fd argument - fseek failed"); } if ((len = ftell(f)) < 0) { ABORT("Bad fd argument - ftell failed"); } rewind(f); if (len < LAZY_THRESHOLD) { return(CORD_from_file_eager(f)); } else { return(CORD_from_file_lazy_inner(f, (size_t)len)); } } synopsis-0.12/src/Synopsis/gc/cord/de_win.ICO0000775000076400007640000000137611104702320020416 0ustar stefanstefan è( @€€€€€€€€€€€€€ÀÀÀÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿßÿÿþ»¿ÿÿ}ÿÿ®ÿÿýÝÿÿþ»øÿwãÿ¯ÏßÿßßÿÿÿßÿÿÿÀÿÿßßü7ÏŸù—ç?óÇð÷çÿÿ÷çÿÿ÷çÿÿóÇÿÿù‡ÿÿü7ÿÿÿ÷ÿÿÿ÷ÿÿÿ÷ÿÿÿ÷ÿÿÿ÷ÿÿÿ÷ÿÿÿ÷ÿÿÿÿÿÿÿÿÿÿÿÿÿÿsynopsis-0.12/src/Synopsis/gc/cord/cordtest.c0000664000076400007640000001751111104702320020603 0ustar stefanstefan/* * Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* Boehm, August 24, 1994 11:58 am PDT */ # include "gc.h" /* For GC_INIT() only */ # include "cord.h" # include # include # include /* This is a very incomplete test of the cord package. It knows about */ /* a few internals of the package (e.g. when C strings are returned) */ /* that real clients shouldn't rely on. */ # define ABORT(string) \ { int x = 0; fprintf(stderr, "FAILED: %s\n", string); x = 1 / x; abort(); } int count; int test_fn(char c, void * client_data) { if (client_data != (void *)13) ABORT("bad client data"); if (count < 64*1024+1) { if ((count & 1) == 0) { if (c != 'b') ABORT("bad char"); } else { if (c != 'a') ABORT("bad char"); } count++; return(0); } else { if (c != 'c') ABORT("bad char"); count++; return(1); } } char id_cord_fn(size_t i, void * client_data) { return((char)i); } void test_basics() { CORD x = CORD_from_char_star("ab"); register int i; char c; CORD y; CORD_pos p; x = CORD_cat(x,x); if (!CORD_IS_STRING(x)) ABORT("short cord should usually be a string"); if (strcmp(x, "abab") != 0) ABORT("bad CORD_cat result"); for (i = 1; i < 16; i++) { x = CORD_cat(x,x); } x = CORD_cat(x,"c"); if (CORD_len(x) != 128*1024+1) ABORT("bad length"); count = 0; if (CORD_iter5(x, 64*1024-1, test_fn, CORD_NO_FN, (void *)13) == 0) { ABORT("CORD_iter5 failed"); } if (count != 64*1024 + 2) ABORT("CORD_iter5 failed"); count = 0; CORD_set_pos(p, x, 64*1024-1); while(CORD_pos_valid(p)) { (void) test_fn(CORD_pos_fetch(p), (void *)13); CORD_next(p); } if (count != 64*1024 + 2) ABORT("Position based iteration failed"); y = CORD_substr(x, 1023, 5); if (!CORD_IS_STRING(y)) ABORT("short cord should usually be a string"); if (strcmp(y, "babab") != 0) ABORT("bad CORD_substr result"); y = CORD_substr(x, 1024, 8); if (!CORD_IS_STRING(y)) ABORT("short cord should usually be a string"); if (strcmp(y, "abababab") != 0) ABORT("bad CORD_substr result"); y = CORD_substr(x, 128*1024-1, 8); if (!CORD_IS_STRING(y)) ABORT("short cord should usually be a string"); if (strcmp(y, "bc") != 0) ABORT("bad CORD_substr result"); x = CORD_balance(x); if (CORD_len(x) != 128*1024+1) ABORT("bad length"); count = 0; if (CORD_iter5(x, 64*1024-1, test_fn, CORD_NO_FN, (void *)13) == 0) { ABORT("CORD_iter5 failed"); } if (count != 64*1024 + 2) ABORT("CORD_iter5 failed"); y = CORD_substr(x, 1023, 5); if (!CORD_IS_STRING(y)) ABORT("short cord should usually be a string"); if (strcmp(y, "babab") != 0) ABORT("bad CORD_substr result"); y = CORD_from_fn(id_cord_fn, 0, 13); i = 0; CORD_set_pos(p, y, i); while(CORD_pos_valid(p)) { c = CORD_pos_fetch(p); if(c != i) ABORT("Traversal of function node failed"); CORD_next(p); i++; } if (i != 13) ABORT("Bad apparent length for function node"); } void test_extras() { # if defined(__OS2__) || defined(__DJGPP__) # define FNAME1 "tmp1" # define FNAME2 "tmp2" # elif defined(AMIGA) # define FNAME1 "T:tmp1" # define FNAME2 "T:tmp2" # else # define FNAME1 "/tmp/cord_test" # define FNAME2 "/tmp/cord_test2" # endif register int i; CORD y = "abcdefghijklmnopqrstuvwxyz0123456789"; CORD x = "{}"; CORD w, z; FILE *f; FILE *f1a, *f1b, *f2; w = CORD_cat(CORD_cat(y,y),y); z = CORD_catn(3,y,y,y); if (CORD_cmp(w,z) != 0) ABORT("CORD_catn comparison wrong"); for (i = 1; i < 100; i++) { x = CORD_cat(x, y); } z = CORD_balance(x); if (CORD_cmp(x,z) != 0) ABORT("balanced string comparison wrong"); if (CORD_cmp(x,CORD_cat(z, CORD_nul(13))) >= 0) ABORT("comparison 2"); if (CORD_cmp(CORD_cat(x, CORD_nul(13)), z) <= 0) ABORT("comparison 3"); if (CORD_cmp(x,CORD_cat(z, "13")) >= 0) ABORT("comparison 4"); if ((f = fopen(FNAME1, "w")) == 0) ABORT("open failed"); if (CORD_put(z,f) == EOF) ABORT("CORD_put failed"); if (fclose(f) == EOF) ABORT("fclose failed"); w = CORD_from_file(f1a = fopen(FNAME1, "rb")); if (CORD_len(w) != CORD_len(z)) ABORT("file length wrong"); if (CORD_cmp(w,z) != 0) ABORT("file comparison wrong"); if (CORD_cmp(CORD_substr(w, 50*36+2, 36), y) != 0) ABORT("file substr wrong"); z = CORD_from_file_lazy(f1b = fopen(FNAME1, "rb")); if (CORD_cmp(w,z) != 0) ABORT("File conversions differ"); if (CORD_chr(w, 0, '9') != 37) ABORT("CORD_chr failed 1"); if (CORD_chr(w, 3, 'a') != 38) ABORT("CORD_chr failed 2"); if (CORD_rchr(w, CORD_len(w) - 1, '}') != 1) ABORT("CORD_rchr failed"); x = y; for (i = 1; i < 14; i++) { x = CORD_cat(x,x); } if ((f = fopen(FNAME2, "w")) == 0) ABORT("2nd open failed"); # ifdef __DJGPP__ /* FIXME: DJGPP workaround. Why does this help? */ if (fflush(f) != 0) ABORT("fflush failed"); # endif if (CORD_put(x,f) == EOF) ABORT("CORD_put failed"); if (fclose(f) == EOF) ABORT("fclose failed"); w = CORD_from_file(f2 = fopen(FNAME2, "rb")); if (CORD_len(w) != CORD_len(x)) ABORT("file length wrong"); if (CORD_cmp(w,x) != 0) ABORT("file comparison wrong"); if (CORD_cmp(CORD_substr(w, 1000*36, 36), y) != 0) ABORT("file substr wrong"); if (strcmp(CORD_to_char_star(CORD_substr(w, 1000*36, 36)), y) != 0) ABORT("char * file substr wrong"); if (strcmp(CORD_substr(w, 1000*36, 2), "ab") != 0) ABORT("short file substr wrong"); if (CORD_str(x,1,"9a") != 35) ABORT("CORD_str failed 1"); if (CORD_str(x,0,"9abcdefghijk") != 35) ABORT("CORD_str failed 2"); if (CORD_str(x,0,"9abcdefghijx") != CORD_NOT_FOUND) ABORT("CORD_str failed 3"); if (CORD_str(x,0,"9>") != CORD_NOT_FOUND) ABORT("CORD_str failed 4"); if (remove(FNAME1) != 0) { /* On some systems, e.g. OS2, this may fail if f1 is still open. */ if ((fclose(f1a) == EOF) & (fclose(f1b) == EOF)) ABORT("fclose(f1) failed"); if (remove(FNAME1) != 0) ABORT("remove 1 failed"); } if (remove(FNAME2) != 0) { if (fclose(f2) == EOF) ABORT("fclose(f2) failed"); if (remove(FNAME2) != 0) ABORT("remove 2 failed"); } } void test_printf() { CORD result; char result2[200]; long l; short s; CORD x; if (CORD_sprintf(&result, "%7.2f%ln", 3.14159F, &l) != 7) ABORT("CORD_sprintf failed 1"); if (CORD_cmp(result, " 3.14") != 0)ABORT("CORD_sprintf goofed 1"); if (l != 7) ABORT("CORD_sprintf goofed 2"); if (CORD_sprintf(&result, "%-7.2s%hn%c%s", "abcd", &s, 'x', "yz") != 10) ABORT("CORD_sprintf failed 2"); if (CORD_cmp(result, "ab xyz") != 0)ABORT("CORD_sprintf goofed 3"); if (s != 7) ABORT("CORD_sprintf goofed 4"); x = "abcdefghij"; x = CORD_cat(x,x); x = CORD_cat(x,x); x = CORD_cat(x,x); if (CORD_sprintf(&result, "->%-120.78r!\n", x) != 124) ABORT("CORD_sprintf failed 3"); (void) sprintf(result2, "->%-120.78s!\n", CORD_to_char_star(x)); if (CORD_cmp(result, result2) != 0)ABORT("CORD_sprintf goofed 5"); } int main() { # ifdef THINK_C printf("cordtest:\n"); # endif GC_INIT(); test_basics(); test_extras(); test_printf(); CORD_fprintf(stderr, "SUCCEEDED\n"); return(0); } synopsis-0.12/src/Synopsis/gc/cord/de_win.RC0000664000076400007640000000364711104702320020310 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to copy this garbage collector for any purpose, * provided the above notices are retained on all copies. */ /* Boehm, May 13, 1994 9:50 am PDT */ #include "windows.h" #include "de_cmds.h" #include "de_win.h" ABOUTBOX DIALOG 19, 21, 163, 47 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "About Demonstration Text Editor" BEGIN ICON "DE", -1, 8, 8, 13, 13, WS_CHILD | WS_VISIBLE LTEXT "Demonstration Text Editor", -1, 44, 8, 118, 8, WS_CHILD | WS_VISIBLE | WS_GROUP LTEXT "Version 4.1", -1, 44, 16, 60, 8, WS_CHILD | WS_VISIBLE | WS_GROUP PUSHBUTTON "OK", IDOK, 118, 27, 24, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP END DE MENU BEGIN POPUP "&File" BEGIN MENUITEM "&Save\t^W", IDM_FILESAVE MENUITEM "E&xit\t^D", IDM_FILEEXIT END POPUP "&Edit" BEGIN MENUITEM "Page &Down\t^R^N", IDM_EDITPDOWN MENUITEM "Page &Up\t^R^P", IDM_EDITPUP MENUITEM "U&ndo\t^U", IDM_EDITUNDO MENUITEM "&Locate\t^L ... ^L", IDM_EDITLOCATE MENUITEM "D&own\t^N", IDM_EDITDOWN MENUITEM "U&p\t^P", IDM_EDITUP MENUITEM "Le&ft\t^B", IDM_EDITLEFT MENUITEM "&Right\t^F", IDM_EDITRIGHT MENUITEM "Delete &Backward\tBS", IDM_EDITBS MENUITEM "Delete F&orward\tDEL", IDM_EDITDEL MENUITEM "&Top\t^T", IDM_EDITTOP END POPUP "&Help" BEGIN MENUITEM "&Contents", IDM_HELPCONTENTS MENUITEM "&About...", IDM_HELPABOUT END MENUITEM "Page_&Down", IDM_EDITPDOWN MENUITEM "Page_&Up", IDM_EDITPUP END DE ACCELERATORS BEGIN "^R", IDM_EDITREPEAT "^N", IDM_EDITDOWN "^P", IDM_EDITUP "^L", IDM_EDITLOCATE "^B", IDM_EDITLEFT "^F", IDM_EDITRIGHT "^T", IDM_EDITTOP VK_DELETE, IDM_EDITDEL, VIRTKEY VK_BACK, IDM_EDITBS, VIRTKEY END DE ICON cord\de_win.ICO synopsis-0.12/src/Synopsis/gc/cord/cordprnt.c0000664000076400007640000002607211104702320020611 0ustar stefanstefan/* * Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* An sprintf implementation that understands cords. This is probably */ /* not terribly portable. It assumes an ANSI stdarg.h. It further */ /* assumes that I can make copies of va_list variables, and read */ /* arguments repeatedly by applyting va_arg to the copies. This */ /* could be avoided at some performance cost. */ /* We also assume that unsigned and signed integers of various kinds */ /* have the same sizes, and can be cast back and forth. */ /* We assume that void * and char * have the same size. */ /* All this cruft is needed because we want to rely on the underlying */ /* sprintf implementation whenever possible. */ /* Boehm, September 21, 1995 6:00 pm PDT */ #include "cord.h" #include "ec.h" #include #include #include #include "gc.h" #define CONV_SPEC_LEN 50 /* Maximum length of a single */ /* conversion specification. */ #define CONV_RESULT_LEN 50 /* Maximum length of any */ /* conversion with default */ /* width and prec. */ static int ec_len(CORD_ec x) { return(CORD_len(x[0].ec_cord) + (x[0].ec_bufptr - x[0].ec_buf)); } /* Possible nonumeric precision values. */ # define NONE -1 # define VARIABLE -2 /* Copy the conversion specification from CORD_pos into the buffer buf */ /* Return negative on error. */ /* Source initially points one past the leading %. */ /* It is left pointing at the conversion type. */ /* Assign field width and precision to *width and *prec. */ /* If width or prec is *, VARIABLE is assigned. */ /* Set *left to 1 if left adjustment flag is present. */ /* Set *long_arg to 1 if long flag ('l' or 'L') is present, or to */ /* -1 if 'h' is present. */ static int extract_conv_spec(CORD_pos source, char *buf, int * width, int *prec, int *left, int * long_arg) { register int result = 0; register int current_number = 0; register int saw_period = 0; register int saw_number = 0; register int chars_so_far = 0; register char current; *width = NONE; buf[chars_so_far++] = '%'; while(CORD_pos_valid(source)) { if (chars_so_far >= CONV_SPEC_LEN) return(-1); current = CORD_pos_fetch(source); buf[chars_so_far++] = current; switch(current) { case '*': saw_number = 1; current_number = VARIABLE; break; case '0': if (!saw_number) { /* Zero fill flag; ignore */ break; } /* otherwise fall through: */ case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': saw_number = 1; current_number *= 10; current_number += current - '0'; break; case '.': saw_period = 1; if(saw_number) { *width = current_number; saw_number = 0; } current_number = 0; break; case 'l': case 'L': *long_arg = 1; current_number = 0; break; case 'h': *long_arg = -1; current_number = 0; break; case ' ': case '+': case '#': current_number = 0; break; case '-': *left = 1; current_number = 0; break; case 'd': case 'i': case 'o': case 'u': case 'x': case 'X': case 'f': case 'e': case 'E': case 'g': case 'G': case 'c': case 'C': case 's': case 'S': case 'p': case 'n': case 'r': goto done; default: return(-1); } CORD_next(source); } return(-1); done: if (saw_number) { if (saw_period) { *prec = current_number; } else { *prec = NONE; *width = current_number; } } else { *prec = NONE; } buf[chars_so_far] = '\0'; return(result); } int CORD_vsprintf(CORD * out, CORD format, va_list args) { CORD_ec result; register int count; register char current; CORD_pos pos; char conv_spec[CONV_SPEC_LEN + 1]; CORD_ec_init(result); for (CORD_set_pos(pos, format, 0); CORD_pos_valid(pos); CORD_next(pos)) { current = CORD_pos_fetch(pos); if (current == '%') { CORD_next(pos); if (!CORD_pos_valid(pos)) return(-1); current = CORD_pos_fetch(pos); if (current == '%') { CORD_ec_append(result, current); } else { int width, prec; int left_adj = 0; int long_arg = 0; CORD arg; size_t len; if (extract_conv_spec(pos, conv_spec, &width, &prec, &left_adj, &long_arg) < 0) { return(-1); } current = CORD_pos_fetch(pos); switch(current) { case 'n': /* Assign length to next arg */ if (long_arg == 0) { int * pos_ptr; pos_ptr = va_arg(args, int *); *pos_ptr = ec_len(result); } else if (long_arg > 0) { long * pos_ptr; pos_ptr = va_arg(args, long *); *pos_ptr = ec_len(result); } else { short * pos_ptr; pos_ptr = va_arg(args, short *); *pos_ptr = ec_len(result); } goto done; case 'r': /* Append cord and any padding */ if (width == VARIABLE) width = va_arg(args, int); if (prec == VARIABLE) prec = va_arg(args, int); arg = va_arg(args, CORD); len = CORD_len(arg); if (prec != NONE && len > prec) { if (prec < 0) return(-1); arg = CORD_substr(arg, 0, prec); len = prec; } if (width != NONE && len < width) { char * blanks = GC_MALLOC_ATOMIC(width-len+1); memset(blanks, ' ', width-len); blanks[width-len] = '\0'; if (left_adj) { arg = CORD_cat(arg, blanks); } else { arg = CORD_cat(blanks, arg); } } CORD_ec_append_cord(result, arg); goto done; case 'c': if (width == NONE && prec == NONE) { register char c; c = (char)va_arg(args, int); CORD_ec_append(result, c); goto done; } break; case 's': if (width == NONE && prec == NONE) { char * str = va_arg(args, char *); register char c; while ((c = *str++)) { CORD_ec_append(result, c); } goto done; } break; default: break; } /* Use standard sprintf to perform conversion */ { register char * buf; va_list vsprintf_args; int max_size = 0; int res; # ifdef __va_copy __va_copy(vsprintf_args, args); # else # if defined(__GNUC__) && !defined(__DJGPP__) /* and probably in other cases */ va_copy(vsprintf_args, args); # else vsprintf_args = args; # endif # endif if (width == VARIABLE) width = va_arg(args, int); if (prec == VARIABLE) prec = va_arg(args, int); if (width != NONE) max_size = width; if (prec != NONE && prec > max_size) max_size = prec; max_size += CONV_RESULT_LEN; if (max_size >= CORD_BUFSZ) { buf = GC_MALLOC_ATOMIC(max_size + 1); } else { if (CORD_BUFSZ - (result[0].ec_bufptr-result[0].ec_buf) < max_size) { CORD_ec_flush_buf(result); } buf = result[0].ec_bufptr; } switch(current) { case 'd': case 'i': case 'o': case 'u': case 'x': case 'X': case 'c': if (long_arg <= 0) { (void) va_arg(args, int); } else if (long_arg > 0) { (void) va_arg(args, long); } break; case 's': case 'p': (void) va_arg(args, char *); break; case 'f': case 'e': case 'E': case 'g': case 'G': (void) va_arg(args, double); break; default: return(-1); } res = vsprintf(buf, conv_spec, vsprintf_args); len = (size_t)res; if ((char *)(GC_word)res == buf) { /* old style vsprintf */ len = strlen(buf); } else if (res < 0) { return(-1); } if (buf != result[0].ec_bufptr) { register char c; while ((c = *buf++)) { CORD_ec_append(result, c); } } else { result[0].ec_bufptr = buf + len; } } done:; } } else { CORD_ec_append(result, current); } } count = ec_len(result); *out = CORD_balance(CORD_ec_to_cord(result)); return(count); } int CORD_sprintf(CORD * out, CORD format, ...) { va_list args; int result; va_start(args, format); result = CORD_vsprintf(out, format, args); va_end(args); return(result); } int CORD_fprintf(FILE * f, CORD format, ...) { va_list args; int result; CORD out; va_start(args, format); result = CORD_vsprintf(&out, format, args); va_end(args); if (result > 0) CORD_put(out, f); return(result); } int CORD_vfprintf(FILE * f, CORD format, va_list args) { int result; CORD out; result = CORD_vsprintf(&out, format, args); if (result > 0) CORD_put(out, f); return(result); } int CORD_printf(CORD format, ...) { va_list args; int result; CORD out; va_start(args, format); result = CORD_vsprintf(&out, format, args); va_end(args); if (result > 0) CORD_put(out, stdout); return(result); } int CORD_vprintf(CORD format, va_list args) { int result; CORD out; result = CORD_vsprintf(&out, format, args); if (result > 0) CORD_put(out, stdout); return(result); } synopsis-0.12/src/Synopsis/gc/cord/cordbscs.c0000664000076400007640000006516111104702321020563 0ustar stefanstefan/* * Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * * Author: Hans-J. Boehm (boehm@parc.xerox.com) */ /* Boehm, October 3, 1994 5:19 pm PDT */ # include "gc.h" # include "cord.h" # include # include # include /* An implementation of the cord primitives. These are the only */ /* Functions that understand the representation. We perform only */ /* minimal checks on arguments to these functions. Out of bounds */ /* arguments to the iteration functions may result in client functions */ /* invoked on garbage data. In most cases, client functions should be */ /* programmed defensively enough that this does not result in memory */ /* smashes. */ typedef void (* oom_fn)(void); oom_fn CORD_oom_fn = (oom_fn) 0; # define OUT_OF_MEMORY { if (CORD_oom_fn != (oom_fn) 0) (*CORD_oom_fn)(); \ ABORT("Out of memory\n"); } # define ABORT(msg) { fprintf(stderr, "%s\n", msg); abort(); } typedef unsigned long word; typedef union { struct Concatenation { char null; char header; char depth; /* concatenation nesting depth. */ unsigned char left_len; /* Length of left child if it is sufficiently */ /* short; 0 otherwise. */ # define MAX_LEFT_LEN 255 word len; CORD left; /* length(left) > 0 */ CORD right; /* length(right) > 0 */ } concatenation; struct Function { char null; char header; char depth; /* always 0 */ char left_len; /* always 0 */ word len; CORD_fn fn; void * client_data; } function; struct Generic { char null; char header; char depth; char left_len; word len; } generic; char string[1]; } CordRep; # define CONCAT_HDR 1 # define FN_HDR 4 # define SUBSTR_HDR 6 /* Substring nodes are a special case of function nodes. */ /* The client_data field is known to point to a substr_args */ /* structure, and the function is either CORD_apply_access_fn */ /* or CORD_index_access_fn. */ /* The following may be applied only to function and concatenation nodes: */ #define IS_CONCATENATION(s) (((CordRep *)s)->generic.header == CONCAT_HDR) #define IS_FUNCTION(s) ((((CordRep *)s)->generic.header & FN_HDR) != 0) #define IS_SUBSTR(s) (((CordRep *)s)->generic.header == SUBSTR_HDR) #define LEN(s) (((CordRep *)s) -> generic.len) #define DEPTH(s) (((CordRep *)s) -> generic.depth) #define GEN_LEN(s) (CORD_IS_STRING(s) ? strlen(s) : LEN(s)) #define LEFT_LEN(c) ((c) -> left_len != 0? \ (c) -> left_len \ : (CORD_IS_STRING((c) -> left) ? \ (c) -> len - GEN_LEN((c) -> right) \ : LEN((c) -> left))) #define SHORT_LIMIT (sizeof(CordRep) - 1) /* Cords shorter than this are C strings */ /* Dump the internal representation of x to stdout, with initial */ /* indentation level n. */ void CORD_dump_inner(CORD x, unsigned n) { register size_t i; for (i = 0; i < (size_t)n; i++) { fputs(" ", stdout); } if (x == 0) { fputs("NIL\n", stdout); } else if (CORD_IS_STRING(x)) { for (i = 0; i <= SHORT_LIMIT; i++) { if (x[i] == '\0') break; putchar(x[i]); } if (x[i] != '\0') fputs("...", stdout); putchar('\n'); } else if (IS_CONCATENATION(x)) { register struct Concatenation * conc = &(((CordRep *)x) -> concatenation); printf("Concatenation: %p (len: %d, depth: %d)\n", x, (int)(conc -> len), (int)(conc -> depth)); CORD_dump_inner(conc -> left, n+1); CORD_dump_inner(conc -> right, n+1); } else /* function */{ register struct Function * func = &(((CordRep *)x) -> function); if (IS_SUBSTR(x)) printf("(Substring) "); printf("Function: %p (len: %d): ", x, (int)(func -> len)); for (i = 0; i < 20 && i < func -> len; i++) { putchar((*(func -> fn))(i, func -> client_data)); } if (i < func -> len) fputs("...", stdout); putchar('\n'); } } /* Dump the internal representation of x to stdout */ void CORD_dump(CORD x) { CORD_dump_inner(x, 0); fflush(stdout); } CORD CORD_cat_char_star(CORD x, const char * y, size_t leny) { register size_t result_len; register size_t lenx; register int depth; if (x == CORD_EMPTY) return(y); if (leny == 0) return(x); if (CORD_IS_STRING(x)) { lenx = strlen(x); result_len = lenx + leny; if (result_len <= SHORT_LIMIT) { register char * result = GC_MALLOC_ATOMIC(result_len+1); if (result == 0) OUT_OF_MEMORY; memcpy(result, x, lenx); memcpy(result + lenx, y, leny); result[result_len] = '\0'; return((CORD) result); } else { depth = 1; } } else { register CORD right; register CORD left; register char * new_right; register size_t right_len; lenx = LEN(x); if (leny <= SHORT_LIMIT/2 && IS_CONCATENATION(x) && CORD_IS_STRING(right = ((CordRep *)x) -> concatenation.right)) { /* Merge y into right part of x. */ if (!CORD_IS_STRING(left = ((CordRep *)x) -> concatenation.left)) { right_len = lenx - LEN(left); } else if (((CordRep *)x) -> concatenation.left_len != 0) { right_len = lenx - ((CordRep *)x) -> concatenation.left_len; } else { right_len = strlen(right); } result_len = right_len + leny; /* length of new_right */ if (result_len <= SHORT_LIMIT) { new_right = GC_MALLOC_ATOMIC(result_len + 1); memcpy(new_right, right, right_len); memcpy(new_right + right_len, y, leny); new_right[result_len] = '\0'; y = new_right; leny = result_len; x = left; lenx -= right_len; /* Now fall through to concatenate the two pieces: */ } if (CORD_IS_STRING(x)) { depth = 1; } else { depth = DEPTH(x) + 1; } } else { depth = DEPTH(x) + 1; } result_len = lenx + leny; } { /* The general case; lenx, result_len is known: */ register struct Concatenation * result; result = GC_NEW(struct Concatenation); if (result == 0) OUT_OF_MEMORY; result->header = CONCAT_HDR; result->depth = depth; if (lenx <= MAX_LEFT_LEN) result->left_len = lenx; result->len = result_len; result->left = x; result->right = y; if (depth >= MAX_DEPTH) { return(CORD_balance((CORD)result)); } else { return((CORD) result); } } } CORD CORD_cat(CORD x, CORD y) { register size_t result_len; register int depth; register size_t lenx; if (x == CORD_EMPTY) return(y); if (y == CORD_EMPTY) return(x); if (CORD_IS_STRING(y)) { return(CORD_cat_char_star(x, y, strlen(y))); } else if (CORD_IS_STRING(x)) { lenx = strlen(x); depth = DEPTH(y) + 1; } else { register int depthy = DEPTH(y); lenx = LEN(x); depth = DEPTH(x) + 1; if (depthy >= depth) depth = depthy + 1; } result_len = lenx + LEN(y); { register struct Concatenation * result; result = GC_NEW(struct Concatenation); if (result == 0) OUT_OF_MEMORY; result->header = CONCAT_HDR; result->depth = depth; if (lenx <= MAX_LEFT_LEN) result->left_len = lenx; result->len = result_len; result->left = x; result->right = y; if (depth >= MAX_DEPTH) { return(CORD_balance((CORD)result)); } else { return((CORD) result); } } } CORD CORD_from_fn(CORD_fn fn, void * client_data, size_t len) { if (len <= 0) return(0); if (len <= SHORT_LIMIT) { register char * result; register size_t i; char buf[SHORT_LIMIT+1]; register char c; for (i = 0; i < len; i++) { c = (*fn)(i, client_data); if (c == '\0') goto gen_case; buf[i] = c; } buf[i] = '\0'; result = GC_MALLOC_ATOMIC(len+1); if (result == 0) OUT_OF_MEMORY; strcpy(result, buf); result[len] = '\0'; return((CORD) result); } gen_case: { register struct Function * result; result = GC_NEW(struct Function); if (result == 0) OUT_OF_MEMORY; result->header = FN_HDR; /* depth is already 0 */ result->len = len; result->fn = fn; result->client_data = client_data; return((CORD) result); } } size_t CORD_len(CORD x) { if (x == 0) { return(0); } else { return(GEN_LEN(x)); } } struct substr_args { CordRep * sa_cord; size_t sa_index; }; char CORD_index_access_fn(size_t i, void * client_data) { register struct substr_args *descr = (struct substr_args *)client_data; return(((char *)(descr->sa_cord))[i + descr->sa_index]); } char CORD_apply_access_fn(size_t i, void * client_data) { register struct substr_args *descr = (struct substr_args *)client_data; register struct Function * fn_cord = &(descr->sa_cord->function); return((*(fn_cord->fn))(i + descr->sa_index, fn_cord->client_data)); } /* A version of CORD_substr that simply returns a function node, thus */ /* postponing its work. The fourth argument is a function that may */ /* be used for efficient access to the ith character. */ /* Assumes i >= 0 and i + n < length(x). */ CORD CORD_substr_closure(CORD x, size_t i, size_t n, CORD_fn f) { register struct substr_args * sa = GC_NEW(struct substr_args); CORD result; if (sa == 0) OUT_OF_MEMORY; sa->sa_cord = (CordRep *)x; sa->sa_index = i; result = CORD_from_fn(f, (void *)sa, n); ((CordRep *)result) -> function.header = SUBSTR_HDR; return (result); } # define SUBSTR_LIMIT (10 * SHORT_LIMIT) /* Substrings of function nodes and flat strings shorter than */ /* this are flat strings. Othewise we use a functional */ /* representation, which is significantly slower to access. */ /* A version of CORD_substr that assumes i >= 0, n > 0, and i + n < length(x).*/ CORD CORD_substr_checked(CORD x, size_t i, size_t n) { if (CORD_IS_STRING(x)) { if (n > SUBSTR_LIMIT) { return(CORD_substr_closure(x, i, n, CORD_index_access_fn)); } else { register char * result = GC_MALLOC_ATOMIC(n+1); if (result == 0) OUT_OF_MEMORY; strncpy(result, x+i, n); result[n] = '\0'; return(result); } } else if (IS_CONCATENATION(x)) { register struct Concatenation * conc = &(((CordRep *)x) -> concatenation); register size_t left_len; register size_t right_len; left_len = LEFT_LEN(conc); right_len = conc -> len - left_len; if (i >= left_len) { if (n == right_len) return(conc -> right); return(CORD_substr_checked(conc -> right, i - left_len, n)); } else if (i+n <= left_len) { if (n == left_len) return(conc -> left); return(CORD_substr_checked(conc -> left, i, n)); } else { /* Need at least one character from each side. */ register CORD left_part; register CORD right_part; register size_t left_part_len = left_len - i; if (i == 0) { left_part = conc -> left; } else { left_part = CORD_substr_checked(conc -> left, i, left_part_len); } if (i + n == right_len + left_len) { right_part = conc -> right; } else { right_part = CORD_substr_checked(conc -> right, 0, n - left_part_len); } return(CORD_cat(left_part, right_part)); } } else /* function */ { if (n > SUBSTR_LIMIT) { if (IS_SUBSTR(x)) { /* Avoid nesting substring nodes. */ register struct Function * f = &(((CordRep *)x) -> function); register struct substr_args *descr = (struct substr_args *)(f -> client_data); return(CORD_substr_closure((CORD)descr->sa_cord, i + descr->sa_index, n, f -> fn)); } else { return(CORD_substr_closure(x, i, n, CORD_apply_access_fn)); } } else { char * result; register struct Function * f = &(((CordRep *)x) -> function); char buf[SUBSTR_LIMIT+1]; register char * p = buf; register char c; register int j; register int lim = i + n; for (j = i; j < lim; j++) { c = (*(f -> fn))(j, f -> client_data); if (c == '\0') { return(CORD_substr_closure(x, i, n, CORD_apply_access_fn)); } *p++ = c; } *p = '\0'; result = GC_MALLOC_ATOMIC(n+1); if (result == 0) OUT_OF_MEMORY; strcpy(result, buf); return(result); } } } CORD CORD_substr(CORD x, size_t i, size_t n) { register size_t len = CORD_len(x); if (i >= len || n <= 0) return(0); /* n < 0 is impossible in a correct C implementation, but */ /* quite possible under SunOS 4.X. */ if (i + n > len) n = len - i; # ifndef __STDC__ if (i < 0) ABORT("CORD_substr: second arg. negative"); /* Possible only if both client and C implementation are buggy. */ /* But empirically this happens frequently. */ # endif return(CORD_substr_checked(x, i, n)); } /* See cord.h for definition. We assume i is in range. */ int CORD_iter5(CORD x, size_t i, CORD_iter_fn f1, CORD_batched_iter_fn f2, void * client_data) { if (x == 0) return(0); if (CORD_IS_STRING(x)) { register const char *p = x+i; if (*p == '\0') ABORT("2nd arg to CORD_iter5 too big"); if (f2 != CORD_NO_FN) { return((*f2)(p, client_data)); } else { while (*p) { if ((*f1)(*p, client_data)) return(1); p++; } return(0); } } else if (IS_CONCATENATION(x)) { register struct Concatenation * conc = &(((CordRep *)x) -> concatenation); if (i > 0) { register size_t left_len = LEFT_LEN(conc); if (i >= left_len) { return(CORD_iter5(conc -> right, i - left_len, f1, f2, client_data)); } } if (CORD_iter5(conc -> left, i, f1, f2, client_data)) { return(1); } return(CORD_iter5(conc -> right, 0, f1, f2, client_data)); } else /* function */ { register struct Function * f = &(((CordRep *)x) -> function); register size_t j; register size_t lim = f -> len; for (j = i; j < lim; j++) { if ((*f1)((*(f -> fn))(j, f -> client_data), client_data)) { return(1); } } return(0); } } #undef CORD_iter int CORD_iter(CORD x, CORD_iter_fn f1, void * client_data) { return(CORD_iter5(x, 0, f1, CORD_NO_FN, client_data)); } int CORD_riter4(CORD x, size_t i, CORD_iter_fn f1, void * client_data) { if (x == 0) return(0); if (CORD_IS_STRING(x)) { register const char *p = x + i; register char c; for(;;) { c = *p; if (c == '\0') ABORT("2nd arg to CORD_riter4 too big"); if ((*f1)(c, client_data)) return(1); if (p == x) break; p--; } return(0); } else if (IS_CONCATENATION(x)) { register struct Concatenation * conc = &(((CordRep *)x) -> concatenation); register CORD left_part = conc -> left; register size_t left_len; left_len = LEFT_LEN(conc); if (i >= left_len) { if (CORD_riter4(conc -> right, i - left_len, f1, client_data)) { return(1); } return(CORD_riter4(left_part, left_len - 1, f1, client_data)); } else { return(CORD_riter4(left_part, i, f1, client_data)); } } else /* function */ { register struct Function * f = &(((CordRep *)x) -> function); register size_t j; for (j = i; ; j--) { if ((*f1)((*(f -> fn))(j, f -> client_data), client_data)) { return(1); } if (j == 0) return(0); } } } int CORD_riter(CORD x, CORD_iter_fn f1, void * client_data) { return(CORD_riter4(x, CORD_len(x) - 1, f1, client_data)); } /* * The following functions are concerned with balancing cords. * Strategy: * Scan the cord from left to right, keeping the cord scanned so far * as a forest of balanced trees of exponentialy decreasing length. * When a new subtree needs to be added to the forest, we concatenate all * shorter ones to the new tree in the appropriate order, and then insert * the result into the forest. * Crucial invariants: * 1. The concatenation of the forest (in decreasing order) with the * unscanned part of the rope is equal to the rope being balanced. * 2. All trees in the forest are balanced. * 3. forest[i] has depth at most i. */ typedef struct { CORD c; size_t len; /* Actual length of c */ } ForestElement; static size_t min_len [ MAX_DEPTH ]; static int min_len_init = 0; int CORD_max_len; typedef ForestElement Forest [ MAX_DEPTH ]; /* forest[i].len >= fib(i+1) */ /* The string is the concatenation */ /* of the forest in order of DECREASING */ /* indices. */ void CORD_init_min_len() { register int i; register size_t last, previous, current; min_len[0] = previous = 1; min_len[1] = last = 2; for (i = 2; i < MAX_DEPTH; i++) { current = last + previous; if (current < last) /* overflow */ current = last; min_len[i] = current; previous = last; last = current; } CORD_max_len = last - 1; min_len_init = 1; } void CORD_init_forest(ForestElement * forest, size_t max_len) { register int i; for (i = 0; i < MAX_DEPTH; i++) { forest[i].c = 0; if (min_len[i] > max_len) return; } ABORT("Cord too long"); } /* Add a leaf to the appropriate level in the forest, cleaning */ /* out lower levels as necessary. */ /* Also works if x is a balanced tree of concatenations; however */ /* in this case an extra concatenation node may be inserted above x; */ /* This node should not be counted in the statement of the invariants. */ void CORD_add_forest(ForestElement * forest, CORD x, size_t len) { register int i = 0; register CORD sum = CORD_EMPTY; register size_t sum_len = 0; while (len > min_len[i + 1]) { if (forest[i].c != 0) { sum = CORD_cat(forest[i].c, sum); sum_len += forest[i].len; forest[i].c = 0; } i++; } /* Sum has depth at most 1 greter than what would be required */ /* for balance. */ sum = CORD_cat(sum, x); sum_len += len; /* If x was a leaf, then sum is now balanced. To see this */ /* consider the two cases in which forest[i-1] either is or is */ /* not empty. */ while (sum_len >= min_len[i]) { if (forest[i].c != 0) { sum = CORD_cat(forest[i].c, sum); sum_len += forest[i].len; /* This is again balanced, since sum was balanced, and has */ /* allowable depth that differs from i by at most 1. */ forest[i].c = 0; } i++; } i--; forest[i].c = sum; forest[i].len = sum_len; } CORD CORD_concat_forest(ForestElement * forest, size_t expected_len) { register int i = 0; CORD sum = 0; size_t sum_len = 0; while (sum_len != expected_len) { if (forest[i].c != 0) { sum = CORD_cat(forest[i].c, sum); sum_len += forest[i].len; } i++; } return(sum); } /* Insert the frontier of x into forest. Balanced subtrees are */ /* treated as leaves. This potentially adds one to the depth */ /* of the final tree. */ void CORD_balance_insert(CORD x, size_t len, ForestElement * forest) { register int depth; if (CORD_IS_STRING(x)) { CORD_add_forest(forest, x, len); } else if (IS_CONCATENATION(x) && ((depth = DEPTH(x)) >= MAX_DEPTH || len < min_len[depth])) { register struct Concatenation * conc = &(((CordRep *)x) -> concatenation); size_t left_len = LEFT_LEN(conc); CORD_balance_insert(conc -> left, left_len, forest); CORD_balance_insert(conc -> right, len - left_len, forest); } else /* function or balanced */ { CORD_add_forest(forest, x, len); } } CORD CORD_balance(CORD x) { Forest forest; register size_t len; if (x == 0) return(0); if (CORD_IS_STRING(x)) return(x); if (!min_len_init) CORD_init_min_len(); len = LEN(x); CORD_init_forest(forest, len); CORD_balance_insert(x, len, forest); return(CORD_concat_forest(forest, len)); } /* Position primitives */ /* Private routines to deal with the hard cases only: */ /* P contains a prefix of the path to cur_pos. Extend it to a full */ /* path and set up leaf info. */ /* Return 0 if past the end of cord, 1 o.w. */ void CORD__extend_path(register CORD_pos p) { register struct CORD_pe * current_pe = &(p[0].path[p[0].path_len]); register CORD top = current_pe -> pe_cord; register size_t pos = p[0].cur_pos; register size_t top_pos = current_pe -> pe_start_pos; register size_t top_len = GEN_LEN(top); /* Fill in the rest of the path. */ while(!CORD_IS_STRING(top) && IS_CONCATENATION(top)) { register struct Concatenation * conc = &(((CordRep *)top) -> concatenation); register size_t left_len; left_len = LEFT_LEN(conc); current_pe++; if (pos >= top_pos + left_len) { current_pe -> pe_cord = top = conc -> right; current_pe -> pe_start_pos = top_pos = top_pos + left_len; top_len -= left_len; } else { current_pe -> pe_cord = top = conc -> left; current_pe -> pe_start_pos = top_pos; top_len = left_len; } p[0].path_len++; } /* Fill in leaf description for fast access. */ if (CORD_IS_STRING(top)) { p[0].cur_leaf = top; p[0].cur_start = top_pos; p[0].cur_end = top_pos + top_len; } else { p[0].cur_end = 0; } if (pos >= top_pos + top_len) p[0].path_len = CORD_POS_INVALID; } char CORD__pos_fetch(register CORD_pos p) { /* Leaf is a function node */ struct CORD_pe * pe = &((p)[0].path[(p)[0].path_len]); CORD leaf = pe -> pe_cord; register struct Function * f = &(((CordRep *)leaf) -> function); if (!IS_FUNCTION(leaf)) ABORT("CORD_pos_fetch: bad leaf"); return ((*(f -> fn))(p[0].cur_pos - pe -> pe_start_pos, f -> client_data)); } void CORD__next(register CORD_pos p) { register size_t cur_pos = p[0].cur_pos + 1; register struct CORD_pe * current_pe = &((p)[0].path[(p)[0].path_len]); register CORD leaf = current_pe -> pe_cord; /* Leaf is not a string or we're at end of leaf */ p[0].cur_pos = cur_pos; if (!CORD_IS_STRING(leaf)) { /* Function leaf */ register struct Function * f = &(((CordRep *)leaf) -> function); register size_t start_pos = current_pe -> pe_start_pos; register size_t end_pos = start_pos + f -> len; if (cur_pos < end_pos) { /* Fill cache and return. */ register size_t i; register size_t limit = cur_pos + FUNCTION_BUF_SZ; register CORD_fn fn = f -> fn; register void * client_data = f -> client_data; if (limit > end_pos) { limit = end_pos; } for (i = cur_pos; i < limit; i++) { p[0].function_buf[i - cur_pos] = (*fn)(i - start_pos, client_data); } p[0].cur_start = cur_pos; p[0].cur_leaf = p[0].function_buf; p[0].cur_end = limit; return; } } /* End of leaf */ /* Pop the stack until we find two concatenation nodes with the */ /* same start position: this implies we were in left part. */ { while (p[0].path_len > 0 && current_pe[0].pe_start_pos != current_pe[-1].pe_start_pos) { p[0].path_len--; current_pe--; } if (p[0].path_len == 0) { p[0].path_len = CORD_POS_INVALID; return; } } p[0].path_len--; CORD__extend_path(p); } void CORD__prev(register CORD_pos p) { register struct CORD_pe * pe = &(p[0].path[p[0].path_len]); if (p[0].cur_pos == 0) { p[0].path_len = CORD_POS_INVALID; return; } p[0].cur_pos--; if (p[0].cur_pos >= pe -> pe_start_pos) return; /* Beginning of leaf */ /* Pop the stack until we find two concatenation nodes with the */ /* different start position: this implies we were in right part. */ { register struct CORD_pe * current_pe = &((p)[0].path[(p)[0].path_len]); while (p[0].path_len > 0 && current_pe[0].pe_start_pos == current_pe[-1].pe_start_pos) { p[0].path_len--; current_pe--; } } p[0].path_len--; CORD__extend_path(p); } #undef CORD_pos_fetch #undef CORD_next #undef CORD_prev #undef CORD_pos_to_index #undef CORD_pos_to_cord #undef CORD_pos_valid char CORD_pos_fetch(register CORD_pos p) { if (p[0].cur_start <= p[0].cur_pos && p[0].cur_pos < p[0].cur_end) { return(p[0].cur_leaf[p[0].cur_pos - p[0].cur_start]); } else { return(CORD__pos_fetch(p)); } } void CORD_next(CORD_pos p) { if (p[0].cur_pos < p[0].cur_end - 1) { p[0].cur_pos++; } else { CORD__next(p); } } void CORD_prev(CORD_pos p) { if (p[0].cur_end != 0 && p[0].cur_pos > p[0].cur_start) { p[0].cur_pos--; } else { CORD__prev(p); } } size_t CORD_pos_to_index(CORD_pos p) { return(p[0].cur_pos); } CORD CORD_pos_to_cord(CORD_pos p) { return(p[0].path[0].pe_cord); } int CORD_pos_valid(CORD_pos p) { return(p[0].path_len != CORD_POS_INVALID); } void CORD_set_pos(CORD_pos p, CORD x, size_t i) { if (x == CORD_EMPTY) { p[0].path_len = CORD_POS_INVALID; return; } p[0].path[0].pe_cord = x; p[0].path[0].pe_start_pos = 0; p[0].path_len = 0; p[0].cur_pos = i; CORD__extend_path(p); } synopsis-0.12/src/Synopsis/gc/Makefile.direct0000664000076400007640000010656211104702317020605 0ustar stefanstefan# This is the original manually generated Makefile. It may still be used # to build the collector. # # Primary targets: # gc.a - builds basic library # c++ - adds C++ interface to library # cords - adds cords (heavyweight strings) to library # test - prints porting information, then builds basic version of gc.a, # and runs some tests of collector and cords. Does not add cords or # c++ interface to gc.a # cord/de - builds dumb editor based on cords. ABI_FLAG= # ABI_FLAG should be the cc flag that specifies the ABI. On most # platforms this will be the empty string. Possible values: # +DD64 for 64-bit executable on HP/UX. # -n32, -n64, -o32 for SGI/MIPS ABIs. AS_ABI_FLAG=$(ABI_FLAG) # ABI flag for assembler. On HP/UX this is +A64 for 64 bit # executables. CC=cc $(ABI_FLAG) CXX=g++ $(ABI_FLAG) AS=as $(AS_ABI_FLAG) # The above doesn't work with gas, which doesn't run cpp. # Define AS as `gcc -c -x assembler-with-cpp' instead. # Redefining srcdir allows object code for the nonPCR version of the collector # to be generated in different directories. srcdir= . VPATH= $(srcdir) # Atomic_ops installation directory. If this doesn't exist, we create # it from the included libatomic_ops distribution. AO_VERSION=1.2 AO_SRC_DIR=$(srcdir)/libatomic_ops-$(AO_VERSION) AO_INSTALL_DIR=$(srcdir)/libatomic_ops-install CFLAGS= -O -I$(srcdir)/include -I$(AO_INSTALL_DIR)/include -DATOMIC_UNCOLLECTABLE -DNO_EXECUTE_PERMISSION -DALL_INTERIOR_POINTERS # To build the parallel collector on Linux, add to the above: # -DGC_LINUX_THREADS -DPARALLEL_MARK -DTHREAD_LOCAL_ALLOC # To build the thread-capable preload library that intercepts # malloc, add -DGC_USE_DLOPEN_WRAP -DREDIRECT_MALLOC=GC_malloc -fpic # To build the parallel collector in a static library on HP/UX, # add to the above: # -DGC_HPUX_THREADS -DTHREAD_LOCAL_ALLOC -D_POSIX_C_SOURCE=199506L -mt # FIXME: PARALLEL_MARK currently broken on HP/UX. # To build the thread-safe collector on Tru64, add to the above: # -pthread -DGC_OSF1_THREADS # HOSTCC and HOSTCFLAGS are used to build executables that will be run as # part of the build process, i.e. on the build machine. These will usually # be the same as CC and CFLAGS, except in a cross-compilation environment. # Note that HOSTCFLAGS should include any -D flags that affect thread support. HOSTCC=$(CC) HOSTCFLAGS=$(CFLAGS) # For dynamic library builds, it may be necessary to add flags to generate # PIC code, e.g. -fPIC on Linux. # Setjmp_test may yield overly optimistic results when compiled # without optimization. # These define arguments influence the collector configuration: # -DFIND_LEAK causes GC_find_leak to be initially set. # This causes the collector to assume that all inaccessible # objects should have been explicitly deallocated, and reports exceptions. # Finalization and the test program are not usable in this mode. # # IMPORTANT: Any of the _THREADS options must normally also be defined in # the client before including gc.h. This redefines thread primitives to # invoke the GC_ versions instead. Alternatively, linker-based symbol # interception can be used on a few platforms. # -DGC_THREADS should set the appropriate one of the below macros, # except -DGC_WIN32_PTHREADS, which must be set explicitly. # -DGC_SOLARIS_PTHREADS enables support for Solaris pthreads. # (Clients should also define GC_SOLARIS_THREADS and then include # gc.h before performing thr_ or dl* or GC_ operations.) # Must also define -D_REENTRANT. # -DGC_IRIX_THREADS enables support for Irix pthreads. See README.irix. # -DGC_HPUX_THREADS enables support for HP/UX 11 pthreads. # Also requires -D_REENTRANT or -D_POSIX_C_SOURCE=199506L. See README.hp. # -DGC_LINUX_THREADS enables support for Xavier Leroy's Linux threads # or NPTL threads. See README.linux. -D_REENTRANT may also be required. # -DGC_OSF1_THREADS enables support for Tru64 pthreads. # -DGC_FREEBSD_THREADS enables support for FreeBSD pthreads. # Appeared to run into some underlying thread problems. # -DGC_DARWIN_THREADS enables support for Mac OS X pthreads. # -DGC_AIX_THREADS enables support for IBM AIX threads. # -DGC_DGUX386_THREADS enables support for DB/UX on I386 threads. # See README.DGUX386. (Probably has not been tested recently.) # -DGC_WIN32_THREADS enables support for win32 threads. That makes sense # for this Makefile only under Cygwin. # -DGC_WIN32_PTHREADS enables support for Ming32 pthreads. This cannot be # enabled automatically by GC_THREADS, which would assume Win32 native # threads. # -DPTW32_STATIC_LIB causes the static version of the Mingw pthreads library # to be used. Requires -DGC_WIN32_PTHREADS. # # -DALL_INTERIOR_POINTERS allows all pointers to the interior # of objects to be recognized. (See gc_priv.h for consequences.) # Alternatively, GC_all_interior_pointers can be set at process # initialization time. # -DSMALL_CONFIG tries to tune the collector for small heap sizes, # usually causing it to use less space in such situations. # Incremental collection no longer works in this case. # -DLARGE_CONFIG tunes the collector for unusually large heaps. # Necessary for heaps larger than about 500 MB on most machines. # Recommended for heaps larger than about 64 MB. # -DDONT_ADD_BYTE_AT_END is meaningful only with -DALL_INTERIOR_POINTERS or # GC_all_interior_pointers = 1. Normally -DALL_INTERIOR_POINTERS # causes all objects to be padded so that pointers just past the end of # an object can be recognized. This can be expensive. (The padding # is normally more than one byte due to alignment constraints.) # -DDONT_ADD_BYTE_AT_END disables the padding. # -DNO_EXECUTE_PERMISSION may cause some or all of the heap to not # have execute permission, i.e. it may be impossible to execute # code from the heap. Currently this only affects the incremental # collector on UNIX machines. It may greatly improve its performance, # since this may avoid some expensive cache synchronization. # -DGC_NO_OPERATOR_NEW_ARRAY declares that the C++ compiler does not support # the new syntax "operator new[]" for allocating and deleting arrays. # See gc_cpp.h for details. No effect on the C part of the collector. # This is defined implicitly in a few environments. Must also be defined # by clients that use gc_cpp.h. # -DREDIRECT_MALLOC=X causes malloc to be defined as alias for X. # Unless the following macros are defined, realloc is also redirected # to GC_realloc, and free is redirected to GC_free. # Calloc and strdup are redefined in terms of the new malloc. X should # be either GC_malloc or GC_malloc_uncollectable, or # GC_debug_malloc_replacement. (The latter invokes GC_debug_malloc # with dummy source location information, but still results in # properly remembered call stacks on Linux/X86 and Solaris/SPARC. # It requires that the following two macros also be used.) # The former is occasionally useful for working around leaks in code # you don't want to (or can't) look at. It may not work for # existing code, but it often does. Neither works on all platforms, # since some ports use malloc or calloc to obtain system memory. # (Probably works for UNIX, and win32.) If you build with DBG_HDRS_ALL, # you should only use GC_debug_malloc_replacement as a malloc # replacement. # -DREDIRECT_REALLOC=X causes GC_realloc to be redirected to X. # The canonical use is -DREDIRECT_REALLOC=GC_debug_realloc_replacement, # together with -DREDIRECT_MALLOC=GC_debug_malloc_replacement to # generate leak reports with call stacks for both malloc and realloc. # This also requires the following: # -DREDIRECT_FREE=X causes free to be redirected to X. The # canonical use is -DREDIRECT_FREE=GC_debug_free. # -DIGNORE_FREE turns calls to free into a noop. Only useful with # -DREDIRECT_MALLOC. # -DNO_DEBUGGING removes GC_dump and the debugging routines it calls. # Reduces code size slightly at the expense of debuggability. # -DJAVA_FINALIZATION makes it somewhat safer to finalize objects out of # order by specifying a nonstandard finalization mark procedure (see # finalize.c). Objects reachable from finalizable objects will be marked # in a separate postpass, and hence their memory won't be reclaimed. # Not recommended unless you are implementing a language that specifies # these semantics. Since 5.0, determines only the initial value # of GC_java_finalization variable. # -DFINALIZE_ON_DEMAND causes finalizers to be run only in response # to explicit GC_invoke_finalizers() calls. # In 5.0 this became runtime adjustable, and this only determines the # initial value of GC_finalize_on_demand. # -DATOMIC_UNCOLLECTABLE includes code for GC_malloc_atomic_uncollectable. # This is useful if either the vendor malloc implementation is poor, # or if REDIRECT_MALLOC is used. # -DMARK_BIT_PER_GRANULE requests that a mark bit (or often byte) # be allocated for each allocation granule, as opposed to each object. # This often improves speed, possibly at some cost in space and/or # cache footprint. Normally it is best to let this decision be # made automatically depending on platform. # -DMARK_BIT_PER_OBJ requests that a mark bit be allocated for each # object instead of allocation granule. The opposiet of # MARK_BIT_PER_GRANULE. # -DHBLKSIZE=ddd, where ddd is a power of 2 between 512 and 16384, explicitly # sets the heap block size. Each heap block is devoted to a single size and # kind of object. For the incremental collector it makes sense to match # the most likely page size. Otherwise large values result in more # fragmentation, but generally better performance for large heaps. # -DUSE_MMAP use MMAP instead of sbrk to get new memory. # Works for Solaris and Irix. # -DUSE_MUNMAP causes memory to be returned to the OS under the right # circumstances. This currently disables VM-based incremental collection. # This is currently experimental, and works only under some Unix, # Linux and Windows versions. # -DMMAP_STACKS (for Solaris threads) Use mmap from /dev/zero rather than # GC_scratch_alloc() to get stack memory. # -DPRINT_BLACK_LIST Whenever a black list entry is added, i.e. whenever # the garbage collector detects a value that looks almost, but not quite, # like a pointer, print both the address containing the value, and the # value of the near-bogus-pointer. Can be used to identifiy regions of # memory that are likely to contribute misidentified pointers. # -DKEEP_BACK_PTRS Add code to save back pointers in debugging headers # for objects allocated with the debugging allocator. If all objects # through GC_MALLOC with GC_DEBUG defined, this allows the client # to determine how particular or randomly chosen objects are reachable # for debugging/profiling purposes. The gc_backptr.h interface is # implemented only if this is defined. # -DGC_ASSERTIONS Enable some internal GC assertion checking. Currently # this facility is only used in a few places. It is intended primarily # for debugging of the garbage collector itself, but could also # -DDBG_HDRS_ALL Make sure that all objects have debug headers. Increases # the reliability (from 99.9999% to 100% mod. bugs) of some of the debugging # code (especially KEEP_BACK_PTRS). Makes -DSHORT_DBG_HDRS possible. # Assumes that all client allocation is done through debugging # allocators. # -DSHORT_DBG_HDRS Assume that all objects have debug headers. Shorten # the headers to minimize object size, at the expense of checking for # writes past the end of an object. This is intended for environments # in which most client code is written in a "safe" language, such as # Scheme or Java. Assumes that all client allocation is done using # the GC_debug_ functions, or through the macros that expand to these, # or by redirecting malloc to GC_debug_malloc_replacement. # (Also eliminates the field for the requested object size.) # occasionally be useful for debugging of client code. Slows down the # collector somewhat, but not drastically. # -DSAVE_CALL_COUNT= Set the number of call frames saved with objects # allocated through the debugging interface. Affects the amount of # information generated in leak reports. Only matters on platforms # on which we can quickly generate call stacks, currently Linux/(X86 & SPARC) # and Solaris/SPARC and platforms that provide execinfo.h. # Default is zero. On X86, client # code should NOT be compiled with -fomit-frame-pointer. # -DSAVE_CALL_NARGS= Set the number of functions arguments to be # saved with each call frame. Default is zero. Ignored if we # don't know how to retrieve arguments on the platform. # -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly # altered stubborn objects, at substantial performance cost. # Use only for debugging of the incremental collector. # -DGC_GCJ_SUPPORT includes support for gcj (and possibly other systems # that include a pointer to a type descriptor in each allocated object). # Building this way requires an ANSI C compiler. # -DUSE_I686_PREFETCH causes the collector to issue Pentium III style # prefetch instructions. No effect except on X86 Linux platforms. # Assumes a very recent gcc-compatible compiler and assembler. # (Gas prefetcht0 support was added around May 1999.) # Empirically the code appears to still run correctly on Pentium II # processors, though with no performance benefit. May not run on other # X86 processors? In some cases this improves performance by # 15% or so. # -DUSE_3DNOW_PREFETCH causes the collector to issue AMD 3DNow style # prefetch instructions. Same restrictions as USE_I686_PREFETCH. # Minimally tested. Didn't appear to be an obvious win on a K6-2/500. # -DUSE_PPC_PREFETCH causes the collector to issue PowerPC style # prefetch instructions. No effect except on PowerPC OS X platforms. # Performance impact untested. # -DGC_USE_LD_WRAP in combination with the old flags listed in README.linux # causes the collector some system and pthread calls in a more transparent # fashion than the usual macro-based approach. Requires GNU ld, and # currently probably works only with Linux. # -DGC_USE_DLOPEN_WRAP causes the collector to redefine malloc and intercepted # pthread routines with their real names, and causes it to use dlopen # and dlsym to refer to the original versions. This makes it possible to # build an LD_PRELOADable malloc replacement library. # -DTHREAD_LOCAL_ALLOC defines GC_malloc(), GC_malloc_atomic() # and GC_gcj_malloc() to use a per-thread set of free-lists. # These then allocate in a way that usually does not involve # acquisition of a global lock. Currently supported only on platforms # such as Linux that use pthread_support.c. Recommended for multiprocessors. # Requires explicit GC_INIT() call, unless REDIRECT_MALLOC is # defined and GC_malloc is used first. # -DUSE_COMPILER_TLS causes thread local allocation to use compiler-supported # "__thread" thread-local variables. This is the default in HP/UX. It # may help performance on recent Linux installations. (It failed for # me on RedHat 8, but appears to work on RedHat 9.) # -DPARALLEL_MARK allows the marker to run in multiple threads. Recommended # for multiprocessors. Currently requires Linux on X86 or IA64, though # support for other Posix platforms should be fairly easy to add, # if the thread implementation is otherwise supported. # -DNO_GETENV prevents the collector from looking at environment variables. # These may otherwise alter its configuration, or turn off GC altogether. # I don't know of a reason to disable this, except possibly if the # resulting process runs as a privileged user? # -DUSE_GLOBAL_ALLOC. Win32 only. Use GlobalAlloc instead of # VirtualAlloc to allocate the heap. May be needed to work around # a Windows NT/2000 issue. Incompatible with USE_MUNMAP. # See README.win32 for details. # -DMAKE_BACK_GRAPH. Enable GC_PRINT_BACK_HEIGHT environment variable. # See README.environment for details. Experimental. Limited platform # support. Implies DBG_HDRS_ALL. All allocation should be done using # the debug interface. # -DSTUBBORN_ALLOC allows allocation of "hard to change" objects, and thus # makes incremental collection easier. Was enabled by default until 6.0. # Rarely used, to my knowledge. # -DHANDLE_FORK attempts to make GC_malloc() work in a child process fork()ed # from a multithreaded parent. Currently only supported by pthread_support.c. # (Similar code should work on Solaris or Irix, but it hasn't been tried.) # -DTEST_WITH_SYSTEM_MALLOC causes gctest to allocate (and leak) large chunks # of memory with the standard system malloc. This will cause the root # set and collected heap to grow significantly if malloced memory is # somehow getting traced by the collector. This has no impact on the # generated library; it only affects the test. # -DNO_INCREMENTAL cases the gctest program to not invoke the incremental # collector. This has no impact on the generated library, only on the # test program. (This is often useful for debugging failures unrelated # to incremental GC.) # -DPOINTER_MASK=0x... causes candidate pointers to be ANDed with the # given mask before being considered. If either this or the following # macro is defined, it will be assumed that all pointers stored in # the heap need to be processed this way. Stack and register pointers # will be considered both with and without processing. # These macros are normally needed only to support systems that use # high-order pointer tags. EXPERIMENTAL. # -DPOINTER_SHIFT=n causes the collector to left shift candidate pointers # by the indicated amount before trying to interpret them. Applied # after POINTER_MASK. EXPERIMENTAL. See also the preceding macro. # -DENABLE_TRACE enables the GC_TRACE=addr environment setting to do its # job. By default this is not supported in order to keep the marker as fast # as possible. # -DDARWIN_DONT_PARSE_STACK Causes the Darwin port to discover thread # stack bounds in the same way as other pthread ports, without trying to # walk the frames onthe stack. This is recommended only as a fallback # for applications that don't support proper stack unwinding. # -DUSE_PROC_FOR_LIBRARIES Causes the Linux collector to treat writable # memory mappings (as reported by /proc) as roots, if it doesn't have # otherinformation about them. It no longer traverses dynamic loader # data structures to find dynamic library static data. This may be # required for applications that store pointers in mmapped segments without # informaing the collector. But it typically performs poorly, especially # since it will scan inactive but cached NPTL thread stacks completely. # CXXFLAGS= $(CFLAGS) AR= ar RANLIB= ranlib OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o \ headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o \ malloc.o stubborn.o checksums.o pthread_support.o pthread_stop_world.o \ darwin_stop_world.o typd_mlc.o ptr_chck.o mallocx.o gcj_mlc.o specific.o \ gc_dlopen.o backgraph.o win32_threads.o thread_local_alloc.o CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c \ headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c \ new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c \ checksums.c pthread_support.c pthread_stop_world.c darwin_stop_world.c \ typd_mlc.c ptr_chck.c mallocx.c gcj_mlc.c specific.c gc_dlopen.c \ backgraph.c win32_threads.c thread_local_alloc.c CORD_SRCS= cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/de.c cord/cordtest.c include/cord.h include/ec.h include/private/cord_pos.h cord/de_win.c cord/de_win.h cord/de_cmds.h cord/de_win.ICO cord/de_win.RC CORD_OBJS= cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o SRCS= $(CSRCS) mips_sgi_mach_dep.s rs6000_mach_dep.s alpha_mach_dep.S \ sparc_mach_dep.S include/gc.h include/gc_typed.h include/gc_tiny_fl.h \ include/private/gc_hdrs.h include/private/gc_priv.h \ include/private/gcconfig.h include/private/gc_pmark.h \ include/gc_inline.h include/gc_mark.h \ threadlibs.c if_mach.c if_not_there.c gc_cpp.cc include/gc_cpp.h \ gcname.c include/weakpointer.h include/private/gc_locks.h \ mips_ultrix_mach_dep.s \ include/new_gc_alloc.h include/gc_allocator.h \ include/javaxfc.h sparc_sunos4_mach_dep.s sparc_netbsd_mach_dep.s \ include/gc_backptr.h \ hpux_test_and_clear.s include/gc_gcj.h \ include/private/dbg_mlc.h \ include/private/specific.h \ include/leak_detector.h include/gc_amiga_redirects.h \ include/gc_pthread_redirects.h ia64_save_regs_in_stack.s \ include/gc_config_macros.h include/private/pthread_support.h \ include/private/pthread_stop_world.h include/private/darwin_semaphore.h \ include/private/darwin_stop_world.h include/private/thread_local_alloc.h \ $(CORD_SRCS) DOC_FILES= README.QUICK doc/README.Mac doc/README.MacOSX doc/README.OS2 \ doc/README.amiga doc/README.cords doc/debugging.html \ doc/porting.html doc/overview.html \ doc/README.dj doc/README.hp doc/README.linux doc/README.rs6000 \ doc/README.sgi doc/README.solaris2 doc/README.uts \ doc/README.win32 doc/barrett_diagram doc/README \ doc/README.contributors doc/README.changes doc/gc.man \ doc/README.environment doc/tree.html doc/gcdescr.html \ doc/README.autoconf doc/README.macros doc/README.ews4800 \ doc/README.DGUX386 doc/README.arm.cross doc/leak.html \ doc/scale.html doc/gcinterface.html doc/README.darwin \ doc/simple_example.html doc/README.win64 TESTS= tests/test.c tests/test_cpp.cc tests/trace_test.c \ tests/leak_test.c tests/thread_leak_test.c tests/middle.c GNU_BUILD_FILES= configure.ac Makefile.am configure acinclude.m4 \ libtool.m4 install-sh configure.host Makefile.in \ aclocal.m4 config.sub config.guess \ include/include.am doc/doc.am \ ltmain.sh mkinstalldirs depcomp missing \ cord/cord.am tests/tests.am autogen.sh \ bdw-gc.pc.in compile OTHER_MAKEFILES= OS2_MAKEFILE NT_MAKEFILE NT_THREADS_MAKEFILE gc.mak \ BCC_MAKEFILE EMX_MAKEFILE WCC_MAKEFILE Makefile.dj \ PCR-Makefile SMakefile.amiga Makefile.DLLs \ digimars.mak Makefile.direct NT_STATIC_THREADS_MAKEFILE \ NT_X64_STATIC_THREADS_MAKEFILE configure_atomic_ops.sh # Makefile and Makefile.direct are copies of each other. OTHER_FILES= Makefile setjmp_t.c callprocs \ MacProjects.sit.hqx MacOS.c \ Mac_files/datastart.c Mac_files/dataend.c \ Mac_files/MacOS_config.h Mac_files/MacOS_Test_config.h \ add_gc_prefix.c gc_cpp.cpp \ version.h AmigaOS.c mscvc_dbg.c include/private/msvc_dbg.h \ $(TESTS) $(GNU_BUILD_FILES) $(OTHER_MAKEFILES) CORD_INCLUDE_FILES= $(srcdir)/include/gc.h $(srcdir)/include/cord.h \ $(srcdir)/include/ec.h $(srcdir)/include/private/cord_pos.h UTILS= if_mach if_not_there threadlibs # Libraries needed for curses applications. Only needed for de. CURSES= -lcurses -ltermlib # The following is irrelevant on most systems. But a few # versions of make otherwise fork the shell specified in # the SHELL environment variable. SHELL= /bin/sh SPECIALCFLAGS = -I$(srcdir)/include -I$(AO_INSTALL_DIR)/include # Alternative flags to the C compiler for mach_dep.c. # Mach_dep.c often doesn't like optimization, and it's # not time-critical anyway. # Set SPECIALCFLAGS to -q nodirect_code on Encore. all: gc.a gctest # if AO_INSTALL_DIR doesn't exist, we assume that it is pointing to # the default location, and we need to build $(AO_INSTALL_DIR): CC=$(CC) $(srcdir)/configure_atomic_ops.sh cd $(AO_SRC_DIR); make CC=$(CC) install LEAKFLAGS=$(CFLAGS) -DFIND_LEAK BSD-pkg-all: bsd-libgc.a bsd-libleak.a bsd-libgc.a: $(MAKE) CFLAGS="$(CFLAGS)" clean c++-t mv gc.a bsd-libgc.a bsd-libleak.a: $(MAKE) -f Makefile.direct CFLAGS="$(LEAKFLAGS)" clean c++-nt mv gc.a bsd-libleak.a BSD-pkg-install: BSD-pkg-all ${CP} bsd-libgc.a libgc.a ${INSTALL_DATA} libgc.a ${PREFIX}/lib ${INSTALL_DATA} gc.h gc_cpp.h ${PREFIX}/include ${INSTALL_MAN} doc/gc.man ${PREFIX}/man/man3/gc.3 pcr: PCR-Makefile include/private/gc_private.h include/private/gc_hdrs.h \ include/private/gc_locks.h include/gc.h include/private/gcconfig.h \ mach_dep.o $(SRCS) $(MAKE) -f PCR-Makefile depend $(MAKE) -f PCR-Makefile $(OBJS) tests/test.o dyn_load.o dyn_load_sunos53.o: \ $(srcdir)/include/private/gc_priv.h \ $(srcdir)/include/private/gc_hdrs.h $(srcdir)/include/private/gc_locks.h \ $(srcdir)/include/gc.h $(srcdir)/include/gc_pthread_redirects.h \ $(srcdir)/include/private/gcconfig.h $(srcdir)/include/gc_typed.h \ $(srcdir)/include/gc_config_macros.h Makefile $(AO_INSTALL_DIR) # The dependency on Makefile is needed. Changing # options affects the size of GC_arrays, # invalidating all .o files that rely on gc_priv.h mark.o typd_mlc.o finalize.o ptr_chck.o: $(srcdir)/include/gc_mark.h \ $(srcdir)/include/private/gc_pmark.h specific.o pthread_support.o thread_local_alloc.o win32_threads.o: \ $(srcdir)/include/private/specific.h $(srcdir)/include/gc_inline.h \ $(srcdir)/include/private/thread_local_alloc.h dbg_mlc.o gcj_mlc.o: $(srcdir)/include/private/dbg_mlc.h tests/test.o: tests $(srcdir)/tests/test.c $(CC) $(CFLAGS) -c $(srcdir)/tests/test.c mv test.o tests/test.o tests: mkdir tests base_lib gc.a: $(OBJS) dyn_load.o $(UTILS) echo > base_lib rm -f dont_ar_1 cp $(AO_INSTALL_DIR)/lib/libatomic_ops.a gc.a ./if_mach SPARC SOLARIS touch dont_ar_1 ./if_mach SPARC SOLARIS $(AR) rus gc.a $(OBJS) dyn_load.o ./if_mach M68K AMIGA touch dont_ar_1 ./if_mach M68K AMIGA $(AR) -vrus gc.a $(OBJS) dyn_load.o ./if_not_there dont_ar_1 $(AR) ru gc.a $(OBJS) dyn_load.o ./if_not_there dont_ar_1 $(RANLIB) gc.a || cat /dev/null # ignore ranlib failure; that usually means it doesn't exist, and isn't needed cords: $(CORD_OBJS) cord/cordtest $(UTILS) rm -f dont_ar_3 ./if_mach SPARC SOLARIS touch dont_ar_3 ./if_mach SPARC SOLARIS $(AR) rus gc.a $(CORD_OBJS) ./if_mach M68K AMIGA touch dont_ar_3 ./if_mach M68K AMIGA $(AR) -vrus gc.a $(CORD_OBJS) ./if_not_there dont_ar_3 $(AR) ru gc.a $(CORD_OBJS) ./if_not_there dont_ar_3 $(RANLIB) gc.a || cat /dev/null gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/include/gc_cpp.h $(srcdir)/include/gc.h Makefile $(CXX) -c $(CXXFLAGS) $(srcdir)/gc_cpp.cc test_cpp: $(srcdir)/tests/test_cpp.cc $(srcdir)/include/gc_cpp.h gc_cpp.o $(srcdir)/include/gc.h \ base_lib $(UTILS) rm -f test_cpp ./if_mach HP_PA HPUX $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/tests/test_cpp.cc gc_cpp.o gc.a -ldld `./threadlibs` ./if_not_there test_cpp $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/tests/test_cpp.cc gc_cpp.o gc.a `./threadlibs` c++-t: c++ ./test_cpp 1 c++-nt: c++ @echo "Use ./test_cpp 1 to test the leak library" c++: gc_cpp.o $(srcdir)/include/gc_cpp.h test_cpp rm -f dont_ar_4 ./if_mach SPARC SOLARIS touch dont_ar_4 ./if_mach SPARC SOLARIS $(AR) rus gc.a gc_cpp.o ./if_mach M68K AMIGA touch dont_ar_4 ./if_mach M68K AMIGA $(AR) -vrus gc.a gc_cpp.o ./if_not_there dont_ar_4 $(AR) ru gc.a gc_cpp.o ./if_not_there dont_ar_4 $(RANLIB) gc.a || cat /dev/null ./test_cpp 1 echo > c++ dyn_load_sunos53.o: dyn_load.c $(CC) $(CFLAGS) -DSUNOS53_SHARED_LIB -c $(srcdir)/dyn_load.c -o $@ # SunOS5 shared library version of the collector sunos5gc.so: $(OBJS) dyn_load_sunos53.o $(CC) -G -o sunos5gc.so $(OBJS) dyn_load_sunos53.o $(AO_INSTALL_DIR)/lib/libatomic_ops.a -ldl ln sunos5gc.so libgc.so # Alpha/OSF shared library version of the collector libalphagc.so: $(OBJS) ld -shared -o libalphagc.so $(OBJS) dyn_load.o -lc ln libalphagc.so libgc.so # IRIX shared library version of the collector libirixgc.so: $(OBJS) dyn_load.o ld -shared $(ABI_FLAG) -o libirixgc.so $(OBJS) dyn_load.o -lc ln libirixgc.so libgc.so # Linux shared library version of the collector liblinuxgc.so: $(OBJS) dyn_load.o gcc -shared -o liblinuxgc.so $(OBJS) dyn_load.o ln liblinuxgc.so libgc.so # Build gctest with dynamic library dyn_test: $(CC) $(CFLAGS) -o gctest tests/test.c libgc.so `./threadlibs` ./gctest # Alternative Linux rule. This is preferable, but is likely to break the # Makefile for some non-linux platforms. # LIBOBJS= $(patsubst %.o, %.lo, $(OBJS)) # #.SUFFIXES: .lo $(SUFFIXES) # #.c.lo: # $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c $< -o $@ # # liblinuxgc.so: $(LIBOBJS) dyn_load.lo # gcc -shared -Wl,-soname=libgc.so.0 -o libgc.so.0 $(LIBOBJS) dyn_load.lo # touch liblinuxgc.so mach_dep.o: $(srcdir)/mach_dep.c $(srcdir)/mips_sgi_mach_dep.s \ $(srcdir)/mips_ultrix_mach_dep.s \ $(srcdir)/rs6000_mach_dep.s \ $(srcdir)/sparc_mach_dep.S $(srcdir)/sparc_sunos4_mach_dep.s \ $(srcdir)/ia64_save_regs_in_stack.s \ $(srcdir)/sparc_netbsd_mach_dep.s $(UTILS) rm -f mach_dep.o ./if_mach SPARC SOLARIS $(CC) -c -o mach_dep2.o $(srcdir)/sparc_mach_dep.S ./if_mach SPARC OPENBSD $(AS) -o mach_dep2.o $(srcdir)/sparc_sunos4_mach_dep.s ./if_mach SPARC NETBSD $(AS) -o mach_dep2.o $(srcdir)/sparc_netbsd_mach_dep.s ./if_mach SPARC "" $(CC) -c -o mach_dep1.o $(SPECIALCFLAGS) $(srcdir)/mach_dep.c ./if_mach SPARC "" ld -r -o mach_dep.o mach_dep1.o mach_dep2.o ./if_mach IA64 "" as $(AS_ABI_FLAG) -o ia64_save_regs_in_stack.o $(srcdir)/ia64_save_regs_in_stack.s ./if_mach IA64 "" $(CC) -c -o mach_dep1.o $(SPECIALCFLAGS) $(srcdir)/mach_dep.c ./if_mach IA64 "" ld -r -o mach_dep.o mach_dep1.o ia64_save_regs_in_stack.o ./if_not_there mach_dep.o $(CC) -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c mark_rts.o: $(srcdir)/mark_rts.c $(UTILS) rm -f mark_rts.o -./if_mach ALPHA OSF1 $(CC) -c $(CFLAGS) -Wo,-notail $(srcdir)/mark_rts.c ./if_not_there mark_rts.o $(CC) -c $(CFLAGS) $(srcdir)/mark_rts.c # Work-around for DEC optimizer tail recursion elimination bug. # The ALPHA-specific line should be removed if gcc is used. alloc.o: version.h cord: mkdir cord cord/cordbscs.o: cord $(srcdir)/cord/cordbscs.c $(CORD_INCLUDE_FILES) $(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordbscs.c mv cordbscs.o cord/cordbscs.o # not all compilers understand -o filename cord/cordxtra.o: cord $(srcdir)/cord/cordxtra.c $(CORD_INCLUDE_FILES) $(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordxtra.c mv cordxtra.o cord/cordxtra.o cord/cordprnt.o: cord $(srcdir)/cord/cordprnt.c $(CORD_INCLUDE_FILES) $(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordprnt.c mv cordprnt.o cord/cordprnt.o cord/cordtest: $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a $(UTILS) rm -f cord/cordtest ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -lucb ./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -ldld `./threadlibs` ./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a `./threadlibs` ./if_not_there cord/cordtest $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a `./threadlibs` cord/de: $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(UTILS) rm -f cord/de ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -lucb `./threadlibs` ./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -ldld `./threadlibs` ./if_mach POWERPC AIX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses ./if_mach POWERPC DARWIN $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a ./if_mach I386 LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs` ./if_mach ALPHA LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs` ./if_mach IA64 LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs` ./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses ./if_not_there cord/de $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) `./threadlibs` if_mach: $(srcdir)/if_mach.c $(srcdir)/include/private/gcconfig.h $(HOSTCC) $(HOSTCFLAGS) -o if_mach $(srcdir)/if_mach.c threadlibs: $(srcdir)/threadlibs.c $(srcdir)/include/private/gcconfig.h Makefile $(HOSTCC) $(HOSTCFLAGS) -o threadlibs $(srcdir)/threadlibs.c if_not_there: $(srcdir)/if_not_there.c $(HOSTCC) $(HOSTCFLAGS) -o if_not_there $(srcdir)/if_not_there.c clean: rm -f gc.a *.o *.exe tests/*.o gctest gctest_dyn_link test_cpp \ setjmp_test mon.out gmon.out a.out core if_not_there if_mach \ threadlibs $(CORD_OBJS) cord/cordtest cord/de -rm -f *~ gctest: tests/test.o gc.a $(UTILS) rm -f gctest ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o gctest tests/test.o gc.a -lucb ./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o gctest tests/test.o gc.a -ldld `./threadlibs` ./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o gctest tests/test.o gc.a `./threadlibs` ./if_not_there gctest $(CC) $(CFLAGS) -o gctest tests/test.o gc.a `./threadlibs` # If an optimized setjmp_test generates a segmentation fault, # odds are your compiler is broken. Gctest may still work. # Try compiling setjmp_t.c unoptimized. setjmp_test: $(srcdir)/setjmp_t.c $(srcdir)/include/gc.h $(UTILS) $(AO_INSTALL_DIR) $(CC) $(CFLAGS) -o setjmp_test $(srcdir)/setjmp_t.c test: KandRtest cord/cordtest cord/cordtest # Those tests that work even with a K&R C compiler: KandRtest: setjmp_test gctest ./setjmp_test ./gctest add_gc_prefix: $(srcdir)/add_gc_prefix.c $(srcdir)/version.h $(CC) -o add_gc_prefix $(srcdir)/add_gc_prefix.c gcname: $(srcdir)/gcname.c $(srcdir)/version.h $(CC) -o gcname $(srcdir)/gcname.c #We assume this is being done from source directory. dist gc.tar: $(SRCS) $(DOC_FILES) $(OTHER_FILES) add_gc_prefix gcname cp Makefile Makefile.old cp Makefile.direct Makefile CC=$(CC) ./configure_atomic_ops.sh cd $(AO_SRC_DIR); make dist if test $(srcdir)/libatomic_ops-$(AO_VERSION) = $(AO_SRC_DIR); \ then \ mv $(AO_SRC_DIR) $(AO_SRC_DIR).bak ; \ tar xvfz $(AO_SRC_DIR).bak/libatomic_ops-$(AO_VERSION).tar.gz ; \ else \ tar xvfz $(AO_SRC_DIR)/libatomic_ops-$(AO_VERSION).tar.gz ; \ fi rm -f `./gcname` ln -s . `./gcname` ./add_gc_prefix $(SRCS) $(DOC_FILES) $(OTHER_FILES) libatomic_ops-$(AO_VERSION) > /tmp/gc.tar-files tar cvfh gc.tar `cat /tmp/gc.tar-files` cp gc.tar `./gcname`.tar gzip `./gcname`.tar rm `./gcname` gc.tar.Z: gc.tar compress gc.tar gc.tar.gz: gc.tar gzip gc.tar lint: $(CSRCS) tests/test.c lint -DLINT $(CSRCS) tests/test.c | egrep -v "possible pointer alignment problem|abort|exit|sbrk|mprotect|syscall|change in ANSI|improper alignment" # BTL: added to test shared library version of collector. # Currently works only under SunOS5. Requires GC_INIT call from statically # loaded client code. ABSDIR = `pwd` gctest_dyn_link: tests/test.o libgc.so $(CC) -L$(ABSDIR) -R$(ABSDIR) -o gctest_dyn_link tests/test.o -lgc -ldl -lthread gctest_irix_dyn_link: tests/test.o libirixgc.so $(CC) -L$(ABSDIR) -o gctest_irix_dyn_link tests/test.o -lirixgc # The following appear to be dead, especially since libgc_globals.h # is apparently lost. test_dll.o: tests/test.c libgc_globals.h $(CC) $(CFLAGS) -DGC_USE_DLL -c tests/test.c -o test_dll.o test_dll: test_dll.o libgc_dll.a libgc.dll $(CC) test_dll.o -L$(ABSDIR) -lgc_dll -o test_dll SYM_PREFIX-libgc=GC # Uncomment the following line to build a GNU win32 DLL # include Makefile.DLLs reserved_namespace: $(SRCS) for file in $(SRCS) tests/test.c tests/test_cpp.cc; do \ sed s/GC_/_GC_/g < $$file > tmp; \ cp tmp $$file; \ done user_namespace: $(SRCS) for file in $(SRCS) tests/test.c tests/test_cpp.cc; do \ sed s/_GC_/GC_/g < $$file > tmp; \ cp tmp $$file; \ done synopsis-0.12/src/Synopsis/gc/tests/0000775000076400007640000000000011172123233017023 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/tests/test.c0000664000076400007640000012366111104702320020152 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996 by Silicon Graphics. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* An incomplete test for the garbage collector. */ /* Some more obscure entry points are not tested at all. */ /* This must be compiled with the same flags used to build the */ /* GC. It uses GC internals to allow more precise results */ /* checking for some of the tests. */ # undef GC_BUILD #if defined(DBG_HDRS_ALL) || defined(MAKE_BACK_GRAPH) # define GC_DEBUG #endif # if defined(mips) && defined(SYSTYPE_BSD43) /* MIPS RISCOS 4 */ # else # include # endif # include # ifdef _WIN32_WCE # include # define assert ASSERT # else # include /* Not normally used, but handy for debugging. */ # endif # include "gc.h" # include "gc_typed.h" # include "private/gc_priv.h" /* For output, locking, MIN_WORDS, */ /* and some statistics, and gcconfig.h. */ # if defined(MSWIN32) || defined(MSWINCE) # include # endif # ifdef PCR # include "th/PCR_ThCrSec.h" # include "th/PCR_Th.h" # define GC_printf printf # endif # if defined(GC_PTHREADS) # include # endif # if defined(GC_WIN32_THREADS) && !defined(GC_PTHREADS) static CRITICAL_SECTION incr_cs; # endif #ifdef __STDC__ # include #endif /* Allocation Statistics */ int stubborn_count = 0; int uncollectable_count = 0; int collectable_count = 0; int atomic_count = 0; int realloc_count = 0; #if defined(GC_AMIGA_FASTALLOC) && defined(AMIGA) extern void GC_amiga_free_all_mem(void); void Amiga_Fail(void){GC_amiga_free_all_mem();abort();} # define FAIL (void)Amiga_Fail() void *GC_amiga_gctest_malloc_explicitly_typed(size_t lb, GC_descr d){ void *ret=GC_malloc_explicitly_typed(lb,d); if(ret==NULL){ if(!GC_dont_gc){ GC_gcollect(); ret=GC_malloc_explicitly_typed(lb,d); } if(ret==NULL){ GC_printf("Out of memory, (typed allocations are not directly " "supported with the GC_AMIGA_FASTALLOC option.)\n"); FAIL; } } return ret; } void *GC_amiga_gctest_calloc_explicitly_typed(size_t a,size_t lb, GC_descr d){ void *ret=GC_calloc_explicitly_typed(a,lb,d); if(ret==NULL){ if(!GC_dont_gc){ GC_gcollect(); ret=GC_calloc_explicitly_typed(a,lb,d); } if(ret==NULL){ GC_printf("Out of memory, (typed allocations are not directly " "supported with the GC_AMIGA_FASTALLOC option.)\n"); FAIL; } } return ret; } # define GC_malloc_explicitly_typed(a,b) GC_amiga_gctest_malloc_explicitly_typed(a,b) # define GC_calloc_explicitly_typed(a,b,c) GC_amiga_gctest_calloc_explicitly_typed(a,b,c) #else /* !AMIGA_FASTALLOC */ # ifdef PCR # define FAIL (void)abort() # else # ifdef MSWINCE # define FAIL DebugBreak() # else # define FAIL GC_abort("Test failed"); # endif # endif #endif /* !AMIGA_FASTALLOC */ /* AT_END may be defined to exercise the interior pointer test */ /* if the collector is configured with ALL_INTERIOR_POINTERS. */ /* As it stands, this test should succeed with either */ /* configuration. In the FIND_LEAK configuration, it should */ /* find lots of leaks, since we free almost nothing. */ struct SEXPR { struct SEXPR * sexpr_car; struct SEXPR * sexpr_cdr; }; typedef struct SEXPR * sexpr; # define INT_TO_SEXPR(x) ((sexpr)(GC_word)(x)) # define SEXPR_TO_INT(x) ((int)(GC_word)(x)) # undef nil # define nil (INT_TO_SEXPR(0)) # define car(x) ((x) -> sexpr_car) # define cdr(x) ((x) -> sexpr_cdr) # define is_nil(x) ((x) == nil) int extra_count = 0; /* Amount of space wasted in cons node */ /* Silly implementation of Lisp cons. Intentionally wastes lots of space */ /* to test collector. */ # ifdef VERY_SMALL_CONFIG # define cons small_cons # else sexpr cons (sexpr x, sexpr y) { sexpr r; int *p; int my_extra = extra_count; stubborn_count++; r = (sexpr) GC_MALLOC_STUBBORN(sizeof(struct SEXPR) + my_extra); if (r == 0) { (void)GC_printf("Out of memory\n"); exit(1); } for (p = (int *)r; ((char *)p) < ((char *)r) + my_extra + sizeof(struct SEXPR); p++) { if (*p) { (void)GC_printf("Found nonzero at %p - allocator is broken\n", p); FAIL; } *p = (int)((13 << 12) + ((p - (int *)r) & 0xfff)); } # ifdef AT_END r = (sexpr)((char *)r + (my_extra & ~7)); # endif r -> sexpr_car = x; r -> sexpr_cdr = y; my_extra++; if ( my_extra >= 5000 ) { extra_count = 0; } else { extra_count = my_extra; } GC_END_STUBBORN_CHANGE((char *)r); return(r); } # endif #ifdef GC_GCJ_SUPPORT #include "gc_mark.h" #include "gc_gcj.h" /* The following struct emulates the vtable in gcj. */ /* This assumes the default value of MARK_DESCR_OFFSET. */ struct fake_vtable { void * dummy; /* class pointer in real gcj. */ size_t descr; }; struct fake_vtable gcj_class_struct1 = { 0, sizeof(struct SEXPR) + sizeof(struct fake_vtable *) }; /* length based descriptor. */ struct fake_vtable gcj_class_struct2 = { 0, (3l << (CPP_WORDSZ - 3)) | GC_DS_BITMAP}; /* Bitmap based descriptor. */ struct GC_ms_entry * fake_gcj_mark_proc(word * addr, struct GC_ms_entry *mark_stack_ptr, struct GC_ms_entry *mark_stack_limit, word env ) { sexpr x; if (1 == env) { /* Object allocated with debug allocator. */ addr = (word *)GC_USR_PTR_FROM_BASE(addr); } x = (sexpr)(addr + 1); /* Skip the vtable pointer. */ mark_stack_ptr = GC_MARK_AND_PUSH( (void *)(x -> sexpr_cdr), mark_stack_ptr, mark_stack_limit, (void * *)&(x -> sexpr_cdr)); mark_stack_ptr = GC_MARK_AND_PUSH( (void *)(x -> sexpr_car), mark_stack_ptr, mark_stack_limit, (void * *)&(x -> sexpr_car)); return(mark_stack_ptr); } #endif /* GC_GCJ_SUPPORT */ sexpr small_cons (sexpr x, sexpr y) { sexpr r; collectable_count++; r = (sexpr) GC_MALLOC(sizeof(struct SEXPR)); if (r == 0) { (void)GC_printf("Out of memory\n"); exit(1); } r -> sexpr_car = x; r -> sexpr_cdr = y; return(r); } sexpr small_cons_uncollectable (sexpr x, sexpr y) { sexpr r; uncollectable_count++; r = (sexpr) GC_MALLOC_UNCOLLECTABLE(sizeof(struct SEXPR)); if (r == 0) { (void)GC_printf("Out of memory\n"); exit(1); } r -> sexpr_car = x; r -> sexpr_cdr = (sexpr)(~(GC_word)y); return(r); } #ifdef GC_GCJ_SUPPORT sexpr gcj_cons(sexpr x, sexpr y) { GC_word * r; sexpr result; static int count = 0; r = (GC_word *) GC_GCJ_MALLOC(sizeof(struct SEXPR) + sizeof(struct fake_vtable*), &gcj_class_struct2); if (r == 0) { (void)GC_printf("Out of memory\n"); exit(1); } result = (sexpr)(r + 1); result -> sexpr_car = x; result -> sexpr_cdr = y; return(result); } #endif /* Return reverse(x) concatenated with y */ sexpr reverse1(sexpr x, sexpr y) { if (is_nil(x)) { return(y); } else { return( reverse1(cdr(x), cons(car(x), y)) ); } } sexpr reverse(sexpr x) { # ifdef TEST_WITH_SYSTEM_MALLOC malloc(100000); # endif return( reverse1(x, nil) ); } sexpr ints(int low, int up) { if (low > up) { return(nil); } else { return(small_cons(small_cons(INT_TO_SEXPR(low), nil), ints(low+1, up))); } } #ifdef GC_GCJ_SUPPORT /* Return reverse(x) concatenated with y */ sexpr gcj_reverse1(sexpr x, sexpr y) { if (is_nil(x)) { return(y); } else { return( gcj_reverse1(cdr(x), gcj_cons(car(x), y)) ); } } sexpr gcj_reverse(sexpr x) { return( gcj_reverse1(x, nil) ); } sexpr gcj_ints(int low, int up) { if (low > up) { return(nil); } else { return(gcj_cons(gcj_cons(INT_TO_SEXPR(low), nil), gcj_ints(low+1, up))); } } #endif /* GC_GCJ_SUPPORT */ /* To check uncollectable allocation we build lists with disguised cdr */ /* pointers, and make sure they don't go away. */ sexpr uncollectable_ints(int low, int up) { if (low > up) { return(nil); } else { return(small_cons_uncollectable(small_cons(INT_TO_SEXPR(low), nil), uncollectable_ints(low+1, up))); } } void check_ints(sexpr list, int low, int up) { if (SEXPR_TO_INT(car(car(list))) != low) { (void)GC_printf( "List reversal produced incorrect list - collector is broken\n"); FAIL; } if (low == up) { if (cdr(list) != nil) { (void)GC_printf("List too long - collector is broken\n"); FAIL; } } else { check_ints(cdr(list), low+1, up); } } # define UNCOLLECTABLE_CDR(x) (sexpr)(~(GC_word)(cdr(x))) void check_uncollectable_ints(sexpr list, int low, int up) { if (SEXPR_TO_INT(car(car(list))) != low) { (void)GC_printf( "Uncollectable list corrupted - collector is broken\n"); FAIL; } if (low == up) { if (UNCOLLECTABLE_CDR(list) != nil) { (void)GC_printf("Uncollectable list too long - collector is broken\n"); FAIL; } } else { check_uncollectable_ints(UNCOLLECTABLE_CDR(list), low+1, up); } } /* Not used, but useful for debugging: */ void print_int_list(sexpr x) { if (is_nil(x)) { (void)GC_printf("NIL\n"); } else { (void)GC_printf("(%d)", SEXPR_TO_INT(car(car(x)))); if (!is_nil(cdr(x))) { (void)GC_printf(", "); (void)print_int_list(cdr(x)); } else { (void)GC_printf("\n"); } } } /* ditto: */ void check_marks_int_list(sexpr x) { if (!GC_is_marked((ptr_t)x)) GC_printf("[unm:%p]", x); else GC_printf("[mkd:%p]", x); if (is_nil(x)) { (void)GC_printf("NIL\n"); } else { if (!GC_is_marked((ptr_t)car(x))) GC_printf("[unm car:%p]", car(x)); (void)GC_printf("(%d)", SEXPR_TO_INT(car(car(x)))); if (!is_nil(cdr(x))) { (void)GC_printf(", "); (void)check_marks_int_list(cdr(x)); } else { (void)GC_printf("\n"); } } } /* * A tiny list reversal test to check thread creation. */ #ifdef THREADS # if defined(GC_WIN32_THREADS) && !defined(GC_PTHREADS) DWORD __stdcall tiny_reverse_test(void * arg) # else void * tiny_reverse_test(void * arg) # endif { int i; for (i = 0; i < 5; ++i) { check_ints(reverse(reverse(ints(1,10))), 1, 10); } return 0; } # if defined(GC_PTHREADS) void fork_a_thread() { pthread_t t; int code; if ((code = pthread_create(&t, 0, tiny_reverse_test, 0)) != 0) { (void)GC_printf("Small thread creation failed %d\n", code); FAIL; } if ((code = pthread_join(t, 0)) != 0) { (void)GC_printf("Small thread join failed %d\n", code); FAIL; } } # elif defined(GC_WIN32_THREADS) void fork_a_thread() { DWORD thread_id; HANDLE h; h = GC_CreateThread(NULL, 0, tiny_reverse_test, 0, 0, &thread_id); if (h == (HANDLE)NULL) { (void)GC_printf("Small thread creation failed %d\n", GetLastError()); FAIL; } if (WaitForSingleObject(h, INFINITE) != WAIT_OBJECT_0) { (void)GC_printf("Small thread wait failed %d\n", GetLastError()); FAIL; } } # else # define fork_a_thread() # endif #else # define fork_a_thread() #endif /* Try to force a to be strangely aligned */ struct { char dummy; sexpr aa; } A; #define a A.aa /* * Repeatedly reverse lists built out of very different sized cons cells. * Check that we didn't lose anything. */ void reverse_test() { int i; sexpr b; sexpr c; sexpr d; sexpr e; sexpr *f, *g, *h; # if defined(MSWIN32) || defined(MACOS) /* Win32S only allows 128K stacks */ # define BIG 1000 # else # if defined PCR /* PCR default stack is 100K. Stack frames are up to 120 bytes. */ # define BIG 700 # else # if defined MSWINCE /* WinCE only allows 64K stacks */ # define BIG 500 # else # if defined(OSF1) /* OSF has limited stack space by default, and large frames. */ # define BIG 200 # else # define BIG 4500 # endif # endif # endif # endif A.dummy = 17; a = ints(1, 49); b = ints(1, 50); c = ints(1, BIG); d = uncollectable_ints(1, 100); e = uncollectable_ints(1, 1); /* Check that realloc updates object descriptors correctly */ collectable_count++; f = (sexpr *)GC_MALLOC(4 * sizeof(sexpr)); realloc_count++; f = (sexpr *)GC_REALLOC((void *)f, 6 * sizeof(sexpr)); f[5] = ints(1,17); collectable_count++; g = (sexpr *)GC_MALLOC(513 * sizeof(sexpr)); realloc_count++; g = (sexpr *)GC_REALLOC((void *)g, 800 * sizeof(sexpr)); g[799] = ints(1,18); collectable_count++; h = (sexpr *)GC_MALLOC(1025 * sizeof(sexpr)); realloc_count++; h = (sexpr *)GC_REALLOC((void *)h, 2000 * sizeof(sexpr)); # ifdef GC_GCJ_SUPPORT h[1999] = gcj_ints(1,200); for (i = 0; i < 51; ++i) h[1999] = gcj_reverse(h[1999]); /* Leave it as the reveresed list for now. */ # else h[1999] = ints(1,200); # endif /* Try to force some collections and reuse of small list elements */ for (i = 0; i < 10; i++) { (void)ints(1, BIG); } /* Superficially test interior pointer recognition on stack */ c = (sexpr)((char *)c + sizeof(char *)); d = (sexpr)((char *)d + sizeof(char *)); # ifdef __STDC__ GC_FREE((void *)e); # else GC_FREE((char *)e); # endif check_ints(b,1,50); check_ints(a,1,49); for (i = 0; i < 50; i++) { check_ints(b,1,50); b = reverse(reverse(b)); } check_ints(b,1,50); check_ints(a,1,49); for (i = 0; i < 60; i++) { if (i % 10 == 0) fork_a_thread(); /* This maintains the invariant that a always points to a list of */ /* 49 integers. Thus this is thread safe without locks, */ /* assuming atomic pointer assignments. */ a = reverse(reverse(a)); # if !defined(AT_END) && !defined(THREADS) /* This is not thread safe, since realloc explicitly deallocates */ if (i & 1) { a = (sexpr)GC_REALLOC((void *)a, 500); } else { a = (sexpr)GC_REALLOC((void *)a, 8200); } # endif } check_ints(a,1,49); check_ints(b,1,50); c = (sexpr)((char *)c - sizeof(char *)); d = (sexpr)((char *)d - sizeof(char *)); check_ints(c,1,BIG); check_uncollectable_ints(d, 1, 100); check_ints(f[5], 1,17); check_ints(g[799], 1,18); # ifdef GC_GCJ_SUPPORT h[1999] = gcj_reverse(h[1999]); # endif check_ints(h[1999], 1,200); # ifndef THREADS a = 0; # endif b = c = 0; } #undef a /* * The rest of this builds balanced binary trees, checks that they don't * disappear, and tests finalization. */ typedef struct treenode { int level; struct treenode * lchild; struct treenode * rchild; } tn; int finalizable_count = 0; int finalized_count = 0; volatile int dropped_something = 0; # ifdef __STDC__ void finalizer(void * obj, void * client_data) # else void finalizer(obj, client_data) char * obj; char * client_data; # endif { tn * t = (tn *)obj; # ifdef PCR PCR_ThCrSec_EnterSys(); # endif # if defined(GC_PTHREADS) static pthread_mutex_t incr_lock = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_lock(&incr_lock); # elif defined(GC_WIN32_THREADS) EnterCriticalSection(&incr_cs); # endif if ((int)(GC_word)client_data != t -> level) { (void)GC_printf("Wrong finalization data - collector is broken\n"); FAIL; } finalized_count++; t -> level = -1; /* detect duplicate finalization immediately */ # ifdef PCR PCR_ThCrSec_ExitSys(); # endif # if defined(GC_PTHREADS) pthread_mutex_unlock(&incr_lock); # elif defined(GC_WIN32_THREADS) LeaveCriticalSection(&incr_cs); # endif } size_t counter = 0; # define MAX_FINALIZED 8000 # if !defined(MACOS) GC_FAR GC_word live_indicators[MAX_FINALIZED] = {0}; #else /* Too big for THINK_C. have to allocate it dynamically. */ GC_word *live_indicators = 0; #endif int live_indicators_count = 0; tn * mktree(int n) { tn * result = (tn *)GC_MALLOC(sizeof(tn)); collectable_count++; # if defined(MACOS) /* get around static data limitations. */ if (!live_indicators) live_indicators = (GC_word*)NewPtrClear(MAX_FINALIZED * sizeof(GC_word)); if (!live_indicators) { (void)GC_printf("Out of memory\n"); exit(1); } # endif if (n == 0) return(0); if (result == 0) { (void)GC_printf("Out of memory\n"); exit(1); } result -> level = n; result -> lchild = mktree(n-1); result -> rchild = mktree(n-1); if (counter++ % 17 == 0 && n >= 2) { tn * tmp = result -> lchild -> rchild; result -> lchild -> rchild = result -> rchild -> lchild; result -> rchild -> lchild = tmp; } if (counter++ % 119 == 0) { int my_index; { # ifdef PCR PCR_ThCrSec_EnterSys(); # endif # if defined(GC_PTHREADS) static pthread_mutex_t incr_lock = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_lock(&incr_lock); # elif defined(GC_WIN32_THREADS) EnterCriticalSection(&incr_cs); # endif /* Losing a count here causes erroneous report of failure. */ finalizable_count++; my_index = live_indicators_count++; # ifdef PCR PCR_ThCrSec_ExitSys(); # endif # if defined(GC_PTHREADS) pthread_mutex_unlock(&incr_lock); # elif defined(GC_WIN32_THREADS) LeaveCriticalSection(&incr_cs); # endif } GC_REGISTER_FINALIZER((void *)result, finalizer, (void *)(GC_word)n, (GC_finalization_proc *)0, (void * *)0); if (my_index >= MAX_FINALIZED) { GC_printf("live_indicators overflowed\n"); FAIL; } live_indicators[my_index] = 13; if (GC_GENERAL_REGISTER_DISAPPEARING_LINK( (void * *)(&(live_indicators[my_index])), (void *)result) != 0) { GC_printf("GC_general_register_disappearing_link failed\n"); FAIL; } if (GC_unregister_disappearing_link( (void * *) (&(live_indicators[my_index]))) == 0) { GC_printf("GC_unregister_disappearing_link failed\n"); FAIL; } if (GC_GENERAL_REGISTER_DISAPPEARING_LINK( (void * *)(&(live_indicators[my_index])), (void *)result) != 0) { GC_printf("GC_general_register_disappearing_link failed 2\n"); FAIL; } GC_reachable_here(result); } return(result); } void chktree(tn *t, int n) { if (n == 0 && t != 0) { (void)GC_printf("Clobbered a leaf - collector is broken\n"); FAIL; } if (n == 0) return; if (t -> level != n) { (void)GC_printf("Lost a node at level %d - collector is broken\n", n); FAIL; } if (counter++ % 373 == 0) { collectable_count++; (void) GC_MALLOC(counter%5001); } chktree(t -> lchild, n-1); if (counter++ % 73 == 0) { collectable_count++; (void) GC_MALLOC(counter%373); } chktree(t -> rchild, n-1); } #if defined(GC_PTHREADS) pthread_key_t fl_key; void * alloc8bytes() { # if defined(SMALL_CONFIG) || defined(GC_DEBUG) collectable_count++; return(GC_MALLOC(8)); # else void ** my_free_list_ptr; void * my_free_list; my_free_list_ptr = (void **)pthread_getspecific(fl_key); if (my_free_list_ptr == 0) { uncollectable_count++; my_free_list_ptr = GC_NEW_UNCOLLECTABLE(void *); if (pthread_setspecific(fl_key, my_free_list_ptr) != 0) { (void)GC_printf("pthread_setspecific failed\n"); FAIL; } } my_free_list = *my_free_list_ptr; if (my_free_list == 0) { my_free_list = GC_malloc_many(8); if (my_free_list == 0) { (void)GC_printf("alloc8bytes out of memory\n"); FAIL; } } *my_free_list_ptr = GC_NEXT(my_free_list); GC_NEXT(my_free_list) = 0; collectable_count++; return(my_free_list); # endif } #else # define alloc8bytes() GC_MALLOC_ATOMIC(8) #endif void alloc_small(int n) { int i; for (i = 0; i < n; i += 8) { atomic_count++; if (alloc8bytes() == 0) { (void)GC_printf("Out of memory\n"); FAIL; } } } # if defined(THREADS) && defined(GC_DEBUG) # ifdef VERY_SMALL_CONFIG # define TREE_HEIGHT 12 # else # define TREE_HEIGHT 15 # endif # else # ifdef VERY_SMALL_CONFIG # define TREE_HEIGHT 13 # else # define TREE_HEIGHT 16 # endif # endif void tree_test() { tn * root; int i; root = mktree(TREE_HEIGHT); # ifndef VERY_SMALL_CONFIG alloc_small(5000000); # endif chktree(root, TREE_HEIGHT); if (finalized_count && ! dropped_something) { (void)GC_printf("Premature finalization - collector is broken\n"); FAIL; } dropped_something = 1; GC_noop(root); /* Root needs to remain live until */ /* dropped_something is set. */ root = mktree(TREE_HEIGHT); chktree(root, TREE_HEIGHT); for (i = TREE_HEIGHT; i >= 0; i--) { root = mktree(i); chktree(root, i); } # ifndef VERY_SMALL_CONFIG alloc_small(5000000); # endif } unsigned n_tests = 0; GC_word bm_huge[10] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00ffffff, }; /* A very simple test of explicitly typed allocation */ void typed_test() { GC_word * old, * new; GC_word bm3 = 0x3; GC_word bm2 = 0x2; GC_word bm_large = 0xf7ff7fff; GC_descr d1 = GC_make_descriptor(&bm3, 2); GC_descr d2 = GC_make_descriptor(&bm2, 2); GC_descr d3 = GC_make_descriptor(&bm_large, 32); GC_descr d4 = GC_make_descriptor(bm_huge, 320); GC_word * x = (GC_word *)GC_malloc_explicitly_typed(2000, d4); int i; # ifndef LINT (void)GC_make_descriptor(&bm_large, 32); # endif collectable_count++; old = 0; for (i = 0; i < 4000; i++) { collectable_count++; new = (GC_word *) GC_malloc_explicitly_typed(4 * sizeof(GC_word), d1); if (0 != new[0] || 0 != new[1]) { GC_printf("Bad initialization by GC_malloc_explicitly_typed\n"); FAIL; } new[0] = 17; new[1] = (GC_word)old; old = new; collectable_count++; new = (GC_word *) GC_malloc_explicitly_typed(4 * sizeof(GC_word), d2); new[0] = 17; new[1] = (GC_word)old; old = new; collectable_count++; new = (GC_word *) GC_malloc_explicitly_typed(33 * sizeof(GC_word), d3); new[0] = 17; new[1] = (GC_word)old; old = new; collectable_count++; new = (GC_word *) GC_calloc_explicitly_typed(4, 2 * sizeof(GC_word), d1); new[0] = 17; new[1] = (GC_word)old; old = new; collectable_count++; if (i & 0xff) { new = (GC_word *) GC_calloc_explicitly_typed(7, 3 * sizeof(GC_word), d2); } else { new = (GC_word *) GC_calloc_explicitly_typed(1001, 3 * sizeof(GC_word), d2); if (0 != new[0] || 0 != new[1]) { GC_printf("Bad initialization by GC_malloc_explicitly_typed\n"); FAIL; } } new[0] = 17; new[1] = (GC_word)old; old = new; } for (i = 0; i < 20000; i++) { if (new[0] != 17) { (void)GC_printf("typed alloc failed at %lu\n", (unsigned long)i); FAIL; } new[0] = 0; old = new; new = (GC_word *)(old[1]); } GC_gcollect(); GC_noop(x); } int fail_count = 0; #ifndef __STDC__ /*ARGSUSED*/ void fail_proc1(x) void * x; { fail_count++; } #else /*ARGSUSED*/ void fail_proc1(void * x) { fail_count++; } static void uniq(void *p, ...) { va_list a; void *q[100]; int n = 0, i, j; q[n++] = p; va_start(a,p); for (;(q[n] = va_arg(a,void *));n++) ; va_end(a); for (i=0; i= (n)) #endif void run_one_test() { char *x; # ifdef LINT char *y = 0; # else char *y = (char *)(size_t)fail_proc1; # endif DCL_LOCK_STATE; # ifdef FIND_LEAK (void)GC_printf( "This test program is not designed for leak detection mode\n"); (void)GC_printf("Expect lots of problems.\n"); # endif GC_FREE(0); # ifndef DBG_HDRS_ALL collectable_count += 3; if ((GC_size(GC_malloc(7)) != 8 && GC_size(GC_malloc(7)) != MIN_WORDS * sizeof(GC_word)) || GC_size(GC_malloc(15)) != 16) { (void)GC_printf("GC_size produced unexpected results\n"); FAIL; } collectable_count += 1; if (GC_size(GC_malloc(0)) != MIN_WORDS * sizeof(GC_word)) { (void)GC_printf("GC_malloc(0) failed: GC_size returns %ld\n", (unsigned long)GC_size(GC_malloc(0))); FAIL; } collectable_count += 1; if (GC_size(GC_malloc_uncollectable(0)) != MIN_WORDS * sizeof(GC_word)) { (void)GC_printf("GC_malloc_uncollectable(0) failed\n"); FAIL; } GC_is_valid_displacement_print_proc = fail_proc1; GC_is_visible_print_proc = fail_proc1; collectable_count += 1; x = GC_malloc(16); if (GC_base(x + 13) != x) { (void)GC_printf("GC_base(heap ptr) produced incorrect result\n"); FAIL; } # ifndef PCR if (GC_base(y) != 0) { (void)GC_printf("GC_base(fn_ptr) produced incorrect result\n"); FAIL; } # endif if (GC_same_obj(x+5, x) != x + 5) { (void)GC_printf("GC_same_obj produced incorrect result\n"); FAIL; } if (GC_is_visible(y) != y || GC_is_visible(x) != x) { (void)GC_printf("GC_is_visible produced incorrect result\n"); FAIL; } if (!TEST_FAIL_COUNT(1)) { # if!(defined(RS6000) || defined(POWERPC) || defined(IA64)) || defined(M68K) /* ON RS6000s function pointers point to a descriptor in the */ /* data segment, so there should have been no failures. */ /* The same applies to IA64. Something similar seems to */ /* be going on with NetBSD/M68K. */ (void)GC_printf("GC_is_visible produced wrong failure indication\n"); FAIL; # endif } if (GC_is_valid_displacement(y) != y || GC_is_valid_displacement(x) != x || GC_is_valid_displacement(x + 3) != x + 3) { (void)GC_printf( "GC_is_valid_displacement produced incorrect result\n"); FAIL; } # if defined(__STDC__) && !defined(MSWIN32) && !defined(MSWINCE) /* Harder to test under Windows without a gc.h declaration. */ { size_t i; extern void *GC_memalign(); GC_malloc(17); for (i = sizeof(GC_word); i < 512; i *= 2) { GC_word result = (GC_word) GC_memalign(i, 17); if (result % i != 0 || result == 0 || *(int *)result != 0) FAIL; } } # endif # ifndef ALL_INTERIOR_POINTERS # if defined(RS6000) || defined(POWERPC) if (!TEST_FAIL_COUNT(1)) { # else if (GC_all_interior_pointers && !TEST_FAIL_COUNT(1) || !GC_all_interior_pointers && !TEST_FAIL_COUNT(2)) { # endif (void)GC_printf("GC_is_valid_displacement produced wrong failure indication\n"); FAIL; } # endif # endif /* DBG_HDRS_ALL */ /* Test floating point alignment */ collectable_count += 2; *(double *)GC_MALLOC(sizeof(double)) = 1.0; *(double *)GC_MALLOC(sizeof(double)) = 1.0; # ifdef GC_GCJ_SUPPORT GC_REGISTER_DISPLACEMENT(sizeof(struct fake_vtable *)); GC_init_gcj_malloc(0, (void *)fake_gcj_mark_proc); # endif /* Make sure that fn arguments are visible to the collector. */ # ifdef __STDC__ uniq( GC_malloc(12), GC_malloc(12), GC_malloc(12), (GC_gcollect(),GC_malloc(12)), GC_malloc(12), GC_malloc(12), GC_malloc(12), (GC_gcollect(),GC_malloc(12)), GC_malloc(12), GC_malloc(12), GC_malloc(12), (GC_gcollect(),GC_malloc(12)), GC_malloc(12), GC_malloc(12), GC_malloc(12), (GC_gcollect(),GC_malloc(12)), GC_malloc(12), GC_malloc(12), GC_malloc(12), (GC_gcollect(),GC_malloc(12)), (void *)0); # endif /* GC_malloc(0) must return NULL or something we can deallocate. */ GC_free(GC_malloc(0)); GC_free(GC_malloc_atomic(0)); GC_free(GC_malloc(0)); GC_free(GC_malloc_atomic(0)); /* Repeated list reversal test. */ reverse_test(); # ifdef PRINTSTATS GC_printf("-------------Finished reverse_test\n"); # endif # ifndef DBG_HDRS_ALL typed_test(); # ifdef PRINTSTATS GC_printf("-------------Finished typed_test\n"); # endif # endif /* DBG_HDRS_ALL */ tree_test(); LOCK(); n_tests++; UNLOCK(); # if defined(THREADS) && defined(HANDLE_FORK) if (fork() == 0) { GC_gcollect(); tiny_reverse_test(0); GC_gcollect(); GC_printf("Finished a child process\n"); exit(0); } # endif /* GC_printf("Finished %x\n", pthread_self()); */ } void check_heap_stats() { size_t max_heap_sz; int i; int still_live; int late_finalize_count = 0; # ifdef VERY_SMALL_CONFIG /* these are something of a guess */ if (sizeof(char *) > 4) { max_heap_sz = 4500000; } else { max_heap_sz = 2800000; } # else if (sizeof(char *) > 4) { max_heap_sz = 19000000; } else { max_heap_sz = 11000000; } # endif # ifdef GC_DEBUG max_heap_sz *= 2; # ifdef SAVE_CALL_CHAIN max_heap_sz *= 3; # ifdef SAVE_CALL_COUNT max_heap_sz += max_heap_sz * SAVE_CALL_COUNT/4; # endif # endif # endif /* Garbage collect repeatedly so that all inaccessible objects */ /* can be finalized. */ while (GC_collect_a_little()) { } for (i = 0; i < 16; i++) { GC_gcollect(); late_finalize_count += GC_invoke_finalizers(); } (void)GC_printf("Completed %u tests\n", n_tests); (void)GC_printf("Allocated %d collectable objects\n", collectable_count); (void)GC_printf("Allocated %d uncollectable objects\n", uncollectable_count); (void)GC_printf("Allocated %d atomic objects\n", atomic_count); (void)GC_printf("Allocated %d stubborn objects\n", stubborn_count); (void)GC_printf("Finalized %d/%d objects - ", finalized_count, finalizable_count); # ifdef FINALIZE_ON_DEMAND if (finalized_count != late_finalize_count) { (void)GC_printf("Demand finalization error\n"); FAIL; } # endif if (finalized_count > finalizable_count || finalized_count < finalizable_count/2) { (void)GC_printf("finalization is probably broken\n"); FAIL; } else { (void)GC_printf("finalization is probably ok\n"); } still_live = 0; for (i = 0; i < MAX_FINALIZED; i++) { if (live_indicators[i] != 0) { still_live++; } } i = finalizable_count - finalized_count - still_live; if (0 != i) { GC_printf("%d disappearing links remain and %d more objects " "were not finalized\n", still_live, i); if (i > 10) { GC_printf("\tVery suspicious!\n"); } else { GC_printf("\tSlightly suspicious, but probably OK.\n"); } } (void)GC_printf("Total number of bytes allocated is %lu\n", (unsigned long) (GC_bytes_allocd + GC_bytes_allocd_before_gc)); (void)GC_printf("Final heap size is %lu bytes\n", (unsigned long)GC_get_heap_size()); if (GC_bytes_allocd + GC_bytes_allocd_before_gc # ifdef VERY_SMALL_CONFIG < 2700000*n_tests) { # else < 33500000*n_tests) { # endif (void)GC_printf("Incorrect execution - missed some allocations\n"); FAIL; } if (GC_get_heap_size() > max_heap_sz*n_tests) { (void)GC_printf("Unexpected heap growth - collector may be broken\n"); FAIL; } (void)GC_printf("Collector appears to work\n"); } #if defined(MACOS) void SetMinimumStack(long minSize) { long newApplLimit; if (minSize > LMGetDefltStack()) { newApplLimit = (long) GetApplLimit() - (minSize - LMGetDefltStack()); SetApplLimit((Ptr) newApplLimit); MaxApplZone(); } } #define cMinStackSpace (512L * 1024L) #endif #ifdef __STDC__ void warn_proc(char *msg, GC_word p) #else void warn_proc(msg, p) char *msg; GC_word p; #endif { GC_printf(msg, (unsigned long)p); /*FAIL;*/ } #if !defined(PCR) \ && !defined(GC_WIN32_THREADS) && !defined(GC_PTHREADS) \ || defined(LINT) #if defined(MSWIN32) && !defined(__MINGW32__) int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prev, LPTSTR cmd, int n) #else int main() #endif { # if defined(DJGPP) int dummy; # endif n_tests = 0; # if defined(DJGPP) /* No good way to determine stack base from library; do it */ /* manually on this platform. */ GC_stackbottom = (void *)(&dummy); # endif # if defined(MACOS) /* Make sure we have lots and lots of stack space. */ SetMinimumStack(cMinStackSpace); /* Cheat and let stdio initialize toolbox for us. */ printf("Testing GC Macintosh port.\n"); # endif GC_INIT(); /* Only needed on a few platforms. */ (void) GC_set_warn_proc(warn_proc); # if (defined(MPROTECT_VDB) || defined(PROC_VDB) || defined(GWW_VDB)) \ && !defined(MAKE_BACK_GRAPH) && !defined(NO_INCREMENTAL) GC_enable_incremental(); (void) GC_printf("Switched to incremental mode\n"); # if defined(MPROTECT_VDB) (void)GC_printf("Emulating dirty bits with mprotect/signals\n"); # else # ifdef PROC_VDB (void)GC_printf("Reading dirty bits from /proc\n"); # else (void)GC_printf("Using DEFAULT_VDB dirty bit implementation\n"); # endif # endif # endif run_one_test(); check_heap_stats(); # ifndef MSWINCE (void)fflush(stdout); # endif # ifdef LINT /* Entry points we should be testing, but aren't. */ /* Some can be tested by defining GC_DEBUG at the top of this file */ /* This is a bit SunOS4 specific. */ GC_noop(GC_expand_hp, GC_add_roots, GC_clear_roots, GC_register_disappearing_link, GC_register_finalizer_ignore_self, GC_debug_register_displacement, GC_print_obj, GC_debug_change_stubborn, GC_debug_end_stubborn_change, GC_debug_malloc_uncollectable, GC_debug_free, GC_debug_realloc, GC_generic_malloc_words_small, GC_init, GC_make_closure, GC_debug_invoke_finalizer, GC_page_was_ever_dirty, GC_is_fresh, GC_malloc_ignore_off_page, GC_malloc_atomic_ignore_off_page, GC_set_max_heap_size, GC_get_bytes_since_gc, GC_get_total_bytes, GC_pre_incr, GC_post_incr); # endif # ifdef MSWIN32 GC_win32_free_heap(); # endif return(0); } # endif #if defined(GC_WIN32_THREADS) && !defined(GC_PTHREADS) DWORD __stdcall thr_run_one_test(void *arg) { run_one_test(); return 0; } #ifdef MSWINCE HANDLE win_created_h; HWND win_handle; LRESULT CALLBACK window_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { LRESULT ret = 0; switch (uMsg) { case WM_HIBERNATE: GC_printf("Received WM_HIBERNATE, calling GC_gcollect\n"); GC_gcollect(); break; case WM_CLOSE: GC_printf("Received WM_CLOSE, closing window\n"); DestroyWindow(hwnd); break; case WM_DESTROY: PostQuitMessage(0); break; default: ret = DefWindowProc(hwnd, uMsg, wParam, lParam); break; } return ret; } DWORD __stdcall thr_window(void *arg) { WNDCLASS win_class = { CS_NOCLOSE, window_proc, 0, 0, GetModuleHandle(NULL), NULL, NULL, (HBRUSH)(COLOR_APPWORKSPACE+1), NULL, L"GCtestWindow" }; MSG msg; if (!RegisterClass(&win_class)) FAIL; win_handle = CreateWindowEx( 0, L"GCtestWindow", L"GCtest", 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, GetModuleHandle(NULL), NULL); if (win_handle == NULL) FAIL; SetEvent(win_created_h); ShowWindow(win_handle, SW_SHOW); UpdateWindow(win_handle); while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return 0; } #endif #define NTEST 2 # ifdef MSWINCE int APIENTRY GC_WinMain(HINSTANCE instance, HINSTANCE prev, LPWSTR cmd, int n) # else int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prev, LPSTR cmd, int n) # endif { # if NTEST > 0 HANDLE h[NTEST]; int i; # endif # ifdef MSWINCE HANDLE win_thr_h; # endif DWORD thread_id; # ifdef GC_DLL GC_use_DllMain(); /* Test with implicit thread registration if possible. */ GC_printf("Using DllMain to track threads\n"); # endif GC_INIT(); # ifndef NO_INCREMENTAL GC_enable_incremental(); # endif InitializeCriticalSection(&incr_cs); (void) GC_set_warn_proc(warn_proc); # ifdef MSWINCE win_created_h = CreateEvent(NULL, FALSE, FALSE, NULL); if (win_created_h == (HANDLE)NULL) { (void)GC_printf("Event creation failed %\n", GetLastError()); FAIL; } win_thr_h = GC_CreateThread(NULL, 0, thr_window, 0, 0, &thread_id); if (win_thr_h == (HANDLE)NULL) { (void)GC_printf("Thread creation failed %d\n", GetLastError()); FAIL; } if (WaitForSingleObject(win_created_h, INFINITE) != WAIT_OBJECT_0) FAIL; CloseHandle(win_created_h); # endif # if NTEST > 0 for (i = 0; i < NTEST; i++) { h[i] = GC_CreateThread(NULL, 0, thr_run_one_test, 0, 0, &thread_id); if (h[i] == (HANDLE)NULL) { (void)GC_printf("Thread creation failed %d\n", GetLastError()); FAIL; } } # endif /* NTEST > 0 */ run_one_test(); # if NTEST > 0 for (i = 0; i < NTEST; i++) { if (WaitForSingleObject(h[i], INFINITE) != WAIT_OBJECT_0) { (void)GC_printf("Thread wait failed %d\n", GetLastError()); FAIL; } } # endif /* NTEST > 0 */ # ifdef MSWINCE PostMessage(win_handle, WM_CLOSE, 0, 0); if (WaitForSingleObject(win_thr_h, INFINITE) != WAIT_OBJECT_0) FAIL; # endif check_heap_stats(); return(0); } #endif /* GC_WIN32_THREADS */ #ifdef PCR test() { PCR_Th_T * th1; PCR_Th_T * th2; int code; n_tests = 0; /* GC_enable_incremental(); */ (void) GC_set_warn_proc(warn_proc); th1 = PCR_Th_Fork(run_one_test, 0); th2 = PCR_Th_Fork(run_one_test, 0); run_one_test(); if (PCR_Th_T_Join(th1, &code, NIL, PCR_allSigsBlocked, PCR_waitForever) != PCR_ERes_okay || code != 0) { (void)GC_printf("Thread 1 failed\n"); } if (PCR_Th_T_Join(th2, &code, NIL, PCR_allSigsBlocked, PCR_waitForever) != PCR_ERes_okay || code != 0) { (void)GC_printf("Thread 2 failed\n"); } check_heap_stats(); return(0); } #endif #if defined(GC_PTHREADS) void * thr_run_one_test(void * arg) { run_one_test(); return(0); } #ifdef GC_DEBUG # define GC_free GC_debug_free #endif int main() { pthread_t th1; pthread_t th2; pthread_attr_t attr; int code; # ifdef GC_IRIX_THREADS /* Force a larger stack to be preallocated */ /* Since the initial cant always grow later. */ *((volatile char *)&code - 1024*1024) = 0; /* Require 1 Mb */ # endif /* GC_IRIX_THREADS */ # if defined(GC_HPUX_THREADS) /* Default stack size is too small, especially with the 64 bit ABI */ /* Increase it. */ if (pthread_default_stacksize_np(1024*1024, 0) != 0) { (void)GC_printf("pthread_default_stacksize_np failed.\n"); } # endif /* GC_HPUX_THREADS */ # ifdef PTW32_STATIC_LIB pthread_win32_process_attach_np (); pthread_win32_thread_attach_np (); # endif GC_INIT(); pthread_attr_init(&attr); # if defined(GC_IRIX_THREADS) || defined(GC_FREEBSD_THREADS) \ || defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS) pthread_attr_setstacksize(&attr, 1000000); # endif n_tests = 0; # if (defined(MPROTECT_VDB)) \ && !defined(PARALLEL_MARK) &&!defined(REDIRECT_MALLOC) \ && !defined(MAKE_BACK_GRAPH) && !defined(USE_PROC_FOR_LIBRARIES) \ && !defined(NO_INCREMENTAL) GC_enable_incremental(); (void) GC_printf("Switched to incremental mode\n"); # if defined(MPROTECT_VDB) (void)GC_printf("Emulating dirty bits with mprotect/signals\n"); # else # ifdef PROC_VDB (void)GC_printf("Reading dirty bits from /proc\n"); # else (void)GC_printf("Using DEFAULT_VDB dirty bit implementation\n"); # endif # endif # endif (void) GC_set_warn_proc(warn_proc); if ((code = pthread_key_create(&fl_key, 0)) != 0) { (void)GC_printf("Key creation failed %d\n", code); FAIL; } if ((code = pthread_create(&th1, &attr, thr_run_one_test, 0)) != 0) { (void)GC_printf("Thread 1 creation failed %d\n", code); FAIL; } if ((code = pthread_create(&th2, &attr, thr_run_one_test, 0)) != 0) { (void)GC_printf("Thread 2 creation failed %d\n", code); FAIL; } run_one_test(); if ((code = pthread_join(th1, 0)) != 0) { (void)GC_printf("Thread 1 failed %d\n", code); FAIL; } if (pthread_join(th2, 0) != 0) { (void)GC_printf("Thread 2 failed %d\n", code); FAIL; } check_heap_stats(); (void)fflush(stdout); pthread_attr_destroy(&attr); GC_printf("Completed %d collections\n", GC_gc_no); # ifdef PTW32_STATIC_LIB pthread_win32_thread_detach_np (); pthread_win32_process_detach_np (); # endif return(0); } #endif /* GC_PTHREADS */ synopsis-0.12/src/Synopsis/gc/tests/tests.am0000664000076400007640000000312011104702320020473 0ustar stefanstefan# # # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED # OR IMPLIED. ANY USE IS AT YOUR OWN RISK. # # Permission is hereby granted to use or copy this program # for any purpose, provided the above notices are retained on all copies. # Permission to modify the code and to distribute modified code is granted, # provided the above notices are retained, and a notice that the code was # modified is included with the above copyright notice. ## FIXME: trace_test don't works on macosx 10.3 ## gcc -g -O2 -o .libs/tracetest trace_test.o ../.libs/libgc.dylib -lpthread ## ld: Undefined symbols: ## _GC_generate_random_backtrace # Common libs to _LDADD for all tests. test_ldadd = $(top_builddir)/libgc.la $(EXTRA_TEST_LIBS) TESTS += gctest$(EXEEXT) check_PROGRAMS += gctest gctest_SOURCES = tests/test.c gctest_LDADD = $(test_ldadd) gctest_DEPENDENCIES = $(top_builddir)/libgc.la TESTS += leaktest$(EXEEXT) check_PROGRAMS += leaktest leaktest_SOURCES = tests/leak_test.c leaktest_LDADD = $(test_ldadd) TESTS += middletest$(EXEEXT) check_PROGRAMS += middletest middletest_SOURCES = tests/middle.c middletest_LDADD = $(test_ldadd) #TESTS += tracetest$(EXEEXT) #check_PROGRAMS += tracetest #tracetest_SOURCES = tests/trace_test.c #tracetest_LDADD = $(test_ldadd) if THREADS TESTS += threadleaktest$(EXEEXT) check_PROGRAMS += threadleaktest threadleaktest_SOURCES = tests/thread_leak_test.c threadleaktest_LDADD = $(test_ldadd) endif if CPLUSPLUS TESTS += test_cpp$(EXEEXT) check_PROGRAMS += test_cpp test_cpp_SOURCES = tests/test_cpp.cc test_cpp_LDADD = libgccpp.la $(test_ldadd) endif synopsis-0.12/src/Synopsis/gc/tests/leak_test.c0000664000076400007640000000114411104702320021135 0ustar stefanstefan#include "leak_detector.h" main() { int *p[10]; int i; GC_find_leak = 1; /* for new collect versions not compiled */ /* with -DFIND_LEAK. */ GC_INIT(); /* Needed if thread-local allocation is enabled. */ /* FIXME: This is not ideal. */ for (i = 0; i < 10; ++i) { p[i] = malloc(sizeof(int)+i); } CHECK_LEAKS(); for (i = 1; i < 10; ++i) { free(p[i]); } for (i = 0; i < 9; ++i) { p[i] = malloc(sizeof(int)+i); } CHECK_LEAKS(); CHECK_LEAKS(); CHECK_LEAKS(); return 0; } synopsis-0.12/src/Synopsis/gc/tests/test_cpp.cc0000664000076400007640000001766211104702320021162 0ustar stefanstefan/**************************************************************************** Copyright (c) 1994 by Xerox Corporation. All rights reserved. THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. Permission is hereby granted to use or copy this program for any purpose, provided the above notices are retained on all copies. Permission to modify the code and to distribute modified code is granted, provided the above notices are retained, and a notice that the code was modified is included with the above copyright notice. **************************************************************************** Last modified on Mon Jul 10 21:06:03 PDT 1995 by ellis modified on December 20, 1994 7:27 pm PST by boehm usage: test_cpp number-of-iterations This program tries to test the specific C++ functionality provided by gc_c++.h that isn't tested by the more general test routines of the collector. A recommended value for number-of-iterations is 10, which will take a few minutes to complete. ***************************************************************************/ #include "gc_cpp.h" #include #include #include #define USE_STD_ALLOCATOR #ifdef USE_STD_ALLOCATOR # include "gc_allocator.h" #elif __GNUC__ # include "new_gc_alloc.h" #else # include "gc_alloc.h" #endif extern "C" { # include "private/gcconfig.h" GC_API void GC_printf(const char *format, ...); /* Use GC private output to reach the same log file. */ /* Don't include gc_priv.h, since that may include Windows system */ /* header files that don't take kindly to this context. */ } #ifdef MSWIN32 # include #endif #ifdef GC_NAME_CONFLICT # define USE_GC UseGC struct foo * GC; #else # define USE_GC GC #endif #define my_assert( e ) \ if (! (e)) { \ GC_printf( "Assertion failure in " __FILE__ ", line %d: " #e "\n", \ __LINE__ ); \ exit( 1 ); } class A {public: /* An uncollectable class. */ A( int iArg ): i( iArg ) {} void Test( int iArg ) { my_assert( i == iArg );} int i;}; class B: public gc, public A {public: /* A collectable class. */ B( int j ): A( j ) {} ~B() { my_assert( deleting );} static void Deleting( int on ) { deleting = on;} static int deleting;}; int B::deleting = 0; class C: public gc_cleanup, public A {public: /* A collectable class with cleanup and virtual multiple inheritance. */ C( int levelArg ): A( levelArg ), level( levelArg ) { nAllocated++; if (level > 0) { left = new C( level - 1 ); right = new C( level - 1 );} else { left = right = 0;}} ~C() { this->A::Test( level ); nFreed++; my_assert( level == 0 ? left == 0 && right == 0 : level == left->level + 1 && level == right->level + 1 ); left = right = 0; level = -123456;} static void Test() { my_assert( nFreed <= nAllocated && nFreed >= .8 * nAllocated );} static int nFreed; static int nAllocated; int level; C* left; C* right;}; int C::nFreed = 0; int C::nAllocated = 0; class D: public gc {public: /* A collectable class with a static member function to be used as an explicit clean-up function supplied to ::new. */ D( int iArg ): i( iArg ) { nAllocated++;} static void CleanUp( void* obj, void* data ) { D* self = (D*) obj; nFreed++; my_assert( self->i == (int) (GC_word) data );} static void Test() { my_assert( nFreed >= .8 * nAllocated );} int i; static int nFreed; static int nAllocated;}; int D::nFreed = 0; int D::nAllocated = 0; class E: public gc_cleanup {public: /* A collectable class with clean-up for use by F. */ E() { nAllocated++;} ~E() { nFreed++;} static int nFreed; static int nAllocated;}; int E::nFreed = 0; int E::nAllocated = 0; class F: public E {public: /* A collectable class with clean-up, a base with clean-up, and a member with clean-up. */ F() { nAllocated++;} ~F() { nFreed++;} static void Test() { my_assert( nFreed >= .8 * nAllocated ); my_assert( 2 * nFreed == E::nFreed );} E e; static int nFreed; static int nAllocated;}; int F::nFreed = 0; int F::nAllocated = 0; GC_word Disguise( void* p ) { return ~ (GC_word) p;} void* Undisguise( GC_word i ) { return (void*) ~ i;} #ifdef MSWIN32 int APIENTRY WinMain( HINSTANCE instance, HINSTANCE prev, LPSTR cmd, int cmdShow ) { int argc; char* argv[ 3 ]; for (argc = 1; argc < sizeof( argv ) / sizeof( argv[ 0 ] ); argc++) { argv[ argc ] = strtok( argc == 1 ? cmd : 0, " \t" ); if (0 == argv[ argc ]) break;} #else # ifdef MACOS int main() { # else int main( int argc, char* argv[] ) { # endif #endif GC_INIT(); # if defined(MACOS) // MacOS char* argv_[] = {"test_cpp", "10"}; // doesn't argv = argv_; // have a argc = sizeof(argv_)/sizeof(argv_[0]); // commandline # endif int i, iters, n; # ifdef USE_STD_ALLOCATOR int *x = gc_allocator().allocate(1); int **xptr = traceable_allocator().allocate(1); # else # ifdef __GNUC__ int *x = (int *)gc_alloc::allocate(sizeof(int)); # else int *x = (int *)alloc::allocate(sizeof(int)); # endif # endif *x = 29; # ifdef USE_STD_ALLOCATOR *xptr = x; x = 0; # endif if (argc != 2 || (0 >= (n = atoi( argv[ 1 ] )))) { GC_printf( "usage: test_cpp number-of-iterations\nAssuming 10 iters\n" ); n = 10;} for (iters = 1; iters <= n; iters++) { GC_printf( "Starting iteration %d\n", iters ); /* Allocate some uncollectable As and disguise their pointers. Later we'll check to see if the objects are still there. We're checking to make sure these objects really are uncollectable. */ GC_word as[ 1000 ]; GC_word bs[ 1000 ]; for (i = 0; i < 1000; i++) { as[ i ] = Disguise( new (NoGC) A( i ) ); bs[ i ] = Disguise( new (NoGC) B( i ) );} /* Allocate a fair number of finalizable Cs, Ds, and Fs. Later we'll check to make sure they've gone away. */ for (i = 0; i < 1000; i++) { C* c = new C( 2 ); C c1( 2 ); /* stack allocation should work too */ D* d = ::new (USE_GC, D::CleanUp, (void*)(GC_word)i) D( i ); F* f = new F; if (0 == i % 10) delete c;} /* Allocate a very large number of collectable As and Bs and drop the references to them immediately, forcing many collections. */ for (i = 0; i < 1000000; i++) { A* a = new (USE_GC) A( i ); B* b = new B( i ); b = new (USE_GC) B( i ); if (0 == i % 10) { B::Deleting( 1 ); delete b; B::Deleting( 0 );} # ifdef FINALIZE_ON_DEMAND GC_invoke_finalizers(); # endif } /* Make sure the uncollectable As and Bs are still there. */ for (i = 0; i < 1000; i++) { A* a = (A*) Undisguise( as[ i ] ); B* b = (B*) Undisguise( bs[ i ] ); a->Test( i ); delete a; b->Test( i ); B::Deleting( 1 ); delete b; B::Deleting( 0 ); # ifdef FINALIZE_ON_DEMAND GC_invoke_finalizers(); # endif } /* Make sure most of the finalizable Cs, Ds, and Fs have gone away. */ C::Test(); D::Test(); F::Test();} # ifdef USE_STD_ALLOCATOR x = *xptr; # endif my_assert (29 == x[0]); GC_printf( "The test appears to have succeeded.\n" ); return( 0 );} synopsis-0.12/src/Synopsis/gc/tests/trace_test.c0000664000076400007640000000111711104702320021317 0ustar stefanstefan#include #define GC_DEBUG #include "gc.h" struct treenode { struct treenode *x; struct treenode *y; } * root[10]; struct treenode * mktree(int i) { struct treenode * r = GC_MALLOC(sizeof(struct treenode)); if (0 == i) return 0; if (1 == i) r = GC_MALLOC_ATOMIC(sizeof(struct treenode)); r -> x = mktree(i-1); r -> y = mktree(i-1); return r; } main() { int i; for (i = 0; i < 10; ++i) { root[i] = mktree(12); } GC_generate_random_backtrace(); GC_generate_random_backtrace(); GC_generate_random_backtrace(); GC_generate_random_backtrace(); } synopsis-0.12/src/Synopsis/gc/tests/thread_leak_test.c0000664000076400007640000000172211104702320022466 0ustar stefanstefan#ifndef GC_THREADS # define GC_THREADS #endif /* GC_THREADS */ #include "leak_detector.h" #include #include void * test(void * arg) { int *p[10]; int i; GC_find_leak = 1; /* for new collect versions not compiled */ /* with -DFIND_LEAK. */ for (i = 0; i < 10; ++i) { p[i] = malloc(sizeof(int)+i); } CHECK_LEAKS(); for (i = 1; i < 10; ++i) { free(p[i]); } return 0; } #define NTHREADS 5 main() { int i; pthread_t t[NTHREADS]; int code; GC_INIT(); for (i = 0; i < NTHREADS; ++i) { if ((code = pthread_create(t + i, 0, test, 0)) != 0) { printf("Thread creation failed %d\n", code); } } for (i = 0; i < NTHREADS; ++i) { if ((code = pthread_join(t[i], 0)) != 0) { printf("Thread join failed %lu\n", code); } } CHECK_LEAKS(); CHECK_LEAKS(); CHECK_LEAKS(); return 0; } synopsis-0.12/src/Synopsis/gc/tests/middle.c0000664000076400007640000000102211104702320020413 0ustar stefanstefan/* * Test at the boundary between small and large objects. * Inspired by a test case from Zoltan Varga. */ #include #include int main () { int i; GC_all_interior_pointers = 0; GC_INIT(); for (i = 0; i < 20000; ++i) { GC_malloc_atomic (4096); GC_malloc (4096); } for (i = 0; i < 20000; ++i) { GC_malloc_atomic (2048); GC_malloc (2048); } printf("Final heap size is %ld\n", GC_get_heap_size()); return 0; } synopsis-0.12/src/Synopsis/gc/headers.c0000664000076400007640000002600311104702321017435 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996 by Silicon Graphics. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* * This implements: * 1. allocation of heap block headers * 2. A map from addresses to heap block addresses to heap block headers * * Access speed is crucial. We implement an index structure based on a 2 * level tree. */ # include "private/gc_priv.h" bottom_index * GC_all_bottom_indices = 0; /* Pointer to first (lowest addr) */ /* bottom_index. */ bottom_index * GC_all_bottom_indices_end = 0; /* Pointer to last (highest addr) */ /* bottom_index. */ /* Non-macro version of header location routine */ hdr * GC_find_header(ptr_t h) { # ifdef HASH_TL hdr * result; GET_HDR(h, result); return(result); # else return(HDR_INNER(h)); # endif } /* Handle a header cache miss. Returns a pointer to the */ /* header corresponding to p, if p can possibly be a valid */ /* object pointer, and 0 otherwise. */ /* GUARANTEED to return 0 for a pointer past the first page */ /* of an object unless both GC_all_interior_pointers is set */ /* and p is in fact a valid object pointer. */ #ifdef PRINT_BLACK_LIST hdr * GC_header_cache_miss(ptr_t p, hdr_cache_entry *hce, ptr_t source) #else hdr * GC_header_cache_miss(ptr_t p, hdr_cache_entry *hce) #endif { hdr *hhdr; HC_MISS(); GET_HDR(p, hhdr); if (IS_FORWARDING_ADDR_OR_NIL(hhdr)) { if (GC_all_interior_pointers) { if (hhdr != 0) { ptr_t current = p; current = (ptr_t)HBLKPTR(current); do { current = current - HBLKSIZE*(word)hhdr; hhdr = HDR(current); } while(IS_FORWARDING_ADDR_OR_NIL(hhdr)); /* current points to near the start of the large object */ if (hhdr -> hb_flags & IGNORE_OFF_PAGE || HBLK_IS_FREE(hhdr)) return 0; if (p - current >= (ptrdiff_t)(hhdr->hb_sz)) { GC_ADD_TO_BLACK_LIST_NORMAL(p, source); /* Pointer past the end of the block */ return 0; } } else { GC_ADD_TO_BLACK_LIST_NORMAL(p, source); } return hhdr; /* Pointers past the first page are probably too rare */ /* to add them to the cache. We don't. */ /* And correctness relies on the fact that we don't. */ } else { if (hhdr == 0) { GC_ADD_TO_BLACK_LIST_NORMAL(p, source); } return 0; } } else { if (HBLK_IS_FREE(hhdr)) { GC_ADD_TO_BLACK_LIST_NORMAL(p, source); return 0; } else { hce -> block_addr = (word)(p) >> LOG_HBLKSIZE; hce -> hce_hdr = hhdr; return hhdr; } } } /* Routines to dynamically allocate collector data structures that will */ /* never be freed. */ static ptr_t scratch_free_ptr = 0; /* GC_scratch_last_end_ptr is end point of last obtained scratch area. */ /* GC_scratch_end_ptr is end point of current scratch area. */ ptr_t GC_scratch_alloc(size_t bytes) { register ptr_t result = scratch_free_ptr; bytes += GRANULE_BYTES-1; bytes &= ~(GRANULE_BYTES-1); scratch_free_ptr += bytes; if (scratch_free_ptr <= GC_scratch_end_ptr) { return(result); } { word bytes_to_get = MINHINCR * HBLKSIZE; if (bytes_to_get <= bytes) { /* Undo the damage, and get memory directly */ bytes_to_get = bytes; # ifdef USE_MMAP bytes_to_get += GC_page_size - 1; bytes_to_get &= ~(GC_page_size - 1); # endif result = (ptr_t)GET_MEM(bytes_to_get); scratch_free_ptr -= bytes; GC_scratch_last_end_ptr = result + bytes; return(result); } result = (ptr_t)GET_MEM(bytes_to_get); if (result == 0) { if (GC_print_stats) GC_printf("Out of memory - trying to allocate less\n"); scratch_free_ptr -= bytes; bytes_to_get = bytes; # ifdef USE_MMAP bytes_to_get += GC_page_size - 1; bytes_to_get &= ~(GC_page_size - 1); # endif return((ptr_t)GET_MEM(bytes_to_get)); } scratch_free_ptr = result; GC_scratch_end_ptr = scratch_free_ptr + bytes_to_get; GC_scratch_last_end_ptr = GC_scratch_end_ptr; return(GC_scratch_alloc(bytes)); } } static hdr * hdr_free_list = 0; /* Return an uninitialized header */ static hdr * alloc_hdr(void) { register hdr * result; if (hdr_free_list == 0) { result = (hdr *) GC_scratch_alloc((word)(sizeof(hdr))); } else { result = hdr_free_list; hdr_free_list = (hdr *) (result -> hb_next); } return(result); } static void free_hdr(hdr * hhdr) { hhdr -> hb_next = (struct hblk *) hdr_free_list; hdr_free_list = hhdr; } #ifdef USE_HDR_CACHE word GC_hdr_cache_hits = 0; word GC_hdr_cache_misses = 0; #endif void GC_init_headers(void) { register unsigned i; GC_all_nils = (bottom_index *)GC_scratch_alloc((word)sizeof(bottom_index)); BZERO(GC_all_nils, sizeof(bottom_index)); for (i = 0; i < TOP_SZ; i++) { GC_top_index[i] = GC_all_nils; } } /* Make sure that there is a bottom level index block for address addr */ /* Return FALSE on failure. */ static GC_bool get_index(word addr) { word hi = (word)(addr) >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE); bottom_index * r; bottom_index * p; bottom_index ** prev; bottom_index *pi; # ifdef HASH_TL word i = TL_HASH(hi); bottom_index * old; old = p = GC_top_index[i]; while(p != GC_all_nils) { if (p -> key == hi) return(TRUE); p = p -> hash_link; } r = (bottom_index*)GC_scratch_alloc((word)(sizeof (bottom_index))); if (r == 0) return(FALSE); BZERO(r, sizeof (bottom_index)); r -> hash_link = old; GC_top_index[i] = r; # else if (GC_top_index[hi] != GC_all_nils) return(TRUE); r = (bottom_index*)GC_scratch_alloc((word)(sizeof (bottom_index))); if (r == 0) return(FALSE); GC_top_index[hi] = r; BZERO(r, sizeof (bottom_index)); # endif r -> key = hi; /* Add it to the list of bottom indices */ prev = &GC_all_bottom_indices; /* pointer to p */ pi = 0; /* bottom_index preceding p */ while ((p = *prev) != 0 && p -> key < hi) { pi = p; prev = &(p -> asc_link); } r -> desc_link = pi; if (0 == p) { GC_all_bottom_indices_end = r; } else { p -> desc_link = r; } r -> asc_link = p; *prev = r; return(TRUE); } /* Install a header for block h. */ /* The header is uninitialized. */ /* Returns the header or 0 on failure. */ struct hblkhdr * GC_install_header(struct hblk *h) { hdr * result; if (!get_index((word) h)) return(0); result = alloc_hdr(); SET_HDR(h, result); # ifdef USE_MUNMAP result -> hb_last_reclaimed = (unsigned short)GC_gc_no; # endif return(result); } /* Set up forwarding counts for block h of size sz */ GC_bool GC_install_counts(struct hblk *h, size_t sz/* bytes */) { struct hblk * hbp; word i; for (hbp = h; (char *)hbp < (char *)h + sz; hbp += BOTTOM_SZ) { if (!get_index((word) hbp)) return(FALSE); } if (!get_index((word)h + sz - 1)) return(FALSE); for (hbp = h + 1; (char *)hbp < (char *)h + sz; hbp += 1) { i = HBLK_PTR_DIFF(hbp, h); SET_HDR(hbp, (hdr *)(i > MAX_JUMP? MAX_JUMP : i)); } return(TRUE); } /* Remove the header for block h */ void GC_remove_header(struct hblk *h) { hdr ** ha; GET_HDR_ADDR(h, ha); free_hdr(*ha); *ha = 0; } /* Remove forwarding counts for h */ void GC_remove_counts(struct hblk *h, size_t sz/* bytes */) { register struct hblk * hbp; for (hbp = h+1; (char *)hbp < (char *)h + sz; hbp += 1) { SET_HDR(hbp, 0); } } /* Apply fn to all allocated blocks */ /*VARARGS1*/ void GC_apply_to_all_blocks(void (*fn)(struct hblk *h, word client_data), word client_data) { signed_word j; bottom_index * index_p; for (index_p = GC_all_bottom_indices; index_p != 0; index_p = index_p -> asc_link) { for (j = BOTTOM_SZ-1; j >= 0;) { if (!IS_FORWARDING_ADDR_OR_NIL(index_p->index[j])) { if (!HBLK_IS_FREE(index_p->index[j])) { (*fn)(((struct hblk *) (((index_p->key << LOG_BOTTOM_SZ) + (word)j) << LOG_HBLKSIZE)), client_data); } j--; } else if (index_p->index[j] == 0) { j--; } else { j -= (signed_word)(index_p->index[j]); } } } } /* Get the next valid block whose address is at least h */ /* Return 0 if there is none. */ struct hblk * GC_next_used_block(struct hblk *h) { register bottom_index * bi; register word j = ((word)h >> LOG_HBLKSIZE) & (BOTTOM_SZ-1); GET_BI(h, bi); if (bi == GC_all_nils) { register word hi = (word)h >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE); bi = GC_all_bottom_indices; while (bi != 0 && bi -> key < hi) bi = bi -> asc_link; j = 0; } while(bi != 0) { while (j < BOTTOM_SZ) { hdr * hhdr = bi -> index[j]; if (IS_FORWARDING_ADDR_OR_NIL(hhdr)) { j++; } else { if (!HBLK_IS_FREE(hhdr)) { return((struct hblk *) (((bi -> key << LOG_BOTTOM_SZ) + j) << LOG_HBLKSIZE)); } else { j += divHBLKSZ(hhdr -> hb_sz); } } } j = 0; bi = bi -> asc_link; } return(0); } /* Get the last (highest address) block whose address is */ /* at most h. Return 0 if there is none. */ /* Unlike the above, this may return a free block. */ struct hblk * GC_prev_block(struct hblk *h) { register bottom_index * bi; register signed_word j = ((word)h >> LOG_HBLKSIZE) & (BOTTOM_SZ-1); GET_BI(h, bi); if (bi == GC_all_nils) { register word hi = (word)h >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE); bi = GC_all_bottom_indices_end; while (bi != 0 && bi -> key > hi) bi = bi -> desc_link; j = BOTTOM_SZ - 1; } while(bi != 0) { while (j >= 0) { hdr * hhdr = bi -> index[j]; if (0 == hhdr) { --j; } else if (IS_FORWARDING_ADDR_OR_NIL(hhdr)) { j -= (signed_word)hhdr; } else { return((struct hblk *) (((bi -> key << LOG_BOTTOM_SZ) + j) << LOG_HBLKSIZE)); } } j = BOTTOM_SZ - 1; bi = bi -> desc_link; } return(0); } synopsis-0.12/src/Synopsis/gc/include/0000775000076400007640000000000011172123233017304 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/include/gc_inline.h0000664000076400007640000001204211104702317021404 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved. * Copyright (c) 2005 Hewlett-Packard Development Company, L.P. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* USE OF THIS FILE IS NOT RECOMMENDED unless GC_all_interior_pointers */ /* is not set, or the collector has been built with */ /* -DDONT_ADD_BYTE_AT_END, or the specified size includes a pointerfree */ /* word at the end. In the standard collector configuration, */ /* the final word of each object may not be scanned. */ /* This interface is most useful for compilers that generate C. */ /* It is also used internally for thread-local allocation, in which */ /* case, the size is suitably adjusted by the caller. */ /* Manual use is hereby discouraged. */ #include "gc.h" #include "gc_tiny_fl.h" #if __GNUC__ >= 3 # define GC_EXPECT(expr, outcome) __builtin_expect(expr,outcome) /* Equivalent to (expr), but predict that usually (expr)==outcome. */ #else # define GC_EXPECT(expr, outcome) (expr) #endif /* __GNUC__ */ /* The ultimately general inline allocation macro. Allocate an object */ /* of size bytes, putting the resulting pointer in result. Tiny_fl is */ /* a "tiny" free list array, which will be used first, if the size */ /* is appropriate. If bytes is too large, we allocate with */ /* default_expr instead. If we need to refill the free list, we use */ /* GC_generic_malloc_many with the indicated kind. */ /* Tiny_fl should be an array of GC_TINY_FREELISTS void * pointers. */ /* If num_direct is nonzero, and the individual free list pointers */ /* are initialized to (void *)1, then we allocate numdirect granules */ /* directly using gmalloc before putting multiple objects into the */ /* tiny_fl entry. If num_direct is zero, then the free lists may also */ /* be initialized to (void *)0. */ /* We rely on much of this hopefully getting optimized away in the */ /* num_direct = 0 case. */ /* Particularly if bytes is constant, this should generate a small */ /* amount of code. */ # define GC_FAST_MALLOC_GRANS(result,granules,tiny_fl,num_direct,\ kind,default_expr,init) \ { \ if (GC_EXPECT(granules >= GC_TINY_FREELISTS,0)) { \ result = default_expr; \ } else { \ void **my_fl = tiny_fl + granules; \ void *my_entry=*my_fl; \ void *next; \ \ while (GC_EXPECT((GC_word)my_entry \ <= num_direct + GC_TINY_FREELISTS + 1, 0)) { \ /* Entry contains counter or NULL */ \ if ((GC_word)my_entry - 1 < num_direct) { \ /* Small counter value, not NULL */ \ *my_fl = (ptr_t)my_entry + granules + 1; \ result = default_expr; \ goto out; \ } else { \ /* Large counter or NULL */ \ GC_generic_malloc_many(((granules) == 0? GC_GRANULE_BYTES : \ RAW_BYTES_FROM_INDEX(granules)), \ kind, my_fl); \ my_entry = *my_fl; \ if (my_entry == 0) { \ result = GC_oom_fn(bytes); \ goto out; \ } \ } \ } \ next = *(void **)(my_entry); \ result = (void *)my_entry; \ *my_fl = next; \ init; \ PREFETCH_FOR_WRITE(next); \ GC_ASSERT(GC_size(result) >= bytes + EXTRA_BYTES); \ GC_ASSERT((kind) == PTRFREE || ((GC_word *)result)[1] == 0); \ out: ; \ } \ } # define GC_WORDS_TO_WHOLE_GRANULES(n) \ GC_WORDS_TO_GRANULES((n) + GC_GRANULE_WORDS - 1) /* Allocate n words (NOT BYTES). X is made to point to the result. */ /* This should really only be used if GC_all_interior_pointers is */ /* not set, or DONT_ADD_BYTE_AT_END is set. See above. */ /* The semantics changed in version 7.0; we no longer lock, and */ /* the caller is responsible for supplying a cleared tiny_fl */ /* free list array. For single-threaded applications, this may be */ /* a global array. */ # define GC_MALLOC_WORDS(result,n,tiny_fl) \ { \ size_t grans = WORDS_TO_WHOLE_GRANULES(n); \ GC_FAST_MALLOC_GRANS(result, grans, tiny_fl, 0, \ NORMAL, GC_malloc(grans*GRANULE_BYTES), \ *(void **)result = 0); \ } # define GC_MALLOC_ATOMIC_WORDS(result,n,tiny_fl) \ { \ size_t grans = WORDS_TO_WHOLE_GRANULES(n); \ GC_FAST_MALLOC_GRANS(result, grans, tiny_fl, 0, \ PTRFREE, GC_malloc_atomic(grans*GRANULE_BYTES), \ /* no initialization */); \ } /* And once more for two word initialized objects: */ # define GC_CONS(result, first, second, tiny_fl) \ { \ size_t grans = WORDS_TO_WHOLE_GRANULES(2); \ GC_FAST_MALLOC_GRANS(result, grans, tiny_fl, 0, \ NORMAL, GC_malloc(grans*GRANULE_BYTES), \ *(void **)result = (void *)(first)); \ ((void **)(result))[1] = (void *)(second); \ } synopsis-0.12/src/Synopsis/gc/include/gc_backptr.h0000664000076400007640000000546211104702317021564 0ustar stefanstefan/* * This is a simple API to implement pointer back tracing, i.e. * to answer questions such as "who is pointing to this" or * "why is this object being retained by the collector" * * This API assumes that we have an ANSI C compiler. * * Most of these calls yield useful information on only after * a garbage collection. Usually the client will first force * a full collection and then gather information, preferably * before much intervening allocation. * * The implementation of the interface is only about 99.9999% * correct. It is intended to be good enough for profiling, * but is not intended to be used with production code. * * Results are likely to be much more useful if all allocation is * accomplished through the debugging allocators. * * The implementation idea is due to A. Demers. */ #ifndef GC_BACKPTR_H #define GC_BACKPTR_H /* Store information about the object referencing dest in *base_p */ /* and *offset_p. */ /* If multiple objects or roots point to dest, the one reported */ /* will be the last on used by the garbage collector to trace the */ /* object. */ /* source is root ==> *base_p = address, *offset_p = 0 */ /* source is heap object ==> *base_p != 0, *offset_p = offset */ /* Returns 1 on success, 0 if source couldn't be determined. */ /* Dest can be any address within a heap object. */ typedef enum { GC_UNREFERENCED, /* No reference info available. */ GC_NO_SPACE, /* Dest not allocated with debug alloc */ GC_REFD_FROM_ROOT, /* Referenced directly by root *base_p */ GC_REFD_FROM_REG, /* Referenced from a register, i.e. */ /* a root without an address. */ GC_REFD_FROM_HEAP, /* Referenced from another heap obj. */ GC_FINALIZER_REFD /* Finalizable and hence accessible. */ } GC_ref_kind; GC_ref_kind GC_get_back_ptr_info(void *dest, void **base_p, size_t *offset_p); /* Generate a random heap address. */ /* The resulting address is in the heap, but */ /* not necessarily inside a valid object. */ void * GC_generate_random_heap_address(void); /* Generate a random address inside a valid marked heap object. */ void * GC_generate_random_valid_address(void); /* Force a garbage collection and generate a backtrace from a */ /* random heap address. */ /* This uses the GC logging mechanism (GC_printf) to produce */ /* output. It can often be called from a debugger. The */ /* source in dbg_mlc.c also serves as a sample client. */ void GC_generate_random_backtrace(void); /* Print a backtrace from a specific address. Used by the */ /* above. The client should call GC_gcollect() immediately */ /* before invocation. */ void GC_print_backtrace(void *); #endif /* GC_BACKPTR_H */ synopsis-0.12/src/Synopsis/gc/include/gc_pthread_redirects.h0000664000076400007640000000370211104702317023624 0ustar stefanstefan/* Our pthread support normally needs to intercept a number of thread */ /* calls. We arrange to do that here, if appropriate. */ #ifndef GC_PTHREAD_REDIRECTS_H #define GC_PTHREAD_REDIRECTS_H #if !defined(GC_USE_LD_WRAP) && defined(GC_PTHREADS) /* We need to intercept calls to many of the threads primitives, so */ /* that we can locate thread stacks and stop the world. */ /* Note also that the collector cannot always see thread specific data. */ /* Thread specific data should generally consist of pointers to */ /* uncollectable objects (allocated with GC_malloc_uncollectable, */ /* not the system malloc), which are deallocated using the destructor */ /* facility in thr_keycreate. Alternatively, keep a redundant pointer */ /* to thread specific data on the thread stack. */ # include # include int GC_pthread_create(pthread_t *new_thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg); #ifndef GC_DARWIN_THREADS int GC_pthread_sigmask(int how, const sigset_t *set, sigset_t *oset); #endif int GC_pthread_join(pthread_t thread, void **retval); int GC_pthread_detach(pthread_t thread); #if defined(GC_OSF1_THREADS) \ && defined(_PTHREAD_USE_MANGLED_NAMES_) && !defined(_PTHREAD_USE_PTDNAM_) /* Unless the compiler supports #pragma extern_prefix, the Tru64 UNIX redefines some POSIX thread functions to use mangled names. If so, undef them before redefining. */ # undef pthread_create # undef pthread_join # undef pthread_detach #endif # define pthread_create GC_pthread_create # define pthread_join GC_pthread_join # define pthread_detach GC_pthread_detach #ifndef GC_DARWIN_THREADS # ifdef pthread_sigmask # undef pthread_sigmask # endif /* pthread_sigmask */ # define pthread_sigmask GC_pthread_sigmask # define dlopen GC_dlopen #endif #endif /* GC_xxxxx_THREADS */ #endif /* GC_PTHREAD_REDIRECTS_H */ synopsis-0.12/src/Synopsis/gc/include/cord.h0000664000076400007640000003372511104702317020417 0ustar stefanstefan/* * Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * * Author: Hans-J. Boehm (boehm@parc.xerox.com) */ /* Boehm, October 5, 1995 4:20 pm PDT */ /* * Cords are immutable character strings. A number of operations * on long cords are much more efficient than their strings.h counterpart. * In particular, concatenation takes constant time independent of the length * of the arguments. (Cords are represented as trees, with internal * nodes representing concatenation and leaves consisting of either C * strings or a functional description of the string.) * * The following are reasonable applications of cords. They would perform * unacceptably if C strings were used: * - A compiler that produces assembly language output by repeatedly * concatenating instructions onto a cord representing the output file. * - A text editor that converts the input file to a cord, and then * performs editing operations by producing a new cord representing * the file after echa character change (and keeping the old ones in an * edit history) * * For optimal performance, cords should be built by * concatenating short sections. * This interface is designed for maximum compatibility with C strings. * ASCII NUL characters may be embedded in cords using CORD_from_fn. * This is handled correctly, but CORD_to_char_star will produce a string * with embedded NULs when given such a cord. * * This interface is fairly big, largely for performance reasons. * The most basic constants and functions: * * CORD - the type of a cord; * CORD_EMPTY - empty cord; * CORD_len(cord) - length of a cord; * CORD_cat(cord1,cord2) - concatenation of two cords; * CORD_substr(cord, start, len) - substring (or subcord); * CORD_pos i; CORD_FOR(i, cord) { ... CORD_pos_fetch(i) ... } - * examine each character in a cord. CORD_pos_fetch(i) is the char. * CORD_fetch(int i) - Retrieve i'th character (slowly). * CORD_cmp(cord1, cord2) - compare two cords. * CORD_from_file(FILE * f) - turn a read-only file into a cord. * CORD_to_char_star(cord) - convert to C string. * (Non-NULL C constant strings are cords.) * CORD_printf (etc.) - cord version of printf. Use %r for cords. */ # ifndef CORD_H # define CORD_H # include # include /* Cords have type const char *. This is cheating quite a bit, and not */ /* 100% portable. But it means that nonempty character string */ /* constants may be used as cords directly, provided the string is */ /* never modified in place. The empty cord is represented by, and */ /* can be written as, 0. */ typedef const char * CORD; /* An empty cord is always represented as nil */ # define CORD_EMPTY 0 /* Is a nonempty cord represented as a C string? */ #define CORD_IS_STRING(s) (*(s) != '\0') /* Concatenate two cords. If the arguments are C strings, they may */ /* not be subsequently altered. */ CORD CORD_cat(CORD x, CORD y); /* Concatenate a cord and a C string with known length. Except for the */ /* empty string case, this is a special case of CORD_cat. Since the */ /* length is known, it can be faster. */ /* The string y is shared with the resulting CORD. Hence it should */ /* not be altered by the caller. */ CORD CORD_cat_char_star(CORD x, const char * y, size_t leny); /* Compute the length of a cord */ size_t CORD_len(CORD x); /* Cords may be represented by functions defining the ith character */ typedef char (* CORD_fn)(size_t i, void * client_data); /* Turn a functional description into a cord. */ CORD CORD_from_fn(CORD_fn fn, void * client_data, size_t len); /* Return the substring (subcord really) of x with length at most n, */ /* starting at position i. (The initial character has position 0.) */ CORD CORD_substr(CORD x, size_t i, size_t n); /* Return the argument, but rebalanced to allow more efficient */ /* character retrieval, substring operations, and comparisons. */ /* This is useful only for cords that were built using repeated */ /* concatenation. Guarantees log time access to the result, unless */ /* x was obtained through a large number of repeated substring ops */ /* or the embedded functional descriptions take longer to evaluate. */ /* May reallocate significant parts of the cord. The argument is not */ /* modified; only the result is balanced. */ CORD CORD_balance(CORD x); /* The following traverse a cord by applying a function to each */ /* character. This is occasionally appropriate, especially where */ /* speed is crucial. But, since C doesn't have nested functions, */ /* clients of this sort of traversal are clumsy to write. Consider */ /* the functions that operate on cord positions instead. */ /* Function to iteratively apply to individual characters in cord. */ typedef int (* CORD_iter_fn)(char c, void * client_data); /* Function to apply to substrings of a cord. Each substring is a */ /* a C character string, not a general cord. */ typedef int (* CORD_batched_iter_fn)(const char * s, void * client_data); # define CORD_NO_FN ((CORD_batched_iter_fn)0) /* Apply f1 to each character in the cord, in ascending order, */ /* starting at position i. If */ /* f2 is not CORD_NO_FN, then multiple calls to f1 may be replaced by */ /* a single call to f2. The parameter f2 is provided only to allow */ /* some optimization by the client. This terminates when the right */ /* end of this string is reached, or when f1 or f2 return != 0. In the */ /* latter case CORD_iter returns != 0. Otherwise it returns 0. */ /* The specified value of i must be < CORD_len(x). */ int CORD_iter5(CORD x, size_t i, CORD_iter_fn f1, CORD_batched_iter_fn f2, void * client_data); /* A simpler version that starts at 0, and without f2: */ int CORD_iter(CORD x, CORD_iter_fn f1, void * client_data); # define CORD_iter(x, f1, cd) CORD_iter5(x, 0, f1, CORD_NO_FN, cd) /* Similar to CORD_iter5, but end-to-beginning. No provisions for */ /* CORD_batched_iter_fn. */ int CORD_riter4(CORD x, size_t i, CORD_iter_fn f1, void * client_data); /* A simpler version that starts at the end: */ int CORD_riter(CORD x, CORD_iter_fn f1, void * client_data); /* Functions that operate on cord positions. The easy way to traverse */ /* cords. A cord position is logically a pair consisting of a cord */ /* and an index into that cord. But it is much faster to retrieve a */ /* charcter based on a position than on an index. Unfortunately, */ /* positions are big (order of a few 100 bytes), so allocate them with */ /* caution. */ /* Things in cord_pos.h should be treated as opaque, except as */ /* described below. Also note that */ /* CORD_pos_fetch, CORD_next and CORD_prev have both macro and function */ /* definitions. The former may evaluate their argument more than once. */ # include "private/cord_pos.h" /* Visible definitions from above: typedef CORD_pos[1]; * Extract the cord from a position: CORD CORD_pos_to_cord(CORD_pos p); * Extract the current index from a position: size_t CORD_pos_to_index(CORD_pos p); * Fetch the character located at the given position: char CORD_pos_fetch(CORD_pos p); * Initialize the position to refer to the given cord and index. * Note that this is the most expensive function on positions: void CORD_set_pos(CORD_pos p, CORD x, size_t i); * Advance the position to the next character. * P must be initialized and valid. * Invalidates p if past end: void CORD_next(CORD_pos p); * Move the position to the preceding character. * P must be initialized and valid. * Invalidates p if past beginning: void CORD_prev(CORD_pos p); * Is the position valid, i.e. inside the cord? int CORD_pos_valid(CORD_pos p); */ # define CORD_FOR(pos, cord) \ for (CORD_set_pos(pos, cord, 0); CORD_pos_valid(pos); CORD_next(pos)) /* An out of memory handler to call. May be supplied by client. */ /* Must not return. */ extern void (* CORD_oom_fn)(void); /* Dump the representation of x to stdout in an implementation defined */ /* manner. Intended for debugging only. */ void CORD_dump(CORD x); /* The following could easily be implemented by the client. They are */ /* provided in cordxtra.c for convenience. */ /* Concatenate a character to the end of a cord. */ CORD CORD_cat_char(CORD x, char c); /* Concatenate n cords. */ CORD CORD_catn(int n, /* CORD */ ...); /* Return the character in CORD_substr(x, i, 1) */ char CORD_fetch(CORD x, size_t i); /* Return < 0, 0, or > 0, depending on whether x < y, x = y, x > y */ int CORD_cmp(CORD x, CORD y); /* A generalization that takes both starting positions for the */ /* comparison, and a limit on the number of characters to be compared. */ int CORD_ncmp(CORD x, size_t x_start, CORD y, size_t y_start, size_t len); /* Find the first occurrence of s in x at position start or later. */ /* Return the position of the first character of s in x, or */ /* CORD_NOT_FOUND if there is none. */ size_t CORD_str(CORD x, size_t start, CORD s); /* Return a cord consisting of i copies of (possibly NUL) c. Dangerous */ /* in conjunction with CORD_to_char_star. */ /* The resulting representation takes constant space, independent of i. */ CORD CORD_chars(char c, size_t i); # define CORD_nul(i) CORD_chars('\0', (i)) /* Turn a file into cord. The file must be seekable. Its contents */ /* must remain constant. The file may be accessed as an immediate */ /* result of this call and/or as a result of subsequent accesses to */ /* the cord. Short files are likely to be immediately read, but */ /* long files are likely to be read on demand, possibly relying on */ /* stdio for buffering. */ /* We must have exclusive access to the descriptor f, i.e. we may */ /* read it at any time, and expect the file pointer to be */ /* where we left it. Normally this should be invoked as */ /* CORD_from_file(fopen(...)) */ /* CORD_from_file arranges to close the file descriptor when it is no */ /* longer needed (e.g. when the result becomes inaccessible). */ /* The file f must be such that ftell reflects the actual character */ /* position in the file, i.e. the number of characters that can be */ /* or were read with fread. On UNIX systems this is always true. On */ /* MS Windows systems, f must be opened in binary mode. */ CORD CORD_from_file(FILE * f); /* Equivalent to the above, except that the entire file will be read */ /* and the file pointer will be closed immediately. */ /* The binary mode restriction from above does not apply. */ CORD CORD_from_file_eager(FILE * f); /* Equivalent to the above, except that the file will be read on demand.*/ /* The binary mode restriction applies. */ CORD CORD_from_file_lazy(FILE * f); /* Turn a cord into a C string. The result shares no structure with */ /* x, and is thus modifiable. */ char * CORD_to_char_star(CORD x); /* Turn a C string into a CORD. The C string is copied, and so may */ /* subsequently be modified. */ CORD CORD_from_char_star(const char *s); /* Identical to the above, but the result may share structure with */ /* the argument and is thus not modifiable. */ const char * CORD_to_const_char_star(CORD x); /* Write a cord to a file, starting at the current position. No */ /* trailing NULs are newlines are added. */ /* Returns EOF if a write error occurs, 1 otherwise. */ int CORD_put(CORD x, FILE * f); /* "Not found" result for the following two functions. */ # define CORD_NOT_FOUND ((size_t)(-1)) /* A vague analog of strchr. Returns the position (an integer, not */ /* a pointer) of the first occurrence of (char) c inside x at position */ /* i or later. The value i must be < CORD_len(x). */ size_t CORD_chr(CORD x, size_t i, int c); /* A vague analog of strrchr. Returns index of the last occurrence */ /* of (char) c inside x at position i or earlier. The value i */ /* must be < CORD_len(x). */ size_t CORD_rchr(CORD x, size_t i, int c); /* The following are also not primitive, but are implemented in */ /* cordprnt.c. They provide functionality similar to the ANSI C */ /* functions with corresponding names, but with the following */ /* additions and changes: */ /* 1. A %r conversion specification specifies a CORD argument. Field */ /* width, precision, etc. have the same semantics as for %s. */ /* (Note that %c,%C, and %S were already taken.) */ /* 2. The format string is represented as a CORD. */ /* 3. CORD_sprintf and CORD_vsprintf assign the result through the 1st */ /* argument. Unlike their ANSI C versions, there is no need to guess */ /* the correct buffer size. */ /* 4. Most of the conversions are implement through the native */ /* vsprintf. Hence they are usually no faster, and */ /* idiosyncracies of the native printf are preserved. However, */ /* CORD arguments to CORD_sprintf and CORD_vsprintf are NOT copied; */ /* the result shares the original structure. This may make them */ /* very efficient in some unusual applications. */ /* The format string is copied. */ /* All functions return the number of characters generated or -1 on */ /* error. This complies with the ANSI standard, but is inconsistent */ /* with some older implementations of sprintf. */ /* The implementation of these is probably less portable than the rest */ /* of this package. */ #ifndef CORD_NO_IO #include int CORD_sprintf(CORD * out, CORD format, ...); int CORD_vsprintf(CORD * out, CORD format, va_list args); int CORD_fprintf(FILE * f, CORD format, ...); int CORD_vfprintf(FILE * f, CORD format, va_list args); int CORD_printf(CORD format, ...); int CORD_vprintf(CORD format, va_list args); #endif /* CORD_NO_IO */ # endif /* CORD_H */ synopsis-0.12/src/Synopsis/gc/include/gc_config_macros.h0000664000076400007640000001157511104702317022751 0ustar stefanstefan/* * This should never be included directly. It is included only from gc.h. * We separate it only to make gc.h more suitable as documentation. * * Some tests for old macros. These violate our namespace rules and will * disappear shortly. Use the GC_ names. */ #if defined(SOLARIS_THREADS) || defined(_SOLARIS_THREADS) \ || defined(_SOLARIS_PTHREADS) || defined(GC_SOLARIS_PTHREADS) /* We no longer support old style Solaris threads. */ /* GC_SOLARIS_THREADS now means pthreads. */ # ifndef GC_SOLARIS_THREADS # define GC_SOLARIS_THREADS # endif #endif #if defined(IRIX_THREADS) # define GC_IRIX_THREADS #endif #if defined(DGUX_THREADS) # if !defined(GC_DGUX386_THREADS) # define GC_DGUX386_THREADS # endif #endif #if defined(AIX_THREADS) # define GC_AIX_THREADS #endif #if defined(HPUX_THREADS) # define GC_HPUX_THREADS #endif #if defined(OSF1_THREADS) # define GC_OSF1_THREADS #endif #if defined(LINUX_THREADS) # define GC_LINUX_THREADS #endif #if defined(WIN32_THREADS) # define GC_WIN32_THREADS #endif #if defined(USE_LD_WRAP) # define GC_USE_LD_WRAP #endif #if !defined(_REENTRANT) && (defined(GC_SOLARIS_THREADS) \ || defined(GC_HPUX_THREADS) \ || defined(GC_AIX_THREADS) \ || defined(GC_LINUX_THREADS) \ || defined(GC_NETBSD_THREADS) \ || defined(GC_GNU_THREADS)) # define _REENTRANT /* Better late than never. This fails if system headers that */ /* depend on this were previously included. */ #endif #if !defined(_PTHREADS) && defined(GC_NETBSD_THREADS) # define _PTHREADS #endif #if defined(GC_DGUX386_THREADS) && !defined(_POSIX4A_DRAFT10_SOURCE) # define _POSIX4A_DRAFT10_SOURCE 1 #endif # if defined(GC_SOLARIS_THREADS) || defined(GC_FREEBSD_THREADS) || \ defined(GC_IRIX_THREADS) || defined(GC_LINUX_THREADS) || \ defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) || \ defined(GC_DGUX386_THREADS) || defined(GC_DARWIN_THREADS) || \ defined(GC_AIX_THREADS) || defined(GC_NETBSD_THREADS) || \ (defined(GC_WIN32_THREADS) && defined(__CYGWIN32__)) || \ defined(GC_GNU_THREADS) # define GC_PTHREADS # endif #if defined(GC_WIN32_PTHREADS) # define GC_WIN32_THREADS # define GC_PTHREADS #endif #if defined(GC_THREADS) && !defined(GC_PTHREADS) # if defined(__linux__) # define GC_LINUX_THREADS # define GC_PTHREADS # endif # if !defined(__linux__) && (defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \ || defined(hppa) || defined(__HPPA)) \ || (defined(__ia64) && defined(_HPUX_SOURCE)) # define GC_HPUX_THREADS # define GC_PTHREADS # endif # if !defined(__linux__) && (defined(__alpha) || defined(__alpha__)) # define GC_OSF1_THREADS # define GC_PTHREADS # endif # if defined(__mips) && !defined(__linux__) # define GC_IRIX_THREADS # define GC_PTHREADS # endif # if defined(__sparc) && !defined(__linux__) \ || defined(sun) && (defined(i386) || defined(__i386__)) # define GC_SOLARIS_THREADS # define GC_PTHREADS # endif # if defined(__APPLE__) && defined(__MACH__) # define GC_DARWIN_THREADS # define GC_PTHREADS # endif # if !defined(GC_PTHREADS) && (defined(__FreeBSD__) || defined(__DragonFly__)) # define GC_FREEBSD_THREADS # define GC_PTHREADS # endif # if !defined(GC_PTHREADS) && defined(__NetBSD__) # define GC_NETBSD_THREADS # define GC_PTHREADS # endif # if defined(DGUX) && (defined(i386) || defined(__i386__)) # define GC_DGUX386_THREADS # define GC_PTHREADS # endif # if defined(_AIX) # define GC_AIX_THREADS # define GC_PTHREADS # endif #endif /* GC_THREADS */ #if defined(GC_THREADS) && !defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS) \ && (defined(_WIN32) || defined(_MSC_VER) || defined(__CYGWIN__) \ || defined(__MINGW32__) || defined(__BORLANDC__) \ || defined(_WIN32_WCE)) # define GC_WIN32_THREADS # if defined(__CYGWIN__) # define GC_PTHREADS # endif #endif # define __GC # ifndef _WIN32_WCE # include # if defined(__MINGW32__) # include /* We mention uintptr_t. */ /* Perhaps this should be included in pure msft environments */ /* as well? */ # endif # else /* ! _WIN32_WCE */ /* Yet more kluges for WinCE */ # include /* size_t is defined here */ typedef long ptrdiff_t; /* ptrdiff_t is not defined */ # endif #if defined(_DLL) && !defined(GC_NOT_DLL) && !defined(GC_DLL) # define GC_DLL #endif #if defined(__MINGW32__) && defined(GC_DLL) # ifdef GC_BUILD # define GC_API __declspec(dllexport) # else # define GC_API __declspec(dllimport) # endif #endif #if (defined(__DMC__) || defined(_MSC_VER)) && defined(GC_DLL) # ifdef GC_BUILD # define GC_API extern __declspec(dllexport) # else # define GC_API __declspec(dllimport) # endif #endif #if defined(__WATCOMC__) && defined(GC_DLL) # ifdef GC_BUILD # define GC_API extern __declspec(dllexport) # else # define GC_API extern __declspec(dllimport) # endif #endif #ifndef GC_API #define GC_API extern #endif synopsis-0.12/src/Synopsis/gc/include/private/0000775000076400007640000000000011172123233020756 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/include/private/darwin_stop_world.h0000664000076400007640000000066211104702317024674 0ustar stefanstefan#ifndef GC_DARWIN_STOP_WORLD_H #define GC_DARWIN_STOP_WORLD_H #if !defined(GC_DARWIN_THREADS) #error darwin_stop_world.h included without GC_DARWIN_THREADS defined #endif #include #include struct thread_stop_info { mach_port_t mach_thread; }; struct GC_mach_thread { thread_act_t thread; int already_suspended; }; void GC_darwin_register_mach_handler_thread(mach_port_t thread); #endif synopsis-0.12/src/Synopsis/gc/include/private/cord_pos.h0000664000076400007640000001000511104702317022734 0ustar stefanstefan/* * Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* Boehm, May 19, 1994 2:23 pm PDT */ # ifndef CORD_POSITION_H /* The representation of CORD_position. This is private to the */ /* implementation, but the size is known to clients. Also */ /* the implementation of some exported macros relies on it. */ /* Don't use anything defined here and not in cord.h. */ # define MAX_DEPTH 48 /* The maximum depth of a balanced cord + 1. */ /* We don't let cords get deeper than MAX_DEPTH. */ struct CORD_pe { CORD pe_cord; size_t pe_start_pos; }; /* A structure describing an entry on the path from the root */ /* to current position. */ typedef struct CORD_Pos { size_t cur_pos; int path_len; # define CORD_POS_INVALID (0x55555555) /* path_len == INVALID <==> position invalid */ const char *cur_leaf; /* Current leaf, if it is a string. */ /* If the current leaf is a function, */ /* then this may point to function_buf */ /* containing the next few characters. */ /* Always points to a valid string */ /* containing the current character */ /* unless cur_end is 0. */ size_t cur_start; /* Start position of cur_leaf */ size_t cur_end; /* Ending position of cur_leaf */ /* 0 if cur_leaf is invalid. */ struct CORD_pe path[MAX_DEPTH + 1]; /* path[path_len] is the leaf corresponding to cur_pos */ /* path[0].pe_cord is the cord we point to. */ # define FUNCTION_BUF_SZ 8 char function_buf[FUNCTION_BUF_SZ]; /* Space for next few chars */ /* from function node. */ } CORD_pos[1]; /* Extract the cord from a position: */ CORD CORD_pos_to_cord(CORD_pos p); /* Extract the current index from a position: */ size_t CORD_pos_to_index(CORD_pos p); /* Fetch the character located at the given position: */ char CORD_pos_fetch(CORD_pos p); /* Initialize the position to refer to the give cord and index. */ /* Note that this is the most expensive function on positions: */ void CORD_set_pos(CORD_pos p, CORD x, size_t i); /* Advance the position to the next character. */ /* P must be initialized and valid. */ /* Invalidates p if past end: */ void CORD_next(CORD_pos p); /* Move the position to the preceding character. */ /* P must be initialized and valid. */ /* Invalidates p if past beginning: */ void CORD_prev(CORD_pos p); /* Is the position valid, i.e. inside the cord? */ int CORD_pos_valid(CORD_pos p); char CORD__pos_fetch(CORD_pos); void CORD__next(CORD_pos); void CORD__prev(CORD_pos); #define CORD_pos_fetch(p) \ (((p)[0].cur_end != 0)? \ (p)[0].cur_leaf[(p)[0].cur_pos - (p)[0].cur_start] \ : CORD__pos_fetch(p)) #define CORD_next(p) \ (((p)[0].cur_pos + 1 < (p)[0].cur_end)? \ (p)[0].cur_pos++ \ : (CORD__next(p), 0)) #define CORD_prev(p) \ (((p)[0].cur_end != 0 && (p)[0].cur_pos > (p)[0].cur_start)? \ (p)[0].cur_pos-- \ : (CORD__prev(p), 0)) #define CORD_pos_to_index(p) ((p)[0].cur_pos) #define CORD_pos_to_cord(p) ((p)[0].path[0].pe_cord) #define CORD_pos_valid(p) ((p)[0].path_len != CORD_POS_INVALID) /* Some grubby stuff for performance-critical friends: */ #define CORD_pos_chars_left(p) ((long)((p)[0].cur_end) - (long)((p)[0].cur_pos)) /* Number of characters in cache. <= 0 ==> none */ #define CORD_pos_advance(p,n) ((p)[0].cur_pos += (n) - 1, CORD_next(p)) /* Advance position by n characters */ /* 0 < n < CORD_pos_chars_left(p) */ #define CORD_pos_cur_char_addr(p) \ (p)[0].cur_leaf + ((p)[0].cur_pos - (p)[0].cur_start) /* address of current character in cache. */ #endif synopsis-0.12/src/Synopsis/gc/include/private/gc_pmark.h0000664000076400007640000004311411104702317022716 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 2001 by Hewlett-Packard Company. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */ /* Private declarations of GC marker data structures and macros */ /* * Declarations of mark stack. Needed by marker and client supplied mark * routines. Transitively include gc_priv.h. * (Note that gc_priv.h should not be included before this, since this * includes dbg_mlc.h, which wants to include gc_priv.h AFTER defining * I_HIDE_POINTERS.) */ #ifndef GC_PMARK_H # define GC_PMARK_H # if defined(KEEP_BACK_PTRS) || defined(PRINT_BLACK_LIST) # include "dbg_mlc.h" # endif # ifndef GC_MARK_H # include "../gc_mark.h" # endif # ifndef GC_PRIVATE_H # include "gc_priv.h" # endif /* The real declarations of the following is in gc_priv.h, so that */ /* we can avoid scanning the following table. */ /* extern mark_proc GC_mark_procs[MAX_MARK_PROCS]; */ /* * Mark descriptor stuff that should remain private for now, mostly * because it's hard to export WORDSZ without including gcconfig.h. */ # define BITMAP_BITS (WORDSZ - GC_DS_TAG_BITS) # define PROC(descr) \ (GC_mark_procs[((descr) >> GC_DS_TAG_BITS) & (GC_MAX_MARK_PROCS-1)]) # define ENV(descr) \ ((descr) >> (GC_DS_TAG_BITS + GC_LOG_MAX_MARK_PROCS)) # define MAX_ENV \ (((word)1 << (WORDSZ - GC_DS_TAG_BITS - GC_LOG_MAX_MARK_PROCS)) - 1) extern unsigned GC_n_mark_procs; /* Number of mark stack entries to discard on overflow. */ #define GC_MARK_STACK_DISCARDS (INITIAL_MARK_STACK_SIZE/8) typedef struct GC_ms_entry { ptr_t mse_start; /* First word of object */ GC_word mse_descr; /* Descriptor; low order two bits are tags, */ /* identifying the upper 30 bits as one of the */ /* following: */ } mse; extern size_t GC_mark_stack_size; extern mse * GC_mark_stack_limit; #ifdef PARALLEL_MARK extern mse * volatile GC_mark_stack_top; #else extern mse * GC_mark_stack_top; #endif extern mse * GC_mark_stack; #ifdef PARALLEL_MARK /* * Allow multiple threads to participate in the marking process. * This works roughly as follows: * The main mark stack never shrinks, but it can grow. * * The initiating threads holds the GC lock, and sets GC_help_wanted. * * Other threads: * 1) update helper_count (while holding mark_lock.) * 2) allocate a local mark stack * repeatedly: * 3) Steal a global mark stack entry by atomically replacing * its descriptor with 0. * 4) Copy it to the local stack. * 5) Mark on the local stack until it is empty, or * it may be profitable to copy it back. * 6) If necessary, copy local stack to global one, * holding mark lock. * 7) Stop when the global mark stack is empty. * 8) decrement helper_count (holding mark_lock). * * This is an experiment to see if we can do something along the lines * of the University of Tokyo SGC in a less intrusive, though probably * also less performant, way. */ void GC_do_parallel_mark(); /* inititate parallel marking. */ extern GC_bool GC_help_wanted; /* Protected by mark lock */ extern unsigned GC_helper_count; /* Number of running helpers. */ /* Protected by mark lock */ extern unsigned GC_active_count; /* Number of active helpers. */ /* Protected by mark lock */ /* May increase and decrease */ /* within each mark cycle. But */ /* once it returns to 0, it */ /* stays zero for the cycle. */ /* GC_mark_stack_top is also protected by mark lock. */ /* * GC_notify_all_marker() is used when GC_help_wanted is first set, * when the last helper becomes inactive, * when something is added to the global mark stack, and just after * GC_mark_no is incremented. * This could be split into multiple CVs (and probably should be to * scale to really large numbers of processors.) */ #endif /* PARALLEL_MARK */ /* Return a pointer to within 1st page of object. */ /* Set *new_hdr_p to corr. hdr. */ ptr_t GC_find_start(ptr_t current, hdr *hhdr, hdr **new_hdr_p); mse * GC_signal_mark_stack_overflow(mse *msp); /* Push the object obj with corresponding heap block header hhdr onto */ /* the mark stack. */ # define PUSH_OBJ(obj, hhdr, mark_stack_top, mark_stack_limit) \ { \ register word _descr = (hhdr) -> hb_descr; \ \ if (_descr != 0) { \ mark_stack_top++; \ if (mark_stack_top >= mark_stack_limit) { \ mark_stack_top = GC_signal_mark_stack_overflow(mark_stack_top); \ } \ mark_stack_top -> mse_start = (obj); \ mark_stack_top -> mse_descr = _descr; \ } \ } /* Push the contents of current onto the mark stack if it is a valid */ /* ptr to a currently unmarked object. Mark it. */ /* If we assumed a standard-conforming compiler, we could probably */ /* generate the exit_label transparently. */ # define PUSH_CONTENTS(current, mark_stack_top, mark_stack_limit, \ source, exit_label) \ { \ hdr * my_hhdr; \ \ HC_GET_HDR(current, my_hhdr, source, exit_label); \ PUSH_CONTENTS_HDR(current, mark_stack_top, mark_stack_limit, \ source, exit_label, my_hhdr, TRUE); \ exit_label: ; \ } /* Set mark bit, exit if it was already set. */ # ifdef USE_MARK_BITS # ifdef PARALLEL_MARK /* The following may fail to exit even if the bit was already set. */ /* For our uses, that's benign: */ # define OR_WORD_EXIT_IF_SET(addr, bits, exit_label) \ { \ if (!(*(addr) & (mask))) { \ AO_or((AO_t *)(addr), (mask); \ } else { \ goto label; \ } \ } # else # define OR_WORD_EXIT_IF_SET(addr, bits, exit_label) \ { \ word old = *(addr); \ word my_bits = (bits); \ if (old & my_bits) goto exit_label; \ *(addr) = (old | my_bits); \ } # endif /* !PARALLEL_MARK */ # define SET_MARK_BIT_EXIT_IF_SET(hhdr,bit_no,exit_label) \ { \ word * mark_word_addr = hhdr -> hb_marks + divWORDSZ(bit_no); \ \ OR_WORD_EXIT_IF_SET(mark_word_addr, (word)1 << modWORDSZ(bit_no), \ exit_label); \ } # endif #ifdef USE_MARK_BYTES # if defined(I386) && defined(__GNUC__) # define LONG_MULT(hprod, lprod, x, y) { \ asm("mull %2" : "=a"(lprod), "=d"(hprod) : "g"(y), "0"(x)); \ } # else /* No in-line X86 assembly code */ # define LONG_MULT(hprod, lprod, x, y) { \ unsigned long long prod = (unsigned long long)x \ * (unsigned long long)y; \ hprod = prod >> 32; \ lprod = (unsigned32)prod; \ } # endif /* There is a race here, and we may set */ /* the bit twice in the concurrent case. This can result in the */ /* object being pushed twice. But that's only a performance issue. */ # define SET_MARK_BIT_EXIT_IF_SET(hhdr,bit_no,exit_label) \ { \ char * mark_byte_addr = (char *)hhdr -> hb_marks + (bit_no); \ char mark_byte = *mark_byte_addr; \ \ if (mark_byte) goto exit_label; \ *mark_byte_addr = 1; \ } #endif /* USE_MARK_BYTES */ #ifdef PARALLEL_MARK # define INCR_MARKS(hhdr) \ AO_store(&(hhdr -> hb_n_marks), AO_load(&(hhdr -> hb_n_marks))+1); #else # define INCR_MARKS(hhdr) ++(hhdr -> hb_n_marks) #endif #ifdef ENABLE_TRACE # define TRACE(source, cmd) \ if (GC_trace_addr != 0 && (ptr_t)(source) == GC_trace_addr) cmd # define TRACE_TARGET(target, cmd) \ if (GC_trace_addr != 0 && (target) == *(ptr_t *)GC_trace_addr) cmd #else # define TRACE(source, cmd) # define TRACE_TARGET(source, cmd) #endif /* If the mark bit corresponding to current is not set, set it, and */ /* push the contents of the object on the mark stack. Current points */ /* to the bginning of the object. We rely on the fact that the */ /* preceding header calculation will succeed for a pointer past the */ /* forst page of an object, only if it is in fact a valid pointer */ /* to the object. Thus we can omit the otherwise necessary tests */ /* here. Note in particular tha the "displ" value is the displacement */ /* from the beggining of the heap block, which may itself be in the */ /* interior of a large object. */ #ifdef MARK_BIT_PER_GRANULE # define PUSH_CONTENTS_HDR(current, mark_stack_top, mark_stack_limit, \ source, exit_label, hhdr, do_offset_check) \ { \ size_t displ = HBLKDISPL(current); /* Displacement in block; in bytes. */\ /* displ is always within range. If current doesn't point to */ \ /* first block, then we are in the all_interior_pointers case, and */ \ /* it is safe to use any displacement value. */ \ size_t gran_displ = BYTES_TO_GRANULES(displ); \ size_t gran_offset = hhdr -> hb_map[gran_displ]; \ size_t byte_offset = displ & (GRANULE_BYTES - 1); \ ptr_t base = current; \ /* The following always fails for large block references. */ \ if (EXPECT((gran_offset | byte_offset) != 0, FALSE)) { \ if (hhdr -> hb_large_block) { \ /* gran_offset is bogus. */ \ size_t obj_displ; \ base = (ptr_t)(hhdr -> hb_block); \ obj_displ = (ptr_t)(current) - base; \ if (obj_displ != displ) { \ GC_ASSERT(obj_displ < hhdr -> hb_sz); \ /* Must be in all_interior_pointer case, not first block */ \ /* already did validity check on cache miss. */ \ ; \ } else { \ if (do_offset_check && !GC_valid_offsets[obj_displ]) { \ GC_ADD_TO_BLACK_LIST_NORMAL(current, source); \ goto exit_label; \ } \ } \ gran_displ = 0; \ GC_ASSERT(hhdr -> hb_sz > HBLKSIZE || \ hhdr -> hb_block == HBLKPTR(current)); \ GC_ASSERT((ptr_t)(hhdr -> hb_block) <= (ptr_t) current); \ } else { \ size_t obj_displ = GRANULES_TO_BYTES(gran_offset) \ + byte_offset; \ if (do_offset_check && !GC_valid_offsets[obj_displ]) { \ GC_ADD_TO_BLACK_LIST_NORMAL(current, source); \ goto exit_label; \ } \ gran_displ -= gran_offset; \ base -= obj_displ; \ } \ } \ GC_ASSERT(hhdr == GC_find_header(base)); \ GC_ASSERT(gran_displ % BYTES_TO_GRANULES(hhdr -> hb_sz) == 0); \ TRACE(source, GC_log_printf("GC:%d: passed validity tests\n",GC_gc_no)); \ SET_MARK_BIT_EXIT_IF_SET(hhdr, gran_displ, exit_label); \ TRACE(source, GC_log_printf("GC:%d: previously unmarked\n",GC_gc_no)); \ TRACE_TARGET(base, \ GC_log_printf("GC:%d: marking %p from %p instead\n", GC_gc_no, \ base, source)); \ INCR_MARKS(hhdr); \ GC_STORE_BACK_PTR((ptr_t)source, base); \ PUSH_OBJ(base, hhdr, mark_stack_top, mark_stack_limit); \ } #endif /* MARK_BIT_PER_GRANULE */ #ifdef MARK_BIT_PER_OBJ # define PUSH_CONTENTS_HDR(current, mark_stack_top, mark_stack_limit, \ source, exit_label, hhdr, do_offset_check) \ { \ size_t displ = HBLKDISPL(current); /* Displacement in block; in bytes. */\ unsigned32 low_prod, high_prod, offset_fraction; \ unsigned32 inv_sz = hhdr -> hb_inv_sz; \ ptr_t base = current; \ LONG_MULT(high_prod, low_prod, displ, inv_sz); \ /* product is > and within sz_in_bytes of displ * sz_in_bytes * 2**32 */ \ if (EXPECT(low_prod >> 16 != 0, FALSE)) { \ FIXME: fails if offset is a multiple of HBLKSIZE which becomes 0 \ if (inv_sz == LARGE_INV_SZ) { \ size_t obj_displ; \ base = (ptr_t)(hhdr -> hb_block); \ obj_displ = (ptr_t)(current) - base; \ if (obj_displ != displ) { \ GC_ASSERT(obj_displ < hhdr -> hb_sz); \ /* Must be in all_interior_pointer case, not first block */ \ /* already did validity check on cache miss. */ \ ; \ } else { \ if (do_offset_check && !GC_valid_offsets[obj_displ]) { \ GC_ADD_TO_BLACK_LIST_NORMAL(current, source); \ goto exit_label; \ } \ } \ GC_ASSERT(hhdr -> hb_sz > HBLKSIZE || \ hhdr -> hb_block == HBLKPTR(current)); \ GC_ASSERT((ptr_t)(hhdr -> hb_block) < (ptr_t) current); \ } else { \ /* Accurate enough if HBLKSIZE <= 2**15. */ \ GC_ASSERT(HBLKSIZE <= (1 << 15)); \ size_t obj_displ = (((low_prod >> 16) + 1) * (hhdr -> hb_sz)) >> 16; \ if (do_offset_check && !GC_valid_offsets[obj_displ]) { \ GC_ADD_TO_BLACK_LIST_NORMAL(current, source); \ goto exit_label; \ } \ base -= obj_displ; \ } \ } \ /* May get here for pointer to start of block not at */ \ /* beginning of object. If so, it's valid, and we're fine. */ \ GC_ASSERT(high_prod >= 0 && high_prod <= HBLK_OBJS(hhdr -> hb_sz)); \ TRACE(source, GC_log_printf("GC:%d: passed validity tests\n",GC_gc_no)); \ SET_MARK_BIT_EXIT_IF_SET(hhdr, high_prod, exit_label); \ TRACE(source, GC_log_printf("GC:%d: previously unmarked\n",GC_gc_no)); \ TRACE_TARGET(base, \ GC_log_printf("GC:%d: marking %p from %p instead\n", GC_gc_no, \ base, source)); \ INCR_MARKS(hhdr); \ GC_STORE_BACK_PTR((ptr_t)source, base); \ PUSH_OBJ(base, hhdr, mark_stack_top, mark_stack_limit); \ } #endif /* MARK_BIT_PER_OBJ */ #if defined(PRINT_BLACK_LIST) || defined(KEEP_BACK_PTRS) # define PUSH_ONE_CHECKED_STACK(p, source) \ GC_mark_and_push_stack(p, (ptr_t)(source)) #else # define PUSH_ONE_CHECKED_STACK(p, source) \ GC_mark_and_push_stack(p) #endif /* * Push a single value onto mark stack. Mark from the object pointed to by p. * Invoke FIXUP_POINTER(p) before any further processing. * P is considered valid even if it is an interior pointer. * Previously marked objects are not pushed. Hence we make progress even * if the mark stack overflows. */ # if NEED_FIXUP_POINTER /* Try both the raw version and the fixed up one. */ # define GC_PUSH_ONE_STACK(p, source) \ if ((p) >= (ptr_t)GC_least_plausible_heap_addr \ && (p) < (ptr_t)GC_greatest_plausible_heap_addr) { \ PUSH_ONE_CHECKED_STACK(p, source); \ } \ FIXUP_POINTER(p); \ if ((p) >= (ptr_t)GC_least_plausible_heap_addr \ && (p) < (ptr_t)GC_greatest_plausible_heap_addr) { \ PUSH_ONE_CHECKED_STACK(p, source); \ } # else /* !NEED_FIXUP_POINTER */ # define GC_PUSH_ONE_STACK(p, source) \ if ((ptr_t)(p) >= (ptr_t)GC_least_plausible_heap_addr \ && (ptr_t)(p) < (ptr_t)GC_greatest_plausible_heap_addr) { \ PUSH_ONE_CHECKED_STACK(p, source); \ } # endif /* * As above, but interior pointer recognition as for * normal heap pointers. */ # define GC_PUSH_ONE_HEAP(p,source) \ FIXUP_POINTER(p); \ if ((p) >= (ptr_t)GC_least_plausible_heap_addr \ && (p) < (ptr_t)GC_greatest_plausible_heap_addr) { \ GC_mark_stack_top = GC_mark_and_push( \ (void *)(p), GC_mark_stack_top, \ GC_mark_stack_limit, (void * *)(source)); \ } /* Mark starting at mark stack entry top (incl.) down to */ /* mark stack entry bottom (incl.). Stop after performing */ /* about one page worth of work. Return the new mark stack */ /* top entry. */ mse * GC_mark_from(mse * top, mse * bottom, mse *limit); #define MARK_FROM_MARK_STACK() \ GC_mark_stack_top = GC_mark_from(GC_mark_stack_top, \ GC_mark_stack, \ GC_mark_stack + GC_mark_stack_size); /* * Mark from one finalizable object using the specified * mark proc. May not mark the object pointed to by * real_ptr. That is the job of the caller, if appropriate. * Note that this is called with the mutator running, but * with us holding the allocation lock. This is safe only if the * mutator needs tha allocation lock to reveal hidden pointers. * FIXME: Why do we need the GC_mark_state test below? */ # define GC_MARK_FO(real_ptr, mark_proc) \ { \ (*(mark_proc))(real_ptr); \ while (!GC_mark_stack_empty()) MARK_FROM_MARK_STACK(); \ if (GC_mark_state != MS_NONE) { \ GC_set_mark_bit(real_ptr); \ while (!GC_mark_some((ptr_t)0)) {} \ } \ } extern GC_bool GC_mark_stack_too_small; /* We need a larger mark stack. May be */ /* set by client supplied mark routines.*/ typedef int mark_state_t; /* Current state of marking, as follows:*/ /* Used to remember where we are during */ /* concurrent marking. */ /* We say something is dirty if it was */ /* written since the last time we */ /* retrieved dirty bits. We say it's */ /* grungy if it was marked dirty in the */ /* last set of bits we retrieved. */ /* Invariant I: all roots and marked */ /* objects p are either dirty, or point */ /* to objects q that are either marked */ /* or a pointer to q appears in a range */ /* on the mark stack. */ # define MS_NONE 0 /* No marking in progress. I holds. */ /* Mark stack is empty. */ # define MS_PUSH_RESCUERS 1 /* Rescuing objects are currently */ /* being pushed. I holds, except */ /* that grungy roots may point to */ /* unmarked objects, as may marked */ /* grungy objects above scan_ptr. */ # define MS_PUSH_UNCOLLECTABLE 2 /* I holds, except that marked */ /* uncollectable objects above scan_ptr */ /* may point to unmarked objects. */ /* Roots may point to unmarked objects */ # define MS_ROOTS_PUSHED 3 /* I holds, mark stack may be nonempty */ # define MS_PARTIALLY_INVALID 4 /* I may not hold, e.g. because of M.S. */ /* overflow. However marked heap */ /* objects below scan_ptr point to */ /* marked or stacked objects. */ # define MS_INVALID 5 /* I may not hold. */ extern mark_state_t GC_mark_state; #endif /* GC_PMARK_H */ synopsis-0.12/src/Synopsis/gc/include/private/pthread_stop_world.h0000664000076400007640000000046711104702317025042 0ustar stefanstefan#ifndef GC_PTHREAD_STOP_WORLD_H #define GC_PTHREAD_STOP_WORLD_H struct thread_stop_info { word last_stop_count; /* GC_last_stop_count value when thread */ /* last successfully handled a suspend */ /* signal. */ ptr_t stack_ptr; /* Valid only when stopped. */ }; #endif synopsis-0.12/src/Synopsis/gc/include/private/specific.h0000664000076400007640000000727711104702317022732 0ustar stefanstefan/* * This is a reimplementation of a subset of the pthread_getspecific/setspecific * interface. This appears to outperform the standard linuxthreads one * by a significant margin. * The major restriction is that each thread may only make a single * pthread_setspecific call on a single key. (The current data structure * doesn't really require that. The restriction should be easily removable.) * We don't currently support the destruction functions, though that * could be done. * We also currently assume that only one pthread_setspecific call * can be executed at a time, though that assumption would be easy to remove * by adding a lock. */ #include #include "atomic_ops.h" /* Called during key creation or setspecific. */ /* For the GC we already hold lock. */ /* Currently allocated objects leak on thread exit. */ /* That's hard to fix, but OK if we allocate garbage */ /* collected memory. */ #define MALLOC_CLEAR(n) GC_INTERNAL_MALLOC(n, NORMAL) #define PREFIXED(name) GC_##name #define TS_CACHE_SIZE 1024 #define CACHE_HASH(n) (((((long)n) >> 8) ^ (long)n) & (TS_CACHE_SIZE - 1)) #define TS_HASH_SIZE 1024 #define HASH(n) (((((long)n) >> 8) ^ (long)n) & (TS_HASH_SIZE - 1)) /* An entry describing a thread-specific value for a given thread. */ /* All such accessible structures preserve the invariant that if either */ /* thread is a valid pthread id or qtid is a valid "quick tread id" */ /* for a thread, then value holds the corresponding thread specific */ /* value. This invariant must be preserved at ALL times, since */ /* asynchronous reads are allowed. */ typedef struct thread_specific_entry { volatile AO_t qtid; /* quick thread id, only for cache */ void * value; struct thread_specific_entry *next; pthread_t thread; } tse; /* We represent each thread-specific datum as two tables. The first is */ /* a cache, indexed by a "quick thread identifier". The "quick" thread */ /* identifier is an easy to compute value, which is guaranteed to */ /* determine the thread, though a thread may correspond to more than */ /* one value. We typically use the address of a page in the stack. */ /* The second is a hash table, indexed by pthread_self(). It is used */ /* only as a backup. */ /* Return the "quick thread id". Default version. Assumes page size, */ /* or at least thread stack separation, is at least 4K. */ /* Must be defined so that it never returns 0. (Page 0 can't really */ /* be part of any stack, since that would make 0 a valid stack pointer.)*/ static __inline__ unsigned long quick_thread_id() { int dummy; return (unsigned long)(&dummy) >> 12; } #define INVALID_QTID ((unsigned long)0) #define INVALID_THREADID ((pthread_t)0) typedef struct thread_specific_data { tse * volatile cache[TS_CACHE_SIZE]; /* A faster index to the hash table */ tse * hash[TS_HASH_SIZE]; pthread_mutex_t lock; } tsd; typedef tsd * PREFIXED(key_t); extern int PREFIXED(key_create) (tsd ** key_ptr, void (* destructor)(void *)); extern int PREFIXED(setspecific) (tsd * key, void * value); extern void PREFIXED(remove_specific) (tsd * key); /* An internal version of getspecific that assumes a cache miss. */ void * PREFIXED(slow_getspecific) (tsd * key, unsigned long qtid, tse * volatile * cache_entry); static __inline__ void * PREFIXED(getspecific) (tsd * key) { long qtid = quick_thread_id(); unsigned hash_val = CACHE_HASH(qtid); tse * volatile * entry_ptr = key -> cache + hash_val; tse * entry = *entry_ptr; /* Must be loaded only once. */ if (EXPECT(entry -> qtid == qtid, 1)) { GC_ASSERT(entry -> thread == pthread_self()); return entry -> value; } return PREFIXED(slow_getspecific) (key, qtid, entry_ptr); } synopsis-0.12/src/Synopsis/gc/include/private/gc_hdrs.h0000664000076400007640000001530711104702317022547 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* Boehm, July 11, 1995 11:54 am PDT */ # ifndef GC_HEADERS_H # define GC_HEADERS_H typedef struct hblkhdr hdr; # if CPP_WORDSZ != 32 && CPP_WORDSZ < 36 --> Get a real machine. # endif /* * The 2 level tree data structure that is used to find block headers. * If there are more than 32 bits in a pointer, the top level is a hash * table. * * This defines HDR, GET_HDR, and SET_HDR, the main macros used to * retrieve and set object headers. * * We take advantage of a header lookup * cache. This is a locally declared direct mapped cache, used inside * the marker. The HC_GET_HDR macro uses and maintains this * cache. Assuming we get reasonable hit rates, this shaves a few * memory references from each pointer validation. */ # if CPP_WORDSZ > 32 # define HASH_TL # endif /* Define appropriate out-degrees for each of the two tree levels */ # ifdef SMALL_CONFIG # define LOG_BOTTOM_SZ 11 /* Keep top index size reasonable with smaller blocks. */ # else # define LOG_BOTTOM_SZ 10 # endif # ifndef HASH_TL # define LOG_TOP_SZ (WORDSZ - LOG_BOTTOM_SZ - LOG_HBLKSIZE) # else # define LOG_TOP_SZ 11 # endif # define TOP_SZ (1 << LOG_TOP_SZ) # define BOTTOM_SZ (1 << LOG_BOTTOM_SZ) #ifndef SMALL_CONFIG # define USE_HDR_CACHE #endif /* #define COUNT_HDR_CACHE_HITS */ # ifdef COUNT_HDR_CACHE_HITS extern word GC_hdr_cache_hits; extern word GC_hdr_cache_misses; # define HC_HIT() ++GC_hdr_cache_hits # define HC_MISS() ++GC_hdr_cache_misses # else # define HC_HIT() # define HC_MISS() # endif typedef struct hce { word block_addr; /* right shifted by LOG_HBLKSIZE */ hdr * hce_hdr; } hdr_cache_entry; # define HDR_CACHE_SIZE 8 /* power of 2 */ # define DECLARE_HDR_CACHE \ hdr_cache_entry hdr_cache[HDR_CACHE_SIZE] # define INIT_HDR_CACHE BZERO(hdr_cache, sizeof(hdr_cache)) # define HCE(h) hdr_cache + (((word)(h) >> LOG_HBLKSIZE) & (HDR_CACHE_SIZE-1)) # define HCE_VALID_FOR(hce,h) ((hce) -> block_addr == \ ((word)(h) >> LOG_HBLKSIZE)) # define HCE_HDR(h) ((hce) -> hce_hdr) #ifdef PRINT_BLACK_LIST hdr * GC_header_cache_miss(ptr_t p, hdr_cache_entry *hce, ptr_t source); # define HEADER_CACHE_MISS(p, hce, source) \ GC_header_cache_miss(p, hce, source) #else hdr * GC_header_cache_miss(ptr_t p, hdr_cache_entry *hce); # define HEADER_CACHE_MISS(p, hce, source) GC_header_cache_miss(p, hce) #endif /* Set hhdr to the header for p. Analogous to GET_HDR below, */ /* except that in the case of large objects, it */ /* gets the header for the object beginning, if GC_all_interior_ptrs */ /* is set. */ /* Returns zero if p points to somewhere other than the first page */ /* of an object, and it is not a valid pointer to the object. */ # define HC_GET_HDR(p, hhdr, source, exit_label) \ { \ hdr_cache_entry * hce = HCE(p); \ if (EXPECT(HCE_VALID_FOR(hce, p), 1)) { \ HC_HIT(); \ hhdr = hce -> hce_hdr; \ } else { \ hhdr = HEADER_CACHE_MISS(p, hce, source); \ if (0 == hhdr) goto exit_label; \ } \ } typedef struct bi { hdr * index[BOTTOM_SZ]; /* * The bottom level index contains one of three kinds of values: * 0 means we're not responsible for this block, * or this is a block other than the first one in a free block. * 1 < (long)X <= MAX_JUMP means the block starts at least * X * HBLKSIZE bytes before the current address. * A valid pointer points to a hdr structure. (The above can't be * valid pointers due to the GET_MEM return convention.) */ struct bi * asc_link; /* All indices are linked in */ /* ascending order... */ struct bi * desc_link; /* ... and in descending order. */ word key; /* high order address bits. */ # ifdef HASH_TL struct bi * hash_link; /* Hash chain link. */ # endif } bottom_index; /* extern bottom_index GC_all_nils; - really part of GC_arrays */ /* extern bottom_index * GC_top_index []; - really part of GC_arrays */ /* Each entry points to a bottom_index. */ /* On a 32 bit machine, it points to */ /* the index for a set of high order */ /* bits equal to the index. For longer */ /* addresses, we hash the high order */ /* bits to compute the index in */ /* GC_top_index, and each entry points */ /* to a hash chain. */ /* The last entry in each chain is */ /* GC_all_nils. */ # define MAX_JUMP (HBLKSIZE - 1) # define HDR_FROM_BI(bi, p) \ ((bi)->index[((word)(p) >> LOG_HBLKSIZE) & (BOTTOM_SZ - 1)]) # ifndef HASH_TL # define BI(p) (GC_top_index \ [(word)(p) >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE)]) # define HDR_INNER(p) HDR_FROM_BI(BI(p),p) # ifdef SMALL_CONFIG # define HDR(p) GC_find_header((ptr_t)(p)) # else # define HDR(p) HDR_INNER(p) # endif # define GET_BI(p, bottom_indx) (bottom_indx) = BI(p) # define GET_HDR(p, hhdr) (hhdr) = HDR(p) # define SET_HDR(p, hhdr) HDR_INNER(p) = (hhdr) # define GET_HDR_ADDR(p, ha) (ha) = &(HDR_INNER(p)) # else /* hash */ /* Hash function for tree top level */ # define TL_HASH(hi) ((hi) & (TOP_SZ - 1)) /* Set bottom_indx to point to the bottom index for address p */ # define GET_BI(p, bottom_indx) \ { \ register word hi = \ (word)(p) >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE); \ register bottom_index * _bi = GC_top_index[TL_HASH(hi)]; \ \ while (_bi -> key != hi && _bi != GC_all_nils) \ _bi = _bi -> hash_link; \ (bottom_indx) = _bi; \ } # define GET_HDR_ADDR(p, ha) \ { \ register bottom_index * bi; \ \ GET_BI(p, bi); \ (ha) = &(HDR_FROM_BI(bi, p)); \ } # define GET_HDR(p, hhdr) { register hdr ** _ha; GET_HDR_ADDR(p, _ha); \ (hhdr) = *_ha; } # define SET_HDR(p, hhdr) { register hdr ** _ha; GET_HDR_ADDR(p, _ha); \ *_ha = (hhdr); } # define HDR(p) GC_find_header((ptr_t)(p)) # endif /* Is the result a forwarding address to someplace closer to the */ /* beginning of the block or NIL? */ # define IS_FORWARDING_ADDR_OR_NIL(hhdr) ((size_t) (hhdr) <= MAX_JUMP) /* Get an HBLKSIZE aligned address closer to the beginning of the block */ /* h. Assumes hhdr == HDR(h) and IS_FORWARDING_ADDR(hhdr). */ # define FORWARDED_ADDR(h, hhdr) ((struct hblk *)(h) - (size_t)(hhdr)) # endif /* GC_HEADERS_H */ synopsis-0.12/src/Synopsis/gc/include/private/gcconfig.h0000664000076400007640000022016011104702317022710 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996 by Silicon Graphics. All rights reserved. * Copyright (c) 2000-2004 Hewlett-Packard Development Company, L.P. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* * This header is private to the gc. It is almost always included from * gc_priv.h. However it is possible to include it by itself if just the * configuration macros are needed. In that * case, a few declarations relying on types declared in gc_priv.h will be * omitted. */ #ifndef GCCONFIG_H # define GCCONFIG_H # ifndef GC_PRIVATE_H /* Fake ptr_t declaration, just to avoid compilation errors. */ /* This avoids many instances if "ifndef GC_PRIVATE_H" below. */ typedef struct GC_undefined_struct * ptr_t; # include /* For size_t etc. */ # endif /* Machine dependent parameters. Some tuning parameters can be found */ /* near the top of gc_private.h. */ /* Machine specific parts contributed by various people. See README file. */ /* First a unified test for Linux: */ # if defined(linux) || defined(__linux__) # ifndef LINUX # define LINUX # endif # endif /* And one for NetBSD: */ # if defined(__NetBSD__) # define NETBSD # endif /* And one for OpenBSD: */ # if defined(__OpenBSD__) # define OPENBSD # endif /* And one for FreeBSD: */ # if (defined(__FreeBSD__) || defined(__DragonFly__) || \ defined(__FreeBSD_kernel__)) && !defined(FREEBSD) # define FREEBSD # endif /* Determine the machine type: */ # if defined(__arm__) || defined(__thumb__) # define ARM32 # if !defined(LINUX) && !defined(NETBSD) # define NOSYS # define mach_type_known # endif # endif # if defined(sun) && defined(mc68000) # error SUNOS4 no longer supported # endif # if defined(hp9000s300) # error M68K based HP machines no longer supported. # endif # if defined(OPENBSD) && defined(m68k) # define M68K # define mach_type_known # endif # if defined(OPENBSD) && defined(__sparc__) # define SPARC # define mach_type_known # endif # if defined(NETBSD) && (defined(m68k) || defined(__m68k__)) # define M68K # define mach_type_known # endif # if defined(NETBSD) && defined(__powerpc__) # define POWERPC # define mach_type_known # endif # if defined(NETBSD) && (defined(__arm32__) || defined(__arm__)) # define ARM32 # define mach_type_known # endif # if defined(NETBSD) && defined(__sh__) # define SH # define mach_type_known # endif # if defined(vax) # define VAX # ifdef ultrix # define ULTRIX # else # define BSD # endif # define mach_type_known # endif # if defined(__NetBSD__) && defined(__vax__) # define VAX # define mach_type_known # endif # if defined(mips) || defined(__mips) || defined(_mips) # define MIPS # if defined(nec_ews) || defined(_nec_ews) # define EWS4800 # endif # if !defined(LINUX) && !defined(EWS4800) && !defined(NETBSD) # if defined(ultrix) || defined(__ultrix) # define ULTRIX # else # define IRIX5 /* or IRIX 6.X */ # endif # endif /* !LINUX */ # if defined(__NetBSD__) && defined(__MIPSEL__) # undef ULTRIX # endif # define mach_type_known # endif # if defined(DGUX) && (defined(i386) || defined(__i386__)) # define I386 # ifndef _USING_DGUX # define _USING_DGUX # endif # define mach_type_known # endif # if defined(sequent) && (defined(i386) || defined(__i386__)) # define I386 # define SEQUENT # define mach_type_known # endif # if defined(sun) && (defined(i386) || defined(__i386__)) # define I386 # define SOLARIS # define mach_type_known # endif # if defined(sun) && defined(__amd64) # define X86_64 # define SOLARIS # define mach_type_known # endif # if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__) # define I386 # define OS2 # define mach_type_known # endif # if defined(ibm032) # error IBM PC/RT no longer supported. # endif # if defined(sun) && (defined(sparc) || defined(__sparc)) # define SPARC /* Test for SunOS 5.x */ # include # define SOLARIS # define mach_type_known # endif # if defined(sparc) && defined(unix) && !defined(sun) && !defined(linux) \ && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__) \ && !defined(__DragonFly__) # define SPARC # define DRSNX # define mach_type_known # endif # if defined(_IBMR2) # define POWERPC # define AIX # define mach_type_known # endif # if defined(__NetBSD__) && defined(__sparc__) # define SPARC # define mach_type_known # endif # if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386) /* The above test may need refinement */ # define I386 # if defined(_SCO_ELF) # define SCO_ELF # else # define SCO # endif # define mach_type_known # endif # if defined(_AUX_SOURCE) # error A/UX no longer supported # endif # if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \ || defined(hppa) || defined(__hppa__) # define HP_PA # if !defined(LINUX) && !defined(HPUX) # define HPUX # endif # define mach_type_known # endif # if defined(__ia64) && defined(_HPUX_SOURCE) # define IA64 # ifndef HPUX # define HPUX # endif # define mach_type_known # endif # if defined(__BEOS__) && defined(_X86_) # define I386 # define BEOS # define mach_type_known # endif # if defined(LINUX) && (defined(i386) || defined(__i386__)) # define I386 # define mach_type_known # endif # if defined(LINUX) && defined(__x86_64__) # define X86_64 # define mach_type_known # endif # if defined(LINUX) && (defined(__ia64__) || defined(__ia64)) # define IA64 # define mach_type_known # endif # if defined(LINUX) && defined(__arm__) # define ARM32 # define mach_type_known # endif # if defined(LINUX) && defined(__cris__) # ifndef CRIS # define CRIS # endif # define mach_type_known # endif # if defined(LINUX) && (defined(powerpc) || defined(__powerpc__) || \ defined(powerpc64) || defined(__powerpc64__)) # define POWERPC # define mach_type_known # endif # if defined(FREEBSD) && (defined(powerpc) || defined(__powerpc__)) # define POWERPC # define mach_type_known # endif # if defined(LINUX) && defined(__mc68000__) # define M68K # define mach_type_known # endif # if defined(LINUX) && (defined(sparc) || defined(__sparc__)) # define SPARC # define mach_type_known # endif # if defined(LINUX) && defined(__arm__) # define ARM32 # define mach_type_known # endif # if defined(LINUX) && defined(__sh__) # define SH # define mach_type_known # endif # if defined(LINUX) && defined(__m32r__) # define M32R # define mach_type_known # endif # if defined(__alpha) || defined(__alpha__) # define ALPHA # if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD) && !defined(FREEBSD) # define OSF1 /* a.k.a Digital Unix */ # endif # define mach_type_known # endif # if defined(_AMIGA) && !defined(AMIGA) # define AMIGA # endif # ifdef AMIGA # define M68K # define mach_type_known # endif # if defined(THINK_C) || defined(__MWERKS__) && !defined(__powerc) # define M68K # define MACOS # define mach_type_known # endif # if defined(__MWERKS__) && defined(__powerc) && !defined(__MACH__) # define POWERPC # define MACOS # define mach_type_known # endif # if defined(macosx) || (defined(__APPLE__) && defined(__MACH__)) # define DARWIN # if defined(__ppc__) || defined(__ppc64__) # define POWERPC # define mach_type_known # elif defined(__x86_64__) # define X86_64 # define mach_type_known # elif defined(__i386__) # define I386 # define mach_type_known # endif # endif # if defined(NeXT) && defined(mc68000) # define M68K # define NEXT # define mach_type_known # endif # if defined(NeXT) && (defined(i386) || defined(__i386__)) # define I386 # define NEXT # define mach_type_known # endif # if defined(__OpenBSD__) && (defined(i386) || defined(__i386__)) # define I386 # define OPENBSD # define mach_type_known # endif # if defined(FREEBSD) && (defined(i386) || defined(__i386__)) # define I386 # define mach_type_known # endif # if defined(FREEBSD) && defined(__x86_64__) # define X86_64 # define mach_type_known # endif # if defined(__NetBSD__) && (defined(i386) || defined(__i386__)) # define I386 # define mach_type_known # endif # if defined(__NetBSD__) && defined(__x86_64__) # define X86_64 # define mach_type_known # endif # if defined(FREEBSD) && defined(__sparc__) # define SPARC # define mach_type_known # endif # if defined(bsdi) && (defined(i386) || defined(__i386__)) # define I386 # define BSDI # define mach_type_known # endif # if !defined(mach_type_known) && defined(__386BSD__) # define I386 # define THREE86BSD # define mach_type_known # endif # if defined(_CX_UX) && defined(_M88K) # define M88K # define CX_UX # define mach_type_known # endif # if defined(DGUX) && defined(m88k) # define M88K /* DGUX defined */ # define mach_type_known # endif # if defined(_WIN32_WCE) /* SH3, SH4, MIPS already defined for corresponding architectures */ # if defined(SH3) || defined(SH4) # define SH # endif # if defined(x86) # define I386 # endif # if defined(ARM) # define ARM32 # endif # define MSWINCE # define mach_type_known # else # if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \ || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__) # if defined(__LP64__) || defined(_WIN64) # define X86_64 # else # define I386 # endif # define MSWIN32 /* or Win64 */ # define mach_type_known # endif # if defined(_MSC_VER) && defined(_M_IA64) # define IA64 # define MSWIN32 /* Really win64, but we don't treat 64-bit */ /* variants as a differnt platform. */ # endif # endif # if defined(__DJGPP__) # define I386 # ifndef DJGPP # define DJGPP /* MSDOS running the DJGPP port of GCC */ # endif # define mach_type_known # endif # if defined(__CYGWIN32__) || defined(__CYGWIN__) # define I386 # define CYGWIN32 # define mach_type_known # endif # if defined(__MINGW32__) # define I386 # define MSWIN32 # define mach_type_known # endif # if defined(__BORLANDC__) # define I386 # define MSWIN32 # define mach_type_known # endif # if defined(_UTS) && !defined(mach_type_known) # define S370 # define UTS4 # define mach_type_known # endif # if defined(__pj__) # error PicoJava no longer supported /* The implementation had problems, and I haven't heard of users */ /* in ages. If you want it resurrected, let me know. */ # endif # if defined(__embedded__) && defined(PPC) # define POWERPC # define NOSYS # define mach_type_known # endif /* Ivan Demakov */ # if defined(__WATCOMC__) && defined(__386__) # define I386 # if !defined(OS2) && !defined(MSWIN32) && !defined(DOS4GW) # if defined(__OS2__) # define OS2 # else # if defined(__WINDOWS_386__) || defined(__NT__) # define MSWIN32 # else # define DOS4GW # endif # endif # endif # define mach_type_known # endif # if defined(__s390__) && defined(LINUX) # define S390 # define mach_type_known # endif # if defined(__GNU__) # if defined(__i386__) /* The Debian Hurd running on generic PC */ # define HURD # define I386 # define mach_type_known # endif # endif # if defined(__TANDEM) /* Nonstop S-series */ /* FIXME: Should recognize Integrity series? */ # define MIPS # define NONSTOP # define mach_type_known # endif /* Feel free to add more clauses here */ /* Or manually define the machine type here. A machine type is */ /* characterized by the architecture. Some */ /* machine types are further subdivided by OS. */ /* Macros such as LINUX, FREEBSD, etc. distinguish them. */ /* SYSV on an M68K actually means A/UX. */ /* The distinction in these cases is usually the stack starting address */ # ifndef mach_type_known # error "The collector has not been ported to this machine/OS combination." # endif /* Mapping is: M68K ==> Motorola 680X0 */ /* (NEXT, and SYSV (A/UX), */ /* MACOS and AMIGA variants) */ /* I386 ==> Intel 386 */ /* (SEQUENT, OS2, SCO, LINUX, NETBSD, */ /* FREEBSD, THREE86BSD, MSWIN32, */ /* BSDI,SOLARIS, NEXT, other variants) */ /* NS32K ==> Encore Multimax */ /* MIPS ==> R2000 through R14K */ /* (many variants) */ /* VAX ==> DEC VAX */ /* (BSD, ULTRIX variants) */ /* HP_PA ==> HP9000/700 & /800 */ /* HP/UX, LINUX */ /* SPARC ==> SPARC v7/v8/v9 */ /* (SOLARIS, LINUX, DRSNX variants) */ /* ALPHA ==> DEC Alpha */ /* (OSF1 and LINUX variants) */ /* M88K ==> Motorola 88XX0 */ /* (CX_UX and DGUX) */ /* S370 ==> 370-like machine */ /* running Amdahl UTS4 */ /* S390 ==> 390-like machine */ /* running LINUX */ /* ARM32 ==> Intel StrongARM */ /* IA64 ==> Intel IPF */ /* (e.g. Itanium) */ /* (LINUX and HPUX) */ /* SH ==> Hitachi SuperH */ /* (LINUX & MSWINCE) */ /* X86_64 ==> AMD x86-64 */ /* POWERPC ==> IBM/Apple PowerPC */ /* (MACOS(<=9),DARWIN(incl.MACOSX),*/ /* LINUX, NETBSD, AIX, NOSYS */ /* variants) */ /* Handles 32 and 64-bit variants. */ /* CRIS ==> Axis Etrax */ /* M32R ==> Renesas M32R */ /* * For each architecture and OS, the following need to be defined: * * CPP_WORDSZ is a simple integer constant representing the word size. * in bits. We assume byte addressibility, where a byte has 8 bits. * We also assume CPP_WORDSZ is either 32 or 64. * (We care about the length of pointers, not hardware * bus widths. Thus a 64 bit processor with a C compiler that uses * 32 bit pointers should use CPP_WORDSZ of 32, not 64. Default is 32.) * * MACH_TYPE is a string representation of the machine type. * OS_TYPE is analogous for the OS. * * ALIGNMENT is the largest N, such that * all pointer are guaranteed to be aligned on N byte boundaries. * defining it to be 1 will always work, but perform poorly. * * DATASTART is the beginning of the data segment. * On some platforms SEARCH_FOR_DATA_START is defined. * SEARCH_FOR_DATASTART will cause GC_data_start to * be set to an address determined by accessing data backwards from _end * until an unmapped page is found. DATASTART will be defined to be * GC_data_start. * On UNIX-like systems, the collector will scan the area between DATASTART * and DATAEND for root pointers. * * DATAEND, if not `end' where `end' is defined as ``extern int end[];''. * RTH suggests gaining access to linker script synth'd values with * this idiom instead of `&end' where `end' is defined as ``extern int end;'' . * Otherwise, ``GCC will assume these are in .sdata/.sbss'' and it will, e.g., * cause failures on alpha*-*-* with ``-msmall-data or -fpic'' or mips-*-* * without any special options. * * STACKBOTTOM is the cool end of the stack, which is usually the * highest address in the stack. * Under PCR or OS/2, we have other ways of finding thread stacks. * For each machine, the following should: * 1) define STACK_GROWS_UP if the stack grows toward higher addresses, and * 2) define exactly one of * STACKBOTTOM (should be defined to be an expression) * LINUX_STACKBOTTOM * HEURISTIC1 * HEURISTIC2 * If STACKBOTTOM is defined, then it's value will be used directly as the * stack base. If LINUX_STACKBOTTOM is defined, then it will be determined * with a method appropriate for most Linux systems. Currently we look * first for __libc_stack_end, and if that fails read it from /proc. * If either of the last two macros are defined, then STACKBOTTOM is computed * during collector startup using one of the following two heuristics: * HEURISTIC1: Take an address inside GC_init's frame, and round it up to * the next multiple of STACK_GRAN. * HEURISTIC2: Take an address inside GC_init's frame, increment it repeatedly * in small steps (decrement if STACK_GROWS_UP), and read the value * at each location. Remember the value when the first * Segmentation violation or Bus error is signalled. Round that * to the nearest plausible page boundary, and use that instead * of STACKBOTTOM. * * Gustavo Rodriguez-Rivera points out that on most (all?) Unix machines, * the value of environ is a pointer that can serve as STACKBOTTOM. * I expect that HEURISTIC2 can be replaced by this approach, which * interferes far less with debugging. However it has the disadvantage * that it's confused by a putenv call before the collector is initialized. * This could be dealt with by intercepting putenv ... * * If no expression for STACKBOTTOM can be found, and neither of the above * heuristics are usable, the collector can still be used with all of the above * undefined, provided one of the following is done: * 1) GC_mark_roots can be changed to somehow mark from the correct stack(s) * without reference to STACKBOTTOM. This is appropriate for use in * conjunction with thread packages, since there will be multiple stacks. * (Allocating thread stacks in the heap, and treating them as ordinary * heap data objects is also possible as a last resort. However, this is * likely to introduce significant amounts of excess storage retention * unless the dead parts of the thread stacks are periodically cleared.) * 2) Client code may set GC_stackbottom before calling any GC_ routines. * If the author of the client code controls the main program, this is * easily accomplished by introducing a new main program, setting * GC_stackbottom to the address of a local variable, and then calling * the original main program. The new main program would read something * like: * * # include "gc_private.h" * * main(argc, argv, envp) * int argc; * char **argv, **envp; * { * int dummy; * * GC_stackbottom = (ptr_t)(&dummy); * return(real_main(argc, argv, envp)); * } * * * Each architecture may also define the style of virtual dirty bit * implementation to be used: * MPROTECT_VDB: Write protect the heap and catch faults. * GWW_VDB: Use win32 GetWriteWatch primitive. * PROC_VDB: Use the SVR4 /proc primitives to read dirty bits. * * The first and second one may be combined, in which case a runtime * selection will be made, based on GetWriteWatch availability. * * An architecture may define DYNAMIC_LOADING if dynamic_load.c * defined GC_register_dynamic_libraries() for the architecture. * * An architecture may define PREFETCH(x) to preload the cache with *x. * This defaults to a no-op. * * PREFETCH_FOR_WRITE(x) is used if *x is about to be written. * * An architecture may also define CLEAR_DOUBLE(x) to be a fast way to * clear the two words at GC_malloc-aligned address x. By default, * word stores of 0 are used instead. * * HEAP_START may be defined as the initial address hint for mmap-based * allocation. */ /* If we are using a recent version of gcc, we can use __builtin_unwind_init() * to push the relevant registers onto the stack. */ # if defined(__GNUC__) && ((__GNUC__ >= 3) || \ (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)) \ && !defined(__INTEL_COMPILER) && !defined(__PATHCC__) # define HAVE_BUILTIN_UNWIND_INIT # endif # define STACK_GRAN 0x1000000 # ifdef M68K # define MACH_TYPE "M68K" # define ALIGNMENT 2 # ifdef OPENBSD # define OS_TYPE "OPENBSD" # define HEURISTIC2 # ifdef __ELF__ # define DATASTART GC_data_start # define DYNAMIC_LOADING # else extern char etext[]; # define DATASTART ((ptr_t)(etext)) # endif # endif # ifdef NETBSD # define OS_TYPE "NETBSD" # define HEURISTIC2 # ifdef __ELF__ # define DATASTART GC_data_start # define DYNAMIC_LOADING # else extern char etext[]; # define DATASTART ((ptr_t)(etext)) # endif # endif # ifdef LINUX # define OS_TYPE "LINUX" # define LINUX_STACKBOTTOM # define MPROTECT_VDB # ifdef __ELF__ # define DYNAMIC_LOADING # include # if defined(__GLIBC__)&& __GLIBC__>=2 # define SEARCH_FOR_DATA_START # else /* !GLIBC2 */ extern char **__environ; # define DATASTART ((ptr_t)(&__environ)) /* hideous kludge: __environ is the first */ /* word in crt0.o, and delimits the start */ /* of the data segment, no matter which */ /* ld options were passed through. */ /* We could use _etext instead, but that */ /* would include .rodata, which may */ /* contain large read-only data tables */ /* that we'd rather not scan. */ # endif /* !GLIBC2 */ extern int _end[]; # define DATAEND (_end) # else extern int etext[]; # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff)) # endif # endif # ifdef AMIGA # define OS_TYPE "AMIGA" /* STACKBOTTOM and DATASTART handled specially */ /* in os_dep.c */ # define DATAEND /* not needed */ # define GETPAGESIZE() 4096 # endif # ifdef MACOS # ifndef __LOWMEM__ # include # endif # define OS_TYPE "MACOS" /* see os_dep.c for details of global data segments. */ # define STACKBOTTOM ((ptr_t) LMGetCurStackBase()) # define DATAEND /* not needed */ # define GETPAGESIZE() 4096 # endif # ifdef NEXT # define OS_TYPE "NEXT" # define DATASTART ((ptr_t) get_etext()) # define STACKBOTTOM ((ptr_t) 0x4000000) # define DATAEND /* not needed */ # endif # endif # if defined(POWERPC) # define MACH_TYPE "POWERPC" # ifdef MACOS # define ALIGNMENT 2 /* Still necessary? Could it be 4? */ # ifndef __LOWMEM__ # include # endif # define OS_TYPE "MACOS" /* see os_dep.c for details of global data segments. */ # define STACKBOTTOM ((ptr_t) LMGetCurStackBase()) # define DATAEND /* not needed */ # endif # ifdef LINUX # if defined(__powerpc64__) # define ALIGNMENT 8 # define CPP_WORDSZ 64 # ifndef HBLKSIZE # define HBLKSIZE 4096 # endif # else # define ALIGNMENT 4 # endif # define OS_TYPE "LINUX" /* HEURISTIC1 has been reliably reported to fail for a 32-bit */ /* executable on a 64 bit kernel. */ # define LINUX_STACKBOTTOM # define DYNAMIC_LOADING # define SEARCH_FOR_DATA_START extern int _end[]; # define DATAEND (_end) # endif # ifdef DARWIN # define OS_TYPE "DARWIN" # define DYNAMIC_LOADING # if defined(__ppc64__) # define ALIGNMENT 8 # define CPP_WORDSZ 64 # define STACKBOTTOM ((ptr_t) 0x7fff5fc00000) # define CACHE_LINE_SIZE 64 # ifndef HBLKSIZE # define HBLKSIZE 4096 # endif # else # define ALIGNMENT 4 # define STACKBOTTOM ((ptr_t) 0xc0000000) # endif /* XXX: see get_end(3), get_etext() and get_end() should not be used. These aren't used when dyld support is enabled (it is by default) */ # define DATASTART ((ptr_t) get_etext()) # define DATAEND ((ptr_t) get_end()) # define USE_MMAP # define USE_MMAP_ANON # ifdef GC_DARWIN_THREADS # define MPROTECT_VDB # endif # include # define GETPAGESIZE() getpagesize() # if defined(USE_PPC_PREFETCH) && defined(__GNUC__) /* The performance impact of prefetches is untested */ # define PREFETCH(x) \ __asm__ __volatile__ ("dcbt 0,%0" : : "r" ((const void *) (x))) # define PREFETCH_FOR_WRITE(x) \ __asm__ __volatile__ ("dcbtst 0,%0" : : "r" ((const void *) (x))) # endif /* There seems to be some issues with trylock hanging on darwin. This should be looked into some more */ # define NO_PTHREAD_TRYLOCK # endif # ifdef FREEBSD # define ALIGNMENT 4 # define OS_TYPE "FREEBSD" # ifndef GC_FREEBSD_THREADS # define MPROTECT_VDB # endif # define SIG_SUSPEND SIGUSR1 # define SIG_THR_RESTART SIGUSR2 # define FREEBSD_STACKBOTTOM # ifdef __ELF__ # define DYNAMIC_LOADING # endif extern char etext[]; extern char * GC_FreeBSDGetDataStart(); # define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext) # endif # ifdef NETBSD # define ALIGNMENT 4 # define OS_TYPE "NETBSD" # define HEURISTIC2 extern char etext[]; # define DATASTART GC_data_start # define DYNAMIC_LOADING # endif # ifdef AIX # define OS_TYPE "AIX" # undef ALIGNMENT /* in case it's defined */ # ifdef IA64 # undef IA64 /* DOB: some AIX installs stupidly define IA64 in */ /* /usr/include/sys/systemcfg.h */ # endif # ifdef __64BIT__ # define ALIGNMENT 8 # define CPP_WORDSZ 64 # define STACKBOTTOM ((ptr_t)0x1000000000000000) # else # define ALIGNMENT 4 # define CPP_WORDSZ 32 # define STACKBOTTOM ((ptr_t)((ulong)&errno)) # endif # define USE_MMAP # define USE_MMAP_ANON /* From AIX linker man page: _text Specifies the first location of the program. _etext Specifies the first location after the program. _data Specifies the first location of the data. _edata Specifies the first location after the initialized data _end or end Specifies the first location after all data. */ extern int _data[], _end[]; # define DATASTART ((ptr_t)((ulong)_data)) # define DATAEND ((ptr_t)((ulong)_end)) extern int errno; # define DYNAMIC_LOADING /* For really old versions of AIX, this may have to be removed. */ # endif # ifdef NOSYS # define ALIGNMENT 4 # define OS_TYPE "NOSYS" extern void __end[], __dso_handle[]; # define DATASTART (__dso_handle) /* OK, that's ugly. */ # define DATAEND (__end) /* Stack starts at 0xE0000000 for the simulator. */ # undef STACK_GRAN # define STACK_GRAN 0x10000000 # define HEURISTIC1 # endif # endif # ifdef VAX # define MACH_TYPE "VAX" # define ALIGNMENT 4 /* Pointers are longword aligned by 4.2 C compiler */ extern char etext[]; # define DATASTART ((ptr_t)(etext)) # ifdef BSD # define OS_TYPE "BSD" # define HEURISTIC1 /* HEURISTIC2 may be OK, but it's hard to test. */ # endif # ifdef ULTRIX # define OS_TYPE "ULTRIX" # define STACKBOTTOM ((ptr_t) 0x7fffc800) # endif # endif # ifdef SPARC # define MACH_TYPE "SPARC" # if defined(__arch64__) || defined(__sparcv9) # define ALIGNMENT 8 # define CPP_WORDSZ 64 # define ELF_CLASS ELFCLASS64 # else # define ALIGNMENT 4 /* Required by hardware */ # define CPP_WORDSZ 32 # endif /* Don't define USE_ASM_PUSH_REGS. We do use an asm helper, but */ /* not to push the registers on the mark stack. */ # ifdef SOLARIS # define OS_TYPE "SOLARIS" extern int _etext[]; extern int _end[]; extern ptr_t GC_SysVGetDataStart(size_t, ptr_t); # define DATASTART GC_SysVGetDataStart(0x10000, (ptr_t)_etext) # define DATAEND (_end) # if !defined(USE_MMAP) && defined(REDIRECT_MALLOC) # define USE_MMAP /* Otherwise we now use calloc. Mmap may result in the */ /* heap interleaved with thread stacks, which can result in */ /* excessive blacklisting. Sbrk is unusable since it */ /* doesn't interact correctly with the system malloc. */ # endif # ifdef USE_MMAP # define HEAP_START (ptr_t)0x40000000 # else # define HEAP_START DATAEND # endif # define PROC_VDB /* HEURISTIC1 reportedly no longer works under 2.7. */ /* HEURISTIC2 probably works, but this appears to be preferable. */ /* Apparently USRSTACK is defined to be USERLIMIT, but in some */ /* installations that's undefined. We work around this with a */ /* gross hack: */ # include # ifdef USERLIMIT /* This should work everywhere, but doesn't. */ # define STACKBOTTOM USRSTACK # else # define HEURISTIC2 # endif # include # define GETPAGESIZE() sysconf(_SC_PAGESIZE) /* getpagesize() appeared to be missing from at least one */ /* Solaris 5.4 installation. Weird. */ # define DYNAMIC_LOADING # endif # ifdef DRSNX # define OS_TYPE "DRSNX" extern ptr_t GC_SysVGetDataStart(size_t, ptr_t); extern int etext[]; # define DATASTART GC_SysVGetDataStart(0x10000, (ptr_t)etext) # define MPROTECT_VDB # define STACKBOTTOM ((ptr_t) 0xdfff0000) # define DYNAMIC_LOADING # endif # ifdef LINUX # define OS_TYPE "LINUX" # ifdef __ELF__ # define DYNAMIC_LOADING # else Linux Sparc/a.out not supported # endif extern int _end[]; extern int _etext[]; # define DATAEND (_end) # define SVR4 extern ptr_t GC_SysVGetDataStart(size_t, ptr_t); # ifdef __arch64__ # define DATASTART GC_SysVGetDataStart(0x100000, (ptr_t)_etext) # else # define DATASTART GC_SysVGetDataStart(0x10000, (ptr_t)_etext) # endif # define LINUX_STACKBOTTOM # endif # ifdef OPENBSD # define OS_TYPE "OPENBSD" # define STACKBOTTOM ((ptr_t) 0xf8000000) extern int etext[]; # define DATASTART ((ptr_t)(etext)) # endif # ifdef NETBSD # define OS_TYPE "NETBSD" # define HEURISTIC2 # ifdef __ELF__ # define DATASTART GC_data_start # define DYNAMIC_LOADING # else extern char etext[]; # define DATASTART ((ptr_t)(etext)) # endif # endif # ifdef FREEBSD # define OS_TYPE "FREEBSD" # define SIG_SUSPEND SIGUSR1 # define SIG_THR_RESTART SIGUSR2 # define FREEBSD_STACKBOTTOM # ifdef __ELF__ # define DYNAMIC_LOADING # endif extern char etext[]; extern char edata[]; extern char end[]; # define NEED_FIND_LIMIT # define DATASTART ((ptr_t)(&etext)) # define DATAEND (GC_find_limit (DATASTART, TRUE)) # define DATASTART2 ((ptr_t)(&edata)) # define DATAEND2 ((ptr_t)(&end)) # endif # endif # ifdef I386 # define MACH_TYPE "I386" # if defined(__LP64__) || defined(_WIN64) # error This should be handled as X86_64 # else # define CPP_WORDSZ 32 # define ALIGNMENT 4 /* Appears to hold for all "32 bit" compilers */ /* except Borland. The -a4 option fixes */ /* Borland. */ /* Ivan Demakov: For Watcom the option is -zp4. */ # endif # ifdef SEQUENT # define OS_TYPE "SEQUENT" extern int etext[]; # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff)) # define STACKBOTTOM ((ptr_t) 0x3ffff000) # endif # ifdef BEOS # define OS_TYPE "BEOS" # include # define GETPAGESIZE() B_PAGE_SIZE extern int etext[]; # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff)) # endif # ifdef SOLARIS # define OS_TYPE "SOLARIS" extern int _etext[], _end[]; extern ptr_t GC_SysVGetDataStart(size_t, ptr_t); # define DATASTART GC_SysVGetDataStart(0x1000, (ptr_t)_etext) # define DATAEND (_end) /* # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7, */ /* but reportedly breaks under 2.8. It appears that the stack */ /* base is a property of the executable, so this should not break */ /* old executables. */ /* HEURISTIC2 probably works, but this appears to be preferable. */ # include # define STACKBOTTOM USRSTACK /* At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */ /* It appears to be fixed in 2.8 and 2.9. */ # ifdef SOLARIS25_PROC_VDB_BUG_FIXED # define PROC_VDB # endif # define DYNAMIC_LOADING # if !defined(USE_MMAP) && defined(REDIRECT_MALLOC) # define USE_MMAP /* Otherwise we now use calloc. Mmap may result in the */ /* heap interleaved with thread stacks, which can result in */ /* excessive blacklisting. Sbrk is unusable since it */ /* doesn't interact correctly with the system malloc. */ # endif # ifdef USE_MMAP # define HEAP_START (ptr_t)0x40000000 # else # define HEAP_START DATAEND # endif # endif # ifdef SCO # define OS_TYPE "SCO" extern int etext[]; # define DATASTART ((ptr_t)((((word) (etext)) + 0x3fffff) \ & ~0x3fffff) \ +((word)etext & 0xfff)) # define STACKBOTTOM ((ptr_t) 0x7ffffffc) # endif # ifdef SCO_ELF # define OS_TYPE "SCO_ELF" extern int etext[]; # define DATASTART ((ptr_t)(etext)) # define STACKBOTTOM ((ptr_t) 0x08048000) # define DYNAMIC_LOADING # define ELF_CLASS ELFCLASS32 # endif # ifdef DGUX # define OS_TYPE "DGUX" extern int _etext, _end; extern ptr_t GC_SysVGetDataStart(size_t, ptr_t); # define DATASTART GC_SysVGetDataStart(0x1000, (ptr_t)(&_etext)) # define DATAEND (&_end) # define STACK_GROWS_DOWN # define HEURISTIC2 # include # define GETPAGESIZE() sysconf(_SC_PAGESIZE) # define DYNAMIC_LOADING # ifndef USE_MMAP # define USE_MMAP # endif /* USE_MMAP */ # define MAP_FAILED (void *) -1 # ifdef USE_MMAP # define HEAP_START (ptr_t)0x40000000 # else /* USE_MMAP */ # define HEAP_START DATAEND # endif /* USE_MMAP */ # endif /* DGUX */ # ifdef LINUX # define OS_TYPE "LINUX" # define LINUX_STACKBOTTOM # if 0 # define HEURISTIC1 # undef STACK_GRAN # define STACK_GRAN 0x10000000 /* STACKBOTTOM is usually 0xc0000000, but this changes with */ /* different kernel configurations. In particular, systems */ /* with 2GB physical memory will usually move the user */ /* address space limit, and hence initial SP to 0x80000000. */ # endif # if !defined(GC_LINUX_THREADS) || !defined(REDIRECT_MALLOC) # define MPROTECT_VDB # else /* We seem to get random errors in incremental mode, */ /* possibly because Linux threads is itself a malloc client */ /* and can't deal with the signals. */ # endif # define HEAP_START (ptr_t)0x1000 /* This encourages mmap to give us low addresses, */ /* thus allowing the heap to grow to ~3GB */ # ifdef __ELF__ # define DYNAMIC_LOADING # ifdef UNDEFINED /* includes ro data */ extern int _etext[]; # define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff)) # endif # include # if defined(__GLIBC__) && __GLIBC__ >= 2 # define SEARCH_FOR_DATA_START # else extern char **__environ; # define DATASTART ((ptr_t)(&__environ)) /* hideous kludge: __environ is the first */ /* word in crt0.o, and delimits the start */ /* of the data segment, no matter which */ /* ld options were passed through. */ /* We could use _etext instead, but that */ /* would include .rodata, which may */ /* contain large read-only data tables */ /* that we'd rather not scan. */ # endif extern int _end[]; # define DATAEND (_end) # else extern int etext[]; # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff)) # endif # ifdef USE_I686_PREFETCH /* FIXME: Thus should use __builtin_prefetch, but we'll leave that */ /* for the next rtelease. */ # define PREFETCH(x) \ __asm__ __volatile__ (" prefetchnta %0": : "m"(*(char *)(x))) /* Empirically prefetcht0 is much more effective at reducing */ /* cache miss stalls for the targetted load instructions. But it */ /* seems to interfere enough with other cache traffic that the net */ /* result is worse than prefetchnta. */ # if 0 /* Using prefetches for write seems to have a slight negative */ /* impact on performance, at least for a PIII/500. */ # define PREFETCH_FOR_WRITE(x) \ __asm__ __volatile__ (" prefetcht0 %0": : "m"(*(char *)(x))) # endif # endif # ifdef USE_3DNOW_PREFETCH # define PREFETCH(x) \ __asm__ __volatile__ (" prefetch %0": : "m"(*(char *)(x))) # define PREFETCH_FOR_WRITE(x) \ __asm__ __volatile__ (" prefetchw %0": : "m"(*(char *)(x))) # endif # endif # ifdef CYGWIN32 # define OS_TYPE "CYGWIN32" # define DATASTART ((ptr_t)GC_DATASTART) /* From gc.h */ # define DATAEND ((ptr_t)GC_DATAEND) # undef STACK_GRAN # define STACK_GRAN 0x10000 # define HEURISTIC1 # endif # ifdef OS2 # define OS_TYPE "OS2" /* STACKBOTTOM and DATASTART are handled specially in */ /* os_dep.c. OS2 actually has the right */ /* system call! */ # define DATAEND /* not needed */ # endif # ifdef MSWIN32 # define OS_TYPE "MSWIN32" /* STACKBOTTOM and DATASTART are handled specially in */ /* os_dep.c. */ # if !defined(__WATCOMC__) # define MPROTECT_VDB /* We also avoided doing this in the past with GC_WIN32_THREADS */ /* Hopefully that's fixed. */ # endif # if _MSC_VER >= 1300 /* .NET, i.e. > VisualStudio 6 */ # define GWW_VDB # endif # define DATAEND /* not needed */ # endif # ifdef MSWINCE # define OS_TYPE "MSWINCE" # define DATAEND /* not needed */ # endif # ifdef DJGPP # define OS_TYPE "DJGPP" # include "stubinfo.h" extern int etext[]; extern int _stklen; extern int __djgpp_stack_limit; # define DATASTART ((ptr_t)((((word) (etext)) + 0x1ff) & ~0x1ff)) /* # define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \ + _stklen)) */ # define STACKBOTTOM ((ptr_t)((word) __djgpp_stack_limit + _stklen)) /* This may not be right. */ # endif # ifdef OPENBSD # define OS_TYPE "OPENBSD" # endif # ifdef FREEBSD # define OS_TYPE "FREEBSD" # ifndef GC_FREEBSD_THREADS # define MPROTECT_VDB # endif # ifdef __GLIBC__ # define SIG_SUSPEND (32+6) # define SIG_THR_RESTART (32+5) extern int _end[]; # define DATAEND (_end) # else # define SIG_SUSPEND SIGUSR1 # define SIG_THR_RESTART SIGUSR2 # endif # define FREEBSD_STACKBOTTOM # ifdef __ELF__ # define DYNAMIC_LOADING # endif extern char etext[]; extern char * GC_FreeBSDGetDataStart(size_t, ptr_t); # define DATASTART GC_FreeBSDGetDataStart(0x1000, (ptr_t)etext) # endif # ifdef NETBSD # define OS_TYPE "NETBSD" # ifdef __ELF__ # define DYNAMIC_LOADING # endif # endif # ifdef THREE86BSD # define OS_TYPE "THREE86BSD" # endif # ifdef BSDI # define OS_TYPE "BSDI" # endif # if defined(OPENBSD) || defined(NETBSD) \ || defined(THREE86BSD) || defined(BSDI) # define HEURISTIC2 extern char etext[]; # define DATASTART ((ptr_t)(etext)) # endif # ifdef NEXT # define OS_TYPE "NEXT" # define DATASTART ((ptr_t) get_etext()) # define STACKBOTTOM ((ptr_t)0xc0000000) # define DATAEND /* not needed */ # endif # ifdef DOS4GW # define OS_TYPE "DOS4GW" extern long __nullarea; extern char _end; extern char *_STACKTOP; /* Depending on calling conventions Watcom C either precedes or does not precedes with undescore names of C-variables. Make sure startup code variables always have the same names. */ #pragma aux __nullarea "*"; #pragma aux _end "*"; # define STACKBOTTOM ((ptr_t) _STACKTOP) /* confused? me too. */ # define DATASTART ((ptr_t) &__nullarea) # define DATAEND ((ptr_t) &_end) # endif # ifdef HURD # define OS_TYPE "HURD" # define STACK_GROWS_DOWN # define HEURISTIC2 # define SIG_SUSPEND SIGUSR1 # define SIG_THR_RESTART SIGUSR2 # define SEARCH_FOR_DATA_START extern int _end[]; # define DATAEND ((ptr_t) (_end)) /* # define MPROTECT_VDB Not quite working yet? */ # define DYNAMIC_LOADING # endif # ifdef DARWIN # define OS_TYPE "DARWIN" # define DARWIN_DONT_PARSE_STACK # define DYNAMIC_LOADING /* XXX: see get_end(3), get_etext() and get_end() should not be used. These aren't used when dyld support is enabled (it is by default) */ # define DATASTART ((ptr_t) get_etext()) # define DATAEND ((ptr_t) get_end()) # define STACKBOTTOM ((ptr_t) 0xc0000000) # define USE_MMAP # define USE_MMAP_ANON # ifdef GC_DARWIN_THREADS # define MPROTECT_VDB # endif # include # define GETPAGESIZE() getpagesize() /* There seems to be some issues with trylock hanging on darwin. This should be looked into some more */ # define NO_PTHREAD_TRYLOCK # endif /* DARWIN */ # endif # ifdef NS32K # define MACH_TYPE "NS32K" # define ALIGNMENT 4 extern char **environ; # define DATASTART ((ptr_t)(&environ)) /* hideous kludge: environ is the first */ /* word in crt0.o, and delimits the start */ /* of the data segment, no matter which */ /* ld options were passed through. */ # define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */ # endif # ifdef MIPS # define MACH_TYPE "MIPS" # ifdef LINUX /* This was developed for a linuxce style platform. Probably */ /* needs to be tweaked for workstation class machines. */ # define OS_TYPE "LINUX" # define DYNAMIC_LOADING extern int _end[]; # define DATAEND (_end) extern int __data_start[]; # define DATASTART ((ptr_t)(__data_start)) # define ALIGNMENT 4 # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 2 || __GLIBC__ > 2 # define LINUX_STACKBOTTOM # else # define STACKBOTTOM 0x80000000 # endif # endif /* Linux */ # ifdef EWS4800 # define HEURISTIC2 # if defined(_MIPS_SZPTR) && (_MIPS_SZPTR == 64) extern int _fdata[], _end[]; # define DATASTART ((ptr_t)_fdata) # define DATAEND ((ptr_t)_end) # define CPP_WORDSZ _MIPS_SZPTR # define ALIGNMENT (_MIPS_SZPTR/8) # else extern int etext[], edata[], end[]; extern int _DYNAMIC_LINKING[], _gp[]; # define DATASTART ((ptr_t)((((word)etext + 0x3ffff) & ~0x3ffff) \ + ((word)etext & 0xffff))) # define DATAEND (edata) # define DATASTART2 (_DYNAMIC_LINKING \ ? (ptr_t)(((word)_gp + 0x8000 + 0x3ffff) & ~0x3ffff) \ : (ptr_t)edata) # define DATAEND2 (end) # define ALIGNMENT 4 # endif # define OS_TYPE "EWS4800" # endif # ifdef ULTRIX # define HEURISTIC2 # define DATASTART (ptr_t)0x10000000 /* Could probably be slightly higher since */ /* startup code allocates lots of stuff. */ # define OS_TYPE "ULTRIX" # define ALIGNMENT 4 # endif # ifdef IRIX5 # define HEURISTIC2 extern int _fdata[]; # define DATASTART ((ptr_t)(_fdata)) # ifdef USE_MMAP # define HEAP_START (ptr_t)0x30000000 # else # define HEAP_START DATASTART # endif /* Lowest plausible heap address. */ /* In the MMAP case, we map there. */ /* In either case it is used to identify */ /* heap sections so they're not */ /* considered as roots. */ # define OS_TYPE "IRIX5" /*# define MPROTECT_VDB DOB: this should work, but there is evidence */ /* of recent breakage. */ # ifdef _MIPS_SZPTR # define CPP_WORDSZ _MIPS_SZPTR # define ALIGNMENT (_MIPS_SZPTR/8) # else # define ALIGNMENT 4 # endif # define DYNAMIC_LOADING # endif # ifdef MSWINCE # define OS_TYPE "MSWINCE" # define ALIGNMENT 4 # define DATAEND /* not needed */ # endif # if defined(NETBSD) # define OS_TYPE "NETBSD" # define ALIGNMENT 4 # define HEURISTIC2 # ifdef __ELF__ extern int etext[]; # define DATASTART GC_data_start # define NEED_FIND_LIMIT # define DYNAMIC_LOADING # else # define DATASTART ((ptr_t) 0x10000000) # define STACKBOTTOM ((ptr_t) 0x7ffff000) # endif /* _ELF_ */ # endif # if defined(NONSTOP) # define CPP_WORDSZ 32 # define OS_TYPE "NONSTOP" # define ALIGNMENT 4 # define DATASTART ((ptr_t) 0x08000000) extern char **environ; # define DATAEND ((ptr_t)(environ - 0x10)) # define STACKBOTTOM ((ptr_t) 0x4fffffff) # endif # endif # ifdef HP_PA # define MACH_TYPE "HP_PA" # ifdef __LP64__ # define CPP_WORDSZ 64 # define ALIGNMENT 8 # else # define CPP_WORDSZ 32 # define ALIGNMENT 4 # endif # if !defined(GC_HPUX_THREADS) && !defined(GC_LINUX_THREADS) # ifndef LINUX /* For now. */ # define MPROTECT_VDB # endif # else # ifdef PARALLEL_MARK # define USE_MARK_BYTES /* Minimize compare-and-swap usage. */ # endif # endif # define STACK_GROWS_UP # ifdef HPUX # define OS_TYPE "HPUX" extern int __data_start[]; # define DATASTART ((ptr_t)(__data_start)) # if 0 /* The following appears to work for 7xx systems running HP/UX */ /* 9.xx Furthermore, it might result in much faster */ /* collections than HEURISTIC2, which may involve scanning */ /* segments that directly precede the stack. It is not the */ /* default, since it may not work on older machine/OS */ /* combinations. (Thanks to Raymond X.T. Nijssen for uncovering */ /* this.) */ # define STACKBOTTOM ((ptr_t) 0x7b033000) /* from /etc/conf/h/param.h */ # else /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2 */ /* to this. Note that the GC must be initialized before the */ /* first putenv call. */ extern char ** environ; # define STACKBOTTOM ((ptr_t)environ) # endif # define DYNAMIC_LOADING # include # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE) # ifndef __GNUC__ # define PREFETCH(x) { \ register long addr = (long)(x); \ (void) _asm ("LDW", 0, 0, addr, 0); \ } # endif # endif /* HPUX */ # ifdef LINUX # define OS_TYPE "LINUX" # define LINUX_STACKBOTTOM # define DYNAMIC_LOADING # define SEARCH_FOR_DATA_START extern int _end[]; # define DATAEND (&_end) # endif /* LINUX */ # endif /* HP_PA */ # ifdef ALPHA # define MACH_TYPE "ALPHA" # define ALIGNMENT 8 # define CPP_WORDSZ 64 # ifdef NETBSD # define OS_TYPE "NETBSD" # define HEURISTIC2 # define DATASTART GC_data_start # define ELFCLASS32 32 # define ELFCLASS64 64 # define ELF_CLASS ELFCLASS64 # define DYNAMIC_LOADING # endif # ifdef OPENBSD # define OS_TYPE "OPENBSD" # define HEURISTIC2 # ifdef __ELF__ /* since OpenBSD/Alpha 2.9 */ # define DATASTART GC_data_start # define ELFCLASS32 32 # define ELFCLASS64 64 # define ELF_CLASS ELFCLASS64 # else /* ECOFF, until OpenBSD/Alpha 2.7 */ # define DATASTART ((ptr_t) 0x140000000) # endif # endif # ifdef FREEBSD # define OS_TYPE "FREEBSD" /* MPROTECT_VDB is not yet supported at all on FreeBSD/alpha. */ # define SIG_SUSPEND SIGUSR1 # define SIG_THR_RESTART SIGUSR2 # define FREEBSD_STACKBOTTOM # ifdef __ELF__ # define DYNAMIC_LOADING # endif /* Handle unmapped hole alpha*-*-freebsd[45]* puts between etext and edata. */ extern char etext[]; extern char edata[]; extern char end[]; # define NEED_FIND_LIMIT # define DATASTART ((ptr_t)(&etext)) # define DATAEND (GC_find_limit (DATASTART, TRUE)) # define DATASTART2 ((ptr_t)(&edata)) # define DATAEND2 ((ptr_t)(&end)) # endif # ifdef OSF1 # define OS_TYPE "OSF1" # define DATASTART ((ptr_t) 0x140000000) extern int _end[]; # define DATAEND ((ptr_t) &_end) extern char ** environ; /* round up from the value of environ to the nearest page boundary */ /* Probably breaks if putenv is called before collector */ /* initialization. */ # define STACKBOTTOM ((ptr_t)(((word)(environ) | (getpagesize()-1))+1)) /* # define HEURISTIC2 */ /* Normally HEURISTIC2 is too conervative, since */ /* the text segment immediately follows the stack. */ /* Hence we give an upper pound. */ /* This is currently unused, since we disabled HEURISTIC2 */ extern int __start[]; # define HEURISTIC2_LIMIT ((ptr_t)((word)(__start) & ~(getpagesize()-1))) # ifndef GC_OSF1_THREADS /* Unresolved signal issues with threads. */ # define MPROTECT_VDB # endif # define DYNAMIC_LOADING # endif # ifdef LINUX # define OS_TYPE "LINUX" # define LINUX_STACKBOTTOM # ifdef __ELF__ # define SEARCH_FOR_DATA_START # define DYNAMIC_LOADING # else # define DATASTART ((ptr_t) 0x140000000) # endif extern int _end[]; # define DATAEND (_end) # define MPROTECT_VDB /* Has only been superficially tested. May not */ /* work on all versions. */ # endif # endif # ifdef IA64 # define MACH_TYPE "IA64" # ifdef HPUX # ifdef _ILP32 # define CPP_WORDSZ 32 /* Requires 8 byte alignment for malloc */ # define ALIGNMENT 4 # else # ifndef _LP64 ---> unknown ABI # endif # define CPP_WORDSZ 64 /* Requires 16 byte alignment for malloc */ # define ALIGNMENT 8 # endif # define OS_TYPE "HPUX" extern int __data_start[]; # define DATASTART ((ptr_t)(__data_start)) /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2 */ /* to this. Note that the GC must be initialized before the */ /* first putenv call. */ extern char ** environ; # define STACKBOTTOM ((ptr_t)environ) # define HPUX_STACKBOTTOM # define DYNAMIC_LOADING # include # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE) /* The following was empirically determined, and is probably */ /* not very robust. */ /* Note that the backing store base seems to be at a nice */ /* address minus one page. */ # define BACKING_STORE_DISPLACEMENT 0x1000000 # define BACKING_STORE_ALIGNMENT 0x1000 extern ptr_t GC_register_stackbottom; # define BACKING_STORE_BASE GC_register_stackbottom /* Known to be wrong for recent HP/UX versions!!! */ # endif # ifdef LINUX # define CPP_WORDSZ 64 # define ALIGNMENT 8 # define OS_TYPE "LINUX" /* The following works on NUE and older kernels: */ /* # define STACKBOTTOM ((ptr_t) 0xa000000000000000l) */ /* This does not work on NUE: */ # define LINUX_STACKBOTTOM /* We also need the base address of the register stack */ /* backing store. This is computed in */ /* GC_linux_register_stack_base based on the following */ /* constants: */ # define BACKING_STORE_ALIGNMENT 0x100000 # define BACKING_STORE_DISPLACEMENT 0x80000000 extern ptr_t GC_register_stackbottom; # define BACKING_STORE_BASE GC_register_stackbottom # define SEARCH_FOR_DATA_START # ifdef __GNUC__ # define DYNAMIC_LOADING # else /* In the Intel compiler environment, we seem to end up with */ /* statically linked executables and an undefined reference */ /* to _DYNAMIC */ # endif # define MPROTECT_VDB /* Requires Linux 2.3.47 or later. */ extern int _end[]; # define DATAEND (_end) # ifdef __GNUC__ # ifndef __INTEL_COMPILER # define PREFETCH(x) \ __asm__ (" lfetch [%0]": : "r"(x)) # define PREFETCH_FOR_WRITE(x) \ __asm__ (" lfetch.excl [%0]": : "r"(x)) # define CLEAR_DOUBLE(x) \ __asm__ (" stf.spill [%0]=f0": : "r"((void *)(x))) # else # include # define PREFETCH(x) \ __lfetch(__lfhint_none, (x)) # define PREFETCH_FOR_WRITE(x) \ __lfetch(__lfhint_nta, (x)) # define CLEAR_DOUBLE(x) \ __stf_spill((void *)(x), 0) # endif // __INTEL_COMPILER # endif # endif # ifdef MSWIN32 /* FIXME: This is a very partial guess. There is no port, yet. */ # define OS_TYPE "MSWIN32" /* STACKBOTTOM and DATASTART are handled specially in */ /* os_dep.c. */ # define DATAEND /* not needed */ # if defined(_WIN64) # define CPP_WORDSZ 64 # else # define CPP_WORDSZ 32 /* Is this possible? */ # endif # define ALIGNMENT 8 # define STRTOULL _strtoui64 # endif # endif # ifdef M88K # define MACH_TYPE "M88K" # define ALIGNMENT 4 extern int etext[]; # ifdef CX_UX # define OS_TYPE "CX_UX" # define DATASTART ((((word)etext + 0x3fffff) & ~0x3fffff) + 0x10000) # endif # ifdef DGUX # define OS_TYPE "DGUX" extern ptr_t GC_SysVGetDataStart(size_t, ptr_t); # define DATASTART GC_SysVGetDataStart(0x10000, (ptr_t)etext) # endif # define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */ # endif # ifdef S370 /* If this still works, and if anyone cares, this should probably */ /* be moved to the S390 category. */ # define MACH_TYPE "S370" # define ALIGNMENT 4 /* Required by hardware */ # ifdef UTS4 # define OS_TYPE "UTS4" extern int etext[]; extern int _etext[]; extern int _end[]; extern ptr_t GC_SysVGetDataStart(size_t, ptr_t); # define DATASTART GC_SysVGetDataStart(0x10000, (ptr_t)_etext) # define DATAEND (_end) # define HEURISTIC2 # endif # endif # ifdef S390 # define MACH_TYPE "S390" # ifndef __s390x__ # define ALIGNMENT 4 # define CPP_WORDSZ 32 # else # define ALIGNMENT 8 # define CPP_WORDSZ 64 # ifndef HBLKSIZE # define HBLKSIZE 4096 # endif # endif # ifdef LINUX # define OS_TYPE "LINUX" # define LINUX_STACKBOTTOM # define DYNAMIC_LOADING extern int __data_start[]; # define DATASTART ((ptr_t)(__data_start)) extern int _end[]; # define DATAEND (_end) # define CACHE_LINE_SIZE 256 # define GETPAGESIZE() 4096 # endif # endif # ifdef ARM32 # define CPP_WORDSZ 32 # define MACH_TYPE "ARM32" # define ALIGNMENT 4 # ifdef NETBSD # define OS_TYPE "NETBSD" # define HEURISTIC2 # ifdef __ELF__ # define DATASTART GC_data_start # define DYNAMIC_LOADING # else extern char etext[]; # define DATASTART ((ptr_t)(etext)) # endif # endif # ifdef LINUX # define OS_TYPE "LINUX" # define LINUX_STACKBOTTOM # undef STACK_GRAN # define STACK_GRAN 0x10000000 # ifdef __ELF__ # define DYNAMIC_LOADING # include # if defined(__GLIBC__) && __GLIBC__ >= 2 # define SEARCH_FOR_DATA_START # else extern char **__environ; # define DATASTART ((ptr_t)(&__environ)) /* hideous kludge: __environ is the first */ /* word in crt0.o, and delimits the start */ /* of the data segment, no matter which */ /* ld options were passed through. */ /* We could use _etext instead, but that */ /* would include .rodata, which may */ /* contain large read-only data tables */ /* that we'd rather not scan. */ # endif extern int _end[]; # define DATAEND (_end) # else extern int etext[]; # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff)) # endif # endif # ifdef MSWINCE # define OS_TYPE "MSWINCE" # define DATAEND /* not needed */ # endif # ifdef NOSYS /* __data_start is usually defined in the target linker script. */ extern int __data_start[]; # define DATASTART (ptr_t)(__data_start) /* __stack_base__ is set in newlib/libc/sys/arm/crt0.S */ extern void *__stack_base__; # define STACKBOTTOM ((ptr_t) (__stack_base__)) # endif #endif # ifdef CRIS # define MACH_TYPE "CRIS" # define CPP_WORDSZ 32 # define ALIGNMENT 1 # define OS_TYPE "LINUX" # define DYNAMIC_LOADING # define LINUX_STACKBOTTOM # define SEARCH_FOR_DATA_START extern int _end[]; # define DATAEND (_end) # endif # ifdef SH # define MACH_TYPE "SH" # define ALIGNMENT 4 # ifdef MSWINCE # define OS_TYPE "MSWINCE" # define DATAEND /* not needed */ # endif # ifdef LINUX # define OS_TYPE "LINUX" # define LINUX_STACKBOTTOM # define DYNAMIC_LOADING # define SEARCH_FOR_DATA_START extern int _end[]; # define DATAEND (_end) # endif # ifdef NETBSD # define OS_TYPE "NETBSD" # define HEURISTIC2 # define DATASTART GC_data_start # define DYNAMIC_LOADING # endif # endif # ifdef SH4 # define MACH_TYPE "SH4" # define OS_TYPE "MSWINCE" # define ALIGNMENT 4 # define DATAEND /* not needed */ # endif # ifdef M32R # define CPP_WORDSZ 32 # define MACH_TYPE "M32R" # define ALIGNMENT 4 # ifdef LINUX # define OS_TYPE "LINUX" # define LINUX_STACKBOTTOM # undef STACK_GRAN # define STACK_GRAN 0x10000000 # define DYNAMIC_LOADING # define SEARCH_FOR_DATA_START extern int _end[]; # define DATAEND (_end) # endif # endif # ifdef X86_64 # define MACH_TYPE "X86_64" # define ALIGNMENT 8 # define CPP_WORDSZ 64 # ifndef HBLKSIZE # define HBLKSIZE 4096 # endif # define CACHE_LINE_SIZE 64 # ifdef LINUX # define OS_TYPE "LINUX" # define LINUX_STACKBOTTOM # if !defined(GC_LINUX_THREADS) || !defined(REDIRECT_MALLOC) # define MPROTECT_VDB # else /* We seem to get random errors in incremental mode, */ /* possibly because Linux threads is itself a malloc client */ /* and can't deal with the signals. */ # endif # ifdef __ELF__ # define DYNAMIC_LOADING # ifdef UNDEFINED /* includes ro data */ extern int _etext[]; # define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff)) # endif # include # define SEARCH_FOR_DATA_START extern int _end[]; # define DATAEND (_end) # else extern int etext[]; # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff)) # endif # if defined(__GNUC__) && __GNUC__ >= 3 # define PREFETCH(x) __builtin_prefetch((x), 0, 0) # define PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1) # endif # endif # ifdef DARWIN # define OS_TYPE "DARWIN" # define DARWIN_DONT_PARSE_STACK # define DYNAMIC_LOADING /* XXX: see get_end(3), get_etext() and get_end() should not be used. These aren't used when dyld support is enabled (it is by default) */ # define DATASTART ((ptr_t) get_etext()) # define DATAEND ((ptr_t) get_end()) # define STACKBOTTOM ((ptr_t) 0x7fff5fc00000) # define USE_MMAP # define USE_MMAP_ANON # ifdef GC_DARWIN_THREADS # define MPROTECT_VDB # endif # include # define GETPAGESIZE() getpagesize() /* There seems to be some issues with trylock hanging on darwin. This should be looked into some more */ # define NO_PTHREAD_TRYLOCK # endif # ifdef FREEBSD # define OS_TYPE "FREEBSD" # ifndef GC_FREEBSD_THREADS # define MPROTECT_VDB # endif # ifdef __GLIBC__ # define SIG_SUSPEND (32+6) # define SIG_THR_RESTART (32+5) extern int _end[]; # define DATAEND (_end) # else # define SIG_SUSPEND SIGUSR1 # define SIG_THR_RESTART SIGUSR2 # endif # define FREEBSD_STACKBOTTOM # ifdef __ELF__ # define DYNAMIC_LOADING # endif extern char etext[]; extern char * GC_FreeBSDGetDataStart(); # define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext) # endif # ifdef NETBSD # define OS_TYPE "NETBSD" # ifdef __ELF__ # define DYNAMIC_LOADING # endif # define HEURISTIC2 extern char etext[]; # define SEARCH_FOR_DATA_START # endif # ifdef SOLARIS # define OS_TYPE "SOLARIS" # define ELF_CLASS ELFCLASS64 extern int _etext[], _end[]; extern ptr_t GC_SysVGetDataStart(size_t, ptr_t); # define DATASTART GC_SysVGetDataStart(0x1000, (ptr_t)_etext) # define DATAEND (_end) /* # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7, */ /* but reportedly breaks under 2.8. It appears that the stack */ /* base is a property of the executable, so this should not break */ /* old executables. */ /* HEURISTIC2 probably works, but this appears to be preferable. */ /* Apparently USRSTACK is defined to be USERLIMIT, but in some */ /* installations that's undefined. We work around this with a */ /* gross hack: */ # include # ifdef USERLIMIT /* This should work everywhere, but doesn't. */ # define STACKBOTTOM USRSTACK # else # define HEURISTIC2 # endif /* At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */ /* It appears to be fixed in 2.8 and 2.9. */ # ifdef SOLARIS25_PROC_VDB_BUG_FIXED # define PROC_VDB # endif # define DYNAMIC_LOADING # if !defined(USE_MMAP) && defined(REDIRECT_MALLOC) # define USE_MMAP /* Otherwise we now use calloc. Mmap may result in the */ /* heap interleaved with thread stacks, which can result in */ /* excessive blacklisting. Sbrk is unusable since it */ /* doesn't interact correctly with the system malloc. */ # endif # ifdef USE_MMAP # define HEAP_START (ptr_t)0x40000000 # else # define HEAP_START DATAEND # endif # endif # ifdef MSWIN32 # define OS_TYPE "MSWIN32" /* STACKBOTTOM and DATASTART are handled specially in */ /* os_dep.c. */ # if !defined(__WATCOMC__) # define MPROTECT_VDB /* We also avoided doing this in the past with GC_WIN32_THREADS */ /* Hopefully that's fixed. */ # endif # if _MSC_VER >= 1300 /* .NET, i.e. > VisualStudio 6 */ # define GWW_VDB # endif # define DATAEND /* not needed */ # endif # endif #if defined(LINUX) && defined(USE_MMAP) /* The kernel may do a somewhat better job merging mappings etc. */ /* with anonymous mappings. */ # define USE_MMAP_ANON #endif #if defined(GC_LINUX_THREADS) && defined(REDIRECT_MALLOC) /* Nptl allocates thread stacks with mmap, which is fine. But it */ /* keeps a cache of thread stacks. Thread stacks contain the */ /* thread control blocks. These in turn contain a pointer to */ /* (sizeof (void *) from the beginning of) the dtv for thread-local */ /* storage, which is calloc allocated. If we don't scan the cached */ /* thread stacks, we appear to lose the dtv. This tends to */ /* result in something that looks like a bogus dtv count, which */ /* tends to result in a memset call on a block that is way too */ /* large. Sometimes we're lucky and the process just dies ... */ /* There seems to be a similar issue with some other memory */ /* allocated by the dynamic loader. */ /* This can be avoided by either: */ /* - Defining USE_PROC_FOR_LIBRARIES here. */ /* That performs very poorly, precisely because we end up */ /* scanning cached stacks. */ /* - Have calloc look at its callers. That is currently what we do.*/ /* In spite of the fact that it is gross and disgusting. */ /* # define USE_PROC_FOR_LIBRARIES */ #endif # ifndef STACK_GROWS_UP # define STACK_GROWS_DOWN # endif # ifndef CPP_WORDSZ # define CPP_WORDSZ 32 # endif # ifndef OS_TYPE # define OS_TYPE "" # endif # ifndef DATAEND extern int end[]; # define DATAEND (end) # endif # if defined(SVR4) && !defined(GETPAGESIZE) # include # define GETPAGESIZE() sysconf(_SC_PAGESIZE) # endif # ifndef GETPAGESIZE # if defined(SOLARIS) || defined(IRIX5) || defined(LINUX) \ || defined(NETBSD) || defined(FREEBSD) || defined(HPUX) # include # endif # define GETPAGESIZE() getpagesize() # endif # if defined(SOLARIS) || defined(DRSNX) || defined(UTS4) /* OS has SVR4 generic features. */ /* Probably others also qualify. */ # define SVR4 # endif # if defined(SOLARIS) || defined(DRSNX) /* OS has SOLARIS style semi-undocumented interface */ /* to dynamic loader. */ # define SOLARISDL /* OS has SOLARIS style signal handlers. */ # define SUNOS5SIGS # endif # if defined(HPUX) # define SUNOS5SIGS # endif # if defined(FREEBSD) && \ (defined(__DragonFly__) || __FreeBSD__ >= 4 || (__FreeBSD_kernel__ >= 4)) # define SUNOS5SIGS # endif # ifdef GC_NETBSD_THREADS # define SIGRTMIN 33 # define SIGRTMAX 63 # endif # if defined(SVR4) || defined(LINUX) || defined(IRIX5) || defined(HPUX) \ || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \ || defined(DGUX) || defined(BSD) \ || defined(AIX) || defined(DARWIN) || defined(OSF1) \ || defined(HURD) # define UNIX_LIKE /* Basic Unix-like system calls work. */ # endif # if CPP_WORDSZ != 32 && CPP_WORDSZ != 64 -> bad word size # endif # ifdef PCR # undef DYNAMIC_LOADING # undef STACKBOTTOM # undef HEURISTIC1 # undef HEURISTIC2 # undef PROC_VDB # undef MPROTECT_VDB # define PCR_VDB # endif # ifdef SMALL_CONFIG /* Presumably not worth the space it takes. */ # undef PROC_VDB # undef MPROTECT_VDB # endif # ifdef USE_MUNMAP # undef MPROTECT_VDB /* Can't deal with address space holes. */ # endif # ifdef PARALLEL_MARK # undef MPROTECT_VDB /* For now. */ # endif # if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB) \ && !defined(GWW_VDB) # define DEFAULT_VDB # endif # ifndef PREFETCH # define PREFETCH(x) # define NO_PREFETCH # endif # ifndef PREFETCH_FOR_WRITE # define PREFETCH_FOR_WRITE(x) # define NO_PREFETCH_FOR_WRITE # endif # ifndef CACHE_LINE_SIZE # define CACHE_LINE_SIZE 32 /* Wild guess */ # endif # if defined(LINUX) || defined(HURD) || defined(__GLIBC__) # define REGISTER_LIBRARIES_EARLY /* We sometimes use dl_iterate_phdr, which may acquire an internal */ /* lock. This isn't safe after the world has stopped. So we must */ /* call GC_register_dynamic_libraries before stopping the world. */ /* For performance reasons, this may be beneficial on other */ /* platforms as well, though it should be avoided in win32. */ # endif /* LINUX */ # if defined(SEARCH_FOR_DATA_START) extern ptr_t GC_data_start; # define DATASTART GC_data_start # endif # ifndef CLEAR_DOUBLE # define CLEAR_DOUBLE(x) \ ((word*)x)[0] = 0; \ ((word*)x)[1] = 0; # endif /* CLEAR_DOUBLE */ # if defined(GC_LINUX_THREADS) && defined(REDIRECT_MALLOC) \ && !defined(INCLUDE_LINUX_THREAD_DESCR) /* Will not work, since libc and the dynamic loader use thread */ /* locals, sometimes as the only reference. */ # define INCLUDE_LINUX_THREAD_DESCR # endif # if defined(GC_IRIX_THREADS) && !defined(IRIX5) --> inconsistent configuration # endif # if defined(GC_LINUX_THREADS) && !defined(LINUX) --> inconsistent configuration # endif # if defined(GC_NETBSD_THREADS) && !defined(NETBSD) --> inconsistent configuration # endif # if defined(GC_SOLARIS_THREADS) && !defined(SOLARIS) --> inconsistent configuration # endif # if defined(GC_HPUX_THREADS) && !defined(HPUX) --> inconsistent configuration # endif # if defined(GC_AIX_THREADS) && !defined(_AIX) --> inconsistent configuration # endif # if defined(GC_GNU_THREADS) && !defined(HURD) --> inconsistent configuration # endif # if defined(GC_WIN32_THREADS) && !defined(MSWIN32) && !defined(CYGWIN32) --> inconsistent configuration # endif # if defined(PCR) || defined(GC_WIN32_THREADS) || defined(GC_PTHREADS) # define THREADS # endif # if !defined(USE_MARK_BITS) && !defined(USE_MARK_BYTES) # if defined(THREADS) && defined(PARALLEL_MARK) # define USE_MARK_BYTES # else # define USE_MARK_BITS # endif # endif # if defined(MSWINCE) # define NO_GETENV # endif # if defined(SPARC) # define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */ /* include assembly code to do it well. */ # endif /* Can we save call chain in objects for debugging? */ /* SET NFRAMES (# of saved frames) and NARGS (#of args for each */ /* frame) to reasonable values for the platform. */ /* Set SAVE_CALL_CHAIN if we can. SAVE_CALL_COUNT can be specified */ /* at build time, though we feel free to adjust it slightly. */ /* Define NEED_CALLINFO if we either save the call stack or */ /* GC_ADD_CALLER is defined. */ /* GC_CAN_SAVE_CALL_STACKS is set in gc.h. */ #if defined(SPARC) # define CAN_SAVE_CALL_ARGS #endif #if (defined(I386) || defined(X86_64)) && (defined(LINUX) || defined(__GLIBC__)) /* SAVE_CALL_CHAIN is supported if the code is compiled to save */ /* frame pointers by default, i.e. no -fomit-frame-pointer flag. */ # define CAN_SAVE_CALL_ARGS #endif # if defined(SAVE_CALL_COUNT) && !defined(GC_ADD_CALLER) \ && defined(GC_CAN_SAVE_CALL_STACKS) # define SAVE_CALL_CHAIN # endif # ifdef SAVE_CALL_CHAIN # if defined(SAVE_CALL_NARGS) && defined(CAN_SAVE_CALL_ARGS) # define NARGS SAVE_CALL_NARGS # else # define NARGS 0 /* Number of arguments to save for each call. */ # endif # endif # ifdef SAVE_CALL_CHAIN # ifndef SAVE_CALL_COUNT # define NFRAMES 6 /* Number of frames to save. Even for */ /* alignment reasons. */ # else # define NFRAMES ((SAVE_CALL_COUNT + 1) & ~1) # endif # define NEED_CALLINFO # endif /* SAVE_CALL_CHAIN */ # ifdef GC_ADD_CALLER # define NFRAMES 1 # define NARGS 0 # define NEED_CALLINFO # endif # if defined(MAKE_BACK_GRAPH) && !defined(DBG_HDRS_ALL) # define DBG_HDRS_ALL # endif # if defined(POINTER_MASK) && !defined(POINTER_SHIFT) # define POINTER_SHIFT 0 # endif # if defined(POINTER_SHIFT) && !defined(POINTER_MASK) # define POINTER_MASK ((GC_word)(-1)) # endif # if !defined(FIXUP_POINTER) && defined(POINTER_MASK) # define FIXUP_POINTER(p) (p) = ((p) & (POINTER_MASK) << POINTER_SHIFT) # endif # if defined(FIXUP_POINTER) # define NEED_FIXUP_POINTER 1 # else # define NEED_FIXUP_POINTER 0 # define FIXUP_POINTER(p) # endif # if !defined(MARK_BIT_PER_GRANULE) && !defined(MARK_BIT_PER_OBJ) # define MARK_BIT_PER_GRANULE /* Usually faster */ # endif /* Some static sanity tests. */ # if defined(MARK_BIT_PER_GRANULE) && defined(MARK_BIT_PER_OBJ) # error Define only one of MARK_BIT_PER_GRANULE and MARK_BIT_PER_OBJ. # endif # if defined(STACK_GROWS_UP) && defined(STACK_GROWS_DOWN) # error "Only one of STACK_GROWS_UP and STACK_GROWS_DOWN should be defd." # endif # if !defined(STACK_GROWS_UP) && !defined(STACK_GROWS_DOWN) # error "One of STACK_GROWS_UP and STACK_GROWS_DOWN should be defd." # endif # if defined(REDIRECT_MALLOC) && defined(THREADS) && !defined(LINUX) # error "REDIRECT_MALLOC with THREADS works at most on Linux." # endif #ifdef GC_PRIVATE_H /* This relies on some type definitions from gc_priv.h, from */ /* where it's normally included. */ /* */ /* How to get heap memory from the OS: */ /* Note that sbrk()-like allocation is preferred, since it */ /* usually makes it possible to merge consecutively allocated */ /* chunks. It also avoids unintented recursion with */ /* -DREDIRECT_MALLOC. */ /* GET_MEM() returns a HLKSIZE aligned chunk. */ /* 0 is taken to mean failure. */ /* In the case os USE_MMAP, the argument must also be a */ /* physical page size. */ /* GET_MEM is currently not assumed to retrieve 0 filled space, */ /* though we should perhaps take advantage of the case in which */ /* does. */ struct hblk; /* See gc_priv.h. */ # if defined(PCR) char * real_malloc(); # define GET_MEM(bytes) HBLKPTR(real_malloc((size_t)bytes + GC_page_size) \ + GC_page_size-1) # elif defined(OS2) void * os2_alloc(size_t bytes); # define GET_MEM(bytes) HBLKPTR((ptr_t)os2_alloc((size_t)bytes \ + GC_page_size) \ + GC_page_size-1) # elif defined(NEXT) || defined(DOS4GW) || defined(NONSTOP) || \ (defined(AMIGA) && !defined(GC_AMIGA_FASTALLOC)) || \ (defined(SOLARIS) && !defined(USE_MMAP)) # define GET_MEM(bytes) HBLKPTR((size_t) calloc(1, (size_t)bytes + GC_page_size) \ + GC_page_size-1) # elif defined(MSWIN32) extern ptr_t GC_win32_get_mem(); # define GET_MEM(bytes) (struct hblk *)GC_win32_get_mem(bytes) # elif defined(MACOS) # if defined(USE_TEMPORARY_MEMORY) extern Ptr GC_MacTemporaryNewPtr(size_t size, Boolean clearMemory); # define GET_MEM(bytes) HBLKPTR( \ GC_MacTemporaryNewPtr(bytes + GC_page_size, true) \ + GC_page_size-1) # else # define GET_MEM(bytes) HBLKPTR( \ NewPtrClear(bytes + GC_page_size) + GC_page_size-1) # endif # elif defined(MSWINCE) extern ptr_t GC_wince_get_mem(); # define GET_MEM(bytes) (struct hblk *)GC_wince_get_mem(bytes) # elif defined(AMIGA) && defined(GC_AMIGA_FASTALLOC) extern void *GC_amiga_get_mem(size_t size); # define GET_MEM(bytes) HBLKPTR((size_t) \ GC_amiga_get_mem((size_t)bytes + GC_page_size) \ + GC_page_size-1) # else extern ptr_t GC_unix_get_mem(); # define GET_MEM(bytes) (struct hblk *)GC_unix_get_mem(bytes) # endif #endif /* GC_PRIVATE_H */ # endif /* GCCONFIG_H */ synopsis-0.12/src/Synopsis/gc/include/private/pthread_support.h0000664000076400007640000000560311104702317024357 0ustar stefanstefan#ifndef GC_PTHREAD_SUPPORT_H #define GC_PTHREAD_SUPPORT_H # include "private/gc_priv.h" # if defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS) #if defined(GC_DARWIN_THREADS) # include "private/darwin_stop_world.h" #else # include "private/pthread_stop_world.h" #endif #ifdef THREAD_LOCAL_ALLOC # include "thread_local_alloc.h" #endif /* THREAD_LOCAL_ALLOC */ /* We use the allocation lock to protect thread-related data structures. */ /* The set of all known threads. We intercept thread creation and */ /* joins. */ /* Protected by allocation/GC lock. */ /* Some of this should be declared volatile, but that's inconsistent */ /* with some library routine declarations. */ typedef struct GC_Thread_Rep { struct GC_Thread_Rep * next; /* More recently allocated threads */ /* with a given pthread id come */ /* first. (All but the first are */ /* guaranteed to be dead, but we may */ /* not yet have registered the join.) */ pthread_t id; /* Extra bookkeeping information the stopping code uses */ struct thread_stop_info stop_info; short flags; # define FINISHED 1 /* Thread has exited. */ # define DETACHED 2 /* Thread is treated as detached. */ /* Thread may really be detached, or */ /* it may have have been explicitly */ /* registered, in which case we can */ /* deallocate its GC_Thread_Rep once */ /* it unregisters itself, since it */ /* may not return a GC pointer. */ # define MAIN_THREAD 4 /* True for the original thread only. */ short thread_blocked; /* Protected by GC lock. */ /* Treated as a boolean value. If set, */ /* thread will acquire GC lock before */ /* doing any pointer manipulations, and */ /* has set its sp value. Thus it does */ /* not need to be sent a signal to stop */ /* it. */ ptr_t stack_end; /* Cold end of the stack. */ # ifdef IA64 ptr_t backing_store_end; ptr_t backing_store_ptr; # endif void * status; /* The value returned from the thread. */ /* Used only to avoid premature */ /* reclamation of any data it might */ /* reference. */ /* This is unfortunately also the */ /* reason we need to intercept join */ /* and detach. */ # ifdef THREAD_LOCAL_ALLOC struct thread_local_freelists tlfs; # endif } * GC_thread; # define THREAD_TABLE_SZ 256 /* Must be power of 2 */ extern volatile GC_thread GC_threads[THREAD_TABLE_SZ]; extern GC_bool GC_thr_initialized; GC_thread GC_lookup_thread(pthread_t id); void GC_stop_init(); extern GC_bool GC_in_thread_creation; /* We may currently be in thread creation or destruction. */ /* Only set to TRUE while allocation lock is held. */ /* When set, it is OK to run GC from unknown thread. */ #endif /* GC_PTHREADS && !GC_SOLARIS_THREADS.... etc */ #endif /* GC_PTHREAD_SUPPORT_H */ synopsis-0.12/src/Synopsis/gc/include/private/darwin_semaphore.h0000664000076400007640000000315511104702317024463 0ustar stefanstefan#ifndef GC_DARWIN_SEMAPHORE_H #define GC_DARWIN_SEMAPHORE_H #if !defined(GC_DARWIN_THREADS) #error darwin_semaphore.h included with GC_DARWIN_THREADS not defined #endif /* This is a very simple semaphore implementation for darwin. It is implemented in terms of pthreads calls so it isn't async signal safe. This isn't a problem because signals aren't used to suspend threads on darwin. */ typedef struct { pthread_mutex_t mutex; pthread_cond_t cond; int value; } sem_t; static int sem_init(sem_t *sem, int pshared, int value) { int ret; if(pshared) GC_abort("sem_init with pshared set"); sem->value = value; ret = pthread_mutex_init(&sem->mutex,NULL); if(ret < 0) return -1; ret = pthread_cond_init(&sem->cond,NULL); if(ret < 0) return -1; return 0; } static int sem_post(sem_t *sem) { if(pthread_mutex_lock(&sem->mutex) < 0) return -1; sem->value++; if(pthread_cond_signal(&sem->cond) < 0) { pthread_mutex_unlock(&sem->mutex); return -1; } if(pthread_mutex_unlock(&sem->mutex) < 0) return -1; return 0; } static int sem_wait(sem_t *sem) { if(pthread_mutex_lock(&sem->mutex) < 0) return -1; while(sem->value == 0) { pthread_cond_wait(&sem->cond,&sem->mutex); } sem->value--; if(pthread_mutex_unlock(&sem->mutex) < 0) return -1; return 0; } static int sem_destroy(sem_t *sem) { int ret; ret = pthread_cond_destroy(&sem->cond); if(ret < 0) return -1; ret = pthread_mutex_destroy(&sem->mutex); if(ret < 0) return -1; return 0; } #endif synopsis-0.12/src/Synopsis/gc/include/private/msvc_dbg.h0000664000076400007640000000550511104702317022721 0ustar stefanstefan/* Copyright (c) 2004-2005 Andrei Polushin 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 _MSVC_DBG_H #define _MSVC_DBG_H #include #ifdef __cplusplus extern "C" { #endif #if !MSVC_DBG_DLL #define MSVC_DBG_EXPORT #elif MSVC_DBG_BUILD #define MSVC_DBG_EXPORT __declspec(dllexport) #else #define MSVC_DBG_EXPORT __declspec(dllimport) #endif #ifndef MAX_SYM_NAME #define MAX_SYM_NAME 2000 #endif typedef void* HANDLE; typedef struct _CONTEXT CONTEXT; MSVC_DBG_EXPORT size_t GetStackFrames(size_t skip, void* frames[], size_t maxFrames); MSVC_DBG_EXPORT size_t GetStackFramesFromContext(HANDLE hProcess, HANDLE hThread, CONTEXT* context, size_t skip, void* frames[], size_t maxFrames); MSVC_DBG_EXPORT size_t GetModuleNameFromAddress(void* address, char* moduleName, size_t size); MSVC_DBG_EXPORT size_t GetModuleNameFromStack(size_t skip, char* moduleName, size_t size); MSVC_DBG_EXPORT size_t GetSymbolNameFromAddress(void* address, char* symbolName, size_t size, size_t* offsetBytes); MSVC_DBG_EXPORT size_t GetSymbolNameFromStack(size_t skip, char* symbolName, size_t size, size_t* offsetBytes); MSVC_DBG_EXPORT size_t GetFileLineFromAddress(void* address, char* fileName, size_t size, size_t* lineNumber, size_t* offsetBytes); MSVC_DBG_EXPORT size_t GetFileLineFromStack(size_t skip, char* fileName, size_t size, size_t* lineNumber, size_t* offsetBytes); MSVC_DBG_EXPORT size_t GetDescriptionFromAddress(void* address, const char* format, char* description, size_t size); MSVC_DBG_EXPORT size_t GetDescriptionFromStack(void*const frames[], size_t count, const char* format, char* description[], size_t size); /* Compatibility with */ MSVC_DBG_EXPORT int backtrace(void* addresses[], int count); MSVC_DBG_EXPORT char** backtrace_symbols(void*const addresses[], int count); #ifdef __cplusplus } #endif #endif/*_MSVC_DBG_H*/ synopsis-0.12/src/Synopsis/gc/include/private/gc_priv.h0000664000076400007640000021442011104702317022564 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P. * * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ # ifndef GC_PRIVATE_H # define GC_PRIVATE_H # include # if !(defined( sony_news ) ) # include # endif #ifdef DGUX # include # include # include #endif /* DGUX */ #ifdef BSD_TIME # include # include # include #endif /* BSD_TIME */ #ifdef PARALLEL_MARK # define AO_REQUIRE_CAS #endif #ifndef _GC_H # include "../gc.h" #endif #ifndef GC_TINY_FL_H # include "../gc_tiny_fl.h" #endif #ifndef GC_MARK_H # include "../gc_mark.h" #endif typedef GC_word word; typedef GC_signed_word signed_word; typedef unsigned int unsigned32; typedef int GC_bool; # define TRUE 1 # define FALSE 0 typedef char * ptr_t; /* A generic pointer to which we can add */ /* byte displacements and which can be used */ /* for address comparisons. */ # ifndef GCCONFIG_H # include "gcconfig.h" # endif # ifndef HEADERS_H # include "gc_hdrs.h" # endif #if __GNUC__ >= 3 # define EXPECT(expr, outcome) __builtin_expect(expr,outcome) /* Equivalent to (expr), but predict that usually (expr)==outcome. */ # define INLINE inline #else # define EXPECT(expr, outcome) (expr) # define INLINE #endif /* __GNUC__ */ # ifndef GC_LOCKS_H # include "gc_locks.h" # endif # ifdef STACK_GROWS_DOWN # define COOLER_THAN > # define HOTTER_THAN < # define MAKE_COOLER(x,y) if ((x)+(y) > (x)) {(x) += (y);} \ else {(x) = (ptr_t)ONES;} # define MAKE_HOTTER(x,y) (x) -= (y) # else # define COOLER_THAN < # define HOTTER_THAN > # define MAKE_COOLER(x,y) if ((x)-(y) < (x)) {(x) -= (y);} else {(x) = 0;} # define MAKE_HOTTER(x,y) (x) += (y) # endif #if defined(AMIGA) && defined(__SASC) # define GC_FAR __far #else # define GC_FAR #endif /*********************************/ /* */ /* Definitions for conservative */ /* collector */ /* */ /*********************************/ /*********************************/ /* */ /* Easily changeable parameters */ /* */ /*********************************/ /* #define STUBBORN_ALLOC */ /* Enable stubborm allocation, and thus a limited */ /* form of incremental collection w/o dirty bits. */ /* #define ALL_INTERIOR_POINTERS */ /* Forces all pointers into the interior of an */ /* object to be considered valid. Also causes the */ /* sizes of all objects to be inflated by at least */ /* one byte. This should suffice to guarantee */ /* that in the presence of a compiler that does */ /* not perform garbage-collector-unsafe */ /* optimizations, all portable, strictly ANSI */ /* conforming C programs should be safely usable */ /* with malloc replaced by GC_malloc and free */ /* calls removed. There are several disadvantages: */ /* 1. There are probably no interesting, portable, */ /* strictly ANSI conforming C programs. */ /* 2. This option makes it hard for the collector */ /* to allocate space that is not ``pointed to'' */ /* by integers, etc. Under SunOS 4.X with a */ /* statically linked libc, we empiricaly */ /* observed that it would be difficult to */ /* allocate individual objects larger than 100K. */ /* Even if only smaller objects are allocated, */ /* more swap space is likely to be needed. */ /* Fortunately, much of this will never be */ /* touched. */ /* If you can easily avoid using this option, do. */ /* If not, try to keep individual objects small. */ /* This is now really controlled at startup, */ /* through GC_all_interior_pointers. */ #define GC_INVOKE_FINALIZERS() GC_notify_or_invoke_finalizers() #if !defined(DONT_ADD_BYTE_AT_END) # define EXTRA_BYTES GC_all_interior_pointers # define MAX_EXTRA_BYTES 1 #else # define EXTRA_BYTES 0 # define MAX_EXTRA_BYTES 0 #endif # ifndef LARGE_CONFIG # define MINHINCR 16 /* Minimum heap increment, in blocks of HBLKSIZE */ /* Must be multiple of largest page size. */ # define MAXHINCR 2048 /* Maximum heap increment, in blocks */ # else # define MINHINCR 64 # define MAXHINCR 4096 # endif # define TIME_LIMIT 50 /* We try to keep pause times from exceeding */ /* this by much. In milliseconds. */ # define BL_LIMIT GC_black_list_spacing /* If we need a block of N bytes, and we have */ /* a block of N + BL_LIMIT bytes available, */ /* and N > BL_LIMIT, */ /* but all possible positions in it are */ /* blacklisted, we just use it anyway (and */ /* print a warning, if warnings are enabled). */ /* This risks subsequently leaking the block */ /* due to a false reference. But not using */ /* the block risks unreasonable immediate */ /* heap growth. */ /*********************************/ /* */ /* Stack saving for debugging */ /* */ /*********************************/ #ifdef NEED_CALLINFO struct callinfo { word ci_pc; /* Caller, not callee, pc */ # if NARGS > 0 word ci_arg[NARGS]; /* bit-wise complement to avoid retention */ # endif # if (NFRAMES * (NARGS + 1)) % 2 == 1 /* Likely alignment problem. */ word ci_dummy; # endif }; #endif #ifdef SAVE_CALL_CHAIN /* Fill in the pc and argument information for up to NFRAMES of my */ /* callers. Ignore my frame and my callers frame. */ void GC_save_callers(struct callinfo info[NFRAMES]); void GC_print_callers(struct callinfo info[NFRAMES]); #endif /*********************************/ /* */ /* OS interface routines */ /* */ /*********************************/ #ifdef BSD_TIME # undef CLOCK_TYPE # undef GET_TIME # undef MS_TIME_DIFF # define CLOCK_TYPE struct timeval # define GET_TIME(x) { struct rusage rusage; \ getrusage (RUSAGE_SELF, &rusage); \ x = rusage.ru_utime; } # define MS_TIME_DIFF(a,b) ((double) (a.tv_sec - b.tv_sec) * 1000.0 \ + (double) (a.tv_usec - b.tv_usec) / 1000.0) #else /* !BSD_TIME */ # if defined(MSWIN32) || defined(MSWINCE) # include # include # define CLOCK_TYPE DWORD # define GET_TIME(x) x = GetTickCount() # define MS_TIME_DIFF(a,b) ((long)((a)-(b))) # else /* !MSWIN32, !MSWINCE, !BSD_TIME */ # include # if !defined(__STDC__) && defined(SPARC) && defined(SUNOS4) clock_t clock(); /* Not in time.h, where it belongs */ # endif # if defined(FREEBSD) && !defined(CLOCKS_PER_SEC) # include # define CLOCKS_PER_SEC CLK_TCK # endif # if !defined(CLOCKS_PER_SEC) # define CLOCKS_PER_SEC 1000000 /* * This is technically a bug in the implementation. ANSI requires that * CLOCKS_PER_SEC be defined. But at least under SunOS4.1.1, it isn't. * Also note that the combination of ANSI C and POSIX is incredibly gross * here. The type clock_t is used by both clock() and times(). But on * some machines these use different notions of a clock tick, CLOCKS_PER_SEC * seems to apply only to clock. Hence we use it here. On many machines, * including SunOS, clock actually uses units of microseconds (which are * not really clock ticks). */ # endif # define CLOCK_TYPE clock_t # define GET_TIME(x) x = clock() # define MS_TIME_DIFF(a,b) ((unsigned long) \ (1000.0*(double)((a)-(b))/(double)CLOCKS_PER_SEC)) # endif /* !MSWIN32 */ #endif /* !BSD_TIME */ /* We use bzero and bcopy internally. They may not be available. */ # if defined(SPARC) && defined(SUNOS4) # define BCOPY_EXISTS # endif # if defined(M68K) && defined(AMIGA) # define BCOPY_EXISTS # endif # if defined(M68K) && defined(NEXT) # define BCOPY_EXISTS # endif # if defined(VAX) # define BCOPY_EXISTS # endif # if defined(AMIGA) # include # define BCOPY_EXISTS # endif # if defined(DARWIN) # include # define BCOPY_EXISTS # endif # ifndef BCOPY_EXISTS # include # define BCOPY(x,y,n) memcpy(y, x, (size_t)(n)) # define BZERO(x,n) memset(x, 0, (size_t)(n)) # else # define BCOPY(x,y,n) bcopy((void *)(x),(void *)(y),(size_t)(n)) # define BZERO(x,n) bzero((void *)(x),(size_t)(n)) # endif /* * Stop and restart mutator threads. */ # ifdef PCR # include "th/PCR_ThCtl.h" # define STOP_WORLD() \ PCR_ThCtl_SetExclusiveMode(PCR_ThCtl_ExclusiveMode_stopNormal, \ PCR_allSigsBlocked, \ PCR_waitForever) # define START_WORLD() \ PCR_ThCtl_SetExclusiveMode(PCR_ThCtl_ExclusiveMode_null, \ PCR_allSigsBlocked, \ PCR_waitForever); # else # if defined(GC_SOLARIS_THREADS) || defined(GC_WIN32_THREADS) \ || defined(GC_PTHREADS) void GC_stop_world(); void GC_start_world(); # define STOP_WORLD() GC_stop_world() # define START_WORLD() GC_start_world() # else # define STOP_WORLD() # define START_WORLD() # endif # endif /* Abandon ship */ # ifdef PCR # define ABORT(s) PCR_Base_Panic(s) # else # ifdef SMALL_CONFIG # define ABORT(msg) abort() # else GC_API void GC_abort(const char * msg); # define ABORT(msg) GC_abort(msg) # endif # endif /* Exit abnormally, but without making a mess (e.g. out of memory) */ # ifdef PCR # define EXIT() PCR_Base_Exit(1,PCR_waitForever) # else # define EXIT() (void)exit(1) # endif /* Print warning message, e.g. almost out of memory. */ # define WARN(msg,arg) (*GC_current_warn_proc)("GC Warning: " msg, (GC_word)(arg)) extern GC_warn_proc GC_current_warn_proc; /* Get environment entry */ #if !defined(NO_GETENV) # if defined(EMPTY_GETENV_RESULTS) /* Workaround for a reputed Wine bug. */ static inline char * fixed_getenv(const char *name) { char * tmp = getenv(name); if (tmp == 0 || strlen(tmp) == 0) return 0; return tmp; } # define GETENV(name) fixed_getenv(name) # else # define GETENV(name) getenv(name) # endif #else # define GETENV(name) 0 #endif #if defined(DARWIN) # if defined(POWERPC) # if CPP_WORDSZ == 32 # define GC_THREAD_STATE_T ppc_thread_state_t # define GC_MACH_THREAD_STATE PPC_THREAD_STATE # define GC_MACH_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT # define GC_MACH_HEADER mach_header # define GC_MACH_SECTION section # else # define GC_THREAD_STATE_T ppc_thread_state64_t # define GC_MACH_THREAD_STATE PPC_THREAD_STATE64 # define GC_MACH_THREAD_STATE_COUNT PPC_THREAD_STATE64_COUNT # define GC_MACH_HEADER mach_header_64 # define GC_MACH_SECTION section_64 # endif # elif defined(I386) || defined(X86_64) # if CPP_WORDSZ == 32 # define GC_THREAD_STATE_T x86_thread_state32_t # define GC_MACH_THREAD_STATE x86_THREAD_STATE32 # define GC_MACH_THREAD_STATE_COUNT x86_THREAD_STATE32_COUNT # define GC_MACH_HEADER mach_header # define GC_MACH_SECTION section # else # define GC_THREAD_STATE_T x86_thread_state64_t # define GC_MACH_THREAD_STATE x86_THREAD_STATE64 # define GC_MACH_THREAD_STATE_COUNT x86_THREAD_STATE64_COUNT # define GC_MACH_HEADER mach_header_64 # define GC_MACH_SECTION section_64 # endif # else # error define GC_THREAD_STATE_T # define GC_MACH_THREAD_STATE MACHINE_THREAD_STATE # define GC_MACH_THREAD_STATE_COUNT MACHINE_THREAD_STATE_COUNT # endif /* Try to work out the right way to access thread state structure members. The structure has changed its definition in different Darwin versions. This now defaults to the (older) names without __, thus hopefully, not breaking any existing Makefile.direct builds. */ # if defined (HAS_PPC_THREAD_STATE___R0) \ || defined (HAS_PPC_THREAD_STATE64___R0) \ || defined (HAS_X86_THREAD_STATE32___EAX) \ || defined (HAS_X86_THREAD_STATE64___RAX) # define THREAD_FLD(x) __ ## x # else # define THREAD_FLD(x) x # endif #endif /*********************************/ /* */ /* Word-size-dependent defines */ /* */ /*********************************/ #if CPP_WORDSZ == 32 # define WORDS_TO_BYTES(x) ((x)<<2) # define BYTES_TO_WORDS(x) ((x)>>2) # define LOGWL ((word)5) /* log[2] of CPP_WORDSZ */ # define modWORDSZ(n) ((n) & 0x1f) /* n mod size of word */ # if ALIGNMENT != 4 # define UNALIGNED # endif #endif #if CPP_WORDSZ == 64 # define WORDS_TO_BYTES(x) ((x)<<3) # define BYTES_TO_WORDS(x) ((x)>>3) # define LOGWL ((word)6) /* log[2] of CPP_WORDSZ */ # define modWORDSZ(n) ((n) & 0x3f) /* n mod size of word */ # if ALIGNMENT != 8 # define UNALIGNED # endif #endif /* The first TINY_FREELISTS free lists correspond to the first */ /* TINY_FREELISTS multiples of GRANULE_BYTES, i.e. we keep */ /* separate free lists for each multiple of GRANULE_BYTES */ /* up to (TINY_FREELISTS-1) * GRANULE_BYTES. After that they */ /* may be spread out further. */ #include "../gc_tiny_fl.h" #define GRANULE_BYTES GC_GRANULE_BYTES #define TINY_FREELISTS GC_TINY_FREELISTS #define WORDSZ ((word)CPP_WORDSZ) #define SIGNB ((word)1 << (WORDSZ-1)) #define BYTES_PER_WORD ((word)(sizeof (word))) #define ONES ((word)(signed_word)(-1)) #define divWORDSZ(n) ((n) >> LOGWL) /* divide n by size of word */ #if GRANULE_BYTES == 8 # define BYTES_TO_GRANULES(n) ((n)>>3) # define GRANULES_TO_BYTES(n) ((n)<<3) # if CPP_WORDSZ == 64 # define GRANULES_TO_WORDS(n) (n) # elif CPP_WORDSZ == 32 # define GRANULES_TO_WORDS(n) ((n)<<1) # else # define GRANULES_TO_WORDS(n) BYTES_TO_WORDS(GRANULES_TO_BYTES(n)) # endif #elif GRANULE_BYTES == 16 # define BYTES_TO_GRANULES(n) ((n)>>4) # define GRANULES_TO_BYTES(n) ((n)<<4) # if CPP_WORDSZ == 64 # define GRANULES_TO_WORDS(n) ((n)<<1) # elif CPP_WORDSZ == 32 # define GRANULES_TO_WORDS(n) ((n)<<2) # else # define GRANULES_TO_WORDS(n) BYTES_TO_WORDS(GRANULES_TO_BYTES(n)) # endif #else # error Bad GRANULE_BYTES value #endif /*********************/ /* */ /* Size Parameters */ /* */ /*********************/ /* heap block size, bytes. Should be power of 2 */ #ifndef HBLKSIZE # ifdef SMALL_CONFIG # define CPP_LOG_HBLKSIZE 10 # else # if (CPP_WORDSZ == 32) || (defined(HPUX) && defined(HP_PA)) /* HPUX/PA seems to use 4K pages with the 64 bit ABI */ # define CPP_LOG_HBLKSIZE 12 # else # define CPP_LOG_HBLKSIZE 13 # endif # endif #else # if HBLKSIZE == 512 # define CPP_LOG_HBLKSIZE 9 # endif # if HBLKSIZE == 1024 # define CPP_LOG_HBLKSIZE 10 # endif # if HBLKSIZE == 2048 # define CPP_LOG_HBLKSIZE 11 # endif # if HBLKSIZE == 4096 # define CPP_LOG_HBLKSIZE 12 # endif # if HBLKSIZE == 8192 # define CPP_LOG_HBLKSIZE 13 # endif # if HBLKSIZE == 16384 # define CPP_LOG_HBLKSIZE 14 # endif # ifndef CPP_LOG_HBLKSIZE --> fix HBLKSIZE # endif # undef HBLKSIZE #endif # define CPP_HBLKSIZE (1 << CPP_LOG_HBLKSIZE) # define LOG_HBLKSIZE ((size_t)CPP_LOG_HBLKSIZE) # define HBLKSIZE ((size_t)CPP_HBLKSIZE) /* max size objects supported by freelist (larger objects are */ /* allocated directly with allchblk(), by rounding to the next */ /* multiple of HBLKSIZE. */ #define CPP_MAXOBJBYTES (CPP_HBLKSIZE/2) #define MAXOBJBYTES ((size_t)CPP_MAXOBJBYTES) #define CPP_MAXOBJWORDS BYTES_TO_WORDS(CPP_MAXOBJBYTES) #define MAXOBJWORDS ((size_t)CPP_MAXOBJWORDS) #define CPP_MAXOBJGRANULES BYTES_TO_GRANULES(CPP_MAXOBJBYTES) #define MAXOBJGRANULES ((size_t)CPP_MAXOBJGRANULES) # define divHBLKSZ(n) ((n) >> LOG_HBLKSIZE) # define HBLK_PTR_DIFF(p,q) divHBLKSZ((ptr_t)p - (ptr_t)q) /* Equivalent to subtracting 2 hblk pointers. */ /* We do it this way because a compiler should */ /* find it hard to use an integer division */ /* instead of a shift. The bundled SunOS 4.1 */ /* o.w. sometimes pessimizes the subtraction to */ /* involve a call to .div. */ # define modHBLKSZ(n) ((n) & (HBLKSIZE-1)) # define HBLKPTR(objptr) ((struct hblk *)(((word) (objptr)) & ~(HBLKSIZE-1))) # define HBLKDISPL(objptr) (((size_t) (objptr)) & (HBLKSIZE-1)) /* Round up byte allocation requests to integral number of words, etc. */ # define ROUNDED_UP_WORDS(n) \ BYTES_TO_WORDS((n) + (WORDS_TO_BYTES(1) - 1 + EXTRA_BYTES)) # define ROUNDED_UP_GRANULES(n) \ BYTES_TO_GRANULES((n) + (GRANULE_BYTES - 1 + EXTRA_BYTES)) # if MAX_EXTRA_BYTES == 0 # define SMALL_OBJ(bytes) EXPECT((bytes) <= (MAXOBJBYTES), 1) # else # define SMALL_OBJ(bytes) \ (EXPECT((bytes) <= (MAXOBJBYTES - MAX_EXTRA_BYTES), 1) || \ (bytes) <= (MAXOBJBYTES - EXTRA_BYTES)) /* This really just tests bytes <= MAXOBJBYTES - EXTRA_BYTES. */ /* But we try to avoid looking up EXTRA_BYTES. */ # endif # define ADD_SLOP(bytes) ((bytes) + EXTRA_BYTES) # ifndef MIN_WORDS # define MIN_WORDS 2 /* FIXME: obsolete */ # endif /* * Hash table representation of sets of pages. * Implements a map from aligned HBLKSIZE chunks of the address space to one * bit each. * This assumes it is OK to spuriously set bits, e.g. because multiple * addresses are represented by a single location. * Used by black-listing code, and perhaps by dirty bit maintenance code. */ # ifdef LARGE_CONFIG # define LOG_PHT_ENTRIES 20 /* Collisions likely at 1M blocks, */ /* which is >= 4GB. Each table takes */ /* 128KB, some of which may never be */ /* touched. */ # else # ifdef SMALL_CONFIG # define LOG_PHT_ENTRIES 14 /* Collisions are likely if heap grows */ /* to more than 16K hblks = 64MB. */ /* Each hash table occupies 2K bytes. */ # else /* default "medium" configuration */ # define LOG_PHT_ENTRIES 16 /* Collisions are likely if heap grows */ /* to more than 64K hblks >= 256MB. */ /* Each hash table occupies 8K bytes. */ /* Even for somewhat smaller heaps, */ /* say half that, collisions may be an */ /* issue because we blacklist */ /* addresses outside the heap. */ # endif # endif # define PHT_ENTRIES ((word)1 << LOG_PHT_ENTRIES) # define PHT_SIZE (PHT_ENTRIES >> LOGWL) typedef word page_hash_table[PHT_SIZE]; # define PHT_HASH(addr) ((((word)(addr)) >> LOG_HBLKSIZE) & (PHT_ENTRIES - 1)) # define get_pht_entry_from_index(bl, index) \ (((bl)[divWORDSZ(index)] >> modWORDSZ(index)) & 1) # define set_pht_entry_from_index(bl, index) \ (bl)[divWORDSZ(index)] |= (word)1 << modWORDSZ(index) # define clear_pht_entry_from_index(bl, index) \ (bl)[divWORDSZ(index)] &= ~((word)1 << modWORDSZ(index)) /* And a dumb but thread-safe version of set_pht_entry_from_index. */ /* This sets (many) extra bits. */ # define set_pht_entry_from_index_safe(bl, index) \ (bl)[divWORDSZ(index)] = ONES /********************************************/ /* */ /* H e a p B l o c k s */ /* */ /********************************************/ /* heap block header */ #define HBLKMASK (HBLKSIZE-1) #define MARK_BITS_PER_HBLK (HBLKSIZE/GRANULE_BYTES) /* upper bound */ /* We allocate 1 bit per allocation granule. */ /* If MARK_BIT_PER_GRANULE is defined, we use */ /* every nth bit, where n is the number of */ /* allocation granules per object. If */ /* MARK_BIT_PER_OBJ is defined, we only use the */ /* initial group of mark bits, and it is safe */ /* to allocate smaller header for large objects. */ # ifdef USE_MARK_BYTES # define MARK_BITS_SZ (MARK_BITS_PER_HBLK + 1) /* Unlike the other case, this is in units of bytes. */ /* Since we force doubleword alignment, we need at most one */ /* mark bit per 2 words. But we do allocate and set one */ /* extra mark bit to avoid an explicit check for the */ /* partial object at the end of each block. */ # else # define MARK_BITS_SZ (MARK_BITS_PER_HBLK/CPP_WORDSZ + 1) # endif #ifdef PARALLEL_MARK # include typedef AO_t counter_t; #else typedef size_t counter_t; #endif /* We maintain layout maps for heap blocks containing objects of a given */ /* size. Each entry in this map describes a byte offset and has the */ /* following type. */ struct hblkhdr { struct hblk * hb_next; /* Link field for hblk free list */ /* and for lists of chunks waiting to be */ /* reclaimed. */ struct hblk * hb_prev; /* Backwards link for free list. */ struct hblk * hb_block; /* The corresponding block. */ unsigned char hb_obj_kind; /* Kind of objects in the block. Each kind */ /* identifies a mark procedure and a set of */ /* list headers. Sometimes called regions. */ unsigned char hb_flags; # define IGNORE_OFF_PAGE 1 /* Ignore pointers that do not */ /* point to the first page of */ /* this object. */ # define WAS_UNMAPPED 2 /* This is a free block, which has */ /* been unmapped from the address */ /* space. */ /* GC_remap must be invoked on it */ /* before it can be reallocated. */ /* Only set with USE_MUNMAP. */ # define FREE_BLK 4 /* Block is free, i.e. not in use. */ unsigned short hb_last_reclaimed; /* Value of GC_gc_no when block was */ /* last allocated or swept. May wrap. */ /* For a free block, this is maintained */ /* only for USE_MUNMAP, and indicates */ /* when the header was allocated, or */ /* when the size of the block last */ /* changed. */ size_t hb_sz; /* If in use, size in bytes, of objects in the block. */ /* if free, the size in bytes of the whole block */ word hb_descr; /* object descriptor for marking. See */ /* mark.h. */ # ifdef MARK_BIT_PER_OBJ unsigned32 hb_inv_sz; /* A good upper bound for 2**32/hb_sz. */ /* For large objects, we use */ /* LARGE_INV_SZ. */ # define LARGE_INV_SZ (1 << 16) # else unsigned char hb_large_block; short * hb_map; /* Essentially a table of remainders */ /* mod BYTES_TO_GRANULES(hb_sz), except */ /* for large blocks. See GC_obj_map. */ # endif counter_t hb_n_marks; /* Number of set mark bits, excluding */ /* the one always set at the end. */ /* Currently it is concurrently */ /* updated and hence only approximate. */ /* But a zero value does guarantee that */ /* the block contains no marked */ /* objects. */ /* Ensuring this property means that we */ /* never decrement it to zero during a */ /* collection, and hence the count may */ /* be one too high. Due to concurrent */ /* updates, an arbitrary number of */ /* increments, but not all of them (!) */ /* may be lost, hence it may in theory */ /* be much too low. */ /* The count may also be too high if */ /* multiple mark threads mark the */ /* same object due to a race. */ /* Without parallel marking, the count */ /* is accurate. */ # ifdef USE_MARK_BYTES union { char _hb_marks[MARK_BITS_SZ]; /* The i'th byte is 1 if the object */ /* starting at granule i or object i is */ /* marked, 0 o.w. */ /* The mark bit for the "one past the */ /* end" object is always set to avoid a */ /* special case test in the marker. */ word dummy; /* Force word alignment of mark bytes. */ } _mark_byte_union; # define hb_marks _mark_byte_union._hb_marks # else word hb_marks[MARK_BITS_SZ]; # endif /* !USE_MARK_BYTES */ }; # define ANY_INDEX 23 /* "Random" mark bit index for assertions */ /* heap block body */ # define HBLK_WORDS (HBLKSIZE/sizeof(word)) # define HBLK_GRANULES (HBLKSIZE/GRANULE_BYTES) /* The number of objects in a block dedicated to a certain size. */ /* may erroneously yield zero (instead of one) for large objects. */ # define HBLK_OBJS(sz_in_bytes) (HBLKSIZE/(sz_in_bytes)) struct hblk { char hb_body[HBLKSIZE]; }; # define HBLK_IS_FREE(hdr) (((hdr) -> hb_flags & FREE_BLK) != 0) # define OBJ_SZ_TO_BLOCKS(sz) divHBLKSZ(sz + HBLKSIZE-1) /* Size of block (in units of HBLKSIZE) needed to hold objects of */ /* given sz (in bytes). */ /* Object free list link */ # define obj_link(p) (*(void **)(p)) # define LOG_MAX_MARK_PROCS 6 # define MAX_MARK_PROCS (1 << LOG_MAX_MARK_PROCS) /* Root sets. Logically private to mark_rts.c. But we don't want the */ /* tables scanned, so we put them here. */ /* MAX_ROOT_SETS is the maximum number of ranges that can be */ /* registered as static roots. */ # ifdef LARGE_CONFIG # define MAX_ROOT_SETS 4096 # else /* GCJ LOCAL: MAX_ROOT_SETS increased to permit more shared */ /* libraries to be loaded. */ # define MAX_ROOT_SETS 1024 # endif # define MAX_EXCLUSIONS (MAX_ROOT_SETS/4) /* Maximum number of segments that can be excluded from root sets. */ /* * Data structure for excluded static roots. */ struct exclusion { ptr_t e_start; ptr_t e_end; }; /* Data structure for list of root sets. */ /* We keep a hash table, so that we can filter out duplicate additions. */ /* Under Win32, we need to do a better job of filtering overlaps, so */ /* we resort to sequential search, and pay the price. */ struct roots { ptr_t r_start; ptr_t r_end; # if !defined(MSWIN32) && !defined(MSWINCE) struct roots * r_next; # endif GC_bool r_tmp; /* Delete before registering new dynamic libraries */ }; #if !defined(MSWIN32) && !defined(MSWINCE) /* Size of hash table index to roots. */ # define LOG_RT_SIZE 6 # define RT_SIZE (1 << LOG_RT_SIZE) /* Power of 2, may be != MAX_ROOT_SETS */ #endif /* Lists of all heap blocks and free lists */ /* as well as other random data structures */ /* that should not be scanned by the */ /* collector. */ /* These are grouped together in a struct */ /* so that they can be easily skipped by the */ /* GC_mark routine. */ /* The ordering is weird to make GC_malloc */ /* faster by keeping the important fields */ /* sufficiently close together that a */ /* single load of a base register will do. */ /* Scalars that could easily appear to */ /* be pointers are also put here. */ /* The main fields should precede any */ /* conditionally included fields, so that */ /* gc_inl.h will work even if a different set */ /* of macros is defined when the client is */ /* compiled. */ struct _GC_arrays { word _heapsize; /* Heap size in bytes. */ word _max_heapsize; word _requested_heapsize; /* Heap size due to explicit expansion */ ptr_t _last_heap_addr; ptr_t _prev_heap_addr; word _large_free_bytes; /* Total bytes contained in blocks on large object free */ /* list. */ word _large_allocd_bytes; /* Total number of bytes in allocated large objects blocks. */ /* For the purposes of this counter and the next one only, a */ /* large object is one that occupies a block of at least */ /* 2*HBLKSIZE. */ word _max_large_allocd_bytes; /* Maximum number of bytes that were ever allocated in */ /* large object blocks. This is used to help decide when it */ /* is safe to split up a large block. */ word _bytes_allocd_before_gc; /* Number of words allocated before this */ /* collection cycle. */ # ifndef SEPARATE_GLOBALS word _bytes_allocd; /* Number of words allocated during this collection cycle */ # endif word _bytes_finalized; /* Approximate number of bytes in objects (and headers) */ /* That became ready for finalization in the last */ /* collection. */ word _non_gc_bytes_at_gc; /* Number of explicitly managed bytes of storage */ /* at last collection. */ word _bytes_freed; /* Number of explicitly deallocated bytes of memory */ /* since last collection. */ word _finalizer_bytes_freed; /* Bytes of memory explicitly deallocated while */ /* finalizers were running. Used to approximate mem. */ /* explicitly deallocated by finalizers. */ ptr_t _scratch_end_ptr; ptr_t _scratch_last_end_ptr; /* Used by headers.c, and can easily appear to point to */ /* heap. */ GC_mark_proc _mark_procs[MAX_MARK_PROCS]; /* Table of user-defined mark procedures. There is */ /* a small number of these, which can be referenced */ /* by DS_PROC mark descriptors. See gc_mark.h. */ # ifndef SEPARATE_GLOBALS void *_objfreelist[MAXOBJGRANULES+1]; /* free list for objects */ void *_aobjfreelist[MAXOBJGRANULES+1]; /* free list for atomic objs */ # endif void *_uobjfreelist[MAXOBJGRANULES+1]; /* uncollectable but traced objs */ /* objects on this and auobjfreelist */ /* are always marked, except during */ /* garbage collections. */ # ifdef ATOMIC_UNCOLLECTABLE void *_auobjfreelist[MAXOBJGRANULES+1]; # endif /* uncollectable but traced objs */ word _composite_in_use; /* Number of words in accessible composite */ /* objects. */ word _atomic_in_use; /* Number of words in accessible atomic */ /* objects. */ # ifdef USE_MUNMAP word _unmapped_bytes; # endif size_t _size_map[MAXOBJBYTES+1]; /* Number of words to allocate for a given allocation request in */ /* bytes. */ # ifdef STUBBORN_ALLOC ptr_t _sobjfreelist[MAXOBJGRANULES+1]; # endif /* free list for immutable objects */ # ifdef MARK_BIT_PER_GRANULE short * _obj_map[MAXOBJGRANULES+1]; /* If not NIL, then a pointer to a map of valid */ /* object addresses. */ /* _obj_map[sz_in_granules][i] is */ /* i % sz_in_granules. */ /* This is now used purely to replace a */ /* division in the marker by a table lookup. */ /* _obj_map[0] is used for large objects and */ /* contains all nonzero entries. This gets us */ /* out of the marker fast path without an extra */ /* test. */ # define MAP_LEN BYTES_TO_GRANULES(HBLKSIZE) # endif # define VALID_OFFSET_SZ HBLKSIZE char _valid_offsets[VALID_OFFSET_SZ]; /* GC_valid_offsets[i] == TRUE ==> i */ /* is registered as a displacement. */ char _modws_valid_offsets[sizeof(word)]; /* GC_valid_offsets[i] ==> */ /* GC_modws_valid_offsets[i%sizeof(word)] */ # ifdef STUBBORN_ALLOC page_hash_table _changed_pages; /* Stubborn object pages that were changes since last call to */ /* GC_read_changed. */ page_hash_table _prev_changed_pages; /* Stubborn object pages that were changes before last call to */ /* GC_read_changed. */ # endif # if defined(PROC_VDB) || defined(MPROTECT_VDB) || \ defined(GWW_VDB) || defined(MANUAL_VDB) page_hash_table _grungy_pages; /* Pages that were dirty at last */ /* GC_read_dirty. */ # endif # if defined(MPROTECT_VDB) || defined(MANUAL_VDB) volatile page_hash_table _dirty_pages; /* Pages dirtied since last GC_read_dirty. */ # endif # if defined(PROC_VDB) || defined(GWW_VDB) page_hash_table _written_pages; /* Pages ever dirtied */ # endif # ifdef LARGE_CONFIG # if CPP_WORDSZ > 32 # define MAX_HEAP_SECTS 4096 /* overflows at roughly 64 GB */ # else # define MAX_HEAP_SECTS 768 /* Separately added heap sections. */ # endif # else # ifdef SMALL_CONFIG # define MAX_HEAP_SECTS 128 /* Roughly 256MB (128*2048*1K) */ # else # define MAX_HEAP_SECTS 384 /* Roughly 3GB */ # endif # endif struct HeapSect { ptr_t hs_start; size_t hs_bytes; } _heap_sects[MAX_HEAP_SECTS]; # if defined(MSWIN32) || defined(MSWINCE) ptr_t _heap_bases[MAX_HEAP_SECTS]; /* Start address of memory regions obtained from kernel. */ # endif # ifdef MSWINCE word _heap_lengths[MAX_HEAP_SECTS]; /* Commited lengths of memory regions obtained from kernel. */ # endif struct roots _static_roots[MAX_ROOT_SETS]; # if !defined(MSWIN32) && !defined(MSWINCE) struct roots * _root_index[RT_SIZE]; # endif struct exclusion _excl_table[MAX_EXCLUSIONS]; /* Block header index; see gc_headers.h */ bottom_index * _all_nils; bottom_index * _top_index [TOP_SZ]; #ifdef ENABLE_TRACE ptr_t _trace_addr; #endif #ifdef SAVE_CALL_CHAIN struct callinfo _last_stack[NFRAMES]; /* Stack at last garbage collection.*/ /* Useful for debugging mysterious */ /* object disappearances. */ /* In the multithreaded case, we */ /* currently only save the calling */ /* stack. */ #endif }; GC_API GC_FAR struct _GC_arrays GC_arrays; # ifndef SEPARATE_GLOBALS # define GC_objfreelist GC_arrays._objfreelist # define GC_aobjfreelist GC_arrays._aobjfreelist # define GC_bytes_allocd GC_arrays._bytes_allocd # endif # define GC_uobjfreelist GC_arrays._uobjfreelist # ifdef ATOMIC_UNCOLLECTABLE # define GC_auobjfreelist GC_arrays._auobjfreelist # endif # define GC_sobjfreelist GC_arrays._sobjfreelist # define GC_valid_offsets GC_arrays._valid_offsets # define GC_modws_valid_offsets GC_arrays._modws_valid_offsets # ifdef STUBBORN_ALLOC # define GC_changed_pages GC_arrays._changed_pages # define GC_prev_changed_pages GC_arrays._prev_changed_pages # endif # ifdef MARK_BIT_PER_GRANULE # define GC_obj_map GC_arrays._obj_map # endif # define GC_last_heap_addr GC_arrays._last_heap_addr # define GC_prev_heap_addr GC_arrays._prev_heap_addr # define GC_large_free_bytes GC_arrays._large_free_bytes # define GC_large_allocd_bytes GC_arrays._large_allocd_bytes # define GC_max_large_allocd_bytes GC_arrays._max_large_allocd_bytes # define GC_bytes_finalized GC_arrays._bytes_finalized # define GC_non_gc_bytes_at_gc GC_arrays._non_gc_bytes_at_gc # define GC_bytes_freed GC_arrays._bytes_freed # define GC_finalizer_bytes_freed GC_arrays._finalizer_bytes_freed # define GC_scratch_end_ptr GC_arrays._scratch_end_ptr # define GC_scratch_last_end_ptr GC_arrays._scratch_last_end_ptr # define GC_mark_procs GC_arrays._mark_procs # define GC_heapsize GC_arrays._heapsize # define GC_max_heapsize GC_arrays._max_heapsize # define GC_requested_heapsize GC_arrays._requested_heapsize # define GC_bytes_allocd_before_gc GC_arrays._bytes_allocd_before_gc # define GC_heap_sects GC_arrays._heap_sects # define GC_last_stack GC_arrays._last_stack #ifdef ENABLE_TRACE #define GC_trace_addr GC_arrays._trace_addr #endif # ifdef USE_MUNMAP # define GC_unmapped_bytes GC_arrays._unmapped_bytes # endif # if defined(MSWIN32) || defined(MSWINCE) # define GC_heap_bases GC_arrays._heap_bases # endif # ifdef MSWINCE # define GC_heap_lengths GC_arrays._heap_lengths # endif # define GC_static_roots GC_arrays._static_roots # define GC_root_index GC_arrays._root_index # define GC_excl_table GC_arrays._excl_table # define GC_all_nils GC_arrays._all_nils # define GC_top_index GC_arrays._top_index # if defined(PROC_VDB) || defined(MPROTECT_VDB) || \ defined(GWW_VDB) || defined(MANUAL_VDB) # define GC_grungy_pages GC_arrays._grungy_pages # endif # if defined(MPROTECT_VDB) || defined(MANUAL_VDB) # define GC_dirty_pages GC_arrays._dirty_pages # endif # if defined(PROC_VDB) || defined(GWW_VDB) # define GC_written_pages GC_arrays._written_pages # endif # define GC_composite_in_use GC_arrays._composite_in_use # define GC_atomic_in_use GC_arrays._atomic_in_use # define GC_size_map GC_arrays._size_map # define beginGC_arrays ((ptr_t)(&GC_arrays)) # define endGC_arrays (((ptr_t)(&GC_arrays)) + (sizeof GC_arrays)) #define USED_HEAP_SIZE (GC_heapsize - GC_large_free_bytes) /* Object kinds: */ # define MAXOBJKINDS 16 extern struct obj_kind { void **ok_freelist; /* Array of free listheaders for this kind of object */ /* Point either to GC_arrays or to storage allocated */ /* with GC_scratch_alloc. */ struct hblk **ok_reclaim_list; /* List headers for lists of blocks waiting to be */ /* swept. */ /* Indexed by object size in granules. */ word ok_descriptor; /* Descriptor template for objects in this */ /* block. */ GC_bool ok_relocate_descr; /* Add object size in bytes to descriptor */ /* template to obtain descriptor. Otherwise */ /* template is used as is. */ GC_bool ok_init; /* Clear objects before putting them on the free list. */ } GC_obj_kinds[MAXOBJKINDS]; # define beginGC_obj_kinds ((ptr_t)(&GC_obj_kinds)) # define endGC_obj_kinds (beginGC_obj_kinds + (sizeof GC_obj_kinds)) /* Variables that used to be in GC_arrays, but need to be accessed by */ /* inline allocation code. If they were in GC_arrays, the inlined */ /* allocation code would include GC_arrays offsets (as it did), which */ /* introduce maintenance problems. */ #ifdef SEPARATE_GLOBALS word GC_bytes_allocd; /* Number of words allocated during this collection cycle */ ptr_t GC_objfreelist[MAXOBJGRANULES+1]; /* free list for NORMAL objects */ # define beginGC_objfreelist ((ptr_t)(&GC_objfreelist)) # define endGC_objfreelist (beginGC_objfreelist + sizeof(GC_objfreelist)) ptr_t GC_aobjfreelist[MAXOBJGRANULES+1]; /* free list for atomic (PTRFREE) objs */ # define beginGC_aobjfreelist ((ptr_t)(&GC_aobjfreelist)) # define endGC_aobjfreelist (beginGC_aobjfreelist + sizeof(GC_aobjfreelist)) #endif /* Predefined kinds: */ # define PTRFREE 0 # define NORMAL 1 # define UNCOLLECTABLE 2 # ifdef ATOMIC_UNCOLLECTABLE # define AUNCOLLECTABLE 3 # define STUBBORN 4 # define IS_UNCOLLECTABLE(k) (((k) & ~1) == UNCOLLECTABLE) # else # define STUBBORN 3 # define IS_UNCOLLECTABLE(k) ((k) == UNCOLLECTABLE) # endif extern unsigned GC_n_kinds; GC_API word GC_fo_entries; extern word GC_n_heap_sects; /* Number of separately added heap */ /* sections. */ extern word GC_page_size; # if defined(MSWIN32) || defined(MSWINCE) struct _SYSTEM_INFO; extern struct _SYSTEM_INFO GC_sysinfo; extern word GC_n_heap_bases; /* See GC_heap_bases. */ # endif extern word GC_total_stack_black_listed; /* Number of bytes on stack blacklist. */ extern word GC_black_list_spacing; /* Average number of bytes between blacklisted */ /* blocks. Approximate. */ /* Counts only blocks that are */ /* "stack-blacklisted", i.e. that are */ /* problematic in the interior of an object. */ extern struct hblk * GC_hblkfreelist[]; /* List of completely empty heap blocks */ /* Linked through hb_next field of */ /* header structure associated with */ /* block. */ extern GC_bool GC_objects_are_marked; /* There are marked objects in */ /* the heap. */ #ifndef SMALL_CONFIG extern GC_bool GC_incremental; /* Using incremental/generational collection. */ # define TRUE_INCREMENTAL \ (GC_incremental && GC_time_limit != GC_TIME_UNLIMITED) /* True incremental, not just generational, mode */ #else # define GC_incremental FALSE /* Hopefully allow optimizer to remove some code. */ # define TRUE_INCREMENTAL FALSE #endif extern GC_bool GC_dirty_maintained; /* Dirty bits are being maintained, */ /* either for incremental collection, */ /* or to limit the root set. */ extern word GC_root_size; /* Total size of registered root sections */ extern GC_bool GC_debugging_started; /* GC_debug_malloc has been called. */ extern long GC_large_alloc_warn_interval; /* Interval between unsuppressed warnings. */ extern long GC_large_alloc_warn_suppressed; /* Number of warnings suppressed so far. */ #ifdef THREADS extern GC_bool GC_world_stopped; #endif /* Operations */ # ifndef abs # define abs(x) ((x) < 0? (-(x)) : (x)) # endif /* Marks are in a reserved area in */ /* each heap block. Each word has one mark bit associated */ /* with it. Only those corresponding to the beginning of an */ /* object are used. */ /* Set mark bit correctly, even if mark bits may be concurrently */ /* accessed. */ #ifdef PARALLEL_MARK # define OR_WORD(addr, bits) \ { AO_or((volatile AO_t *)(addr), (AO_t)bits); } #else # define OR_WORD(addr, bits) *(addr) |= (bits) #endif /* Mark bit operations */ /* * Retrieve, set, clear the nth mark bit in a given heap block. * * (Recall that bit n corresponds to nth object or allocation granule * relative to the beginning of the block, including unused words) */ #ifdef USE_MARK_BYTES # define mark_bit_from_hdr(hhdr,n) ((hhdr)->hb_marks[n]) # define set_mark_bit_from_hdr(hhdr,n) ((hhdr)->hb_marks[n]) = 1 # define clear_mark_bit_from_hdr(hhdr,n) ((hhdr)->hb_marks[n]) = 0 #else /* !USE_MARK_BYTES */ # define mark_bit_from_hdr(hhdr,n) (((hhdr)->hb_marks[divWORDSZ(n)] \ >> (modWORDSZ(n))) & (word)1) # define set_mark_bit_from_hdr(hhdr,n) \ OR_WORD((hhdr)->hb_marks+divWORDSZ(n), \ (word)1 << modWORDSZ(n)) # define clear_mark_bit_from_hdr(hhdr,n) (hhdr)->hb_marks[divWORDSZ(n)] \ &= ~((word)1 << modWORDSZ(n)) #endif /* !USE_MARK_BYTES */ #ifdef MARK_BIT_PER_OBJ # define MARK_BIT_NO(offset, sz) (((unsigned)(offset))/(sz)) /* Get the mark bit index corresponding to the given byte */ /* offset and size (in bytes). */ # define MARK_BIT_OFFSET(sz) 1 /* Spacing between useful mark bits. */ # define IF_PER_OBJ(x) x # define FINAL_MARK_BIT(sz) ((sz) > MAXOBJBYTES? 1 : HBLK_OBJS(sz)) /* Position of final, always set, mark bit. */ #else /* MARK_BIT_PER_GRANULE */ # define MARK_BIT_NO(offset, sz) BYTES_TO_GRANULES((unsigned)(offset)) # define MARK_BIT_OFFSET(sz) BYTES_TO_GRANULES(sz) # define IF_PER_OBJ(x) # define FINAL_MARK_BIT(sz) \ ((sz) > MAXOBJBYTES? MARK_BITS_PER_HBLK \ : BYTES_TO_GRANULES(sz * HBLK_OBJS(sz))) #endif /* Important internal collector routines */ ptr_t GC_approx_sp(void); GC_bool GC_should_collect(void); void GC_apply_to_all_blocks(void (*fn) (struct hblk *h, word client_data), word client_data); /* Invoke fn(hbp, client_data) for each */ /* allocated heap block. */ struct hblk * GC_next_used_block(struct hblk * h); /* Return first in-use block >= h */ struct hblk * GC_prev_block(struct hblk * h); /* Return last block <= h. Returned block */ /* is managed by GC, but may or may not be in */ /* use. */ void GC_mark_init(void); void GC_clear_marks(void); /* Clear mark bits for all heap objects. */ void GC_invalidate_mark_state(void); /* Tell the marker that marked */ /* objects may point to unmarked */ /* ones, and roots may point to */ /* unmarked objects. */ /* Reset mark stack. */ GC_bool GC_mark_stack_empty(void); GC_bool GC_mark_some(ptr_t cold_gc_frame); /* Perform about one pages worth of marking */ /* work of whatever kind is needed. Returns */ /* quickly if no collection is in progress. */ /* Return TRUE if mark phase finished. */ void GC_initiate_gc(void); /* initiate collection. */ /* If the mark state is invalid, this */ /* becomes full colleection. Otherwise */ /* it's partial. */ void GC_push_all(ptr_t bottom, ptr_t top); /* Push everything in a range */ /* onto mark stack. */ void GC_push_selected(ptr_t bottom, ptr_t top, int (*dirty_fn) (struct hblk *h), void (*push_fn) (ptr_t bottom, ptr_t top) ); /* Push all pages h in [b,t) s.t. */ /* select_fn(h) != 0 onto mark stack. */ #ifndef SMALL_CONFIG void GC_push_conditional (ptr_t b, ptr_t t, GC_bool all); #else # define GC_push_conditional(b, t, all) GC_push_all(b, t) #endif /* Do either of the above, depending */ /* on the third arg. */ void GC_push_all_stack (ptr_t b, ptr_t t); /* As above, but consider */ /* interior pointers as valid */ void GC_push_all_eager (ptr_t b, ptr_t t); /* Same as GC_push_all_stack, but */ /* ensures that stack is scanned */ /* immediately, not just scheduled */ /* for scanning. */ #ifndef THREADS void GC_push_all_stack_partially_eager(ptr_t bottom, ptr_t top, ptr_t cold_gc_frame); /* Similar to GC_push_all_eager, but only the */ /* part hotter than cold_gc_frame is scanned */ /* immediately. Needed to ensure that callee- */ /* save registers are not missed. */ #else /* In the threads case, we push part of the current thread stack */ /* with GC_push_all_eager when we push the registers. This gets the */ /* callee-save registers that may disappear. The remainder of the */ /* stacks are scheduled for scanning in *GC_push_other_roots, which */ /* is thread-package-specific. */ #endif void GC_push_current_stack(ptr_t cold_gc_frame, void *context); /* Push enough of the current stack eagerly to */ /* ensure that callee-save registers saved in */ /* GC frames are scanned. */ /* In the non-threads case, schedule entire */ /* stack for scanning. */ /* The second argument is a pointer to the */ /* (possibly null) thread context, for */ /* (currently hypothetical) more precise */ /* stack scanning. */ void GC_push_roots(GC_bool all, ptr_t cold_gc_frame); /* Push all or dirty roots. */ extern void (*GC_push_other_roots)(void); /* Push system or application specific roots */ /* onto the mark stack. In some environments */ /* (e.g. threads environments) this is */ /* predfined to be non-zero. A client supplied */ /* replacement should also call the original */ /* function. */ extern void GC_push_gc_structures(void); /* Push GC internal roots. These are normally */ /* included in the static data segment, and */ /* Thus implicitly pushed. But we must do this */ /* explicitly if normal root processing is */ /* disabled. Calls the following: */ extern void GC_push_finalizer_structures(void); extern void GC_push_stubborn_structures (void); # ifdef THREADS extern void GC_push_thread_structures (void); # endif extern void (*GC_start_call_back) (void); /* Called at start of full collections. */ /* Not called if 0. Called with allocation */ /* lock held. */ /* 0 by default. */ void GC_push_regs_and_stack(ptr_t cold_gc_frame); void GC_push_regs(void); void GC_with_callee_saves_pushed(void (*fn)(ptr_t, void *), ptr_t arg); # if defined(SPARC) || defined(IA64) /* Cause all stacked registers to be saved in memory. Return a */ /* pointer to the top of the corresponding memory stack. */ ptr_t GC_save_regs_in_stack(void); # endif /* Push register contents onto mark stack. */ /* If NURSERY is defined, the default push */ /* action can be overridden with GC_push_proc */ # ifdef NURSERY extern void (*GC_push_proc)(ptr_t); # endif # if defined(MSWIN32) || defined(MSWINCE) void __cdecl GC_push_one(word p); # else void GC_push_one(word p); /* If p points to an object, mark it */ /* and push contents on the mark stack */ /* Pointer recognition test always */ /* accepts interior pointers, i.e. this */ /* is appropriate for pointers found on */ /* stack. */ # endif # if defined(PRINT_BLACK_LIST) || defined(KEEP_BACK_PTRS) void GC_mark_and_push_stack(ptr_t p, ptr_t source); /* Ditto, omits plausibility test */ # else void GC_mark_and_push_stack(ptr_t p); # endif void GC_push_marked(struct hblk * h, hdr * hhdr); /* Push contents of all marked objects in h onto */ /* mark stack. */ #ifdef SMALL_CONFIG # define GC_push_next_marked_dirty(h) GC_push_next_marked(h) #else struct hblk * GC_push_next_marked_dirty(struct hblk * h); /* Invoke GC_push_marked on next dirty block above h. */ /* Return a pointer just past the end of this block. */ #endif /* !SMALL_CONFIG */ struct hblk * GC_push_next_marked(struct hblk * h); /* Ditto, but also mark from clean pages. */ struct hblk * GC_push_next_marked_uncollectable(struct hblk * h); /* Ditto, but mark only from uncollectable pages. */ GC_bool GC_stopped_mark(GC_stop_func stop_func); /* Stop world and mark from all roots */ /* and rescuers. */ void GC_clear_hdr_marks(hdr * hhdr); /* Clear the mark bits in a header */ void GC_set_hdr_marks(hdr * hhdr); /* Set the mark bits in a header */ void GC_set_fl_marks(ptr_t p); /* Set all mark bits associated with */ /* a free list. */ #ifdef GC_ASSERTIONS void GC_check_fl_marks(ptr_t p); /* Check that all mark bits */ /* associated with a free list are */ /* set. Abort if not. */ #endif void GC_add_roots_inner(ptr_t b, ptr_t e, GC_bool tmp); void GC_remove_roots_inner(ptr_t b, ptr_t e); GC_bool GC_is_static_root(ptr_t p); /* Is the address p in one of the registered static */ /* root sections? */ # if defined(MSWIN32) || defined(_WIN32_WCE_EMULATION) GC_bool GC_is_tmp_root(ptr_t p); /* Is the address p in one of the temporary static */ /* root sections? */ # endif void GC_register_dynamic_libraries(void); /* Add dynamic library data sections to the root set. */ void GC_cond_register_dynamic_libraries(void); /* Remove and reregister dynamic libraries if we're */ /* configured to do that at each GC. */ GC_bool GC_register_main_static_data(void); /* We need to register the main data segment. Returns */ /* TRUE unless this is done implicitly as part of */ /* dynamic library registration. */ /* Machine dependent startup routines */ ptr_t GC_get_main_stack_base(void); /* Cold end of stack */ #ifdef IA64 ptr_t GC_get_register_stack_base(void); /* Cold end of register stack. */ #endif void GC_register_data_segments(void); /* Black listing: */ void GC_bl_init(void); # ifdef PRINT_BLACK_LIST void GC_add_to_black_list_normal(word p, ptr_t source); /* Register bits as a possible future false */ /* reference from the heap or static data */ # define GC_ADD_TO_BLACK_LIST_NORMAL(bits, source) \ if (GC_all_interior_pointers) { \ GC_add_to_black_list_stack((word)(bits), (source)); \ } else { \ GC_add_to_black_list_normal((word)(bits), (source)); \ } # else void GC_add_to_black_list_normal(word p); # define GC_ADD_TO_BLACK_LIST_NORMAL(bits, source) \ if (GC_all_interior_pointers) { \ GC_add_to_black_list_stack((word)(bits)); \ } else { \ GC_add_to_black_list_normal((word)(bits)); \ } # endif # ifdef PRINT_BLACK_LIST void GC_add_to_black_list_stack(word p, ptr_t source); # define GC_ADD_TO_BLACK_LIST_STACK(bits, source) \ GC_add_to_black_list_stack((word)(bits), (source)) # else void GC_add_to_black_list_stack(word p); # define GC_ADD_TO_BLACK_LIST_STACK(bits, source) \ GC_add_to_black_list_stack((word)(bits)) # endif struct hblk * GC_is_black_listed(struct hblk * h, word len); /* If there are likely to be false references */ /* to a block starting at h of the indicated */ /* length, then return the next plausible */ /* starting location for h that might avoid */ /* these false references. */ void GC_promote_black_lists(void); /* Declare an end to a black listing phase. */ void GC_unpromote_black_lists(void); /* Approximately undo the effect of the above. */ /* This actually loses some information, but */ /* only in a reasonably safe way. */ word GC_number_stack_black_listed(struct hblk *start, struct hblk *endp1); /* Return the number of (stack) blacklisted */ /* blocks in the range for statistical */ /* purposes. */ ptr_t GC_scratch_alloc(size_t bytes); /* GC internal memory allocation for */ /* small objects. Deallocation is not */ /* possible. */ /* Heap block layout maps: */ GC_bool GC_add_map_entry(size_t sz); /* Add a heap block map for objects of */ /* size sz to obj_map. */ /* Return FALSE on failure. */ void GC_register_displacement_inner(size_t offset); /* Version of GC_register_displacement */ /* that assumes lock is already held */ /* and signals are already disabled. */ void GC_initialize_offsets(void); /* Initialize GC_valid_offsets, */ /* depending on current */ /* GC_all_interior_pointers settings. */ /* hblk allocation: */ void GC_new_hblk(size_t size_in_granules, int kind); /* Allocate a new heap block, and build */ /* a free list in it. */ ptr_t GC_build_fl(struct hblk *h, size_t words, GC_bool clear, ptr_t list); /* Build a free list for objects of */ /* size sz in block h. Append list to */ /* end of the free lists. Possibly */ /* clear objects on the list. Normally */ /* called by GC_new_hblk, but also */ /* called explicitly without GC lock. */ struct hblk * GC_allochblk (size_t size_in_bytes, int kind, unsigned flags); /* Allocate a heap block, inform */ /* the marker that block is valid */ /* for objects of indicated size. */ ptr_t GC_alloc_large (size_t lb, int k, unsigned flags); /* Allocate a large block of size lb bytes. */ /* The block is not cleared. */ /* Flags is 0 or IGNORE_OFF_PAGE. */ /* Calls GC_allchblk to do the actual */ /* allocation, but also triggers GC and/or */ /* heap expansion as appropriate. */ /* Does not update GC_bytes_allocd, but does */ /* other accounting. */ ptr_t GC_alloc_large_and_clear(size_t lb, int k, unsigned flags); /* As above, but clear block if appropriate */ /* for kind k. */ void GC_freehblk(struct hblk * p); /* Deallocate a heap block and mark it */ /* as invalid. */ /* Misc GC: */ void GC_init_inner(void); GC_bool GC_expand_hp_inner(word n); void GC_start_reclaim(int abort_if_found); /* Restore unmarked objects to free */ /* lists, or (if abort_if_found is */ /* TRUE) report them. */ /* Sweeping of small object pages is */ /* largely deferred. */ void GC_continue_reclaim(size_t sz, int kind); /* Sweep pages of the given size and */ /* kind, as long as possible, and */ /* as long as the corr. free list is */ /* empty. Sz is in granules. */ void GC_reclaim_or_delete_all(void); /* Arrange for all reclaim lists to be */ /* empty. Judiciously choose between */ /* sweeping and discarding each page. */ GC_bool GC_reclaim_all(GC_stop_func stop_func, GC_bool ignore_old); /* Reclaim all blocks. Abort (in a */ /* consistent state) if f returns TRUE. */ ptr_t GC_reclaim_generic(struct hblk * hbp, hdr *hhdr, size_t sz, GC_bool init, ptr_t list, signed_word *count); /* Rebuild free list in hbp with */ /* header hhdr, with objects of size sz */ /* bytes. Add list to the end of the */ /* free list. Add the number of */ /* reclaimed bytes to *count. */ GC_bool GC_block_empty(hdr * hhdr); /* Block completely unmarked? */ GC_bool GC_never_stop_func(void); /* Returns FALSE. */ GC_bool GC_try_to_collect_inner(GC_stop_func f); /* Collect; caller must have acquired */ /* lock and disabled signals. */ /* Collection is aborted if f returns */ /* TRUE. Returns TRUE if it completes */ /* successfully. */ # define GC_gcollect_inner() \ (void) GC_try_to_collect_inner(GC_never_stop_func) void GC_finish_collection(void); /* Finish collection. Mark bits are */ /* consistent and lock is still held. */ GC_bool GC_collect_or_expand(word needed_blocks, GC_bool ignore_off_page); /* Collect or expand heap in an attempt */ /* make the indicated number of free */ /* blocks available. Should be called */ /* until the blocks are available or */ /* until it fails by returning FALSE. */ extern GC_bool GC_is_initialized; /* GC_init() has been run. */ #if defined(MSWIN32) || defined(MSWINCE) void GC_deinit(void); /* Free any resources allocated by */ /* GC_init */ #endif void GC_collect_a_little_inner(int n); /* Do n units worth of garbage */ /* collection work, if appropriate. */ /* A unit is an amount appropriate for */ /* HBLKSIZE bytes of allocation. */ /* void * GC_generic_malloc(size_t lb, int k); */ /* Allocate an object of the given */ /* kind. By default, there are only */ /* a few kinds: composite(pointerfree), */ /* atomic, uncollectable, etc. */ /* We claim it's possible for clever */ /* client code that understands GC */ /* internals to add more, e.g. to */ /* communicate object layout info */ /* to the collector. */ /* The actual decl is in gc_mark.h. */ void * GC_generic_malloc_ignore_off_page(size_t b, int k); /* As above, but pointers past the */ /* first page of the resulting object */ /* are ignored. */ void * GC_generic_malloc_inner(size_t lb, int k); /* Ditto, but I already hold lock, etc. */ void * GC_generic_malloc_inner_ignore_off_page(size_t lb, int k); /* Allocate an object, where */ /* the client guarantees that there */ /* will always be a pointer to the */ /* beginning of the object while the */ /* object is live. */ void GC_generic_malloc_many(size_t lb, int k, void **result); /* Store a pointer to a list of newly */ /* allocated objects of kind k and size */ /* lb in *result. */ /* Caler must make sure that *result is */ /* traced even if objects are ptrfree. */ ptr_t GC_allocobj(size_t sz, int kind); /* Make the indicated */ /* free list nonempty, and return its */ /* head. Sz is in granules. */ /* Allocation routines that bypass the thread local cache. */ /* Used internally. */ #ifdef THREAD_LOCAL_ALLOC void * GC_core_malloc(size_t); void * GC_core_malloc_atomic(size_t); # ifdef GC_GCJ_SUPPORT void *GC_core_gcj_malloc(size_t, void *); # endif #endif /* THREAD_LOCAL_ALLOC */ void GC_free_inner(void * p); void GC_debug_free_inner(void * p); void GC_init_headers(void); struct hblkhdr * GC_install_header(struct hblk *h); /* Install a header for block h. */ /* Return 0 on failure, or the header */ /* otherwise. */ GC_bool GC_install_counts(struct hblk * h, size_t sz); /* Set up forwarding counts for block */ /* h of size sz. */ /* Return FALSE on failure. */ void GC_remove_header(struct hblk * h); /* Remove the header for block h. */ void GC_remove_counts(struct hblk * h, size_t sz); /* Remove forwarding counts for h. */ hdr * GC_find_header(ptr_t h); /* Debugging only. */ void GC_finalize(void); /* Perform all indicated finalization actions */ /* on unmarked objects. */ /* Unreachable finalizable objects are enqueued */ /* for processing by GC_invoke_finalizers. */ /* Invoked with lock. */ void GC_notify_or_invoke_finalizers(void); /* If GC_finalize_on_demand is not set, invoke */ /* eligible finalizers. Otherwise: */ /* Call *GC_finalizer_notifier if there are */ /* finalizers to be run, and we haven't called */ /* this procedure yet this GC cycle. */ GC_API void * GC_make_closure(GC_finalization_proc fn, void * data); GC_API void GC_debug_invoke_finalizer(void * obj, void * data); /* Auxiliary fns to make finalization work */ /* correctly with displaced pointers introduced */ /* by the debugging allocators. */ void GC_add_to_heap(struct hblk *p, size_t bytes); /* Add a HBLKSIZE aligned chunk to the heap. */ void GC_print_obj(ptr_t p); /* P points to somewhere inside an object with */ /* debugging info. Print a human readable */ /* description of the object to stderr. */ extern void (*GC_check_heap)(void); /* Check that all objects in the heap with */ /* debugging info are intact. */ /* Add any that are not to GC_smashed list. */ extern void (*GC_print_all_smashed) (void); /* Print GC_smashed if it's not empty. */ /* Clear GC_smashed list. */ extern void GC_print_all_errors (void); /* Print smashed and leaked objects, if any. */ /* Clear the lists of such objects. */ extern void (*GC_print_heap_obj) (ptr_t p); /* If possible print s followed by a more */ /* detailed description of the object */ /* referred to by p. */ #if defined(LINUX) && defined(__ELF__) && !defined(SMALL_CONFIG) void GC_print_address_map (void); /* Print an address map of the process. */ #endif extern GC_bool GC_have_errors; /* We saw a smashed or leaked object. */ /* Call error printing routine */ /* occasionally. */ #ifndef SMALL_CONFIG extern int GC_print_stats; /* Nonzero generates basic GC log. */ /* VERBOSE generates add'l messages. */ #else # define GC_print_stats 0 /* Will this keep the message character strings from the executable? */ /* It should ... */ #endif #define VERBOSE 2 #ifndef NO_DEBUGGING extern GC_bool GC_dump_regularly; /* Generate regular debugging dumps. */ # define COND_DUMP if (GC_dump_regularly) GC_dump(); #else # define COND_DUMP #endif #ifdef KEEP_BACK_PTRS extern long GC_backtraces; void GC_generate_random_backtrace_no_gc(void); #endif extern GC_bool GC_print_back_height; #ifdef MAKE_BACK_GRAPH void GC_print_back_graph_stats(void); #endif /* Macros used for collector internal allocation. */ /* These assume the collector lock is held. */ #ifdef DBG_HDRS_ALL extern void * GC_debug_generic_malloc_inner(size_t lb, int k); extern void * GC_debug_generic_malloc_inner_ignore_off_page(size_t lb, int k); # define GC_INTERNAL_MALLOC GC_debug_generic_malloc_inner # define GC_INTERNAL_MALLOC_IGNORE_OFF_PAGE \ GC_debug_generic_malloc_inner_ignore_off_page # ifdef THREADS # define GC_INTERNAL_FREE GC_debug_free_inner # else # define GC_INTERNAL_FREE GC_debug_free # endif #else # define GC_INTERNAL_MALLOC GC_generic_malloc_inner # define GC_INTERNAL_MALLOC_IGNORE_OFF_PAGE \ GC_generic_malloc_inner_ignore_off_page # ifdef THREADS # define GC_INTERNAL_FREE GC_free_inner # else # define GC_INTERNAL_FREE GC_free # endif #endif /* Memory unmapping: */ #ifdef USE_MUNMAP void GC_unmap_old(void); void GC_merge_unmapped(void); void GC_unmap(ptr_t start, size_t bytes); void GC_remap(ptr_t start, size_t bytes); void GC_unmap_gap(ptr_t start1, size_t bytes1, ptr_t start2, size_t bytes2); #endif /* Virtual dirty bit implementation: */ /* Each implementation exports the following: */ void GC_read_dirty(void); /* Retrieve dirty bits. */ GC_bool GC_page_was_dirty(struct hblk *h); /* Read retrieved dirty bits. */ GC_bool GC_page_was_ever_dirty(struct hblk *h); /* Could the page contain valid heap pointers? */ void GC_remove_protection(struct hblk *h, word nblocks, GC_bool pointerfree); /* h is about to be writteni or allocated. Ensure */ /* that it's not write protected by the virtual */ /* dirty bit implementation. */ void GC_dirty_init(void); /* Slow/general mark bit manipulation: */ GC_API GC_bool GC_is_marked(ptr_t p); void GC_clear_mark_bit(ptr_t p); void GC_set_mark_bit(ptr_t p); /* Stubborn objects: */ void GC_read_changed(void); /* Analogous to GC_read_dirty */ GC_bool GC_page_was_changed(struct hblk * h); /* Analogous to GC_page_was_dirty */ void GC_clean_changing_list(void); /* Collect obsolete changing list entries */ void GC_stubborn_init(void); /* Debugging print routines: */ void GC_print_block_list(void); void GC_print_hblkfreelist(void); void GC_print_heap_sects(void); void GC_print_static_roots(void); void GC_print_finalization_stats(void); /* void GC_dump(void); - declared in gc.h */ #ifdef KEEP_BACK_PTRS void GC_store_back_pointer(ptr_t source, ptr_t dest); void GC_marked_for_finalization(ptr_t dest); # define GC_STORE_BACK_PTR(source, dest) GC_store_back_pointer(source, dest) # define GC_MARKED_FOR_FINALIZATION(dest) GC_marked_for_finalization(dest) #else # define GC_STORE_BACK_PTR(source, dest) # define GC_MARKED_FOR_FINALIZATION(dest) #endif /* Make arguments appear live to compiler */ # ifdef __WATCOMC__ void GC_noop(void*, ...); # else # ifdef __DMC__ GC_API void GC_noop(...); # else GC_API void GC_noop(); # endif # endif void GC_noop1(word); /* Logging and diagnostic output: */ GC_API void GC_printf (const char * format, ...); /* A version of printf that doesn't allocate, */ /* 1K total output length. */ /* (We use sprintf. Hopefully that doesn't */ /* allocate for long arguments.) */ GC_API void GC_err_printf(const char * format, ...); GC_API void GC_log_printf(const char * format, ...); void GC_err_puts(const char *s); /* Write s to stderr, don't buffer, don't add */ /* newlines, don't ... */ #if defined(LINUX) && !defined(SMALL_CONFIG) void GC_err_write(const char *buf, size_t len); /* Write buf to stderr, don't buffer, don't add */ /* newlines, don't ... */ #endif # ifdef GC_ASSERTIONS # define GC_ASSERT(expr) if(!(expr)) {\ GC_err_printf("Assertion failure: %s:%ld\n", \ __FILE__, (unsigned long)__LINE__); \ ABORT("assertion failure"); } # else # define GC_ASSERT(expr) # endif /* Check a compile time assertion at compile time. The error */ /* message for failure is a bit baroque, but ... */ #if defined(mips) && !defined(__GNUC__) /* DOB: MIPSPro C gets an internal error taking the sizeof an array type. This code works correctly (ugliness is to avoid "unused var" warnings) */ # define GC_STATIC_ASSERT(expr) do { if (0) { char j[(expr)? 1 : -1]; j[0]='\0'; j[0]=j[0]; } } while(0) #else # define GC_STATIC_ASSERT(expr) sizeof(char[(expr)? 1 : -1]) #endif # if defined(PARALLEL_MARK) || defined(THREAD_LOCAL_ALLOC) /* We need additional synchronization facilities from the thread */ /* support. We believe these are less performance critical */ /* than the main garbage collector lock; standard pthreads-based */ /* implementations should be sufficient. */ /* The mark lock and condition variable. If the GC lock is also */ /* acquired, the GC lock must be acquired first. The mark lock is */ /* used to both protect some variables used by the parallel */ /* marker, and to protect GC_fl_builder_count, below. */ /* GC_notify_all_marker() is called when */ /* the state of the parallel marker changes */ /* in some significant way (see gc_mark.h for details). The */ /* latter set of events includes incrementing GC_mark_no. */ /* GC_notify_all_builder() is called when GC_fl_builder_count */ /* reaches 0. */ extern void GC_acquire_mark_lock(); extern void GC_release_mark_lock(); extern void GC_notify_all_builder(); /* extern void GC_wait_builder(); */ extern void GC_wait_for_reclaim(); extern word GC_fl_builder_count; /* Protected by mark lock. */ # endif /* PARALLEL_MARK || THREAD_LOCAL_ALLOC */ # ifdef PARALLEL_MARK extern void GC_notify_all_marker(); extern void GC_wait_marker(); extern word GC_mark_no; /* Protected by mark lock. */ extern void GC_help_marker(word my_mark_no); /* Try to help out parallel marker for mark cycle */ /* my_mark_no. Returns if the mark cycle finishes or */ /* was already done, or there was nothing to do for */ /* some other reason. */ # endif /* PARALLEL_MARK */ # if defined(GC_PTHREADS) /* We define the thread suspension signal here, so that we can refer */ /* to it in the dirty bit implementation, if necessary. Ideally we */ /* would allocate a (real-time ?) signal using the standard mechanism.*/ /* unfortunately, there is no standard mechanism. (There is one */ /* in Linux glibc, but it's not exported.) Thus we continue to use */ /* the same hard-coded signals we've always used. */ # if !defined(SIG_SUSPEND) # if defined(GC_LINUX_THREADS) || defined(GC_DGUX386_THREADS) # if defined(SPARC) && !defined(SIGPWR) /* SPARC/Linux doesn't properly define SIGPWR in . * It is aliased to SIGLOST in asm/signal.h, though. */ # define SIG_SUSPEND SIGLOST # else /* Linuxthreads itself uses SIGUSR1 and SIGUSR2. */ # define SIG_SUSPEND SIGPWR # endif # else /* !GC_LINUX_THREADS */ # if defined(_SIGRTMIN) # define SIG_SUSPEND _SIGRTMIN + 6 # else # define SIG_SUSPEND SIGRTMIN + 6 # endif # endif # endif /* !SIG_SUSPEND */ # endif /* Some macros for setjmp that works across signal handlers */ /* were possible, and a couple of routines to facilitate */ /* catching accesses to bad addresses when that's */ /* possible/needed. */ #ifdef UNIX_LIKE # include # if defined(SUNOS5SIGS) && !defined(FREEBSD) # include # endif /* Define SETJMP and friends to be the version that restores */ /* the signal mask. */ # define SETJMP(env) sigsetjmp(env, 1) # define LONGJMP(env, val) siglongjmp(env, val) # define JMP_BUF sigjmp_buf #else # ifdef ECOS # define SETJMP(env) hal_setjmp(env) # else # define SETJMP(env) setjmp(env) # endif # define LONGJMP(env, val) longjmp(env, val) # define JMP_BUF jmp_buf #endif /* Do we need the GC_find_limit machinery to find the end of a */ /* data segment. */ # if defined(HEURISTIC2) || defined(SEARCH_FOR_DATA_START) # define NEED_FIND_LIMIT # endif # if !defined(STACKBOTTOM) && defined(HEURISTIC2) # define NEED_FIND_LIMIT # endif # if (defined(SVR4) || defined(AUX) || defined(DGUX) \ || (defined(LINUX) && defined(SPARC))) && !defined(PCR) # define NEED_FIND_LIMIT # endif #if defined(FREEBSD) && (defined(I386) || defined(X86_64) || defined(powerpc) \ || defined(__powerpc__)) # include # if !defined(PCR) # define NEED_FIND_LIMIT # endif #endif #if (defined(NETBSD) || defined(OPENBSD)) && defined(__ELF__) \ && !defined(NEED_FIND_LIMIT) /* Used by GC_init_netbsd_elf() in os_dep.c. */ # define NEED_FIND_LIMIT #endif #if defined(IA64) && !defined(NEED_FIND_LIMIT) # define NEED_FIND_LIMIT /* May be needed for register backing store base. */ #endif # if defined(NEED_FIND_LIMIT) || \ defined(USE_PROC_FOR_LIBRARIES) && defined(THREADS) JMP_BUF GC_jmp_buf; /* Set up a handler for address faults which will longjmp to */ /* GC_jmp_buf; */ extern void GC_setup_temporary_fault_handler(void); /* Undo the effect of GC_setup_temporary_fault_handler. */ extern void GC_reset_fault_handler(void); # endif /* Need to handle address faults. */ # endif /* GC_PRIVATE_H */ synopsis-0.12/src/Synopsis/gc/include/private/dbg_mlc.h0000664000076400007640000001511311104702317022520 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved. * Copyright (c) 1997 by Silicon Graphics. All rights reserved. * Copyright (c) 1999 by Hewlett-Packard Company. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* * This is mostly an internal header file. Typical clients should * not use it. Clients that define their own object kinds with * debugging allocators will probably want to include this, however. * No attempt is made to keep the namespace clean. This should not be * included from header files that are frequently included by clients. */ #ifndef _DBG_MLC_H #define _DBG_MLC_H # define I_HIDE_POINTERS # include "gc_priv.h" # ifdef KEEP_BACK_PTRS # include "gc_backptr.h" # endif #ifndef HIDE_POINTER /* Gc.h was previously included, and hence the I_HIDE_POINTERS */ /* definition had no effect. Repeat the gc.h definitions here to */ /* get them anyway. */ typedef GC_word GC_hidden_pointer; # define HIDE_POINTER(p) (~(GC_hidden_pointer)(p)) # define REVEAL_POINTER(p) ((void *)(HIDE_POINTER(p))) #endif /* HIDE_POINTER */ # define START_FLAG ((word)0xfedcedcb) # define END_FLAG ((word)0xbcdecdef) /* Stored both one past the end of user object, and one before */ /* the end of the object as seen by the allocator. */ # if defined(KEEP_BACK_PTRS) || defined(PRINT_BLACK_LIST) \ || defined(MAKE_BACK_GRAPH) /* Pointer "source"s that aren't real locations. */ /* Used in oh_back_ptr fields and as "source" */ /* argument to some marking functions. */ # define NOT_MARKED (ptr_t)(0) # define MARKED_FOR_FINALIZATION (ptr_t)(2) /* Object was marked because it is finalizable. */ # define MARKED_FROM_REGISTER (ptr_t)(4) /* Object was marked from a rgister. Hence the */ /* source of the reference doesn't have an address. */ # endif /* KEEP_BACK_PTRS || PRINT_BLACK_LIST */ /* Object header */ typedef struct { # if defined(KEEP_BACK_PTRS) || defined(MAKE_BACK_GRAPH) /* We potentially keep two different kinds of back */ /* pointers. KEEP_BACK_PTRS stores a single back */ /* pointer in each reachable object to allow reporting */ /* of why an object was retained. MAKE_BACK_GRAPH */ /* builds a graph containing the inverse of all */ /* "points-to" edges including those involving */ /* objects that have just become unreachable. This */ /* allows detection of growing chains of unreachable */ /* objects. It may be possible to eventually combine */ /* both, but for now we keep them separate. Both */ /* kinds of back pointers are hidden using the */ /* following macros. In both cases, the plain version */ /* is constrained to have an least significant bit of 1,*/ /* to allow it to be distinguished from a free list */ /* link. This means the plain version must have an */ /* lsb of 0. */ /* Note that blocks dropped by black-listing will */ /* also have the lsb clear once debugging has */ /* started. */ /* We're careful never to overwrite a value with lsb 0. */ # if ALIGNMENT == 1 /* Fudge back pointer to be even. */ # define HIDE_BACK_PTR(p) HIDE_POINTER(~1 & (GC_word)(p)) # else # define HIDE_BACK_PTR(p) HIDE_POINTER(p) # endif # ifdef KEEP_BACK_PTRS GC_hidden_pointer oh_back_ptr; # endif # ifdef MAKE_BACK_GRAPH GC_hidden_pointer oh_bg_ptr; # endif # if defined(KEEP_BACK_PTRS) != defined(MAKE_BACK_GRAPH) /* Keep double-pointer-sized alignment. */ word oh_dummy; # endif # endif const char * oh_string; /* object descriptor string */ word oh_int; /* object descriptor integers */ # ifdef NEED_CALLINFO struct callinfo oh_ci[NFRAMES]; # endif # ifndef SHORT_DBG_HDRS word oh_sz; /* Original malloc arg. */ word oh_sf; /* start flag */ # endif /* SHORT_DBG_HDRS */ } oh; /* The size of the above structure is assumed not to dealign things, */ /* and to be a multiple of the word length. */ #ifdef SHORT_DBG_HDRS # define DEBUG_BYTES (sizeof (oh)) # define UNCOLLECTABLE_DEBUG_BYTES DEBUG_BYTES #else /* Add space for END_FLAG, but use any extra space that was already */ /* added to catch off-the-end pointers. */ /* For uncollectable objects, the extra byte is not added. */ # define UNCOLLECTABLE_DEBUG_BYTES (sizeof (oh) + sizeof (word)) # define DEBUG_BYTES (UNCOLLECTABLE_DEBUG_BYTES - EXTRA_BYTES) #endif /* Round bytes to words without adding extra byte at end. */ #define SIMPLE_ROUNDED_UP_WORDS(n) BYTES_TO_WORDS((n) + WORDS_TO_BYTES(1) - 1) /* ADD_CALL_CHAIN stores a (partial) call chain into an object */ /* header. It may be called with or without the allocation */ /* lock. */ /* PRINT_CALL_CHAIN prints the call chain stored in an object */ /* to stderr. It requires that we do not hold the lock. */ #if defined(SAVE_CALL_CHAIN) struct callinfo; void GC_save_callers(struct callinfo info[NFRAMES]); void GC_print_callers(struct callinfo info[NFRAMES]); # define ADD_CALL_CHAIN(base, ra) GC_save_callers(((oh *)(base)) -> oh_ci) # define PRINT_CALL_CHAIN(base) GC_print_callers(((oh *)(base)) -> oh_ci) #elif defined(GC_ADD_CALLER) struct callinfo; void GC_print_callers(struct callinfo info[NFRAMES]); # define ADD_CALL_CHAIN(base, ra) ((oh *)(base)) -> oh_ci[0].ci_pc = (ra) # define PRINT_CALL_CHAIN(base) GC_print_callers(((oh *)(base)) -> oh_ci) #else # define ADD_CALL_CHAIN(base, ra) # define PRINT_CALL_CHAIN(base) #endif # ifdef GC_ADD_CALLER # define OPT_RA ra, # else # define OPT_RA # endif /* Check whether object with base pointer p has debugging info */ /* p is assumed to point to a legitimate object in our part */ /* of the heap. */ #ifdef SHORT_DBG_HDRS # define GC_has_other_debug_info(p) TRUE #else GC_bool GC_has_other_debug_info(/* p */); #endif #if defined(KEEP_BACK_PTRS) || defined(MAKE_BACK_GRAPH) # define GC_HAS_DEBUG_INFO(p) \ ((*((word *)p) & 1) && GC_has_other_debug_info(p)) #else # define GC_HAS_DEBUG_INFO(p) GC_has_other_debug_info(p) #endif /* Store debugging info into p. Return displaced pointer. */ /* Assumes we don't hold allocation lock. */ ptr_t GC_store_debug_info(/* p, sz, string, integer */); #endif /* _DBG_MLC_H */ synopsis-0.12/src/Synopsis/gc/include/private/gc_locks.h0000664000076400007640000001746011104702317022724 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999 by Hewlett-Packard Company. All rights reserved. * * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ #ifndef GC_LOCKS_H #define GC_LOCKS_H /* * Mutual exclusion between allocator/collector routines. * Needed if there is more than one allocator thread. * DCL_LOCK_STATE declares any local variables needed by LOCK and UNLOCK. * * Note that I_HOLD_LOCK and I_DONT_HOLD_LOCK are used only positively * in assertions, and may return TRUE in the "dont know" case. */ # ifdef THREADS # include void GC_noop1(word); # ifdef PCR # include # include extern PCR_Th_ML GC_allocate_ml; # define DCL_LOCK_STATE \ PCR_ERes GC_fastLockRes; PCR_sigset_t GC_old_sig_mask # define LOCK() PCR_Th_ML_Acquire(&GC_allocate_ml) # define UNLOCK() PCR_Th_ML_Release(&GC_allocate_ml) # endif # if !defined(AO_HAVE_test_and_set_acquire) && defined(GC_PTHREADS) # define USE_PTHREAD_LOCKS # endif # if defined(GC_WIN32_THREADS) && defined(GC_PTHREADS) # define USE_PTHREAD_LOCKS # endif # if defined(GC_WIN32_THREADS) && !defined(USE_PTHREAD_LOCKS) # include # define NO_THREAD (DWORD)(-1) extern DWORD GC_lock_holder; GC_API CRITICAL_SECTION GC_allocate_ml; # ifdef GC_ASSERTIONS # define UNCOND_LOCK() \ { EnterCriticalSection(&GC_allocate_ml); \ SET_LOCK_HOLDER(); } # define UNCOND_UNLOCK() \ { GC_ASSERT(I_HOLD_LOCK()); UNSET_LOCK_HOLDER(); \ LeaveCriticalSection(&GC_allocate_ml); } # else # define UNCOND_LOCK() EnterCriticalSection(&GC_allocate_ml); # define UNCOND_UNLOCK() LeaveCriticalSection(&GC_allocate_ml); # endif /* !GC_ASSERTIONS */ # define SET_LOCK_HOLDER() GC_lock_holder = GetCurrentThreadId() # define UNSET_LOCK_HOLDER() GC_lock_holder = NO_THREAD # define I_HOLD_LOCK() (!GC_need_to_lock \ || GC_lock_holder == GetCurrentThreadId()) # define I_DONT_HOLD_LOCK() (!GC_need_to_lock \ || GC_lock_holder != GetCurrentThreadId()) # elif defined(GC_PTHREADS) # include /* Posix allows pthread_t to be a struct, though it rarely is. */ /* Unfortunately, we need to use a pthread_t to index a data */ /* structure. It also helps if comparisons don't involve a */ /* function call. Hence we introduce platform-dependent macros */ /* to compare pthread_t ids and to map them to integers. */ /* the mapping to integers does not need to result in different */ /* integers for each thread, though that should be true as much */ /* as possible. */ /* Refine to exclude platforms on which pthread_t is struct */ # if !defined(GC_WIN32_PTHREADS) # define NUMERIC_THREAD_ID(id) ((unsigned long)(id)) # define THREAD_EQUAL(id1, id2) ((id1) == (id2)) # define NUMERIC_THREAD_ID_UNIQUE # else # if defined(GC_WIN32_PTHREADS) # define NUMERIC_THREAD_ID(id) ((unsigned long)(id.p)) /* Using documented internal details of win32_pthread library. */ /* Faster than pthread_equal(). Should not change with */ /* future versions of win32_pthread library. */ # define THREAD_EQUAL(id1, id2) ((id1.p == id2.p) && (id1.x == id2.x)) # undef NUMERIC_THREAD_ID_UNIQUE # else /* Generic definitions that always work, but will result in */ /* poor performance and weak assertion checking. */ # define NUMERIC_THREAD_ID(id) 1l # define THREAD_EQUAL(id1, id2) pthread_equal(id1, id2) # undef NUMERIC_THREAD_ID_UNIQUE # endif # endif # define NO_THREAD (-1l) /* != NUMERIC_THREAD_ID(pthread_self()) for any thread */ # if !defined(THREAD_LOCAL_ALLOC) && !defined(USE_PTHREAD_LOCKS) /* In the THREAD_LOCAL_ALLOC case, the allocation lock tends to */ /* be held for long periods, if it is held at all. Thus spinning */ /* and sleeping for fixed periods are likely to result in */ /* significant wasted time. We thus rely mostly on queued locks. */ # define USE_SPIN_LOCK extern volatile AO_TS_t GC_allocate_lock; extern void GC_lock(void); /* Allocation lock holder. Only set if acquired by client through */ /* GC_call_with_alloc_lock. */ # ifdef GC_ASSERTIONS # define UNCOND_LOCK() \ { if (AO_test_and_set_acquire(&GC_allocate_lock) == AO_TS_SET) \ GC_lock(); \ SET_LOCK_HOLDER(); } # define UNCOND_UNLOCK() \ { GC_ASSERT(I_HOLD_LOCK()); UNSET_LOCK_HOLDER(); \ AO_CLEAR(&GC_allocate_lock); } # else # define UNCOND_LOCK() \ { if (AO_test_and_set_acquire(&GC_allocate_lock) == AO_TS_SET) \ GC_lock(); } # define UNCOND_UNLOCK() \ AO_CLEAR(&GC_allocate_lock) # endif /* !GC_ASSERTIONS */ # else /* THREAD_LOCAL_ALLOC || USE_PTHREAD_LOCKS */ # ifndef USE_PTHREAD_LOCKS # define USE_PTHREAD_LOCKS # endif # endif /* THREAD_LOCAL_ALLOC || USE_PTHREAD_LOCK */ # ifdef USE_PTHREAD_LOCKS # include extern pthread_mutex_t GC_allocate_ml; # ifdef GC_ASSERTIONS # define UNCOND_LOCK() \ { GC_lock(); \ SET_LOCK_HOLDER(); } # define UNCOND_UNLOCK() \ { GC_ASSERT(I_HOLD_LOCK()); UNSET_LOCK_HOLDER(); \ pthread_mutex_unlock(&GC_allocate_ml); } # else /* !GC_ASSERTIONS */ # if defined(NO_PTHREAD_TRYLOCK) # define UNCOND_LOCK() GC_lock(); # else /* !defined(NO_PTHREAD_TRYLOCK) */ # define UNCOND_LOCK() \ { if (0 != pthread_mutex_trylock(&GC_allocate_ml)) GC_lock(); } # endif # define UNCOND_UNLOCK() pthread_mutex_unlock(&GC_allocate_ml) # endif /* !GC_ASSERTIONS */ # endif /* USE_PTHREAD_LOCKS */ # define SET_LOCK_HOLDER() \ GC_lock_holder = NUMERIC_THREAD_ID(pthread_self()) # define UNSET_LOCK_HOLDER() GC_lock_holder = NO_THREAD # define I_HOLD_LOCK() \ (!GC_need_to_lock || \ GC_lock_holder == NUMERIC_THREAD_ID(pthread_self())) # ifndef NUMERIC_THREAD_ID_UNIQUE # define I_DONT_HOLD_LOCK() 1 /* Conservatively say yes */ # else # define I_DONT_HOLD_LOCK() \ (!GC_need_to_lock \ || GC_lock_holder != NUMERIC_THREAD_ID(pthread_self())) # endif extern volatile GC_bool GC_collecting; # define ENTER_GC() GC_collecting = 1; # define EXIT_GC() GC_collecting = 0; extern void GC_lock(void); extern unsigned long GC_lock_holder; # ifdef GC_ASSERTIONS extern unsigned long GC_mark_lock_holder; # endif # endif /* GC_PTHREADS with linux_threads.c implementation */ # else /* !THREADS */ # define LOCK() # define UNLOCK() # define SET_LOCK_HOLDER() # define UNSET_LOCK_HOLDER() # define I_HOLD_LOCK() TRUE # define I_DONT_HOLD_LOCK() TRUE /* Used only in positive assertions or to test whether */ /* we still need to acaquire the lock. TRUE works in */ /* either case. */ # endif /* !THREADS */ #if defined(UNCOND_LOCK) && !defined(LOCK) GC_API GC_bool GC_need_to_lock; /* At least two thread running; need to lock. */ # define LOCK() if (GC_need_to_lock) { UNCOND_LOCK(); } # define UNLOCK() if (GC_need_to_lock) { UNCOND_UNLOCK(); } #endif # ifndef ENTER_GC # define ENTER_GC() # define EXIT_GC() # endif # ifndef DCL_LOCK_STATE # define DCL_LOCK_STATE # endif #endif /* GC_LOCKS_H */ synopsis-0.12/src/Synopsis/gc/include/private/thread_local_alloc.h0000664000076400007640000001272411104702317024731 0ustar stefanstefan/* * Copyright (c) 2000-2005 by Hewlett-Packard Company. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* Included indirectly from a thread-library-specific file. */ /* This is the interface for thread-local allocation, whose */ /* implementation is mostly thread-library-independent. */ /* Here we describe only the interface that needs to be known */ /* and invoked from the thread support layer; the actual */ /* implementation also exports GC_malloc and friends, which */ /* are declared in gc.h. */ #include "private/gc_priv.h" #if defined(THREAD_LOCAL_ALLOC) #include "gc_inline.h" # if defined USE_HPUX_TLS # error USE_HPUX_TLS macro was replaced by USE_COMPILER_TLS # endif # if !defined(USE_PTHREAD_SPECIFIC) && !defined(USE_WIN32_SPECIFIC) && \ !defined(USE_WIN32_COMPILER_TLS) && !defined(USE_COMPILER_TLS) && \ !defined(USE_CUSTOM_SPECIFIC) # if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32) # if defined(__GNUC__) /* Fixed for versions past 2.95? */ # define USE_WIN32_SPECIFIC # else # define USE_WIN32_COMPILER_TLS # endif /* !GNU */ # elif defined(LINUX) && !defined(ARM32) && \ (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >=3)) # define USE_COMPILER_TLS # elif (defined(GC_DGUX386_THREADS) || defined(GC_OSF1_THREADS) || \ defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS)) || \ defined(GC_NETBSD_THREADS) # define USE_PTHREAD_SPECIFIC # elif defined(GC_HPUX_THREADS) # ifdef __GNUC__ # define USE_PTHREAD_SPECIFIC /* Empirically, as of gcc 3.3, USE_COMPILER_TLS doesn't work. */ # else # define USE_COMPILER_TLS # endif # else # define USE_CUSTOM_SPECIFIC /* Use our own. */ # endif # endif # include /* One of these should be declared as the tlfs field in the */ /* structure pointed to by a GC_thread. */ typedef struct thread_local_freelists { # ifdef THREAD_LOCAL_ALLOC void * ptrfree_freelists[TINY_FREELISTS]; void * normal_freelists[TINY_FREELISTS]; # ifdef GC_GCJ_SUPPORT void * gcj_freelists[TINY_FREELISTS]; # define ERROR_FL (void *)(-1) /* Value used for gcj_freelist[-1]; allocation is */ /* erroneous. */ # endif /* Free lists contain either a pointer or a small count */ /* reflecting the number of granules allocated at that */ /* size. */ /* 0 ==> thread-local allocation in use, free list */ /* empty. */ /* > 0, <= DIRECT_GRANULES ==> Using global allocation, */ /* too few objects of this size have been */ /* allocated by this thread. */ /* >= HBLKSIZE => pointer to nonempty free list. */ /* > DIRECT_GRANULES, < HBLKSIZE ==> transition to */ /* local alloc, equivalent to 0. */ # define DIRECT_GRANULES (HBLKSIZE/GRANULE_BYTES) /* Don't use local free lists for up to this much */ /* allocation. */ # endif } *GC_tlfs; # if defined(USE_PTHREAD_SPECIFIC) # define GC_getspecific pthread_getspecific # define GC_setspecific pthread_setspecific # define GC_key_create pthread_key_create # define GC_remove_specific(key) /* No need for cleanup on exit. */ typedef pthread_key_t GC_key_t; # elif defined(USE_COMPILER_TLS) || defined(USE_WIN32_COMPILER_TLS) # define GC_getspecific(x) (x) # define GC_setspecific(key, v) ((key) = (v), 0) # define GC_key_create(key, d) 0 # define GC_remove_specific(key) /* No need for cleanup on exit. */ typedef void * GC_key_t; # elif defined(USE_WIN32_SPECIFIC) # include # define GC_getspecific TlsGetValue # define GC_setspecific(key, v) !TlsSetValue(key, v) /* We assume 0 == success, msft does the opposite. */ # define GC_key_create(key, d) \ ((d) != 0? (ABORT("Destructor unsupported by TlsAlloc"),0) \ : (*(key) = TlsAlloc(), 0)) # define GC_remove_specific(key) /* No need for cleanup on thread exit. */ /* Need TlsFree on process exit/detach ? */ typedef DWORD GC_key_t; # elif defined(USE_CUSTOM_SPECIFIC) # include "private/specific.h" # else # error implement me # endif /* Each thread structure must be initialized. */ /* This call must be made from the new thread. */ /* Caller holds allocation lock. */ void GC_init_thread_local(GC_tlfs p); /* Called when a thread is unregistered, or exits. */ /* We hold the allocator lock. */ void GC_destroy_thread_local(GC_tlfs p); /* The thread support layer must arrange to mark thread-local */ /* free lists explicitly, since the link field is often */ /* invisible to the marker. It knows hoe to find all threads; */ /* we take care of an individual thread freelist structure. */ void GC_mark_thread_local_fls_for(GC_tlfs p); extern #if defined(USE_COMPILER_TLS) __thread #elif defined(USE_WIN32_COMPILER_TLS) __declspec(thread) #endif GC_key_t GC_thread_key; /* This is set up by the thread_local_alloc implementation. But the */ /* thread support layer calls GC_remove_specific(GC_thread_key) */ /* before a thread exits. */ /* And the thread support layer makes sure that GC_thread_key is traced,*/ /* if necessary. */ #endif /* THREAD_LOCAL_ALLOC */ synopsis-0.12/src/Synopsis/gc/include/gc_mark.h0000664000076400007640000002172311104702317021066 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 2001 by Hewlett-Packard Company. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */ /* * This contains interfaces to the GC marker that are likely to be useful to * clients that provide detailed heap layout information to the collector. * This interface should not be used by normal C or C++ clients. * It will be useful to runtimes for other languages. * * This is an experts-only interface! There are many ways to break the * collector in subtle ways by using this functionality. */ #ifndef GC_MARK_H # define GC_MARK_H # ifndef GC_H # include "gc.h" # endif /* A client supplied mark procedure. Returns new mark stack pointer. */ /* Primary effect should be to push new entries on the mark stack. */ /* Mark stack pointer values are passed and returned explicitly. */ /* Global variables decribing mark stack are not necessarily valid. */ /* (This usually saves a few cycles by keeping things in registers.) */ /* Assumed to scan about GC_PROC_BYTES on average. If it needs to do */ /* much more work than that, it should do it in smaller pieces by */ /* pushing itself back on the mark stack. */ /* Note that it should always do some work (defined as marking some */ /* objects) before pushing more than one entry on the mark stack. */ /* This is required to ensure termination in the event of mark stack */ /* overflows. */ /* This procedure is always called with at least one empty entry on the */ /* mark stack. */ /* Currently we require that mark procedures look for pointers in a */ /* subset of the places the conservative marker would. It must be safe */ /* to invoke the normal mark procedure instead. */ /* WARNING: Such a mark procedure may be invoked on an unused object */ /* residing on a free list. Such objects are cleared, except for a */ /* free list link field in the first word. Thus mark procedures may */ /* not count on the presence of a type descriptor, and must handle this */ /* case correctly somehow. */ # define GC_PROC_BYTES 100 struct GC_ms_entry; typedef struct GC_ms_entry * (*GC_mark_proc) ( GC_word * addr, struct GC_ms_entry * mark_stack_ptr, struct GC_ms_entry * mark_stack_limit, GC_word env); # define GC_LOG_MAX_MARK_PROCS 6 # define GC_MAX_MARK_PROCS (1 << GC_LOG_MAX_MARK_PROCS) /* In a few cases it's necessary to assign statically known indices to */ /* certain mark procs. Thus we reserve a few for well known clients. */ /* (This is necessary if mark descriptors are compiler generated.) */ #define GC_RESERVED_MARK_PROCS 8 # define GC_GCJ_RESERVED_MARK_PROC_INDEX 0 /* Object descriptors on mark stack or in objects. Low order two */ /* bits are tags distinguishing among the following 4 possibilities */ /* for the high order 30 bits. */ #define GC_DS_TAG_BITS 2 #define GC_DS_TAGS ((1 << GC_DS_TAG_BITS) - 1) #define GC_DS_LENGTH 0 /* The entire word is a length in bytes that */ /* must be a multiple of 4. */ #define GC_DS_BITMAP 1 /* 30 (62) bits are a bitmap describing pointer */ /* fields. The msb is 1 iff the first word */ /* is a pointer. */ /* (This unconventional ordering sometimes */ /* makes the marker slightly faster.) */ /* Zeroes indicate definite nonpointers. Ones */ /* indicate possible pointers. */ /* Only usable if pointers are word aligned. */ #define GC_DS_PROC 2 /* The objects referenced by this object can be */ /* pushed on the mark stack by invoking */ /* PROC(descr). ENV(descr) is passed as the */ /* last argument. */ # define GC_MAKE_PROC(proc_index, env) \ (((((env) << GC_LOG_MAX_MARK_PROCS) \ | (proc_index)) << GC_DS_TAG_BITS) | GC_DS_PROC) #define GC_DS_PER_OBJECT 3 /* The real descriptor is at the */ /* byte displacement from the beginning of the */ /* object given by descr & ~DS_TAGS */ /* If the descriptor is negative, the real */ /* descriptor is at (*) - */ /* (descr & ~DS_TAGS) - GC_INDIR_PER_OBJ_BIAS */ /* The latter alternative can be used if each */ /* object contains a type descriptor in the */ /* first word. */ /* Note that in multithreaded environments */ /* per object descriptors maust be located in */ /* either the first two or last two words of */ /* the object, since only those are guaranteed */ /* to be cleared while the allocation lock is */ /* held. */ #define GC_INDIR_PER_OBJ_BIAS 0x10 extern void * GC_least_plausible_heap_addr; extern void * GC_greatest_plausible_heap_addr; /* Bounds on the heap. Guaranteed valid */ /* Likely to include future heap expansion. */ /* Handle nested references in a custom mark procedure. */ /* Check if obj is a valid object. If so, ensure that it is marked. */ /* If it was not previously marked, push its contents onto the mark */ /* stack for future scanning. The object will then be scanned using */ /* its mark descriptor. */ /* Returns the new mark stack pointer. */ /* Handles mark stack overflows correctly. */ /* Since this marks first, it makes progress even if there are mark */ /* stack overflows. */ /* Src is the address of the pointer to obj, which is used only */ /* for back pointer-based heap debugging. */ /* It is strongly recommended that most objects be handled without mark */ /* procedures, e.g. with bitmap descriptors, and that mark procedures */ /* be reserved for exceptional cases. That will ensure that */ /* performance of this call is not extremely performance critical. */ /* (Otherwise we would need to inline GC_mark_and_push completely, */ /* which would tie the client code to a fixed collector version.) */ /* Note that mark procedures should explicitly call FIXUP_POINTER() */ /* if required. */ struct GC_ms_entry *GC_mark_and_push(void * obj, struct GC_ms_entry * mark_stack_ptr, struct GC_ms_entry * mark_stack_limit, void * *src); #define GC_MARK_AND_PUSH(obj, msp, lim, src) \ (((GC_word)obj >= (GC_word)GC_least_plausible_heap_addr && \ (GC_word)obj <= (GC_word)GC_greatest_plausible_heap_addr)? \ GC_mark_and_push(obj, msp, lim, src) : \ msp) extern size_t GC_debug_header_size; /* The size of the header added to objects allocated through */ /* the GC_debug routines. */ /* Defined as a variable so that client mark procedures don't */ /* need to be recompiled for collector version changes. */ #define GC_USR_PTR_FROM_BASE(p) ((void *)((char *)(p) + GC_debug_header_size)) /* And some routines to support creation of new "kinds", e.g. with */ /* custom mark procedures, by language runtimes. */ /* The _inner versions assume the caller holds the allocation lock. */ /* Return a new free list array. */ void ** GC_new_free_list(void); void ** GC_new_free_list_inner(void); /* Return a new kind, as specified. */ unsigned GC_new_kind(void **free_list, GC_word mark_descriptor_template, int add_size_to_descriptor, int clear_new_objects); /* The last two parameters must be zero or one. */ unsigned GC_new_kind_inner(void **free_list, GC_word mark_descriptor_template, int add_size_to_descriptor, int clear_new_objects); /* Return a new mark procedure identifier, suitable for use as */ /* the first argument in GC_MAKE_PROC. */ unsigned GC_new_proc(GC_mark_proc); unsigned GC_new_proc_inner(GC_mark_proc); /* Allocate an object of a given kind. Note that in multithreaded */ /* contexts, this is usually unsafe for kinds that have the descriptor */ /* in the object itself, since there is otherwise a window in which */ /* the descriptor is not correct. Even in the single-threaded case, */ /* we need to be sure that cleared objects on a free list don't */ /* cause a GC crash if they are accidentally traced. */ void * GC_generic_malloc(size_t lb, int k); typedef void (*GC_describe_type_fn) (void *p, char *out_buf); /* A procedure which */ /* produces a human-readable */ /* description of the "type" of object */ /* p into the buffer out_buf of length */ /* GC_TYPE_DESCR_LEN. This is used by */ /* the debug support when printing */ /* objects. */ /* These functions should be as robust */ /* as possible, though we do avoid */ /* invoking them on objects on the */ /* global free list. */ # define GC_TYPE_DESCR_LEN 40 void GC_register_describe_type_fn(int kind, GC_describe_type_fn knd); /* Register a describe_type function */ /* to be used when printing objects */ /* of a particular kind. */ #endif /* GC_MARK_H */ synopsis-0.12/src/Synopsis/gc/include/gc_amiga_redirects.h0000664000076400007640000000224211104702317023251 0ustar stefanstefan#ifndef GC_AMIGA_REDIRECTS_H # define GC_AMIGA_REDIRECTS_H # if ( defined(_AMIGA) && !defined(GC_AMIGA_MAKINGLIB) ) extern void *GC_amiga_realloc(void *old_object,size_t new_size_in_bytes); # define GC_realloc(a,b) GC_amiga_realloc(a,b) extern void GC_amiga_set_toany(void (*func)(void)); extern int GC_amiga_free_space_divisor_inc; extern void *(*GC_amiga_allocwrapper_do) \ (size_t size,void *(*AllocFunction)(size_t size2)); # define GC_malloc(a) \ (*GC_amiga_allocwrapper_do)(a,GC_malloc) # define GC_malloc_atomic(a) \ (*GC_amiga_allocwrapper_do)(a,GC_malloc_atomic) # define GC_malloc_uncollectable(a) \ (*GC_amiga_allocwrapper_do)(a,GC_malloc_uncollectable) # define GC_malloc_stubborn(a) \ (*GC_amiga_allocwrapper_do)(a,GC_malloc_stubborn) # define GC_malloc_atomic_uncollectable(a) \ (*GC_amiga_allocwrapper_do)(a,GC_malloc_atomic_uncollectable) # define GC_malloc_ignore_off_page(a) \ (*GC_amiga_allocwrapper_do)(a,GC_malloc_ignore_off_page) # define GC_malloc_atomic_ignore_off_page(a) \ (*GC_amiga_allocwrapper_do)(a,GC_malloc_atomic_ignore_off_page) # endif /* _AMIGA && !GC_AMIGA_MAKINGLIB */ #endif /* GC_AMIGA_REDIRECTS_H */ synopsis-0.12/src/Synopsis/gc/include/gc_tiny_fl.h0000664000076400007640000000726711104702317021607 0ustar stefanstefan/* * Copyright (c) 1999-2005 Hewlett-Packard Development Company, L.P. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ #ifndef GC_TINY_FL_H #define GC_TINY_FL_H /* * Constants and data structures for "tiny" free lists. * These are used for thread-local allocation or in-lined allocators. * Each global free list also essentially starts with one of these. * However, global free lists are known to the GC. "Tiny" free lists * are basically private to the client. Their contents are viewed as * "in use" and marked accordingly by the core of the GC. * * Note that inlined code might know about the layout of these and the constants * involved. Thus any change here may invalidate clients, and such changes should * be avoided. Hence we keep this as simple as possible. */ /* * We always set GRANULE_BYTES to twice the length of a pointer. * This means that all allocation requests are rounded up to the next * multiple of 16 on 64-bit architectures or 8 on 32-bit architectures. * This appears to be a reasonable compromise between fragmentation overhead * and space usage for mark bits (usually mark bytes). * On many 64-bit architectures some memory references require 16-byte * alignment, making this necessary anyway. * For a few 32-bit architecture (e.g. x86), we may also need 16-byte alignment * for certain memory references. But currently that does not seem to be the * default for all conventional malloc implementations, so we ignore that * problem. * It would always be safe, and often useful, to be able to allocate very * small objects with smaller alignment. But that would cost us mark bit * space, so we no longer do so. */ #ifndef GC_GRANULE_BYTES /* GC_GRANULE_BYTES should not be overridden in any instances of the GC */ /* library that may be shared between applications, since it affects */ /* the binary interface to the library. */ # if defined(__LP64__) || defined (_LP64) || defined(_WIN64) \ || defined(__s390x__) || defined(__x86_64__) \ || defined(__alpha__) || defined(__powerpc64__) \ || defined(__arch64__) # define GC_GRANULE_BYTES 16 # define GC_GRANULE_WORDS 2 # else # define GC_GRANULE_BYTES 8 # define GC_GRANULE_WORDS 2 # endif #endif /* !GC_GRANULE_BYTES */ #if GC_GRANULE_WORDS == 2 # define GC_WORDS_TO_GRANULES(n) ((n)>>1) #else # define GC_WORDS_TO_GRANULES(n) ((n)*sizeof(void *)/GRANULE_BYTES) #endif /* A "tiny" free list header contains TINY_FREELISTS pointers to */ /* singly linked lists of objects of different sizes, the ith one */ /* containing objects i granules in size. Note that there is a list */ /* of size zero objects. */ #ifndef GC_TINY_FREELISTS # if GC_GRANULE_BYTES == 16 # define GC_TINY_FREELISTS 25 # else # define GC_TINY_FREELISTS 33 /* Up to and including 256 bytes */ # endif #endif /* !GC_TINY_FREELISTS */ /* The ith free list corresponds to size i*GRANULE_BYTES */ /* Internally to the collector, the index can be computed with */ /* ROUNDED_UP_GRANULES. Externally, we don't know whether */ /* DONT_ADD_BYTE_AT_END is set, but the client should know. */ /* Convert a free list index to the actual size of objects */ /* on that list, including extra space we added. Not an */ /* inverse of the above. */ #define RAW_BYTES_FROM_INDEX(i) ((i) * GC_GRANULE_BYTES) #endif /* GC_TINY_FL_H */ synopsis-0.12/src/Synopsis/gc/include/new_gc_alloc.h0000664000076400007640000003444511104702317022104 0ustar stefanstefan/* * Copyright (c) 1996-1998 by Silicon Graphics. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ // // This is a revision of gc_alloc.h for SGI STL versions > 3.0 // Unlike earlier versions, it supplements the standard "alloc.h" // instead of replacing it. // // This is sloppy about variable names used in header files. // It also doesn't yet understand the new header file names or // namespaces. // // This assumes the collector has been compiled with -DATOMIC_UNCOLLECTABLE. // The user should also consider -DREDIRECT_MALLOC=GC_uncollectable_malloc, // to ensure that object allocated through malloc are traced. // // Some of this could be faster in the explicit deallocation case. // In particular, we spend too much time clearing objects on the // free lists. That could be avoided. // // This uses template classes with static members, and hence does not work // with g++ 2.7.2 and earlier. // // Unlike its predecessor, this one simply defines // gc_alloc // single_client_gc_alloc // traceable_alloc // single_client_traceable_alloc // // It does not redefine alloc. Nor does it change the default allocator, // though the user may wish to do so. (The argument against changing // the default allocator is that it may introduce subtle link compatibility // problems. The argument for changing it is that the usual default // allocator is usually a very bad choice for a garbage collected environment.) // // This code assumes that the collector itself has been compiled with a // compiler that defines __STDC__ . // #ifndef GC_ALLOC_H #include "gc.h" #if (__GNUC__ < 3) # include // A more portable way to get stl_alloc.h . #else # include # ifndef __STL_BEGIN_NAMESPACE # define __STL_BEGIN_NAMESPACE namespace std { # define __STL_END_NAMESPACE }; # endif #ifndef __STL_USE_STD_ALLOCATORS #define __STL_USE_STD_ALLOCATORS #endif #endif /* A hack to deal with gcc 3.1. If you are using gcc3.1 and later, */ /* you should probably really use gc_allocator.h instead. */ #if defined (__GNUC__) && \ (__GNUC__ > 3 || (__GNUC__ == 3 && (__GNUC_MINOR__ >= 1))) # define simple_alloc __simple_alloc #endif #define GC_ALLOC_H #include #include // The following need to match collector data structures. // We can't include gc_priv.h, since that pulls in way too much stuff. // This should eventually be factored out into another include file. extern "C" { extern void ** const GC_objfreelist_ptr; extern void ** const GC_aobjfreelist_ptr; extern void ** const GC_uobjfreelist_ptr; extern void ** const GC_auobjfreelist_ptr; extern void GC_incr_bytes_allocd(size_t bytes); extern void GC_incr_mem_freed(size_t words); /* FIXME: use bytes */ extern char * GC_generic_malloc_words_small(size_t word, int kind); /* FIXME: Doesn't exist anymore. */ } // Object kinds; must match PTRFREE, NORMAL, UNCOLLECTABLE, and // AUNCOLLECTABLE in gc_priv.h. enum { GC_PTRFREE = 0, GC_NORMAL = 1, GC_UNCOLLECTABLE = 2, GC_AUNCOLLECTABLE = 3 }; enum { GC_max_fast_bytes = 255 }; enum { GC_bytes_per_word = sizeof(char *) }; enum { GC_byte_alignment = 8 }; enum { GC_word_alignment = GC_byte_alignment/GC_bytes_per_word }; inline void * &GC_obj_link(void * p) { return *reinterpret_cast(p); } // Compute a number of words >= n+1 bytes. // The +1 allows for pointers one past the end. inline size_t GC_round_up(size_t n) { return ((n + GC_byte_alignment)/GC_byte_alignment)*GC_word_alignment; } // The same but don't allow for extra byte. inline size_t GC_round_up_uncollectable(size_t n) { return ((n + GC_byte_alignment - 1)/GC_byte_alignment)*GC_word_alignment; } template class GC_aux_template { public: // File local count of allocated words. Occasionally this is // added into the global count. A separate count is necessary since the // real one must be updated with a procedure call. static size_t GC_bytes_recently_allocd; // Same for uncollectable mmory. Not yet reflected in either // GC_bytes_recently_allocd or GC_non_gc_bytes. static size_t GC_uncollectable_bytes_recently_allocd; // Similar counter for explicitly deallocated memory. static size_t GC_bytes_recently_freed; // Again for uncollectable memory. static size_t GC_uncollectable_bytes_recently_freed; static void * GC_out_of_line_malloc(size_t nwords, int kind); }; template size_t GC_aux_template::GC_bytes_recently_allocd = 0; template size_t GC_aux_template::GC_uncollectable_bytes_recently_allocd = 0; template size_t GC_aux_template::GC_bytes_recently_freed = 0; template size_t GC_aux_template::GC_uncollectable_bytes_recently_freed = 0; template void * GC_aux_template::GC_out_of_line_malloc(size_t nwords, int kind) { GC_bytes_recently_allocd += GC_uncollectable_bytes_recently_allocd; GC_non_gc_bytes += GC_uncollectable_bytes_recently_allocd; GC_uncollectable_bytes_recently_allocd = 0; GC_bytes_recently_freed += GC_uncollectable_bytes_recently_freed; GC_non_gc_bytes -= GC_uncollectable_bytes_recently_freed; GC_uncollectable_bytes_recently_freed = 0; GC_incr_bytes_allocd(GC_bytes_recently_allocd); GC_bytes_recently_allocd = 0; GC_incr_mem_freed(GC_bytes_per_word(GC_bytes_recently_freed)); GC_bytes_recently_freed = 0; return GC_generic_malloc_words_small(nwords, kind); } typedef GC_aux_template<0> GC_aux; // A fast, single-threaded, garbage-collected allocator // We assume the first word will be immediately overwritten. // In this version, deallocation is not a noop, and explicit // deallocation is likely to help performance. template class single_client_gc_alloc_template { public: static void * allocate(size_t n) { size_t nwords = GC_round_up(n); void ** flh; void * op; if (n > GC_max_fast_bytes) return GC_malloc(n); flh = GC_objfreelist_ptr + nwords; if (0 == (op = *flh)) { return GC_aux::GC_out_of_line_malloc(nwords, GC_NORMAL); } *flh = GC_obj_link(op); GC_aux::GC_bytes_recently_allocd += nwords * GC_bytes_per_word; return op; } static void * ptr_free_allocate(size_t n) { size_t nwords = GC_round_up(n); void ** flh; void * op; if (n > GC_max_fast_bytes) return GC_malloc_atomic(n); flh = GC_aobjfreelist_ptr + nwords; if (0 == (op = *flh)) { return GC_aux::GC_out_of_line_malloc(nwords, GC_PTRFREE); } *flh = GC_obj_link(op); GC_aux::GC_bytes_recently_allocd += nwords * GC_bytes_per_word; return op; } static void deallocate(void *p, size_t n) { size_t nwords = GC_round_up(n); void ** flh; if (n > GC_max_fast_bytes) { GC_free(p); } else { flh = GC_objfreelist_ptr + nwords; GC_obj_link(p) = *flh; memset(reinterpret_cast(p) + GC_bytes_per_word, 0, GC_bytes_per_word * (nwords - 1)); *flh = p; GC_aux::GC_bytes_recently_freed += nwords * GC_bytes_per_word; } } static void ptr_free_deallocate(void *p, size_t n) { size_t nwords = GC_round_up(n); void ** flh; if (n > GC_max_fast_bytes) { GC_free(p); } else { flh = GC_aobjfreelist_ptr + nwords; GC_obj_link(p) = *flh; *flh = p; GC_aux::GC_bytes_recently_freed += nwords * GC_bytes_per_word; } } }; typedef single_client_gc_alloc_template<0> single_client_gc_alloc; // Once more, for uncollectable objects. template class single_client_traceable_alloc_template { public: static void * allocate(size_t n) { size_t nwords = GC_round_up_uncollectable(n); void ** flh; void * op; if (n > GC_max_fast_bytes) return GC_malloc_uncollectable(n); flh = GC_uobjfreelist_ptr + nwords; if (0 == (op = *flh)) { return GC_aux::GC_out_of_line_malloc(nwords, GC_UNCOLLECTABLE); } *flh = GC_obj_link(op); GC_aux::GC_uncollectable_bytes_recently_allocd += nwords * GC_bytes_per_word; return op; } static void * ptr_free_allocate(size_t n) { size_t nwords = GC_round_up_uncollectable(n); void ** flh; void * op; if (n > GC_max_fast_bytes) return GC_malloc_atomic_uncollectable(n); flh = GC_auobjfreelist_ptr + nwords; if (0 == (op = *flh)) { return GC_aux::GC_out_of_line_malloc(nwords, GC_AUNCOLLECTABLE); } *flh = GC_obj_link(op); GC_aux::GC_uncollectable_bytes_recently_allocd += nwords * GC_bytes_per_word; return op; } static void deallocate(void *p, size_t n) { size_t nwords = GC_round_up_uncollectable(n); void ** flh; if (n > GC_max_fast_bytes) { GC_free(p); } else { flh = GC_uobjfreelist_ptr + nwords; GC_obj_link(p) = *flh; *flh = p; GC_aux::GC_uncollectable_bytes_recently_freed += nwords * GC_bytes_per_word; } } static void ptr_free_deallocate(void *p, size_t n) { size_t nwords = GC_round_up_uncollectable(n); void ** flh; if (n > GC_max_fast_bytes) { GC_free(p); } else { flh = GC_auobjfreelist_ptr + nwords; GC_obj_link(p) = *flh; *flh = p; GC_aux::GC_uncollectable_bytes_recently_freed += nwords * GC_bytes_per_word; } } }; typedef single_client_traceable_alloc_template<0> single_client_traceable_alloc; template < int dummy > class gc_alloc_template { public: static void * allocate(size_t n) { return GC_malloc(n); } static void * ptr_free_allocate(size_t n) { return GC_malloc_atomic(n); } static void deallocate(void *, size_t) { } static void ptr_free_deallocate(void *, size_t) { } }; typedef gc_alloc_template < 0 > gc_alloc; template < int dummy > class traceable_alloc_template { public: static void * allocate(size_t n) { return GC_malloc_uncollectable(n); } static void * ptr_free_allocate(size_t n) { return GC_malloc_atomic_uncollectable(n); } static void deallocate(void *p, size_t) { GC_free(p); } static void ptr_free_deallocate(void *p, size_t) { GC_free(p); } }; typedef traceable_alloc_template < 0 > traceable_alloc; // We want to specialize simple_alloc so that it does the right thing // for all pointerfree types. At the moment there is no portable way to // even approximate that. The following approximation should work for // SGI compilers, and recent versions of g++. # define __GC_SPECIALIZE(T,alloc) \ class simple_alloc { \ public: \ static T *allocate(size_t n) \ { return 0 == n? 0 : \ reinterpret_cast(alloc::ptr_free_allocate(n * sizeof (T))); } \ static T *allocate(void) \ { return reinterpret_cast(alloc::ptr_free_allocate(sizeof (T))); } \ static void deallocate(T *p, size_t n) \ { if (0 != n) alloc::ptr_free_deallocate(p, n * sizeof (T)); } \ static void deallocate(T *p) \ { alloc::ptr_free_deallocate(p, sizeof (T)); } \ }; __STL_BEGIN_NAMESPACE __GC_SPECIALIZE(char, gc_alloc) __GC_SPECIALIZE(int, gc_alloc) __GC_SPECIALIZE(unsigned, gc_alloc) __GC_SPECIALIZE(float, gc_alloc) __GC_SPECIALIZE(double, gc_alloc) __GC_SPECIALIZE(char, traceable_alloc) __GC_SPECIALIZE(int, traceable_alloc) __GC_SPECIALIZE(unsigned, traceable_alloc) __GC_SPECIALIZE(float, traceable_alloc) __GC_SPECIALIZE(double, traceable_alloc) __GC_SPECIALIZE(char, single_client_gc_alloc) __GC_SPECIALIZE(int, single_client_gc_alloc) __GC_SPECIALIZE(unsigned, single_client_gc_alloc) __GC_SPECIALIZE(float, single_client_gc_alloc) __GC_SPECIALIZE(double, single_client_gc_alloc) __GC_SPECIALIZE(char, single_client_traceable_alloc) __GC_SPECIALIZE(int, single_client_traceable_alloc) __GC_SPECIALIZE(unsigned, single_client_traceable_alloc) __GC_SPECIALIZE(float, single_client_traceable_alloc) __GC_SPECIALIZE(double, single_client_traceable_alloc) __STL_END_NAMESPACE #ifdef __STL_USE_STD_ALLOCATORS __STL_BEGIN_NAMESPACE template struct _Alloc_traits<_Tp, gc_alloc > { static const bool _S_instanceless = true; typedef simple_alloc<_Tp, gc_alloc > _Alloc_type; typedef __allocator<_Tp, gc_alloc > allocator_type; }; inline bool operator==(const gc_alloc&, const gc_alloc&) { return true; } inline bool operator!=(const gc_alloc&, const gc_alloc&) { return false; } template struct _Alloc_traits<_Tp, single_client_gc_alloc > { static const bool _S_instanceless = true; typedef simple_alloc<_Tp, single_client_gc_alloc > _Alloc_type; typedef __allocator<_Tp, single_client_gc_alloc > allocator_type; }; inline bool operator==(const single_client_gc_alloc&, const single_client_gc_alloc&) { return true; } inline bool operator!=(const single_client_gc_alloc&, const single_client_gc_alloc&) { return false; } template struct _Alloc_traits<_Tp, traceable_alloc > { static const bool _S_instanceless = true; typedef simple_alloc<_Tp, traceable_alloc > _Alloc_type; typedef __allocator<_Tp, traceable_alloc > allocator_type; }; inline bool operator==(const traceable_alloc&, const traceable_alloc&) { return true; } inline bool operator!=(const traceable_alloc&, const traceable_alloc&) { return false; } template struct _Alloc_traits<_Tp, single_client_traceable_alloc > { static const bool _S_instanceless = true; typedef simple_alloc<_Tp, single_client_traceable_alloc > _Alloc_type; typedef __allocator<_Tp, single_client_traceable_alloc > allocator_type; }; inline bool operator==(const single_client_traceable_alloc&, const single_client_traceable_alloc&) { return true; } inline bool operator!=(const single_client_traceable_alloc&, const single_client_traceable_alloc&) { return false; } __STL_END_NAMESPACE #endif /* __STL_USE_STD_ALLOCATORS */ #endif /* GC_ALLOC_H */ synopsis-0.12/src/Synopsis/gc/include/ec.h0000664000076400007640000000336211104702317020051 0ustar stefanstefan# ifndef EC_H # define EC_H # ifndef CORD_H # include "cord.h" # endif /* Extensible cords are strings that may be destructively appended to. */ /* They allow fast construction of cords from characters that are */ /* being read from a stream. */ /* * A client might look like: * * { * CORD_ec x; * CORD result; * char c; * FILE *f; * * ... * CORD_ec_init(x); * while(...) { * c = getc(f); * ... * CORD_ec_append(x, c); * } * result = CORD_balance(CORD_ec_to_cord(x)); * * If a C string is desired as the final result, the call to CORD_balance * may be replaced by a call to CORD_to_char_star. */ # ifndef CORD_BUFSZ # define CORD_BUFSZ 128 # endif typedef struct CORD_ec_struct { CORD ec_cord; char * ec_bufptr; char ec_buf[CORD_BUFSZ+1]; } CORD_ec[1]; /* This structure represents the concatenation of ec_cord with */ /* ec_buf[0 ... (ec_bufptr-ec_buf-1)] */ /* Flush the buffer part of the extended chord into ec_cord. */ /* Note that this is almost the only real function, and it is */ /* implemented in 6 lines in cordxtra.c */ void CORD_ec_flush_buf(CORD_ec x); /* Convert an extensible cord to a cord. */ # define CORD_ec_to_cord(x) (CORD_ec_flush_buf(x), (x)[0].ec_cord) /* Initialize an extensible cord. */ # define CORD_ec_init(x) ((x)[0].ec_cord = 0, (x)[0].ec_bufptr = (x)[0].ec_buf) /* Append a character to an extensible cord. */ # define CORD_ec_append(x, c) \ { \ if ((x)[0].ec_bufptr == (x)[0].ec_buf + CORD_BUFSZ) { \ CORD_ec_flush_buf(x); \ } \ *((x)[0].ec_bufptr)++ = (c); \ } /* Append a cord to an extensible cord. Structure remains shared with */ /* original. */ void CORD_ec_append_cord(CORD_ec x, CORD s); # endif /* EC_H */ synopsis-0.12/src/Synopsis/gc/include/leak_detector.h0000664000076400007640000000037611104702317022271 0ustar stefanstefan#define GC_DEBUG #include "gc.h" #define malloc(n) GC_MALLOC(n) #define calloc(m,n) GC_MALLOC((m)*(n)) #define free(p) GC_FREE(p) #define realloc(p,n) GC_REALLOC((p),(n)) #undef strdup #define strdup(s) GC_STRDUP((s)) #define CHECK_LEAKS() GC_gcollect() synopsis-0.12/src/Synopsis/gc/include/gc_allocator.h0000664000076400007640000001661711104702317022122 0ustar stefanstefan/* * Copyright (c) 1996-1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * Copyright (c) 2002 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /* * This implements standard-conforming allocators that interact with * the garbage collector. Gc_alloctor allocates garbage-collectable * objects of type T. Traceable_allocator allocates objects that * are not temselves garbage collected, but are scanned by the * collector for pointers to collectable objects. Traceable_alloc * should be used for explicitly managed STL containers that may * point to collectable objects. * * This code was derived from an earlier version of the GNU C++ standard * library, which itself was derived from the SGI STL implementation. */ #ifndef GC_ALLOCATOR_H #define GC_ALLOCATOR_H #include "gc.h" #include // for placement new #if defined(__GNUC__) # define GC_ATTR_UNUSED __attribute__((unused)) #else # define GC_ATTR_UNUSED #endif /* First some helpers to allow us to dispatch on whether or not a type * is known to be pointerfree. * These are private, except that the client may invoke the * GC_DECLARE_PTRFREE macro. */ struct GC_true_type {}; struct GC_false_type {}; template struct GC_type_traits { GC_false_type GC_is_ptr_free; }; # define GC_DECLARE_PTRFREE(T) \ template<> struct GC_type_traits { GC_true_type GC_is_ptr_free; } GC_DECLARE_PTRFREE(char); GC_DECLARE_PTRFREE(signed char); GC_DECLARE_PTRFREE(unsigned char); GC_DECLARE_PTRFREE(signed short); GC_DECLARE_PTRFREE(unsigned short); GC_DECLARE_PTRFREE(signed int); GC_DECLARE_PTRFREE(unsigned int); GC_DECLARE_PTRFREE(signed long); GC_DECLARE_PTRFREE(unsigned long); GC_DECLARE_PTRFREE(float); GC_DECLARE_PTRFREE(double); GC_DECLARE_PTRFREE(long double); /* The client may want to add others. */ // In the following GC_Tp is GC_true_type iff we are allocating a // pointerfree object. template inline void * GC_selective_alloc(size_t n, GC_Tp) { return GC_MALLOC(n); } template <> inline void * GC_selective_alloc(size_t n, GC_true_type) { return GC_MALLOC_ATOMIC(n); } /* Now the public gc_allocator class: */ template class gc_allocator { public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef GC_Tp* pointer; typedef const GC_Tp* const_pointer; typedef GC_Tp& reference; typedef const GC_Tp& const_reference; typedef GC_Tp value_type; template struct rebind { typedef gc_allocator other; }; gc_allocator() {} gc_allocator(const gc_allocator&) throw() {} # if !(GC_NO_MEMBER_TEMPLATES || 0 < _MSC_VER && _MSC_VER <= 1200) // MSVC++ 6.0 do not support member templates template gc_allocator(const gc_allocator&) throw() {} # endif ~gc_allocator() throw() {} pointer address(reference GC_x) const { return &GC_x; } const_pointer address(const_reference GC_x) const { return &GC_x; } // GC_n is permitted to be 0. The C++ standard says nothing about what // the return value is when GC_n == 0. GC_Tp* allocate(size_type GC_n, const void* = 0) { GC_type_traits traits; return static_cast (GC_selective_alloc(GC_n * sizeof(GC_Tp), traits.GC_is_ptr_free)); } // __p is not permitted to be a null pointer. void deallocate(pointer __p, size_type GC_ATTR_UNUSED GC_n) { GC_FREE(__p); } size_type max_size() const throw() { return size_t(-1) / sizeof(GC_Tp); } void construct(pointer __p, const GC_Tp& __val) { new(__p) GC_Tp(__val); } void destroy(pointer __p) { __p->~GC_Tp(); } }; template<> class gc_allocator { typedef size_t size_type; typedef ptrdiff_t difference_type; typedef void* pointer; typedef const void* const_pointer; typedef void value_type; template struct rebind { typedef gc_allocator other; }; }; template inline bool operator==(const gc_allocator&, const gc_allocator&) { return true; } template inline bool operator!=(const gc_allocator&, const gc_allocator&) { return false; } /* * And the public traceable_allocator class. */ // Note that we currently don't specialize the pointer-free case, since a // pointer-free traceable container doesn't make that much sense, // though it could become an issue due to abstraction boundaries. template class traceable_allocator { public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef GC_Tp* pointer; typedef const GC_Tp* const_pointer; typedef GC_Tp& reference; typedef const GC_Tp& const_reference; typedef GC_Tp value_type; template struct rebind { typedef traceable_allocator other; }; traceable_allocator() throw() {} traceable_allocator(const traceable_allocator&) throw() {} # if !(GC_NO_MEMBER_TEMPLATES || 0 < _MSC_VER && _MSC_VER <= 1200) // MSVC++ 6.0 do not support member templates template traceable_allocator (const traceable_allocator&) throw() {} # endif ~traceable_allocator() throw() {} pointer address(reference GC_x) const { return &GC_x; } const_pointer address(const_reference GC_x) const { return &GC_x; } // GC_n is permitted to be 0. The C++ standard says nothing about what // the return value is when GC_n == 0. GC_Tp* allocate(size_type GC_n, const void* = 0) { return static_cast(GC_MALLOC_UNCOLLECTABLE(GC_n * sizeof(GC_Tp))); } // __p is not permitted to be a null pointer. void deallocate(pointer __p, size_type GC_ATTR_UNUSED GC_n) { GC_FREE(__p); } size_type max_size() const throw() { return size_t(-1) / sizeof(GC_Tp); } void construct(pointer __p, const GC_Tp& __val) { new(__p) GC_Tp(__val); } void destroy(pointer __p) { __p->~GC_Tp(); } }; template<> class traceable_allocator { typedef size_t size_type; typedef ptrdiff_t difference_type; typedef void* pointer; typedef const void* const_pointer; typedef void value_type; template struct rebind { typedef traceable_allocator other; }; }; template inline bool operator==(const traceable_allocator&, const traceable_allocator&) { return true; } template inline bool operator!=(const traceable_allocator&, const traceable_allocator&) { return false; } #endif /* GC_ALLOCATOR_H */ synopsis-0.12/src/Synopsis/gc/include/weakpointer.h0000664000076400007640000002167511104702317022021 0ustar stefanstefan#ifndef _weakpointer_h_ #define _weakpointer_h_ /**************************************************************************** WeakPointer and CleanUp Copyright (c) 1991 by Xerox Corporation. All rights reserved. THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. Permission is hereby granted to copy this code for any purpose, provided the above notices are retained on all copies. Last modified on Mon Jul 17 18:16:01 PDT 1995 by ellis ****************************************************************************/ /**************************************************************************** WeakPointer A weak pointer is a pointer to a heap-allocated object that doesn't prevent the object from being garbage collected. Weak pointers can be used to track which objects haven't yet been reclaimed by the collector. A weak pointer is deactivated when the collector discovers its referent object is unreachable by normal pointers (reachability and deactivation are defined more precisely below). A deactivated weak pointer remains deactivated forever. ****************************************************************************/ template< class T > class WeakPointer { public: WeakPointer( T* t = 0 ) /* Constructs a weak pointer for *t. t may be null. It is an error if t is non-null and *t is not a collected object. */ {impl = _WeakPointer_New( t );} T* Pointer() /* wp.Pointer() returns a pointer to the referent object of wp or null if wp has been deactivated (because its referent object has been discovered unreachable by the collector). */ {return (T*) _WeakPointer_Pointer( this->impl );} int operator==( WeakPointer< T > wp2 ) /* Given weak pointers wp1 and wp2, if wp1 == wp2, then wp1 and wp2 refer to the same object. If wp1 != wp2, then either wp1 and wp2 don't refer to the same object, or if they do, one or both of them has been deactivated. (Note: If objects t1 and t2 are never made reachable by their clean-up functions, then WeakPointer(t1) == WeakPointer(t2) if and only t1 == t2.) */ {return _WeakPointer_Equal( this->impl, wp2.impl );} int Hash() /* Returns a hash code suitable for use by multiplicative- and division-based hash tables. If wp1 == wp2, then wp1.Hash() == wp2.Hash(). */ {return _WeakPointer_Hash( this->impl );} private: void* impl; }; /***************************************************************************** CleanUp A garbage-collected object can have an associated clean-up function that will be invoked some time after the collector discovers the object is unreachable via normal pointers. Clean-up functions can be used to release resources such as open-file handles or window handles when their containing objects become unreachable. If a C++ object has a non-empty explicit destructor (i.e. it contains programmer-written code), the destructor will be automatically registered as the object's initial clean-up function. There is no guarantee that the collector will detect every unreachable object (though it will find almost all of them). Clients should not rely on clean-up to cause some action to occur immediately -- clean-up is only a mechanism for improving resource usage. Every object with a clean-up function also has a clean-up queue. When the collector finds the object is unreachable, it enqueues it on its queue. The clean-up function is applied when the object is removed from the queue. By default, objects are enqueued on the garbage collector's queue, and the collector removes all objects from its queue after each collection. If a client supplies another queue for objects, it is his responsibility to remove objects (and cause their functions to be called) by polling it periodically. Clean-up queues allow clean-up functions accessing global data to synchronize with the main program. Garbage collection can occur at any time, and clean-ups invoked by the collector might access data in an inconsistent state. A client can control this by defining an explicit queue for objects and polling it at safe points. The following definitions are used by the specification below: Given a pointer t to a collected object, the base object BO(t) is the value returned by new when it created the object. (Because of multiple inheritance, t and BO(t) may not be the same address.) A weak pointer wp references an object *t if BO(wp.Pointer()) == BO(t). ***************************************************************************/ template< class T, class Data > class CleanUp { public: static void Set( T* t, void c( Data* d, T* t ), Data* d = 0 ) /* Sets the clean-up function of object BO(t) to be , replacing any previously defined clean-up function for BO(t); c and d can be null, but t cannot. Sets the clean-up queue for BO(t) to be the collector's queue. When t is removed from its clean-up queue, its clean-up will be applied by calling c(d, t). It is an error if *t is not a collected object. */ {_CleanUp_Set( t, c, d );} static void Call( T* t ) /* Sets the new clean-up function for BO(t) to be null and, if the old one is non-null, calls it immediately, even if BO(t) is still reachable. Deactivates any weak pointers to BO(t). */ {_CleanUp_Call( t );} class Queue {public: Queue() /* Constructs a new queue. */ {this->head = _CleanUp_Queue_NewHead();} void Set( T* t ) /* q.Set(t) sets the clean-up queue of BO(t) to be q. */ {_CleanUp_Queue_Set( this->head, t );} int Call() /* If q is non-empty, q.Call() removes the first object and calls its clean-up function; does nothing if q is empty. Returns true if there are more objects in the queue. */ {return _CleanUp_Queue_Call( this->head );} private: void* head; }; }; /********************************************************************** Reachability and Clean-up An object O is reachable if it can be reached via a non-empty path of normal pointers from the registers, stacks, global variables, or an object with a non-null clean-up function (including O itself), ignoring pointers from an object to itself. This definition of reachability ensures that if object B is accessible from object A (and not vice versa) and if both A and B have clean-up functions, then A will always be cleaned up before B. Note that as long as an object with a clean-up function is contained in a cycle of pointers, it will always be reachable and will never be cleaned up or collected. When the collector finds an unreachable object with a null clean-up function, it atomically deactivates all weak pointers referencing the object and recycles its storage. If object B is accessible from object A via a path of normal pointers, A will be discovered unreachable no later than B, and a weak pointer to A will be deactivated no later than a weak pointer to B. When the collector finds an unreachable object with a non-null clean-up function, the collector atomically deactivates all weak pointers referencing the object, redefines its clean-up function to be null, and enqueues it on its clean-up queue. The object then becomes reachable again and remains reachable at least until its clean-up function executes. The clean-up function is assured that its argument is the only accessible pointer to the object. Nothing prevents the function from redefining the object's clean-up function or making the object reachable again (for example, by storing the pointer in a global variable). If the clean-up function does not make its object reachable again and does not redefine its clean-up function, then the object will be collected by a subsequent collection (because the object remains unreachable and now has a null clean-up function). If the clean-up function does make its object reachable again and a clean-up function is subsequently redefined for the object, then the new clean-up function will be invoked the next time the collector finds the object unreachable. Note that a destructor for a collected object cannot safely redefine a clean-up function for its object, since after the destructor executes, the object has been destroyed into "raw memory". (In most implementations, destroying an object mutates its vtbl.) Finally, note that calling delete t on a collected object first deactivates any weak pointers to t and then invokes its clean-up function (destructor). **********************************************************************/ extern "C" { void* _WeakPointer_New( void* t ); void* _WeakPointer_Pointer( void* wp ); int _WeakPointer_Equal( void* wp1, void* wp2 ); int _WeakPointer_Hash( void* wp ); void _CleanUp_Set( void* t, void (*c)( void* d, void* t ), void* d ); void _CleanUp_Call( void* t ); void* _CleanUp_Queue_NewHead (); void _CleanUp_Queue_Set( void* h, void* t ); int _CleanUp_Queue_Call( void* h ); } #endif /* _weakpointer_h_ */ synopsis-0.12/src/Synopsis/gc/include/gc_cpp.h0000664000076400007640000003050311104702317020712 0ustar stefanstefan#ifndef GC_CPP_H #define GC_CPP_H /**************************************************************************** Copyright (c) 1994 by Xerox Corporation. All rights reserved. THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. Permission is hereby granted to use or copy this program for any purpose, provided the above notices are retained on all copies. Permission to modify the code and to distribute modified code is granted, provided the above notices are retained, and a notice that the code was modified is included with the above copyright notice. **************************************************************************** C++ Interface to the Boehm Collector John R. Ellis and Jesse Hull This interface provides access to the Boehm collector. It provides basic facilities similar to those described in "Safe, Efficient Garbage Collection for C++", by John R. Elis and David L. Detlefs (ftp://ftp.parc.xerox.com/pub/ellis/gc). All heap-allocated objects are either "collectable" or "uncollectable". Programs must explicitly delete uncollectable objects, whereas the garbage collector will automatically delete collectable objects when it discovers them to be inaccessible. Collectable objects may freely point at uncollectable objects and vice versa. Objects allocated with the built-in "::operator new" are uncollectable. Objects derived from class "gc" are collectable. For example: class A: public gc {...}; A* a = new A; // a is collectable. Collectable instances of non-class types can be allocated using the GC (or UseGC) placement: typedef int A[ 10 ]; A* a = new (GC) A; Uncollectable instances of classes derived from "gc" can be allocated using the NoGC placement: class A: public gc {...}; A* a = new (NoGC) A; // a is uncollectable. The new(PointerFreeGC) syntax allows the allocation of collectable objects that are not scanned by the collector. This useful if you are allocating compressed data, bitmaps, or network packets. (In the latter case, it may remove danger of unfriendly network packets intentionally containing values that cause spurious memory retention.) Both uncollectable and collectable objects can be explicitly deleted with "delete", which invokes an object's destructors and frees its storage immediately. A collectable object may have a clean-up function, which will be invoked when the collector discovers the object to be inaccessible. An object derived from "gc_cleanup" or containing a member derived from "gc_cleanup" has a default clean-up function that invokes the object's destructors. Explicit clean-up functions may be specified as an additional placement argument: A* a = ::new (GC, MyCleanup) A; An object is considered "accessible" by the collector if it can be reached by a path of pointers from static variables, automatic variables of active functions, or from some object with clean-up enabled; pointers from an object to itself are ignored. Thus, if objects A and B both have clean-up functions, and A points at B, B is considered accessible. After A's clean-up is invoked and its storage released, B will then become inaccessible and will have its clean-up invoked. If A points at B and B points to A, forming a cycle, then that's considered a storage leak, and neither will be collectable. See the interface gc.h for low-level facilities for handling such cycles of objects with clean-up. The collector cannot guarantee that it will find all inaccessible objects. In practice, it finds almost all of them. Cautions: 1. Be sure the collector has been augmented with "make c++" or "--enable-cplusplus". 2. If your compiler supports the new "operator new[]" syntax, then add -DGC_OPERATOR_NEW_ARRAY to the Makefile. If your compiler doesn't support "operator new[]", beware that an array of type T, where T is derived from "gc", may or may not be allocated as a collectable object (it depends on the compiler). Use the explicit GC placement to make the array collectable. For example: class A: public gc {...}; A* a1 = new A[ 10 ]; // collectable or uncollectable? A* a2 = new (GC) A[ 10 ]; // collectable 3. The destructors of collectable arrays of objects derived from "gc_cleanup" will not be invoked properly. For example: class A: public gc_cleanup {...}; A* a = new (GC) A[ 10 ]; // destructors not invoked correctly Typically, only the destructor for the first element of the array will be invoked when the array is garbage-collected. To get all the destructors of any array executed, you must supply an explicit clean-up function: A* a = new (GC, MyCleanUp) A[ 10 ]; (Implementing clean-up of arrays correctly, portably, and in a way that preserves the correct exception semantics requires a language extension, e.g. the "gc" keyword.) 4. Compiler bugs (now hopefully history): * Solaris 2's CC (SC3.0) doesn't implement t->~T() correctly, so the destructors of classes derived from gc_cleanup won't be invoked. You'll have to explicitly register a clean-up function with new-placement syntax. * Evidently cfront 3.0 does not allow destructors to be explicitly invoked using the ANSI-conforming syntax t->~T(). If you're using cfront 3.0, you'll have to comment out the class gc_cleanup, which uses explicit invocation. 5. GC name conflicts: Many other systems seem to use the identifier "GC" as an abbreviation for "Graphics Context". Since version 5.0, GC placement has been replaced by UseGC. GC is an alias for UseGC, unless GC_NAME_CONFLICT is defined. ****************************************************************************/ #include "gc.h" #ifndef THINK_CPLUS # define GC_cdecl #else # define GC_cdecl _cdecl #endif #if ! defined( GC_NO_OPERATOR_NEW_ARRAY ) \ && !defined(_ENABLE_ARRAYNEW) /* Digimars */ \ && (defined(__BORLANDC__) && (__BORLANDC__ < 0x450) \ || (defined(__GNUC__) && \ (__GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 6)) \ || (defined(__WATCOMC__) && __WATCOMC__ < 1050)) # define GC_NO_OPERATOR_NEW_ARRAY #endif #if !defined(GC_NO_OPERATOR_NEW_ARRAY) && !defined(GC_OPERATOR_NEW_ARRAY) # define GC_OPERATOR_NEW_ARRAY #endif #if ! defined ( __BORLANDC__ ) /* Confuses the Borland compiler. */ \ && ! defined ( __sgi ) # define GC_PLACEMENT_DELETE #endif enum GCPlacement {UseGC, #ifndef GC_NAME_CONFLICT GC=UseGC, #endif NoGC, PointerFreeGC}; class gc {public: inline void* operator new( size_t size ); inline void* operator new( size_t size, GCPlacement gcp ); inline void* operator new( size_t size, void *p ); /* Must be redefined here, since the other overloadings */ /* hide the global definition. */ inline void operator delete( void* obj ); # ifdef GC_PLACEMENT_DELETE inline void operator delete( void*, void* ); # endif #ifdef GC_OPERATOR_NEW_ARRAY inline void* operator new[]( size_t size ); inline void* operator new[]( size_t size, GCPlacement gcp ); inline void* operator new[]( size_t size, void *p ); inline void operator delete[]( void* obj ); # ifdef GC_PLACEMENT_DELETE inline void operator delete[]( void*, void* ); # endif #endif /* GC_OPERATOR_NEW_ARRAY */ }; /* Instances of classes derived from "gc" will be allocated in the collected heap by default, unless an explicit NoGC placement is specified. */ class gc_cleanup: virtual public gc {public: inline gc_cleanup(); inline virtual ~gc_cleanup(); private: inline static void GC_cdecl cleanup( void* obj, void* clientData );}; /* Instances of classes derived from "gc_cleanup" will be allocated in the collected heap by default. When the collector discovers an inaccessible object derived from "gc_cleanup" or containing a member derived from "gc_cleanup", its destructors will be invoked. */ extern "C" {typedef void (*GCCleanUpFunc)( void* obj, void* clientData );} #ifdef _MSC_VER // Disable warning that "no matching operator delete found; memory will // not be freed if initialization throws an exception" # pragma warning(disable:4291) #endif inline void* operator new( size_t size, GCPlacement gcp, GCCleanUpFunc cleanup = 0, void* clientData = 0 ); /* Allocates a collectable or uncollected object, according to the value of "gcp". For collectable objects, if "cleanup" is non-null, then when the allocated object "obj" becomes inaccessible, the collector will invoke the function "cleanup( obj, clientData )" but will not invoke the object's destructors. It is an error to explicitly delete an object allocated with a non-null "cleanup". It is an error to specify a non-null "cleanup" with NoGC or for classes derived from "gc_cleanup" or containing members derived from "gc_cleanup". */ #ifdef _MSC_VER /** This ensures that the system default operator new[] doesn't get * undefined, which is what seems to happen on VC++ 6 for some reason * if we define a multi-argument operator new[]. * There seems to be really redirect new in this environment without * including this everywhere. */ void *operator new[]( size_t size ); void operator delete[](void* obj); void* operator new( size_t size); void operator delete(void* obj); // This new operator is used by VC++ in case of Debug builds ! void* operator new( size_t size, int ,//nBlockUse, const char * szFileName, int nLine ); #endif /* _MSC_VER */ #ifdef GC_OPERATOR_NEW_ARRAY inline void* operator new[]( size_t size, GCPlacement gcp, GCCleanUpFunc cleanup = 0, void* clientData = 0 ); /* The operator new for arrays, identical to the above. */ #endif /* GC_OPERATOR_NEW_ARRAY */ /**************************************************************************** Inline implementation ****************************************************************************/ inline void* gc::operator new( size_t size ) { return GC_MALLOC( size );} inline void* gc::operator new( size_t size, GCPlacement gcp ) { if (gcp == UseGC) return GC_MALLOC( size ); else if (gcp == PointerFreeGC) return GC_MALLOC_ATOMIC( size ); else return GC_MALLOC_UNCOLLECTABLE( size );} inline void* gc::operator new( size_t size, void *p ) { return p;} inline void gc::operator delete( void* obj ) { GC_FREE( obj );} #ifdef GC_PLACEMENT_DELETE inline void gc::operator delete( void*, void* ) {} #endif #ifdef GC_OPERATOR_NEW_ARRAY inline void* gc::operator new[]( size_t size ) { return gc::operator new( size );} inline void* gc::operator new[]( size_t size, GCPlacement gcp ) { return gc::operator new( size, gcp );} inline void* gc::operator new[]( size_t size, void *p ) { return p;} inline void gc::operator delete[]( void* obj ) { gc::operator delete( obj );} #ifdef GC_PLACEMENT_DELETE inline void gc::operator delete[]( void*, void* ) {} #endif #endif /* GC_OPERATOR_NEW_ARRAY */ inline gc_cleanup::~gc_cleanup() { GC_register_finalizer_ignore_self( GC_base(this), 0, 0, 0, 0 );} inline void gc_cleanup::cleanup( void* obj, void* displ ) { ((gc_cleanup*) ((char*) obj + (ptrdiff_t) displ))->~gc_cleanup();} inline gc_cleanup::gc_cleanup() { GC_finalization_proc oldProc; void* oldData; void* base = GC_base( (void *) this ); if (0 != base) { // Don't call the debug version, since this is a real base address. GC_register_finalizer_ignore_self( base, (GC_finalization_proc)cleanup, (void*) ((char*) this - (char*) base), &oldProc, &oldData ); if (0 != oldProc) { GC_register_finalizer_ignore_self( base, oldProc, oldData, 0, 0 );}}} inline void* operator new( size_t size, GCPlacement gcp, GCCleanUpFunc cleanup, void* clientData ) { void* obj; if (gcp == UseGC) { obj = GC_MALLOC( size ); if (cleanup != 0) GC_REGISTER_FINALIZER_IGNORE_SELF( obj, cleanup, clientData, 0, 0 );} else if (gcp == PointerFreeGC) { obj = GC_MALLOC_ATOMIC( size );} else { obj = GC_MALLOC_UNCOLLECTABLE( size );}; return obj;} #ifdef GC_OPERATOR_NEW_ARRAY inline void* operator new[]( size_t size, GCPlacement gcp, GCCleanUpFunc cleanup, void* clientData ) { return ::operator new( size, gcp, cleanup, clientData );} #endif /* GC_OPERATOR_NEW_ARRAY */ #endif /* GC_CPP_H */ synopsis-0.12/src/Synopsis/gc/include/gc.h0000664000076400007640000014250311104702317020054 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved. * Copyright 1996-1999 by Silicon Graphics. All rights reserved. * Copyright 1999 by Hewlett-Packard Company. All rights reserved. * Copyright (C) 2007 Free Software Foundation, Inc * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* * Note that this defines a large number of tuning hooks, which can * safely be ignored in nearly all cases. For normal use it suffices * to call only GC_MALLOC and perhaps GC_REALLOC. * For better performance, also look at GC_MALLOC_ATOMIC, and * GC_enable_incremental. If you need an action to be performed * immediately before an object is collected, look at GC_register_finalizer. * If you are using Solaris threads, look at the end of this file. * Everything else is best ignored unless you encounter performance * problems. */ #ifndef _GC_H # define _GC_H # include "gc_config_macros.h" # ifdef __cplusplus extern "C" { # endif /* Define word and signed_word to be unsigned and signed types of the */ /* size as char * or void *. There seems to be no way to do this */ /* even semi-portably. The following is probably no better/worse */ /* than almost anything else. */ /* The ANSI standard suggests that size_t and ptr_diff_t might be */ /* better choices. But those had incorrect definitions on some older */ /* systems. Notably "typedef int size_t" is WRONG. */ #ifndef _WIN64 typedef unsigned long GC_word; typedef long GC_signed_word; #else /* Win64 isn't really supported yet, but this is the first step. And */ /* it might cause error messages to show up in more plausible places. */ /* This needs basetsd.h, which is included by windows.h. */ typedef unsigned long long GC_word; typedef long long GC_signed_word; #endif /* Public read-only variables */ GC_API GC_word GC_gc_no;/* Counter incremented per collection. */ /* Includes empty GCs at startup. */ GC_API int GC_parallel; /* GC is parallelized for performance on */ /* multiprocessors. Currently set only */ /* implicitly if collector is built with */ /* -DPARALLEL_MARK and if either: */ /* Env variable GC_NPROC is set to > 1, or */ /* GC_NPROC is not set and this is an MP. */ /* If GC_parallel is set, incremental */ /* collection is only partially functional, */ /* and may not be desirable. */ /* Public R/W variables */ GC_API void * (*GC_oom_fn) (size_t bytes_requested); /* When there is insufficient memory to satisfy */ /* an allocation request, we return */ /* (*GC_oom_fn)(). By default this just */ /* returns 0. */ /* If it returns, it must return 0 or a valid */ /* pointer to a previously allocated heap */ /* object. */ GC_API int GC_find_leak; /* Do not actually garbage collect, but simply */ /* report inaccessible memory that was not */ /* deallocated with GC_free. Initial value */ /* is determined by FIND_LEAK macro. */ GC_API int GC_all_interior_pointers; /* Arrange for pointers to object interiors to */ /* be recognized as valid. May not be changed */ /* after GC initialization. */ /* Initial value is determined by */ /* -DALL_INTERIOR_POINTERS. */ /* Unless DONT_ADD_BYTE_AT_END is defined, this */ /* also affects whether sizes are increased by */ /* at least a byte to allow "off the end" */ /* pointer recognition. */ /* MUST BE 0 or 1. */ GC_API int GC_finalize_on_demand; /* If nonzero, finalizers will only be run in */ /* response to an explicit GC_invoke_finalizers */ /* call. The default is determined by whether */ /* the FINALIZE_ON_DEMAND macro is defined */ /* when the collector is built. */ GC_API int GC_java_finalization; /* Mark objects reachable from finalizable */ /* objects in a separate postpass. This makes */ /* it a bit safer to use non-topologically- */ /* ordered finalization. Default value is */ /* determined by JAVA_FINALIZATION macro. */ /* Enables register_finalizer_unreachable to */ /* work correctly. */ GC_API void (* GC_finalizer_notifier)(void); /* Invoked by the collector when there are */ /* objects to be finalized. Invoked at most */ /* once per GC cycle. Never invoked unless */ /* GC_finalize_on_demand is set. */ /* Typically this will notify a finalization */ /* thread, which will call GC_invoke_finalizers */ /* in response. */ GC_API int GC_dont_gc; /* != 0 ==> Dont collect. In versions 6.2a1+, */ /* this overrides explicit GC_gcollect() calls. */ /* Used as a counter, so that nested enabling */ /* and disabling work correctly. Should */ /* normally be updated with GC_enable() and */ /* GC_disable() calls. */ /* Direct assignment to GC_dont_gc is */ /* deprecated. */ GC_API int GC_dont_expand; /* Dont expand heap unless explicitly requested */ /* or forced to. */ GC_API int GC_use_entire_heap; /* Causes the nonincremental collector to use the */ /* entire heap before collecting. This was the only */ /* option for GC versions < 5.0. This sometimes */ /* results in more large block fragmentation, since */ /* very larg blocks will tend to get broken up */ /* during each GC cycle. It is likely to result in a */ /* larger working set, but lower collection */ /* frequencies, and hence fewer instructions executed */ /* in the collector. */ GC_API int GC_full_freq; /* Number of partial collections between */ /* full collections. Matters only if */ /* GC_incremental is set. */ /* Full collections are also triggered if */ /* the collector detects a substantial */ /* increase in the number of in-use heap */ /* blocks. Values in the tens are now */ /* perfectly reasonable, unlike for */ /* earlier GC versions. */ GC_API GC_word GC_non_gc_bytes; /* Bytes not considered candidates for collection. */ /* Used only to control scheduling of collections. */ /* Updated by GC_malloc_uncollectable and GC_free. */ /* Wizards only. */ GC_API int GC_no_dls; /* Don't register dynamic library data segments. */ /* Wizards only. Should be used only if the */ /* application explicitly registers all roots. */ /* In Microsoft Windows environments, this will */ /* usually also prevent registration of the */ /* main data segment as part of the root set. */ GC_API GC_word GC_free_space_divisor; /* We try to make sure that we allocate at */ /* least N/GC_free_space_divisor bytes between */ /* collections, where N is twice the number */ /* of traced bytes, plus the number of untraced */ /* bytes (bytes in "atomic" objects), plus */ /* a rough estimate of the root set size. */ /* N approximates GC tracing work per GC. */ /* Initially, GC_free_space_divisor = 3. */ /* Increasing its value will use less space */ /* but more collection time. Decreasing it */ /* will appreciably decrease collection time */ /* at the expense of space. */ GC_API GC_word GC_max_retries; /* The maximum number of GCs attempted before */ /* reporting out of memory after heap */ /* expansion fails. Initially 0. */ GC_API char *GC_stackbottom; /* Cool end of user stack. */ /* May be set in the client prior to */ /* calling any GC_ routines. This */ /* avoids some overhead, and */ /* potentially some signals that can */ /* confuse debuggers. Otherwise the */ /* collector attempts to set it */ /* automatically. */ /* For multithreaded code, this is the */ /* cold end of the stack for the */ /* primordial thread. */ GC_API int GC_dont_precollect; /* Don't collect as part of */ /* initialization. Should be set only */ /* if the client wants a chance to */ /* manually initialize the root set */ /* before the first collection. */ /* Interferes with blacklisting. */ /* Wizards only. */ GC_API unsigned long GC_time_limit; /* If incremental collection is enabled, */ /* We try to terminate collections */ /* after this many milliseconds. Not a */ /* hard time bound. Setting this to */ /* GC_TIME_UNLIMITED will essentially */ /* disable incremental collection while */ /* leaving generational collection */ /* enabled. */ # define GC_TIME_UNLIMITED 999999 /* Setting GC_time_limit to this value */ /* will disable the "pause time exceeded"*/ /* tests. */ /* Public procedures */ /* Initialize the collector. This is only required when using thread-local * allocation, since unlike the regular allocation routines, GC_local_malloc * is not self-initializing. If you use GC_local_malloc you should arrange * to call this somehow (e.g. from a constructor) before doing any allocation. * For win32 threads, it needs to be called explicitly. */ GC_API void GC_init(void); /* * general purpose allocation routines, with roughly malloc calling conv. * The atomic versions promise that no relevant pointers are contained * in the object. The nonatomic versions guarantee that the new object * is cleared. GC_malloc_stubborn promises that no changes to the object * will occur after GC_end_stubborn_change has been called on the * result of GC_malloc_stubborn. GC_malloc_uncollectable allocates an object * that is scanned for pointers to collectable objects, but is not itself * collectable. The object is scanned even if it does not appear to * be reachable. GC_malloc_uncollectable and GC_free called on the resulting * object implicitly update GC_non_gc_bytes appropriately. * * Note that the GC_malloc_stubborn support is stubbed out by default * starting in 6.0. GC_malloc_stubborn is an alias for GC_malloc unless * the collector is built with STUBBORN_ALLOC defined. */ GC_API void * GC_malloc(size_t size_in_bytes); GC_API void * GC_malloc_atomic(size_t size_in_bytes); GC_API char * GC_strdup (const char *str); GC_API void * GC_malloc_uncollectable(size_t size_in_bytes); GC_API void * GC_malloc_stubborn(size_t size_in_bytes); /* The following is only defined if the library has been suitably */ /* compiled: */ GC_API void * GC_malloc_atomic_uncollectable(size_t size_in_bytes); /* Explicitly deallocate an object. Dangerous if used incorrectly. */ /* Requires a pointer to the base of an object. */ /* If the argument is stubborn, it should not be changeable when freed. */ /* An object should not be enable for finalization when it is */ /* explicitly deallocated. */ /* GC_free(0) is a no-op, as required by ANSI C for free. */ GC_API void GC_free(void * object_addr); /* * Stubborn objects may be changed only if the collector is explicitly informed. * The collector is implicitly informed of coming change when such * an object is first allocated. The following routines inform the * collector that an object will no longer be changed, or that it will * once again be changed. Only nonNIL pointer stores into the object * are considered to be changes. The argument to GC_end_stubborn_change * must be exacly the value returned by GC_malloc_stubborn or passed to * GC_change_stubborn. (In the second case it may be an interior pointer * within 512 bytes of the beginning of the objects.) * There is a performance penalty for allowing more than * one stubborn object to be changed at once, but it is acceptable to * do so. The same applies to dropping stubborn objects that are still * changeable. */ GC_API void GC_change_stubborn(void *); GC_API void GC_end_stubborn_change(void *); /* Return a pointer to the base (lowest address) of an object given */ /* a pointer to a location within the object. */ /* I.e. map an interior pointer to the corresponding bas pointer. */ /* Note that with debugging allocation, this returns a pointer to the */ /* actual base of the object, i.e. the debug information, not to */ /* the base of the user object. */ /* Return 0 if displaced_pointer doesn't point to within a valid */ /* object. */ /* Note that a deallocated object in the garbage collected heap */ /* may be considered valid, even if it has been deallocated with */ /* GC_free. */ GC_API void * GC_base(void * displaced_pointer); /* Given a pointer to the base of an object, return its size in bytes. */ /* The returned size may be slightly larger than what was originally */ /* requested. */ GC_API size_t GC_size(void * object_addr); /* For compatibility with C library. This is occasionally faster than */ /* a malloc followed by a bcopy. But if you rely on that, either here */ /* or with the standard C library, your code is broken. In my */ /* opinion, it shouldn't have been invented, but now we're stuck. -HB */ /* The resulting object has the same kind as the original. */ /* If the argument is stubborn, the result will have changes enabled. */ /* It is an error to have changes enabled for the original object. */ /* Follows ANSI comventions for NULL old_object. */ GC_API void * GC_realloc(void * old_object, size_t new_size_in_bytes); /* Explicitly increase the heap size. */ /* Returns 0 on failure, 1 on success. */ GC_API int GC_expand_hp(size_t number_of_bytes); /* Limit the heap size to n bytes. Useful when you're debugging, */ /* especially on systems that don't handle running out of memory well. */ /* n == 0 ==> unbounded. This is the default. */ GC_API void GC_set_max_heap_size(GC_word n); /* Inform the collector that a certain section of statically allocated */ /* memory contains no pointers to garbage collected memory. Thus it */ /* need not be scanned. This is sometimes important if the application */ /* maps large read/write files into the address space, which could be */ /* mistaken for dynamic library data segments on some systems. */ GC_API void GC_exclude_static_roots(void * low_address, void * high_address_plus_1); /* Clear the set of root segments. Wizards only. */ GC_API void GC_clear_roots(void); /* Add a root segment. Wizards only. */ GC_API void GC_add_roots(void * low_address, void * high_address_plus_1); /* Remove a root segment. Wizards only. */ GC_API void GC_remove_roots(void * low_address, void * high_address_plus_1); /* Add a displacement to the set of those considered valid by the */ /* collector. GC_register_displacement(n) means that if p was returned */ /* by GC_malloc, then (char *)p + n will be considered to be a valid */ /* pointer to p. N must be small and less than the size of p. */ /* (All pointers to the interior of objects from the stack are */ /* considered valid in any case. This applies to heap objects and */ /* static data.) */ /* Preferably, this should be called before any other GC procedures. */ /* Calling it later adds to the probability of excess memory */ /* retention. */ /* This is a no-op if the collector has recognition of */ /* arbitrary interior pointers enabled, which is now the default. */ GC_API void GC_register_displacement(size_t n); /* The following version should be used if any debugging allocation is */ /* being done. */ GC_API void GC_debug_register_displacement(size_t n); /* Explicitly trigger a full, world-stop collection. */ GC_API void GC_gcollect(void); /* Trigger a full world-stopped collection. Abort the collection if */ /* and when stop_func returns a nonzero value. Stop_func will be */ /* called frequently, and should be reasonably fast. This works even */ /* if virtual dirty bits, and hence incremental collection is not */ /* available for this architecture. Collections can be aborted faster */ /* than normal pause times for incremental collection. However, */ /* aborted collections do no useful work; the next collection needs */ /* to start from the beginning. */ /* Return 0 if the collection was aborted, 1 if it succeeded. */ typedef int (* GC_stop_func)(void); GC_API int GC_try_to_collect(GC_stop_func stop_func); /* Return the number of bytes in the heap. Excludes collector private */ /* data structures. Includes empty blocks and fragmentation loss. */ /* Includes some pages that were allocated but never written. */ GC_API size_t GC_get_heap_size(void); /* Return a lower bound on the number of free bytes in the heap. */ GC_API size_t GC_get_free_bytes(void); /* Return the number of bytes allocated since the last collection. */ GC_API size_t GC_get_bytes_since_gc(void); /* Return the total number of bytes allocated in this process. */ /* Never decreases, except due to wrapping. */ GC_API size_t GC_get_total_bytes(void); /* Disable garbage collection. Even GC_gcollect calls will be */ /* ineffective. */ GC_API void GC_disable(void); /* Reenable garbage collection. GC_disable() and GC_enable() calls */ /* nest. Garbage collection is enabled if the number of calls to both */ /* both functions is equal. */ GC_API void GC_enable(void); /* Enable incremental/generational collection. */ /* Not advisable unless dirty bits are */ /* available or most heap objects are */ /* pointerfree(atomic) or immutable. */ /* Don't use in leak finding mode. */ /* Ignored if GC_dont_gc is true. */ /* Only the generational piece of this is */ /* functional if GC_parallel is TRUE */ /* or if GC_time_limit is GC_TIME_UNLIMITED. */ /* Causes GC_local_gcj_malloc() to revert to */ /* locked allocation. Must be called */ /* before any GC_local_gcj_malloc() calls. */ /* For best performance, should be called as early as possible. */ /* On some platforms, calling it later may have adverse effects.*/ /* Safe to call before GC_INIT(). Includes a GC_init() call. */ GC_API void GC_enable_incremental(void); /* Does incremental mode write-protect pages? Returns zero or */ /* more of the following, or'ed together: */ #define GC_PROTECTS_POINTER_HEAP 1 /* May protect non-atomic objs. */ #define GC_PROTECTS_PTRFREE_HEAP 2 #define GC_PROTECTS_STATIC_DATA 4 /* Currently never. */ #define GC_PROTECTS_STACK 8 /* Probably impractical. */ #define GC_PROTECTS_NONE 0 GC_API int GC_incremental_protection_needs(void); /* Perform some garbage collection work, if appropriate. */ /* Return 0 if there is no more work to be done. */ /* Typically performs an amount of work corresponding roughly */ /* to marking from one page. May do more work if further */ /* progress requires it, e.g. if incremental collection is */ /* disabled. It is reasonable to call this in a wait loop */ /* until it returns 0. */ GC_API int GC_collect_a_little(void); /* Allocate an object of size lb bytes. The client guarantees that */ /* as long as the object is live, it will be referenced by a pointer */ /* that points to somewhere within the first 256 bytes of the object. */ /* (This should normally be declared volatile to prevent the compiler */ /* from invalidating this assertion.) This routine is only useful */ /* if a large array is being allocated. It reduces the chance of */ /* accidentally retaining such an array as a result of scanning an */ /* integer that happens to be an address inside the array. (Actually, */ /* it reduces the chance of the allocator not finding space for such */ /* an array, since it will try hard to avoid introducing such a false */ /* reference.) On a SunOS 4.X or MS Windows system this is recommended */ /* for arrays likely to be larger than 100K or so. For other systems, */ /* or if the collector is not configured to recognize all interior */ /* pointers, the threshold is normally much higher. */ GC_API void * GC_malloc_ignore_off_page(size_t lb); GC_API void * GC_malloc_atomic_ignore_off_page(size_t lb); #if defined(__sgi) && !defined(__GNUC__) && _COMPILER_VERSION >= 720 # define GC_ADD_CALLER # define GC_RETURN_ADDR (GC_word)__return_address #endif #if defined(__linux__) || defined(__GLIBC__) # include # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ && !defined(__ia64__) # ifndef GC_HAVE_BUILTIN_BACKTRACE # define GC_HAVE_BUILTIN_BACKTRACE # endif # endif # if defined(__i386__) || defined(__x86_64__) # define GC_CAN_SAVE_CALL_STACKS # endif #endif #if defined(_MSC_VER) && _MSC_VER >= 1200 /* version 12.0+ (MSVC 6.0+) */ \ && !defined(_AMD64_) # ifndef GC_HAVE_NO_BUILTIN_BACKTRACE # define GC_HAVE_BUILTIN_BACKTRACE # endif #endif #if defined(GC_HAVE_BUILTIN_BACKTRACE) && !defined(GC_CAN_SAVE_CALL_STACKS) # define GC_CAN_SAVE_CALL_STACKS #endif #if defined(__sparc__) # define GC_CAN_SAVE_CALL_STACKS #endif /* If we're on an a platform on which we can't save call stacks, but */ /* gcc is normally used, we go ahead and define GC_ADD_CALLER. */ /* We make this decision independent of whether gcc is actually being */ /* used, in order to keep the interface consistent, and allow mixing */ /* of compilers. */ /* This may also be desirable if it is possible but expensive to */ /* retrieve the call chain. */ #if (defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__) \ || defined(__FreeBSD__) || defined(__DragonFly__)) & !defined(GC_CAN_SAVE_CALL_STACKS) # define GC_ADD_CALLER # if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) /* gcc knows how to retrieve return address, but we don't know */ /* how to generate call stacks. */ # define GC_RETURN_ADDR (GC_word)__builtin_return_address(0) # else /* Just pass 0 for gcc compatibility. */ # define GC_RETURN_ADDR 0 # endif #endif #ifdef GC_ADD_CALLER # define GC_EXTRAS GC_RETURN_ADDR, __FILE__, __LINE__ # define GC_EXTRA_PARAMS GC_word ra, const char * s, int i #else # define GC_EXTRAS __FILE__, __LINE__ # define GC_EXTRA_PARAMS const char * s, int i #endif /* Debugging (annotated) allocation. GC_gcollect will check */ /* objects allocated in this way for overwrites, etc. */ GC_API void * GC_debug_malloc(size_t size_in_bytes, GC_EXTRA_PARAMS); GC_API void * GC_debug_malloc_atomic(size_t size_in_bytes, GC_EXTRA_PARAMS); GC_API char * GC_debug_strdup(const char *str, GC_EXTRA_PARAMS); GC_API void * GC_debug_malloc_uncollectable (size_t size_in_bytes, GC_EXTRA_PARAMS); GC_API void * GC_debug_malloc_stubborn (size_t size_in_bytes, GC_EXTRA_PARAMS); GC_API void * GC_debug_malloc_ignore_off_page (size_t size_in_bytes, GC_EXTRA_PARAMS); GC_API void * GC_debug_malloc_atomic_ignore_off_page (size_t size_in_bytes, GC_EXTRA_PARAMS); GC_API void GC_debug_free (void * object_addr); GC_API void * GC_debug_realloc (void * old_object, size_t new_size_in_bytes, GC_EXTRA_PARAMS); GC_API void GC_debug_change_stubborn(void *); GC_API void GC_debug_end_stubborn_change(void *); /* Routines that allocate objects with debug information (like the */ /* above), but just fill in dummy file and line number information. */ /* Thus they can serve as drop-in malloc/realloc replacements. This */ /* can be useful for two reasons: */ /* 1) It allows the collector to be built with DBG_HDRS_ALL defined */ /* even if some allocation calls come from 3rd party libraries */ /* that can't be recompiled. */ /* 2) On some platforms, the file and line information is redundant, */ /* since it can be reconstructed from a stack trace. On such */ /* platforms it may be more convenient not to recompile, e.g. for */ /* leak detection. This can be accomplished by instructing the */ /* linker to replace malloc/realloc with these. */ GC_API void * GC_debug_malloc_replacement (size_t size_in_bytes); GC_API void * GC_debug_realloc_replacement (void * object_addr, size_t size_in_bytes); # ifdef GC_DEBUG # define GC_MALLOC(sz) GC_debug_malloc(sz, GC_EXTRAS) # define GC_MALLOC_ATOMIC(sz) GC_debug_malloc_atomic(sz, GC_EXTRAS) # define GC_STRDUP(s) GC_debug_strdup((s), GC_EXTRAS) # define GC_MALLOC_UNCOLLECTABLE(sz) \ GC_debug_malloc_uncollectable(sz, GC_EXTRAS) # define GC_MALLOC_IGNORE_OFF_PAGE(sz) \ GC_debug_malloc_ignore_off_page(sz, GC_EXTRAS) # define GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE(sz) \ GC_debug_malloc_atomic_ignore_off_page(sz, GC_EXTRAS) # define GC_REALLOC(old, sz) GC_debug_realloc(old, sz, GC_EXTRAS) # define GC_FREE(p) GC_debug_free(p) # define GC_REGISTER_FINALIZER(p, f, d, of, od) \ GC_debug_register_finalizer(p, f, d, of, od) # define GC_REGISTER_FINALIZER_IGNORE_SELF(p, f, d, of, od) \ GC_debug_register_finalizer_ignore_self(p, f, d, of, od) # define GC_REGISTER_FINALIZER_NO_ORDER(p, f, d, of, od) \ GC_debug_register_finalizer_no_order(p, f, d, of, od) # define GC_REGISTER_FINALIZER_UNREACHABLE(p, f, d, of, od) \ GC_debug_register_finalizer_unreachable(p, f, d, of, od) # define GC_MALLOC_STUBBORN(sz) GC_debug_malloc_stubborn(sz, GC_EXTRAS); # define GC_CHANGE_STUBBORN(p) GC_debug_change_stubborn(p) # define GC_END_STUBBORN_CHANGE(p) GC_debug_end_stubborn_change(p) # define GC_GENERAL_REGISTER_DISAPPEARING_LINK(link, obj) \ GC_general_register_disappearing_link(link, GC_base(obj)) # define GC_REGISTER_DISPLACEMENT(n) GC_debug_register_displacement(n) # else # define GC_MALLOC(sz) GC_malloc(sz) # define GC_MALLOC_ATOMIC(sz) GC_malloc_atomic(sz) # define GC_STRDUP(s) GC_strdup(s) # define GC_MALLOC_UNCOLLECTABLE(sz) GC_malloc_uncollectable(sz) # define GC_MALLOC_IGNORE_OFF_PAGE(sz) \ GC_malloc_ignore_off_page(sz) # define GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE(sz) \ GC_malloc_atomic_ignore_off_page(sz) # define GC_REALLOC(old, sz) GC_realloc(old, sz) # define GC_FREE(p) GC_free(p) # define GC_REGISTER_FINALIZER(p, f, d, of, od) \ GC_register_finalizer(p, f, d, of, od) # define GC_REGISTER_FINALIZER_IGNORE_SELF(p, f, d, of, od) \ GC_register_finalizer_ignore_self(p, f, d, of, od) # define GC_REGISTER_FINALIZER_NO_ORDER(p, f, d, of, od) \ GC_register_finalizer_no_order(p, f, d, of, od) # define GC_REGISTER_FINALIZER_UNREACHABLE(p, f, d, of, od) \ GC_register_finalizer_unreachable(p, f, d, of, od) # define GC_MALLOC_STUBBORN(sz) GC_malloc_stubborn(sz) # define GC_CHANGE_STUBBORN(p) GC_change_stubborn(p) # define GC_END_STUBBORN_CHANGE(p) GC_end_stubborn_change(p) # define GC_GENERAL_REGISTER_DISAPPEARING_LINK(link, obj) \ GC_general_register_disappearing_link(link, obj) # define GC_REGISTER_DISPLACEMENT(n) GC_register_displacement(n) # endif /* The following are included because they are often convenient, and */ /* reduce the chance for a misspecifed size argument. But calls may */ /* expand to something syntactically incorrect if t is a complicated */ /* type expression. */ # define GC_NEW(t) (t *)GC_MALLOC(sizeof (t)) # define GC_NEW_ATOMIC(t) (t *)GC_MALLOC_ATOMIC(sizeof (t)) # define GC_NEW_STUBBORN(t) (t *)GC_MALLOC_STUBBORN(sizeof (t)) # define GC_NEW_UNCOLLECTABLE(t) (t *)GC_MALLOC_UNCOLLECTABLE(sizeof (t)) /* Finalization. Some of these primitives are grossly unsafe. */ /* The idea is to make them both cheap, and sufficient to build */ /* a safer layer, closer to Modula-3, Java, or PCedar finalization. */ /* The interface represents my conclusions from a long discussion */ /* with Alan Demers, Dan Greene, Carl Hauser, Barry Hayes, */ /* Christian Jacobi, and Russ Atkinson. It's not perfect, and */ /* probably nobody else agrees with it. Hans-J. Boehm 3/13/92 */ typedef void (*GC_finalization_proc) (void * obj, void * client_data); GC_API void GC_register_finalizer(void * obj, GC_finalization_proc fn, void * cd, GC_finalization_proc *ofn, void * *ocd); GC_API void GC_debug_register_finalizer (void * obj, GC_finalization_proc fn, void * cd, GC_finalization_proc *ofn, void * *ocd); /* When obj is no longer accessible, invoke */ /* (*fn)(obj, cd). If a and b are inaccessible, and */ /* a points to b (after disappearing links have been */ /* made to disappear), then only a will be */ /* finalized. (If this does not create any new */ /* pointers to b, then b will be finalized after the */ /* next collection.) Any finalizable object that */ /* is reachable from itself by following one or more */ /* pointers will not be finalized (or collected). */ /* Thus cycles involving finalizable objects should */ /* be avoided, or broken by disappearing links. */ /* All but the last finalizer registered for an object */ /* is ignored. */ /* Finalization may be removed by passing 0 as fn. */ /* Finalizers are implicitly unregistered just before */ /* they are invoked. */ /* The old finalizer and client data are stored in */ /* *ofn and *ocd. */ /* Fn is never invoked on an accessible object, */ /* provided hidden pointers are converted to real */ /* pointers only if the allocation lock is held, and */ /* such conversions are not performed by finalization */ /* routines. */ /* If GC_register_finalizer is aborted as a result of */ /* a signal, the object may be left with no */ /* finalization, even if neither the old nor new */ /* finalizer were NULL. */ /* Obj should be the nonNULL starting address of an */ /* object allocated by GC_malloc or friends. */ /* Note that any garbage collectable object referenced */ /* by cd will be considered accessible until the */ /* finalizer is invoked. */ /* Another versions of the above follow. It ignores */ /* self-cycles, i.e. pointers from a finalizable object to */ /* itself. There is a stylistic argument that this is wrong, */ /* but it's unavoidable for C++, since the compiler may */ /* silently introduce these. It's also benign in that specific */ /* case. And it helps if finalizable objects are split to */ /* avoid cycles. */ /* Note that cd will still be viewed as accessible, even if it */ /* refers to the object itself. */ GC_API void GC_register_finalizer_ignore_self (void * obj, GC_finalization_proc fn, void * cd, GC_finalization_proc *ofn, void * *ocd); GC_API void GC_debug_register_finalizer_ignore_self (void * obj, GC_finalization_proc fn, void * cd, GC_finalization_proc *ofn, void * *ocd); /* Another version of the above. It ignores all cycles. */ /* It should probably only be used by Java implementations. */ /* Note that cd will still be viewed as accessible, even if it */ /* refers to the object itself. */ GC_API void GC_register_finalizer_no_order (void * obj, GC_finalization_proc fn, void * cd, GC_finalization_proc *ofn, void * *ocd); GC_API void GC_debug_register_finalizer_no_order (void * obj, GC_finalization_proc fn, void * cd, GC_finalization_proc *ofn, void * *ocd); /* This is a special finalizer that is useful when an object's */ /* finalizer must be run when the object is known to be no */ /* longer reachable, not even from other finalizable objects. */ /* It behaves like "normal" finalization, except that the */ /* finalizer is not run while the object is reachable from */ /* other objects specifying unordered finalization. */ /* Effectively it allows an object referenced, possibly */ /* indirectly, from an unordered finalizable object to override */ /* the unordered finalization request. */ /* This can be used in combination with finalizer_no_order so */ /* as to release resources that must not be released while an */ /* object can still be brought back to life by other */ /* finalizers. */ /* Only works if GC_java_finalization is set. Probably only */ /* of interest when implementing a language that requires */ /* unordered finalization (e.g. Java, C#). */ GC_API void GC_register_finalizer_unreachable (void * obj, GC_finalization_proc fn, void * cd, GC_finalization_proc *ofn, void * *ocd); GC_API void GC_debug_register_finalizer_unreachable (void * obj, GC_finalization_proc fn, void * cd, GC_finalization_proc *ofn, void * *ocd); /* The following routine may be used to break cycles between */ /* finalizable objects, thus causing cyclic finalizable */ /* objects to be finalized in the correct order. Standard */ /* use involves calling GC_register_disappearing_link(&p), */ /* where p is a pointer that is not followed by finalization */ /* code, and should not be considered in determining */ /* finalization order. */ GC_API int GC_register_disappearing_link(void * * link ); /* Link should point to a field of a heap allocated */ /* object obj. *link will be cleared when obj is */ /* found to be inaccessible. This happens BEFORE any */ /* finalization code is invoked, and BEFORE any */ /* decisions about finalization order are made. */ /* This is useful in telling the finalizer that */ /* some pointers are not essential for proper */ /* finalization. This may avoid finalization cycles. */ /* Note that obj may be resurrected by another */ /* finalizer, and thus the clearing of *link may */ /* be visible to non-finalization code. */ /* There's an argument that an arbitrary action should */ /* be allowed here, instead of just clearing a pointer. */ /* But this causes problems if that action alters, or */ /* examines connectivity. */ /* Returns 1 if link was already registered, 0 */ /* otherwise. */ /* Only exists for backward compatibility. See below: */ GC_API int GC_general_register_disappearing_link (void * * link, void * obj); /* A slight generalization of the above. *link is */ /* cleared when obj first becomes inaccessible. This */ /* can be used to implement weak pointers easily and */ /* safely. Typically link will point to a location */ /* holding a disguised pointer to obj. (A pointer */ /* inside an "atomic" object is effectively */ /* disguised.) In this way soft */ /* pointers are broken before any object */ /* reachable from them are finalized. Each link */ /* May be registered only once, i.e. with one obj */ /* value. This was added after a long email discussion */ /* with John Ellis. */ /* Obj must be a pointer to the first word of an object */ /* we allocated. It is unsafe to explicitly deallocate */ /* the object containing link. Explicitly deallocating */ /* obj may or may not cause link to eventually be */ /* cleared. */ /* This can be used to implement certain types of */ /* weak pointers. Note however that this generally */ /* requires that thje allocation lock is held (see */ /* GC_call_with_allock_lock() below) when the disguised */ /* pointer is accessed. Otherwise a strong pointer */ /* could be recreated between the time the collector */ /* decides to reclaim the object and the link is */ /* cleared. */ GC_API int GC_unregister_disappearing_link (void * * link); /* Returns 0 if link was not actually registered. */ /* Undoes a registration by either of the above two */ /* routines. */ /* Returns !=0 if GC_invoke_finalizers has something to do. */ GC_API int GC_should_invoke_finalizers(void); GC_API int GC_invoke_finalizers(void); /* Run finalizers for all objects that are ready to */ /* be finalized. Return the number of finalizers */ /* that were run. Normally this is also called */ /* implicitly during some allocations. If */ /* GC-finalize_on_demand is nonzero, it must be called */ /* explicitly. */ /* Explicitly tell the collector that an object is reachable */ /* at a particular program point. This prevents the argument */ /* pointer from being optimized away, even it is otherwise no */ /* longer needed. It should have no visible effect in the */ /* absence of finalizers or disappearing links. But it may be */ /* needed to prevent finalizers from running while the */ /* associated external resource is still in use. */ /* The function is sometimes called keep_alive in other */ /* settings. */ # if defined(__GNUC__) && !defined(__INTEL_COMPILER) # define GC_reachable_here(ptr) \ __asm__ volatile(" " : : "X"(ptr) : "memory"); # else GC_API void GC_noop1(GC_word x); # define GC_reachable_here(ptr) GC_noop1((GC_word)(ptr)); #endif /* GC_set_warn_proc can be used to redirect or filter warning messages. */ /* p may not be a NULL pointer. */ typedef void (*GC_warn_proc) (char *msg, GC_word arg); GC_API GC_warn_proc GC_set_warn_proc(GC_warn_proc p); /* Returns old warning procedure. */ GC_API GC_word GC_set_free_space_divisor(GC_word value); /* Set free_space_divisor. See above for definition. */ /* Returns old value. */ /* The following is intended to be used by a higher level */ /* (e.g. Java-like) finalization facility. It is expected */ /* that finalization code will arrange for hidden pointers to */ /* disappear. Otherwise objects can be accessed after they */ /* have been collected. */ /* Note that putting pointers in atomic objects or in */ /* nonpointer slots of "typed" objects is equivalent to */ /* disguising them in this way, and may have other advantages. */ # if defined(I_HIDE_POINTERS) || defined(GC_I_HIDE_POINTERS) typedef GC_word GC_hidden_pointer; # define HIDE_POINTER(p) (~(GC_hidden_pointer)(p)) # define REVEAL_POINTER(p) ((void *)(HIDE_POINTER(p))) /* Converting a hidden pointer to a real pointer requires verifying */ /* that the object still exists. This involves acquiring the */ /* allocator lock to avoid a race with the collector. */ # endif /* I_HIDE_POINTERS */ typedef void * (*GC_fn_type) (void * client_data); GC_API void * GC_call_with_alloc_lock (GC_fn_type fn, void * client_data); /* These routines are intended to explicitly notify the collector */ /* of new threads. Often this is unnecessary because thread creation */ /* is implicitly intercepted by the collector, using header-file */ /* defines, or linker-based interception. In the long run the intent */ /* is to always make redundant registration safe. In the short run, */ /* this is being implemented a platform at a time. */ /* The interface is complicated by the fact that we probably will not */ /* ever be able to automatically determine the stack base for thread */ /* stacks on all platforms. */ /* Structure representing the base of a thread stack. On most */ /* platforms this contains just a single address. */ struct GC_stack_base { void * mem_base; /* Base of memory stack. */ # if defined(__ia64) || defined(__ia64__) void * reg_base; /* Base of separate register stack. */ # endif }; typedef void * (*GC_stack_base_func)(struct GC_stack_base *sb, void *arg); /* Call a function with a stack base structure corresponding to */ /* somewhere in the GC_call_with_stack_base frame. This often can */ /* be used to provide a sufficiently accurate stack base. And we */ /* implement it everywhere. */ void * GC_call_with_stack_base(GC_stack_base_func fn, void *arg); /* Register the current thread, with the indicated stack base, as */ /* a new thread whose stack(s) should be traced by the GC. If a */ /* platform does not implicitly do so, this must be called before a */ /* thread can allocate garbage collected memory, or assign pointers */ /* to the garbage collected heap. Once registered, a thread will be */ /* stopped during garbage collections. */ /* Return codes: */ #define GC_SUCCESS 0 #define GC_DUPLICATE 1 /* Was already registered. */ #define GC_NO_THREADS 2 /* No thread support in GC. */ #define GC_UNIMPLEMENTED 3 /* Not yet implemented on this platform. */ int GC_register_my_thread(struct GC_stack_base *); /* Unregister the current thread. The thread may no longer allocate */ /* garbage collected memory or manipulate pointers to the */ /* garbage collected heap after making this call. */ /* Specifically, if it wants to return or otherwise communicate a */ /* pointer to the garbage-collected heap to another thread, it must */ /* do this before calling GC_unregister_my_thread, most probably */ /* by saving it in a global data structure. */ int GC_unregister_my_thread(void); /* Attempt to fill in the GC_stack_base structure with the stack base */ /* for this thread. This appears to be required to implement anything */ /* like the JNI AttachCurrentThread in an environment in which new */ /* threads are not automatically registered with the collector. */ /* It is also unfortunately hard to implement well on many platforms. */ /* Returns GC_SUCCESS or GC_UNIMPLEMENTED. */ int GC_get_stack_base(struct GC_stack_base *); /* The following routines are primarily intended for use with a */ /* preprocessor which inserts calls to check C pointer arithmetic. */ /* They indicate failure by invoking the corresponding _print_proc. */ /* Check that p and q point to the same object. */ /* Fail conspicuously if they don't. */ /* Returns the first argument. */ /* Succeeds if neither p nor q points to the heap. */ /* May succeed if both p and q point to between heap objects. */ GC_API void * GC_same_obj (void * p, void * q); /* Checked pointer pre- and post- increment operations. Note that */ /* the second argument is in units of bytes, not multiples of the */ /* object size. This should either be invoked from a macro, or the */ /* call should be automatically generated. */ GC_API void * GC_pre_incr (void * *p, size_t how_much); GC_API void * GC_post_incr (void * *p, size_t how_much); /* Check that p is visible */ /* to the collector as a possibly pointer containing location. */ /* If it isn't fail conspicuously. */ /* Returns the argument in all cases. May erroneously succeed */ /* in hard cases. (This is intended for debugging use with */ /* untyped allocations. The idea is that it should be possible, though */ /* slow, to add such a call to all indirect pointer stores.) */ /* Currently useless for multithreaded worlds. */ GC_API void * GC_is_visible (void * p); /* Check that if p is a pointer to a heap page, then it points to */ /* a valid displacement within a heap object. */ /* Fail conspicuously if this property does not hold. */ /* Uninteresting with GC_all_interior_pointers. */ /* Always returns its argument. */ GC_API void * GC_is_valid_displacement (void * p); /* Explicitly dump the GC state. This is most often called from the */ /* debugger, or by setting the GC_DUMP_REGULARLY environment variable, */ /* but it may be useful to call it from client code during debugging. */ void GC_dump(void); /* Safer, but slow, pointer addition. Probably useful mainly with */ /* a preprocessor. Useful only for heap pointers. */ #ifdef GC_DEBUG # define GC_PTR_ADD3(x, n, type_of_result) \ ((type_of_result)GC_same_obj((x)+(n), (x))) # define GC_PRE_INCR3(x, n, type_of_result) \ ((type_of_result)GC_pre_incr(&(x), (n)*sizeof(*x)) # define GC_POST_INCR2(x, type_of_result) \ ((type_of_result)GC_post_incr(&(x), sizeof(*x)) # ifdef __GNUC__ # define GC_PTR_ADD(x, n) \ GC_PTR_ADD3(x, n, typeof(x)) # define GC_PRE_INCR(x, n) \ GC_PRE_INCR3(x, n, typeof(x)) # define GC_POST_INCR(x, n) \ GC_POST_INCR3(x, typeof(x)) # else /* We can't do this right without typeof, which ANSI */ /* decided was not sufficiently useful. Repeatedly */ /* mentioning the arguments seems too dangerous to be */ /* useful. So does not casting the result. */ # define GC_PTR_ADD(x, n) ((x)+(n)) # endif #else /* !GC_DEBUG */ # define GC_PTR_ADD3(x, n, type_of_result) ((x)+(n)) # define GC_PTR_ADD(x, n) ((x)+(n)) # define GC_PRE_INCR3(x, n, type_of_result) ((x) += (n)) # define GC_PRE_INCR(x, n) ((x) += (n)) # define GC_POST_INCR2(x, n, type_of_result) ((x)++) # define GC_POST_INCR(x, n) ((x)++) #endif /* Safer assignment of a pointer to a nonstack location. */ #ifdef GC_DEBUG # define GC_PTR_STORE(p, q) \ (*(void **)GC_is_visible(p) = GC_is_valid_displacement(q)) #else /* !GC_DEBUG */ # define GC_PTR_STORE(p, q) *((p) = (q)) #endif /* Functions called to report pointer checking errors */ GC_API void (*GC_same_obj_print_proc) (void * p, void * q); GC_API void (*GC_is_valid_displacement_print_proc) (void * p); GC_API void (*GC_is_visible_print_proc) (void * p); /* For pthread support, we generally need to intercept a number of */ /* thread library calls. We do that here by macro defining them. */ #if !defined(GC_USE_LD_WRAP) && \ (defined(GC_PTHREADS) || defined(GC_SOLARIS_THREADS)) # include "gc_pthread_redirects.h" #endif # if defined(PCR) || defined(GC_SOLARIS_THREADS) || \ defined(GC_PTHREADS) || defined(GC_WIN32_THREADS) /* Any flavor of threads. */ /* This returns a list of objects, linked through their first */ /* word. Its use can greatly reduce lock contention problems, since */ /* the allocation lock can be acquired and released many fewer times. */ /* It is used internally by gc_local_alloc.h, which provides a simpler */ /* programming interface on Linux. */ void * GC_malloc_many(size_t lb); #define GC_NEXT(p) (*(void * *)(p)) /* Retrieve the next element */ /* in returned list. */ extern void GC_thr_init(void); /* Needed for Solaris/X86 ?? */ #endif /* THREADS */ /* Register a callback to control the scanning of dynamic libraries. When the GC scans the static data of a dynamic library, it will first call a user-supplied routine with filename of the library and the address and length of the memory region. This routine should return nonzero if that region should be scanned. */ GC_API void GC_register_has_static_roots_callback (int (*callback)(const char *, void *, size_t)); #if defined(GC_WIN32_THREADS) && !defined(__CYGWIN32__) \ && !defined(__CYGWIN__) \ && !defined(GC_PTHREADS) #ifdef __cplusplus } /* Including windows.h in an extern "C" context no longer works. */ #endif # include #ifdef __cplusplus extern "C" { #endif /* * All threads must be created using GC_CreateThread or GC_beginthreadex, * or must explicitly call GC_register_my_thread, * so that they will be recorded in the thread table. * For backwards compatibility, it is possible to build the GC * with GC_DLL defined, and to call GC_use_DllMain(). * This implicitly registers all created threads, but appears to be * less robust. * * Currently the collector expects all threads to fall through and * terminate normally, or call GC_endthreadex() or GC_ExitThread, * so that the thread is properly unregistered. (An explicit call * to GC_unregister_my_thread() should also work, but risks unregistering * the thread twice.) */ GC_API HANDLE WINAPI GC_CreateThread( LPSECURITY_ATTRIBUTES lpThreadAttributes, DWORD dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId ); GC_API uintptr_t GC_beginthreadex( void *security, unsigned stack_size, unsigned ( __stdcall *start_address )( void * ), void *arglist, unsigned initflag, unsigned *thrdaddr); GC_API void GC_endthreadex(unsigned retval); GC_API void WINAPI GC_ExitThread(DWORD dwExitCode); # if defined(_WIN32_WCE) /* * win32_threads.c implements the real WinMain, which will start a new thread * to call GC_WinMain after initializing the garbage collector. */ GC_API int WINAPI GC_WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow ); # ifndef GC_BUILD # define WinMain GC_WinMain # endif # endif /* defined(_WIN32_WCE) */ /* * Use implicit thread registration via DllMain. */ GC_API void GC_use_DllMain(void); # define CreateThread GC_CreateThread # define ExitThread GC_ExitThread # define _beginthreadex GC_beginthreadex # define _endthreadex GC_endthreadex # define _beginthread { > "Please use _beginthreadex instead of _beginthread" < } #endif /* defined(GC_WIN32_THREADS) && !cygwin */ /* * Fully portable code should call GC_INIT() from the main program * before making any other GC_ calls. On most platforms this is a * no-op and the collector self-initializes. But a number of platforms * make that too hard. * A GC_INIT call is required if the collector is built with THREAD_LOCAL_ALLOC * defined and the initial allocation call is not to GC_malloc(). */ #if defined(__CYGWIN32__) || defined (_AIX) /* * Similarly gnu-win32 DLLs need explicit initialization from * the main program, as does AIX. */ # ifdef __CYGWIN32__ extern int _data_start__[]; extern int _data_end__[]; extern int _bss_start__[]; extern int _bss_end__[]; # define GC_MAX(x,y) ((x) > (y) ? (x) : (y)) # define GC_MIN(x,y) ((x) < (y) ? (x) : (y)) # define GC_DATASTART ((void *) GC_MIN(_data_start__, _bss_start__)) # define GC_DATAEND ((void *) GC_MAX(_data_end__, _bss_end__)) # if defined(GC_DLL) # define GC_INIT() { GC_add_roots(GC_DATASTART, GC_DATAEND); \ GC_gcollect(); /* For blacklisting. */} # else /* Main program init not required */ # define GC_INIT() { GC_init(); } # endif # endif # if defined(_AIX) extern int _data[], _end[]; # define GC_DATASTART ((void *)((ulong)_data)) # define GC_DATAEND ((void *)((ulong)_end)) # define GC_INIT() { GC_add_roots(GC_DATASTART, GC_DATAEND); } # endif #else # define GC_INIT() { GC_init(); } #endif #if !defined(_WIN32_WCE) \ && ((defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \ || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)) /* win32S may not free all resources on process exit. */ /* This explicitly deallocates the heap. */ GC_API void GC_win32_free_heap (); #endif #if ( defined(_AMIGA) && !defined(GC_AMIGA_MAKINGLIB) ) /* Allocation really goes through GC_amiga_allocwrapper_do */ # include "gc_amiga_redirects.h" #endif #if defined(GC_REDIRECT_TO_LOCAL) && !defined(GC_LOCAL_ALLOC_H) # include "gc_local_alloc.h" #endif #ifdef __cplusplus } /* end of extern "C" */ #endif #endif /* _GC_H */ synopsis-0.12/src/Synopsis/gc/include/include.am0000664000076400007640000000311511104702317021247 0ustar stefanstefan# # # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED # OR IMPLIED. ANY USE IS AT YOUR OWN RISK. # # Permission is hereby granted to use or copy this program # for any purpose, provided the above notices are retained on all copies. # Permission to modify the code and to distribute modified code is granted, # provided the above notices are retained, and a notice that the code was # modified is included with the above copyright notice. # # Modified by: Grzegorz Jakacki # Modified by: Petter Urkedal ## Process this file with automake to produce part of Makefile.in. # installed headers # pkginclude_HEADERS += \ include/gc.h \ include/gc_typed.h \ include/gc_inline.h \ include/gc_mark.h \ include/gc_cpp.h \ include/weakpointer.h \ include/new_gc_alloc.h \ include/gc_allocator.h \ include/gc_backptr.h \ include/gc_gcj.h \ include/leak_detector.h \ include/gc_amiga_redirects.h \ include/gc_pthread_redirects.h \ include/gc_config_macros.h \ include/gc_tiny_fl.h # headers which are not installed # dist_noinst_HEADERS += \ include/private/gc_hdrs.h \ include/private/gc_priv.h \ include/private/gcconfig.h \ include/private/gc_pmark.h \ include/private/gc_locks.h \ include/private/dbg_mlc.h \ include/private/specific.h \ include/private/cord_pos.h \ include/private/pthread_support.h \ include/private/pthread_stop_world.h \ include/private/darwin_semaphore.h \ include/private/darwin_stop_world.h \ include/private/thread_local_alloc.h \ include/cord.h \ include/ec.h \ include/javaxfc.h synopsis-0.12/src/Synopsis/gc/include/gc_gcj.h0000664000076400007640000000745411104702317020704 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved. * Copyright 1996-1999 by Silicon Graphics. All rights reserved. * Copyright 1999 by Hewlett-Packard Company. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* This file assumes the collector has been compiled with GC_GCJ_SUPPORT */ /* and that an ANSI C compiler is available. */ /* * We allocate objects whose first word contains a pointer to a struct * describing the object type. This struct contains a garbage collector mark * descriptor at offset MARK_DESCR_OFFSET. Alternatively, the objects * may be marked by the mark procedure passed to GC_init_gcj_malloc. */ #ifndef GC_GCJ_H #define GC_GCJ_H #ifndef MARK_DESCR_OFFSET # define MARK_DESCR_OFFSET sizeof(word) #endif /* Gcj keeps GC descriptor as second word of vtable. This */ /* probably needs to be adjusted for other clients. */ /* We currently assume that this offset is such that: */ /* - all objects of this kind are large enough to have */ /* a value at that offset, and */ /* - it is not zero. */ /* These assumptions allow objects on the free list to be */ /* marked normally. */ #ifndef _GC_H # include "gc.h" #endif /* The following allocators signal an out of memory condition with */ /* return GC_oom_fn(bytes); */ /* The following function must be called before the gcj allocators */ /* can be invoked. */ /* mp_index and mp are the index and mark_proc (see gc_mark.h) */ /* respectively for the allocated objects. Mark_proc will be */ /* used to build the descriptor for objects allocated through the */ /* debugging interface. The mark_proc will be invoked on all such */ /* objects with an "environment" value of 1. The client may choose */ /* to use the same mark_proc for some of its generated mark descriptors.*/ /* In that case, it should use a different "environment" value to */ /* detect the presence or absence of the debug header. */ /* Mp is really of type mark_proc, as defined in gc_mark.h. We don't */ /* want to include that here for namespace pollution reasons. */ extern void GC_init_gcj_malloc(int mp_index, void * /* really mark_proc */mp); /* Allocate an object, clear it, and store the pointer to the */ /* type structure (vtable in gcj). */ /* This adds a byte at the end of the object if GC_malloc would.*/ extern void * GC_gcj_malloc(size_t lb, void * ptr_to_struct_containing_descr); /* The debug versions allocate such that the specified mark_proc */ /* is always invoked. */ extern void * GC_debug_gcj_malloc(size_t lb, void * ptr_to_struct_containing_descr, GC_EXTRA_PARAMS); /* Similar to GC_gcj_malloc, but assumes that a pointer to near the */ /* beginning of the resulting object is always maintained. */ extern void * GC_gcj_malloc_ignore_off_page(size_t lb, void * ptr_to_struct_containing_descr); /* The kind numbers of normal and debug gcj objects. */ /* Useful only for debug support, we hope. */ extern int GC_gcj_kind; extern int GC_gcj_debug_kind; # ifdef GC_DEBUG # define GC_GCJ_MALLOC(s,d) GC_debug_gcj_malloc(s,d,GC_EXTRAS) # define GC_GCJ_MALLOC_IGNORE_OFF_PAGE(s,d) GC_debug_gcj_malloc(s,d,GC_EXTRAS) # else # define GC_GCJ_MALLOC(s,d) GC_gcj_malloc(s,d) # define GC_GCJ_MALLOC_IGNORE_OFF_PAGE(s,d) \ GC_gcj_malloc_ignore_off_page(s,d) # endif #endif /* GC_GCJ_H */ synopsis-0.12/src/Synopsis/gc/include/gc_typed.h0000664000076400007640000001060211104702317021253 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright 1996 Silicon Graphics. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* * Some simple primitives for allocation with explicit type information. * Facilities for dynamic type inference may be added later. * Should be used only for extremely performance critical applications, * or if conservative collector leakage is otherwise a problem (unlikely). * Note that this is implemented completely separately from the rest * of the collector, and is not linked in unless referenced. * This does not currently support GC_DEBUG in any interesting way. */ /* Boehm, May 19, 1994 2:13 pm PDT */ #ifndef _GC_TYPED_H # define _GC_TYPED_H # ifndef _GC_H # include "gc.h" # endif #ifdef __cplusplus extern "C" { #endif typedef GC_word * GC_bitmap; /* The least significant bit of the first word is one if */ /* the first word in the object may be a pointer. */ # define GC_WORDSZ (8*sizeof(GC_word)) # define GC_get_bit(bm, index) \ (((bm)[index/GC_WORDSZ] >> (index%GC_WORDSZ)) & 1) # define GC_set_bit(bm, index) \ (bm)[index/GC_WORDSZ] |= ((GC_word)1 << (index%GC_WORDSZ)) # define GC_WORD_OFFSET(t, f) (offsetof(t,f)/sizeof(GC_word)) # define GC_WORD_LEN(t) (sizeof(t)/ sizeof(GC_word)) # define GC_BITMAP_SIZE(t) ((GC_WORD_LEN(t) + GC_WORDSZ-1)/GC_WORDSZ) typedef GC_word GC_descr; GC_API GC_descr GC_make_descriptor(GC_bitmap bm, size_t len); /* Return a type descriptor for the object whose layout */ /* is described by the argument. */ /* The least significant bit of the first word is one */ /* if the first word in the object may be a pointer. */ /* The second argument specifies the number of */ /* meaningful bits in the bitmap. The actual object */ /* may be larger (but not smaller). Any additional */ /* words in the object are assumed not to contain */ /* pointers. */ /* Returns a conservative approximation in the */ /* (unlikely) case of insufficient memory to build */ /* the descriptor. Calls to GC_make_descriptor */ /* may consume some amount of a finite resource. This */ /* is intended to be called once per type, not once */ /* per allocation. */ /* It is possible to generate a descriptor for a C type T with */ /* word aligned pointer fields f1, f2, ... as follows: */ /* */ /* GC_descr T_descr; */ /* GC_word T_bitmap[GC_BITMAP_SIZE(T)] = {0}; */ /* GC_set_bit(T_bitmap, GC_WORD_OFFSET(T,f1)); */ /* GC_set_bit(T_bitmap, GC_WORD_OFFSET(T,f2)); */ /* ... */ /* T_descr = GC_make_descriptor(T_bitmap, GC_WORD_LEN(T)); */ GC_API void * GC_malloc_explicitly_typed(size_t size_in_bytes, GC_descr d); /* Allocate an object whose layout is described by d. */ /* The resulting object MAY NOT BE PASSED TO REALLOC. */ /* The returned object is cleared. */ GC_API void * GC_malloc_explicitly_typed_ignore_off_page (size_t size_in_bytes, GC_descr d); GC_API void * GC_calloc_explicitly_typed(size_t nelements, size_t element_size_in_bytes, GC_descr d); /* Allocate an array of nelements elements, each of the */ /* given size, and with the given descriptor. */ /* The elemnt size must be a multiple of the byte */ /* alignment required for pointers. E.g. on a 32-bit */ /* machine with 16-bit aligned pointers, size_in_bytes */ /* must be a multiple of 2. */ /* Returned object is cleared. */ #ifdef GC_DEBUG # define GC_MALLOC_EXPLICITLY_TYPED(bytes, d) GC_MALLOC(bytes) # define GC_CALLOC_EXPLICITLY_TYPED(n, bytes, d) GC_MALLOC(n*bytes) #else # define GC_MALLOC_EXPLICITLY_TYPED(bytes, d) \ GC_malloc_explicitly_typed(bytes, d) # define GC_CALLOC_EXPLICITLY_TYPED(n, bytes, d) \ GC_calloc_explicitly_typed(n, bytes, d) #endif /* !GC_DEBUG */ #ifdef __cplusplus } /* matches extern "C" */ #endif #endif /* _GC_TYPED_H */ synopsis-0.12/src/Synopsis/gc/include/javaxfc.h0000664000076400007640000000137111104702317021102 0ustar stefanstefan# ifndef GC_H # include "gc.h" # endif /* * Invoke all remaining finalizers that haven't yet been run. * This is needed for strict compliance with the Java standard, * which can make the runtime guarantee that all finalizers are run. * This is problematic for several reasons: * 1) It means that finalizers, and all methods calle by them, * must be prepared to deal with objects that have been finalized in * spite of the fact that they are still referenced by statically * allocated pointer variables. * 1) It may mean that we get stuck in an infinite loop running * finalizers which create new finalizable objects, though that's * probably unlikely. * Thus this is not recommended for general use. */ void GC_finalize_all(); synopsis-0.12/src/Synopsis/gc/gcname.c0000664000076400007640000000042311104702321017252 0ustar stefanstefan#include #include "version.h" int main() { if (GC_ALPHA_VERSION == GC_NOT_ALPHA) { printf("gc%d.%d", GC_VERSION_MAJOR, GC_VERSION_MINOR); } else { printf("gc%d.%dalpha%d", GC_VERSION_MAJOR, GC_VERSION_MINOR, GC_ALPHA_VERSION); } return 0; } synopsis-0.12/src/Synopsis/gc/aclocal.m40000664000076400007640000010475511126175473017551 0ustar stefanstefan# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(AC_AUTOCONF_VERSION, [2.61],, [m4_warning([this file was generated for autoconf 2.61. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.10' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.10.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.10.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) # Figure out how to run the assembler. -*- Autoconf -*- # Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_PROG_AS # ---------- AC_DEFUN([AM_PROG_AS], [# By default we simply use the C compiler to build assembly code. AC_REQUIRE([AC_PROG_CC]) test "${CCAS+set}" = set || CCAS=$CC test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS AC_ARG_VAR([CCAS], [assembler compiler command (defaults to CC)]) AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)]) _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl ]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 13 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.60])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) ]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996, 1998, 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 4 AC_DEFUN([AM_MAINTAINER_MODE], [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode is disabled by default AC_ARG_ENABLE(maintainer-mode, [ --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer], USE_MAINTAINER_MODE=$enableval, USE_MAINTAINER_MODE=no) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST(MAINT)dnl ] ) AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_PROG_CC_C_O # -------------- # Like AC_PROG_CC_C_O, but changed for automake. AC_DEFUN([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC_C_O])dnl AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi dnl Make sure AC_PROG_CC is never called again, or it will override our dnl setting of CC. m4_define([AC_PROG_CC], [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([acinclude.m4]) synopsis-0.12/src/Synopsis/gc/gc_cpp.cc0000664000076400007640000000374411104702316017433 0ustar stefanstefan/************************************************************************* Copyright (c) 1994 by Xerox Corporation. All rights reserved. THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. Last modified on Sat Nov 19 19:31:14 PST 1994 by ellis on Sat Jun 8 15:10:00 PST 1994 by boehm Permission is hereby granted to copy this code for any purpose, provided the above notices are retained on all copies. This implementation module for gc_c++.h provides an implementation of the global operators "new" and "delete" that calls the Boehm allocator. All objects allocated by this implementation will be non-collectable but part of the root set of the collector. You should ensure (using implementation-dependent techniques) that the linker finds this module before the library that defines the default built-in "new" and "delete". Authors: John R. Ellis and Jesse Hull **************************************************************************/ /* Boehm, December 20, 1994 7:26 pm PST */ #include "gc_cpp.h" void* operator new( size_t size ) { return GC_MALLOC_UNCOLLECTABLE( size );} void operator delete( void* obj ) { GC_FREE( obj );} #ifdef GC_OPERATOR_NEW_ARRAY void* operator new[]( size_t size ) { return GC_MALLOC_UNCOLLECTABLE( size );} void operator delete[]( void* obj ) { GC_FREE( obj );} #endif /* GC_OPERATOR_NEW_ARRAY */ #ifdef _MSC_VER // This new operator is used by VC++ in case of Debug builds ! void* operator new( size_t size, int ,//nBlockUse, const char * szFileName, int nLine ) { #ifndef GC_DEBUG return GC_malloc_uncollectable( size ); #else return GC_debug_malloc_uncollectable(size, szFileName, nLine); #endif } // This new operator is used by VC++ 7.0 and later in Debug builds. void* operator new[](size_t size, int nBlockUse, const char* szFileName, int nLine) { return operator new(size, nBlockUse, szFileName, nLine); } #endif /* _MSC_VER */ synopsis-0.12/src/Synopsis/gc/threadlibs.c0000664000076400007640000000342411104702316020151 0ustar stefanstefan# include "gc_config_macros.h" # include "private/gcconfig.h" # include int main() { # if defined(GC_USE_LD_WRAP) printf("-Wl,--wrap -Wl,dlopen " "-Wl,--wrap -Wl,pthread_create -Wl,--wrap -Wl,pthread_join " "-Wl,--wrap -Wl,pthread_detach " "-Wl,--wrap -Wl,pthread_sigmask -Wl,--wrap -Wl,sleep\n"); # endif # if defined(GC_LINUX_THREADS) || defined(GC_IRIX_THREADS) \ || defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS) \ || defined(GC_GNU_THREADS) # ifdef GC_USE_DLOPEN_WRAP printf("-ldl "); # endif printf("-lpthread\n"); # endif # if defined(GC_FREEBSD_THREADS) # ifdef GC_USE_DLOPEN_WRAP printf("-ldl "); # endif # if (__FREEBSD_version >= 500000) printf("-lpthread\n"); # else printf("-pthread\n"); # endif # endif # if defined(GC_NETBSD_THREADS) printf("-lpthread -lrt\n"); # endif # if defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) printf("-lpthread -lrt\n"); # endif # if defined(GC_SOLARIS_THREADS) printf("-lthread -lposix4\n"); /* Is this right for recent versions? */ # endif # if defined(GC_WIN32_THREADS) && defined(CYGWIN32) printf("-lpthread\n"); # endif # if defined(GC_WIN32_PTHREADS) # ifdef PTW32_STATIC_LIB /* assume suffix s for static version of the win32 pthread library */ printf("-lpthreadGC2s -lws2_32\n"); # else printf("-lpthreadGC2\n"); # endif # endif # if defined(GC_OSF1_THREADS) printf("-pthread -lrt"); /* DOB: must be -pthread, not -lpthread */ # endif /* You need GCC 3.0.3 to build this one! */ /* DG/UX native gcc doesnt know what "-pthread" is */ # if defined(GC_DGUX386_THREADS) printf("-ldl -pthread\n"); # endif return 0; } synopsis-0.12/src/Synopsis/gc/Makefile.am0000664000076400007640000001445611104702315017726 0ustar stefanstefan# Copyright (c) 1999-2001 by Red Hat, Inc. All rights reserved. # # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED # OR IMPLIED. ANY USE IS AT YOUR OWN RISK. # # Permission is hereby granted to use or copy this program # for any purpose, provided the above notices are retained on all copies. # Permission to modify the code and to distribute modified code is granted, # provided the above notices are retained, and a notice that the code was # modified is included with the above copyright notice. # # Original author: Tom Tromey # Severely truncated by Hans-J. Boehm # Modified by: Grzegorz Jakacki # Modified by: Petter Urkedal (2005-04) ## Process this file with automake to produce Makefile.in. ## FIXME: `make distcheck' in this directory will not currently work. ## This is most likely to the explicit flags passed to submakes. # We currently use the source files directly from libatomic_ops, if we # use the internal version. This is done since libatomic_ops doesn't # use libtool, since it has no real use for it. But that seems to make # it hard to use either the resulting object files or libraries. # Thus there seems too be no real reason to recusively build in the # libatomic_ops directory. # if USE_INTERNAL_LIBATOMICS_OPS # SUBDIRS = @maybe_libatomic_ops@ # else # SUBDIRS = # endif SUBDIRS = # Initialize variables so that we can declare files locally. EXTRA_DIST = lib_LTLIBRARIES = include_HEADERS = pkginclude_HEADERS = dist_noinst_HEADERS = check_PROGRAMS = TESTS = pkgconfigdir = $(libdir)/pkgconfig dist_pkgconfig_DATA = bdw-gc.pc # C Library # --------- lib_LTLIBRARIES += libgc.la libgc_la_SOURCES = \ allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c \ dyn_load.c finalize.c gc_dlopen.c gcj_mlc.c headers.c \ malloc.c mallocx.c mark.c mark_rts.c misc.c new_hblk.c \ obj_map.c os_dep.c pcr_interface.c ptr_chck.c real_malloc.c reclaim.c \ specific.c stubborn.c typd_mlc.c \ backgraph.c thread_local_alloc.c # C Library: Architecture Dependent # --------------------------------- if PTHREADS libgc_la_SOURCES += pthread_support.c pthread_stop_world.c endif if DARWIN_THREADS libgc_la_SOURCES += darwin_stop_world.c endif if WIN32_THREADS libgc_la_SOURCES += win32_threads.c endif if USE_INTERNAL_LIBATOMIC_OPS nodist_libgc_la_SOURCES = atomic_ops.c endif if NEED_ATOMIC_OPS_ASM nodist_libgc_la_SOURCES = atomic_ops_sysdeps.S endif # Include THREADDLLIBS here to ensure that the correct versions of # linuxthread semaphore functions get linked: libgc_la_LIBADD = @addobjs@ $(THREADDLLIBS) $(UNWINDLIBS) libgc_la_DEPENDENCIES = @addobjs@ libgc_la_LDFLAGS = $(extra_ldflags_libgc) -version-info 1:3:0 -no-undefined EXTRA_libgc_la_SOURCES = alpha_mach_dep.S \ mips_sgi_mach_dep.s mips_ultrix_mach_dep.s \ rs6000_mach_dep.s sparc_mach_dep.S sparc_netbsd_mach_dep.s \ sparc_sunos4_mach_dep.s ia64_save_regs_in_stack.s # C++ Interface # ------------- if CPLUSPLUS lib_LTLIBRARIES += libgccpp.la pkginclude_HEADERS += include/gc_cpp.h include/gc_allocator.h libgccpp_la_SOURCES = gc_cpp.cc libgccpp_la_LIBADD = $(top_builddir)/libgc.la libgccpp_la_LDFLAGS = -version-info 1:3:0 -no-undefined endif # FIXME: If Visual C++ users use Makefile.am, this should go into # pkginclude_HEADERS with proper AM_CONDITIONALization. Otherwise # delete this comment. EXTRA_DIST += gc_cpp.cpp # Misc # ---- AM_CXXFLAGS = @GC_CFLAGS@ AM_CFLAGS = @GC_CFLAGS@ ## FIXME: relies on internal code generated by automake. ## FIXME: ./configure --enable-dependency-tracking should be used #all_objs = @addobjs@ $(libgc_la_OBJECTS) #$(all_objs) : include/private/gcconfig.h include/private/gc_priv.h \ #include/private/gc_hdrs.h include/gc.h include/gc_gcj.h \ #include/gc_pthread_redirects.h include/gc_config_macros.h \ #include/private/thread_local_alloc.h include/private_support.h \ #include/private/pthread_stop_world.h \ #include/gc_mark.h @addincludes@ ## FIXME: we shouldn't have to do this, but automake forces us to. ## We use -Wp,-P to strip #line directives. Irix `as' chokes on ## these. if COMPILER_XLC ## XLC neither requires nor tolerates the unnecessary assembler goop ASM_CPP_OPTIONS = else ## We use -Wp,-P to strip #line directives. Irix `as' chokes on ## these. ASM_CPP_OPTIONS = -Wp,-P -x assembler-with-cpp endif .s.lo: $(LTCOMPILE) $(ASM_CPP_OPTIONS) -c $< .S.lo: $(LTCOMPILE) $(ASM_CPP_OPTIONS) -c $< ## We need to add DEFS to assembler flags ## :FIXME: what if assembler does not accept -D... ? ## (use Autoconf to prepare ASDEFS ???) CCASFLAGS += $(DEFS) dist_noinst_SCRIPTS = callprocs configure.host ## callprocs --- used by Makefile.{dj,direct} ## configure.host --- used by Makefile.{am,dj,direct} # headers which are not installed # (see include/include.am for more) # dist_noinst_HEADERS += version.h # documentation which is not installed # EXTRA_DIST += README.QUICK # other makefiles # :GOTCHA: deliberately we do not include 'Makefile' EXTRA_DIST += BCC_MAKEFILE NT_MAKEFILE NT_THREADS_MAKEFILE \ OS2_MAKEFILE PCR-Makefile digimars.mak EMX_MAKEFILE \ Makefile.direct Makefile.dj Makefile.DLLs SMakefile.amiga \ WCC_MAKEFILE configure_atomic_ops.sh \ NT_STATIC_THREADS_MAKEFILE NT_X64_STATIC_THREADS_MAKEFILE # files used by makefiles other than Makefile.am # EXTRA_DIST += add_gc_prefix.c gcname.c if_mach.c if_not_there.c \ hpux_test_and_clear.s gc.mak MacOS.c \ MacProjects.sit.hqx mach_dep.c setjmp_t.c \ threadlibs.c AmigaOS.c \ Mac_files/datastart.c Mac_files/dataend.c \ Mac_files/MacOS_config.h Mac_files/MacOS_Test_config.h \ include/private/msvc_dbg.h msvc_dbg.c # The libatomic_ops library. This is not ideal, since we pick up junk from # there. The hard-coded version number should also go. EXTRA_DIST += libatomic_ops-1.2 # this is an auxiliary shell file used by Makefile and Makefile.direct # CONFIG_STATUS_DEPENDENCIES = $(srcdir)/configure.host # :FIXME: why do we distribute this one??? # EXTRA_DIST += libtool.m4 # # :GOTCHA: GNU make rule for making .s out of .S is flawed, # it will not remove dest if building fails .S.s: if $(CPP) $< >$@ ; then :; else rm -f $@; fi include include/include.am include cord/cord.am include tests/tests.am include doc/doc.am # Putting these at the top causes cord to be built first, and not find libgc.a # on HP/UX. There may be a better fix. synopsis-0.12/src/Synopsis/gc/EMX_MAKEFILE0000664000076400007640000001240211104702316017471 0ustar stefanstefan# # OS/2 specific Makefile for the EMX environment # # You need GNU Make 3.71, gcc 2.5.7, emx 0.8h and GNU fileutils 3.9 # or similar tools. C++ interface and de.exe weren't tested. # # Rename this file "Makefile". # # Primary targets: # gc.a - builds basic library # c++ - adds C++ interface to library and include directory # cords - adds cords (heavyweight strings) to library and include directory # test - prints porting information, then builds basic version of gc.a, and runs # some tests of collector and cords. Does not add cords or c++ interface to gc.a # cord/de.exe - builds dumb editor based on cords. CC= gcc CXX=g++ # Needed only for "make c++", which adds the c++ interface CFLAGS= -O -DALL_INTERIOR_POINTERS # Setjmp_test may yield overly optimistic results when compiled # without optimization. # -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly # altered stubborn objects, at substantial performance cost. # -DFIND_LEAK causes the collector to assume that all inaccessible # objects should have been explicitly deallocated, and reports exceptions # -DSOLARIS_THREADS enables support for Solaris (thr_) threads. # (Clients should also define SOLARIS_THREADS and then include # gc.h before performing thr_ or GC_ operations.) # -DALL_INTERIOR_POINTERS allows all pointers to the interior # of objects to be recognized. (See gc_private.h for consequences.) # -DSMALL_CONFIG tries to tune the collector for small heap sizes, # usually causing it to use less space in such situations. # Incremental collection no longer works in this case. # -DDONT_ADD_BYTE_AT_END is meaningful only with # -DALL_INTERIOR_POINTERS. Normally -DALL_INTERIOR_POINTERS # causes all objects to be padded so that pointers just past the end of # an object can be recognized. This can be expensive. (The padding # is normally more than one byte due to alignment constraints.) # -DDONT_ADD_BYTE_AT_END disables the padding. AR= ar RANLIB= ar s # Redefining srcdir allows object code for the nonPCR version of the collector # to be generated in different directories srcdir = . VPATH = $(srcdir) OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dyn_load.o dbg_mlc.o malloc.o stubborn.o checksums.o typd_mlc.o ptr_chck.o mallocx.o CORD_OBJS= cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o CORD_INCLUDE_FILES= $(srcdir)/gc.h $(srcdir)/cord/cord.h $(srcdir)/cord/ec.h \ $(srcdir)/cord/cord_pos.h # Libraries needed for curses applications. Only needed for de. CURSES= -lcurses -ltermlib # The following is irrelevant on most systems. But a few # versions of make otherwise fork the shell specified in # the SHELL environment variable. SHELL= bash SPECIALCFLAGS = # Alternative flags to the C compiler for mach_dep.c. # Mach_dep.c often doesn't like optimization, and it's # not time-critical anyway. all: gc.a gctest.exe $(OBJS) test.o: $(srcdir)/gc_priv.h $(srcdir)/gc_hdrs.h $(srcdir)/gc.h \ $(srcdir)/gcconfig.h $(srcdir)/gc_typed.h # The dependency on Makefile is needed. Changing # options affects the size of GC_arrays, # invalidating all .o files that rely on gc_priv.h mark.o typd_mlc.o finalize.o: $(srcdir)/include/gc_mark.h $(srcdir)/include/private/gc_pmark.h gc.a: $(OBJS) $(AR) ru gc.a $(OBJS) $(RANLIB) gc.a cords: $(CORD_OBJS) cord/cordtest.exe $(AR) ru gc.a $(CORD_OBJS) $(RANLIB) gc.a cp $(srcdir)/cord/cord.h include/cord.h cp $(srcdir)/cord/ec.h include/ec.h cp $(srcdir)/cord/cord_pos.h include/cord_pos.h gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/gc_cpp.h $(CXX) -c -O $(srcdir)/gc_cpp.cc c++: gc_cpp.o $(srcdir)/gc_cpp.h $(AR) ru gc.a gc_cpp.o $(RANLIB) gc.a cp $(srcdir)/gc_cpp.h include/gc_cpp.h mach_dep.o: $(srcdir)/mach_dep.c $(CC) -o mach_dep.o -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c mark_rts.o: $(srcdir)/mark_rts.c $(CC) -o mark_rts.o -c $(CFLAGS) $(srcdir)/mark_rts.c cord/cordbscs.o: $(srcdir)/cord/cordbscs.c $(CORD_INCLUDE_FILES) $(CC) $(CFLAGS) -c $(srcdir)/cord/cordbscs.c -o cord/cordbscs.o cord/cordxtra.o: $(srcdir)/cord/cordxtra.c $(CORD_INCLUDE_FILES) $(CC) $(CFLAGS) -c $(srcdir)/cord/cordxtra.c -o cord/cordxtra.o cord/cordprnt.o: $(srcdir)/cord/cordprnt.c $(CORD_INCLUDE_FILES) $(CC) $(CFLAGS) -c $(srcdir)/cord/cordprnt.c -o cord/cordprnt.o cord/cordtest.exe: $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a $(CC) $(CFLAGS) -o cord/cordtest.exe $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a cord/de.exe: $(srcdir)/cord/de.c $(srcdir)/cord/cordbscs.o $(srcdir)/cord/cordxtra.o gc.a $(CC) $(CFLAGS) -o cord/de.exe $(srcdir)/cord/de.c $(srcdir)/cord/cordbscs.o $(srcdir)/cord/cordxtra.o gc.a $(CURSES) clean: rm -f gc.a tests/test.o gctest.exe output-local output-diff $(OBJS) \ setjmp_test mon.out gmon.out a.out core \ $(CORD_OBJS) cord/cordtest.exe cord/de.exe -rm -f *~ gctest.exe: tests/test.o gc.a $(CC) $(CFLAGS) -o gctest.exe tests/test.o gc.a # If an optimized setjmp_test generates a segmentation fault, # odds are your compiler is broken. Gctest may still work. # Try compiling setjmp_t.c unoptimized. setjmp_test.exe: $(srcdir)/setjmp_t.c $(srcdir)/gc.h $(CC) $(CFLAGS) -o setjmp_test.exe $(srcdir)/setjmp_t.c test: setjmp_test.exe gctest.exe ./setjmp_test ./gctest make cord/cordtest.exe cord/cordtest synopsis-0.12/src/Synopsis/gc/doc/0000775000076400007640000000000011172123233016426 5ustar stefanstefansynopsis-0.12/src/Synopsis/gc/doc/README.arm.cross0000775000076400007640000000421011104702320021207 0ustar stefanstefanFrom: Margaret Fleck Here's the key details of what worked for me, in case anyone else needs them. There may well be better ways to do some of this, but .... -- Margaret The badge4 has a StrongArm-1110 processor and a StrongArm-1111 coprocessor. Assume that the garbage collector distribution is unpacked into /home/arm/gc6.0, which is visible to both the ARM machine and a linux desktop (e.g. via NFS mounting). Assume that you have a file /home/arm/config.site with contents something like the example attached below. Notice that our local ARM toolchain lives in /skiff/local. Go to /home/arm/gc6.0 directory. Do CONFIG_SITE=/home/arm/config.site ./configure --target=arm-linux --prefix=/home/arm/gc6.0 On your desktop, do: make make install The main garbage collector library should now be in ../gc6.0/lib/libgc.so. To test the garbage collector, first do the following on your desktop make gctest ./gctest Then do the following on the ARM machine cd .libs ./lt-gctest Do not try to do "make test" (the usual way of running the test program). This does not work and seems to erase some of the important files. The gctest program claims to have succeeded. Haven't run any further tests with it, though I'll be doing so in the near future. ------------------------------- # config.site for configure # Modified from the one provided by Bradley D. LaRonde # Edited by Andrej Cedilnik # Used some of solutions by Tilman Vogel # Ported for iPAQ Familiar by Oliver Kurth # Further modified by Margaret Fleck for the badge4 HOSTCC=gcc # Names of the cross-compilers CC=/skiff/local/bin/arm-linux-gcc CXX=/skiff/local/bin/arm-linux-gcc # The cross compiler specific options CFLAGS="-O2 -fno-exceptions" CXXFLAGS="-O2 -fno-exceptions" CPPFLAGS="-O2 -fno-exceptions" LDFLAGS="" # Some other programs AR=/skiff/local/bin/arm-linux-ar RANLIB=/skiff/local/bin/arm-linux-ranlib NM=/skiff/local/bin/arm-linux-nm ac_cv_path_NM=/skiff/local/bin/arm-linux-nm ac_cv_func_setpgrp_void=yes x_includes=/skiff/local/arm-linux/include/X11 x_libraries=/skiff/local/arm-linux/lib/X11 synopsis-0.12/src/Synopsis/gc/doc/README.ews48000000664000076400007640000000411311104702320020411 0ustar stefanstefanGC on EWS4800 ------------- 1. About EWS4800 EWS4800 is 32bit/64bit workstation. Vender: NEC Corporation OS: UX/4800 R9.* - R13.* (SystemV R4.2) CPU: R4000, R4400, R10000 (MIPS) 2. Compiler 32bit: Use ANSI C compiler. CC = /usr/abiccs/bin/cc 64bit: Use 64bit ANSI C compiler. CC = /usr/ccs64/bin/cc AR = /usr/ccs64/bin/ar 3. ELF file format *** Caution: The following infomation is empirical. *** 32bit: ELF file has an unique format. (See a.out(4) and end(3C).) &_start : text segment &etext DATASTART : data segment (initialized) &edata DATASTART2 : data segment (uninitialized) &end Here, DATASTART and DATASTART2 are macros of GC, and are defined as the following equations. (See include/private/gcconfig.h.) The algorithm for DATASTART is similar with the function GC_SysVGetDataStart() in os_dep.c. DATASTART = ((&etext + 0x3ffff) & ~0x3ffff) + (&etext & 0xffff) Dynamically linked: DATASTART2 = (&_gp + 0x8000 + 0x3ffff) & ~0x3ffff Statically linked: DATASTART2 = &edata GC has to check addresses both between DATASTART and &edata, and between DATASTART2 and &end. If a program accesses between &etext and DATASTART, or between &edata and DATASTART2, the segmentation error occurs and the program stops. If a program is statically linked, there is not a gap between &edata and DATASTART2. The global symbol &_DYNAMIC_LINKING is used for the detection. 64bit: ELF file has a simple format. (See end(3C).) _ftext : text segment _etext _fdata = DATASTART : data segment (initialized) _edata _fbss : data segment (uninitialized) _end = DATAEND -- Hironori SAKAMOTO When using the new "configure; make" build process, please run configure with the --disable-shared option. "Make check" does not yet pass with dynamic libraries. Ther reasons for that are not yet understood. (HB, paraphrasing message from Hironori SAKAMOTO.) synopsis-0.12/src/Synopsis/gc/doc/README.changes0000664000076400007640000042663311104702320020726 0ustar stefanstefanThis is a rough history of garbage collector bugs and versions. This has been maintained with varying diligence over the years. I made an attempt to include recent contributors here. I apologize for any omissions. RECENT UPDATES ARE RECORDED IN ../ChangeLog FILE INSTEAD TO CONFORM TO MORE COMMON CONVENTIONS. ------------------------- Version 1.3 and immediately preceding versions contained spurious assembly language assignments to TMP_SP. Only the assignment in the PC/RT code is necessary. On other machines, with certain compiler options, the assignments can lead to an unsaved register being overwritten. Known to cause problems under SunOS 3.5 WITHOUT the -O option. (With -O the compiler recognizes it as dead code. It probably shouldn't, but that's another story.) Version 1.4 and earlier versions used compile time determined values for the stack base. This no longer works on Sun 3s, since Sun 3/80s use a different stack base. We now use a straightforward heuristic on all machines on which it is known to work (incl. Sun 3s) and compile-time determined values for the rest. There should really be library calls to determine such values. Version 1.5 and earlier did not ensure 8 byte alignment for objects allocated on a sparc based machine. Version 1.8 added ULTRIX support in gc_private.h. Version 1.9 fixed a major bug in gc_realloc. Version 2.0 introduced a consistent naming convention for collector routines and added support for registering dynamic library data segments in the standard mark_roots.c. Most of the data structures were revamped. The treatment of interior pointers was completely changed. Finalization was added. Support for locking was added. Object kinds were added. We added a black listing facility to avoid allocating at addresses known to occur as integers somewhere in the address space. Much of this was accomplished by adapting ideas and code from the PCR collector. The test program was changed and expanded. Version 2.1 was the first stable version since 1.9, and added support for PPCR. Version 2.2 added debugging allocation, and fixed various bugs. Among them: - GC_realloc could fail to extend the size of the object for certain large object sizes. - A blatant subscript range error in GC_printf, which unfortunately wasn't exercised on machines with sufficient stack alignment constraints. - GC_register_displacement did the wrong thing if it was called after any allocation had taken place. - The leak finding code would eventually break after 2048 byte byte objects leaked. - interface.c didn't compile. - The heap size remained much too small for large stacks. - The stack clearing code behaved badly for large stacks, and perhaps on HP/PA machines. Version 2.3 added ALL_INTERIOR_POINTERS and fixed the following bugs: - Missing declaration of etext in the A/UX version. - Some PCR root-finding problems. - Blacklisting was not 100% effective, because the plausible future heap bounds were being miscalculated. - GC_realloc didn't handle out-of-memory correctly. - GC_base could return a nonzero value for addresses inside free blocks. - test.c wasn't really thread safe, and could erroneously report failure in a multithreaded environment. (The locking primitives need to be replaced for other threads packages.) - GC_CONS was thoroughly broken. - On a SPARC with dynamic linking, signals stayed diabled while the client code was running. (Thanks to Manuel Serrano at INRIA for reporting the last two.) Version 2.4 added GC_free_space_divisor as a tuning knob, added support for OS/2 and linux, and fixed the following bugs: - On machines with unaligned pointers (e.g. Sun 3), every 128th word could fail to be considered for marking. - Dynamic_load.c erroneously added 4 bytes to the length of the data and bss sections of the dynamic library. This could result in a bad memory reference if the actual length was a multiple of a page. (Observed on Sun 3. Can probably also happen on a Sun 4.) (Thanks to Robert Brazile for pointing out that the Sun 3 version was broken. Dynamic library handling is still broken on Sun 3s under 4.1.1U1, but apparently not 4.1.1. If you have such a machine, use -Bstatic.) Version 2.5 fixed the following bugs: - Removed an explicit call to exit(1) - Fixed calls to GC_printf and GC_err_printf, so the correct number of arguments are always supplied. The OS/2 C compiler gets confused if the number of actuals and the number of formals differ. (ANSI C doesn't require this to work. The ANSI sanctioned way of doing things causes too many compatibility problems.) Version 3.0 added generational/incremental collection and stubborn objects. Version 3.1 added the following features: - A workaround for a SunOS 4.X SPARC C compiler misfeature that caused problems when the collector was turned into a dynamic library. - A fix for a bug in GC_base that could result in a memory fault. - A fix for a performance bug (and several other misfeatures) pointed out by Dave Detlefs and Al Dosser. - Use of dirty bit information for static data under Solaris 2.X. - DEC Alpha/OSF1 support (thanks to Al Dosser). - Incremental collection on more platforms. - A more refined heap expansion policy. Less space usage by default. - Various minor enhancements to reduce space usage, and to reduce the amount of memory scanned by the collector. - Uncollectable allocation without per object overhead. - More conscientious handling of out-of-memory conditions. - Fixed a bug in debugging stubborn allocation. - Fixed a bug that resulted in occasional erroneous reporting of smashed objects with debugging allocation. - Fixed bogus leak reports of size 4096 blocks with FIND_LEAK. Version 3.2 fixed a serious and not entirely repeatable bug in the incremental collector. It appeared only when dirty bit info on the roots was available, which is normally only under Solaris. It also added GC_general_register_disappearing_link, and some testing code. Interface.c disappeared. Version 3.3 fixes several bugs and adds new ports: - PCR-specific bugs. - Missing locking in GC_free, redundant FASTUNLOCK in GC_malloc_stubborn, and 2 bugs in GC_unregister_disappearing_link. All of the above were pointed out by Neil Sharman (neil@cs.mu.oz.au). - Common symbols allocated by the SunOS4.X dynamic loader were not included in the root set. - Bug in GC_finalize (reported by Brian Beuning and Al Dosser) - Merged Amiga port from Jesper Peterson (untested) - Merged NeXT port from Thomas Funke (significantly modified and untested) Version 3.4: - Fixed a performance bug in GC_realloc. - Updated the amiga port. - Added NetBSD and 386BSD ports. - Added cord library. - Added trivial performance enhancement for ALL_INTERIOR_POINTERS. (Don't scan last word.) Version 3.5 - Minor collections now mark from roots only once, if that doesn't cause an excessive pause. - The stack clearing heuristic was refined to prevent anomalies with very heavily recursive programs and sparse stacks. - Fixed a bug that prevented mark stack growth in some cases. GC_objects_are_marked should be set to TRUE after a call to GC_push_roots and as part of GC_push_marked, since both can now set mark bits. I think this is only a performance bug, but I wouldn't bet on it. It's certainly very hard to argue that the old version was correct. - Fixed an incremental collection bug that prevented it from working at all when HBLKSIZE != getpagesize() - Changed dynamic_loading.c to include gc_priv.h before testing DYNAMIC_LOADING. SunOS dynamic library scanning must have been broken in 3.4. - Object size rounding now adapts to program behavior. - Added a workaround (provided by Manuel Serrano and colleagues) to a long-standing SunOS 4.X (and 3.X?) ld bug that I had incorrectly assumed to have been squished. The collector was broken if the text segment size was within 32 bytes of a multiple of 8K bytes, and if the beginning of the data segment contained interesting roots. The workaround assumes a demand-loadable executable. The original may have have "worked" in some other cases. - Added dynamic library support under IRIX5. - Added support for EMX under OS/2 (thanks to Ari Huttunen). Version 3.6: - fixed a bug in the mark stack growth code that was introduced in 3.4. - fixed Makefile to work around DEC AXP compiler tail recursion bug. Version 3.7: - Added a workaround for an HP/UX compiler bug. - Fixed another stack clearing performance bug. Reworked that code once more. Version 4.0: - Added support for Solaris threads (which was possible only by reimplementing some fraction of Solaris threads, since Sun doesn't currently make the thread debugging interface available). - Added non-threads win32 and win32S support. - (Grudgingly, with suitable muttering of obscenities) renamed files so that the collector distribution could live on a FAT file system. Files that are guaranteed to be useless on a PC still have long names. Gc_inline.h and gc_private.h still exist, but now just include gc_inl.h and gc_priv.h. - Fixed a really obscure bug in finalization that could cause undetected mark stack overflows. (I would be surprised if any real code ever tickled this one.) - Changed finalization code to dynamically resize the hash tables it maintains. (This probably does not matter for well- -written code. It no doubt does for C++ code that overuses destructors.) - Added typed allocation primitives. Rewrote the marker to accommodate them with more reasonable efficiency. This change should also speed up marking for GC_malloc allocated objects a little. See gc_typed.h for new primitives. - Improved debugging facilities slightly. Allocation time stack traces are now kept by default on SPARC/SUNOS4. (Thanks to Scott Schwartz.) - Added better support for small heap applications. - Significantly extended cord package. Fixed a bug in the implementation of lazily read files. Printf and friends now have cord variants. Cord traversals are a bit faster. - Made ALL_INTERIOR_POINTERS recognition the default. - Fixed de so that it can run in constant space, independent of file size. Added simple string searching to cords and de. - Added the Hull-Ellis C++ interface. - Added dynamic library support for OSF/1. (Thanks to Al Dosser and Tim Bingham at DEC.) - Changed argument to GC_expand_hp to be expressed in units of bytes instead of heap blocks. (Necessary since the heap block size now varies depending on configuration. The old version was never very clean.) - Added GC_get_heap_size(). The previous "equivalent" was broken. - Restructured the Makefile a bit. Since version 4.0: - Changed finalization implementation to guarantee that finalization procedures are called outside of the allocation lock, making direct use of the interface a little less dangerous. MAY BREAK EXISTING CLIENTS that assume finalizers are protected by a lock. Since there seem to be few multithreaded clients that use finalization, this is hopefully not much of a problem. - Fixed a gross bug in CORD_prev. - Fixed a bug in blacklst.c that could result in unbounded heap growth during startup on machines that do not clear memory obtained from the OS (e.g. win32S). - Ported de editor to win32/win32S. (This is now the only version with a mouse-sensitive UI.) - Added GC_malloc_ignore_off_page to allocate large arrays in the presence of ALL_INTERIOR_POINTERS. - Changed GC_call_with_alloc_lock to not disable signals in the single-threaded case. - Reduced retry count in GC_collect_or_expand for garbage collecting when out of memory. - Made uncollectable allocations bypass black-listing, as they should. - Fixed a bug in typed_test in test.c that could cause (legitimate) GC crashes. - Fixed some potential synchronization problems in finalize.c - Fixed a real locking problem in typd_mlc.c. - Worked around an AIX 3.2 compiler feature that results in out of bounds memory references. - Partially worked around an IRIX5.2 beta problem (which may or may not persist to the final release). - Fixed a bug in the heap integrity checking code that could result in explicitly deallocated objects being identified as smashed. Fixed a bug in the dbg_mlc stack saving code that caused old argument pointers to be considered live. - Fixed a bug in CORD_ncmp (and hence CORD_str). - Repaired the OS2 port, which had suffered from bit rot in 4.0. Worked around what appears to be CSet/2 V1.0 optimizer bug. - Fixed a Makefile bug for target "c++". Since version 4.1: - Multiple bug fixes/workarounds in the Solaris threads version. (It occasionally failed to locate some register contents for marking. It also turns out that thr_suspend and friends are unreliable in Solaris 2.3. Dirty bit reads appear to be unreliable under some weird circumstances. My stack marking code contained a serious performance bug. The new code is extremely defensive, and has not failed in several cpu hours of testing. But no guarantees ...) - Added MacOS support (thanks to Patrick Beard.) - Fixed several syntactic bugs in gc_c++.h and friends. (These didn't bother g++, but did bother most other compilers.) Fixed gc_c++.h finalization interface. (It didn't.) - 64 bit alignment for allocated objects was not guaranteed in a few cases in which it should have been. - Added GC_malloc_atomic_ignore_off_page. - Added GC_collect_a_little. - Added some prototypes to gc.h. - Some other minor bug fixes (notably in Makefile). - Fixed OS/2 / EMX port (thanks to Ari Huttunen). - Fixed AmigaDOS port. (thanks to Michel Schinz). - Fixed the DATASTART definition under Solaris. There was a 1 in 16K chance of the collector missing the first 64K of static data (and thus crashing). - Fixed some blatant anachronisms in the README file. - Fixed PCR-Makefile for upcoming PPCR release. Since version 4.2: - Fixed SPARC alignment problem with GC_DEBUG. - Fixed Solaris threads /proc workaround. The real problem was an interaction with mprotect. - Incorporated fix from Patrick Beard for gc_c++.h (now gc_cpp.h). - Slightly improved allocator space utilization by fixing the GC_size_map mechanism. - Integrated some Sony News and MIPS RISCos 4.51 patches. (Thanks to Nobuyuki Hikichi of Software Research Associates, Inc. Japan) - Fixed HP_PA alignment problem. (Thanks to xjam@cork.cs.berkeley.edu.) - Added GC_same_obj and friends. Changed GC_base to return 0 for pointers past the end of large objects. Improved GC_base performance with ALL_INTERIOR_POINTERS on machines with a slow integer mod operation. Added GC_PTR_ADD, GC_PTR_STORE, etc. to prepare for preprocessor. - changed the default on most UNIX machines to be that signals are not disabled during critical GC operations. This is still ANSI-conforming, though somewhat dangerous in the presence of signal handlers. But the performance cost of the alternative is sometimes problematic. Can be changed back with a minor Makefile edit. - renamed IS_STRING in gc.h, to CORD_IS_STRING, thus following my own naming convention. Added the function CORD_to_const_char_star. - Fixed a gross bug in GC_finalize. Symptom: occasional address faults in that function. (Thanks to Anselm Baird-Smith (Anselm.BairdSmith@inria.fr) - Added port to ICL DRS6000 running DRS/NX. Restructured things a bit to factor out common code, and remove obsolete code. Collector should now run under SUNOS5 with either mprotect or /proc dirty bits. (Thanks to Douglas Steel (doug@wg.icl.co.uk)). - More bug fixes and workarounds for Solaris 2.X. (These were mostly related to putting the collector in a dynamic library, which didn't really work before. Also SOLARIS_THREADS didn't interact well with dl_open.) Thanks to btlewis@eng.sun.com. - Fixed a serious performance bug on the DEC Alpha. The text segment was getting registered as part of the root set. (Amazingly, the result was still fast enough that the bug was not conspicuous.) The fix works on OSF/1, version 1.3. Hopefully it also works on other versions of OSF/1 ... - Fixed a bug in GC_clear_roots. - Fixed a bug in GC_generic_malloc_words_small that broke gc_inl.h. (Reported by Antoine de Maricourt. I broke it in trying to tweak the Mac port.) - Fixed some problems with cord/de under Linux. - Fixed some cord problems, notably with CORD_riter4. - Added DG/UX port. Thanks to Ben A. Mesander (ben@piglet.cr.usgs.gov) - Added finalization registration routines with weaker ordering constraints. (This is necessary for C++ finalization with multiple inheritance, since the compiler often adds self-cycles.) - Filled the holes in the SCO port. (Thanks to Michael Arnoldus .) - John Ellis' additions to the C++ support: From John: * I completely rewrote the documentation in the interface gc_c++.h (later renamed gc_cpp.h). I've tried to make it both clearer and more precise. * The definition of accessibility now ignores pointers from an finalizable object (an object with a clean-up function) to itself. This allows objects with virtual base classes to be finalizable by the collector. Compilers typically implement virtual base classes using pointers from an object to itself, which under the old definition of accessibility prevented objects with virtual base classes from ever being collected or finalized. * gc_cleanup now includes gc as a virtual base. This was enabled by the change in the definition of accessibility. * I added support for operator new[]. Since most (all?) compilers don't yet support operator new[], it is conditionalized on -DOPERATOR_NEW_ARRAY. The code is untested, but its trivial and looks correct. * The test program test_gc_c++ (later renamed test_cpp.cc) tries to test for the C++-specific functionality not tested by the other programs. - Added include to misc.c. (Needed for ppcr.) - Added PowerMac port. (Thanks to Patrick Beard again.) - Fixed "srcdir"-related Makefile problems. Changed things so that all externally visible include files always appear in the include subdirectory of the source. Made gc.h directly includable from C++ code. (These were at Per Bothner's suggestion.) - Changed Intel code to also mark from ebp (Kevin Warne's suggestion). - Renamed C++ related files so they could live in a FAT file system. (Charles Fiterman's suggestion.) - Changed Windows NT Makefile to include C++ support in gc.lib. Added C++ test as Makefile target. Since version 4.3: - ASM_CLEAR_CODE was erroneously defined for HP PA machines, resulting in a compile error. - Fixed OS/2 Makefile to create a library. (Thanks to Mark Boulter (mboulter@vnet.ibm.com)). - Gc_cleanup objects didn't work if they were created on the stack. Fixed. - One copy of Gc_cpp.h in the distribution was out of synch, and failed to document some known compiler problems with explicit destructor invocation. Partially fixed. There are probably other compilers on which gc_cleanup is miscompiled. - Fixed Makefile to pass C compiler flags to C++ compiler. - Added Mac fixes. - Fixed os_dep.c to work around what appears to be a new and different VirtualQuery bug under newer versions of win32S. - GC_non_gc_bytes was not correctly maintained by GC_free. Fixed. Thanks to James Clark (jjc@jclark.com). - Added GC_set_max_heap_size. - Changed allocation code to ignore blacklisting if it is preventing use of a very large block of memory. This has the advantage that naive code allocating very large objects is much more likely to work. The downside is you might no longer find out that such code should really use GC_malloc_ignore_off_page. - Changed GC_printf under win32 to close and reopen the file between calls. FAT file systems otherwise make the log file useless for debugging. - Added GC_try_to_collect and GC_get_bytes_since_gc. These allow starting an abortable collection during idle times. This facility does not require special OS support. (Thanks to Michael Spertus of Geodesic Systems for suggesting this. It was actually an easy addition. Kumar Srikantan previously added a similar facility to a now ancient version of the collector. At the time this was much harder, and the result was less convincing.) - Added some support for the Borland development environment. (Thanks to John Ellis and Michael Spertus.) - Removed a misfeature from checksums.c that caused unexpected heap growth. (Thanks to Scott Schwartz.) - Changed finalize.c to call WARN if it encounters a finalization cycle. WARN is defined in gc_priv.h to write a message, usually to stdout. In many environments, this may be inappropriate. - Renamed NO_PARAMS in gc.h to GC_NO_PARAMS, thus adhering to my own naming convention. - Added GC_set_warn_proc to intercept warnings. - Fixed Amiga port. (Thanks to Michel Schinz (schinz@alphanet.ch).) - Fixed a bug in mark.c that could result in an access to unmapped memory from GC_mark_from_mark_stack on machines with unaligned pointers. - Fixed a win32 specific performance bug that could result in scanning of objects allocated with the system malloc. - Added REDIRECT_MALLOC. Since version 4.4: - Fixed many minor and one major README bugs. (Thanks to Franklin Chen (chen@adi.com) for pointing out many of them.) - Fixed ALPHA/OSF/1 dynamic library support. (Thanks to Jonathan Bachrach (jonathan@harlequin.com)). - Added incremental GC support (MPROTECT_VDB) for Linux (with some help from Bruno Haible). - Altered SPARC recognition tests in gc.h and config.h (mostly as suggested by Fergus Henderson). - Added basic incremental GC support for win32, as implemented by Windows NT and Windows 95. GC_enable_incremental is a noop under win32s, which doesn't implement enough of the VM interface. - Added -DLARGE_CONFIG. - Fixed GC_..._ignore_off_page to also function without -DALL_INTERIOR_POINTERS. - (Hopefully) fixed RS/6000 port. (Only the test was broken.) - Fixed a performance bug in the nonincremental collector running on machines supporting incremental collection with MPROTECT_VDB (e.g. SunOS 4, DEC AXP). This turned into a correctness bug under win32s with win32 incremental collection. (Not all memory protection was disabled.) - Fixed some ppcr related bit rot. - Caused dynamic libraries to be unregistered before reregistering. The old way turned out to be a performance bug on some machines. - GC_root_size was not properly maintained under MSWIN32. - Added -DNO_DEBUGGING and GC_dump. - Fixed a couple of bugs arising with SOLARIS_THREADS + REDIRECT_MALLOC. - Added NetBSD/M68K port. (Thanks to Peter Seebach .) - Fixed a serious realloc bug. For certain object sizes, the collector wouldn't scan the expanded part of the object. (Thanks to Clay Spence (cds@peanut.sarnoff.com) for noticing the problem, and helping me to track it down.) Since version 4.5: - Added Linux ELF support. (Thanks to Arrigo Triulzi .) - GC_base crashed if it was called before any other GC_ routines. This could happen if a gc_cleanup object was allocated outside the heap before any heap allocation. - The heap expansion heuristic was not stable if all objects had finalization enabled. Fixed finalize.c to count memory in finalization queue and avoid explicit deallocation. Changed alloc.c to also consider this count. (This is still not recommended. It's expensive if nothing else.) Thanks to John Ellis for pointing this out. - GC_malloc_uncollectable(0) was broken. Thanks to Phong Vo for pointing this out. - The collector didn't compile under Linux 1.3.X. (Thanks to Fred Gilham for pointing this out.) The current workaround is ugly, but expected to be temporary. - Fixed a formatting problem for SPARC stack traces. - Fixed some '=='s in os_dep.c that should have been assignments. Fortunately these were in code that should never be executed anyway. (Thanks to Fergus Henderson.) - Fixed the heap block allocator to only drop blacklisted blocks in small chunks. Made BL_LIMIT self adjusting. (Both of these were in response to heap growth observed by Paul Graham.) - Fixed the Metrowerks/68K Mac code to also mark from a6. (Thanks to Patrick Beard.) - Significantly updated README.debugging. - Fixed some problems with longjmps out of signal handlers, especially under Solaris. Added a workaround for the fact that siglongjmp doesn't appear to do the right thing with -lthread under Solaris. - Added MSDOS/djgpp port. (Thanks to Mitch Harris (maharri@uiuc.edu).) - Added "make reserved_namespace" and "make user_namespace". The first renames ALL "GC_xxx" identifiers as "_GC_xxx". The second is the inverse transformation. Note that doing this is guaranteed to break all clients written for the other names. - descriptor field for kind NORMAL in GC_obj_kinds with ADD_BYTE_AT_END defined should be -ALIGNMENT not WORDS_TO_BYTES(-1). This is a serious bug on machines with pointer alignment of less than a word. - GC_ignore_self_finalize_mark_proc didn't handle pointers to very near the end of the object correctly. Caused failures of the C++ test on a DEC Alpha with g++. - gc_inl.h still had problems. Partially fixed. Added warnings at the beginning to hopefully specify the remaining dangers. - Added DATAEND definition to config.h. - Fixed some of the .h file organization. Fixed "make floppy". Since version 4.6: - Fixed some compilation problems with -DCHECKSUMS (thanks to Ian Searle) - Updated some Mac specific files to synchronize with Patrick Beard. - Fixed a serious bug for machines with non-word-aligned pointers. (Thanks to Patrick Beard for pointing out the problem. The collector should fail almost any conceivable test immediately on such machines.) Since version 4.7: - Changed a "comment" in a MacOS specific part of mach-dep.c that caused gcc to fail on other platforms. Since version 4.8 - More README.debugging fixes. - Objects ready for finalization, but not finalized in the same GC cycle, could be prematurely collected. This occasionally happened in test_cpp. - Too little memory was obtained from the system for very large objects. That could cause a heap explosion if these objects were not contiguous (e.g. under PCR), and too much of them was blacklisted. - Due to an improper initialization, the collector was too hesitant to allocate blacklisted objects immediately after system startup. - Moved GC_arrays from the data into the bss segment by not explicitly initializing it to zero. This significantly reduces the size of executables, and probably avoids some disk accesses on program startup. It's conceivable that it might break a port that I didn't test. - Fixed EMX_MAKEFILE to reflect the gc_c++.h to gc_cpp.h renaming which occurred a while ago. Since 4.9: - Fixed a typo around a call to GC_collect_or_expand in alloc.c. It broke handling of out of memory. (Thanks to Patrick Beard for noticing.) Since 4.10: - Rationalized (hopefully) GC_try_to_collect in an incremental collection environment. It appeared to not handle a call while a collection was in progress, and was otherwise too conservative. - Merged GC_reclaim_or_delete_all into GC_reclaim_all to get rid of some code. - Added Patrick Beard's Mac fixes, with substantial completely untested modifications. - Fixed the MPROTECT_VDB code to deal with large pages and imprecise fault addresses (as on an UltraSPARC running Solaris 2.5). Note that this was not a problem in the default configuration, which uses PROC_VDB. - The DEC Alpha assembly code needed to restore $gp between calls. Thanks to Fergus Henderson for tracking this down and supplying a patch. - The write command for "de" was completely broken for large files. I used the easiest portable fix, which involved changing the semantics so that f.new is written instead of overwriting f. That's safer anyway. - Added README.solaris2 with a discussion of the possible problems of mixing the collector's sbrk allocation with malloc/realloc. - Changed the data segment starting address for SGI machines. The old code failed under IRIX6. - Required double word alignment for MIPS. - Various minor fixes to remove warnings. - Attempted to fix some Solaris threads problems reported by Zhiying Chen. In particular, the collector could try to fork a thread with the world stopped as part of GC_thr_init. It also failed to deal with the case in which the original thread terminated before the whole process did. - Added -DNO_EXECUTE_PERMISSION. This has a major performance impact on the incremental collector under Irix, and perhaps under other operating systems. - Added some code to support allocating the heap with mmap. This may be preferable under some circumstances. - Integrated dynamic library support for HP. (Thanks to Knut Tvedten .) - Integrated James Clark's win32 threads support, and made a number of changes to it, many of which were suggested by Pontus Rydin. This is still not 100% solid. - Integrated Alistair Crooks' support for UTS4 running on an Amdahl 370-class machine. - Fixed a serious bug in explicitly typed allocation. Objects requiring large descriptors where handled in a way that usually resulted in a segmentation fault in the marker. (Thanks to Jeremy Fitzhardinge for helping to track this down.) - Added partial support for GNU win32 development. (Thanks to Fergus Henderson.) - Added optional support for Java-style finalization semantics. (Thanks to Patrick Bridges.) This is recommended only for Java implementations. - GC_malloc_uncollectable faulted instead of returning 0 when out of memory. (Thanks to dan@math.uiuc.edu for noticing.) - Calls to GC_base before the collector was initialized failed on a DEC Alpha. (Thanks to Matthew Flatt.) - Added base pointer checking to GC_REGISTER_FINALIZER in debugging mode, at the suggestion of Jeremy Fitzhardinge. - GC_debug_realloc failed for uncollectable objects. (Thanks to Jeremy Fitzhardinge.) - Explicitly typed allocation could crash if it ran out of memory. (Thanks to Jeremy Fitzhardinge.) - Added minimal support for a DEC Alpha running Linux. - Fixed a problem with allocation of objects whose size overflowed ptrdiff_t. (This now fails unconditionally, as it should.) - Added the beginning of Irix pthread support. - Integrated Xiaokun Zhu's fixes for djgpp 2.01. - Added SGI-style STL allocator support (gc_alloc.h). - Fixed a serious bug in README.solaris2. Multithreaded programs must include gc.h with SOLARIS_THREADS defined. - Changed GC_free so it actually deallocates uncollectable objects. (Thanks to Peter Chubb for pointing out the problem.) - Added Linux ELF support for dynamic libararies. (Thanks again to Patrick Bridges.) - Changed the Borland cc configuration so that the assembler is not required. - Fixed a bug in the C++ test that caused it to fail in 64-bit environments. Since 4.11: - Fixed ElfW definition in dyn_load.c. (Thanks to Fergus Henderson.) This prevented the dynamic library support from compiling on some older ELF Linux systems. - Fixed UTS4 port (which I apparently mangled during the integration) (Thanks to again to Alistair Crooks.) - "Make C++" failed on Suns with SC4.0, due to a problem with "bool". Fixed in gc_priv.h. - Added more pieces for GNU win32. (Thanks to Timothy N. Newsham.) The current state of things should suffice for at least some applications. - Changed the out of memory retry count handling as suggested by Kenjiro Taura. (This matters only if GC_max_retries > 0, which is no longer the default.) - If a /proc read failed repeatedly, GC_written_pages was not updated correctly. (Thanks to Peter Chubb for diagnosing this.) - Under unlikely circumstances, the allocator could infinite loop in an out of memory situation. (Thanks again to Kenjiro Taura for identifying the problem and supplying a fix.) - Fixed a syntactic error in the DJGPP code. (Thanks to Fergus Henderson for finding this by inspection.) Also fixed a test program problem with DJGPP (Thanks to Peter Monks.) - Atomic uncollectable objects were not treated correctly by the incremental collector. This resulted in weird log statistics and occasional performance problems. (Thanks to Peter Chubb for pointing this out.) - Fixed some problems resulting from compilers that dont define __STDC__. In this case void * and char * were used inconsistently in some cases. (Void * should not have been used at all. If you have an ANSI superset compiler that does not define __STDC__, please compile with -D__STDC__=0. Thanks to Manuel Serrano and others for pointing out the problem.) - Fixed a compilation problem on Irix with -n32 and -DIRIX_THREADS. Also fixed some other IRIX_THREADS problems which may or may not have had observable symptoms. - Fixed an HP PA compilation problem in dyn_load.c. (Thanks to Philippe Queinnec.) - SEGV fault handlers sometimes did not get reset correctly. (Thanks to David Pickens.) - Added a fix for SOLARIS_THREADS on Intel. (Thanks again to David Pickens.) This probably needs more work to become functional. - Fixed struct sigcontext_struct in os_dep.c for compilation under Linux 2.1.X. (Thanks to Fergus Henderson.) - Changed the DJGPP STACKBOTTOM and DATASTART values to those suggested by Kristian Kristensen. These may still not be right, but it is it is likely to work more often than what was there before. They may even be exactly right. - Added a #include to test_cpp.cc. This appears to help with HP/UX and gcc. (Thanks to assar@sics.se.) - Version 4.11 failed to run in incremental mode on recent 64-bit Irix kernels. This was a problem related to page unaligned heap segments. Changed the code to page align heap sections on all platforms. (I had mistakenly identified this as a kernel problem earlier. It was not.) - Version 4.11 did not make allocated storage executable, except on one or two platforms, due to a bug in a #if test. (Thanks to Dave Grove for pointing this out.) - Added sparc_sunos4_mach_dep.s to support Sun's compilers under SunOS4. - Added GC_exclude_static_roots. - Fixed the object size mapping algorithm. This shouldn't matter, but the old code was ugly. - Heap checking code could die if one of the allocated objects was larger than its base address. (Unsigned underflow problem. Thanks to Clay Spence for isolating the problem.) - Added RS6000 (AIX) dynamic library support and fixed STACK_BOTTOM. (Thanks to Fred Stearns.) - Added Fergus Henderson's patches for improved robustness with large heaps and lots of blacklisting. - Added Peter Chubb's changes to support Solaris Pthreads, to support MMAP allocation in Solaris, to allow Solaris to find dynamic libraries through /proc, to add malloc_typed_ignore_off_page, and a few other minor features and bug fixes. - The Solaris 2 port should not use sbrk. I received confirmation from Sun that the use of sbrk and malloc in the same program is not supported. The collector now defines USE_MMAP by default on Solaris. - Replaced the djgpp makefile with Gary Leavens' version. - Fixed MSWIN32 detection test. - Added Fergus Henderson's patches to allow putting the collector into a DLL under GNU win32. - Added Ivan V. Demakov's port to Watcom C on X86. - Added Ian Piumarta's Linux/PowerPC port. - On Brian Burton's suggestion added PointerFreeGC to the placement options in gc_cpp.h. This is of course unsafe, and may be controversial. On the other hand, it seems to be needed often enough that it's worth adding as a standard facility. Since 4.12: - Fixed a crucial bug in the Watcom port. There was a redundant decl of GC_push_one in gc_priv.h. - Added FINALIZE_ON_DEMAND. - Fixed some pre-ANSI cc problems in test.c. - Removed getpagesize() use for Solaris. It seems to be missing in one or two versions. - Fixed bool handling for SPARCCompiler version 4.2. - Fixed some files in include that had gotten unlinked from the main copy. - Some RS/6000 fixes (missing casts). Thanks to Toralf Foerster. - Fixed several problems in GC_debug_realloc, affecting mostly the FIND_LEAK case. - GC_exclude_static_roots contained a buggy unsigned comparison to terminate a loop. (Thanks to Wilson Ho.) - CORD_str failed if the substring occurred at the last possible position. (Only affects cord users.) - Fixed Linux code to deal with RedHat 5.0 and integrated Peter Bigot's os_dep.c code for dealing with various Linux versions. - Added workaround for Irix pthreads sigaction bug and possible signal misdirection problems. Since alpha1: - Changed RS6000 STACKBOTTOM. - Integrated Patrick Beard's Mac changes. - Alpha1 didn't compile on Irix m.n, m < 6. - Replaced Makefile.dj with a new one from Gary Leavens. - Added Andrew Stitcher's changes to support SCO OpenServer. - Added PRINT_BLACK_LIST, to allow debugging of high densities of false pointers. - Added code to debug allocator to keep track of return address in GC_malloc caller, thus giving a bit more context. - Changed default behavior of large block allocator to more aggressively avoid fragmentation. This is likely to slow down the collector when it succeeds at reducing space cost. - Integrated Fergus Henderson's CYGWIN32 changes. They are untested, but needed for newer versions. - USE_MMAP had some serious bugs. This caused the collector to fail consistently on Solaris with -DSMALL_CONFIG. - Added Linux threads support, thanks largely to Fergus Henderson. Since alpha2: - Fixed more Linux threads problems. - Changed default GC_free_space_divisor to 3 with new large block allocation. (Thanks to Matthew Flatt for some measurements that suggest the old value sometimes favors space too much over time.) - More CYGWIN32 fixes. - Integrated Tyson-Dowd's Linux-M68K port. - Minor HP PA and DEC UNIX fixes from Fergus Henderson. - Integrated Christoffe Raffali's Linux-SPARC changes. - Allowed for one more GC fixup iteration after a full GC in incremental mode. Some quick measurements suggested that this significantly reduces pause times even with smaller GC_RATE values. - Moved some more GC data structures into GC_arrays. This decreases pause times and GC overhead, but makes debugging slightly less convenient. - Fixed namespace pollution problem ("excl_table"). - Made GC_incremental a constant for -DSMALL_CONFIG, hopefully shrinking that slightly. - Added some win32 threads fixes. - Integrated Ivan Demakov and David Stes' Watcom fixes. - Various other minor fixes contributed by many people. - Renamed config.h to gcconfig.h, since config.h tends to be used for many other things. - Integrated Matthew Flatt's support for 68K MacOS "far globals". - Fixed up some of the dynamic library Makefile targets for consistency across platforms. - Fixed a USE_MMAP typo that caused out-of-memory handling to fail on Solaris. - Added code to test.c to test thread creation a bit more. - Integrated GC_win32_free_heap, as suggested by Ivan Demakov. - Fixed Solaris 2.7 stack base finding problem. (This may actually have been done in an earlier alpha release.) Since alpha3: - Fixed MSWIN32 recognition test, which interfered with cygwin. - Removed unnecessary gc_watcom.asm from distribution. Removed some obsolete README.win32 text. - Added Alpha Linux incremental GC support. (Thanks to Philipp Tomsich for code for retrieving the fault address in a signal handler.) Changed Linux signal handler context argument to be a pointer. - Took care of some new warnings generated by the 7.3 SGI compiler. - Integrated Phillip Musumeci's FreeBSD/ELF fixes. - -DIRIX_THREADS was broken with the -o32 ABI (typo in gc_priv.h> Since 4.13: - Fixed GC_print_source_ptr to not use a prototype. - generalized CYGWIN test. - gc::new did the wrong thing with PointerFreeGC placement. (Thanks to Rauli Ruohonen.) - In the ALL_INTERIOR_POINTERS (default) case, some callee-save register values could fail to be scanned if the register was saved and reused in a GC frame. This showed up in verbose mode with gctest compiled with an unreleased SGI compiler. I vaguely recall an old bug report that may have been related. The bug was probably quite old. (The problem was that the stack scanning could be deferred until after the relevant frame was overwritten, and the new save location might be outside the scanned area. Fixed by more eager stack scanning.) - PRINT_BLACK_LIST had some problems. A few source addresses were garbage. - Replaced Makefile.dj and added -I flags to cord make targets. (Thanks to Gary Leavens.) - GC_try_to_collect was broken with the nonincremental collector. - gc_cleanup destructors could pass the wrong address to GC_register_finalizer_ignore_self in the presence of multiple inheritance. (Thanks to Darrell Schiebel.) - Changed PowerPC Linux stack finding code. Since 4.14alpha1 - -DSMALL_CONFIG did not work reliably with large (> 4K) pages. Recycling the mark stack during expansion could result in a size zero heap segment, which confused things. (This was probably also an issue with the normal config and huge pages.) - Did more work to make sure that callee-save registers were scanned completely, even with the setjmp-based code. Added USE_GENERIC_PUSH_REGS macro to facilitate testing on machines I have access to. - Added code to explicitly push register contents for win32 threads. This seems to be necessary. (Thanks to Pierre de Rop.) Since 4.14alpha2 - changed STACKBOTTOM for DJGPP (Thanks to Salvador Eduardo Tropea). Since 4.14 - Reworked large block allocator. Now uses multiple doubly linked free lists to approximate best fit. - Changed heap expansion heuristic. Entirely free blocks are no longer counted towards the heap size. This seems to have a major impact on heap size stability; the old version could expand the heap way too much in the presence of large block fragmentation. - added -DGC_ASSERTIONS and some simple assertions inside the collector. This is mainlyt for collector debugging. - added -DUSE_MUNMAP to allow the heap to shrink. Suupported on only a few UNIX-like platforms for now. - added GC_dump_regions() for debugging of fragmentation issues. - Changed PowerPC pointer alignment under Linux to 4. (This needs checking by someone who has one. The suggestions came to me via a rather circuitous path.) - Changed the Linux/Alpha port to walk the data segment backwards until it encounters a SIGSEGV. The old way to find the start of the data segment broke with a recent release. - cordxtra.c needed to call GC_REGISTER_FINALIZER instead of GC_register_finalizer, so that it would continue to work with GC_DEBUG. - allochblk sometimes cleared the wrong block for debugging purposes when it dropped blacklisted blocks. This could result in spurious error reports with GC_DEBUG. - added MACOS X Server support. (Thanks to Andrew Stone.) - Changed the Solaris threads code to ignore stack limits > 8 MB with a warning. Empirically, it is not safe to access arbitrary pages in such large stacks. And the dirty bit implementation does not guarantee that none of them will be accessed. - Integrated Martin Tauchmann's Amiga changes. - Integrated James Dominy's OpenBSD/SPARC port. Since 5.0alpha1 - Fixed bugs introduced in alpha1 (OpenBSD & large block initialization). - Added -DKEEP_BACK_PTRS and backptr.h interface. (The implementation idea came from Al Demers.) Since 5.0alpha2 - Added some highly incomplete code to support a copied young generation. Comments on nursery.h are appreciated. - Changed -DFIND_LEAK, -DJAVA_FINALIZATION, and -DFINALIZE_ON_DEMAND, so the same effect could be obtained with a runtime switch. This is a step towards standardizing on a single dynamic GC library. - Significantly changed the way leak detection is handled, as a consequence of the above. Since 5.0 alpha3 - Added protection fault handling patch for Linux/M68K from Fergus Henderson and Roman Hodek. - Removed the tests for SGI_SOURCE in new_gc_alloc.h. This was causing that interface to fail on nonSGI platforms. - Changed the Linux stack finding code to use /proc, after changing it to use HEURISTIC1. (Thanks to David Mossberger for pointing out the /proc hook.) - Added HP/UX incremental GC support and HP/UX 11 thread support. Thread support is currently still flakey. - Added basic Linux/IA64 support. - Integrated Anthony Green's PicoJava support. - Integrated Scott Ananian's StrongARM/NetBSD support. - Fixed some fairly serious performance bugs in the incremental collector. These have probably been there essentially forever. (Mark bits were sometimes set before scanning dirty pages. The reclaim phase unnecessarily dirtied full small object pages.) - Changed the reclaim phase to ignore nearly full pages to avoid touching them. - Limited GC_black_list_spacing to roughly the heap growth increment. - Changed full collection triggering heuristic to decrease full GC frequency by default, but to explicitly trigger full GCs during heap growth. This doesn't always improve things, but on average it's probably a win. - GC_debug_free(0, ...) failed. Thanks to Fergus Henderson for the bug report and fix. Since 5.0 alpha4 - GC_malloc_explicitly_typed and friends sometimes failed to initialize first word. - Added allocation routines and support in the marker for mark descriptors in a type structure referenced by the first word of an object. This was introduced to support gcj, but hopefully in a way that makes it generically useful. - Added GC_requested_heapsize, and inhibited collections in nonincremental mode if the actual used heap size is less than what was explicitly requested. - The Solaris pthreads version of GC_pthread_create didn't handle a NULL attribute pointer. Solaris thread support used the wrong default thread stack size. (Thanks to Melissa O'Neill for the patch.) - Changed PUSH_CONTENTS macro to no longer modify first parameter. This usually doesn't matter, but it was certainly an accident waiting to happen ... - Added GC_register_finalizer_no_order and friends to gc.h. They're needed by Java implementations. - Integrated a fix for a win32 deadlock resulting from clock() calling malloc. (Thanks to Chris Dodd.) - Integrated Hiroshi Kawashima's port to Linux/MIPS. This was designed for a handheld platform, and may or may not be sufficient for other machines. - Fixed a va_arg problem with the %c specifier in cordprnt.c. It appears that this was always broken, but recent versions of gcc are the first to report the (statically detectable) bug. - Added an attempt at a more general solution to dlopen races/deadlocks. GC_dlopen now temporarily disables collection. Still not ideal, but ... - Added -DUSE_I686_PREFETCH, -DUSE_3DNOW_PREFETCH, and support for IA64 prefetch instructions. May improve performance measurably, but I'm not sure the code will run correctly on processors that don't support the instruction. Won't build except with very recent gcc. - Added caching for header lookups in the marker. This seems to result in a barely measurable performance gain. Added support for interleaved lookups of two pointers, but unconfigured that since the performance gain is currently near zero, and it adds to code size. - Changed Linux DATA_START definition to check both data_start and __data_start, since nothing else seems to be portable. - Added -DUSE_LD_WRAP to optionally take advantage of the GNU ld function wrapping mechanism. Probably currently useful only on Linux. - Moved some variables for the scratch allocator into GC_arrays, on Martin Hirzel's suggestion. - Fixed a win32 threads bug that caused the collector to not look for interior pointers from one of the thread stacks without ALL_INTERIOR_POINTERS. (Thanks to Jeff Sturm.) - Added Mingw32 support. (Thanks again to Jeff Sturm for the patch.) - Changed the alpha port to use the generic register scanning code instead of alpha_mach_dep.s. Alpha_mach_dep.s doesn't look for pointers in fp registers, but gcc sometimes spills pointers there. (Thanks to Manuel Serrano for helping me debug this by email.) Changed the IA64 code to do something similar for similar reasons. [5.0alpha5 doesn't really exist, but it may have escaped.] Since 5.0alpha6: - -DREDIRECT_MALLOC was broken in alpha6. Fixed. - Cleaned up gc_ccp.h slightly, thus also causing the HP C++ compiler to accept it. - Removed accidental reference to dbg_mlc.c, which caused dbg_mlc.o to be linked into every executable. - Added PREFETCH to bitmap marker. Changed it to use the header cache. - GC_push_marked sometimes pushed one object too many, resulting in a segmentation fault in GC_mark_from_mark_stack. This was probably an old bug. It finally showed up in gctest on win32. - Gc_priv.h erroneously #defined GC_incremental to be TRUE instead of FALSE when SMALL_CONFIG was defined. This was no doubt a major performance bug for the default win32 configuration. - Removed -DSMALL_CONFIG from NT_MAKEFILE. It seemed like an anchronism now that the average PC has 64MB or so. - Integrated Bryce McKinley's patches for linux threads and dynamic loading from the libgcj tree. Turned on dynamic loading support for Linux/PPC. - Changed the stack finding code to use environ on HP/UX. (Thanks to Gustavo Rodriguez-Rivera for the suggestion.) This should probably be done on other platforms, too. Since I can't test those, that'll wait until after 5.0. Since 5.0alpha7: - Fixed threadlibs.c for linux threads. -DUSE_LD_WRAP was broken and -ldl was omitted. Fixed Linux stack finding code to handle -DUSE_LD_WRAP correctly. - Added MSWIN32 exception handler around marker, so that the collector can recover from root segments that are unmapped during the collection. This caused occasional failures under Windows 98, and may also be an issue under Windows NT/2000. Since 5.0 - Fixed a gc.h header bug which showed up under Irix. (Thanks to Dan Sullivan.) - Fixed a typo in GC_double_descr in typd_mlc.c. This probably could result in objects described by array descriptors not getting traced correctly. (Thanks to Ben Hutchings for pointing this out.) - The block nearly full tests in reclaim.c were not correct for 64 bit environments. This could result in unnecessary heap growth under unlikely conditions. Since 5.1 - dyn_load.c declared GC_scratch_last_end_ptr as an extern even if it was defined as a macro. This prevented the collector from building on Irix. - We quietly assumed that indirect mark descriptors were never 0. Our own typed allocation interface violated that. This could result in segmentation faults in the marker with typed allocation. - Fixed a _DUSE_MUNMAP bug in the heap block allocation code. (Thanks to Ben Hutchings for the patch.) - Taught the collector about VC++ handling array operator new. (Thanks again to Ben Hutchings for the patch.) - The two copies of gc_hdrs.h had diverged. Made one a link to the other again. Since 5.2 (A few 5.2 patches are not in 6.0alpha1) - Fixed _end declaration for OSF1. - There were lots of spurious leak reports in leak detection mode, caused by the fact that some pages were not being swept, and hence unmarked objects weren't making it onto free lists. (This bug dated back to 5.0.) - Fixed a typo in the liblinuxgc.so Makefile rule. - Added the GetExitCodeThread to Win32 GC_stop_world to (mostly) work around a Windows 95 GetOpenFileName problem. (Thanks to Jacob Navia.) Since 5.3 - Fixed a typo that prevented compilation with -DUSE_3DNOW_PREFETCH. (Thanks to Shawn Wagner for actually testing this.) - Fixed GC_is_thread_stack in solaris_threads.c. It forgot to return a value in the common case. I wonder why nobody noticed? - Fixed another silly syntax problem in GC_double_descr. (Thanks to Fergus Henderson for finding it.) - Fixed a GC_gcj_malloc bug: It tended to release the allocator lock twice. Since 5.4 (A few 5.3 patches are not in 6.0alpha2) - Added HP/PA prefetch support. - Added -DDBG_HDRS_ALL and -DSHORT_DBG_HDRS to reduce the cost and improve the reliability of generating pointer backtrace information, e.g. in the Bigloo environment. - Added parallel marking support (-DPARALLEL_MARK). This currently works only under IA32 and IA64 Linux, but it shouldn't be hard to adapt to other platforms. This is intended to be a lighter-weight (less new code, probably not as scalable) solution than the work by Toshio Endo et al, at the University of Tokyo. A number of their ideas were reused, though the code wasn't, and the underlying data structure is significantly different. In particular, we keep the global mark stack as a single shared data structure, but most of the work is done on smaller thread-local mark stacks. - Changed GC_malloc_many to be cheaper, and to require less mutual exclusion with -DPARALLEL_MARK. - Added full support for thread local allocation under Linux (-DTHREAD_LOCAL_ALLOC). This is a thin veneer on GC_malloc_many, and should be easily portable to other platforms, especially those that support pthreads. - CLEAR_DOUBLE was not always getting invoked when it should have been. - GC_gcj_malloc and friends used different out of memory handling than everything else, probably because I forgot about one when I implemented the other. They now both call GC_oom_fn(), not GC_oom_action(). - Integrated Jakub Jelinek's fixes for Linux/SPARC. - Moved GC_objfreelist, GC_aobjfreelist, and GC_words_allocd out of GC_arrays, and separately registered the first two as excluded roots. This makes code compiled with gc_inl.h less dependent on the collector version. (It would be nice to remove the inclusion of gc_priv.h by gc_inl.h completely, but we're not there yet. The locking definitions in gc_priv.h are still referenced.) This change was later coniditoned on SEPARATE_GLOBALS, which is not defined by default, since it involves a performance hit. - Register GC_obj_kinds separately as an excluded root region. The attempt to register it with GC_arrays was usually failing. (This wasn't serious, but seemed to generate some confusion.) - Moved backptr.h to gc_backptr.h. Since 6.0alpha1 - Added USE_MARK_BYTES to reduce the need for compare-and-swap on platforms for which that's expensive. - Fixed a locking bug ib GC_gcj_malloc and some locking assertion problems. - Added a missing volatile to OR_WORD and renamed the parameter to GC_compare_and_swap so it's not a C++ reserved word. (Thanks to Toshio Endo for pointing out both of those.) - Changed Linux dynamic library registration code to look at /proc/self/maps instead of the rld data structures when REDIRECT_MALLOC is defined. Otherwise some of the rld data data structures may be prematurely garbage collected. (Thanks to Eric Benson for helping to track this down.) - Fixed USE_LD_WRAP a bit more, so it should now work without threads. - Renamed XXX_THREADS macros to GC_XXX_THREADS for namespace correctness. Tomporarily added some backward compatibility definitions. Renamed USE_LD_WRAP to GC_USE_LD_WRAP. - Many MACOSX POWERPC changes, some additions to the gctest output, and a few minor generic bug fixes. (Thanks to Dietmar Planitzer.) Since 6.0 alpha2 - Fixed the /proc/self/maps code to not seek, since that apparently is not reliable across all interesting kernels. - Fixed some compilation problems in the absence of PARALLEL_MARK (introduced in alpha2). - Fixed an algorithmic problem with PARALLEL_MARK. If work needs to be given back to the main mark "stack", the BOTTOM entries of the local stack should be given away, not the top ones. This has substantial performance impact, especially for > 2 processors, from what I can tell. - Extracted gc_lock.h from gc_priv.h. This should eventually make it a bit easier to avoid including gc_priv.h in clients. - Moved all include files to include/ and removed duplicate links to the same file. The old scheme was a bad idea because it was too easy to get the copies out of sync, and many systems don't support hard links. Unfortunately, it's likely that I broke some of the non-Unix Makefiles in the process, although I tried to update them appropriately. - Removed the partial support for a copied nursery. It's not clear that this would be a tremendous win, since we don't consistently lose to generational copying collectors. And it would significantly complicate many things. May be reintroduced if/when it really turns out to win. - Removed references to IRIX_JDK_THREADS, since I believe there never were and never will be any clients. - Added some code to linux_threads.c to possibly support HPUX threads using the Linux code. Unfortunately, it doesn't work yet, and is currently disabled. - Added support under Linux/X86 for saving the call chain, both in (debug) objects for client debugging, and in GC_arrays._last_stack for GC debugging. This was previously supported only under Solaris. It is not enabled by default under X86, since it requires that code be compiled to explicitly dave frame pointers on the call stack. (With gcc this currently happens by default, but is often turned off explicitly.) To turn it on, define SAVE_CALL_CHAIN. Since 6.0 alpha3 - Moved up the detection of mostly full blocks to the initiatiation of the sweep phase. This eliminates some lock conention in the PARALLEL_MARK case, as multiple threads try to look at mostly full blocks concurrently. - Restored the code in GC_malloc_many that grabs a prefix of the global free list. This avoids the case in which every GC_malloc_many call tries and fails to allocate a new heap block, and the returns a single object from the global free list. - Some minor fixes in new_hblk.c. (Attempted to build free lists in order of increasing addresses instead of decreasing addresses for cache performance reasons. But this seems to be only a very minor gain with -DEAGER_SWEEP, and a loss in other cases. So the change was backed out.) - Fixed some of the documentation. (Thanks in large part to Fergus Henderson.) - Fixed the Linux USE_PROC_FOR_LIBRARIES code to deal with apps that perform large numbers of mmaps. (Thanks to Eric Benson.) Also fixed that code to deal with short reads. - Added GC_get_total_bytes(). - Fixed leak detection mode to avoid spurious messages under linuxthreads. (This should also now be easy for the other supported threads packages. But the code is tricky enough that I'm hesitant to do it without being able to test. Everything allocated in the GC thread support itself should be explicitly deallocated.) - Made it possible (with luck) to redirect malloc to GC_local_malloc. Since 6.0 alpha4 - Changed the definition of GC_pause in linux_threads.c to use a volatile asm. Some versions of gcc apparently optimize away writes to local volatile variables. This caused poor locking behaviour starting at about 4 processors. - Added GC_start_blocking(), GC_end_blocking() calls and wrapper for sleep to linux_threads.c. The first two calls could be used to generally avoid sending GC signals to blocked threads, avoiding both premature wakeups and unnecessary overhead. - Fixed a serious bug in thread-local allocation. At thread termination, GC_free could get called on small integers. Changed the code for thread termination to more efficiently return left-over free-lists. - Integrated Kjetil Matheussen's BeOS support. - Rearranged the directory structure to create the doc and tests subdirectories. - Sort of integrated Eric Benson's patch for OSF1. This provided basic OSF1 thread support by suitably extending hpux_irix_threads.c. Based on earlier email conversations with David Butenhof, I suspect that it will be more reliable in the long run to base this on linux_threads.c instead. Thus I attempted to patch up linux_threads.c based on Eric's code. The result is almost certainly broken, but hopefully close enough that someone with access to a machine can pick it up. - Integrated lots of minor changes from the NetBSD distribution. (These were supplied by David Brownlee. I'm not sure about the original authors.) - Hacked a bit more on the HP/UX thread-support in linux_threads.c. It now appears to work in the absence of incremental collection. Renamed hpux_irix_threads.c back to irix_threads.c, and removed the attempt to support HPUX there. - Changed gc.h to define _REENTRANT in cases in which it should already have been defined. It is still safer to also define it on the command line. Since 6.0alpha5: - Changed the definition of DATASTART on ALPHA and IA64, where data_start and __data_start are not defined by earlier versions of glibc. This might need to be fixed on other platforms as well. - Changed the way the stack base and backing store base are found on IA64. This should now remain reliable on future kernels. But since it relies on /proc, it will no longer work in the simulated NUE environment. - Made the call to random() in dbg_mlc.c with -DKEEP_BACK_PTRS dependent on the OS. On non-Unix systems, rand() should be used instead. Handled small RAND_MAX. (Thanks to Peter Ross for pointing this out.) - Fixed the cord make rules to create the cord subdirectory, if necessary. (Thanks to Doug Moen.) - Changed fo_object_size calculation in finalize.c. Turned finalization of nonheap object into a no-op. Removed anachronism from GC_size() implementation. - Changed GC_push_dirty call in solaris_threads.c to GC_push_selected. It was missed in a previous renaming. (Thanks to Vladimir Tsichevski for pointing this out.) - Arranged to not not mask SIGABRT in linux_threads.c. (Thanks to Bryce McKinlay.) - Added GC_no_dls hook for applications that want to register their own roots. - Integrated Kjetil Matheussen's Amiga changes. - Added FREEBSD_STACKBOTTOM. Changed the X86/FreeBSD port to use it. (Thanks to Matthew Flatt.) - Added pthread_detach interception for platforms supported by linux_threads.c and irix_threads.c. Should also be added for Solaris? - Changed the USE_MMAP code to check for the case in which we got the high end of the address space, i.e. mem_ptr + mem_sz == 0. It appears that this can happen under Solaris 7. It seems to be allowed by what I would claim is an oversight in the mmap specification. (Thanks to Toshio Endo for pointing out the problem.) - Cleanup of linux_threads.c. Some code was originally cloned from irix_threads.c and now unnecessary. Some comments were obviously wrong. - (Mostly) fixed a longstanding problem with setting of dirty bits from a signal handler. In the presence of threads, dirty bits could get lost, since the etting of a bit in the bit vector was not atomic with respect to other updates. The fix is 100% correct only for platforms for which GC_test_and_set is defined. The goal is to make that all platforms with thread support. Matters only if incremental GC and threads are both enabled. - made GC_all_interior_pointers (a.k.a. ALL_INTERIOR_POINTERS) an initialization time, instead of build-time option. This is a nontrivial, high risk change. It should slow down the code measurably only if MERGE_SIZES is not defined, which is a very nonstandard configuration. - Added doc/README.environment, and implemented what it describes. This allows a number of additional configuration options to be set through the environment. It documents a few previously undocumented options. - Integrated Eric Benson's leak testing improvements. - Removed the option to throw away the beginning of each page (DISCARD_WORDS). This became less and less useful as processors enforce stricter alignment. And it hadn't been tested in ages, and was thus probably broken anyway. Since 6.0alpha6: - Added GC_finalizer_notifier. Fixed GC_finalize_on_demand. (The variable actually wasn't being tested at the right points. The build-time flag was.) - Added Tom Tromey's S390 Linux patch. - Added code to push GC_finalize_now in GC_push_finalizer_structures. (Thanks to Matthew Flatt.) - Added GC_push_gc_structures() to push all GC internal roots. - Integrated some FreeBSD changes from Matthew Flatt. - It looks like USRSTACK is not always correctly defined under Solaris. Hacked gcconfig.h to attempt to work around the problem. The result is not well tested. (Thanks again to Matthew Flatt for pointing this out. The gross hack is mine. - HB) - Added Ji-Yong Chung's win32 threads and C++ fixes. - Arranged for hpux_test_and_clear.s to no longer be needed or built. It was causing build problems with gas, and it's not clear this is better than the pthreads alternative on this platform. - Some MINGW32 fixes from Hubert Garavel. - Added Initial Hitachi SH4 port from Kaz Kojima. - Ported thread-local allocation and parallel mark code to HP/UX on PA_RISC. - Made include/gc_mark.h more public and separated out the really private pieces. This is probably still not quite sufficient for clients that want to supply their own kind of type information. But it's a start. This involved lots of identifier renaming to make it namespace clean. - Added GC_dont_precollect for clients that need complete control over the root set. - GC_is_visible didn't do the right thing with gcj objects. (Not that many people are likely to care, but ...) - Don't redefine read with GC_USE_LD_WRAP. - Initial port to LINUX/HP_PA. Incremental collection and threads are not yet supported. (Incremental collection should work if you have the right kernel. Threads may work with a sufficiently patched pthread library.) - Changed gcconfig.h to recognize __i386__ as an alternative to i386 in many places. (Thanks to Benjamin Lerman.) - Made win32_threads.c more tolerant of detaching a thread that it didn't know about. (Thanks to Paul Nash.) - Added Makefile.am and configure.in from gcc to the distribution, with minimal changes. For the moment, those are just placeholders. In the future, we're planning to switch to a GNU-style build environment for Un*x-like systems, though the old Makefile will remain as a backup. - Turned off STUBBORN_ALLOC by default, and added it back as a Makefile option. - Redistributed some functions between malloc.c and mallocx.c, so that simple statically linked apps no longer pull in mallocx.o. - Changed large object allocation to clear the first and last few words of each block before releassing the lock. Otherwise the marker could see objects with nonsensical type descriptors. - Fixed a couple of subtle problems that could result in not recognizing interior pointers from the stack. (I believe these were introduced in 6.0alpha6.) - GC_debug_free_inner called GC_free, which tried to reacquire the allocator lock, and hence deadlocked. (DBG_HDRS_ALL probably never worked with threads?) - Fixed several problems with back traces. Accidental references to a free list could cause the free list pointer to be overwritten by a back pointer. There seemed to be some problems with the encoding of root and finalizer references. Since 6.0alpha7: - Changed GC_debug_malloc_replacement and GC_debug_realloc_replacement so that they compile under Irix. (Thanks to Dave Love.) - Updated powerpc_macosx_mach_dep.s so that it works if the collector is in a dynamic library. (Thanks to Andrew Begel.) - Transformed README.debugging into debugging.html, updating and expanding it in the process. Added gcdescr.html and tree.html from the web site to the GC distribution. - Fixed several problems related to PRINT_BLACK_LIST. This involved restructuring some of the marker macros. - Fixed some problems with the sizing of objects with debug information. Finalization was broken KEEP_BACK_PTRS or PRINT_BLACK_LIST. Reduced the object size with SHORT_DEBUG_HDRS by another word. - The "Needed to allocate blacklisted ..." warning had inadvertently been turned off by default, due to a buggy test in allchblk.c. Turned it back on. - Removed the marker macros to deal with 2 pointers in interleaved fashion. They were messy and the performance improvement seemed minimal. We'll leave such scheduling issues to the compiler. - Changed Linux/PowerPC test to also check for __powerpc__ in response to a discussion on the gcc mailing list. - On Matthew Flatt's suggestion removed the "static" from the jmp_buf declaration in GC_generic_push_regs. This was causing problems in systems that register all of their own roots. It looks far more correct to me without the "static" anyway. - Fixed several problems with thread local allocation of pointerfree or typed objects. The collector was reclaiming thread-local free lists, since it wasn't following the link fields. - There was apparently a long-standing race condition related to multithreaded incremental collection. A collection could be started and a thread stopped between the memory unprotect system call and the setting of the corresponding dirt bit. I believe this did not affect Solaris or PCR, which use a different dirty-bit implementation. Fixed this by installing signal handlers with sigaction instead of signal, and disabling the thread suspend signal while in the write-protect handler. (It is unclear whether this scenario ever actually occurred. I found it while tracking down the following:) - Incremental collection did not cooperate correctly with the PARALLEL_MARK implementation of GC_malloc_many or the local_malloc primitves. It still doesn't work well, but it shouldn't lose memory anymore. - Integrated some changes from the gcc source tree that I had previously missed. (Thanks to Bryce McKinley for the reminder/diff.) - Added Makefile.direct as a copy of the default Makefile, which would normally be overwritten if configure is run. - Changed the gc.tar target in Makefile.direct to embed the version number in the gc directory name. This will affect future tar file distributions. - Changed the Irix dynamic library finding code to no longer try to eliminate writable text segments under Irix6.x, since that is probably no longer necessary, and can apparently be unsafe on occasion. (Thanks to Shiro Kawai for pointing this out.) - GC_cleanup with GC_DEBUG enabled passed a real object base address to GC_debug_register_finalizer_ignore_self, which expected a pointer past the debug header. Call GC_register_finalizer_ignore_self instead, even with debugging enabled. (Thanks to Jean-Daniel Fekete for catching this.) - The collector didn't build with call chain saving enabled but NARGS=0. (Thanks to Maarten Thibaut.) - Fixed up the GNU-style build files enough so that they work in some obvious cases. - Added initial port to Digital Mars compiler for win32. (Thanks to Walter Bright.) Since 6.0alpha8: - added README.macros. - Made gc.mak a symbolic link to work around winzip's tendency to ignore hard links. - Simplified the setting of NEED_FIND_LIMIT in os_dep.c, possibly breaking it on untested platforms. - Integrated initial GNU HURD port. (Thanks to Chris Lingard and Igor Khavkine.) - A few more fixes for Digital Mars compiler (Walter Bright). - Fixed gcc version recognition. Renamed OPERATOR_NEW_ARRAY to GC_OPERATOR_NEW_ARRAY. Changed GC_OPERATOR_NEW_ARRAY to be the default. It can be overridden with -DGC_NO_OPERATOR_NEW_ARRAY. (Thanks to Cesar Eduardo Barros.) - Changed the byte size to free-list mapping in thread local allocation so that size 0 allocations are handled correctly. - Fixed Linux/MIPS stackbottom for new toolchain. (Thanks to Ryan Murray.) - Changed finalization registration to invoke GC_oom_fn when it runs out of memory. - Removed lvalue cast in finalize.c. This caused some debug configurations not to build with some non-gcc compilers. Since 6.0alpha9: - Two more bug fixes for KEEP_BACK_PTRS and DBG_HDRS_ALL. - Fixed a stack clearing problem that resulted in SIGILL with a misaligned stack pointer for multithreaded SPARC builds. - Integrated another HURD patch (thanks to Igor Khavkine). Since 6.0: - Non-debug, atomic allocations could result in bogus smashed object reports with debugging on. (Thanks to Patrick Doyle for the small test case.) - Fixed GC_get_register_stack_base (Itanium only) to work around a glibc 2.2.4 bug. - Initial port to HP/UX on Itanium. Thread support and both 32 and 64 bit ABIs appear to work. Parallel mark support doesn't yet, due to some inline assembly code issues. Thread local allocation does appear to work. - ifdef'ed out glibc2.1/Itanium workaround. I suspect nobody is using that combination anymore. - Added a patch to make new_gc_alloc.h usable with gcc3.0. (Thanks to Dimitris Vyzovitis for the patch.) - Debugged 64-bit support on HP/UX PA-RISC. - Turned on dynamic loading support for FreeBSD/ELF. (Thanks to Peter Housel.) - Unregistering of finalizers with debugging allocation was broken. (Thanks to Jani Kajala for the test case.) - Old finalizers were not returned correctly from GC_debug_register_finalizer. - Disabled MPROTECT_VDB for Linux/M68K based on a report that it doesn't work. - Cleaned up some statistics gathering code in reclaim.c (Thanks to Walter Bright.) - Added some support for OpenBSD/ELF/Linux. (Thanks to Suzuki Toshiya.) - Added Jakub Jelinek's patch to use dl_iterate_phdr for dynamic library traversal to dyn_load.c. Changed it to weakly reference dl_iterate_phdr, so that the old code is stilll used with old versions of glibc. - Cleaned up feature test macros for various threads packages and integrated (partially functional) FreeBSD threads code from Loren Rittle. It's likely that the cleanup broke something, since it touched lots of code. It's also likelly that it fixed some unreported bugs in the less common thread implementations, since some of the original code didn't stand up to close scrutiny. Support for the next pthreads implementation should be easier to add. Since 6.1alpha1: - No longer wrap read by default in multithreaded applications. It was pointed out on the libgcj list that this holds the allocation lock for way too long if the read blocks. For now, reads into the heap are broken with incremental collection. It's possible to turn this back on if you make sure that read calls don't block (e.g. by calling select first). - Fix ifdef in Solaris_threads.h to refer to GC_SOLARIS_THREADS. - Added check for environment variable GC_IGNORE_GCJ_INFO. - Added printing of stop-the-world GC times if GC_PRINT_STATS environment variable is set. - The calloc definition in leak_detector.h was missing parentheses, and realloc was missing a second argument to GC_REALLOC. (Thanks to Elrond (elrondsamba-tng.org).) - Added GC_PRINT_BACK_HEIGHT environment variable and associated code, mostly in the new file backgraph.c. See doc/README.environment. - Added -DUSE_GLOBAL_ALLOC to work around a Windows NT issue. (Thanks to Jonathan Clark.) - Integrated port to NEC EWS4800 (MIPS-based workstation, with somewhat different address-space layout). This may help for other machines with holes in the data segment. (Thanks to Hironori Sakamoto.) - Changed the order in which GC_push_roots and friends push things onto the mark stack. GC_push_all calls need to come first, since we can't necessarily recovere if those overflow the mark stack. (Thanks to Matthew Flatt for tracking down the problem.) - Some minor cleanups to mostly support the Intel compiler on Linux/IA64. Since 6.1 alpha2: - Minor cleanup on the gcconfig.h section for SPARC. - Minor fix to support Intel compiler for I386/Linux. (Thanks to Sven Hartrumpf.) - Added SPARC V9 (64-bit) support. (Thanks to Jeff Sturm.) - Restructured the way in which we determine whether or not to keep call stacks for debug allocation. By default SAVE_CALL_COUNT is now zero on all platforms. Added SAVE_CALL_NARGS parameters. If possible, use execinfo.h to capture call stack. (This should add support for a number of new platforms, though often at considerable runtime expense.) - Try to print symbolic information for call stacks. On Linux, we do this with a combination of execinfo.h and running addr2line in a separate process. This is both much more expensive and much more useful. Amazingly, it seems to be fast enough for most purposes. - Redefined strdup if -DREDIRECT_MALLOC is given. - Changed incremental collector and MPROTECT_VDB implementation so that, under favorable conditions, pointerfree objects are not protected. Added GC_incremental_protection_needs() to determine ahead of time whether pointerfree objects may be protected. Replaced GC_write_hint() with GC_remove_protection(). - Added test for GC_ENABLE_INCREMENTAL environment variable. - Made GC_time_limit runtime configurable. Added GC_PAUSE_TIME_TARGET environment variable. - Eliminated GC_page_sz, a duplicate of GC_page_size. - Caused the Solaris and Irix thread creation primitives to call GC_init_inner(). Since 6.1alpha3: - Fixed typo in sparc_mach_dep.S, preventing the 64-bit version from building. Increased 64-bit heap size limit in test.c slightly, since a functional SPARC collector seems to slightly exceed the old limits. (Thanks again to Jeff Sturm.) - Use NPRGREG in solaris_threads.c, thus printing all registers if things go wrong. - Added GC_MARKERS environment variable to allow use of a single marker thread on an MP without confusing the lock implementation. - Collect much less aggressively in incremental mode with GC_TIME_UNLIMITED. This is really a purely generational mode, and we can afford to postpone the collection until the heap is (nearly) full. - Remove read() wrapper for MPROTECT_VDB. It was causing more harm than good. It is often no longer needed if system calls avoid writing to pointerfull heap objects. - Fix MACOSX test in gcconfig.h. (Thanks to John Clements.) - Change GC_test_and_set so that it consistently has one argument. Add spaces to ::: in powerpc assembly code in gc_locks.h. (Thanks to Ryan Murray.) - Fixed a formatting error in dbg_mlc.c. Added prototype to GC_abort() declaration. (Thanks to Michael Smith.) - Removed "source" argument to GC_find_start(). Eliminate GC_FIND_START(). - Added win32 recognition code in configure.in. Changed some of the dllimport/export defines in gc.h. (Thanks to Adam Megacz.) - GC_malloc_many didn't set hb_last_reclaimed when it called GC_reclaim_generic. (I'm not sure this matters much, but ...) - Allocating uncollectable objects with debug information sometimes allocated objects that were one byte too small, since uncollectable objects don't have the extra byte added at the end. (Thanks to Wink Saville for pointing this out.) - Added a bit more assertion checking to make sure that gcj objects on free lists never have a nonzero second word. - Replaced BCC_MAKEFILE with an up-to-date one. (Thanks to Andre Leiradella.) - Upgraded libtool, cinfigure.in and some related files to hopefully support NetBSD/SPARC. (Thanks to Adrian Bunk.) Unfortunately, libtool 1.4.2 seemed to be buggy due to missing quotes in several "test" invocations. Fixed those in the ltmain.sh script. - Some win32-specific patches, including the introduction of GC_CreateThread. (Thanks to Adam Megacz.) - Merged in gcj changes from Anthony Green to support embedded systems. - Tried to consistently rename preprocessed assembly files with a capital .S extension. - Use alpha_mach_dep.S on ALPHA again. It doesn't really matter, but this makes our distribution consistent with the gcc one, avoiding future merge problems. - Move GET_MEM definition into gcconfig.h. Include gcconfig.h slightly later in gc_priv.h to avoid forward references to ptr_t. - Add some testing of local allocation to test.c. - Change definition of INVALID_QTID in specific.h. The -1 value was used inconsistently, and too likely to collide with a valid stack address. Some general clean-up of specific.[ch]. Added assertions. (Thanks to Michael Smith for tracking down an intermittent bug to this general area. I'm not sure it has been squashed yet, however.) - On Pthread systems it was not safe to call GC_malloc() between fork() and exec(). According to the applicable standards, it doesn't appear to be safe to call malloc() or many other libc functions either, thus it's not clear this is fixable. Added experimental support for -DHANDLE_FORK in linux_threads.c which tries to support it. It may succeed if libc does the right thing. I'm not sure whether it does. (Thanks to Kenneth Schalk for pointing out this issue.) - Documented thread local allocation primitives to require an explicit GC_init call. GC_init_parallel is no longer declared to be a constructor function, since that isn't portable and often seems to lead to initialization order problems. - Changed gc_cpp.cc and gc_cpp.h in one more attempt to make them compatible with Visual C++ 6. (Thanks to Wink Saville for the patch.) - Some more patches for Linux on HP PA-RISC. - Added include/gc_allocator.h. It implements (hopefully) standard conforming (as opposed to SGI-style) allocators that allocate collectable (gc_allocator) or GC-traceable, but not collectable (traceable_allocator) objects. This borrows heavily from libstc++, which borrows heavily from the SGI implementation, this part of which was written by Matt Austern. Changed test_cpp.cc to very minimally test this. - On Linux/X86, retry mmap with a different start argument. That should allow the collector to use more (closer to 3GB) of the address space. (Thanks to Jeffrey Mark Siskind for tracking this down.) - Force 64 bit alignment with GCJ support. (Reflects Bryce McKinley's patch to the gcc tree.) - Refined the choice of sa_handler vs. sa_sigaction in GC_dirty_init to accomodate some glibc5 systems. (Thanks to Dan Fandrich for the patch.) - Compensated for the fact that current versions of glibc set __libc_stack_end incorrectly on Linux/IA64 while initialization code is running. This could cause the collector to miss 16 bytes of the memory stack if GC_malloc or friends where called before main(). - Mostly integrated Takis Psarogiannakopoulos' port to DG/UX Inix 86. This will probably take another iteration to work, since his patch conflicted with the libtool upgrade. - Added README.arm.cross containing some information about cross- compiling to an ARM processor from Margaret Fleck. Since 6.1alpha4: - Added GC_finalizer_mem_freed, and changed some of the code that decided on heap expansion to look at it. Memory explicitly deallocated by finalizers essentially needs to be counted as reclaimed by the GC. Otherwise there are cases in which the heap can grow unboundedly. (Thanks to Mark Reichert for the test case.) - Integrated Adam Megacz patches to not scan dynamic libraries if we are compiling with gcc on win32. Otherwise we need structured exception handling to deal with asynchronously unmapped root segments, and gcc doesn't directly support that. - Integrated Anthony Green's patch to support Wine. - GC_OPERATOR_NEW_ARRAY was misspelled OPERATOR_NEW_ARRAY in several places, including gc_cpp.cc. (Thanks to Wink Saville for pointing this out.) - Integrated Loren James Rittle's Alpha FreeBSD patches. In response to Richard Henderson's suggestion, these also changed the declarations of symbols like _end on many platforms to that they wouldn't mistakenly be declared as short data symbols. - Integrated changes from the Debian distribution. (Thanks to Ryan Murray for pointing these out.) Fix C++ comments in POWERPC port. Add ARM32 incremental GC support. Get rid of USE_GENERIC_PUSH_REGS for alpha/Linux, this time for real. Use va_copy to get rid of cord printf problems (finally). - Close file descriptor used to count cpus. Thanks to Jeff Sturm for pointing out the omission. - Don't just drop gcj free lists in GC_start_reclaim, since that can eventually cause the marker to see a bogus mark descriptor in the dropped objects. The usual symptom was a very intermittent segmentation fault in the marker. This mattered only if one of the GC_gcj_malloc variants was used. (Thanks to Michael Smith, Jeff Sturm, Bryce McKinley and Tom Tromey for helping to track this down.) - Fixed Linux and Solaris/64 SPARC configuration. (Thanks to David Miller, Jeff Sturm, Tom Tromey, and Christian Joensson.) - Fixed a typo in strdup definition. (Thanks to Gerard A Allan.) - Changed Makefile.direct to invoke $(CC) to assemble alpha_mach_dep.S. This is needed on Linux. I'm not sure whether it's better or worse on Tru64. - Changed gc_cpp.h once more to declare operator new and friends only in a Microsoft environment. This may need further fine tuning. (Thanks to Johannes Schmidt for pointing out that the older code breaks on gcc3.0.4.) - Don't ever override strdup if it's already macro defined. (Thanks to Adnan Ali for pointing out the problem.) - Changed gc_cpp.h yet again to also overload placement new. Due to the C++ overloading rules, the other overloaded new operations otherwise hide placement new, which causes many STL uses to break. (Thanks to Reza Shahidi for reporting this, and to Matt Austern for proposing a fix.) - Integrated cygwin pthreads support from Dan Bonachea. - Turn on DYNAMIC_LOADING for NetBSD. (Thanks to Krister Walfridsson.) - Changed printing code to print more complete GC times. - Applied Mark Mitchell's Irix patch to correct some bitrot. - Clarified which object-printing routines in dbg_mlc.c should hold the allocation lock. Restructured the code to allow reasonable object printing with -DREDIRECT_MALLOC. - Fix the Linux mmap code to always start with 0x1000 as the initial hint. Minor patches for 64-bit AIX, particularly to STACKBOTTOM. (Thanks again to Jeffrey Mark Siskind.) - Renamed "SUSPENDED" flag for Solaris threads support to avoid a conflict with a system header. (Thanks to Philp Brown.) - Cause win32_threads.c to handle an out of range stack pointer correctly, though currently with a warning. (Thanks to Jonathan Clark for observing that win32 applications may temporarily use the stack pointer for other purposes, and suggesting a fix. Unfortunately, it's not clear that there is a complete solution to this problem.) Since 6.1alpha5: - Added GC_MAXIMUM_HEAP_SIZE environment variable. - Fix configure.in for MIPS/LINUX. (Thanks to H.J. Lu.) - Double page hash table size for -DLARGE_CONFIG. - Integrated Bo Thorsen's X86-64 support. - STACKBOTTOM definition for LINUX/MIPS was partially changed back. (Thanks to H.J. Lu and Hiroshi Kawashima for resolving this.) - Replaced all occurrences of LINUX_DATA_START in gcconfig.h with SEARCH_FOR_DATA_START. It doesn't hurt to falll back to a search. And __data_start doesn't seem to get defined correctly of the GC library is loaded with LD_PRELOAD, e.g. for leak detection. - If the GC_find_leak environment variable is set, do a atexit(GC_gcollect) to give us at least one chance to detect leaks. This may report some very benign leaks, but ... - Addeded REDIRECT_FREE. It's necessary if we want leak detection with LD_PRELOAD. - Defer printing of leaked objects, as for smashed objects. - Fixed process and descriptor leak in GC_print_callers. Try for line number even if we got function name.) - Ported parallel GC support and thread local allocation to Alpha. Not yet well-tested. - Added GC_DUMP_REGULARLY and added finalization statistics to GC_dump(). - Fixed Makefile.am to mention alpha_mach_dep.S instead of the defunct alpha_mach_dep.s. (Thanks to Fergus Henderson.) - Incorporated a change to new_gc_alloc.h, suggested by Johannes Schmidt, which should make it work with gcc3.1. (I would still like to encourage use of gc_allocator.h instead.) - Use alpha_mach_dep.S only on Linux. (It's not clear that this is optimal, but it otherwise didn't build on Tru64. Thanks to Fergus Henderson.) - Added ifdef to guard free() in os_dep.c. Otherwise we get a compilation error on Irix. (Thanks to Dai Sato.) - Added an experimental version of GC_memalign to mallocx.c. This can't always work, since we don't handle alignment requests in the hblk-level allocator, and we can't handle arbitrary pointer displacements unless GC_all_interior_pointers is enabled. But it should work for alignment requests up to HBLKSIZE. This is not yet documented in the standard places. - Finally debugged the OSF1/Tru64 thread support. This needs more testing, since I needed to add a somewhat unconvincing workaround for signal delivery issues that I don't yet completely understand. But it does pass my tests, even in parallel GC mode. Incremental GC support is disabled if thread support is enabled, due to the signal issues. - Eliminated name-space-incorrect definition of _cdecl from gc_cpp.h. - Added GC_debug_malloc_replacement and GC_debug_realloc_replacement declarations to gc.h. On IA64, this is required for REDIRECT_MALLOC to work correctly with these. - Fixed Linux USE_PROC_FOR_LIBRARIES to work with a 64-bit /proc format. Since 6.1: - Guard the test for GC_DUMP_REGULARLY in misc.c with "#ifndef NO_DEBUGGING". Otherwise it fails to build with NO_DEBUGGING defined. (Thanks to Manuel Serrano.) - Message about retrying suspend signals was incorrectly generated even when flag was not set. - Cleaned up MACOSX/NEXT root registration code. There was apparently a separate ifdef case in GC_register_data_segments() for no reason. - Removed MPROTECT_VDB for MACOSX port, based on one negative report. - Arrange for gc.h and friends to be correctly installed with GNU-style "make install". - Enable the GNU-style build facility include C++ support in the library with --enable-cplusplus. (Thanks to Thomas Maier for some of the patch.) - Mark from GC_thread_key in linux_threads.c, in case that's allocated from the garbage collected heap, as it is with our own thread-specific storage implementation. (Thanks to Jeff Sturm.) - Mark all free list header blocks if they are heap allocated. This avoids some unnecessary tracing. And it remains correct if we clear the root set. (Thanks to Jeff Sturm for identifying the bug.) - Improved S390/Linux support. Add S390/Linux 64-bit support. (Thanks to Ulrich Weigand.) - Corrected the spelling of GC_{M,C}ALLOC_EXPLICTLY_TYPED to GC_{M,C}ALLOC_EXPLICITLY_TYPED in gc_typed.h. This is technically an interface change. Based on the fact that nobody reported this, I suspect/hope there were no clients. - Cleaned up gc_typed.h so that (1) it adds an extern "C" declaration when appropriate, (2) doesn't generate references to undefined internal macros, and (3) allows easier manual construction of descriptors. - Close the file descriptor used by GC_print_address_map(). - Set the "close-on-exec" bit for various file descriptors maintained for the collector's internal use. - Added a hack to find memory segments owned by the system allocator under win32. Based on my tests, this tends to eventually find all segments, though it may take a while. There appear to be cleaner, but slower solutions under NT/XP. But they rely on an API that's unsupported under 9X. - Changed Linux PowerPC stack finding to LINUX_STACKBOTTOM. (Thanks to Akira Tagoh for pointing out that HEURISTIC1 doesn't work on 64-bit kernels.) - Added GC_set_free_space_divisor to avoid some Windows dll issues. - Added FIXUP_POINTER, POINTER_SHIFT, POINTER_MASK to allow preprocessing of candidate pointers for tagging, etc. - Always lock around GC_notify_full_gc(). Simplified code for invoking GC_notify_full_gc(). - Changed the way DATASTART is defined on FreeBSD to be robust against an unmapped page after etext. (Thanks to Hironori Sakamoto for tracking down the intermittent failure.) - Made GC_enable() and GC_disable() official. Deprecated direct update of GC_dont_gc. Changed GC_gcollect to be a noop when garbage collection is disabled. - Call GC_register_dynamic_libraries before stopping the world on Linux, in order to avoid a potential deadlock due to the dl_iterate_phdr lock. - Introduced a more general mechanism for platform-dependent code to decide whether the main data segment should be handled separately from dynamic libraries, or registered by GC_register_dynamic_libraries. The latter is more reliable and easier on Linux with dl_iterate_phdr. Since 6.2alpha1: - Fixed the completely broken FreeBSD code in 6.2alpha1. (Thanks to Hironori Sakamoto for the patch.) - Changed IRIX reference in dbg_mlc.c to IRIX5. (Thanks to Marcus Herbert.) - Attempted to work around the problems with .S filenames and the SGI compiler. (Reported by several people. Untested.) - Worked around an HP/UX make issue with the GNU-style build process. - Fixed the --enable-cplusplus build machinery to allow builds without a C++ compiler. (That was always the intent ...) - Changed the debugging allocation macros to explicitly pass the return address for Linux and XXXBSD on hardware for which we can't get stack traces. Use __builtin_return_address(0) to generate it when possible. Some of the configuration work was cleaned up (good) and moved to gc.h (bad, but necessary). This should make leak detection more useful on a number of platforms. (Thanks to Fabian Thylman for the suggestion.) - Fixed compilation problems in dbg_mlc.c with GC_ADD_CALLER. - Bumped revision number for dynamic library. Since 6.2alpha2: - Don't include execinfo.h in os_dep.c when it's not needed, and may not exist. Since 6.2alpha3: - Use LINUX_STACKBOTTOM for >= glibc2.2 on Linux/MIPS. (See Debian bug # 177204) - Integrated Jeff Sturm and Jesse Rosenstock's MACOSX threads patches. - Integrated Grzegorz Jakacki's substantial GNU build patch. "Make dist" should now work for the GNU build process. Documentation files are installed under share/gc. - Tweaked gc_cpp.h to again support the Borland compiler. (Thanks to Rene Girard for pointing out the problems.) - Updated BCC_MAKEFILE (thanks to Rene Girard). - Added GC_ASSERT check for minimum thread stack size. - Added --enable-gc-assertions. - Added some web documentation to the distribution. Updated it in the process. - Separate gc_conf_macros.h from gc.h. - Added generic GC_THREADS client-defined macro to set the appropriate GC_XXX_THREADS internal macro. (gc_config_macros.h.) - Add debugging versions of _ignore_off_page allocation primitves. - Moved declarations of GC_make_closure and GC_debug_invoke_finalizer from gc.h to gc_priv.h. - Reset GC_fail_count even if only a small allocation succeeds. - Integrated Brian Alliet's patch for dynamic library support on Darwin. - gc_cpp.h's gc_cleanup destructor called GC_REGISTER_FINALIZER_IGNORE_SELF when it should have called the lower case version, since it was explicitly computing a base pointer. Since 6.2alpha4: - GC_invoke_finalizers could, under rare conditions, set GC_finalizer_mem_freed to an essentially random value. This could possibly cause unbounded heap growth for long-running applications under some conditions. (The bug was introduced in 6.1alpha5, and is not in gcc3.3. Thanks to Ben Hutchings for finding it.) - Attempted to sanitize the various DLL macros. GC_USE_DLL disappeared. GC_DLL is used instead. All internal tests are now on GC_DLL. README.macros is now more precise about the intended meaning. - Include DllMain in the multithreaded win32 version only if the collector is actually built as a dll. (Thanks to Mohan Embar for a version of the patch.) - Hide the cygwin threadAttach/Detach functions. They were violating our namespace rules. - Fixed an assertion in GC_check_heap_proc. Added GC_STATIC_ASSERT. (Thanks again to Ben Hutchings.) - Removed some obsolete definitions for Linux/PowerPC in gcconfig.h. - CORD_cat was not rebalancing unbalanced trees in some cases, violating a CORD invariant. Also tweaked the rebalancing rule for CORD_cat_char_star. (Thanks to Alexandr Petrosian for the bug report and patch.) - Added hand-coded structured exception handling support to mark.c. This should enable support of dynamic libraries under win32 with gcc-compiled code. (Thanks to Ranjit Mathew for the patch.) Turned on dynamic library scanning for win32/gcc. - Removed some remnants of read wrapping. (Thanks to Kenneth Schalk.) GC_USE_LD_WRAP ws probably broken in recent versions. - The build could fail on some platforms since gcconfig.h could include declarations mentioning ptr_t, which was not defined, e.g. when if_mach was built. (Thanks to Yann Dirson for pointing this out.) Also cleaned up tests for GC_PRIVATE_H in gcconfig.h a bit. - The GC_LOOP_ON_ABORT environment variable interfered with incremental collection, since the write fault handler was erroneously overridden. Handlers are now set up in the correct order. - It used to be possible to call GC_mark_thread_local_free_lists() while the world was not stopped during an incremental GC. This was not safe. Fortunately, it was also unnecessary. Added GC_world_stopped flag to avoid it. (This caused occasional crashes in GC_set_fl_marks with thread local allocation and incremental GC. This probably happened primarily on old, slow multiprocessors.) - Allowed overriding of MAX_THREADS in win32_threads.c from the build command line. (Patch from Yannis Bres.) - Taught the IA64/linux code to determine the register backing store base from /proc/self/maps after checking the __libc symbol, but before guessing. (__libc symbols are on the endangered list, and the guess is likely to not always be right for 2.6 kernels.) Restructured the code to read and parse /proc/self/maps so it only exists in one place (all platforms). - The -DUSE_PROC_FOR_LIBRARIES code was broken on Linux. It claimed that it also registered the main data segment, but didn't actually do so. (I don't think anyone actually uses this configuration, but ...) - Made another attempt to get --enablecplusplus to do the right thing. Since there are unavoidable problems with C programs linking against a dynamic library that includes C++ code, I separated out the c++ code into libgccpp. Since 6.2alpha5: - There was an extra underscore in the name of GC_save_registers_in_stack for NetBSD/SPARC. (Thanks to Jaap Boender for the patch.) - Integrated Brian Alliet's patch for Darwin. This restructured the linuxthreads/pthreads support to separate generic pthreads support from more the system-dependent thread-stopping code. I believe this should make it easier to eliminate the code duplication between pthreads platforms in the future. The patch included some other code cleanups. - Integrated Dan Bonachea's patch to support AIX threads. This required substantial manual integration, mostly due to conflicts with other recent threads changes. It may take another iteration to get it to work. - Removed HPUX/PA-RISC support from aix_irix_threads.c. It wasn't used anyway and it cluttered up the code. And anything we can do to migrate towards generic pthreads support is a good thing. - Added a more explicit test for tracing of function arguments to test.c. (Thanks to Dan Grayson.) - Added Akira Tagoh's PowerPC64 patch. - Fixed some bit rot in the Cygwin port. (Thanks to Dan Bonachea for pointing it out.) Gc.h now includes just windows.h, not winbase.h. - Declared GC_save_regs_in_stack() in gc_priv.h. Remove other declarations. - Changed --enable-cplusplus to use automake consitionals. The old way confused libtool. "Make install" didn't work correctly for the old version. Previously --enable-cplusplus was broken on cygwin. - Changed the C version of GC_push_regs to fail at compile time if it is generated with an empty body. This seems to have been the cause of one or two subtle failures on unusual platforms. Those failures should now occur at build time and be easily fixable. Since 6.2alpha6: - Integrated a second round of Irix/AIX patches from Dan Bonachea. Renamed mips_sgi_mach_dep.S back to mips_sgi_mach_dep.s, since it requires the Irix assembler to do the C preprocessing; gcc -E doesn't work. - Fixed Makefile.direct for DARWIN. (Thanks to Manuel Serrano.) - There was a race between GC_pthread_detach and thread exit that could result in a thread structure being deallocated by GC_pthread_detach eventhough it was still needed by the thread exit code. (Thanks to Dick Porter for the small test case that allowed this to be debugged.) - Fixed version parsing for non-alpha versions in acinclude.m4 and version checking in version.h. Since 6.2: - Integrated some NetBSD patches forwarded to me by Marc Recht. These were already in the NetBSD package. - GC_pthread_create waited for the semaphore even if pthread_create failed. Thanks to Dick Porter for the pthread_support.c patch. Applied the analogous fix for aix_irix_threads.c. - Added Rainer Orth's Tru64 fixes. - The check for exceeding the thread table size in win32 threadDetach was incorrect. (Thanks to Alexandr Petrosian for the patch.) - Applied Andrew Begel's patch to correct some reentrancy issues with dynamic loading on Darwin. - GC_CreateThread() was neglecting to duplicate the thread handle in the table. (Thanks to Tum Nguyen for the patch.) - Pass +ESdbgasm only on PA-RISC machines with vendor compiler. (Thanks to Roger Sayle for the patch.) - Applied more AIX threads patches from Scott Ananian. Since 6.3alpha1: - Reenabled I_HOLD_LOCK assertion in aix_irix_threads.h. - Put back the WINABI qualifier for GC_CreateThread. (Thanks to Danny Smith for the patch. 6.3alpha1 had the qualifier in one place but not elsewhere, which was clearly wrong.) - Sometimes explicitly define __private_extern__ before DARWIN dyld.h include. (Thanks to Andreas Tobker for postting the patch.) - Included signal.h from pthread_support.c. Removed GC_looping_handler, which was dead code. - GC_find_start was misdeclared by gc_pmark.h if PRINT_BLACK_LIST was defined. (Thanks to Glauco Masotti for testing and reporting this.) Changed GC_find_start to never just return 0. According to its comment it doesn't, and it's unclear that's correct. - GC_alloc_large had several largely compensating bugs in the computation of GC_words_wasted. (It was confused about bytes vs. words in two places.) - Integrated Slava Sysoltev's patch to support more recent versions of the Intel compiler on IA64/Linux. - Changed win32 spinlock initialization to conditionally set a spin count. (Emmanual Stumpf pointed out that enabling this makes a large performance difference on win32 multiprocessors.) Also cleaned up the win32 spinlock initialization code a bit. - Fixed thread support for HP/UX/IA64. The register backing store base for the main thread was sometimes not set correctly. (Thanks to Laurent Morichetti.) - Added -DEMPTY_GETENV_RESULTS flag to work around Wine problem. - Declare GC_stack_alloc and GC_stack_free in solaris_threads.h to avoid 64-bit size mismatches. (Thanks to Bernie Solomon.) - Fixed GC_generic_push_regs to avoid a potential and very unfortunate tail call optimization. This could lead to prematurely reclaimed objects on configurations that used the generic routine and the new build infrastructure (which potentially optimizes mach_dep.c). This was a serious bug, but it's unclear whether it has resulted in any real failures. - Fixed CORD_str to deal with signed characters. (Thanks to Alexandr Petrosian for noticing the problem and supplying the patch.) - Merged a couple of NOSYS/ECOS tests into os_dep.c from gcj. (Thanks to Anthony Green.) - Partially merged a win32 patch from Ben Hutchings, and substantially revised other parts of win32_threads.c. It had several problems. Under MinGW with a statically linked library, the main thread was not registered. Cygwin detached threads leaked thread descriptors. There were several race conditions. For now, unfortunately the static threads limit remains, though we increased it, and made table traversal cost depend on the actual thread count. There is also still some code duplication with pthread_support.c. (Thread descriptors did become much smaller, since Ben Hutchings removed the thread context from them.) - Integrated a Solaris configure.in patch from Rainer Orth. - Added GC_IGNORE_FB and associated warning to very partially address the issue of the collector treating a mapped frame buffer as part of the root set. (Thanks to David Peroutka for providing some insight. More would be helpful. Is there anything that can be used to at least partially identify such memory segments?) Since 6.3alpha2: - Removed -DSMALL_CONFIG from BCC_MAKEFILE. - Changed macros to test for an ARM processor (Patch from Richard Earnshaw.) - Mostly applied a DJGPP patch from Doug Kaufman. Especially Makefile.dj had suffered from serious bit rot. - Rewrote GC_apply_to_maps, eliminating an off-by-one subscript error, and a call to alloca (for lcc compatibility). - Changed USE_MUNMAP behavior on posixy platforms to immediately remap the memory with PROT_NONE instead of unmapping it. The latter risks an intervening mmap grabbing the address space out from underneath us. Updated this code to reflect a cleaner patch from Ulrich Drepper. - Replaced _T with _Tp in new_gc_alloc.h to avoid a MACOS X conflict. (Patch from Andrew Begel.) - Dynamically choose whether or not lock should spin on win32. (Thanks to Maurizio Vairani for the patch.) This may be a significant performance improvement for win32. - Fix Makefile.direct to actually include NT_STATIC_THREADS_MAKEFILE in the distribution. (Again thanks to Maurizio Vairani.) - Maybe_install_looping_handler() was accidentally exported, violating our name space convention. - Made os_dep.c use sigsetjmp and SA_NODEFER for NetBSD. (Thanks to Christian Limpach.) (I generalized the patch to use sigsetjmp on all UNIX_LIKE platforms, admittedly a slightly risky move. But it may avoid similar problems on some other platforms. I also cleaned up the defn of UNIX_LIKE a bit. - Hans) - Integrated Andrew Begel's Darwin threads patch, adjusted according to some of Fergus Hendersons's comments. (Patch didn't apply cleanly, errors are possible.) - Added another test or two for the Intel 8.0 compiler to avoid confusing it with gcc. The single-threaded collector should now build with icc, at least on ia64. Since 6.3alpha3: - USE_MMAP was broken by confusion in the code dealing with USE_MMAP_ANON. (This was pointed out, and fixes were suggested by several other people.) - Darwin supprt was broken in alpha3 as a result of my misintegration of Andrew Begel's patches. Fixed with another patch from Andrew Begel. - A new sanity check in pthread_stop_world.c:GC_push_all_stacks() was overly aggressive. We may collect from an unregistered thread during thread creation. Fixed by explicitly checking for that case. (Added GC_in_thread_creation.) Since 6.3alpha4: - Fix & vs && typo in GC_generic_malloc and GC_generic_malloc_ignore_off_page. (Propagated from the gcc tree.) - Removed SA_NODEFER hack from NetBSD and Solaris write-protect handler. (According to Christian Limpach, the NetBSD problem is fixed. Presumably so is the Solaris 2.3 problem.) - Removed placement delete from gc_cpp.h for the SGI compiler. (Thanks to Simon Gornall for the patch.) - Changed semantics of the GC_IGNORE_FB environment variable, based on experimentation by Nicolas Cannasse pointing out that the old interpretation was useless. We still need help in identifying win32 graphics memory mappings. The current "solution" is a hack. - Removed "MAKEOVERRIDES =" from Makefile.am and thus Makefile.in. It probably made more sense in the gcc context. - Explicitly ensure that NEED_FIND_LIMIT is defined for {Open,Net}BSD/ELF. - Replaced USE_HPUX_TLS macro by USE_COMPILER_TLS, since gcc often supports the same extension on various platforms. - Added some basic (completely untested) defines for win64, in support of future work. - Declared GC_jmp_buf in os_dep.s as JMP_BUF instead of jmp_buf, fixing a memory overwrite bug on Solaris and perhaps other platforms. - Added 0 != __libc_stack_end test to GC_linux_stack_base. (Thanks to Jakub Jelinek, both for the patch, and for explaining the problem to me.) Otherwise "prelink"ing could cause the collector to fail. - Changed default thread local storage implementation to USE_PTHREAD_SPECIFIC for HP/UX with gcc. The compiler-based implementation appears to work only with the vendor compiler. - Export GC_debug_header_size and GC_USR_PTR_FROM_BASE from gc_mark.h, making client mark code cleaner and less dependent on GC version. - Export several new procedures and GC_generic_malloc from gc_mark.h to support user-defined kinds. Use the new procedures to replace existing code in gcj_mlc.c and typd_mlc.c. - Added support for GC_BACKTRACES. - Fixed a remaining problem in CORD_str with signed characters. (Thanks to Alexandr Petrosian for the patch.) - Removed supposedly redundant, but very buggy, definitions of finalizer macros from javaxfc.h. Fortunately this file probably has no users. The correct declarations were already in gc.h. - Also need to set GC_in_thread_creation while waiting for GC during thread termination, since it is also possible to collect from an unregistered thread in that case. - Define NO_GETENV for Windows CE, since getenv doesn't appear to exist. + some other minor WinCE fixes. (Thanks to Alain Novak.) - Added GC_register_describe_type_fn. - Arrange for debugging finalizer registration to ignore non-heap registrations, since the regular version of the routine also behaves that way. - GC_gcj_malloc and friends need to check for finalizers waiting to be run. One of the more obscure allocation routines with missing a LOCK() call. - Fixed cvtres invocations in NT_MAKEFILE and NT_STATIC_THREADS_MAKEFILE to work with VS.NET. - Cleaned up GC_INIT calls in test. Updated gc.man to encourage GC_INIT use in portable code. - Taught the GC to use libunwind if --enable-full-debug is specified on IA64 and libunwind is present. - The USE_MUNMAP code could get confused about the age of a block and prematurely unmap it. GC_unmap_old had a bug related to wrapping of GC_gc_no. GC_freehblk and GC_merge_unmapped didn't maintain hb_last_reclaimed reasonably when blocks were merged. The code was fixed to reflect original intent, but that may not always be an improvement. See todo list item. Since 6.3alpha5: - Define USE_GENERIC_PUSH_REGS for NetBSD/M68K. - Fixed the X86_64 PREFETCH macros to correctly handle ia32e (which uses different prefetch instructions from AMD64). (Thanks to H.J. Lu.) - GC_config_macros.h did not correctly define GC_WIN32_THREADS from GC_THREADS. - Added simple_example.html. - Merged Andrew Gray's patch to correctly restore signal handlers on FreeBSD. - Merged a patch from Andreas Jaeger to deal with prefetch-related warnings on x86-64. Added some other casts so that the PREFETCH macros always get a ptr_t argument. Removed some casts inthe PREFETCH implementations. - At Jesse Jones suggestion: Added a header guard for gc_allocator.h and changed GC_debug_free to clobber contents of deallocated object. - The signal masking code in pthread_stop_world.c contained some errors. In particular SIGSEGV was masked in the handler, in spite of the fact that it wrote to the heap. This could lead to an uncaught SIGSEGV, which apparently became much more likely in Linux 2.6. Also fixed some typos, and reduced code duplication in the same area. - Remove ltconfig, clean up configure messages for DGUX (thanks to Adrian Bunk for the patches). - Integrated NetBSD/OpenBSD patches from Marc Recht and Matthias Drochner. Since 6.3alpha6: - Compile test_cpp.cc with CXXCOMPILE instead of COMPILE. - Very large allocations could cause a collector hang. Correct calculation of GC_collect_at_heapsize. - GC_print_hblkfreelist printed some bogus results if USE_MUNMAP was defined. - Include gc_config_macros.h in threadlibs.c. - Correct MacOSX thread stop code. (Thanks to Dick Porter.) - SMALL_OBJ definition was off by one. This could cause crashes at startup. (Thanks to Zoltan Varga for narrowing this down to a trivial test case.) - Integrate Paolo Molara's patch to deal with a race in the Darwin thread stopping code. - Changed X86_64 implementation to use SA_SIGINFO in the MPROTECT_VDB implementation. The old approach appears to have been broken by recent kernels. - Added GC_ATTR_UNUSED to eliminate a warning in gc_allocator.h (Thanks to Andrew Begel.) - Fix GC_task_self declaration in os_dep.c. (Thanks to Andrew Pinski.) - Increase INITIAL_BUF_SZ in os_dep.c for Solaris /proc reads. Since gc6.3: - Merge gcconfig.h changes from gcc tree. - Unconditionally include gc_priv.h in solaris_pthreads.c, win32_threads.h, aix_irix_threads.c, and solaris_threads.c to get thread definitions. - Start marker threads in GC_thr_init, so that they get started even if no other threads are ever started. (Oddly enough, the parallel collector worked correctly, though not well, with no helper threads.) - Go ahead and split large blocks in GC_allochblk_nth if GC_dont_gc is set. (Thanks to Alexander Petrossian.) - GC_PRINT_BACK_HEIGHT would deadlock with thread support. - Let in_progress_space in backgraph.s grow dynamically. - Fix README.solaris2. The GC_thr_init() hack doesn't work anymore. - Convert GC_finalizer_mem_freed to bytes in allchblk.c. - Add missing declaration for GC_generic_malloc_words_small_inner. Without it, s390x breaks. (Thanks to Ulrich Weigand.) - Applied several MacOSX patches to support older tool chains. (Thanks to Stefan Ring.) - Bug fix for NetBSD/amd64. (Thanks to Marc Recht.) Add NetBSD/sh3 support. (Thanks to Uchiyama Yasushi.) - Fixed an uninitialized variable in cordprnt.c. (Thanks to gcc for providing the warning.) - Eliminated some, but not all, gcc -Wall warnings. - Changed some old style casts to reinterpret_cast in new_gc_alloc.h. (Thanks to Dan Grayson.) - GC_extend_size_map shouldn't adjust for GC_all_interior_pointers if GC_DONT_ADD_BYTE_AT_END is set. - Changed some (long) casts to (word) in preparation for win64. (Thanks to Peter Colson.) - Changed "int stack_size" declaration in pthread_support.c to use size_t. (Only mattered with GC_ASSERTIONS enabled.) - Added CRIS (etrax) support. (Thanks to Simon Posnjak and Hans-Peter Nilsson.) - Removed GC_IGNORE_FB frame buffer recognition, and replaced it with a check that the mapping type is MEM_IMAGE. In theory, this should work much better, but it is a high risk change for win32. (Thanks to Ashley Bone for the crucial experimental data behind this, and to Rutger Ovidus for some further experiments.) - GC_allochblk_nth incremented GC_words_wasted by bytes rather than words. - Consider GC_words_wasted in GC_adj_words_allocd only if it is within reason. (A hack to avoid some extremely unlikely scenarios in which we manage to allocate only "wasted" space. 7.0 has a better fix.) - Changed PowerPC GC_clear implementation to use lwsync instead of eieio, since the documentation recommends against eieio, and it seems to be incorrect if the preceding memory op is a load. - Fixed print_block_list to print the correct kind number for STUBBORN. (Thanks to Rutger Ovidus.) - Have configure.in generate an error if it is asked to support pthreads, but doesn't know how to. - Added Kazuhiro Inaoka's patch for Renesas M32R support. - Have the GNU build mechanism link with -ldl. Rename THREADLIBS to THREADDLLIBS to reflect this. (Thanks to Sven Verdoolaege.) - Added Hannes Mehnert's patch for FreeBSD/SPARC support. - Merged some FreeBSD specific patches to threadlibs.c and dyn_load.c. (Thanks tp John Merryweather Cooper.) - Define MPROTECT_VDB on MACOSX only if threads are being used, since the dirty page tracking mechanism uses threads. (This avoids an undefined reference to _GC_darwin_register_mach_handler_thread.) - By popular demand, use __libc symbols only if we are built with USE_LIBC_PRIVATES, which is off by default, and not otherwise documented. - Ignore GC_enable_incremental() requests when KEEP_BACK_PTRS is set. The GC itself will dirty lots of pages in this cases, probably making it counterproductive on all platforms. And the DARWIN port crashes. Since gc6.4: - Integrated Paolo Molaro's patch to deal with EINTR in sem_wait. - Make GC_approx_sp() write to dummy location to ensure that stack is grown here, when sp looks reasonable, rather than later, when it might look like a bad memory reference. (Problem was never observed that I know of. But on rereading the code it seemed dubious.) - Separate out GC_with_callee_saves_pushed and sometimes call it from GC_suspend_handler in pthread_stop_world.c. Callee-save register values sometimes failed to get traced under HP/UX on PA-RISC. Linux/IA64 had the same problem, though non-stacked callee-save registers seem to be so rarely used there that nobody ever noticed. - Integrated an ancient Darwin powerpc_darwin_machine_dep.s patch from Andreas Tobler, which I had lost. - Fix compare_and_exchange implementation for gcc/IA64 to deal with pickier compiler versions. - Fixed Itanium 32-bit ABI support (HP/UX). In particular, the compare_and_exchange implementation didn't consider that possibility. - Undefine GC_pthread_detach in win32_threads.c. (Thanks to Tagliapietra Tommaso.) - Fixed inclusion of frame.h for NETBSD in os_dep.c. - Applied Dan Bonachea's patch to use mmap on AIX. - Several fixes to resurrect the Irix port on recent OS versions. - Change ALPHA to use LINUX_STACKBOTTOM. - Change SPARC64/LINUX to also use LINUX_STACKBOTTOM. Deal with potential bad values of __libc_stack_end on that platform. (Thanks to David Miller.) - Relax gctest to allow larger heap if ALIGN_DOUBLE isn't set. (Unnecessary in 7.0) - Force a define of __STDC__=0 for the IBM compiler on AIX, so that we get prototypes. (Unnecessary in 7.0) - GC_INIT definition for AIX and CYGWIN referred to DATASTART and DATAEND which are only defined in private include files. - Integrated some small gcconfig.h patches from Dan Bonachea. Also relaxed assertion about FreeBSD stack size in pthread_support.c. - Integrated Andrew Begel's darwin_stop_world.c patch for 64-bit support. This may need additional work. - Avoided potentially infinite recursion in GC_save_callers if the system backtrace calls malloc. The workaround currently requires __thread support if this code is used with threads. - Avoided another similar infinite recursion by conditionally invoking GC_save_callers in alloc.c. (Thanks to Matthias Andree for helping to track down both of these.) - Removed all traces of aix_irix_threads.c. AIX and Irix now use pthread_support.c and pthread_stop_world.c. The old code appeared to be unreliable for AIX, and was not regularly maintained. - On Irix, ignore segments with MA_FETCHOP or MA_NOTCACHED attributed; they're not always safe to read. - Fixed a previously vacuous assertion (diagnosed by the SGI compiler) in GC_remove_from_fl. - Fix stack_size assertion in GC_pthread_create. - Fix assertion in GC_steal_mark_stack. Since gc6.5: - Fix CPU count detection for Irix and FreeBSD. (Thanks to Dan Bonachea.) - Integrate Dan Bonachea's patch for the IBM XLC compiler on Darwin. - Integrated Andreas Tobler's FreeBSD/PowerPC patch. - Don't access the GC thread structure from the restart handler. It's unsafe, since the handler may run too late. (Thanks to Ben Maurer for tracking this down.) - Applied Christian Thalinger's patch to change comment syntax in alpha_mach_dep.S. - Added test for GC_no_dls in GC_dyld_image_add for DARWIN. (Thanks to Juan Jose Garcia Ripoli). - Use LINUX_STACKBOTTOM for Linux/SH and LINUX/ARM. (Thanks to Sugioka Toshinobu and Christian Thalinger.) - Rewrote GC_parse_map_entry. This assumed a fixed column layout of /proc/self/maps on Linux. This ceased to be true about 2 years ago. The old code is probably quite problemetic with -DREDIRECT_MALLOC. It is also used by default for IA64, though I haven't seen actual failures there. - More consistently define HBLKSIZE to 4096 on 64 bit architectures with 4K pages. (Thanks to Andrew Haley.) - With win32 threads, GC_stop_world needs to acquire GC_write_cs. (Thanks to Ben Hutchings for the observation and patch.) - Move up struct callinfo declaration to make gcc 4.0.2. happy. Since 6.6: - Add "int" to Solaris "end" and "etext" declaration in gc.h. Declared the symbols with underscores and as arrays, since that's what's actually used. Perhaps this could all just be removed? (Thanks to John Bowman.) - Fixed ARM GC_test_and_set code. (Thanks to Kazu Hirata and Paul Brook.) - Added casts for assignments to hb_last_reclaimed, which truncate the value. Added a cast to GC_adj_words_allocd. Use GetModuleHandleA when retrieving a handle to kernel32.dll under win32. (Thanks to the Visual Prolog developers.) - Added Tandem S-Series support. (Thanks to Craig McDaniel. A modified version of his patch was applied, and hence breakage is probably not his fault.) - Remove spurious gc:: qualifier for operator delete[] in gc_cpp.h. (Thanks to Hanno Boeck.) - Changed a test for LINUX in config_macros.h to one for __linux__. - Add prototypes for GC_finalizer_notifier and GC_thr_init. (Thanks to David Ayers.) - Use ld instead of nonexitent ldz instruction in Darwin FindTopOfStack. (Thanks to Andreas Tobler.) - Add support for Darwin/X86. (Thanks to Geoff Norton and the Mono developers.) - Merge in some recent gcc fixes. Add ppc64 asm code. (Thanks to Bryce McKinley and other gcj developers.) - Scan MEM_PRIVATE sections under Windows ME and predecessors. - Interior pointers with some largish offsets into large objects could be ignored, if GC_all_interior_pointers was set. (Oddly this worked correctly for stack references if it was not set. Otherwise it failed for both stack and heap references.) Thanks to Andrew McKinlay for the critical test case. - Integrated Tatsuya Bizenn's NETBSD threads support, with some untested changes. - Added GC_strdup and friends to make leak detection work correctly for strdup clients. (Thanks to Jon Moore.) Fixed the existing strdup with malloc redirection to handle a null malloc return correctly. Since gc6.7: - Added some support for Dragonfly BSD. (Thanks to Joerg Sonnenberger and Thomas Klausner.) - Improvements to the HP/UX section of configure.in/configure.ac. (Thanks to Andreas Tobler) - GC_unix_get_mem could neglect to release the malloc lock on Irix, under extremely unlikely circumstances. Thanks to Jean-Baptiste Nivois for some careful code reading. - Added support for kFreeBSD + glibc (Thanks to Petr Salinger) - Fix more MacOS threads memory leaks (Thanks to Allan Hsu) - Added initial Solaris/X86-64 support (Thanks to Rainer Orth) Since gc6.8: - Fix typo in PREFETCH implementation for X86_64. (Thanks to Peter Wang.) - Fix M68K LINUX port. (Thanks to Debian packagers.) - __GNUC__ was misspelled as __GNUC in new_gc_alloc.h. (Thanks to Peter Wang.) - Integrated Allan Hsu's patch for OS X VM deallocation problems. - Applied FreeBSD/X86_64 patch. Since gc6.9: - Remove GC_PROTO, VOLATILE, GC_PTR, and GC_CONST. Assume ANSI C compiler and use ANSI constructs unconditionally. - Introduce #elif and #error in some of the appropriate places. - Remove GC_printf cruft. Use stdargs. - Remove separate Solaris threads support. Use the more generic Posix implementation. - Use atomic_ops for atomic operations and memory barriers. - Clean up MPROTECT_VDB implementation. Use SA_SIGINFO wherever possible. - Remove broken SIGNALS stuff. - Use size_t instead of word, where appropriate. - Add .S.o rule to Makefile.am. - Officially unsupport SunOS4, several old flavors of M68K (SunOS4, A/UX, HP), IBM PC/RTs and RISCOS/Irix4. (I doubt the old code worked. If anyone cares, these should be easy to resurrect.) - Add EXPECT() in some critical places. - Redefined hb_sz and hb_body to deal with bytes rather than words. This affected a great deal of code. I would like to consistently use byte offsets and sizes where there's not a convincing reason to do otherwise. - Redefined several other variables (GC_mem_found, GC_words_allocd) etc. to use units of bytes. Most of these were also renamed to reflect that fact. - Killed as many "register" declarations as possible. - Partially replaced stubborn allocation with manual write barrier. It's currently broken. - Restructured mark code, to allow mark bits to be kept either on a per allocation granule or per object basis. The emphasis is now on the -DUSE_MARK_BYTES option, since individual bits perform quite badly on hyperthreaded P4s, and are probably suboptimal on other architectures. -DUSE_MARK_BITS is currently broken, and may be resurrected only for the single-threaded case. This significantly reduced the cache footprint required by auxiliary GC data structures. It also reduces space overhead for small heaps. It probably slows things down slightly if interior pointers are very common. - As part of the above, we now maintain an approximate count of set mark bits in each heap block. - As part of the above, the semantics of hb_map changed drastically. For MARK_BIT_PER_OBJ, it doesn't exist. For MARK_BIT_PER_GRANULE, it is purely a way to replace a mod instruction with a table lookup. (Somewhat to my surprise, this still wins on modern hardware.) - Removed PRINTSTATS, GATHERSTATS, and SILENT macros. Everything is now controlled by GC_print_stats variable and GC_PRINT_STATS and new GC_PRINT_VERBOSE_STATS environment variables. - Add GC_log_printf and use it consistently for logging output. - Unconditionally count the objects we reclaim in the sweep phase. For thread local allocation, we need that anyway, and we expect that's increasingly the only case that matters. And it simplifies the code. In general expect minor performance hacks that benefit only the single-threaded case to disappear. - Remove GC_quiet from gc.h and elsewhere. - Changed the heap expansion heuristic, and the definition of GC_free_space_divisor, to refer to live data size, instead of total heap size. I believe this is much more robust. It wasn't previously possible, because we didn't have access to live data size. - Thread local allocation added the extra byte in twice: Once in thread_local_alloc, and once in malloc_many. - Removed GC_malloc_words_small and GC_gcj_fast_malloc. A new mechanism based on the thread local allocation data structures is expected to be added instead. This should allow inlined code that is both fast and doesn't rely on collector internals. - Changed both free lists and reclaim lists to be indexed by granules instead of words, norming halving their size. - MERGE_SIZE is now the only option, and the macro was removed. (Without it, we need a memory reference to GC_all_interior_pointers anyway. Thus it costs us nothing.) - Change GC_size_map to map to granules instead of words. Make sure that every possible size up to TINY_FREELISTS is present. - Split of macros need for fast inline allocation into gc_tiny_fl.h in anticipation of a new inline allocator that doesn't rely on GC internals. - Changed thread local allocation to use GRANULE_BYTES and TINY_FREELISTS in anticipation of a merge with the inline allocation code. - Removed ALIGN_DOUBLE. This is mostly handled by GRANULE_BYTES. - Make locking on most platforms conditional on GC_need_to_lock. Since gc7.0alpha1: - GC_bytes_allocd was incremented by a possibly uninitialized variable in GC_generic_malloc_inner. (Bug introduced in gc7.0alpha1. Thanks to Ben Hutchings for tracking it down.) - Win32 fixes. (Thanks to Ben Hutchings and Maurizio Vairani.) - Integrated Ben Hutchings' GetWriteWatch-based virtual dirty bit implementation for win32. - Removed pc_gc.tar and floppy targets in Makefile.direct. Removed pc_excludes file. - No longer include GC_bytes_wasted when evaluating allocation progress. Since we are now counting live memory, it no longer makes sense. - Applied Davide Angelocola's configury patch. There are now separate Makefile.am's in the cord and tests subdirectory, more tests, etc. - Renamed configure.in to configure.ac. - Merged a very small number of Nathanael Nerode's configure.ac cleanups from the gcc tree. Unfortunately, that file is a bit different from ours. - Changed EINTR handling in sem_wait slightly. - Restructure the root marking code. Remove all traces of USE_GENERIC_PUSH_REGS, and effectively make it the default. Make it easier to pass a context pointer to the mark routine, in case we ever want to do precise stack marking. - Replace GC_start_blocking() and GC_end_blocking() with GC_do_blocking(). This remains undocumented, and only implemented for pthreads. But it removes an otherwise unavoidable race with stores of callee-save registers. - Fix GC_n_mark_bits for the default MARK_BIT_PER_GRANULE case. This resulted in bogus complaints in heap dumps. - Upgrade to libatomic_ops-1.0, and update build structure to match. - Remove SRC_M3 support. Clean up lock initialization code in misc.c. - Removed gc_local_alloc.h. If THREAD_LOCAL_ALLOC is defined, the thread local allocation routines are now called automatically. - Renamed gc_inl.h back to gc_inline.h. Changed the interface appreciably since locking has turned into a dominant issue, and in-line allocation only makes sense if it's no worse than thread-local allocation. Gc_inline.h is now also used to implement thread-local allocation. - Finished replacing stubborn allocation with manual write barrier. Untested. - Use thread-local allocation code by default. - Added GC_register_my_thread and friends for Posix and win32. - Patch for GWW_VDB from Ben Hutchings. - Removed explicit THREAD_LOCAL_ALLOC tests, since that now always redefines GC_malloc. - Removed now unused AIX memory allocation code. - Various minor fixes for bugs introduced in 7.0alpha1. Since gc7.0alpha2 - Added support for dlopen-based interception of pthread functions. This is only half done. The gc.h redefinitions currently interfere. - Integrated major automake overhaul from Petter Urkedal. Since gc7.0alpha3 (various 6.5, 6.6 changes) - Removed GC_brief_async_signal_safe_sleep and used atomic_ops instead. (Thanks to Ben Maurer.) - Integrated build patches from David Angelocola and Petter Urkedal. - Fix dynamic-linker-based pthread call redirection. - Renamed RS6000 to POWERPC/AIX. - Allow recovery from SIGSEGV in marker on Linux. This works around a race in thread stack marking if /proc is used to find roots. We do that by default with malloc redirection and threads. This involved moving some GC_find_limit and SETJMP related declarations to gc_priv.h. - Added doc/porting.html file. - Added ADD_HEAP_GUARD_PAGES for sbrk/*nix platforms to debug extreme memory overwrite errors. - Added trivial NO_INCREMENTAL flag to facilitate debugging. - Added GC_getattr_np-based GC_get_stack_base (untested). - Separated thread local allocation into a separate file and added the beginning of win32 support for that. Since gc7.0alpha4 (more 6.6, 6.7 changes) - Some Solaris fixes, including some more general changes in how the assembly pieces of mach_dep.c are handled. - Removed a lot of SOLARIS_THREADS-specific code that was only needed with the old implementation. This included many (mostly no-op) versions of GC_is_fresh. - Don't use atomic_ops in gc_locks.h unless we need threads. - Fixed USE_MARK_BITS, which is once againthe default without PARALLEL_MARK. - Removed Solaris GC_INIT hack. It's a workaround for a long dead bug, and it seemed to be wrong anyway. - Changed win32_threads.c to require preprocessor-based interception of thread routines by default. A client call to GC_use_DllMain is now required to get the old behavior in which DllMain is used to implicitly register threads. This was doen for uniformity with other platforms, and because the DllMain solution seemed to require very tricky code which, at least in the past, imposed hard bounds onthe number of threads. - Many small changes to make thread support work again on Cygwin. - Moved definition of allocator lock etc. to pthread_support.c and win32_threads.c for those two cases. - Got rid of the FASTLOCK() machinery. It doesn't seem useful on modern platforms. - Cleaned up the uncollectable allocation routines, speeding up the slower paths. The code did enough unnecessary work off the critical path that the underlying logic was getting hard to extract. - No longer turn off THREAD_LOCAL_ALLOC with DBG_HDRS_ALL. Indications are it just works, and I think the reasons for it not working disappeared a while ago. - Fixed bugs in hb_n_marks calculation and assertion. - Don't use __builtin_expect for pre-3.0 gcc. - Define GWW_VDB only for recent Microsoft tool chains. - Add overview.html to doc directory. - Fix NT_STATIC_THREADS_MAKEFILE, various compiler warnings. - Made thread local allocation sort of work with Cygwin. The code should be there to deal with other Windows variants, But non-Cygwin Windows threads need more bug fixes. Since gc7.0alpha5 (more 6.7 changes) - Declare GC_dump() in gc.h. - Add --enable-large-config, which just defines the LARGE_CONFIG macro. - Make GlobalAlloc address alignment a bit more intuitive. (Thanks to Charles Mills.) - Use #elif in the definitions of GET_MEM. - Overhaul porting.html. Remove corresponding text from README. - Fix typo in DARWIN section of gcconfig.h. - Fix Darwin thread memory leak. (Thanks to Bruce Mitchener.) - Update x86 AO_test_and_set implementation to use "=q". - Add $(EXEEXT) to many tests in tests/tests.am. (Corresponds to a 6.7 fix, which no longer applied.) - Fix Darwin/PPC port. - Fix Cygwin/threads port. - Fix gcj malloc support. - For GNU-style make, don't build libatomic_ops unless threads are requested. This should allow single-threaded builds on platforms which do not currently support libatomic_ops. - Clean up and hopefully fix the CFLAGS calculation for GNU build. (Substantially improves things on HP/UX.) - Integrated Andrei Polushin's Visual C++ patches. These provide for stack traces, better C++ debug support, and better log file handling. Note that these change the location of the log file to a the path of the executable with a .log extension. To get the old behavior back, define OLD_WIN32_LOG_FILE. For the time being, I'm checking his project files and the like into a windows-untested subdirectory. They are almost certainly already out of date, but better than what we had before. - Fixed some win32 threads bugs, and added support for _beginthreadex. - Fix zero size thread local allocation so that explicit deallocation works correctly. - Removed serious bug in GC_malloc_uncollectable(large size). - Do not try to do thread-local gcj allocation in incremental mode. There are races in setting up the descriptor. - Add GC_INIT() to middle.c, fix some more GC_printfn calls. - Some assertions erroneously used I_HOLD_LOCK() negatively, eventhough it can now spuriously return TRUE. - Rename SUNOS5 macro and OS name to SOLARIS and SUNOS5DL to SOLARISDL. - On Linux and some Un*x variants, allocate memory by first trying sbrk, and then switching to mmap if that fails. - Fixed /proc/x/maps reading to deal with asynchronous deletions. - Fix REDIRECT_MALLOC with threads on Linux. It now usually seems to work with ugly hacks that include having calloc behave differently when it is called from ld.so or the pthreads library. A reasonable amount of infrastructure was added to support some of this. Thanks to Roland McGrath for ideas and information. - Import various updated build scripts. - Add GC_register_has_static_roots_callback. (Thanks to Andrew Haley.) - Fix serious bugs in GC_malloc_atomic_uncollectable(). - Return GC_SUCCESS form GC_get_stack_base(). - Fix several atomic_ops problems on IA64 with HP Compiler. - Update to atomic_ops-1.2. - Fix hb_n_marks description and reclaim.c assertion. - Various additional win32 threads fixes. - Enable GC_ASSERTIONS for Debug build with NT_THREADS_MAKEFILE. [gc7.0alpha7 was released and version bumped to gc7.0alpha8] Since first gc7.0alpha8 version: [ Some gc6.9 changes ] - Change FindTopOfStack decl in darwin_stop_world.c. - Move some static tests from misc.c to gcconfig.h. Use #error. - Add GC_print_free_list() function. (Thanks to Bruce Hoult.) - Add GC_GNU_THREADS support on HURD. (Thanks to Aleksey Demakov, Barry DeFreese, and possibly other Debian maintainers.) - __GNUC__ was misspelled as __GNUC in thread_local_alloc.h. (Thanks to Peter Wang.) - Integrated various MacOSX patches and tried to reconcile them. Thanks to Allan Hsu, several contributers at Apple, and probably others. - Added some casts to powerpc.h in libatomic_ops to silence warnings. FOR FURTHER UPDATES SEE ../ChangeLog FILE. To do: - REDIRECT_MALLOC and threads combination should work on more platforms, and needs more testing on Linux. - Clone marker inner loop to support arch-dependent prefetching, and counting of objects marked for finalization. - The USE_MUNMAP code should really use a separate data structure indexed by physical page to keep track of time since last use of a page. Using hblk headers means we lose track of ages when blocks are merged, and we can't unmap pages that have been allocated and dropped by the blacklisting code. I suspect both of these matter. - A dynamic libgc.so references dlopen unconditionally, but doesn't link against libdl. - GC_proc_fd for Solaris is not correctly updated in response to a fork() call. Thus incremental collection in the child won't work correctly. (Thanks to Ben Cottrell for pointing this out.) - --enable-redirect-malloc is mostly untested and known not to work on some platforms. - There seem to be outstanding issues on Solaris/X86, possibly with finding the data segment starting address. Information/patches would be appreciated. - Very large root set sizes (> 16 MB or so) could cause the collector to abort with an unexpected mark stack overflow. (Thanks again to Peter Chubb.) NOT YET FIXED. Workaround is to increase the initial size. - The SGI version of the collector marks from mmapped pages, even if they are not part of dynamic library static data areas. This causes performance problems with some SGI libraries that use mmap as a bitmap allocator. NOT YET FIXED. It may be possible to turn off DYNAMIC_LOADING in the collector as a workaround. It may also be possible to conditionally intercept mmap and use GC_exclude_static_roots. The real fix is to walk rld data structures, which looks possible. - Incremental collector should handle large objects better. Currently, it looks like the whole object is treated as dirty if any part of it is. FOR FURTHER UPDATES SEE ../ChangeLog FILE. synopsis-0.12/src/Synopsis/gc/doc/scale.html0000664000076400007640000002421711104702320020404 0ustar stefanstefan Garbage collector scalability

Garbage collector scalability

In its default configuration, the Boehm-Demers-Weiser garbage collector is not thread-safe. It can be made thread-safe for a number of environments by building the collector with the appropriate -DXXX-THREADS compilation flag. This has primarily two effects:
  1. It causes the garbage collector to stop all other threads when it needs to see a consistent memory state.
  2. It causes the collector to acquire a lock around essentially all allocation and garbage collection activity.
Since a single lock is used for all allocation-related activity, only one thread can be allocating or collecting at one point. This inherently limits performance of multi-threaded applications on multiprocessors.

On most platforms, the allocator/collector lock is implemented as a spin lock with exponential back-off. Longer wait times are implemented by yielding and/or sleeping. If a collection is in progress, the pure spinning stage is skipped. This has the advantage that uncontested and thus most uniprocessor lock acquisitions are very cheap. It has the disadvantage that the application may sleep for small periods of time even when there is work to be done. And threads may be unnecessarily woken up for short periods. Nonetheless, this scheme empirically outperforms native queue-based mutual exclusion implementations in most cases, sometimes drastically so.

Options for enhanced scalability

Version 6.0 of the collector adds two facilities to enhance collector scalability on multiprocessors. As of 6.0alpha1, these are supported only under Linux on X86 and IA64 processors, though ports to other otherwise supported Pthreads platforms should be straightforward. They are intended to be used together.
  • Building the collector with -DPARALLEL_MARK allows the collector to run the mark phase in parallel in multiple threads, and thus on multiple processors. The mark phase typically consumes the large majority of the collection time. Thus this largely parallelizes the garbage collector itself, though not the allocation process. Currently the marking is performed by the thread that triggered the collection, together with N-1 dedicated threads, where N is the number of processors detected by the collector. The dedicated threads are created once at initialization time.

    A second effect of this flag is to switch to a more concurrent implementation of GC_malloc_many, so that free lists can be built, and memory can be cleared, by more than one thread concurrently.

  • Building the collector with -DTHREAD_LOCAL_ALLOC adds support for thread local allocation. It does not, by itself, cause thread local allocation to be used. It simply allows the use of the interface in gc_local_alloc.h.

    Memory returned from thread-local allocators is completely interchangeable with that returned by the standard allocators. It may be used by other threads. The only difference is that, if the thread allocates enough memory of a certain kind, it will build a thread-local free list for objects of that kind, and allocate from that. This greatly reduces locking. The thread-local free lists are refilled using GC_malloc_many.

    An important side effect of this flag is to replace the default spin-then-sleep lock to be replace by a spin-then-queue based implementation. This reduces performance for the standard allocation functions, though it usually improves performance when thread-local allocation is used heavily, and thus the number of short-duration lock acquisitions is greatly reduced.

The easiest way to switch an application to thread-local allocation is to

  1. Define the macro GC_REDIRECT_TO_LOCAL, and then include the gc.h header in each client source file.
  2. Invoke GC_thr_init() before any allocation.
  3. Allocate using GC_MALLOC, GC_MALLOC_ATOMIC, and/or GC_GCJ_MALLOC.

The Parallel Marking Algorithm

We use an algorithm similar to that developed by Endo, Taura, and Yonezawa at the University of Tokyo. However, the data structures and implementation are different, and represent a smaller change to the original collector source, probably at the expense of extreme scalability. Some of the refinements they suggest, e.g. splitting large objects, were also incorporated into out approach.

The global mark stack is transformed into a global work queue. Unlike the usual case, it never shrinks during a mark phase. The mark threads remove objects from the queue by copying them to a local mark stack and changing the global descriptor to zero, indicating that there is no more work to be done for this entry. This removal is done with no synchronization. Thus it is possible for more than one worker to remove the same entry, resulting in some work duplication.

The global work queue grows only if a marker thread decides to return some of its local mark stack to the global one. This is done if the global queue appears to be running low, or if the local stack is in danger of overflowing. It does require synchronization, but should be relatively rare.

The sequential marking code is reused to process local mark stacks. Hence the amount of additional code required for parallel marking is minimal.

It should be possible to use generational collection in the presence of the parallel collector, by calling GC_enable_incremental(). This does not result in fully incremental collection, since parallel mark phases cannot currently be interrupted, and doing so may be too expensive.

Gcj-style mark descriptors do not currently mix with the combination of local allocation and incremental collection. They should work correctly with one or the other, but not both.

The number of marker threads is set on startup to the number of available processors (or to the value of the GC_NPROCS environment variable). If only a single processor is detected, parallel marking is disabled.

Note that setting GC_NPROCS to 1 also causes some lock acquisitions inside the collector to immediately yield the processor instead of busy waiting first. In the case of a multiprocessor and a client with multiple simultaneously runnable threads, this may have disastrous performance consequences (e.g. a factor of 10 slowdown).

Performance

We conducted some simple experiments with a version of our GC benchmark that was slightly modified to run multiple concurrent client threads in the same address space. Each client thread does the same work as the original benchmark, but they share a heap. This benchmark involves very little work outside of memory allocation. This was run with GC 6.0alpha3 on a dual processor Pentium III/500 machine under Linux 2.2.12.

Running with a thread-unsafe collector, the benchmark ran in 9 seconds. With the simple thread-safe collector, built with -DLINUX_THREADS, the execution time increased to 10.3 seconds, or 23.5 elapsed seconds with two clients. (The times for the malloc/ifree version with glibc malloc are 10.51 (standard library, pthreads not linked), 20.90 (one thread, pthreads linked), and 24.55 seconds respectively. The benchmark favors a garbage collector, since most objects are small.)

The following table gives execution times for the collector built with parallel marking and thread-local allocation support (-DGC_LINUX_THREADS -DPARALLEL_MARK -DTHREAD_LOCAL_ALLOC). We tested the client using either one or two marker threads, and running one or two client threads. Note that the client uses thread local allocation exclusively. With -DTHREAD_LOCAL_ALLOC the collector switches to a locking strategy that is better tuned to less frequent lock acquisition. The standard allocation primitives thus peform slightly worse than without -DTHREAD_LOCAL_ALLOC, and should be avoided in time-critical code.

(The results using pthread_mutex_lock directly for allocation locking would have been worse still, at least for older versions of linuxthreads. With THREAD_LOCAL_ALLOC, we first repeatedly try to acquire the lock with pthread_mutex_try_lock(), busy_waiting between attempts. After a fixed number of attempts, we use pthread_mutex_lock().)

These measurements do not use incremental collection, nor was prefetching enabled in the marker. We used the C version of the benchmark. All measurements are in elapsed seconds on an unloaded machine.

Number of threads1 marker thread (secs.) 2 marker threads (secs.)
1 client10.457.85
2 clients19.9512.3
The execution time for the single threaded case is slightly worse than with simple locking. However, even the single-threaded benchmark runs faster than even the thread-unsafe version if a second processor is available. The execution time for two clients with thread local allocation time is only 1.4 times the sequential execution time for a single thread in a thread-unsafe environment, even though it involves twice the client work. That represents close to a factor of 2 improvement over the 2 client case with the old collector. The old collector clearly still suffered from some contention overhead, in spite of the fact that the locking scheme had been fairly well tuned.

Full linear speedup (i.e. the same execution time for 1 client on one processor as 2 clients on 2 processors) is probably not achievable on this kind of hardware even with such a small number of processors, since the memory system is a major constraint for the garbage collector, the processors usually share a single memory bus, and thus the aggregate memory bandwidth does not increase in proportion to the number of processors.

These results are likely to be very sensitive to both hardware and OS issues. Preliminary experiments with an older Pentium Pro machine running an older kernel were far less encouraging. synopsis-0.12/src/Synopsis/gc/doc/README0000664000076400007640000006633311104702320017314 0ustar stefanstefanCopyright (c) 1988, 1989 Hans-J. Boehm, Alan J. Demers Copyright (c) 1991-1996 by Xerox Corporation. All rights reserved. Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. Copyright (c) 1999-2005 Hewlett-Packard Development Company, L.P. The file linux_threads.c is also Copyright (c) 1998 by Fergus Henderson. All rights reserved. The files Makefile.am, and configure.in are Copyright (c) 2001 by Red Hat Inc. All rights reserved. Several files supporting GNU-style builds are copyrighted by the Free Software Foundation, and carry a different license from that given below. The files included in the libatomic_ops distribution (included here) use either the license below, or a similar MIT-style license, or, for some files not actually used by the garbage-collector library, the GPL. THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. Permission is hereby granted to use or copy this program for any purpose, provided the above notices are retained on all copies. Permission to modify the code and to distribute modified code is granted, provided the above notices are retained, and a notice that the code was modified is included with the above copyright notice. A few of the files needed to use the GNU-style build procedure come with slightly different licenses, though they are all similar in spirit. A few are GPL'ed, but with an exception that should cover all uses in the collector. (If you are concerned about such things, I recommend you look at the notice in config.guess or ltmain.sh.) This is version 7.0 of a conservative garbage collector for C and C++. You might find a more recent version of this at http://www.hpl.hp.com/personal/Hans_Boehm/gc OVERVIEW This is intended to be a general purpose, garbage collecting storage allocator. The algorithms used are described in: Boehm, H., and M. Weiser, "Garbage Collection in an Uncooperative Environment", Software Practice & Experience, September 1988, pp. 807-820. Boehm, H., A. Demers, and S. Shenker, "Mostly Parallel Garbage Collection", Proceedings of the ACM SIGPLAN '91 Conference on Programming Language Design and Implementation, SIGPLAN Notices 26, 6 (June 1991), pp. 157-164. Boehm, H., "Space Efficient Conservative Garbage Collection", Proceedings of the ACM SIGPLAN '91 Conference on Programming Language Design and Implementation, SIGPLAN Notices 28, 6 (June 1993), pp. 197-206. Boehm H., "Reducing Garbage Collector Cache Misses", Proceedings of the 2000 International Symposium on Memory Management. Possible interactions between the collector and optimizing compilers are discussed in Boehm, H., and D. Chase, "A Proposal for GC-safe C Compilation", The Journal of C Language Translation 4, 2 (December 1992). and Boehm H., "Simple GC-safe Compilation", Proceedings of the ACM SIGPLAN '96 Conference on Programming Language Design and Implementation. (Some of these are also available from http://www.hpl.hp.com/personal/Hans_Boehm/papers/, among other places.) Unlike the collector described in the second reference, this collector operates either with the mutator stopped during the entire collection (default) or incrementally during allocations. (The latter is supported on fewer machines.) On the most common platforms, it can be built with or without thread support. On a few platforms, it can take advantage of a multiprocessor to speed up garbage collection. Many of the ideas underlying the collector have previously been explored by others. Notably, some of the run-time systems developed at Xerox PARC in the early 1980s conservatively scanned thread stacks to locate possible pointers (cf. Paul Rovner, "On Adding Garbage Collection and Runtime Types to a Strongly-Typed Statically Checked, Concurrent Language" Xerox PARC CSL 84-7). Doug McIlroy wrote a simpler fully conservative collector that was part of version 8 UNIX (tm), but appears to not have received widespread use. Rudimentary tools for use of the collector as a leak detector are included (see http://www.hpl.hp.com/personal/Hans_Boehm/gc/leak.html), as is a fairly sophisticated string package "cord" that makes use of the collector. (See doc/README.cords and H.-J. Boehm, R. Atkinson, and M. Plass, "Ropes: An Alternative to Strings", Software Practice and Experience 25, 12 (December 1995), pp. 1315-1330. This is very similar to the "rope" package in Xerox Cedar, or the "rope" package in the SGI STL or the g++ distribution.) Further collector documantation can be found at http://www.hpl.hp.com/personal/Hans_Boehm/gc GENERAL DESCRIPTION This is a garbage collecting storage allocator that is intended to be used as a plug-in replacement for C's malloc. Since the collector does not require pointers to be tagged, it does not attempt to ensure that all inaccessible storage is reclaimed. However, in our experience, it is typically more successful at reclaiming unused memory than most C programs using explicit deallocation. Unlike manually introduced leaks, the amount of unreclaimed memory typically stays bounded. In the following, an "object" is defined to be a region of memory allocated by the routines described below. Any objects not intended to be collected must be pointed to either from other such accessible objects, or from the registers, stack, data, or statically allocated bss segments. Pointers from the stack or registers may point to anywhere inside an object. The same is true for heap pointers if the collector is compiled with ALL_INTERIOR_POINTERS defined, or GC_all_interior_pointers is otherwise set, as is now the default. Compiling without ALL_INTERIOR_POINTERS may reduce accidental retention of garbage objects, by requiring pointers from the heap to to the beginning of an object. But this no longer appears to be a significant issue for most programs occupying a small fraction of the possible address space. There are a number of routines which modify the pointer recognition algorithm. GC_register_displacement allows certain interior pointers to be recognized even if ALL_INTERIOR_POINTERS is nor defined. GC_malloc_ignore_off_page allows some pointers into the middle of large objects to be disregarded, greatly reducing the probablility of accidental retention of large objects. For most purposes it seems best to compile with ALL_INTERIOR_POINTERS and to use GC_malloc_ignore_off_page if you get collector warnings from allocations of very large objects. See README.debugging for details. WARNING: pointers inside memory allocated by the standard "malloc" are not seen by the garbage collector. Thus objects pointed to only from such a region may be prematurely deallocated. It is thus suggested that the standard "malloc" be used only for memory regions, such as I/O buffers, that are guaranteed not to contain pointers to garbage collectable memory. Pointers in C language automatic, static, or register variables, are correctly recognized. (Note that GC_malloc_uncollectable has semantics similar to standard malloc, but allocates objects that are traced by the collector.) WARNING: the collector does not always know how to find pointers in data areas that are associated with dynamic libraries. This is easy to remedy IF you know how to find those data areas on your operating system (see GC_add_roots). Code for doing this under SunOS, IRIX 5.X and 6.X, HP/UX, Alpha OSF/1, Linux, and win32 is included and used by default. (See README.win32 for win32 details.) On other systems pointers from dynamic library data areas may not be considered by the collector. If you're writing a program that depends on the collector scanning dynamic library data areas, it may be a good idea to include at least one call to GC_is_visible() to ensure that those areas are visible to the collector. Note that the garbage collector does not need to be informed of shared read-only data. However if the shared library mechanism can introduce discontiguous data areas that may contain pointers, then the collector does need to be informed. Signal processing for most signals may be deferred during collection, and during uninterruptible parts of the allocation process. Like standard ANSI C mallocs, by default it is unsafe to invoke malloc (and other GC routines) from a signal handler while another malloc call may be in progress. Removing -DNO_SIGNALS from Makefile attempts to remedy that. But that may not be reliable with a compiler that substantially reorders memory operations inside GC_malloc. The allocator/collector can also be configured for thread-safe operation. (Full signal safety can also be achieved, but only at the cost of two system calls per malloc, which is usually unacceptable.) WARNING: the collector does not guarantee to scan thread-local storage (e.g. of the kind accessed with pthread_getspecific()). The collector does scan thread stacks, though, so generally the best solution is to ensure that any pointers stored in thread-local storage are also stored on the thread's stack for the duration of their lifetime. (This is arguably a longstanding bug, but it hasn't been fixed yet.) INSTALLATION AND PORTABILITY As distributed, the collector operates silently In the event of problems, this can usually be changed by defining the GC_PRINT_STATS or GC_PRINT_VERBOSE_STATS environment variables. This will result in a few lines of descriptive output for each collection. (The given statistics exhibit a few peculiarities. Things don't appear to add up for a variety of reasons, most notably fragmentation losses. These are probably much more significant for the contrived program "test.c" than for your application.) On most Un*x-like platforms, the collector can be built either using a GNU autoconf-based build infrastructure (type "configure; make" in the simplest case), or with a classic makefile by itself (type "cp Makefile.direct Makefile; make"). Here we focus on the latter option. On other platforms, typically only the latter option is available, though with a different supplied Makefile.) Typing "make test" nstead of "make" will automatically build the collector and then run setjmp_test and gctest. Setjmp_test will give you information about configuring the collector, which is useful primarily if you have a machine that's not already supported. Gctest is a somewhat superficial test of collector functionality. Failure is indicated by a core dump or a message to the effect that the collector is broken. Gctest takes about a second to two to run on reasonable 2007 vintage desktops. It may use up to about 30MB of memory. (The multi-threaded version will use more. 64-bit versions may use more.) "Make test" will also, as its last step, attempt to build and test the "cord" string library.) The Makefile will generate a library gc.a which you should link against. Typing "make cords" will add the cord library to gc.a. Note that this requires an ANSI C compiler. It is suggested that if you need to replace a piece of the collector (e.g. GC_mark_rts.c) you simply list your version ahead of gc.a on the ld command line, rather than replacing the one in gc.a. (This will generate numerous warnings under some versions of AIX, but it still works.) All include files that need to be used by clients will be put in the include subdirectory. (Normally this is just gc.h. "Make cords" adds "cord.h" and "ec.h".) The collector currently is designed to run essentially unmodified on machines that use a flat 32-bit or 64-bit address space. That includes the vast majority of Workstations and X86 (X >= 3) PCs. (The list here was deleted because it was getting too long and constantly out of date.) In a few cases (Amiga, OS/2, Win32, MacOS) a separate makefile or equivalent is supplied. Many of these have separate README.system files. Dynamic libraries are completely supported only under SunOS/Solaris, (and even that support is not functional on the last Sun 3 release), Linux, FreeBSD, NetBSD, IRIX 5&6, HP/UX, Win32 (not Win32S) and OSF/1 on DEC AXP machines plus perhaps a few others listed near the top of dyn_load.c. On other machines we recommend that you do one of the following: 1) Add dynamic library support (and send us the code). 2) Use static versions of the libraries. 3) Arrange for dynamic libraries to use the standard malloc. This is still dangerous if the library stores a pointer to a garbage collected object. But nearly all standard interfaces prohibit this, because they deal correctly with pointers to stack allocated objects. (Strtok is an exception. Don't use it.) In all cases we assume that pointer alignment is consistent with that enforced by the standard C compilers. If you use a nonstandard compiler you may have to adjust the alignment parameters defined in gc_priv.h. Note that this may also be an issue with packed records/structs, if those enforce less alignment for pointers. A port to a machine that is not byte addressed, or does not use 32 bit or 64 bit addresses will require a major effort. A port to plain MSDOS or win16 is hard. For machines not already mentioned, or for nonstandard compilers, some porting suggestions are provided in the "porting.html" file. THE C INTERFACE TO THE ALLOCATOR The following routines are intended to be directly called by the user. Note that usually only GC_malloc is necessary. GC_clear_roots and GC_add_roots calls may be required if the collector has to trace from nonstandard places (e.g. from dynamic library data areas on a machine on which the collector doesn't already understand them.) On some machines, it may be desirable to set GC_stacktop to a good approximation of the stack base. (This enhances code portability on HP PA machines, since there is no good way for the collector to compute this value.) Client code may include "gc.h", which defines all of the following, plus many others. 1) GC_malloc(nbytes) - allocate an object of size nbytes. Unlike malloc, the object is cleared before being returned to the user. Gc_malloc will invoke the garbage collector when it determines this to be appropriate. GC_malloc may return 0 if it is unable to acquire sufficient space from the operating system. This is the most probable consequence of running out of space. Other possible consequences are that a function call will fail due to lack of stack space, or that the collector will fail in other ways because it cannot maintain its internal data structures, or that a crucial system process will fail and take down the machine. Most of these possibilities are independent of the malloc implementation. 2) GC_malloc_atomic(nbytes) - allocate an object of size nbytes that is guaranteed not to contain any pointers. The returned object is not guaranteed to be cleared. (Can always be replaced by GC_malloc, but results in faster collection times. The collector will probably run faster if large character arrays, etc. are allocated with GC_malloc_atomic than if they are statically allocated.) 3) GC_realloc(object, new_size) - change the size of object to be new_size. Returns a pointer to the new object, which may, or may not, be the same as the pointer to the old object. The new object is taken to be atomic iff the old one was. If the new object is composite and larger than the original object, then the newly added bytes are cleared (we hope). This is very likely to allocate a new object, unless MERGE_SIZES is defined in gc_priv.h. Even then, it is likely to recycle the old object only if the object is grown in small additive increments (which, we claim, is generally bad coding practice.) 4) GC_free(object) - explicitly deallocate an object returned by GC_malloc or GC_malloc_atomic. Not necessary, but can be used to minimize collections if performance is critical. Probably a performance loss for very small objects (<= 8 bytes). 5) GC_expand_hp(bytes) - Explicitly increase the heap size. (This is normally done automatically if a garbage collection failed to GC_reclaim enough memory. Explicit calls to GC_expand_hp may prevent unnecessarily frequent collections at program startup.) 6) GC_malloc_ignore_off_page(bytes) - identical to GC_malloc, but the client promises to keep a pointer to the somewhere within the first 256 bytes of the object while it is live. (This pointer should nortmally be declared volatile to prevent interference from compiler optimizations.) This is the recommended way to allocate anything that is likely to be larger than 100Kbytes or so. (GC_malloc may result in failure to reclaim such objects.) 7) GC_set_warn_proc(proc) - Can be used to redirect warnings from the collector. Such warnings should be rare, and should not be ignored during code development. 8) GC_enable_incremental() - Enables generational and incremental collection. Useful for large heaps on machines that provide access to page dirty information. Some dirty bit implementations may interfere with debugging (by catching address faults) and place restrictions on heap arguments to system calls (since write faults inside a system call may not be handled well). 9) Several routines to allow for registration of finalization code. User supplied finalization code may be invoked when an object becomes unreachable. To call (*f)(obj, x) when obj becomes inaccessible, use GC_register_finalizer(obj, f, x, 0, 0); For more sophisticated uses, and for finalization ordering issues, see gc.h. The global variable GC_free_space_divisor may be adjusted up from its default value of 4 to use less space and more collection time, or down for the opposite effect. Setting it to 1 or 0 will effectively disable collections and cause all allocations to simply grow the heap. The variable GC_non_gc_bytes, which is normally 0, may be changed to reflect the amount of memory allocated by the above routines that should not be considered as a candidate for collection. Careless use may, of course, result in excessive memory consumption. Some additional tuning is possible through the parameters defined near the top of gc_priv.h. If only GC_malloc is intended to be used, it might be appropriate to define: #define malloc(n) GC_malloc(n) #define calloc(m,n) GC_malloc((m)*(n)) For small pieces of VERY allocation intensive code, gc_inl.h includes some allocation macros that may be used in place of GC_malloc and friends. All externally visible names in the garbage collector start with "GC_". To avoid name conflicts, client code should avoid this prefix, except when accessing garbage collector routines or variables. There are provisions for allocation with explicit type information. This is rarely necessary. Details can be found in gc_typed.h. THE C++ INTERFACE TO THE ALLOCATOR: The Ellis-Hull C++ interface to the collector is included in the collector distribution. If you intend to use this, type "make c++" after the initial build of the collector is complete. See gc_cpp.h for the definition of the interface. This interface tries to approximate the Ellis-Detlefs C++ garbage collection proposal without compiler changes. Very often it will also be necessary to use gc_allocator.h and the allocator declared there to construct STL data structures. Otherwise subobjects of STL data structures wil be allcoated using a system allocator, and objects they refer to may be prematurely collected. USE AS LEAK DETECTOR: The collector may be used to track down leaks in C programs that are intended to run with malloc/free (e.g. code with extreme real-time or portability constraints). To do so define FIND_LEAK in Makefile This will cause the collector to invoke the report_leak routine defined near the top of reclaim.c whenever an inaccessible object is found that has not been explicitly freed. Such objects will also be automatically reclaimed. If all objects are allocated with GC_DEBUG_MALLOC (see next section), then the default version of report_leak will report at least the source file and line number at which the leaked object was allocated. This may sometimes be sufficient. (On a few machines, it will also report a cryptic stack trace. If this is not symbolic, it can somethimes be called into a sympolic stack trace by invoking program "foo" with "callprocs foo". Callprocs is a short shell script that invokes adb to expand program counter values to symbolic addresses. It was largely supplied by Scott Schwartz.) Note that the debugging facilities described in the next section can sometimes be slightly LESS effective in leak finding mode, since in leak finding mode, GC_debug_free actually results in reuse of the object. (Otherwise the object is simply marked invalid.) Also note that the test program is not designed to run meaningfully in FIND_LEAK mode. Use "make gc.a" to build the collector. DEBUGGING FACILITIES: The routines GC_debug_malloc, GC_debug_malloc_atomic, GC_debug_realloc, and GC_debug_free provide an alternate interface to the collector, which provides some help with memory overwrite errors, and the like. Objects allocated in this way are annotated with additional information. Some of this information is checked during garbage collections, and detected inconsistencies are reported to stderr. Simple cases of writing past the end of an allocated object should be caught if the object is explicitly deallocated, or if the collector is invoked while the object is live. The first deallocation of an object will clear the debugging info associated with an object, so accidentally repeated calls to GC_debug_free will report the deallocation of an object without debugging information. Out of memory errors will be reported to stderr, in addition to returning NIL. GC_debug_malloc checking during garbage collection is enabled with the first call to GC_debug_malloc. This will result in some slowdown during collections. If frequent heap checks are desired, this can be achieved by explicitly invoking GC_gcollect, e.g. from the debugger. GC_debug_malloc allocated objects should not be passed to GC_realloc or GC_free, and conversely. It is however acceptable to allocate only some objects with GC_debug_malloc, and to use GC_malloc for other objects, provided the two pools are kept distinct. In this case, there is a very low probablility that GC_malloc allocated objects may be misidentified as having been overwritten. This should happen with probability at most one in 2**32. This probability is zero if GC_debug_malloc is never called. GC_debug_malloc, GC_malloc_atomic, and GC_debug_realloc take two additional trailing arguments, a string and an integer. These are not interpreted by the allocator. They are stored in the object (the string is not copied). If an error involving the object is detected, they are printed. The macros GC_MALLOC, GC_MALLOC_ATOMIC, GC_REALLOC, GC_FREE, and GC_REGISTER_FINALIZER are also provided. These require the same arguments as the corresponding (nondebugging) routines. If gc.h is included with GC_DEBUG defined, they call the debugging versions of these functions, passing the current file name and line number as the two extra arguments, where appropriate. If gc.h is included without GC_DEBUG defined, then all these macros will instead be defined to their nondebugging equivalents. (GC_REGISTER_FINALIZER is necessary, since pointers to objects with debugging information are really pointers to a displacement of 16 bytes form the object beginning, and some translation is necessary when finalization routines are invoked. For details, about what's stored in the header, see the definition of the type oh in debug_malloc.c) INCREMENTAL/GENERATIONAL COLLECTION: The collector normally interrupts client code for the duration of a garbage collection mark phase. This may be unacceptable if interactive response is needed for programs with large heaps. The collector can also run in a "generational" mode, in which it usually attempts to collect only objects allocated since the last garbage collection. Furthermore, in this mode, garbage collections run mostly incrementally, with a small amount of work performed in response to each of a large number of GC_malloc requests. This mode is enabled by a call to GC_enable_incremental(). Incremental and generational collection is effective in reducing pause times only if the collector has some way to tell which objects or pages have been recently modified. The collector uses two sources of information: 1. Information provided by the VM system. This may be provided in one of several forms. Under Solaris 2.X (and potentially under other similar systems) information on dirty pages can be read from the /proc file system. Under other systems (currently SunOS4.X) it is possible to write-protect the heap, and catch the resulting faults. On these systems we require that system calls writing to the heap (other than read) be handled specially by client code. See os_dep.c for details. 2. Information supplied by the programmer. We define "stubborn" objects to be objects that are rarely changed. Such an object can be allocated (and enabled for writing) with GC_malloc_stubborn. Once it has been initialized, the collector should be informed with a call to GC_end_stubborn_change. Subsequent writes that store pointers into the object must be preceded by a call to GC_change_stubborn. This mechanism performs best for objects that are written only for initialization, and such that only one stubborn object is writable at once. It is typically not worth using for short-lived objects. Stubborn objects are treated less efficiently than pointerfree (atomic) objects. A rough rule of thumb is that, in the absence of VM information, garbage collection pauses are proportional to the amount of pointerful storage plus the amount of modified "stubborn" storage that is reachable during the collection. Initial allocation of stubborn objects takes longer than allocation of other objects, since other data structures need to be maintained. We recommend against random use of stubborn objects in client code, since bugs caused by inappropriate writes to stubborn objects are likely to be very infrequently observed and hard to trace. However, their use may be appropriate in a few carefully written library routines that do not make the objects themselves available for writing by client code. BUGS: Any memory that does not have a recognizable pointer to it will be reclaimed. Exclusive-or'ing forward and backward links in a list doesn't cut it. Some C optimizers may lose the last undisguised pointer to a memory object as a consequence of clever optimizations. This has almost never been observed in practice. Send mail to boehm@acm.org for suggestions on how to fix your compiler. This is not a real-time collector. In the standard configuration, percentage of time required for collection should be constant across heap sizes. But collection pauses will increase for larger heaps. They will decrease with the number of processors if parallel marking is enabled. (On 2007 vintage machines, GC times may be on the order of 5 msecs per MB of accessible memory that needs to be scanned and processor. Your mileage may vary.) The incremental/generational collection facility may help in some cases. Please address bug reports to boehm@acm.org. If you are contemplating a major addition, you might also send mail to ask whether it's already been done (or whether we tried and discarded it). synopsis-0.12/src/Synopsis/gc/doc/README.win320000664000076400007640000002405711104702320020252 0ustar stefanstefanThe collector has at various times been compiled under Windows 95 & later, NT, and XP, with the original Microsoft SDK, with Visual C++ 2.0, 4.0, and 6, with the GNU win32 tools, with Borland 4.5, with Watcom C, and recently with the Digital Mars compiler. It is likely that some of these have been broken in the meantime. Patches are appreciated. For historical reasons, the collector test program "gctest" is linked as a GUI application, but does not open any windows. Its output normally appears in the file "gctest.exe.log". It may be started from the file manager. The hour glass cursor may appear as long as it's running. If it is started from the command line, it will usually run in the background. Wait a few minutes (a few seconds on a modern machine) before you check the output. You should see either a failure indication or a "Collector appears to work" message. The cord test program has not been ported (but should port easily). A toy editor (cord/de.exe) based on cords (heavyweight strings represented as trees) has been ported and is included. It runs fine under either win32 or win32S. It serves as an example of a true Windows application, except that it was written by a nonexpert Windows programmer. (There are some peculiarities in the way files are displayed. The is displayed explicitly for standard DOS text files. As in the UNIX version, control characters are displayed explicitly, but in this case as red text. This may be suboptimal for some tastes and/or sets of default window colors.) In general -DREDIRECT_MALLOC is unlikely to work unless the application is completely statically linked. The collector normally allocates memory from the OS with VirtualAlloc. This appears to cause problems under Windows NT and Windows 2000 (but not Windows 95/98) if the memory is later passed to CreateDIBitmap. To work around this problem, build the collector with -DUSE_GLOBAL_ALLOC. This is currently incompatible with -DUSE_MUNMAP. (Thanks to Jonathan Clark for tracking this down. There's some chance this may be fixed in 6.1alpha4, since we now separate heap sections with an unused page.) [Threads and incremental collection are discussed near the end, below.] Microsoft Tools --------------- For Microsoft development tools, rename NT_MAKEFILE as MAKEFILE. (Make sure that the CPU environment variable is defined to be i386.) In order to use the gc_cpp.h C++ interface, all client code should include gc_cpp.h. For historical reasons, the collector test program "gctest" is linked as a GUI application, but does not open any windows. Its output appears in the file "gc.log". It may be started from the file manager. The hour glass cursor may appear as long as it's running. If it is started from the command line, it will usually run in the background. Wait a few minutes (a few seconds on a modern machine) before you check the output. You should see either a failure indication or a "Collector appears to work" message. If you would prefer a VC++.NET project file, ask boehm@acm.org. One has been contributed, but it seems to contain some absolute paths etc., so it can presumably only be a starting point, and is not in the standard distribution. It is unclear (to me, Hans Boehm) whether it is feasible to change that. Clients may need to define GC_NOT_DLL before including gc.h, if the collector was built as a static library (as it normally is in the absence of thread support). GNU Tools --------- The collector should be buildable under Cygwin with either the old standard Makefile, or possibly with the "configure --diable-shared;make" machinery. (For the latter use --enable-threads=posix for thread support.) The major issue here seems to be that dynamic library support is not currently enabled for Cygwin. (This is probably fixable without a great deal of difficulty by reusing the standard WIN32 code. But it requires some tweaking.) As a result of this, "configure; make; make check" currently does not completely succeed, though the static library appears to be OK when used only from the main programs, and correspondingly the Makefile.direct self tests succeed. Mingw32 builds are not regularly tested, and may or may not work. The following paragraph is probably obsolete: For GNU-win32, use the regular makefile, possibly after uncommenting the line "include Makefile.DLLs". The latter should be necessary only if you want to package the collector as a DLL. [Is the following sentence obsolete? -HB] The GNU-win32 port is believed to work only for b18, not b19, probably due to linker changes in b19. This is probably fixable with a different definition of DATASTART and DATAEND in gcconfig.h. Borland Tools ------------- [Rarely tested.] For Borland tools, use BCC_MAKEFILE. Note that Borland's compiler defaults to 1 byte alignment in structures (-a1), whereas Visual C++ appears to default to 8 byte alignment (/Zp8). The garbage collector in its default configuration EXPECTS AT LEAST 4 BYTE ALIGNMENT. Thus the BORLAND DEFAULT MUST BE OVERRIDDEN. (In my opinion, it should usually be anyway. I expect that -a1 introduces major performance penalties on a 486 or Pentium.) Note that this changes structure layouts. (As a last resort, gcconfig.h can be changed to allow 1 byte alignment. But this has significant negative performance implications.) The Makefile is set up to assume Borland 4.5. If you have another version, change the line near the top. By default, it does not require the assembler. If you do have the assembler, I recommend removing the -DUSE_GENERIC. Watcom compiler --------------- Ivan V. Demakov's README for the Watcom port: The collector has been compiled with Watcom C 10.6 and 11.0. It runs under win32, win32s, and even under msdos with dos4gw dos-extender. It should also run under OS/2, though this isn't tested. Under win32 the collector can be built either as dll or as static library. Note that all compilations were done under Windows 95 or NT. For unknown reason compiling under Windows 3.11 for NT (one attempt has been made) leads to broken executables. Incremental collection is not supported. cord is not ported. Before compiling you may need to edit WCC_MAKEFILE to set target platform, library type (dynamic or static), calling conventions, and optimization options. To compile the collector and testing programs use the command: wmake -f WCC_MAKEFILE All programs using gc should be compiled with 4-byte alignment. For further explanations on this see comments about Borland. If the gc is compiled as dll, the macro ``GC_DLL'' should be defined before including "gc.h" (for example, with -DGC_DLL compiler option). It's important, otherwise resulting programs will not run. Ivan Demakov (email: ivan@tgrad.nsk.su) Incremental Collection ---------------------- There is some support for incremental collection. By default, the collector chooses between explicit page protection, anf GetWriteWatch-based write tracking automatically, depending on the platform. The former is slow and interacts poorly with a debugger. Pages are protected. Protection faults are caught by a handler installed at the bottom of the handler stack. Whenever possible, I recommend adding a call to GC_enable_incremental at the last possible moment, after most debugging is complete. No system calls are wrapped by the collector itself. It may be necessary to wrap ReadFile calls that use a buffer in the heap, so that the call does not encounter a protection fault while it's running. (As usual, none of this is an issue unless GC_enable_incremental is called.) Note that incremental collection is disabled with -DSMALL_CONFIG. Threads ------- This version of the collector by default handles threads similarly to other platforms. James Clark's code which tracks threads attached to the collector DLL still exists, but requires that both - the collector is built in a DLL with GC_DLL defined, and - GC_use_DllMain() is called before GC initialization, which in turn must happen before creating additional threads. We generally recommend avoiding this if possible, since it seems to be less than 100% reliable. Use NT_THREADS_MAKEFILE (a.k.a gc.mak) instead of NT_MAKEFILE to build a version that supports both kinds of thread tracking. To build the garbage collector test with VC++ from the command line, use nmake /F ".\gc.mak" CFG="gctest - Win32 Release" This requires that the subdirectory gctest\Release exist. The test program and DLL will reside in the Release directory. This version currently supports incremental collection only if it is enabled before any additional threads are created. Since 6.3alpha2, threads are also better supported in static library builds with Microsoft tools (use NT_STATIC_THREADS_MAKEFILE) and with the GNU tools. In all cases,the collector must be built with GC_WIN32_THREADS defined, even if the Cygwin pthreads interface is used. (NT_STATIC_THREADS_MAKEFILE does this implicitly. Under Cygwin, ./configure --enable-threads=posix defines GC_WIN32_THREADS.) For the normal, non-dll-based thread tracking to work properly, threads should be created with GC_CreateThread or GC_beginthreadex, and exit normally or call GC_endthreadex or GC_ExitThread. (For Cygwin, use standard pthread calls instead.) As in the pthread case, including gc.h will redefine CreateThread, _beginthreadex, _endthreadex, and ExitThread to call the GC_ versions instead. Note that, as usual, GC_CreateThread tends to introduce resource leaks that are avoided by GC_beginthreadex. There is currently no equivalent of _beginthread, and it should not be used. GC_INIT should be called from the main executable before other GC calls. We strongly advise against using the TerminateThread() win32 API call, especially with the garbage collector. Any use is likely to provoke a crash in the GC, since it makes it impossible for the collector to correctly track threads. To build the collector for Mingw32 Pthreads, use Makefile.direct and explicitly set GC_WIN32_PTHREADS. Use -DPTW32_STATIC_LIB for the static threads library. Note that the DEBUG_WIN32_PTHREADS support in win32_threads.c is currently broken and looking for someone to debug it. (This information and the port came from Romano Paolo Tenca). synopsis-0.12/src/Synopsis/gc/doc/barrett_diagram0000664000076400007640000001444311104702320021501 0ustar stefanstefanThis is an ASCII diagram of the data structure used to check pointer validity. It was provided by Dave Barrett , and should be of use to others attempting to understand the code. The data structure in GC4.X is essentially the same. -HB Data Structure used by GC_base in gc3.7: 21-Apr-94 63 LOG_TOP_SZ[11] LOG_BOTTOM_SZ[10] LOG_HBLKSIZE[13] +------------------+----------------+------------------+------------------+ p:| | TL_HASH(hi) | | HBLKDISPL(p) | +------------------+----------------+------------------+------------------+ \-----------------------HBLKPTR(p)-------------------/ \------------hi-------------------/ \______ ________/ \________ _______/ \________ _______/ V V V | | | GC_top_index[] | | | --- +--------------+ | | | ^ | | | | | | | | | | | TOP +--------------+<--+ | | _SZ +-<| [] | * | | (items)| +--------------+ if 0 < bi< HBLKSIZE | | | | | | then large object | | | | | | starts at the bi'th | | v | | | HBLK before p. | i | --- | +--------------+ | (word- | v | aligned) | bi= |GET_BI(p){->hash_link}->key==hi | | v | | | (bottom_index) \ scratch_alloc'd | | | ( struct bi ) / by get_index() | | --- +->+--------------+ | | ^ | | | | ^ | | | | BOTTOM | | ha=GET_HDR_ADDR(p) | | _SZ(items)+--------------+<----------------------+ +-------+ | +--<| index[] | | | | +--------------+ GC_obj_map: v | | | | from / +-+-+-----+-+-+-+-+ --- v | | | GC_add < 0| | | | | | | | ^ --- | +--------------+ _map_entry \ +-+-+-----+-+-+-+-+ | | | asc_link | +-+-+-----+-+-+-+-+ MAXOBJSZ | +--------------+ +-->| | | j | | | | | +1 | | key | | +-+-+-----+-+-+-+-+ | | +--------------+ | +-+-+-----+-+-+-+-+ | | | hash_link | | | | | | | | | | v | +--------------+ | +-+-+-----+-+-+-+-+ --- | | |<--MAX_OFFSET--->| | | (bytes) HDR(p)| GC_find_header(p) | |<--MAP_ENTRIES-->| | \ from | =HBLKSIZE/WORDSZ | (hdr) (struct hblkhdr) / alloc_hdr() | (1024 on Alpha) +-->+----------------------+ | (8/16 bits each) GET_HDR(p)| word hb_sz (words) | | +----------------------+ | | struct hblk *hb_next | | +----------------------+ | |mark_proc hb_mark_proc| | +----------------------+ | | char * hb_map |>-------------+ +----------------------+ | ushort hb_obj_kind | +----------------------+ | hb_last_reclaimed | --- +----------------------+ ^ | | MARK_BITS| hb_marks[] | *if hdr is free, hb_sz + DISCARD_WORDS _SZ(words)| | is the size of a heap chunk (struct hblk) v | | of at least MININCR*HBLKSIZE bytes (below), --- +----------------------+ otherwise, size of each object in chunk. Dynamic data structures above are interleaved throughout the heap in blocks of size MININCR * HBLKSIZE bytes as done by gc_scratch_alloc which cannot be freed; free lists are used (e.g. alloc_hdr). HBLKs's below are collected. (struct hblk) --- +----------------------+ < HBLKSIZE --- --- DISCARD_ ^ |garbage[DISCARD_WORDS]| aligned ^ ^ HDR_BYTES WORDS | | | | v (bytes) (words) | +-----hb_body----------+ < WORDSZ | --- --- | | | aligned | ^ ^ | | Object 0 | | hb_sz | | | | i |(word- (words)| | | | (bytes)|aligned) v | | + - - - - - - - - - - -+ --- | --- | | | | ^ | ^ | n * | | j (words) | hb_sz BODY_SZ HBLKSIZE | Object 1 | v v | (words) (bytes) | |--------------- v MAX_OFFSET | + - - - - - - - - - - -+ --- (bytes) | | | !All_INTERIOR_PTRS ^ | | | | sets j only for hb_sz | | | Object N | valid object offsets. | | v | | All objects WORDSZ v v --- +----------------------+ aligned. --- --- DISCARD_WORDS is normally zero. Indeed the collector has not been tested with another value in ages. synopsis-0.12/src/Synopsis/gc/doc/README.dj0000664000076400007640000000057011104702320017677 0ustar stefanstefan[Original version supplied by Xiaokun Zhu ] [This version came mostly from Gary Leavens. ] Look first at Makefile.dj, and possibly change the definitions of RM and MV if you don't have rm and mv installed. Then use Makefile.dj to compile the garbage collector. For example, you can do: make -f Makefile.dj test All the tests should work fine. synopsis-0.12/src/Synopsis/gc/doc/README.MacOSX0000664000076400007640000000007411104702320020373 0ustar stefanstefanSee README.darwin for the latest Darwin/MacOSX information. synopsis-0.12/src/Synopsis/gc/doc/README.amiga0000664000076400007640000003271511104702320020366 0ustar stefanstefan=========================================================================== Kjetil S. Matheussen's notes (28-11-2000) =========================================================================== Compiles under SAS/C again. Should allso still compile under other amiga compilers without big changes. I haven't checked if it still works under gcc, because I don't have gcc for amiga. But I have updated 'Makefile', and hope it compiles fine. WHATS NEW: 1. Made a pretty big effort in preventing GCs allocating-functions from returning chip-mem. The lower part of the new file AmigaOS.c does this in various ways, mainly by wrapping GC_malloc, GC_malloc_atomic, GC_malloc_uncollectable, GC_malloc_atomic_uncollectable, GC_malloc_stubborn, GC_malloc_ignore_off_page and GC_malloc_atomic_ignore_off_page. GC_realloc is allso wrapped, but doesn't do the same effort in preventing to return chip-mem. Other allocating-functions (f.ex. GC_*_typed_) can probably be used without any problems, but beware that the warn hook will not be called. In case of problems, don't define GC_AMIGA_FASTALLOC. Programs using more time actually using the memory allocated (instead of just allocate and free rapidly) have the most to earn on this, but even gctest now normally runs twice as fast and uses less memory, on my poor 8MB machine. The changes have only effect when there is no more fast-mem left. But with the way GC works, it could happen quite often. Beware that an atexit handler had to be added, so using the abort() function will make a big memory-loss. If you absolutely must call abort() instead of exit(), try calling the GC_amiga_free_all_mem function before abort(). New amiga-spesific compilation flags: GC_AMIGA_FASTALLOC - By NOT defining this option, GC will work like before, it will not try to force fast-mem out of the OS, and it will use normal calloc for allocation, and the rest of the following flags will have no effect. GC_AMIGA_ONLYFAST - Makes GC never to return chip-mem. GC_AMIGA_RETRY have no effect if this flag is set. GC_AMIGA_GC - If gc returns NULL, do a GC_gcollect, and try again. This usually is a success with the standard GC configuration. It is allso the most important flag to set to prevent GC from returning chip-mem. Beware that it slows down a lot when a program is rapidly allocating/deallocating when theres either very little fast-memory left or verly little chip-memory left. Its not a very common situation, but gctest sometimes (very rare) use many minutes because of this. GC_AMIGA_RETRY - If gc succeed allocating memory, but it is chip-mem, try again and see if it is fast-mem. Most of the time, it will actually return fast-mem for the second try. I have set max number of retries to 9 or size/5000. You can change this if you like. (see GC_amiga_rec_alloc()) GC_AMIGA_PRINTSTATS - Gather some statistics during the execution of a program, and prints out the info when the atexit-handler is called. My reccomendation is to set all this flags, except GC_AMIGA_PRINTSTATS and GC_AMIGA_ONLYFAST. If your program demands high response-time, you should not define GC_AMIGA_GC, and possible allso define GC_AMIGA_ONLYFAST. GC_AMIGA_RETRY does not seem to slow down much. Allso, when compiling up programs, and GC_AMIGA_FASTALLOC was not defined when compilling gc, you can define GC_AMIGA_MAKINGLIB to avoid having these allocation- functions wrapped. (see gc.h) Note that GC_realloc must not be called before any of the other above mentioned allocating-functions have been called. (shouldn't be any programs doing so either, I hope). Another note. The allocation-function is wrapped when defining GC_AMIGA_FASTALLOC by letting the function go thru the new GC_amiga_allocwrapper_do function-pointer (see gc.h). Means that sending function-pointers, such as GC_malloc, GC_malloc_atomic, etc., for later to be called like f.ex this, (*GC_malloc_functionpointer)(size), will not wrap the function. This is normally not a big problem, unless all allocation function is called like this, which will cause the atexit un-allocating function never to be called. Then you either have to manually add the atexit handler, or call the allocation- functions function-pointer functions like this; (*GC_amiga_allocwrapper_do)(size,GC_malloc_functionpointer). There are probably better ways this problem could be handled, unfortunately, I didn't find any without rewriting or replacing a lot of the GC-code, which I really didn't want to. (Making new GC_malloc_* functions, and just define f.ex GC_malloc as GC_amiga_malloc should allso work). New amiga-spesific function: void GC_amiga_set_toany(void (*func)(void)); 'func' is a function that will be called right before gc has to change allocation-method from MEMF_FAST to MEMF_ANY. Ie. when it is likely it will return chip-mem. 2. A few small compiler-spesific additions to make it compile with SAS/C again. 3. Updated and rewritten the smakefile, so that it works again and that the "unnecesarry" 'SCOPTIONS' files could be removed. Allso included the cord-smakefile stuff in the main smakefile, so that the cord smakefile could be removed too. By writing smake -f Smakefile.smk, both gc.lib and cord.lib will be made. STILL MISSING: Programs can not be started from workbench, at least not for SAS/C. (Martin Tauchmanns note about that it now works with workbench is definitely wrong when concerning SAS/C). I guess it works if you use the old "#if 0'ed"-code, but I haven't tested it. I think the reason for MT to replace the "#if 0'ed"-code was only because it was a bit to SAS/C-spesific. But I don't know. An iconx-script solves this problem anyway. BEWARE! -To run gctest, set the stack to around 200000 bytes first. -SAS/C-spesific: cord will crash if you compile gc.lib with either parm=reg or parm=both. (missing legal prototypes for function-pointers someplace is the reason I guess.). tested with software: Radium, http://www.stud.ifi.uio.no/~ksvalast/radium/ tested with hardware: MC68060 -ksvalast@ifi.uio.no =========================================================================== Martin Tauchmann's notes (1-Apr-99) =========================================================================== Works now, also with the GNU-C compiler V2.7.2.1. Modify the `Makefile` CC=cc $(ABI_FLAG) to CC=gcc $(ABI_FLAG) TECHNICAL NOTES - `GC_get_stack_base()`, `GC_register_data_segments()` works now with every C compiler; also Workbench. - Removed AMIGA_SKIP_SEG, but the Code-Segment must not be scanned by GC. PROBLEMS - When the Linker, does`t merge all Code-Segments to an single one. LD of GCC do it always. - With ixemul.library V47.3, when an GC program launched from another program (example: `Make` or `if_mach M68K AMIGA gctest`), `GC_register_data_segments()` found the Segment-List of the caller program. Can be fixed, if the run-time initialization code (for C programs, usually *crt0*) support `__data` and `__bss`. - PowerPC Amiga currently not supported. - Dynamic libraries (dyn_load.c) not supported. TESTED WITH SOFTWARE `Optimized Oberon 2 C` (oo2c) TESTED WITH HARDWARE MC68030 CONTACT Please, contact me at , when you change the Amiga port. =========================================================================== Michel Schinz's notes =========================================================================== WHO DID WHAT The original Amiga port was made by Jesper Peterson. I (Michel Schinz) modified it slightly to reflect the changes made in the new official distributions, and to take advantage of the new SAS/C 6.x features. I also created a makefile to compile the "cord" package (see the cord subdirectory). TECHNICAL NOTES In addition to Jesper's notes, I have the following to say: - Starting with version 4.3, gctest checks to see if the code segment is added to the root set or not, and complains if it is. Previous versions of this Amiga port added the code segment to the root set, so I tried to fix that. The only problem is that, as far as I know, it is impossible to know which segments are code segments and which are data segments (there are indeed solutions to this problem, like scanning the program on disk or patch the LoadSeg functions, but they are rather complicated). The solution I have chosen (see os_dep.c) is to test whether the program counter is in the segment we are about to add to the root set, and if it is, to skip the segment. The problems are that this solution is rather awkward and that it works only for one code segment. This means that if your program has more than one code segment, all of them but one will be added to the root set. This isn't a big problem in fact, since the collector will continue to work correctly, but it may be slower. Anyway, the code which decides whether to skip a segment or not can be removed simply by not defining AMIGA_SKIP_SEG. But notice that if you do so, gctest will complain (it will say that "GC_is_visible produced wrong failure indication"). However, it may be useful if you happen to have pointers stored in a code segment (you really shouldn't). If anyone has a good solution to the problem of finding, when a program is loaded in memory, whether a segment is a code or a data segment, please let me know. PROBLEMS If you have any problem with this version, please contact me at schinz@alphanet.ch (but do *not* send long files, since we pay for every mail!). =========================================================================== Jesper Peterson's notes =========================================================================== ADDITIONAL NOTES FOR AMIGA PORT These notes assume some familiarity with Amiga internals. WHY I PORTED TO THE AMIGA The sole reason why I made this port was as a first step in getting the Sather(*) language on the Amiga. A port of this language will be done as soon as the Sather 1.0 sources are made available to me. Given this motivation, the garbage collection (GC) port is rather minimal. (*) For information on Sather read the comp.lang.sather newsgroup. LIMITATIONS This port assumes that the startup code linked with target programs is that supplied with SAS/C versions 6.0 or later. This allows assumptions to be made about where to find the stack base pointer and data segments when programs are run from WorkBench, as opposed to running from the CLI. The compiler dependent code is all in the GC_get_stack_base() and GC_register_data_segments() functions, but may spread as I add Amiga specific features. Given that SAS/C was assumed, the port is set up to be built with "smake" using the "SMakefile". Compiler options in "SCoptions" can be set with "scopts" program. Both "smake" and "scopts" are part of the SAS/C commercial development system. In keeping with the porting philosophy outlined above, this port will not behave well with Amiga specific code. Especially not inter- process comms via messages, and setting up public structures like Intuition objects or anything else in the system lists. For the time being the use of this library is limited to single threaded ANSI/POSIX compliant or near-complient code. (ie. Stick to stdio for now). Given this limitation there is currently no mechanism for allocating "CHIP" or "PUBLIC" memory under the garbage collector. I'll add this after giving it considerable thought. The major problem is the entire physical address space may have to me scanned, since there is no telling who we may have passed memory to. If you allocate your own stack in client code, you will have to assign the pointer plus stack size to GC_stackbottom. The initial stack size of the target program can be compiled in by setting the __stack symbol (see SAS documentaion). It can be over- ridden from the CLI by running the AmigaDOS "stack" program, or from the WorkBench by setting the stack size in the tool types window. SAS/C COMPILER OPTIONS (SCoptions) You may wish to check the "CPU" code option is appropriate for your intended target system. Under no circumstances set the "StackExtend" code option in either compiling the library or *ANY* client code. All benign compiler warnings have been suppressed. These mainly involve lack of prototypes in the code, and dead assignments detected by the optimizer. THE GOOD NEWS The library as it stands is compatible with the GigaMem commercial virtual memory software, and probably similar PD software. The performance of "gctest" on an Amiga 2630 (68030 @ 25Mhz) compares favourably with an HP9000 with similar architecture (a 325 with a 68030 I think). ----------------------------------------------------------------------- The Amiga port has been brought to you by: Jesper Peterson. jep@mtiame.mtia.oz.au (preferred, but 1 week turnaround) jep@orca1.vic.design.telecom.au (that's orca, 1 day turnaround) At least one of these addresses should be around for a while, even though I don't work for either of the companies involved. synopsis-0.12/src/Synopsis/gc/doc/README.hp0000664000076400007640000000151611104702320017712 0ustar stefanstefanDynamic loading support requires that executables be linked with -ldld. The alternative is to build the collector without defining DYNAMIC_LOADING in gcconfig.h and ensuring that all garbage collectable objects are accessible without considering statically allocated variables in dynamic libraries. The collector should compile with either plain cc or cc -Ae. Cc -Aa fails to define _HPUX_SOURCE and thus will not configure the collector correctly. Incremental collection support was reccently added, and should now work. In spite of past claims, pthread support under HP/UX 11 should now work. Define GC_HPUX_THREADS for the build. Incremental collection still does not work in combination with it. The stack finding code can be confused by putenv calls before collector initialization. Call GC_malloc or GC_init before any putenv calls. synopsis-0.12/src/Synopsis/gc/doc/README.macros0000664000076400007640000000724111104702320020570 0ustar stefanstefanThe collector uses a large amount of conditional compilation in order to deal with platform dependencies. This violates a number of known coding standards. On the other hand, it seems to be the only practical way to support this many platforms without excessive code duplication. A few guidelines have mostly been followed in order to keep this manageable: 1) #if and #ifdef directives are properly indented whenever easily possible. All known C compilers allow whitespace between the "#" and the "if" to make this possible. ANSI C also allows white space before the "#", though we avoid that. It has the known disadvantages that it differs from the normal GNU conventions, and that it makes patches larger than otherwise necessary. In my opinion, it's still well worth it, for the same reason that we indent ordinary "if" statements. 2) Whenever possible, tests are performed on the macros defined in gcconfig.h instead of directly testing patform-specific predefined macros. This makes it relatively easy to adapt to new compilers with a different set of predefined macros. Currently these macros generally identify platforms instead of features. In many cases, this is a mistake. Many of the tested configuration macros are at least somewhat defined in either include/private/gcconfig.h or in Makefile.direct. Here is an attempt at defining some of the remainder: (Thanks to Walter Bright for suggesting this. This is a work in progress) MACRO EXPLANATION ----- ----------- __DMC__ Always #define'd by the Digital Mars compiler. Expands to the compiler version number in hex, i.e. 0x810 is version 8.1b0 _ENABLE_ARRAYNEW #define'd by the Digital Mars C++ compiler when operator new[] and delete[] are separately overloadable. Used in gc_cpp.h. _MSC_VER Expands to the Visual C++ compiler version. Assumed to not be defined for other compilers (at least if they behave appreciably differently). _DLL Defined by Visual C++ if dynamic libraries are being built or used. Used to test whether __declspec(dllimport) or __declspec(dllexport) needs to be added to declarations to support the case in which the collector is in a dll. GC_DLL User-settable macro that forces the effect of _DLL. Set by gc.h if _DLL is defined and GC_NOT_DLL is undefined. This is the macro that is tested internally to determine whether the GC is in its own dynamic library. May need to be set by clients before including gc.h. Note that inside the GC implementation it indicates that the collector is in its own dynamic library, should export its symbols, etc. But in clients it indicates that the GC resides in a different DLL, its entry points should be referenced accordingly, and precautions may need to be taken to properly deal with statically allocated variables in the main program. Used only for MS Windows. GC_NOT_DLL User-settable macro that overrides _DLL, e.g. if dynamic libraries are used, but the collector is in a static library. __STDC__ Assumed to be defined only by compilers that understand prototypes and other C89 features. Its value is generally not used, since we are fine with most nonconforming extensions. SUNOS5SIGS Solaris-like signal handling. This is probably misnamed, since it really doesn't guarantee much more than Posix. Currently set only for Solaris2.X, HPUX, and DRSNX. Should probably be set for some other platforms. PCR Set if the collector is being built as part of the Xerox Portable Common Runtime. USE_COMPILER_TLS Assume the existence of __thread-style thread-local storage. Set automatically for thread-local allocation with the HP/UX vendor compiler. Usable with gcc on sufficiently up-to-date ELF platforms. synopsis-0.12/src/Synopsis/gc/doc/doc.am0000664000076400007640000000260111104702320017504 0ustar stefanstefan# # # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED # OR IMPLIED. ANY USE IS AT YOUR OWN RISK. # # Permission is hereby granted to use or copy this program # for any purpose, provided the above notices are retained on all copies. # Permission to modify the code and to distribute modified code is granted, # provided the above notices are retained, and a notice that the code was # modified is included with the above copyright notice. # # Modified by: Grzegorz Jakacki # Modified by: Petter Urkedal ## Process this file with automake to produce Makefile.in. # installed documentation # dist_pkgdata_DATA = \ doc/barrett_diagram \ doc/debugging.html \ doc/gc.man \ doc/gcdescr.html \ doc/README \ doc/README.amiga \ doc/README.arm.cross \ doc/README.autoconf \ doc/README.changes \ doc/README.contributors \ doc/README.cords \ doc/README.DGUX386 \ doc/README.dj \ doc/README.environment \ doc/README.ews4800 \ doc/README.hp \ doc/README.linux \ doc/README.Mac \ doc/README.MacOSX \ doc/README.macros \ doc/README.OS2 \ doc/README.rs6000 \ doc/README.sgi \ doc/README.solaris2 \ doc/README.uts \ doc/README.win32 \ doc/README.win64 \ doc/overview.html \ doc/tree.html \ doc/leak.html \ doc/gcinterface.html \ doc/scale.html \ doc/README.darwin \ doc/simple_example.html \ doc/porting.html synopsis-0.12/src/Synopsis/gc/doc/gcinterface.html0000664000076400007640000003214011104702320021561 0ustar stefanstefan Garbage Collector Interface

C Interface

On many platforms, a single-threaded garbage collector library can be built to act as a plug-in malloc replacement. (Build with -DREDIRECT_MALLOC=GC_malloc -DIGNORE_FREE.) This is often the best way to deal with third-party libraries which leak or prematurely free objects. -DREDIRECT_MALLOC is intended primarily as an easy way to adapt old code, not for new development.

New code should use the interface discussed below.

Code must be linked against the GC library. On most UNIX platforms, depending on how the collector is built, this will be gc.a or libgc.{a,so}.

The following describes the standard C interface to the garbage collector. It is not a complete definition of the interface. It describes only the most commonly used functionality, approximately in decreasing order of frequency of use. The full interface is described in gc.h or gc.h in the distribution.

Clients should include gc.h.

In the case of multithreaded code, gc.h should be included after the threads header file, and after defining the appropriate GC_XXXX_THREADS macro. (For 6.2alpha4 and later, simply defining GC_THREADS should suffice.) The header file gc.h must be included in files that use either GC or threads primitives, since threads primitives will be redefined to cooperate with the GC on many platforms.

Thread users should also be aware that on many platforms objects reachable only from thread-local variables may be prematurely reclaimed. Thus objects pointed to by thread-local variables should also be pointed to by a globally visible data structure. (This is viewed as a bug, but as one that is exceedingly hard to fix without some libc hooks.)

void * GC_MALLOC(size_t nbytes)
Allocates and clears nbytes of storage. Requires (amortized) time proportional to nbytes. The resulting object will be automatically deallocated when unreferenced. References from objects allocated with the system malloc are usually not considered by the collector. (See GC_MALLOC_UNCOLLECTABLE, however.) GC_MALLOC is a macro which invokes GC_malloc by default or, if GC_DEBUG is defined before gc.h is included, a debugging version that checks occasionally for overwrite errors, and the like.
void * GC_MALLOC_ATOMIC(size_t nbytes)
Allocates nbytes of storage. Requires (amortized) time proportional to nbytes. The resulting object will be automatically deallocated when unreferenced. The client promises that the resulting object will never contain any pointers. The memory is not cleared. This is the preferred way to allocate strings, floating point arrays, bitmaps, etc. More precise information about pointer locations can be communicated to the collector using the interface in gc_typed.h in the distribution.
void * GC_MALLOC_UNCOLLECTABLE(size_t nbytes)
Identical to GC_MALLOC, except that the resulting object is not automatically deallocated. Unlike the system-provided malloc, the collector does scan the object for pointers to garbage-collectable memory, even if the block itself does not appear to be reachable. (Objects allocated in this way are effectively treated as roots by the collector.)
void * GC_REALLOC(void *old, size_t new_size)
Allocate a new object of the indicated size and copy (a prefix of) the old object into the new object. The old object is reused in place if convenient. If the original object was allocated with GC_MALLOC_ATOMIC, the new object is subject to the same constraints. If it was allocated as an uncollectable object, then the new object is uncollectable, and the old object (if different) is deallocated.
void GC_FREE(void *dead)
Explicitly deallocate an object. Typically not useful for small collectable objects.
void * GC_MALLOC_IGNORE_OFF_PAGE(size_t nbytes)
void * GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE(size_t nbytes)
Analogous to GC_MALLOC and GC_MALLOC_ATOMIC, except that the client guarantees that as long as the resulting object is of use, a pointer is maintained to someplace inside the first 512 bytes of the object. This pointer should be declared volatile to avoid interference from compiler optimizations. (Other nonvolatile pointers to the object may exist as well.) This is the preferred way to allocate objects that are likely to be > 100KBytes in size. It greatly reduces the risk that such objects will be accidentally retained when they are no longer needed. Thus space usage may be significantly reduced.
void GC_INIT(void)
On some platforms, it is necessary to invoke this from the main executable, not from a dynamic library, before the initial invocation of a GC routine. It is recommended that this be done in portable code, though we try to ensure that it expands to a no-op on as many platforms as possible. As of GC 7.0, it is required if thread-local allocation is enabled in the collector build, and malloc is not redirected to GC_malloc.
void GC_gcollect(void)
Explicitly force a garbage collection.
void GC_enable_incremental(void)
Cause the garbage collector to perform a small amount of work every few invocations of GC_MALLOC or the like, instead of performing an entire collection at once. This is likely to increase total running time. It will improve response on a platform that either has suitable support in the garbage collector (Linux and most Unix versions, win32 if the collector was suitably built) or if "stubborn" allocation is used (see gc.h). On many platforms this interacts poorly with system calls that write to the garbage collected heap.
GC_warn_proc GC_set_warn_proc(GC_warn_proc p)
Replace the default procedure used by the collector to print warnings. The collector may otherwise write to sterr, most commonly because GC_malloc was used in a situation in which GC_malloc_ignore_off_page would have been more appropriate. See gc.h for details.
void GC_REGISTER_FINALIZER(...)
Register a function to be called when an object becomes inaccessible. This is often useful as a backup method for releasing system resources (e.g. closing files) when the object referencing them becomes inaccessible. It is not an acceptable method to perform actions that must be performed in a timely fashion. See gc.h for details of the interface. See here for a more detailed discussion of the design.

Note that an object may become inaccessible before client code is done operating on objects referenced by its fields. Suitable synchronization is usually required. See here or here for details.

If you are concerned with multiprocessor performance and scalability, you should consider enabling and using thread local allocation (e.g. GC_LOCAL_MALLOC, see gc_local_alloc.h. If your platform supports it, you should build the collector with parallel marking support (-DPARALLEL_MARK, or --enable-parallel-mark).

If the collector is used in an environment in which pointer location information for heap objects is easily available, this can be passed on to the collector using the interfaces in either gc_typed.h or gc_gcj.h.

The collector distribution also includes a string package that takes advantage of the collector. For details see cord.h

C++ Interface

The C++ interface is implemented as a thin layer on the C interface. Unfortunately, this thin layer appears to be very sensitive to variations in C++ implementations, particularly since it tries to replace the global ::new operator, something that appears to not be well-standardized. Your platform may need minor adjustments in this layer (gc_cpp.cc, gc_cpp.h, and possibly gc_allocator.h). Such changes do not require understanding of collector internals, though they may require a good understanding of your platform. (Patches enhancing portability are welcome. But it's easy to break one platform by fixing another.)

Usage of the collector from C++ is also complicated by the fact that there are many "standard" ways to allocate memory in C++. The default ::new operator, default malloc, and default STL allocators allocate memory that is not garbage collected, and is not normally "traced" by the collector. This means that any pointers in memory allocated by these default allocators will not be seen by the collector. Garbage-collectable memory referenced only by pointers stored in such default-allocated objects is likely to be reclaimed prematurely by the collector.

It is the programmers responsibility to ensure that garbage-collectable memory is referenced by pointers stored in one of

  • Program variables
  • Garbage-collected objects
  • Uncollected but "traceable" objects
"Traceable" objects are not necessarily reclaimed by the collector, but are scanned for pointers to collectable objects. They are usually allocated by GC_MALLOC_UNCOLLECTABLE, as described above, and through some interfaces described below.

(On most platforms, the collector may not trace correctly from in-flight exception objects. Thus objects thrown as exceptions should only point to otherwise reachable memory. This is another bug whose proper repair requires platform hooks.)

The easiest way to ensure that collectable objects are properly referenced is to allocate only collectable objects. This requires that every allocation go through one of the following interfaces, each one of which replaces a standard C++ allocation mechanism:

STL allocators

Recent versions of the collector also include a more standard-conforming allocator implementation in gc_allocator.h. It defines

  • traceable_allocator
  • gc_allocator
which may be used either directly to allocate memory or to instantiate container templates. The former allocates uncollectable but traced memory. The latter allocates garbage-collected memory.

These should work with any fully standard-conforming C++ compiler.

Users of the SGI extended STL or its derivatives (including most g++ versions) can alternatively include new_gc_alloc.h before including STL header files. (gc_alloc.h corresponds to now obsolete versions of the SGI STL.) This interface is no longer recommended, but it has existed for much longer.

This defines SGI-style allocators

  • alloc
  • single_client_alloc
  • gc_alloc
  • single_client_gc_alloc
The first two allocate uncollectable but traced memory, while the second two allocate collectable memory. The single_client versions are not safe for concurrent access by multiple threads, but are faster.

For an example, click here.

Class inheritance based interface
Users may include gc_cpp.h and then cause members of classes to be allocated in garbage collectable memory by having those classes inherit from class gc. For details see gc_cpp.h.

Linking against libgccpp in addition to the gc library overrides ::new (and friends) to allocate traceable memory but uncollectable memory, making it safe to refer to collectable objects from the resulting memory.

C interface
It is also possible to use the C interface from gc.h directly. On platforms which use malloc to implement ::new, it should usually be possible to use a version of the collector that has been compiled as a malloc replacement. It is also possible to replace ::new and other allocation functions suitably, as is done by libgccpp.

Note that user-implemented small-block allocation often works poorly with an underlying garbage-collected large block allocator, since the collector has to view all objects accessible from the user's free list as reachable. This is likely to cause problems if GC_MALLOC is used with something like the original HP version of STL. This approach works well with the SGI versions of the STL only if the malloc_alloc allocator is used.

synopsis-0.12/src/Synopsis/gc/doc/porting.html0000664000076400007640000003731411104702320021001 0ustar stefanstefan Conservative GC Porting Directions

Conservative GC Porting Directions

The collector is designed to be relatively easy to port, but is not portable code per se. The collector inherently has to perform operations, such as scanning the stack(s), that are not possible in portable C code.

All of the following assumes that the collector is being ported to a byte-addressable 32- or 64-bit machine. Currently all successful ports to 64-bit machines involve LP64 targets. The code base includes some provisions for P64 targets (notably win64), but that has not been tested. You are hereby discouraged from attempting a port to non-byte-addressable, or 8-bit, or 16-bit machines.

The difficulty of porting the collector varies greatly depending on the needed functionality. In the simplest case, only some small additions are needed for the include/private/gcconfig.h file. This is described in the following section. Later sections discuss some of the optional features, which typically involve more porting effort.

Note that the collector makes heavy use of ifdefs. Unlike some other software projects, we have concluded repeatedly that this is preferable to system dependent files, with code duplicated between the files. However, to keep this manageable, we do strongly believe in indenting ifdefs correctly (for historical reasons usually without the leading sharp sign). (Separate source files are of course fine if they don't result in code duplication.)

Adding Platforms to gcconfig.h

If neither thread support, nor tracing of dynamic library data is required, these are often the only changes you will need to make.

The gcconfig.h file consists of three sections:

  1. A section that defines GC-internal macros that identify the architecture (e.g. IA64 or I386) and operating system (e.g. LINUX or MSWIN32). This is usually done by testing predefined macros. By defining our own macros instead of using the predefined ones directly, we can impose a bit more consistency, and somewhat isolate ourselves from compiler differences.

    It is relatively straightforward to add a new entry here. But please try to be consistent with the existing code. In particular, 64-bit variants of 32-bit architectures general are not treated as a new architecture. Instead we explicitly test for 64-bit-ness in the few places in which it matters. (The notable exception here is I386 and X86_64. This is partially historical, and partially justified by the fact that there are arguably more substantial architecture and ABI differences here than for RISC variants.)

    on GNU-based systems, cpp -dM empty_source_file.c seems to generate a set of predefined macros. On some other systems, the "verbose" compiler option may do so, or the manual page may list them.

  2. A section that defines a small number of platform-specific macros, which are then used directly by the collector. For simple ports, this is where most of the effort is required. We describe the macros below.

    This section contains a subsection for each architecture (enclosed in a suitable ifdef. Each subsection usually contains some architecture-dependent defines, followed by several sets of OS-dependent defines, again enclosed in ifdefs.

  3. A section that fills in defaults for some macros left undefined in the preceding section, and defines some other macros that rarely need adjustment for new platforms. You will typically not have to touch these. If you are porting to an OS that was previously completely unsupported, it is likely that you will need to add another clause to the definition of GET_MEM.
The following macros must be defined correctly for each architecture and operating system:
MACH_TYPE
Defined to a string that represents the machine architecture. Usually just the macro name used to identify the architecture, but enclosed in quotes.
OS_TYPE
Defined to a string that represents the operating system name. Usually just the macro name used to identify the operating system, but enclosed in quotes.
CPP_WORDSZ
The word size in bits as a constant suitable for preprocessor tests, i.e. without casts or sizeof expressions. Currently always defined as either 64 or 32. For platforms supporting both 32- and 64-bit ABIs, this should be conditionally defined depending on the current ABI. There is a default of 32.
ALIGNMENT
Defined to be the largest N, such that all pointer are guaranteed to be aligned on N-byte boundaries. defining it to be 1 will always work, but perform poorly. For all modern 32-bit platforms, this is 4. For all modern 64-bit platforms, this is 8. Whether or not X86 qualifies as a modern architecture here is compiler- and OS-dependent.
DATASTART
The beginning of the main data segment. The collector will trace all memory between DATASTART and DATAEND for root pointers. On some platforms,this can be defined to a constant address, though experience has shown that to be risky. Ideally the linker will define a symbol (e.g. _data whose address is the beginning of the data segment. Sometimes the value can be computed using the GC_SysVGetDataStart function. Not used if either the next macro is defined, or if dynamic loading is supported, and the dynamic loading support defines a function GC_register_main_static_data() which returns false.
SEARCH_FOR_DATA_START
If this is defined DATASTART will be defined to a dynamically computed value which is obtained by starting with the address of _end and walking backwards until non-addressable memory is found. This often works on Posix-like platforms. It makes it harder to debug client programs, since startup involves generating and catching a segmentation fault, which tends to confuse users.
DATAEND
Set to the end of the main data segment. Defaults to end, where that is declared as an array. This works in some cases, since the linker introduces a suitable symbol.
DATASTART2, DATAEND2
Some platforms have two discontiguous main data segments, e.g. for initialized and uninitialized data. If so, these two macros should be defined to the limits of the second main data segment.
STACK_GROWS_UP
Should be defined if the stack (or thread stacks) grow towards higher addresses. (This appears to be true only on PA-RISC. If your architecture has more than one stack per thread, and is not already supported, you will need to do more work. Grep for "IA64" in the source for an example.)
STACKBOTTOM
Defined to be the cool end of the stack, which is usually the highest address in the stack. It must bound the region of the stack that contains pointers into the GC heap. With thread support, this must be the cold end of the main stack, which typically cannot be found in the same way as the other thread stacks. If this is not defined and none of the following three macros is defined, client code must explicitly set GC_stackbottom to an appropriate value before calling GC_INIT() or any other GC_ routine.
LINUX_STACKBOTTOM
May be defined instead of STACKBOTTOM. If defined, then the cold end of the stack will be determined Currently we usually read it from /proc.
HEURISTIC1
May be defined instead of STACKBOTTOM. STACK_GRAN should generally also be undefined and defined. The cold end of the stack is determined by taking an address inside GC_init's frame, and rounding it up to the next multiple of STACK_GRAN. This works well if the stack base is always aligned to a large power of two. (STACK_GRAN is predefined to 0x1000000, which is rarely optimal.)
HEURISTIC2
May be defined instead of STACKBOTTOM. The cold end of the stack is determined by taking an address inside GC_init's frame, incrementing it repeatedly in small steps (decrement if STACK_GROWS_UP), and reading the value at each location. We remember the value when the first Segmentation violation or Bus error is signalled, round that to the nearest plausible page boundary, and use that as the stack base.
DYNAMIC_LOADING
Should be defined if dyn_load.c has been updated for this platform and tracing of dynamic library roots is supported.
MPROTECT_VDB, PROC_VDB
May be defined if the corresponding "virtual dirty bit" implementation in os_dep.c is usable on this platform. This allows incremental/generational garbage collection. MPROTECT_VDB identifies modified pages by write protecting the heap and catching faults. PROC_VDB uses the /proc primitives to read dirty bits.
PREFETCH, PREFETCH_FOR_WRITE
The collector uses PREFETCH(x) to preload the cache with *x. This defaults to a no-op.
CLEAR_DOUBLE
If CLEAR_DOUBLE is defined, then CLEAR_DOUBLE(x) is used as a fast way to clear the two words at GC_malloc-aligned address x. By default, word stores of 0 are used instead.
HEAP_START
HEAP_START may be defined as the initial address hint for mmap-based allocation.
ALIGN_DOUBLE
Should be defined if the architecture requires double-word alignment of GC_malloced memory, e.g. 8-byte alignment with a 32-bit ABI. Most modern machines are likely to require this. This is no longer needed for GC7 and later.

Additional requirements for a basic port

In some cases, you may have to add additional platform-specific code to other files. A likely candidate is the implementation of GC_with_callee_saves_pushed in mach_dep.c. This ensure that register contents that the collector must trace from are copied to the stack. Typically this can be done portably, but on some platforms it may require assembly code, or just tweaking of conditional compilation tests.

For GC7, if your platform supports getcontext(), then definining the macro UNIX_LIKE for your OS in gcconfig.h (if it isn't defined there already) is likely to solve the problem. otherwise, if you are using gcc, _builtin_unwind_init() will be used, and should work fine. If that is not applicable either, the implementation will try to use setjmp(). This will work if your setjmp implementation saves all possibly pointer-valued registers into the buffer, as opposed to trying to unwind the stack at longjmp time. The setjmp_test test tries to determine this, but often doesn't get it right.

In GC6.x versions of the collector, tracing of registers was more commonly handled with assembly code. In GC7, this is generally to be avoided.

Most commonly os_dep.c will not require attention, but see below.

Thread support

Supporting threads requires that the collector be able to find and suspend all threads potentially accessing the garbage-collected heap, and locate any state associated with each thread that must be traced.

The functionality needed for thread support is generally implemented in one or more files specific to the particular thread interface. For example, somewhat portable pthread support is implemented in pthread_support.c and pthread_stop_world.c. The essential functionality consists of

GC_stop_world()
Stops all threads which may access the garbage collected heap, other than the caller.
GC_start_world()
Restart other threads.
GC_push_all_stacks()
Push the contents of all thread stacks (or at least of pointer-containing regions in the thread stacks) onto the mark stack.
These very often require that the garbage collector maintain its own data structures to track active threads.

In addition, LOCK and UNLOCK must be implemented in gc_locks.h

The easiest case is probably a new pthreads platform on which threads can be stopped with signals. In this case, the changes involve:

  1. Introducing a suitable GC_X_THREADS macro, which should be automatically defined by gc_config_macros.h in the right cases. It should also result in a definition of GC_PTHREADS, as for the existing cases.
  2. For GC7+, ensuring that the atomic_ops package at least minimally supports the platform. If incremental GC is needed, or if pthread locks don't perform adequately as the allocation lock, you will probably need to ensure that a sufficient atomic_ops port exists for the platform to provided an atomic test and set operation. (Current GC7 versions require moreatomic_ops asupport than necessary. This is a bug.) For earlier versions define GC_test_and_set in gc_locks.h.
  3. Making any needed adjustments to pthread_stop_world.c and pthread_support.c. Ideally none should be needed. In fact, not all of this is as well standardized as one would like, and outright bugs requiring workarounds are common.
Non-preemptive threads packages will probably require further work. Similarly thread-local allocation and parallel marking requires further work in pthread_support.c, and may require better atomic_ops support.

Dynamic library support

So long as DATASTART and DATAEND are defined correctly, the collector will trace memory reachable from file scope or static variables defined as part of the main executable. This is sufficient if either the program is statically linked, or if pointers to the garbage-collected heap are never stored in non-stack variables defined in dynamic libraries.

If dynamic library data sections must also be traced, then

  • DYNAMIC_LOADING must be defined in the appropriate section of gcconfig.h.
  • An appropriate versions of the functions GC_register_dynamic_libraries() should be defined in dyn_load.c. This function should invoke GC_cond_add_roots(region_start, region_end, TRUE) on each dynamic library data section.

Implementations that scan for writable data segments are error prone, particularly in the presence of threads. They frequently result in race conditions when threads exit and stacks disappear. They may also accidentally trace large regions of graphics memory, or mapped files. On at least one occasion they have been known to try to trace device memory that could not safely be read in the manner the GC wanted to read it.

It is usually safer to walk the dynamic linker data structure, especially if the linker exports an interface to do so. But beware of poorly documented locking behavior in this case.

Incremental GC support

For incremental and generational collection to work, os_dep.c must contain a suitable "virtual dirty bit" implementation, which allows the collector to track which heap pages (assumed to be a multiple of the collectors block size) have been written during a certain time interval. The collector provides several implementations, which might be adapted. The default (DEFAULT_VDB) is a placeholder which treats all pages as having been written. This ensures correctness, but renders incremental and generational collection essentially useless.

Stack traces for debug support

If stack traces in objects are need for debug support, GC_dave_callers and GC_print_callers must be implemented.

Disclaimer

This is an initial pass at porting guidelines. Some things have no doubt been overlooked. synopsis-0.12/src/Synopsis/gc/doc/README.linux0000664000076400007640000001047011104702320020441 0ustar stefanstefanSee README.alpha for Linux on DEC AXP info. This file applies mostly to Linux/Intel IA32. Ports to Linux on an M68K, IA64, SPARC, MIPS, Alpha and PowerPC are also integrated. They should behave similarly, except that the PowerPC port lacks incremental GC support, and it is unknown to what extent the Linux threads code is functional. See below for M68K specific notes. Incremental GC is generally supported. Dynamic libraries are supported on an ELF system. A static executable should be linked with the gcc option "-Wl,-defsym,_DYNAMIC=0". The collector appears to work reliably with Linux threads, but beware of older versions of glibc and gdb. The garbage collector uses SIGPWR and SIGXCPU if it is used with Linux threads. These should not be touched by the client program. To use threads, you need to abide by the following requirements: 1) You need to use LinuxThreads or NPTL (which are included in libc6). The collector relies on some implementation details of the LinuxThreads package. This code may not work on other pthread implementations (in particular it will *not* work with MIT pthreads). 2) You must compile the collector with -DGC_LINUX_THREADS (or just -DGC_THREADS) and -D_REENTRANT specified in the Makefile. 3a) Every file that makes thread calls should define GC_LINUX_THREADS and _REENTRANT and then include gc.h. Gc.h redefines some of the pthread primitives as macros which also provide the collector with information it requires. 3b) A new alternative to (3a) is to build the collector and compile GC clients with -DGC_USE_LD_WRAP, and to link the final program with (for ld) --wrap read --wrap dlopen --wrap pthread_create \ --wrap pthread_join --wrap pthread_detach \ --wrap pthread_sigmask --wrap sleep (for gcc) -Wl,--wrap -Wl,read -Wl,--wrap -Wl,dlopen -Wl,--wrap \ -Wl,pthread_create -Wl,--wrap -Wl,pthread_join -Wl,--wrap \ -Wl,pthread_detach -Wl,--wrap -Wl,pthread_sigmask \ -Wl,--wrap -Wl,sleep In any case, _REENTRANT should be defined during compilation. 4) Dlopen() disables collection during its execution. (It can't run concurrently with the collector, since the collector looks at its data structures. It can't acquire the allocator lock, since arbitrary user startup code may run as part of dlopen().) Under unusual conditions, this may cause unexpected heap growth. 5) The combination of GC_LINUX_THREADS, REDIRECT_MALLOC, and incremental collection is probably not fully reliable, though it now seems to work in simple cases. 6) Thread local storage may not be viewed as part of the root set by the collector. This probably depends on the linuxthreads version. For the time being, any collectable memory referenced by thread local storage should also be referenced from elsewhere, or be allocated as uncollectable. (This is really a bug that should be fixed somehow. The current GC version probably gets things right if there are not too many tls locations and if dlopen is not used.) M68K LINUX: (From Richard Zidlicky) The bad news is that it can crash every linux-m68k kernel on a 68040, so an additional test is needed somewhere on startup. I have meanwhile patches to correct the problem in 68040 buserror handler but it is not yet in any standard kernel. Here is a simple test program to detect whether the kernel has the problem. It could be run as a separate check in configure or tested upon startup. If it fails (return !0) than mprotect can't be used on that system. /* * test for bug that may crash 68040 based Linux */ #include #include #include #include #include char *membase; int pagesize=4096; int pageshift=12; int x_taken=0; int sighandler(int sig) { mprotect(membase,pagesize,PROT_READ|PROT_WRITE); x_taken=1; } main() { long l; signal(SIGSEGV,sighandler); l=(long)mmap(NULL,pagesize,PROT_READ,MAP_PRIVATE | MAP_ANON,-1,0); if (l==-1) { perror("mmap/malloc"); abort(); } membase=(char*)l; *(long*)(membase+sizeof(long))=123456789; if (*(long*)(membase+sizeof(long)) != 123456789 ) { fprintf(stderr,"writeback failed !\n"); exit(1); } if (!x_taken) { fprintf(stderr,"exception not taken !\n"); exit(1); } fprintf(stderr,"vmtest Ok\n"); exit(0); } synopsis-0.12/src/Synopsis/gc/doc/leak.html0000664000076400007640000002046511104702320020232 0ustar stefanstefan Using the Garbage Collector as Leak Detector

Using the Garbage Collector as Leak Detector

The garbage collector may be used as a leak detector. In this case, the primary function of the collector is to report objects that were allocated (typically with GC_MALLOC), not deallocated (normally with GC_FREE), but are no longer accessible. Since the object is no longer accessible, there in normally no way to deallocate the object at a later time; thus it can safely be assumed that the object has been "leaked".

This is substantially different from counting leak detectors, which simply verify that all allocated objects are eventually deallocated. A garbage-collector based leak detector can provide somewhat more precise information when an object was leaked. More importantly, it does not report objects that are never deallocated because they are part of "permanent" data structures. Thus it does not require all objects to be deallocated at process exit time, a potentially useless activity that often triggers large amounts of paging.

All non-ancient versions of the garbage collector provide leak detection support. Version 5.3 adds the following features:

  1. Leak detection mode can be initiated at run-time by setting GC_find_leak instead of building the collector with FIND_LEAK defined. This variable should be set to a nonzero value at program startup.
  2. Leaked objects should be reported and then correctly garbage collected. Prior versions either reported leaks or functioned as a garbage collector.
For the rest of this description we will give instructions that work with any reasonable version of the collector.

To use the collector as a leak detector, follow the following steps:

  1. Build the collector with -DFIND_LEAK. Otherwise use default build options.
  2. Change the program so that all allocation and deallocation goes through the garbage collector.
  3. Arrange to call GC_gcollect at appropriate points to check for leaks. (For sufficiently long running programs, this will happen implicitly, but probably not with sufficient frequency.)
The second step can usually be accomplished with the -DREDIRECT_MALLOC=GC_malloc option when the collector is built, or by defining malloc, calloc, realloc and free to call the corresponding garbage collector functions. But this, by itself, will not yield very informative diagnostics, since the collector does not keep track of information about how objects were allocated. The error reports will include only object addresses.

For more precise error reports, as much of the program as possible should use the all uppercase variants of these functions, after defining GC_DEBUG, and then including gc.h. In this environment GC_MALLOC is a macro which causes at least the file name and line number at the allocation point to be saved as part of the object. Leak reports will then also include this information.

Many collector features (e.g stubborn objects, finalization, and disappearing links) are less useful in this context, and are not fully supported. Their use will usually generate additional bogus leak reports, since the collector itself drops some associated objects.

The same is generally true of thread support. However, as of 6.0alpha4, correct leak reports should be generated with linuxthreads.

On a few platforms (currently Solaris/SPARC, Irix, and, with -DSAVE_CALL_CHAIN, Linux/X86), GC_MALLOC also causes some more information about its call stack to be saved in the object. Such information is reproduced in the error reports in very non-symbolic form, but it can be very useful with the aid of a debugger.

An Example

The following header file leak_detector.h is included in the "include" subdirectory of the distribution:
#define GC_DEBUG
#include "gc.h"
#define malloc(n) GC_MALLOC(n)
#define calloc(m,n) GC_MALLOC((m)*(n))
#define free(p) GC_FREE(p)
#define realloc(p,n) GC_REALLOC((p),(n))
#define CHECK_LEAKS() GC_gcollect()

Assume the collector has been built with -DFIND_LEAK. (For very new versions of the collector, we could instead add the statement GC_find_leak = 1 as the first statement in main.

The program to be tested for leaks can then look like:

#include "leak_detector.h"

main() {
    int *p[10];
    int i;
    /* GC_find_leak = 1; for new collector versions not 	*/
    /* compiled with -DFIND_LEAK.				*/
    for (i = 0; i < 10; ++i) {
	p[i] = malloc(sizeof(int)+i);
    }
    for (i = 1; i < 10; ++i) {
	free(p[i]);
    }
    for (i = 0; i < 9; ++i) {
	p[i] = malloc(sizeof(int)+i);
    }
    CHECK_LEAKS();
}	

On an Intel X86 Linux system this produces on the stderr stream:

Leaked composite object at 0x806dff0 (leak_test.c:8, sz=4)
(On most unmentioned operating systems, the output is similar to this. If the collector had been built on Linux/X86 with -DSAVE_CALL_CHAIN, the output would be closer to the Solaris example. For this to work, the program should not be compiled with -fomit_frame_pointer.)

On Irix it reports

Leaked composite object at 0x10040fe0 (leak_test.c:8, sz=4)
        Caller at allocation:
                ##PC##= 0x10004910
and on Solaris the error report is
Leaked composite object at 0xef621fc8 (leak_test.c:8, sz=4)
        Call chain at allocation:
                args: 4 (0x4), 200656 (0x30FD0)
                ##PC##= 0x14ADC
                args: 1 (0x1), -268436012 (0xEFFFFDD4)
                ##PC##= 0x14A64
In the latter two cases some additional information is given about how malloc was called when the leaked object was allocated. For Solaris, the first line specifies the arguments to GC_debug_malloc (the actual allocation routine), The second the program counter inside main, the third the arguments to main, and finally the program counter inside the caller to main (i.e. in the C startup code).

In the Irix case, only the address inside the caller to main is given.

In many cases, a debugger is needed to interpret the additional information. On systems supporting the "adb" debugger, the callprocs script can be used to replace program counter values with symbolic names. As of version 6.1, the collector tries to generate symbolic names for call stacks if it knows how to do so on the platform. This is true on Linux/X86, but not on most other platforms.

Simplified leak detection under Linux

Since version 6.1, it should be possible to run the collector in leak detection mode on a program a.out under Linux/X86 as follows:
  1. Ensure that a.out is a single-threaded executable, or you are using a very recent (7.0alpha7+) collector version on Linux. On most platforms this does not work at all for multithreaded programs.
  2. If possible, ensure that the addr2line program is installed in /usr/bin. (It comes with RedHat Linux.)
  3. If possible, compile a.out with full debug information. This will improve the quality of the leak reports. With this approach, it is no longer necessary to call GC_ routines explicitly, though that can also improve the quality of the leak reports.
  4. Build the collector and install it in directory foo as follows:
    • configure --prefix=foo --enable-full-debug --enable-redirect-malloc --disable-threads
    • make
    • make install
    With a very recent collector on Linux, it may be safe to omit the --disable-threads.
  5. Set environment variables as follows:
    • LD_PRELOAD=foo/lib/libgc.so
    • GC_FIND_LEAK
    • You may also want to set GC_PRINT_STATS (to confirm that the collector is running) and/or GC_LOOP_ON_ABORT (to facilitate debugging from another window if something goes wrong).
    Simply run a.out as you normally would. Note that if you run anything else (e.g. your editor) with those environment variables set, it will also be leak tested. This may or may not be useful and/or embarrassing. It can generate mountains of leak reports if the application wasn't designed to avoid leaks, e.g. because it's always short-lived.
This has not yet been thoroughly tested on large applications, but it's known to do the right thing on at least some small ones. synopsis-0.12/src/Synopsis/gc/doc/tree.html0000664000076400007640000002501611104702320020252 0ustar stefanstefan Two-Level Tree Structure for Fast Pointer Lookup Hans-J. Boehm, Silicon Graphics (now at HP)

Two-Level Tree Structure for Fast Pointer Lookup

The conservative garbage collector described here uses a 2-level tree data structure to aid in fast pointer identification. This data structure is described in a bit more detail here, since

  1. Variations of the data structure are more generally useful.
  2. It appears to be hard to understand by reading the code.
  3. Some other collectors appear to use inferior data structures to solve the same problem.
  4. It is central to fast collector operation.
A candidate pointer is divided into three sections, the high, middle, and low bits. The exact division between these three groups of bits is dependent on the detailed collector configuration.

The high and middle bits are used to look up an entry in the table described here. The resulting table entry consists of either a block descriptor (struct hblkhdr * or hdr *) identifying the layout of objects in the block, or an indication that this address range corresponds to the middle of a large block, together with a hint for locating the actual block descriptor. Such a hint consist of a displacement that can be subtracted from the middle bits of the candidate pointer without leaving the object.

In either case, the block descriptor (struct hblkhdr) refers to a table of object starting addresses (the hb_map field). The starting address table is indexed by the low bits if the candidate pointer. The resulting entry contains a displacement to the beginning of the object, or an indication that this cannot be a valid object pointer. (If all interior pointer are recognized, pointers into large objects are handled specially, as appropriate.)

The Tree

The rest of this discussion focuses on the two level data structure used to map the high and middle bits to the block descriptor.

The high bits are used as an index into the GC_top_index (really GC_arrays._top_index) array. Each entry points to a bottom_index data structure. This structure in turn consists mostly of an array index indexed by the middle bits of the candidate pointer. The index array contains the actual hdr pointers.

Thus a pointer lookup consists primarily of a handful of memory references, and can be quite fast:

  1. The appropriate bottom_index pointer is looked up in GC_top_index, based on the high bits of the candidate pointer.
  2. The appropriate hdr pointer is looked up in the bottom_index structure, based on the middle bits.
  3. The block layout map pointer is retrieved from the hdr structure. (This memory reference is necessary since we try to share block layout maps.)
  4. The displacement to the beginning of the object is retrieved from the above map.

In order to conserve space, not all GC_top_index entries in fact point to distinct bottom_index structures. If no address with the corresponding high bits is part of the heap, then the entry points to GC_all_nils, a single bottom_index structure consisting only of NULL hdr pointers.

Bottom_index structures contain slightly more information than just hdr pointers. The asc_link field is used to link all bottom_index structures in ascending order for fast traversal. This list is pointed to be GC_all_bottom_indices. It is maintained with the aid of key field that contains the high bits corresponding to the bottom_index.

64 bit addresses

In the case of 64 bit addresses, this picture is complicated slightly by the fact that one of the index structures would have to be huge to cover the entire address space with a two level tree. We deal with this by turning GC_top_index into a chained hash table, instead of a simple array. This adds a hash_link field to the bottom_index structure.

The "hash function" consists of dropping the high bits. This is cheap to compute, and guarantees that there will be no collisions if the heap is contiguous and not excessively large.

A picture

The following is an ASCII diagram of the data structure. This was contributed by Dave Barrett several years ago.


		Data Structure used by GC_base in gc3.7:
			      21-Apr-94
			 
			


    63                  LOG_TOP_SZ[11]  LOG_BOTTOM_SZ[10]   LOG_HBLKSIZE[13]
   +------------------+----------------+------------------+------------------+
 p:|                  |   TL_HASH(hi)  |                  |   HBLKDISPL(p)   |
   +------------------+----------------+------------------+------------------+
    \-----------------------HBLKPTR(p)-------------------/
    \------------hi-------------------/ 
                      \______ ________/ \________ _______/ \________ _______/
                             V                   V                  V
                             |                   |                  |
           GC_top_index[]    |                   |                  | 
 ---      +--------------+   |                   |                  |  
  ^       |              |   |                   |                  |   
  |       |              |   |                   |                  |   
 TOP      +--------------+<--+                   |                  |      
 _SZ   +-<|      []      | *                     |                  |     
(items)|  +--------------+  if 0 < bi< HBLKSIZE  |                  |    
  |    |  |              | then large object     |                  |    
  |    |  |              | starts at the bi'th   |                  |    
  v    |  |              | HBLK before p.        |             i    |    
 ---   |  +--------------+                       |          (word-  |    
       v                                         |         aligned) |    
   bi= |GET_BI(p){->hash_link}->key==hi          |                  |   
       v                                         |                  |    
       |   (bottom_index)  \ scratch_alloc'd     |                  |    
       |   ( struct  bi )  / by get_index()      |                  |    
 ---   +->+--------------+                       |                  |    
  ^       |              |                       |                  |
  ^       |              |                       |                  |
 BOTTOM   |              |   ha=GET_HDR_ADDR(p)  |                  |
_SZ(items)+--------------+<----------------------+          +-------+
  |   +--<|   index[]    |                                  |         
  |   |   +--------------+                      GC_obj_map: v              
  |   |   |              |              from      / +-+-+-----+-+-+-+-+  --- 
  v   |   |              |              GC_add   < 0| | |     | | | | |   ^  
 ---  |   +--------------+             _map_entry \ +-+-+-----+-+-+-+-+   |  
      |   |   asc_link   |                          +-+-+-----+-+-+-+-+ MAXOBJSZ
      |   +--------------+                      +-->| | |  j  | | | | |  +1   
      |   |     key      |                      |   +-+-+-----+-+-+-+-+   |  
      |   +--------------+                      |   +-+-+-----+-+-+-+-+   | 
      |   |  hash_link   |                      |   | | |     | | | | |   v 
      |   +--------------+                      |   +-+-+-----+-+-+-+-+  ---
      |                                         |   |<--MAX_OFFSET--->|   
      |                                         |         (bytes)
HDR(p)| GC_find_header(p)                       |   |<--MAP_ENTRIES-->| 
      |                           \ from        |    =HBLKSIZE/WORDSZ   
      |    (hdr) (struct hblkhdr) / alloc_hdr() |    (1024 on Alpha)
      +-->+----------------------+              |    (8/16 bits each)
GET_HDR(p)| word   hb_sz (words) |              |          
          +----------------------+              |     
          | struct hblk *hb_next |              |
          +----------------------+              |       
          |mark_proc hb_mark_proc|              |
          +----------------------+              |
          | char * hb_map        |>-------------+
          +----------------------+           
          | ushort hb_obj_kind   |           
          +----------------------+           
          |   hb_last_reclaimed  |           
 ---      +----------------------+                
  ^       |                      |
 MARK_BITS|       hb_marks[]     | *if hdr is free, hb_sz + DISCARD_WORDS
_SZ(words)|                      |  is the size of a heap chunk (struct hblk)
  v       |                      |  of at least MININCR*HBLKSIZE bytes (below),
 ---      +----------------------+  otherwise, size of each object in chunk.

Dynamic data structures above are interleaved throughout the heap in blocks of 
size MININCR * HBLKSIZE bytes as done by gc_scratch_alloc which cannot be
freed; free lists are used (e.g. alloc_hdr).  HBLK's below are collected.

	      (struct hblk)      
 ---      +----------------------+ < HBLKSIZE ---         ---          DISCARD_
  ^       |garbage[DISCARD_WORDS]|   aligned   ^           ^ HDR_BYTES WORDS
  |       |                      |             |           v (bytes)   (words)
  |       +-----hb_body----------+ < WORDSZ    |          ---   ---   
  |       |                      |   aligned   |           ^     ^
  |       |      Object 0        |             |           hb_sz |
  |       |                      |           i |(word-    (words)|
  |       |                      |      (bytes)|aligned)   v     |
  |       + - - - - - - - - - - -+ ---         |          ---    |
  |       |                      |  ^          |           ^     |
  n *     |                      |  j (words)  |          hb_sz BODY_SZ 
 HBLKSIZE |      Object 1        |  v          v           |   (words)
 (bytes)  |                      |---------------          v   MAX_OFFSET
  |       + - - - - - - - - - - -+                        ---  (bytes)
  |       |                      | !All_INTERIOR_PTRS      ^     |
  |       |                      | sets j only for       hb_sz   |
  |       |      Object N        | valid object offsets.   |     |
  v       |                      | All objects WORDSZ      v     v
 ---      +----------------------+ aligned.               ---   ---

DISCARD_WORDS is normally zero.  Indeed the collector has not been tested
with another value in ages.
synopsis-0.12/src/Synopsis/gc/doc/debugging.html0000664000076400007640000003655011104702320021253 0ustar stefanstefan Debugging Garbage Collector Related Problems

Debugging Garbage Collector Related Problems

This page contains some hints on debugging issues specific to the Boehm-Demers-Weiser conservative garbage collector. It applies both to debugging issues in client code that manifest themselves as collector misbehavior, and to debugging the collector itself.

If you suspect a bug in the collector itself, it is strongly recommended that you try the latest collector release, even if it is labelled as "alpha", before proceeding.

Bus Errors and Segmentation Violations

If the fault occurred in GC_find_limit, or with incremental collection enabled, this is probably normal. The collector installs handlers to take care of these. You will not see these unless you are using a debugger. Your debugger should allow you to continue. It's often preferable to tell the debugger to ignore SIGBUS and SIGSEGV ("handle SIGSEGV SIGBUS nostop noprint" in gdb, "ignore SIGSEGV SIGBUS" in most versions of dbx) and set a breakpoint in abort. The collector will call abort if the signal had another cause, and there was not other handler previously installed.

We recommend debugging without incremental collection if possible. (This applies directly to UNIX systems. Debugging with incremental collection under win32 is worse. See README.win32.)

If the application generates an unhandled SIGSEGV or equivalent, it may often be easiest to set the environment variable GC_LOOP_ON_ABORT. On many platforms, this will cause the collector to loop in a handler when the SIGSEGV is encountered (or when the collector aborts for some other reason), and a debugger can then be attached to the looping process. This sidesteps common operating system problems related to incomplete core files for multithreaded applications, etc.

Other Signals

On most platforms, the multithreaded version of the collector needs one or two other signals for internal use by the collector in stopping threads. It is normally wise to tell the debugger to ignore these. On Linux, the collector currently uses SIGPWR and SIGXCPU by default.

Warning Messages About Needing to Allocate Blacklisted Blocks

The garbage collector generates warning messages of the form
Needed to allocate blacklisted block at 0x...
or
Repeated allocation of very large block ...
when it needs to allocate a block at a location that it knows to be referenced by a false pointer. These false pointers can be either permanent (e.g. a static integer variable that never changes) or temporary. In the latter case, the warning is largely spurious, and the block will eventually be reclaimed normally. In the former case, the program will still run correctly, but the block will never be reclaimed. Unless the block is intended to be permanent, the warning indicates a memory leak.
  1. Ignore these warnings while you are using GC_DEBUG. Some of the routines mentioned below don't have debugging equivalents. (Alternatively, write the missing routines and send them to me.)
  2. Replace allocator calls that request large blocks with calls to GC_malloc_ignore_off_page or GC_malloc_atomic_ignore_off_page. You may want to set a breakpoint in GC_default_warn_proc to help you identify such calls. Make sure that a pointer to somewhere near the beginning of the resulting block is maintained in a (preferably volatile) variable as long as the block is needed.
  3. If the large blocks are allocated with realloc, we suggest instead allocating them with something like the following. Note that the realloc size increment should be fairly large (e.g. a factor of 3/2) for this to exhibit reasonable performance. But we all know we should do that anyway.
    void * big_realloc(void *p, size_t new_size)
    {
        size_t old_size = GC_size(p);
        void * result;
     
        if (new_size <= 10000) return(GC_realloc(p, new_size));
        if (new_size <= old_size) return(p);
        result = GC_malloc_ignore_off_page(new_size);
        if (result == 0) return(0);
        memcpy(result,p,old_size);
        GC_free(p);
        return(result);
    }
    
  4. In the unlikely case that even relatively small object (<20KB) allocations are triggering these warnings, then your address space contains lots of "bogus pointers", i.e. values that appear to be pointers but aren't. Usually this can be solved by using GC_malloc_atomic or the routines in gc_typed.h to allocate large pointer-free regions of bitmaps, etc. Sometimes the problem can be solved with trivial changes of encoding in certain values. It is possible, to identify the source of the bogus pointers by building the collector with -DPRINT_BLACK_LIST, which will cause it to print the "bogus pointers", along with their location.
  5. If you get only a fixed number of these warnings, you are probably only introducing a bounded leak by ignoring them. If the data structures being allocated are intended to be permanent, then it is also safe to ignore them. The warnings can be turned off by calling GC_set_warn_proc with a procedure that ignores these warnings (e.g. by doing absolutely nothing).

The Collector References a Bad Address in GC_malloc

This typically happens while the collector is trying to remove an entry from its free list, and the free list pointer is bad because the free list link in the last allocated object was bad.

With > 99% probability, you wrote past the end of an allocated object. Try setting GC_DEBUG before including gc.h and allocating with GC_MALLOC. This will try to detect such overwrite errors.

Unexpectedly Large Heap

Unexpected heap growth can be due to one of the following:
  1. Data structures that are being unintentionally retained. This is commonly caused by data structures that are no longer being used, but were not cleared, or by caches growing without bounds.
  2. Pointer misidentification. The garbage collector is interpreting integers or other data as pointers and retaining the "referenced" objects. A common symptom is that GC_dump() shows much of the heap as black-listed.
  3. Heap fragmentation. This should never result in unbounded growth, but it may account for larger heaps. This is most commonly caused by allocation of large objects. On some platforms it can be reduced by building with -DUSE_MUNMAP, which will cause the collector to unmap memory corresponding to pages that have not been recently used.
  4. Per object overhead. This is usually a relatively minor effect, but it may be worth considering. If the collector recognizes interior pointers, object sizes are increased, so that one-past-the-end pointers are correctly recognized. The collector can be configured not to do this (-DDONT_ADD_BYTE_AT_END).

    The collector rounds up object sizes so the result fits well into the chunk size (HBLKSIZE, normally 4K on 32 bit machines, 8K on 64 bit machines) used by the collector. Thus it may be worth avoiding objects of size 2K + 1 (or 2K if a byte is being added at the end.)

The last two cases can often be identified by looking at the output of a call to GC_dump(). Among other things, it will print the list of free heap blocks, and a very brief description of all chunks in the heap, the object sizes they correspond to, and how many live objects were found in the chunk at the last collection.

Growing data structures can usually be identified by

  1. Building the collector with -DKEEP_BACK_PTRS,
  2. Preferably using debugging allocation (defining GC_DEBUG before including gc.h and allocating with GC_MALLOC), so that objects will be identified by their allocation site,
  3. Running the application long enough so that most of the heap is composed of "leaked" memory, and
  4. Then calling GC_generate_random_backtrace() from backptr.h a few times to determine why some randomly sampled objects in the heap are being retained.

The same technique can often be used to identify problems with false pointers, by noting whether the reference chains printed by GC_generate_random_backtrace() involve any misidentified pointers. An alternate technique is to build the collector with -DPRINT_BLACK_LIST which will cause it to report values that are almost, but not quite, look like heap pointers. It is very likely that actual false pointers will come from similar sources.

In the unlikely case that false pointers are an issue, it can usually be resolved using one or more of the following techniques:

  1. Use GC_malloc_atomic for objects containing no pointers. This is especially important for large arrays containing compressed data, pseudo-random numbers, and the like. It is also likely to improve GC performance, perhaps drastically so if the application is paging.
  2. If you allocate large objects containing only one or two pointers at the beginning, either try the typed allocation primitives is gc_typed.h, or separate out the pointerfree component.
  3. Consider using GC_malloc_ignore_off_page() to allocate large objects. (See gc.h and above for details. Large means > 100K in most environments.)
  4. If your heap size is larger than 100MB or so, build the collector with -DLARGE_CONFIG. This allows the collector to keep more precise black-list information.
  5. If you are using heaps close to, or larger than, a gigabyte on a 32-bit machine, you may want to consider moving to a platform with 64-bit pointers. This is very likely to resolve any false pointer issues.

Prematurely Reclaimed Objects

The usual symptom of this is a segmentation fault, or an obviously overwritten value in a heap object. This should, of course, be impossible. In practice, it may happen for reasons like the following:
  1. The collector did not intercept the creation of threads correctly in a multithreaded application, e.g. because the client called pthread_create without including gc.h, which redefines it.
  2. The last pointer to an object in the garbage collected heap was stored somewhere were the collector couldn't see it, e.g. in an object allocated with system malloc, in certain types of mmaped files, or in some data structure visible only to the OS. (On some platforms, thread-local storage is one of these.)
  3. The last pointer to an object was somehow disguised, e.g. by XORing it with another pointer.
  4. Incorrect use of GC_malloc_atomic or typed allocation.
  5. An incorrect GC_free call.
  6. The client program overwrote an internal garbage collector data structure.
  7. A garbage collector bug.
  8. (Empirically less likely than any of the above.) A compiler optimization that disguised the last pointer.
The following relatively simple techniques should be tried first to narrow down the problem:
  1. If you are using the incremental collector try turning it off for debugging.
  2. If you are using shared libraries, try linking statically. If that works, ensure that DYNAMIC_LOADING is defined on your platform.
  3. Try to reproduce the problem with fully debuggable unoptimized code. This will eliminate the last possibility, as well as making debugging easier.
  4. Try replacing any suspect typed allocation and GC_malloc_atomic calls with calls to GC_malloc.
  5. Try removing any GC_free calls (e.g. with a suitable #define).
  6. Rebuild the collector with -DGC_ASSERTIONS.
  7. If the following works on your platform (i.e. if gctest still works if you do this), try building the collector with -DREDIRECT_MALLOC=GC_malloc_uncollectable. This will cause the collector to scan memory allocated with malloc.
If all else fails, you will have to attack this with a debugger. Suggested steps:
  1. Call GC_dump() from the debugger around the time of the failure. Verify that the collectors idea of the root set (i.e. static data regions which it should scan for pointers) looks plausible. If not, i.e. if it doesn't include some static variables, report this as a collector bug. Be sure to describe your platform precisely, since this sort of problem is nearly always very platform dependent.
  2. Especially if the failure is not deterministic, try to isolate it to a relatively small test case.
  3. Set a break point in GC_finish_collection. This is a good point to examine what has been marked, i.e. found reachable, by the collector.
  4. If the failure is deterministic, run the process up to the last collection before the failure. Note that the variable GC_gc_no counts collections and can be used to set a conditional breakpoint in the right one. It is incremented just before the call to GC_finish_collection. If object p was prematurely recycled, it may be helpful to look at *GC_find_header(p) at the failure point. The hb_last_reclaimed field will identify the collection number during which its block was last swept.
  5. Verify that the offending object still has its correct contents at this point. Then call GC_is_marked(p) from the debugger to verify that the object has not been marked, and is about to be reclaimed. Note that GC_is_marked(p) expects the real address of an object (the address of the debug header if there is one), and thus it may be more appropriate to call GC_is_marked(GC_base(p)) instead.
  6. Determine a path from a root, i.e. static variable, stack, or register variable, to the reclaimed object. Call GC_is_marked(q) for each object q along the path, trying to locate the first unmarked object, say r.
  7. If r is pointed to by a static root, verify that the location pointing to it is part of the root set printed by GC_dump(). If it is on the stack in the main (or only) thread, verify that GC_stackbottom is set correctly to the base of the stack. If it is in another thread stack, check the collector's thread data structure (GC_thread[] on several platforms) to make sure that stack bounds are set correctly.
  8. If r is pointed to by heap object s, check that the collector's layout description for s is such that the pointer field will be scanned. Call *GC_find_header(s) to look at the descriptor for the heap chunk. The hb_descr field specifies the layout of objects in that chunk. See gc_mark.h for the meaning of the descriptor. (If it's low order 2 bits are zero, then it is just the length of the object prefix to be scanned. This form is always used for objects allocated with GC_malloc or GC_malloc_atomic.)
  9. If the failure is not deterministic, you may still be able to apply some of the above technique at the point of failure. But remember that objects allocated since the last collection will not have been marked, even if the collector is functioning properly. On some platforms, the collector can be configured to save call chains in objects for debugging. Enabling this feature will also cause it to save the call stack at the point of the last GC in GC_arrays._last_stack.
  10. When looking at GC internal data structures remember that a number of GC_xxx variables are really macro defined to GC_arrays._xxx, so that the collector can avoid scanning them.
synopsis-0.12/src/Synopsis/gc/doc/README.contributors0000664000076400007640000000614211104702320022040 0ustar stefanstefanThis is an attempt to acknowledge early contributions to the garbage collector. Later contributions should instead be mentioned in README.changes. HISTORY - Early versions of this collector were developed as a part of research projects supported in part by the National Science Foundation and the Defense Advance Research Projects Agency. The garbage collector originated as part of the run-time system for the Russell programming language implementation. The first version of the garbage collector was written primarily by Al Demers. It was then refined and mostly rewritten, primarily by Hans-J. Boehm, at Cornell U., the University of Washington, Rice University (where it was first used for C and assembly code), Xerox PARC, SGI, and HP Labs. However, significant contributions have also been made by many others. Some other contributors: More recent contributors are mentioned in the modification history in README.changes. My apologies for any omissions. The SPARC specific code was originally contributed by Mark Weiser. The Encore Multimax modifications were supplied by Kevin Kenny (kenny@m.cs.uiuc.edu). The adaptation to the IBM PC/RT is largely due to Vernon Lee, on machines made available to Rice by IBM. Much of the HP specific code and a number of good suggestions for improving the generic code are due to Walter Underwood. Robert Brazile (brazile@diamond.bbn.com) originally supplied the ULTRIX code. Al Dosser (dosser@src.dec.com) and Regis Cridlig (Regis.Cridlig@cl.cam.ac.uk) subsequently provided updates and information on variation between ULTRIX systems. Parag Patel (parag@netcom.com) supplied the A/UX code. Jesper Peterson(jep@mtiame.mtia.oz.au), Michel Schinz, and Martin Tauchmann (martintauchmann@bigfoot.com) supplied the Amiga port. Thomas Funke (thf@zelator.in-berlin.de(?)) and Brian D.Carlstrom (bdc@clark.lcs.mit.edu) supplied the NeXT ports. Douglas Steel (doug@wg.icl.co.uk) provided ICL DRS6000 code. Bill Janssen (janssen@parc.xerox.com) supplied the SunOS dynamic loader specific code. Manuel Serrano (serrano@cornas.inria.fr) supplied linux and Sony News specific code. Al Dosser provided Alpha/OSF/1 code. He and Dave Detlefs(detlefs@src.dec.com) also provided several generic bug fixes. Alistair G. Crooks(agc@uts.amdahl.com) supplied the NetBSD and 386BSD ports. Jeffrey Hsu (hsu@soda.berkeley.edu) provided the FreeBSD port. Brent Benson (brent@jade.ssd.csd.harris.com) ported the collector to a Motorola 88K processor running CX/UX (Harris NightHawk). Ari Huttunen (Ari.Huttunen@hut.fi) generalized the OS/2 port to nonIBM development environments (a nontrivial task). Patrick Beard (beard@cs.ucdavis.edu) provided the initial MacOS port. David Chase, then at Olivetti Research, suggested several improvements. Scott Schwartz (schwartz@groucho.cse.psu.edu) supplied some of the code to save and print call stacks for leak detection on a SPARC. Jesse Hull and John Ellis supplied the C++ interface code. Zhong Shao performed much of the experimentation that led to the current typed allocation facility. (His dynamic type inference code hasn't made it into the released version of the collector, yet.) synopsis-0.12/src/Synopsis/gc/doc/README.sgi0000664000076400007640000000346311104702320020070 0ustar stefanstefanPerformance of the incremental collector can be greatly enhanced with -DNO_EXECUTE_PERMISSION. The collector should run with all of the -32, -n32 and -64 ABIs. Remember to define the AS macro in the Makefile to be "as -64", or "as -n32". If you use -DREDIRECT_MALLOC=GC_malloc with C++ code, your code should make at least one explicit call to malloc instead of new to ensure that the proper version of malloc is linked in. Sproc threads are not supported in this version, though there may exist other ports. Pthreads support is provided. This requires that: 1) You compile the collector with -DGC_IRIX_THREADS specified in the Makefile. 2) You have the latest pthreads patches installed. (Though the collector makes only documented pthread calls, it relies on signal/threads interactions working just right in ways that are not required by the standard. It is unlikely that this code will run on other pthreads platforms. But please tell me if it does.) 3) Every file that makes thread calls should define IRIX_THREADS and then include gc.h. Gc.h redefines some of the pthread primitives as macros which also provide the collector with information it requires. 4) pthread_cond_wait and pthread_cond_timed_wait should be prepared for premature wakeups. (I believe the pthreads and realted standards require this anyway. Irix pthreads often terminate a wait if a signal arrives. The garbage collector uses signals to stop threads.) 5) It is expensive to stop a thread waiting in IO at the time the request is initiated. Applications with many such threads may not exhibit acceptable performance with the collector. (Increasing the heap size may help.) 6) The collector should not be compiled with -DREDIRECT_MALLOC. This confuses some library calls made by the pthreads implementation, which expect the standard malloc. synopsis-0.12/src/Synopsis/gc/doc/README.environment0000664000076400007640000001475711104702320021662 0ustar stefanstefanThe garbage collector looks at a number of environment variables which are then used to affect its operation. These are examined only on Un*x-like platforms and win32. GC_INITIAL_HEAP_SIZE= - Initial heap size in bytes. May speed up process start-up. GC_MAXIMUM_HEAP_SIZE= - Maximum collected heap size. GC_LOOP_ON_ABORT - Causes the collector abort routine to enter a tight loop. This may make it easier to debug, such a process, especially for multithreaded platforms that don't produce usable core files, or if a core file would be too large. On some platforms, this also causes SIGSEGV to be caught and result in an infinite loop in a handler, allowing similar debugging techniques. GC_PRINT_STATS - Turn on GC logging. Not functional with -DSMALL_CONFIG. GC_LOG_FILE - The name of the log file. Stderr by default. GC_PRINT_VERBOSE_STATS - Turn on even more logging. GC_DUMP_REGULARLY - Generate a GC debugging dump GC_dump() on startup and during every collection. Very verbose. Useful if you have a bug to report, but please include only the last complete dump. GC_BACKTRACES= - Generate n random backtraces (for heap profiling) after each GC. Collector must have been built with KEEP_BACK_PTRS. This won't generate useful output unless most objects in the heap were allocated through debug allocators. This is intended to be only a statistical sample; individual traces may be erroneous due to concurrent heap mutation. GC_PRINT_ADDRESS_MAP - Linux only. Dump /proc/self/maps, i.e. various address maps for the process, to stderr on every GC. Useful for mapping root addresses to source for deciphering leak reports. GC_NPROCS= - Linux w/threads only. Explicitly sets the number of processors that the GC should expect to use. Note that setting this to 1 when multiple processors are available will preserve correctness, but may lead to really horrible performance, since the lock implementation will immediately yield without first spinning. GC_MARKERS= - Linux w/threads and parallel marker only. Set the number of marker threads. This is normally set to the number of processors. It is safer to adjust GC_MARKERS than GC_NPROCS, since GC_MARKERS has no impact on the lock implementation. GC_NO_BLACKLIST_WARNING - Prevents the collector from issuing warnings about allocations of very large blocks. Deprecated. Use GC_LARGE_ALLOC_WARN_INTERVAL instead. GC_LARGE_ALLOC_WARN_INTERVAL= - Print every nth warning about very large block allocations, starting with the nth one. Small values of n are generally benign, in that a bounded number of such warnings generally indicate at most a bounded leak. For best results it should be set at 1 during testing. Default is 5. Very large numbers effectively disable the warning. GC_IGNORE_GCJ_INFO - Ignore the type descriptors implicitly supplied by GC_gcj_malloc and friends. This is useful for debugging descriptor generation problems, and possibly for temporarily working around such problems. It forces a fully conservative scan of all heap objects except those known to be pointerfree, and may thus have other adverse effects. GC_PRINT_BACK_HEIGHT - Print max length of chain through unreachable objects ending in a reachable one. If this number remains bounded, then the program is "GC robust". This ensures that a fixed number of misidentified pointers can only result in a bounded space leak. This currently only works if debugging allocation is used throughout. It increases GC space and time requirements appreciably. This feature is still somewhat experimental, and requires that the collector have been built with MAKE_BACK_GRAPH defined. For details, see Boehm, "Bounding Space Usage of Conservative Garbage Collectors", POPL 2001, or http://lib.hpl.hp.com/techpubs/2001/HPL-2001-251.html . GC_RETRY_SIGNALS, GC_NO_RETRY_SIGNALS - Try to compensate for lost thread suspend signals in linux_threads.c. On by default for GC_OSF1_THREADS, off otherwise. Note that this does not work around a possible loss of thread restart signals. This seems to be necessary for some versions of Tru64. Since we've previously seen similar issues on some other operating systems, it was turned into a runtime flag to enable last-minute work-arounds. The following turn on runtime flags that are also program settable. Checked only during initialization. We expect that they will usually be set through other means, but this may help with debugging and testing: GC_ENABLE_INCREMENTAL - Turn on incremental collection at startup. Note that, depending on platform and collector configuration, this may involve write protecting pieces of the heap to track modifications. These pieces may include pointerfree objects or not. Although this is intended to be transparent, it may cause unintended system call failures. Use with caution. GC_PAUSE_TIME_TARGET - Set the desired garbage collector pause time in msecs. This only has an effect if incremental collection is enabled. If a collection requires appreciably more time than this, the client will be restarted, and the collector will need to do additional work to compensate. The special value "999999" indicates that pause time is unlimited, and the incremental collector will behave completely like a simple generational collector. If the collector is configured for parallel marking, and run on a multiprocessor, incremental collection should only be used with unlimited pause time. GC_FIND_LEAK - Turns on GC_find_leak and thus leak detection. Forces a collection at program termination to detect leaks that would otherwise occur after the last GC. GC_ALL_INTERIOR_POINTERS - Turns on GC_all_interior_pointers and thus interior pointer recognition. GC_DONT_GC - Turns off garbage collection. Use cautiously. GC_TRACE=addr - Intended for collector debugging. Requires that the collector have been built with ENABLE_TRACE defined. Causes the debugger to log information about the tracing of address ranges containing addr. Typically addr is the address that contains a pointer to an object that mysteriously failed to get marked. Addr must be specified as a hexadecimal integer. synopsis-0.12/src/Synopsis/gc/doc/simple_example.html0000664000076400007640000001637411104702320022326 0ustar stefanstefan Using the Garbage Collector: A simple example

Using the Garbage Collector: A simple example

The following consists of step-by-step instructions for building and using the collector. We'll assume a Linux/gcc platform and a single-threaded application. The green text contains information about other platforms or scenarios. It can be skipped, especially on first reading.

Building the collector

If you haven't already so, unpack the collector and enter the newly created directory with
tar xvfz gc.tar.gz
cd gc

You can configure, build, and install the collector in a private directory, say /home/xyz/gc, with the following commands:

./configure --prefix=/home/xyz/gc --disable-threads
make
make check
make install
Here the "make check" command is optional, but highly recommended. It runs a basic correctness test which usually takes well under a minute.

Other platforms

On non-Unix, non-Linux platforms, the collector is usually built by copying the appropriate makefile (see the platform-specific README in doc/README.xxx in the distribution) to the file "Makefile" (overwriting the copy of Makefile.direct that was originally there), and then typing "make" (or "nmake" or ...). This builds the library in the source tree. You may want to move it and the files in the include directory to a more convenient place.

If you use a makefile that does not require running a configure script, you should first look at the makefile, and adjust any options that are documented there.

If your platform provides a "make" utility, that is generally preferred to platform- and compiler- dependent "project" files. (At least that is the strong preference of the would-be maintainer of those project files.)

Threads

If you need thread support, configure the collector with
--enable-threads=posix --enable-thread-local-alloc --enable-parallel-mark
instead of --disable-threads If your target is a real old-fashioned uniprocessor (no "hyperthreading", etc.) you will want to omit --enable-parallel-mark.

C++

You will need to include the C++ support, which unfortunately tends to be among the least portable parts of the collector, since it seems to rely on some corner cases of the language. On Linux, it suffices to add --enable-cplusplus to the configure options.

Writing the program

You will need a
#include "gc.h"
at the beginning of every file that allocates memory through the garbage collector. Call GC_MALLOC wherever you would have call malloc. This initializes memory to zero like calloc; there is no need to explicitly clear the result.

If you know that an object will not contain pointers to the garbage-collected heap, and you don't need it to be initialized, call GC_MALLOC_ATOMIC instead.

A function GC_FREE is provided but need not be called. For very small objects, your program will probably perform better if you do not call it, and let the collector do its job.

A GC_REALLOC function behaves like the C library realloc. It allocates uninitialized pointer-free memory if the original object was allocated that way.

The following program loop.c is a trivial example:

#include "gc.h"
#include <assert.h>
#include <stdio.h>

int main()
{
  int i;

  GC_INIT();	/* Optional on Linux/X86; see below.  */
  for (i = 0; i < 10000000; ++i)
   {
     int **p = (int **) GC_MALLOC(sizeof(int *));
     int *q = (int *) GC_MALLOC_ATOMIC(sizeof(int));
     assert(*p == 0);
     *p = (int *) GC_REALLOC(q, 2 * sizeof(int));
     if (i % 100000 == 0)
       printf("Heap size = %d\n", GC_get_heap_size());
   }
  return 0;
}

Interaction with the system malloc

It is usually best not to mix garbage-collected allocation with the system malloc-free. If you do, you need to be careful not to store pointers to the garbage-collected heap in memory allocated with the system malloc.

Other Platforms

On some other platforms it is necessary to call GC_INIT() from the main program, which is presumed to be part of the main executable, not a dynamic library. This can never hurt, and is thus generally good practice.

Threads

For a multithreaded program some more rules apply:
  • Files that either allocate through the GC or make thread-related calls should first define the macro GC_THREADS, and then include "gc.h". On some platforms this will redefine some threads primitives, e.g. to let the collector keep track of thread creation.
  • To take advantage of fast thread-local allocation, use the following instead of including gc.h:
    #define GC_REDIRECT_TO_LOCAL
    #include "gc_local_alloc.h"
    
    This will cause GC_MALLOC and GC_MALLOC_ATOMIC to keep per-thread allocation caches, and greatly reduce the number of lock acquisitions during allocation.

C++

In the case of C++, you need to be especially careful not to store pointers to the garbage-collected heap in areas that are not traced by the collector. The collector includes some alternate interfaces to make that easier.

Debugging

Additional debug checks can be performed by defining GC_DEBUG before including gc.h. Additional options are available if the collector is also built with --enable-full_debug and all allocations are performed with GC_DEBUG defined.

What if I can't rewrite/recompile my program?

You may be able to build the collector with --enable-redirect-malloc and set the LD_PRELOAD environment variable to point to the resulting library, thus replacing the standard malloc with its garbage-collected counterpart. This is rather platform dependent. See the leak detection documentation for some more details.

Compiling and linking

The above application loop.c test program can be compiled and linked with
cc -I/home/xyz/gc/include loop.c /home/xyz/gc/lib/libgc.a -o loop
The -I option directs the compiler to the right include directory. In this case, we list the static library directly on the compile line; the dynamic library could have been used instead, provided we arranged for the dynamic loader to find it, e.g. by setting LD_LIBRARY_PATH.

Threads

On pthread platforms, you will of course also have to link with -lpthread, and compile with any thread-safety options required by your compiler. On some platforms, you may also need to link with -ldl or -lrt. Looking at threadlibs.c in the GC build directory should give you the appropriate list if a plain -lpthread doesn't work.

Running the executable

The executable can of course be run normally, e.g. by typing
./loop
The operation of the collector is affected by a number of environment variables. For example, setting GC_PRINT_STATS produces some GC statistics on stdout. See README.environment in the distribution for details. synopsis-0.12/src/Synopsis/gc/doc/README.DGUX3860000664000076400007640000001355711104702320020323 0ustar stefanstefan Garbage Collector (parallel iversion) for ix86 DG/UX Release R4.20MU07 *READ* the file README.QUICK. You need the GCC-3.0.3 rev (DG/UX) compiler to build this tree. This compiler has the new "dgux386" threads package implemented. It also supports the switch "-pthread" needed to link correctly the DG/UX's -lrte -lthread with -lgcc and the system's -lc. Finally we support parralleli-mark for the SMP DG/UX machines. To build the garbage collector do: ./configure --enable-parallel-mark make make gctest Before you run "gctest" you need to set your LD_LIBRARY_PATH correctly so that "gctest" can find the shared library libgc. Alternatively you can do a configuration ./configure --enable-parallel-mark --disable-shared to build only the static version of libgc. To enable debugging messages please do: 1) Add the "--enable-full-debug" flag during configuration. 2) Edit the file linux-threads.c and uncommnect the line: /* #define DEBUG_THREADS 1 */ to ---> #define DEBUG_THREADS 1 Then give "make" as usual. In a machine with 4 CPUs (my own machine) the option parallel mark (aka --enable-parallel-mark) makes a BIG difference. Takis Psarogiannakopoulos University of Cambridge Centre for Mathematical Sciences Department of Pure Mathematics Wilberforce Road Cambridge CB3 0WB ,UK , January 2002 Note (HB): The integration of this patch is currently not complete. The following patches against 6.1alpha3 where hard to move to alpha4, and are not integrated. There may also be minor problems with stylistic corrections made by me. --- ltconfig.ORIG Mon Jan 28 20:22:18 2002 +++ ltconfig Mon Jan 28 20:44:00 2002 @@ -689,6 +689,11 @@ pic_flag=-Kconform_pic fi ;; + dgux*) + pic_flag='-fPIC' + link_static='-Bstatic' + wl='-Wl,' + ;; *) pic_flag='-fPIC' ;; @@ -718,6 +723,12 @@ # We can build DLLs from non-PIC. ;; + dgux*) + pic_flag='-KPIC' + link_static='-Bstatic' + wl='-Wl,' + ;; + osf3* | osf4* | osf5*) # All OSF/1 code is PIC. wl='-Wl,' @@ -1154,6 +1165,22 @@ fi ;; + dgux*) + ld_shlibs=yes + # For both C/C++ ommit the deplibs. This is because we relying on the fact + # that compilation of execitables will put them in correct order + # in any case and sometimes are wrong when listed as deplibs (or missing some deplibs) + # However when GNU ld and --whole-archive needs to be used we have the problem + # that if the -fPIC *_s.a archive is linked through deplibs list we ommiting crucial + # .lo/.o files from the created shared lib. This I think is not the case here. + archive_cmds='$CC -shared -h $soname -o $lib $libobjs $linkopts' + thread_safe_flag_spec='-pthread' + wlarc= + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ac_cv_archive_cmds_needs_lc=no + ;; + cygwin* | mingw*) # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. @@ -1497,7 +1524,7 @@ ;; dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + archive_cmds='$CC -shared -h $soname -o $lib $libobjs $linkopts' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; @@ -2092,12 +2119,17 @@ ;; dgux*) - version_type=linux + version_type=dgux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='$libname.so$versuffix' + soname_spec='$libname.so$versuffix' shlibpath_var=LD_LIBRARY_PATH + thread_safe_flag_spec='-pthread' + wlarc= + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ac_cv_archive_cmds_needs_lc=no ;; sysv4*MP*) --- ltmain.sh.ORIG Mon Jan 28 20:31:18 2002 +++ ltmain.sh Tue Jan 29 00:11:29 2002 @@ -1072,11 +1072,38 @@ esac ;; + -thread*) + # DG/UX GCC 2.95.x, 3.x.x rev (DG/UX) links -lthread + # with the switch -threads + if test "$arg" = "-threads"; then + case "$host" in + i[3456]86-*-dgux*) + deplibs="$deplibs $arg" + continue + ;; + esac + fi + ;; + + -pthread*) + # DG/UX GCC 2.95.x, 3.x.x rev (DG/UX) links -lthread + # with the switch -pthread + if test "$arg" = "-pthread"; then + case "$host" in + i[3456]86-*-dgux*) + deplibs="$deplibs $arg" + continue + ;; + esac + fi + ;; + -l*) if test "$arg" = "-lc"; then case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) + *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* | i[3456]86-*-dgux*) # These systems don't actually have c library (as such) + # It is wrong in DG/UX to add -lc when creating shared/dynamic objs/libs continue ;; esac @@ -1248,6 +1275,12 @@ temp_deplibs= for deplib in $dependency_libs; do case "$deplib" in + -thread*) + temp_deplibs="$temp_deplibs $deplib" + ;; + -pthread) + temp_deplibs="$temp_deplibs $deplib" + ;; -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'` case " $rpath $xrpath " in *" $temp_xrpath "*) ;; @@ -1709,6 +1742,13 @@ done ;; + dgux) + # Leave mostly blank for DG/UX + major= + versuffix=".$current.$revision"; + verstring= + ;; + linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" @@ -1792,8 +1832,9 @@ dependency_libs="$deplibs" case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) + *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* | i[3456]86-*-dgux*) # these systems don't actually have a c library (as such)! + # It is wrong in DG/UX to add -lc when creating shared/dynamic objs/libs ;; *) # Add libc to deplibs on all other systems. synopsis-0.12/src/Synopsis/gc/doc/README.win640000664000076400007640000000150411104702320020247 0ustar stefanstefan64-bit Windows on AMD64/Intel EM64T is somewhat supported in the 7.0 release. A collector can be built with Microsoft Visual C++ 2005. The resulting test programs have been known to work at least once. More testing would clearly be helpful. Currently only NT_X64_STATIC_THREADS_MAKEFILE has been used in this environment. Copy this file to MAKEFILE, and then type "nmake" in a Visual C++ command line window to build the static library and the usual test programs. To verify that the colllector is at least somewhat functional, run gctest.exe. This should create gctest.exe.log after a few seconds. This process is completely analogous to NT_STATIC_THREADS_MAKEFILE for the 32-bit version. Note that currently a few warnings are still generated by default, and a number of others have been explicitly turned off in the makefile. synopsis-0.12/src/Synopsis/gc/doc/overview.html0000664000076400007640000005404411104702320021164 0ustar stefanstefan A garbage collector for C and C++
Interface Overview Tutorial Slides FAQ Example Download License

A garbage collector for C and C++

[ This is an updated version of the page formerly at http://reality.sgi.com/boehm/gc.html and before that at ftp://parcftp.xerox.com/pub/gc/gc.html.]

The Boehm-Demers-Weiser conservative garbage collector can be used as a garbage collecting replacement for C malloc or C++ new. It allows you to allocate memory basically as you normally would, without explicitly deallocating memory that is no longer useful. The collector automatically recycles memory when it determines that it can no longer be otherwise accessed. A simple example of such a use is given here.

The collector is also used by a number of programming language implementations that either use C as intermediate code, want to facilitate easier interoperation with C libraries, or just prefer the simple collector interface. For a more detailed description of the interface, see here.

Alternatively, the garbage collector may be used as a leak detector for C or C++ programs, though that is not its primary goal.

Typically several versions will be available. Usually you should first try to use gc_source/gc.tar.gz, which is normally an older, more stable version.

If that fails, try the latest explicitly numbered version in gc_source/. Later versions may contain additional features, platform support, or bug fixes, but are likely to be less well tested. Note that versions containing the letters alpha are even less well tested than others, especially on non-HP platforms.

A slightly older version of the garbage collector is now also included as part of the GNU compiler distribution. The source code for that version is available for browsing here.

The arguments for and against conservative garbage collection in C and C++ are briefly discussed in issues.html. The beginnings of a frequently-asked-questions list are here.

The garbage collector code is copyrighted by Hans-J. Boehm, Alan J. Demers, Xerox Corporation, Silicon Graphics, and Hewlett-Packard Company. It may be used and copied without payment of a fee under minimal restrictions. See the README file in the distribution or the license for more details. IT IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK.

Empirically, this collector works with most unmodified C programs, simply by replacing malloc with GC_malloc calls, replacing realloc with GC_realloc calls, and removing free calls. Exceptions are discussed in issues.html.

Platforms

The collector is not completely portable, but the distribution includes ports to most standard PC and UNIX/Linux platforms. The collector should work on Linux, *BSD, recent Windows versions, MacOS X, HP/UX, Solaris, Tru64, Irix and a few other operating systems. Some ports are more polished than others.

Irix pthreads, Linux threads, Win32 threads, Solaris threads (old style and pthreads), HP/UX 11 pthreads, Tru64 pthreads, and MacOS X threads are supported in recent versions.

Separately distributed ports

For MacOS 9/Classic use, Patrick Beard's latest port is available from http://homepage.mac.com/pcbeard/gc/. (Unfortunately, that's now quite dated. I'm not in a position to test under MacOS. Although I try to incorporate changes, it is impossible for me to update the project file.)

Precompiled versions of the collector for NetBSD are available here or here.

Debian Linux includes prepackaged versions of the collector.

Scalable multiprocessor versions

Kenjiro Taura, Toshio Endo, and Akinori Yonezawa have made available a parallel collector based on this one. Their collector takes advantage of multiple processors during a collection. Starting with collector version 6.0alpha1 we also do this, though with more modest processor scalability goals. Our approach is discussed briefly in scale.html.

Some Collector Details

The collector uses a mark-sweep algorithm. It provides incremental and generational collection under operating systems which provide the right kind of virtual memory support. (Currently this includes SunOS[45], IRIX, OSF/1, Linux, and Windows, with varying restrictions.) It allows finalization code to be invoked when an object is collected. It can take advantage of type information to locate pointers if such information is provided, but it is usually used without such information. ee the README and gc.h files in the distribution for more details.

For an overview of the implementation, see here.

The garbage collector distribution includes a C string (cord) package that provides for fast concatenation and substring operations on long strings. A simple curses- and win32-based editor that represents the entire file as a cord is included as a sample application.

Performance of the nonincremental collector is typically competitive with malloc/free implementations. Both space and time overhead are likely to be only slightly higher for programs written for malloc/free (see Detlefs, Dosser and Zorn's Memory Allocation Costs in Large C and C++ Programs.) For programs allocating primarily very small objects, the collector may be faster; for programs allocating primarily large objects it will be slower. If the collector is used in a multithreaded environment and configured for thread-local allocation, it may in some cases significantly outperform malloc/free allocation in time.

We also expect that in many cases any additional overhead will be more than compensated for by decreased copying etc. if programs are written and tuned for garbage collection.

Further Reading:

The beginnings of a frequently asked questions list for this collector are here.

The following provide information on garbage collection in general:

Paul Wilson's garbage collection ftp archive and GC survey.

The Ravenbrook Memory Management Reference.

David Chase's GC FAQ.

Richard Jones' GC page and his book.

The following papers describe the collector algorithms we use and the underlying design decisions at a higher level.

(Some of the lower level details can be found here.)

The first one is not available electronically due to copyright considerations. Most of the others are subject to ACM copyright.

Boehm, H., "Dynamic Memory Allocation and Garbage Collection", Computers in Physics 9, 3, May/June 1995, pp. 297-303. This is directed at an otherwise sophisticated audience unfamiliar with memory allocation issues. The algorithmic details differ from those in the implementation. There is a related letter to the editor and a minor correction in the next issue.

Boehm, H., and M. Weiser, "Garbage Collection in an Uncooperative Environment", Software Practice & Experience, September 1988, pp. 807-820.

Boehm, H., A. Demers, and S. Shenker, "Mostly Parallel Garbage Collection", Proceedings of the ACM SIGPLAN '91 Conference on Programming Language Design and Implementation, SIGPLAN Notices 26, 6 (June 1991), pp. 157-164.

Boehm, H., "Space Efficient Conservative Garbage Collection", Proceedings of the ACM SIGPLAN '93 Conference on Programming Language Design and Implementation, SIGPLAN Notices 28, 6 (June 1993), pp. 197-206.

Boehm, H., "Reducing Garbage Collector Cache Misses", Proceedings of the 2000 International Symposium on Memory Management . Official version. Technical report version. Describes the prefetch strategy incorporated into the collector for some platforms. Explains why the sweep phase of a "mark-sweep" collector should not really be a distinct phase.

M. Serrano, H. Boehm, "Understanding Memory Allocation of Scheme Programs", Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming, 2000, Montreal, Canada, pp. 245-256. Official version. Earlier Technical Report version. Includes some discussion of the collector debugging facilities for identifying causes of memory retention.

Boehm, H., "Fast Multiprocessor Memory Allocation and Garbage Collection", HP Labs Technical Report HPL 2000-165. Discusses the parallel collection algorithms, and presents some performance results.

Boehm, H., "Bounding Space Usage of Conservative Garbage Collectors", Proceeedings of the 2002 ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Jan. 2002, pp. 93-100. Official version. Technical report version. Includes a discussion of a collector facility to much more reliably test for the potential of unbounded heap growth.

The following papers discuss language and compiler restrictions necessary to guaranteed safety of conservative garbage collection.

We thank John Levine and JCLT for allowing us to make the second paper available electronically, and providing PostScript for the final version.

Boehm, H., ``Simple Garbage-Collector-Safety'', Proceedings of the ACM SIGPLAN '96 Conference on Programming Language Design and Implementation.

Boehm, H., and D. Chase, ``A Proposal for Garbage-Collector-Safe C Compilation'', Journal of C Language Translation 4, 2 (Decemeber 1992), pp. 126-141.

Other related information:

The Detlefs, Dosser and Zorn's Memory Allocation Costs in Large C and C++ Programs. This is a performance comparison of the Boehm-Demers-Weiser collector to malloc/free, using programs written for malloc/free.

Joel Bartlett's mostly copying conservative garbage collector for C++.

John Ellis and David Detlef's Safe Efficient Garbage Collection for C++ proposal.

Henry Baker's paper collection.

Slides for Hans Boehm's Allocation and GC Myths talk.

Current users:

Known current users of some variant of this collector include:

The runtime system for GCJ, the static GNU java compiler.

W3m, a text-based web browser.

Some versions of the Xerox DocuPrint printer software.

The Mozilla project, as leak detector.

The Mono project, an open source implementation of the .NET development framework.

The DotGNU Portable.NET project, another open source .NET implementation.

The Irssi IRC client.

The Berkeley Titanium project.

The NAGWare f90 Fortran 90 compiler.

Elwood Corporation's Eclipse Common Lisp system, C library, and translator.

The Bigloo Scheme and Camloo ML compilers written by Manuel Serrano and others.

Brent Benson's libscheme.

The MzScheme scheme implementation.

The University of Washington Cecil Implementation.

The Berkeley Sather implementation.

The Berkeley Harmonia Project.

The Toba Java Virtual Machine to C translator.

The Gwydion Dylan compiler.

The GNU Objective C runtime.

Macaulay 2, a system to support research in algebraic geometry and commutative algebra.

The Vesta configuration management system.

Visual Prolog 6.

Asymptote LaTeX-compatible vector graphics language.

More collector information at this site

A simple illustration of how to build and use the collector..

Description of alternate interfaces to the garbage collector.

Slides from an ISMM 2004 tutorial about the GC.

A FAQ (frequently asked questions) list.

How to use the garbage collector as a leak detector.

Some hints on debugging garbage collected applications.

An overview of the implementation of the garbage collector.

The data structure used for fast pointer lookups.

Scalability of the collector to multiprocessors.

Directory containing garbage collector source.

More background information at this site

An attempt to establish a bound on space usage of conservative garbage collectors.

Mark-sweep versus copying garbage collectors and their complexity.

Pros and cons of conservative garbage collectors, in comparison to other collectors.

Issues related to garbage collection vs. manual memory management in C/C++.

An example of a case in which garbage collection results in a much faster implementation as a result of reduced synchronization.

Slide set discussing performance of nonmoving garbage collectors.

Slide set discussing Destructors, Finalizers, and Synchronization (POPL 2003).

Paper corresponding to above slide set. ( Technical Report version.)

A Java/Scheme/C/C++ garbage collection benchmark.

Slides for talk on memory allocation myths.

Slides for OOPSLA 98 garbage collection talk.

Related papers.

Contacts and Mailing List

We have recently set up two mailing list for collector announcements and discussions:
  • gc-announce@linux.hpl.hp.com is used for announcements of new versions. Postings are restricted. We expect this to always remain a very low volume list.
  • gc@linux.hpl.hp.com is used for discussions, bug reports, and the like. Subscribers may post. On-topic posts by nonsubscribers will usually also be accepted, but it may take some time to review them.
To subscribe to these lists, send a mail message containing the word "subscribe" to gc-announce-request@linux.hpl.hp.com or to gc-request@linux.hpl.hp.com. (Please ignore the instructions about web-based subscription. The listed web site is behind the HP firewall.)

The archives for these lists appear here. The gc list archive may also be read at gmane.org.

Some prior discussion of the collector has taken place on the gcc java mailing list, whose archives appear here, and also on gclist@iecc.com.

Comments and bug reports may also be sent to (Hans.Boehm@hp.com) or (boehm@acm.org), but the gc mailing list is usually preferred.

synopsis-0.12/src/Synopsis/gc/doc/README.OS20000664000076400007640000000055511104702320017710 0ustar stefanstefanThe code assumes static linking, and a single thread. The editor de has not been ported. The cord test program has. The supplied OS2_MAKEFILE assumes the IBM C Set/2 environment, but the code shouldn't. Since we haven't figured out hoe to do perform partial links or to build static libraries, clients currently need to link against a long list of executables. synopsis-0.12/src/Synopsis/gc/doc/README.darwin0000664000076400007640000001453411104702320020573 0ustar stefanstefanDarwin/MacOSX Support - December 16, 2003 ========================================= Important Usage Notes ===================== GC_init() MUST be called before calling any other GC functions. This is necessary to properly register segments in dynamic libraries. This call is required even if you code does not use dynamic libraries as the dyld code handles registering all data segments. When your use of the garbage collector is confined to dylibs and you cannot call GC_init() before your libraries' static initializers have run and perhaps called GC_malloc(), create an initialization routine for each library to call GC_init(): #include extern "C" void my_library_init() { GC_init(); } Compile this code into a my_library_init.o, and link it into your dylib. When you link the dylib, pass the -init argument with _my_library_init (e.g. gcc -dynamiclib -o my_library.dylib a.o b.o c.o my_library_init.o -init _my_library_init). This causes my_library_init() to be called before any static initializers, and will initialize the garbage collector properly. Note: It doesn't hurt to call GC_init() more than once, so it's best, if you have an application or set of libraries that all use the garbage collector, to create an initialization routine for each of them that calls GC_init(). Better safe than sorry. The incremental collector is still a bit flaky on darwin. It seems to work reliably with workarounds for a few possible bugs in place however these workaround may not work correctly in all cases. There may also be additional problems that I have not found. Thread-local GC allocation will not work with threads that are not created using the GC-provided override of pthread_create(). Threads created without the GC-provided pthread_create() do not have the necessary data structures in the GC to store this data. Implementation Information ========================== Darwin/MacOSX support is nearly complete. Thread support is reliable on Darwin 6.x (MacOSX 10.2) and there have been reports of success on older Darwin versions (MacOSX 10.1). Shared library support had also been added and the gc can be run from a shared library. There is currently only support for Darwin/PPC although adding x86 support should be trivial. Thread support is implemented in terms of mach thread_suspend and thread_resume calls. These provide a very clean interface to thread suspension. This implementation doesn't rely on pthread_kill so the code works on Darwin < 6.0 (MacOSX 10.1). All the code to stop and start the world is located in darwin_stop_world.c. Since not all uses of the GC enable clients to override pthread_create() before threads have been created, the code for stopping the world has been rewritten to look for threads using Mach kernel calls. Each thread identified in this way is suspended and resumed as above. In addition, since Mach kernel threads do not contain pointers to their stacks, a stack-walking function has been written to find the stack limits. Given an initial stack pointer (for the current thread, a pointer to a stack-allocated local variable will do; for a non-active thread, we grab the value of register 1 (on PowerPC)), it will walk the PPC Mach-O-ABI compliant stack chain until it reaches the top of the stack. This appears to work correctly for GCC-compiled C, C++, Objective-C, and Objective-C++ code, as well as for Java programs that use JNI. If you run code that does not follow the stack layout or stack pointer conventions laid out in the PPC Mach-O ABI, then this will likely crash the garbage collector. The original incremental collector support unfortunatelly no longer works on recent Darwin versions. It also relied on some undocumented kernel structures. Mach, however, does have a very clean interface to exception handing. The current implementation uses Mach's exception handling. Much thanks goes to Andrew Stone, Dietmar Planitzer, Andrew Begel, Jeff Sturm, and Jesse Rosenstock for all their work on the Darwin/OS X port. -Brian Alliet brian@brianweb.net gc_cpp.h usage ============== Replacement of operator new and delete is apparently not supported with dynamic libraries. This means that applications using gc_cpp.h (including the built-in test) will probably not work correctly with the collector in a dynamic library, unless special care is taken. See http://article.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/1421 for some details. - Hans Boehm (based on information from Andrew Begel) Older Information (Most of this no longer applies to the current code) ====================================================================== While the GC should work on MacOS X Server, MacOS X and Darwin, I only tested it on MacOS X Server. I've added a PPC assembly version of GC_push_regs(), thus the setjmp() hack is no longer necessary. Incremental collection is supported via mprotect/signal. The current solution isn't really optimal because the signal handler must decode the faulting PPC machine instruction in order to find the correct heap address. Further, it must poke around in the register state which the kernel saved away in some obscure register state structure before it calls the signal handler - needless to say the layout of this structure is no where documented. Threads and dynamic libraries are not yet supported (adding dynamic library support via the low-level dyld API shouldn't be that hard). The original MacOS X port was brought to you by Andrew Stone. June, 1 2000 Dietmar Planitzer dave.pl@ping.at Note from Andrew Begel: One more fix to enable gc.a to link successfully into a shared library for MacOS X. You have to add -fno-common to the CFLAGS in the Makefile. MacOSX disallows common symbols in anything that eventually finds its way into a shared library. (I don't completely understand why, but -fno-common seems to work and doesn't mess up the garbage collector's functionality). Feb 26, 2003 Jeff Sturm and Jesse Rosenstock provided a patch that adds thread support. GC_MACOSX_THREADS should be defined in the build and in clients. Real dynamic library support is still missing, i.e. dynamic library data segments are still not scanned. Code that stores pointers to the garbage collected heap in statically allocated variables should not reside in a dynamic library. This still doesn't appear to be 100% reliable. Mar 10, 2003 Brian Alliet contributed dynamic library support for MacOSX. It could also use more testing. synopsis-0.12/src/Synopsis/gc/doc/README.rs60000000664000076400007640000000077511104702320020243 0ustar stefanstefanWe have so far failed to find a good way to determine the stack base. It is highly recommended that GC_stackbottom be set explicitly on program startup. The supplied value sometimes causes failure under AIX 4.1, though it appears to work under 3.X. HEURISTIC2 seems to work under 4.1, but involves a substantial performance penalty, and will fail if there is no limit on stack size. There is no thread support. (I assume recent versions of AIX provide pthreads? I no longer have access to a machine ...) synopsis-0.12/src/Synopsis/gc/doc/README.solaris20000664000076400007640000000653011104702320021042 0ustar stefanstefanThe collector supports both incremental collection and threads under Solaris 2. The incremental collector normally retrieves page dirty information through the appropriate /proc calls. But it can also be configured (by defining MPROTECT_VDB instead of PROC_VDB in gcconfig.h) to use mprotect and signals. This may result in shorter pause times, but it is no longer safe to issue arbitrary system calls that write to the heap. Under other UNIX versions, the collector normally obtains memory through sbrk. There is some reason to expect that this is not safe if the client program also calls the system malloc, or especially realloc. The sbrk man page strongly suggests this is not safe: "Many library routines use malloc() internally, so use brk() and sbrk() only when you know that malloc() definitely will not be used by any library routine." This doesn't make a lot of sense to me, since there seems to be no documentation as to which routines can transitively call malloc. Nonetheless, under Solaris2, the collector now (since 4.12) allocates memory using mmap by default. (It defines USE_MMAP in gcconfig.h.) You may want to reverse this decisions if you use -DREDIRECT_MALLOC=... SOLARIS THREADS: The collector must be compiled with -DGC_SOLARIS_THREADS (thr_ functions) or -DGC_THREADS to be thread safe. This assumes use of the pthread_ interface. Old style Solaris threads are no longer supported. It is also essential that gc.h be included in files that call thr_create, thr_join, thr_suspend, thr_continue, or dlopen. Gc.h macro defines these to also do GC bookkeeping, etc. Gc.h must be included with one or both of these macros defined, otherwise these replacements are not visible. A collector built in this way way only be used by programs that are linked with the threads library. Since 5.0 alpha5, dlopen disables collection temporarily, unless USE_PROC_FOR_LIBRARIES is defined. In some unlikely cases, this can result in unpleasant heap growth. But it seems better than the race/deadlock issues we had before. If solaris_threads are used on an X86 processor with malloc redirected to GC_malloc, it is necessary to call GC_thr_init explicitly before forking the first thread. (This avoids a deadlock arising from calling GC_thr_init with the allocation lock held.) It appears that there is a problem in using gc_cpp.h in conjunction with Solaris threads and Sun's C++ runtime. Apparently the overloaded new operator is invoked by some iostream initialization code before threads are correctly initialized. As a result, call to thr_self() in garbage collector initialization segfaults. Currently the only known workaround is to not invoke the garbage collector from a user defined global operator new, or to have it invoke the garbage-collector's allocators only after main has started. (Note that the latter requires a moderately expensive test in operator delete.) I encountered "symbol : offet .... is non-aligned" errors. These appear to be traceable to the use of the GNU assembler with the Sun linker. The former appears to generate a relocation not understood by the latter. The fix appears to be to use a consistent tool chain. (As a non-Solaris-expert my solution involved hacking the libtool script, but I'm sure you can do something less ugly.) Hans-J. Boehm (The above contains my personal opinions, which are probably not shared by anyone else.) synopsis-0.12/src/Synopsis/gc/doc/README.cords0000664000076400007640000000476311104702320020424 0ustar stefanstefanCopyright (c) 1993-1994 by Xerox Corporation. All rights reserved. THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. Permission is hereby granted to use or copy this program for any purpose, provided the above notices are retained on all copies. Permission to modify the code and to distribute modified code is granted, provided the above notices are retained, and a notice that the code was modified is included with the above copyright notice. Please send bug reports to Hans-J. Boehm (Hans_Boehm@hp.com or boehm@acm.org). This is a string packages that uses a tree-based representation. See cord.h for a description of the functions provided. Ec.h describes "extensible cords", which are essentially output streams that write to a cord. These allow for efficient construction of cords without requiring a bound on the size of a cord. More details on the data structure can be found in Boehm, Atkinson, and Plass, "Ropes: An Alternative to Strings", Software Practice and Experience 25, 12, December 1995, pp. 1315-1330. A fundamentally similar "rope" data structure is also part of SGI's standard template library implementation, and its descendents, which include the GNU C++ library. That uses reference counting by default. There is a short description of that data structure at http://reality.sgi.com/boehm/ropeimpl.html . (The more official location http://www.sgi.com/tech/stl/ropeimpl.html is missing a figure.) All of these are descendents of the "ropes" in Xerox Cedar. de.c is a very dumb text editor that illustrates the use of cords. It maintains a list of file versions. Each version is simply a cord representing the file contents. Nonetheless, standard editing operations are efficient, even on very large files. (Its 3 line "user manual" can be obtained by invoking it without arguments. Note that ^R^N and ^R^P move the cursor by almost a screen. It does not understand tabs, which will show up as highlighred "I"s. Use the UNIX "expand" program first.) To build the editor, type "make cord/de" in the gc directory. This package assumes an ANSI C compiler such as gcc. It will not compile with an old-style K&R compiler. Note that CORD_printf iand friends use C functions with variable numbers of arguments in non-standard-conforming ways. This code is known to break on some platforms, notably PowerPC. It should be possible to build the remainder of the library (everything but cordprnt.c) on any platform that supports the collector. synopsis-0.12/src/Synopsis/gc/doc/README.Mac0000664000076400007640000003250611104702320020006 0ustar stefanstefanThe contents of this file are old and pertain to pre-MacOSX versions. You probably really wanted README.darwin. --------------------------------------------- Patrick Beard's Notes for building GC v4.12 with CodeWarrior Pro 2: ---------------------------------------------------------------------------- The current build environment for the collector is CodeWarrior Pro 2. Projects for CodeWarrior Pro 2 (and for quite a few older versions) are distributed in the file Mac_projects.sit.hqx. The project file :Mac_projects:gc.prj builds static library versions of the collector. :Mac_projects:gctest.prj builds the GC test suite. Configuring the collector is still done by editing the files :Mac_files:MacOS_config.h and :Mac_files:MacOS_Test_config.h. Lars Farm's suggestions on building the collector: ---------------------------------------------------------------------------- Garbage Collection on MacOS - a manual 'MakeFile' ------------------------------------------------- Project files and IDE's are great on the Macintosh, but they do have problems when used as distribution media. This note tries to provide porting instructions in pure TEXT form to avoid those problems. A manual 'makefile' if you like. GC version: 4.12a2 Codewarrior: CWPro1 date: 18 July 1997 The notes may or may not apply to earlier or later versions of the GC/CWPro. Actually, they do apply to earlier versions of both except that until recently a project could only build one target so each target was a separate project. The notes will most likely apply to future versions too. Possibly with minor tweaks. This is just to record my experiences. These notes do not mean I now provide a supported port of the GC to MacOS. It works for me. If it works for you, great. If it doesn't, sorry, try again...;-) Still, if you find errors, please let me know. mailto: lars.farm@ite.mh.se address: Lars Farm Krönvägen 33b 856 44 Sundsvall Sweden Porting to MacOS is a bit more complex than it first seems. Which MacOS? 68K/PowerPC? Which compiler? Each supports both 68K and PowerPC and offer a large number of (unique to each environment) compiler settings. Each combination of compiler/68K/PPC/settings require a unique combination of standard libraries. And the IDE's does not select them for you. They don't even check that the library is built with compatible setting and this is the major source of problems when porting the GC (and otherwise too). You will have to make choices when you configure the GC. I've made some choices here, but there are other combinations of settings and #defines that work too. As for target settings the major obstacles may be: - 68K Processor: check "4-byte Ints". - PPC Processor: uncheck "Store Static Data in TOC". What you need to do: =================== 1) Build the GC as a library 2) Test that the library works with 'test.c'. 3) Test that the C++ interface 'gc_cpp.cc/h' works with 'test_cpp.cc'. 1) The Libraries: ================= I made one project with four targets (68K/PPC tempmem or appheap). One target will suffice if you're able to decide which one you want. I wasn't... Codewarrior allows a large number of compiler/linker settings. I used these: Settings shared by all targets: ------------------------------ o Access Paths: - User Paths: the GC folder - System Paths: {Compiler}:Metrowerks Standard Library: {Compiler}:MacOS Support:Headers: {Compiler}:MacOS Support:MacHeaders: o C/C++ language: - inlining: normal - direct to SOM: off - enable/check: exceptions, RTTI, bool (and if you like pool strings) PowerPC target settings ----------------------- o Target Settings: - name of target - MacOS PPC Linker o PPC Target - name of library o C/C++ language - prefix file as described below o PPC Processor - Struct Alignment: PowerPC - uncheck "Store Static Data in TOC" -- important! I don't think the others matter, I use full optimization and its ok o PPC Linker - Factory Settings (SYM file with full paths, faster linking, dead-strip static init, Main: __start) 68K target settings ------------------- o Target Settings: - name of target - MacOS 68K Linker o 68K Target - name of library - A5 relative data o C/C++ language - prefix file as described below o 68K Processor - Code model: smart - Struct alignment: 68K - FP: SANE - enable 4-Byte Ints -- important! I don't think the others matter. I selected... - enable: 68020 - enable: global register allocation o IR Optimizer - enable: Optimize Space, Optimize Speed I suppose the others would work too, but haven't tried... o 68K Linker - Factory Settings (New Style MacsBug,SYM file with full paths, A6 Frames, fast link, Merge compiler glue into segment 1, dead-strip static init) Prefix Files to configure the GC sources ---------------------------------------- The Codewarrior equivalent of commandline compilers -DNAME=X is to use prefix-files. A TEXT file that is automatically #included before the first byte of every source file. I used these: ---- ( cut here ) ---- gc_prefix_tempmem.h -- 68K and PPC ----- #include "gc_prefix_common.h" #undef USE_TEMPORARY_MEMORY #define USE_TEMPORARY_MEMORY ---- ( cut here ) ---- gc_prefix_appmem.h -- 68K and PPC ----- #include "gc_prefix_common.h" #undef USE_TEMPORARY_MEMORY // #define USE_TEMPORARY_MEMORY ---- ( cut here ) ---- gc_prefix_common.h -------------------- // gc_prefix_common.h // ------------------ // Codewarrior prefix file to configure the GC libraries // // prefix files are the Codewarrior equivalent of the // command line option -Dname=x frequently seen in makefiles #if !__MWERKS__ #error only tried this with Codewarrior #endif #if macintosh #define MSL_USE_PRECOMPILED_HEADERS 0 #include #ifndef __STDC__ #define __STDC__ 0 #endif // See list of #defines to configure the library in: 'MakeFile' // see also README #define SILENT // no collection messages. In case // of trouble you might want this off #define ALL_INTERIOR_POINTERS // follows interior pointers. //#define DONT_ADD_BYTE_AT_END // disables the padding if defined. //#define SMALL_CONFIG // whether to use a smaller heap. #define NO_SIGNALS // signals aren't real on the Macintosh. #define ATOMIC_UNCOLLECTABLE // GC_malloc_atomic_uncollectable() // define either or none as per personal preference // used in malloc.c #define REDIRECT_MALLOC GC_malloc //#define REDIRECT_MALLOC GC_malloc_uncollectable // if REDIRECT_MALLOC is #defined make sure that the GC library // is listed before the ANSI/ISO libs in the Codewarrior // 'Link order' panel //#define IGNORE_FREE // mac specific configs //#define USE_TEMPORARY_MEMORY // use Macintosh temporary memory. //#define SHARED_LIBRARY_BUILD // build for use in a shared library. #else // could build Win32 here too, or in the future // Rhapsody PPC-mach, Rhapsody PPC-MacOS, // Rhapsody Intel-mach, Rhapsody Intel-Win32,... // ... ugh this will get messy ... #endif // make sure ints are at least 32-bit // ( could be set to 16-bit by compiler settings (68K) ) struct gc_private_assert_intsize_{ char x[ sizeof(int)>=4 ? 1 : 0 ]; }; #if __powerc #if __option(toc_data) #error turn off "store static data in TOC" when using GC // ... or find a way to add TOC to the root set...(?) #endif #endif ---- ( cut here ) ---- end of gc_prefix_common.h ----------------- Files to build the GC libraries: -------------------------------- allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c finalize.c headers.c mach_dep.c MacOS.c -- contains MacOS code malloc.c mallocx.c mark.c mark_rts.c misc.c new_hblk.c obj_map.c os_dep.c -- contains MacOS code ptr_chck.c reclaim.c stubborn.c typd_mlc.c gc++.cc -- this is 'gc_cpp.cc' with less 'inline' and -- throw std::bad_alloc when out of memory -- gc_cpp.cc works just fine too 2) Test that the library works with 'test.c'. ============================================= The test app is just an ordinary ANSI-C console app. Make sure settings match the library you're testing. Files ----- test.c the GC library to test -- link order before ANSI libs suitable Mac+ANSI libraries prefix: ------ ---- ( cut here ) ---- gc_prefix_testlib.h -- all libs ----- #define MSL_USE_PRECOMPILED_HEADERS 0 #include #undef NDEBUG #define ALL_INTERIOR_POINTERS /* for GC_priv.h */ ---- ( cut here ) ---- 3) Test that the C++ interface 'gc_cpp.cc/h' works with 'test_cpp.cc'. The test app is just an ordinary ANSI-C console app. Make sure settings match the library you're testing. Files ----- test_cpp.cc the GC library to test -- link order before ANSI libs suitable Mac+ANSI libraries prefix: ------ same as for test.c For convenience I used one test-project with several targets so that all test apps are build at once. Two for each library to test: test.c and gc_app.cc. When I was satisfied that the libraries were ok. I put the libraries + gc.h + the c++ interface-file in a folder that I then put into the MSL hierarchy so that I don't have to alter access-paths in projects that use the GC. After that, just add the proper GC library to your project and the GC is in action! malloc will call GC_malloc and free GC_free, new/delete too. You don't have to call free or delete. You may have to be a bit cautious about delete if you're freeing other resources than RAM. See gc_cpp.h. You can also keep coding as always with delete/free. That works too. If you want, "include and tweak it's use a bit. Symantec SPM ============ It has been a while since I tried the GC in SPM, but I think that the above instructions should be sufficient to guide you through in SPM too. SPM needs to know where the global data is. Use the files 'datastart.c' and 'dataend.c'. Put 'datastart.c' at the top of your project and 'dataend.c' at the bottom of your project so that all data is surrounded. This is not needed in Codewarrior because it provides intrinsic variables __datastart__, __data_end__ that wraps all globals. Source Changes (GC 4.12a2) ========================== Very few. Just one tiny in the GC, not strictly needed. - MacOS.c line 131 in routine GC_MacFreeTemporaryMemory() change # if !defined(SHARED_LIBRARY_BUILD) to # if !defined(SILENT) && !defined(SHARED_LIBRARY_BUILD) To turn off a message when the application quits (actually, I faked this change by #defining SHARED_LIBRARY_BUILD in a statically linked library for more than a year without ill effects but perhaps this is better). - test_cpp.cc made the first lines of main() look like this: ------------ int main( int argc, char* argv[] ) { #endif #if macintosh // MacOS char* argv_[] = {"test_cpp","10"}; // doesn't argv=argv_; // have a argc = sizeof(argv_)/sizeof(argv_[0]); // commandline #endif // int i, iters, n; # ifndef __GNUC__ alloc dummy_to_fool_the_compiler_into_doing_things_it_currently_cant_handle; ------------ - config.h [now gcconfig.h] __MWERKS__ does not have to mean MACOS. You can use Codewarrior to build a Win32 or BeOS library and soon a Rhapsody library. You may have to change that #if... It worked for me, hope it works for you. Lars Farm 18 July 1997 ---------------------------------------------------------------------------- Patrick Beard's instructions (may be dated): v4.3 of the collector now runs under Symantec C++/THINK C v7.0.4, and Metrowerks C/C++ v4.5 both 68K and PowerPC. Project files are provided to build and test the collector under both development systems. Configuration ------------- To configure the collector, under both development systems, a prefix file is used to set preprocessor directives. This file is called "MacOS_config.h". Also to test the collector, "MacOS_Test_config.h" is provided. Testing ------- To test the collector (always a good idea), build one of the gctest projects, gctest.¹ (Symantec C++/THINK C), mw/gctest.68K.¹, or mw/gctest.PPC.¹. The test will ask you how many times to run; 1 should be sufficient. Building -------- For your convenience project files for the major Macintosh development systems are provided. For Symantec C++/THINK C, you must build the two projects gclib-1.¹ and gclib-2.¹. It has to be split up because the collector has more than 32k of static data and no library can have more than this in the Symantec environment. (Future versions will probably fix this.) For Metrowerks C/C++ 4.5 you build gc.68K.¹/gc.PPC.¹ and the result will be a library called gc.68K.lib/gc.PPC.lib. Using ----- Under Symantec C++/THINK C, you can just add the gclib-1.¹ and gclib-2.¹ projects to your own project. Under Metrowerks, you add gc.68K.lib or gc.PPC.lib and two additional files. You add the files called datastart.c and dataend.c to your project, bracketing all files that use the collector. See mw/gctest.¹ for an example. Include the projects/libraries you built above into your own project, #include "gc.h", and call GC_malloc. You don't have to call GC_free. Patrick C. Beard January 4, 1995 synopsis-0.12/src/Synopsis/gc/doc/gcdescr.html0000664000076400007640000007603011104702320020727 0ustar stefanstefan Conservative GC Algorithmic Overview Hans-J. Boehm, HP Labs (Some of this was written at SGI)

This is under construction, and may always be.

Conservative GC Algorithmic Overview

This is a description of the algorithms and data structures used in our conservative garbage collector. I expect the level of detail to increase with time. For a survey of GC algorithms, see for example Paul Wilson's excellent paper. For an overview of the collector interface, see here.

This description is targeted primarily at someone trying to understand the source code. It specifically refers to variable and function names. It may also be useful for understanding the algorithms at a higher level.

The description here assumes that the collector is used in default mode. In particular, we assume that it used as a garbage collector, and not just a leak detector. We initially assume that it is used in stop-the-world, non-incremental mode, though the presence of the incremental collector will be apparent in the design. We assume the default finalization model, but the code affected by that is very localized.

Introduction

The garbage collector uses a modified mark-sweep algorithm. Conceptually it operates roughly in four phases, which are performed occasionally as part of a memory allocation:
  1. Preparation Each object has an associated mark bit. Clear all mark bits, indicating that all objects are potentially unreachable.
  2. Mark phase Marks all objects that can be reachable via chains of pointers from variables. Often the collector has no real information about the location of pointer variables in the heap, so it views all static data areas, stacks and registers as potentially containing pointers. Any bit patterns that represent addresses inside heap objects managed by the collector are viewed as pointers. Unless the client program has made heap object layout information available to the collector, any heap objects found to be reachable from variables are again scanned similarly.
  3. Sweep phase Scans the heap for inaccessible, and hence unmarked, objects, and returns them to an appropriate free list for reuse. This is not really a separate phase; even in non incremental mode this is operation is usually performed on demand during an allocation that discovers an empty free list. Thus the sweep phase is very unlikely to touch a page that would not have been touched shortly thereafter anyway.
  4. Finalization phase Unreachable objects which had been registered for finalization are enqueued for finalization outside the collector.

The remaining sections describe the memory allocation data structures, and then the last 3 collection phases in more detail. We conclude by outlining some of the additional features implemented in the collector.

Allocation

The collector includes its own memory allocator. The allocator obtains memory from the system in a platform-dependent way. Under UNIX, it uses either malloc, sbrk, or mmap.

Most static data used by the allocator, as well as that needed by the rest of the garbage collector is stored inside the _GC_arrays structure. This allows the garbage collector to easily ignore the collectors own data structures when it searches for root pointers. Other allocator and collector internal data structures are allocated dynamically with GC_scratch_alloc. GC_scratch_alloc does not allow for deallocation, and is therefore used only for permanent data structures.

The allocator allocates objects of different kinds. Different kinds are handled somewhat differently by certain parts of the garbage collector. Certain kinds are scanned for pointers, others are not. Some may have per-object type descriptors that determine pointer locations. Or a specific kind may correspond to one specific object layout. Two built-in kinds are uncollectable. One (STUBBORN) is immutable without special precautions. In spite of that, it is very likely that most C clients of the collector currently use at most two kinds: NORMAL and PTRFREE objects. The gcj runtime also makes heavy use of a kind (allocated with GC_gcj_malloc) that stores type information at a known offset in method tables.

The collector uses a two level allocator. A large block is defined to be one larger than half of HBLKSIZE, which is a power of 2, typically on the order of the page size.

Large block sizes are rounded up to the next multiple of HBLKSIZE and then allocated by GC_allochblk. Recent versions of the collector use an approximate best fit algorithm by keeping free lists for several large block sizes. The actual implementation of GC_allochblk is significantly complicated by black-listing issues (see below).

Small blocks are allocated in chunks of size HBLKSIZE. Each chunk is dedicated to only one object size and kind. The allocator maintains separate free lists for each size and kind of object.

Once a large block is split for use in smaller objects, it can only be used for objects of that size, unless the collector discovers a completely empty chunk. Completely empty chunks are restored to the appropriate large block free list.

In order to avoid allocating blocks for too many distinct object sizes, the collector normally does not directly allocate objects of every possible request size. Instead request are rounded up to one of a smaller number of allocated sizes, for which free lists are maintained. The exact allocated sizes are computed on demand, but subject to the constraint that they increase roughly in geometric progression. Thus objects requested early in the execution are likely to be allocated with exactly the requested size, subject to alignment constraints. See GC_init_size_map for details.

The actual size rounding operation during small object allocation is implemented as a table lookup in GC_size_map.

Both collector initialization and computation of allocated sizes are handled carefully so that they do not slow down the small object fast allocation path. An attempt to allocate before the collector is initialized, or before the appropriate GC_size_map entry is computed, will take the same path as an allocation attempt with an empty free list. This results in a call to the slow path code (GC_generic_malloc_inner) which performs the appropriate initialization checks.

In non-incremental mode, we make a decision about whether to garbage collect whenever an allocation would otherwise have failed with the current heap size. If the total amount of allocation since the last collection is less than the heap size divided by GC_free_space_divisor, we try to expand the heap. Otherwise, we initiate a garbage collection. This ensures that the amount of garbage collection work per allocated byte remains constant.

The above is in fact an oversimplification of the real heap expansion and GC triggering heuristic, which adjusts slightly for root size and certain kinds of fragmentation. In particular:

  • Programs with a large root set size and little live heap memory will expand the heap to amortize the cost of scanning the roots.
  • Versions 5.x of the collector actually collect more frequently in nonincremental mode. The large block allocator usually refuses to split large heap blocks once the garbage collection threshold is reached. This often has the effect of collecting well before the heap fills up, thus reducing fragmentation and working set size at the expense of GC time. Versions 6.x choose an intermediate strategy depending on how much large object allocation has taken place in the past. (If the collector is configured to unmap unused pages, versions 6.x use the 5.x strategy.)
  • In calculating the amount of allocation since the last collection we give partial credit for objects we expect to be explicitly deallocated. Even if all objects are explicitly managed, it is often desirable to collect on rare occasion, since that is our only mechanism for coalescing completely empty chunks.

It has been suggested that this should be adjusted so that we favor expansion if the resulting heap still fits into physical memory. In many cases, that would no doubt help. But it is tricky to do this in a way that remains robust if multiple application are contending for a single pool of physical memory.

Mark phase

At each collection, the collector marks all objects that are possibly reachable from pointer variables. Since it cannot generally tell where pointer variables are located, it scans the following root segments for pointers:
  • The registers. Depending on the architecture, this may be done using assembly code, or by calling a setjmp-like function which saves register contents on the stack.
  • The stack(s). In the case of a single-threaded application, on most platforms this is done by scanning the memory between (an approximation of) the current stack pointer and GC_stackbottom. (For Itanium, the register stack scanned separately.) The GC_stackbottom variable is set in a highly platform-specific way depending on the appropriate configuration information in gcconfig.h. Note that the currently active stack needs to be scanned carefully, since callee-save registers of client code may appear inside collector stack frames, which may change during the mark process. This is addressed by scanning some sections of the stack "eagerly", effectively capturing a snapshot at one point in time.
  • Static data region(s). In the simplest case, this is the region between DATASTART and DATAEND, as defined in gcconfig.h. However, in most cases, this will also involve static data regions associated with dynamic libraries. These are identified by the mostly platform-specific code in dyn_load.c.
The marker maintains an explicit stack of memory regions that are known to be accessible, but that have not yet been searched for contained pointers. Each stack entry contains the starting address of the block to be scanned, as well as a descriptor of the block. If no layout information is available for the block, then the descriptor is simply a length. (For other possibilities, see gc_mark.h.)

At the beginning of the mark phase, all root segments (as described above) are pushed on the stack by GC_push_roots. (Registers and eagerly processed stack sections are processed by pushing the referenced objects instead of the stack section itself.) If ALL_INTERIOR_PTRS is not defined, then stack roots require special treatment. In this case, the normal marking code ignores interior pointers, but GC_push_all_stack explicitly checks for interior pointers and pushes descriptors for target objects.

The marker is structured to allow incremental marking. Each call to GC_mark_some performs a small amount of work towards marking the heap. It maintains explicit state in the form of GC_mark_state, which identifies a particular sub-phase. Some other pieces of state, most notably the mark stack, identify how much work remains to be done in each sub-phase. The normal progression of mark states for a stop-the-world collection is:

  1. MS_INVALID indicating that there may be accessible unmarked objects. In this case GC_objects_are_marked will simultaneously be false, so the mark state is advanced to
  2. MS_PUSH_UNCOLLECTABLE indicating that it suffices to push uncollectable objects, roots, and then mark everything reachable from them. Scan_ptr is advanced through the heap until all uncollectable objects are pushed, and objects reachable from them are marked. At that point, the next call to GC_mark_some calls GC_push_roots to push the roots. It the advances the mark state to
  3. MS_ROOTS_PUSHED asserting that once the mark stack is empty, all reachable objects are marked. Once in this state, we work only on emptying the mark stack. Once this is completed, the state changes to
  4. MS_NONE indicating that reachable objects are marked.
The core mark routine GC_mark_from, is called repeatedly by several of the sub-phases when the mark stack starts to fill up. It is also called repeatedly in MS_ROOTS_PUSHED state to empty the mark stack. The routine is designed to only perform a limited amount of marking at each call, so that it can also be used by the incremental collector. It is fairly carefully tuned, since it usually consumes a large majority of the garbage collection time.

The fact that it perform a only a small amount of work per call also allows it to be used as the core routine of the parallel marker. In that case it is normally invoked on thread-private mark stacks instead of the global mark stack. More details can be found in scale.html

The marker correctly handles mark stack overflows. Whenever the mark stack overflows, the mark state is reset to MS_INVALID. Since there are already marked objects in the heap, this eventually forces a complete scan of the heap, searching for pointers, during which any unmarked objects referenced by marked objects are again pushed on the mark stack. This process is repeated until the mark phase completes without a stack overflow. Each time the stack overflows, an attempt is made to grow the mark stack. All pieces of the collector that push regions onto the mark stack have to be careful to ensure forward progress, even in case of repeated mark stack overflows. Every mark attempt results in additional marked objects.

Each mark stack entry is processed by examining all candidate pointers in the range described by the entry. If the region has no associated type information, then this typically requires that each 4-byte aligned quantity (8-byte aligned with 64-bit pointers) be considered a candidate pointer.

We determine whether a candidate pointer is actually the address of a heap block. This is done in the following steps:

  • The candidate pointer is checked against rough heap bounds. These heap bounds are maintained such that all actual heap objects fall between them. In order to facilitate black-listing (see below) we also include address regions that the heap is likely to expand into. Most non-pointers fail this initial test.
  • The candidate pointer is divided into two pieces; the most significant bits identify a HBLKSIZE-sized page in the address space, and the least significant bits specify an offset within that page. (A hardware page may actually consist of multiple such pages. HBLKSIZE is usually the page size divided by a small power of two.)
  • The page address part of the candidate pointer is looked up in a table. Each table entry contains either 0, indicating that the page is not part of the garbage collected heap, a small integer n, indicating that the page is part of large object, starting at least n pages back, or a pointer to a descriptor for the page. In the first case, the candidate pointer i not a true pointer and can be safely ignored. In the last two cases, we can obtain a descriptor for the page containing the beginning of the object.
  • The starting address of the referenced object is computed. The page descriptor contains the size of the object(s) in that page, the object kind, and the necessary mark bits for those objects. The size information can be used to map the candidate pointer to the object starting address. To accelerate this process, the page header also contains a pointer to a precomputed map of page offsets to displacements from the beginning of an object. The use of this map avoids a potentially slow integer remainder operation in computing the object start address.
  • The mark bit for the target object is checked and set. If the object was previously unmarked, the object is pushed on the mark stack. The descriptor is read from the page descriptor. (This is computed from information GC_obj_kinds when the page is first allocated.)

    At the end of the mark phase, mark bits for left-over free lists are cleared, in case a free list was accidentally marked due to a stray pointer.

    Sweep phase

    At the end of the mark phase, all blocks in the heap are examined. Unmarked large objects are immediately returned to the large object free list. Each small object page is checked to see if all mark bits are clear. If so, the entire page is returned to the large object free list. Small object pages containing some reachable object are queued for later sweeping, unless we determine that the page contains very little free space, in which case it is not examined further.

    This initial sweep pass touches only block headers, not the blocks themselves. Thus it does not require significant paging, even if large sections of the heap are not in physical memory.

    Nonempty small object pages are swept when an allocation attempt encounters an empty free list for that object size and kind. Pages for the correct size and kind are repeatedly swept until at least one empty block is found. Sweeping such a page involves scanning the mark bit array in the page header, and building a free list linked through the first words in the objects themselves. This does involve touching the appropriate data page, but in most cases it will be touched only just before it is used for allocation. Hence any paging is essentially unavoidable.

    Except in the case of pointer-free objects, we maintain the invariant that any object in a small object free list is cleared (except possibly for the link field). Thus it becomes the burden of the small object sweep routine to clear objects. This has the advantage that we can easily recover from accidentally marking a free list, though that could also be handled by other means. The collector currently spends a fair amount of time clearing objects, and this approach should probably be revisited.

    In most configurations, we use specialized sweep routines to handle common small object sizes. Since we allocate one mark bit per word, it becomes easier to examine the relevant mark bits if the object size divides the word length evenly. We also suitably unroll the inner sweep loop in each case. (It is conceivable that profile-based procedure cloning in the compiler could make this unnecessary and counterproductive. I know of no existing compiler to which this applies.)

    The sweeping of small object pages could be avoided completely at the expense of examining mark bits directly in the allocator. This would probably be more expensive, since each allocation call would have to reload a large amount of state (e.g. next object address to be swept, position in mark bit table) before it could do its work. The current scheme keeps the allocator simple and allows useful optimizations in the sweeper.

    Finalization

    Both GC_register_disappearing_link and GC_register_finalizer add the request to a corresponding hash table. The hash table is allocated out of collected memory, but the reference to the finalizable object is hidden from the collector. Currently finalization requests are processed non-incrementally at the end of a mark cycle.

    The collector makes an initial pass over the table of finalizable objects, pushing the contents of unmarked objects onto the mark stack. After pushing each object, the marker is invoked to mark all objects reachable from it. The object itself is not explicitly marked. This assures that objects on which a finalizer depends are neither collected nor finalized.

    If in the process of marking from an object the object itself becomes marked, we have uncovered a cycle involving the object. This usually results in a warning from the collector. Such objects are not finalized, since it may be unsafe to do so. See the more detailed discussion of finalization semantics.

    Any objects remaining unmarked at the end of this process are added to a queue of objects whose finalizers can be run. Depending on collector configuration, finalizers are dequeued and run either implicitly during allocation calls, or explicitly in response to a user request. (Note that the former is unfortunately both the default and not generally safe. If finalizers perform synchronization, it may result in deadlocks. Nontrivial finalizers generally need to perform synchronization, and thus require a different collector configuration.)

    The collector provides a mechanism for replacing the procedure that is used to mark through objects. This is used both to provide support for Java-style unordered finalization, and to ignore certain kinds of cycles, e.g. those arising from C++ implementations of virtual inheritance.

    Generational Collection and Dirty Bits

    We basically use the concurrent and generational GC algorithm described in "Mostly Parallel Garbage Collection", by Boehm, Demers, and Shenker.

    The most significant modification is that the collector always starts running in the allocating thread. There is no separate garbage collector thread. (If parallel GC is enabled, helper threads may also be woken up.) If an allocation attempt either requests a large object, or encounters an empty small object free list, and notices that there is a collection in progress, it immediately performs a small amount of marking work as described above.

    This change was made both because we wanted to easily accommodate single-threaded environments, and because a separate GC thread requires very careful control over the scheduler to prevent the mutator from out-running the collector, and hence provoking unneeded heap growth.

    In incremental mode, the heap is always expanded when we encounter insufficient space for an allocation. Garbage collection is triggered whenever we notice that more than GC_heap_size/2 * GC_free_space_divisor bytes of allocation have taken place. After GC_full_freq minor collections a major collection is started.

    All collections initially run interrupted until a predetermined amount of time (50 msecs by default) has expired. If this allows the collection to complete entirely, we can avoid correcting for data structure modifications during the collection. If it does not complete, we return control to the mutator, and perform small amounts of additional GC work during those later allocations that cannot be satisfied from small object free lists. When marking completes, the set of modified pages is retrieved, and we mark once again from marked objects on those pages, this time with the mutator stopped.

    We keep track of modified pages using one of several distinct mechanisms:

    1. Through explicit mutator cooperation. Currently this requires the use of GC_malloc_stubborn, and is rarely used.
    2. (MPROTECT_VDB) By write-protecting physical pages and catching write faults. This is implemented for many Unix-like systems and for win32. It is not possible in a few environments.
    3. (PROC_VDB) By retrieving dirty bit information from /proc. (Currently only Sun's Solaris supports this. Though this is considerably cleaner, performance may actually be better with mprotect and signals.)
    4. (PCR_VDB) By relying on an external dirty bit implementation, in this case the one in Xerox PCR.
    5. (DEFAULT_VDB) By treating all pages as dirty. This is the default if none of the other techniques is known to be usable, and GC_malloc_stubborn is not used. Practical only for testing, or if the vast majority of objects use GC_malloc_stubborn.

    Black-listing

    The collector implements black-listing of pages, as described in Boehm, ``Space Efficient Conservative Collection'', PLDI '93, also available here.

    During the mark phase, the collector tracks ``near misses'', i.e. attempts to follow a ``pointer'' to just outside the garbage-collected heap, or to a currently unallocated page inside the heap. Pages that have been the targets of such near misses are likely to be the targets of misidentified ``pointers'' in the future. To minimize the future damage caused by such misidentifications they will be allocated only to small pointerfree objects.

    The collector understands two different kinds of black-listing. A page may be black listed for interior pointer references (GC_add_to_black_list_stack), if it was the target of a near miss from a location that requires interior pointer recognition, e.g. the stack, or the heap if GC_all_interior_pointers is set. In this case, we also avoid allocating large blocks that include this page.

    If the near miss came from a source that did not require interior pointer recognition, it is black-listed with GC_add_to_black_list_normal. A page black-listed in this way may appear inside a large object, so long as it is not the first page of a large object.

    The GC_allochblk routine respects black-listing when assigning a block to a particular object kind and size. It occasionally drops (i.e. allocates and forgets) blocks that are completely black-listed in order to avoid excessively long large block free lists containing only unusable blocks. This would otherwise become an issue if there is low demand for small pointerfree objects.

    Thread support

    We support several different threading models. Unfortunately Pthreads, the only reasonably well standardized thread model, supports too narrow an interface for conservative garbage collection. There appears to be no completely portable way to allow the collector to coexist with various Pthreads implementations. Hence we currently support only the more common Pthreads implementations.

    In particular, it is very difficult for the collector to stop all other threads in the system and examine the register contents. This is currently accomplished with very different mechanisms for some Pthreads implementations. The Solaris implementation temporarily disables much of the user-level threads implementation by stopping kernel-level threads ("lwp"s). The Linux/HPUX/OSF1 and Irix implementations sends signals to individual Pthreads and has them wait in the signal handler.

    The Linux and Irix implementations use only documented Pthreads calls, but rely on extensions to their semantics. The Linux implementation linux_threads.c relies on only very mild extensions to the pthreads semantics, and already supports a large number of other Unix-like pthreads implementations. Our goal is to make this the only pthread support in the collector.

    (The Irix implementation is separate only for historical reasons and should clearly be merged. The current Solaris implementation probably performs better in the uniprocessor case, but does not support thread operations in the collector. Hence it cannot support the parallel marker.)

    All implementations must intercept thread creation and a few other thread-specific calls to allow enumeration of threads and location of thread stacks. This is current accomplished with # define's in gc.h (really gc_pthread_redirects.h), or optionally by using ld's function call wrapping mechanism under Linux.

    Recent versions of the collector support several facilites to enhance the processor-scalability and thread performance of the collector. These are discussed in more detail here. We briefly outline the data approach to thread-local allocation in the next section.

    Thread-local allocation

    If thread-local allocation is enabled, the collector keeps separate arrays of free lists for each thread. Thread-local allocation is currently only supported on a few platforms.

    The free list arrays associated with each thread are only used to satisfy requests for objects that are both very small, and belong to one of a small number of well-known kinds. These currently include "normal" and pointer-free objects. Depending onthe configuration, "gcj" objects may also be included.

    Thread-local free list entries contain either a pointer to the first element of a free list, or they contain a counter of the number of allocation "granules" allocated so far. Initially they contain the value one, i.e. a small counter value.

    Thread-local allocation allocates directly through the global allocator, if the object is of a size or kind not covered by the local free lists.

    If there is an appropriate local free list, the allocator checks whether it contains a sufficiently small counter value. If so, the counter is simply incremented by the counter value, and the global allocator is used. In this way, the initial few allocations of a given size bypass the local allocator. A thread that only allocates a handful of objects of a given size will not build up its own free list for that size. This avoids wasting space for unpopular objects sizes or kinds.

    Once the counter passes a threshold, GC_malloc_many is called to allocate roughly HBLKSIZE space and put it on the corresponding local free list. Further allocations of that size and kind then use this free list, and no longer need to acquire the allocation lock. The allocation procedure is otherwise similar to the global free lists. The local free lists are also linked using the first word in the object. In most cases this means they require considerably less time.

    Local free lists are treated buy most of the rest of the collector as though they were in-use reachable data. This requires some care, since pointer-free objects are not normally traced, and hence a special tracing procedure is required to mark all objects on pointer-free and gcj local free lists.

    On thread exit, any remaining thread-local free list entries are transferred back to the global free list.

    Note that if the collector is configured for thread-local allocation, GC versions before 7 do not invoke the thread-local allocator by default. GC_malloc only uses thread-local allocation in version 7 and later. In earlier versions, GC_MALLOC (all caps) may be directed to use thread-local allocation by defining GC_REDIRECT_TO_LOCAL and then include gc_local_alloc.h.

    For some more details see here, and the technical report entitled ``Fast Multiprocessor Memory Allocation and Garbage Collection''


    Comments are appreciated. Please send mail to boehm@acm.org or Hans.Boehm@hp.com

    This is a modified copy of a page written while the author was at SGI. The original was here. synopsis-0.12/src/Synopsis/gc/doc/gc.man0000664000076400007640000001210511104702320017506 0ustar stefanstefan.TH GC_MALLOC 1L "2 October 2003" .SH NAME GC_malloc, GC_malloc_atomic, GC_free, GC_realloc, GC_enable_incremental, GC_register_finalizer, GC_malloc_ignore_off_page, GC_malloc_atomic_ignore_off_page, GC_set_warn_proc \- Garbage collecting malloc replacement .SH SYNOPSIS #include "gc.h" .br void * GC_malloc(size_t size); .br void GC_free(void *ptr); .br void * GC_realloc(void *ptr, size_t size); .br .sp cc ... gc.a .LP .SH DESCRIPTION .I GC_malloc and .I GC_free are plug-in replacements for standard malloc and free. However, .I GC_malloc will attempt to reclaim inaccessible space automatically by invoking a conservative garbage collector at appropriate points. The collector traverses all data structures accessible by following pointers from the machines registers, stack(s), data, and bss segments. Inaccessible structures will be reclaimed. A machine word is considered to be a valid pointer if it is an address inside an object allocated by .I GC_malloc or friends. .LP In most cases it is preferable to call the macros GC_MALLOC, GC_FREE, etc. instead of calling GC_malloc and friends directly. This allows debugging versions of the routines to be substituted by defining GC_DEBUG before including gc.h. .LP See the documentation in the include file gc_cpp.h for an alternate, C++ specific interface to the garbage collector. .LP Unlike the standard implementations of malloc, .I GC_malloc clears the newly allocated storage. .I GC_malloc_atomic does not. Furthermore, it informs the collector that the resulting object will never contain any pointers, and should therefore not be scanned by the collector. .LP .I GC_free can be used to deallocate objects, but its use is optional, and generally discouraged. .I GC_realloc has the standard realloc semantics. It preserves pointer-free-ness. .I GC_register_finalizer allows for registration of functions that are invoked when an object becomes inaccessible. .LP The garbage collector tries to avoid allocating memory at locations that already appear to be referenced before allocation. (Such apparent ``pointers'' are usually large integers and the like that just happen to look like an address.) This may make it hard to allocate very large objects. An attempt to do so may generate a warning. .LP .I GC_malloc_ignore_off_page and .I GC_malloc_atomic_ignore_off_page inform the collector that the client code will always maintain a pointer to near the beginning of the object (within the first 512 bytes), and that pointers beyond that can be ignored by the collector. This makes it much easier for the collector to place large objects. These are recommended for large object allocation. (Objects expected to be larger than about 100KBytes should be allocated this way.) .LP It is also possible to use the collector to find storage leaks in programs destined to be run with standard malloc/free. The collector can be compiled for thread-safe operation. Unlike standard malloc, it is safe to call malloc after a previous malloc call was interrupted by a signal, provided the original malloc call is not resumed. .LP The collector may, on rare occasion produce warning messages. On UNIX machines these appear on stderr. Warning messages can be filtered, redirected, or ignored with .I GC_set_warn_proc This is recommended for production code. See gc.h for details. .LP Fully portable code should call .I GC_INIT from the main program before making any other GC calls. On most platforms this does nothing and the collector is initialized on first use. On a few platforms explicit initialization is necessary. And it can never hurt. .LP Debugging versions of many of the above routines are provided as macros. Their names are identical to the above, but consist of all capital letters. If GC_DEBUG is defined before gc.h is included, these routines do additional checking, and allow the leak detecting version of the collector to produce slightly more useful output. Without GC_DEBUG defined, they behave exactly like the lower-case versions. .LP On some machines, collection will be performed incrementally after a call to .I GC_enable_incremental. This may temporarily write protect pages in the heap. See the README file for more information on how this interacts with system calls that write to the heap. .LP Other facilities not discussed here include limited facilities to support incremental collection on machines without appropriate VM support, provisions for providing more explicit object layout information to the garbage collector, more direct support for ``weak'' pointers, support for ``abortable'' garbage collections during idle time, etc. .LP .SH "SEE ALSO" The README and gc.h files in the distribution. More detailed definitions of the functions exported by the collector are given there. (The above list is not complete.) .LP The web site at http://www.hpl.hp.com/personal/Hans_Boehm/gc . .LP Boehm, H., and M. Weiser, "Garbage Collection in an Uncooperative Environment", \fISoftware Practice & Experience\fP, September 1988, pp. 807-820. .LP The malloc(3) man page. .LP .SH AUTHOR Hans-J. Boehm (Hans.Boehm@hp.com). Some of the code was written by others, most notably Alan Demers. synopsis-0.12/src/Synopsis/gc/doc/README.uts0000664000076400007640000000012611104702320020112 0ustar stefanstefanAlistair Crooks supplied the port. He used Lexa C version 2.1.3 with -Xa to compile. synopsis-0.12/src/Synopsis/gc/doc/README.autoconf0000664000076400007640000000451711104702320021125 0ustar stefanstefanAs of GC6.0alpha8, we attempt to support GNU-style builds based on automake, autoconf and libtool. This is based almost entirely on Tom Tromey's work with gcj. To build and install libraries use configure; make; make install The advantages of this process are: 1) It should eventually do a better job of automatically determining the right compiler to use, etc. It probably already does in some cases. 2) It tries to automatically set a good set of default GC parameters for the platform (e.g. thread support). It provides an easier way to configure some of the others. 3) It integrates better with other projects using a GNU-style build process. 4) It builds both dynamic and static libraries. The known disadvantages are: 1) The build scripts are much more complex and harder to debug (though largely standard). I don't understand them all, and there's probably lots of redundant stuff. 2) It probably doesn't work on all Un*x-like platforms yet. It probably will never work on the rest. 3) The scripts are not yet complete. Some of the standard GNU targets don't yet work. (Corrections/additions are very welcome.) The distribution should contain all files needed to run "configure" and "make", as well as the sources needed to regenerate the derived files. (If I missed some, please let me know.) Note that the distribution comes with a "Makefile" which will be overwritten by "configure" with one that is not at all equiavelent to the original. The distribution contains a copy of the original "Makefile" in "Makefile.direct". Important options to configure: --prefix=PREFIX install architecture-independent files in PREFIX [/usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [same as prefix] --enable-threads=TYPE choose threading package --enable-parallel-mark parallelize marking and free list construction --enable-full-debug include full support for pointer backtracing etc. Unless --prefix is set (or --exec-prefix or one of the more obscure options), make install will install libgc.a and libgc.so in /usr/local/bin, which would typically require the "make install" to be run as root. Most commonly --enable-threads=posix or will be needed. --enable-parallel-mark is recommended for multiprocessors if it is supported on the platform. synopsis-0.12/src/Synopsis/gc/MacProjects.sit.hqx0000664000076400007640000007103411104702317021421 0ustar stefanstefan(This file must be converted with BinHex 4.0) :$deKBe"bEfTPBh4c,R0TG!"6594%8dP8)3#3"&)e!!!"4UiT8dP8)3!(!!"50A* -BA8#ZJ#3!aB"#3d0#'GM,MBi5bkjBf038%-ZZ3#3%)Zi!*!8"@`!N!6rN!4069" 568e$3`%!UbqAD+X`19S!!!Ba!!!,*J!!!F%!!!-PfTmj1`#3"PET)d31)LTH6H4 #*AqG5b5HI*)QjY$IIb00%ReTJSi6rG$jG(bZ,"Rc,9Umf[IRj)6FZ-j`GfGR)#! m-#qLqB#cj'G%46qffB3q8AppLXKc+P&*il4FMJMq3N32r[U,(PlSNdrQm-J(4!p jK)NHmKJSHY!,&chS$4)pk%8mL3I)B0'$AU6S3'q)k%%[5[5J&ffa#68)0ZM&#T! !*fHC-2dFZ3i83[Vr[4Xh'+DNQrm'J)rrpqe%ST`,FeVi6b,*qHH")4eQc28NFMN ZT*m,L"Y%-`pdAk6RLHDaeVV0a,,@P(4UUK66rUM'8bf91llS("lTh81)MBQ+4*q rfHENEhD)Ke#3!09'M%bL[P1+G88fa$3e)5Gpf0kARpBf*6eIH*0`ZBHR%ii"PbN +D&*)688M)Sm$Bm[cCdDjh2YIjmAc`(TVpi*Vka((A*&Yl@'LTSH1M*AMP#,2[A$ (FHA@S"dL4dER#3b!EfBYem(C9P5iGH"a-bb-AL(F"bb-AL,F6)%a9pJUL,(hf%B TeQb["X5ib4DQXV!-fa6&mZf&3,(C&UDd-((SpeMBEIB`8Zc,BcZR3A5'X+jYj$' 6)6HVV+R[!`#3!`X!(E@*MFQ%R4d"))`m[3JM[c)bBS54Tj'M(AP+MK&f%VD5SdG SANFB@3Rqc$Am83(+)`"G(D%A'9!bBQ6!b)b4Sq3SH8D1NDGNX$)bBi54!51--$* Kj0L!M"KKK"dC--,)-h+-6#KKC-$)-F)NamL!!Z06#X!!b&%bBUHp8RcN'%%6!b, i!!kV"`"DLHFaK*!!"Ym4K,,2i2X4c[,`c5!GIPf!ZcNi'8'VfJFpSfdpq+CY$8j -V'f-DZr2[36#1(ael5hmfT@1cSU66D5pqDSA89pdTP-`Z[jj6T&!PmZBFZjal"& 5iG6#blE$+&kLh#QZ118&(0T1J(hZ,9)5MJ9ic*qPI!ac'RJ96QMZjSbkMq()Ui6 B+f,,#'N1icbM4N"aaBr1`3Z9U'8RY'XAiVXFKp#&k2D5Be%VCdh4%,+2QS'b"Q2 %0PNT4rE#%kTUFqYDM56bVjfe!p8MqmL)1VmjVkJY`U[*$&*L3AMSpB@LCQ*U&l% T+3890rL,V9klFN*4@f0UTf8Z&&afN!"4GC6G8p3fN9$4+4[-@DAeK%lej"@eAAL eU@&4[Tm28%mqqUkS(F+VDa#lB&'rlRAllRP&l460Qc,)MHR$jMh@$8Y4Xc'e`cd ZE2AUUiH+fK96feb$epq&'RAQeLG&lCDjmP+"Kr8k9#qp'eI8RPf[6R$dS+$UcqI ELYSV[*ETFL&j[@lr803qd9I2A#bi4Vei3*d[+@Urk*!!&abe0HTVm%44"i4A6JN c(2I!kjRl6a9e813DK"A6p(LjRZZGaGH+1L5SiBT[(6ekd2*ILMSXU(l)#m3QMDB V+QTG!r*NG#RQai#DNh4,l0&!Ie`dYi98Y1%1A$5hKP4,`d9cHdKP'LkD@q4hYC* %dfdLeCCNN@i9UIBNLh5l5(8N68qhM&4R`d9cfdKP'bkD@dHU+qe&XRfNZSqc10j #8Me*&ZNfNZT0hSYd+dP&ri-FGM6G6P,p5D,rPNT0`dQLk5+6'NLb5"HDe'$L)Pe X8N2bj-Z'$r$6-$NZjLGC)1lB-"jQSff@[ak%LJ[rI#%p2ddAGREN(@"V+,S6CI! I!!!0$3KRBbj38%-ZZ@0M8&"$,VN!N"#$BJ#3%4B!!!d'!*!%rj!%68e38Ne33d- "!+X[PfqV-$P*!!!'-3!!&UB!!!(&!!!&C80(jji!N!BMM#0%$L)UANhN3L9rV@9 B`f#c2p$XpAVVCc-[`k20Y5bJ+CTHPScj`Z'!lmr*#EPaRH(ZcR!J!!rqMKG"q)# cj'G%46qffB3q8Aqp4R6FA83PM6`KUjaYD&IlZ@jDrY"pk[b&AZrdH*kFbb9PM*S `4Kh$c8Lf0bVe+Y`Q$amM6mc%*C1(jF&1bFSdGIlLpc*04b#X&D8[&6R%+-#6HhJ kX"#A+Bp6%6RGkB&kM%'jh$ZLmam[1Irq,r82rGM"5H4bh1ZB+b"Z%&-pD)5CL9( AP(4UUK6$!(lkH+UPFXFARF-MIHHMXf!5Nd%SZYRQj'pfL)G3N!$94X#(q25G8U` VXL'QU3Njk8[phV2@0Q92J#d6rA2N1["[!%c(M4X-8p,0IcYJf2lRBmD2c)*RQEF 68m'9jqq*MjHTji&GqDp$kh501r9fqVPJe4iQDRS)L!)ELqiX08i#@40jpP1+F@p iC&))L)Qq4Bk-cK-i*h`cDlN1cMBUbZA3+beKhX*-&UD`X%ME%F91fHB3BaCC''Y KNba-C@(,"-40Yl"l,#c8`YCDf%#"XGD%F4m3'*i'k"iah[Ddam+k"Xd3eV@02'B bj'D90I9p!!!-q)[jAU2HhQ[NiCQC&f(Ne`JR!hlN1''4Sjc`)hcL5IK+f(@8(q& (1&Nj2XreTBI[M!0dGB4'MK01#CFF2c,JK"*1MNZ1(q&(11@5ii5EKimF*ja``Np #bA(#bBL6BpQ6jq5imT-m2mQ!dq2N'H&2RT2M%Nii'6$J,PF!#N#jGS3IS9Uba%G 'A-)*8[#%!j-9'#r3@EpUPQ9+NL6$ldj*kVS6INIK@`*q'q$hGRJCPb,`pUJm(fQ 3!#mGrdQqe$Nm22hkJ2cerNp"i3$m4Z62S5YA40V([V`MbHF@)QPT2IN@3@$ceHm I&dT3GqF9K,'&&8[6LKMTbQ6@-*%bJE#4RM,b'FA*'VC5`0BBdTa"@aNXM#)mU'" N@d@XSIKMMiMh#RbbLSjLT49GG9"F84)Q8QfN&![N1hK"A'V5F,,dJIF@+`iNJEb H-(5Nar84j!"*Q54MH+j&08dYQc,(ipT9I+aFqIQc-XP313&803UUPPD4*+UAIlj $U+jMAP1QUSfEYV2Qp4HKfZ#TYQTCT)hEaCbp+ZXH0"m5USfHDV1HbL4cCT@41rr 5+d+eL4&+'hR90)iLRp$LYcm)e5McQN@UMR#&$kKqr%eHU-DBejbUCC-k+P4N5r% Iha+Uc5aj)kVfm*'ej*8Dali5ULfHDLah-l$Zfer1#G9@6l8TTf*r,RKTZ2#Q8'h MA2&i%MYq(0aCicHKfPlfDYLeJ3*FFEG3l@"HmfJbqFrdHU&IU+jRHE95BmQFkJF 29)qp)93hX!aCGLfYP0!jSEU4HF9)-e8M9rADGfC4U(BbVVC66+8XR2Hj2RAmGk' kLDNk8`@p0[6F"hrG,e3h`kmm(BhDMQjBm@`ejDH1pG)YbUXYM'Y'5aD`-H(VPZ) ,*i6A,Nqe)D1Y'5@UV@HM3VAE)a3$3MT+9jAGa)HI#%*E@9ie+jmf-PA9dY#66`Z [fkMA!l&$eZ3)bP996crcal6`ZRdT$9NG0S#+V([`rRZ&eae,A%dMGB2V4H%9YPL LfZ3B194,NC[ik!QKZSYlaE"deVc1$3[9(XVeFJIG0T,9**@'AVXJZ2Db$%'!,$a e+d2+8SES`Z&RD1(C`m,VlM*Aj)cP#M@ZlJI#Djp(U28`fl)VL9dKY+IXeFM!HRJ MVc0#YCpj6@!,M0VrHYh,CMQN!FBjl1ZVEPhjaCK)``"6,6JiU@@ekMjdmEEPI@M 3DpXKj3pi+f`LFFpIUPrF058)N4X)f4ZQ*P5c1[&!pGhC4i@Ue2BCE"bRL&haLRk Thb#ZUK&ZK-Kc9k4Z-[QKhdaf&1KhN!#*#IdZ-XfJhdPQ)I6l#![SYjD'HXp$hdA f$1LhNlN-r4DbV8$I8iS[RSEqj#URqY@$9b3dJG1XG))%khUHJMX,Vh896Z%"I%B PFK1MejpP2[@,$LpbTe[Q%h#[hhai0BBHF+r-MrTeL9G6k!!IKHa1rmf2qMf,9c6 d)%I[5Hq$1hVVq60(`H@-9fb&cfkb$BBDc1-Ck@@#jrVH%0cXH$@cIK[C#F&2Q9X [qpl(HTpEQ9F`KqVA3&iYS3Pl6#ARpIXMVpCP6[+ma`PkbJPkbJPkbJPkbJPkbJP kbJPkbJPkbJPk1MHKTlbJTlbJpqGlF2RNe4CD`1XDTfUZEYjDHE@[F0T$,KbK"Vc mA!9AAPiGS3Qjm[HQi+l-LraVj'p1i3&mcNKce1@eZ4pFX(PY@1(66rD18)Im"eF YAJ1K#AYcK92peXpVBfM#AZAIKi*r&r$U$"h)dkhp2[JI!kp0S3GjhdZZV))A!43 jH4kk(TLQKF4pTXhHI!ITRb%hcX3KfeN#**1EI54a"'@Z8(9Dm%D@b"Y#qhm!N!- 0!!PRBfaTBLda,VPM8&"$,VN!N"#ah3#3%!9X!!!I``#3"2q3"&"56dT,38K-!3# TY1))Uc!eD!!!@F-!N!B563#3"2$I!*!)22J1`2KbNQaPEr+hGEX``Jk!Vpa0&eT RDl*eSGZ&%EEAc@iGG+hAYBDRapHZd6ETQH'lV2AbpMVJ4lN,ck0G4lMb)fcKAQi *AeLhm1)VRfPGM,"Zi8pBG1%a3VYZi@m,@rM#2'iAfhjHacE,K"[bJGYB,ZcNP&# "$cqJ[fRG`SmXR'aMC-H6r-)AXTaNHE+Fj"HkN!"0"R[G!H4jITB&`!(!dKX"PZ# Z+PX+S(dCS&YGZI3,cN3L+P4H)V5R@D3p,54$JD"3'!j')mhRcl%mUJ)9e2PVUaF j[6lNX)ll!4,jajb6UrZK!hSTX[caD`$ZIHl,pdeVm&EaLeKG-YjQB6AKT)84pF, kB$+55%ID`b-4QF0T19ckfSl,d['15$X-4cTr0"2!dIR5%1j[S4JQa0,J4lT!pkc "EjcQ2ZmmNDF36,1DH)X!8($N3ihbR+mcX1GC!E!0fi)+ra)rCUL`#HU&V9)ke`6 IhTB!b&RK%B!&4fA8Ecr8+8IBcr)4Z8L+$bmVaA0$-Lr)$3+SMf0Xkh!%1L(hiM$ H56i!P'Q(V3ZXrmCRE,f[6f'0N!"Z$E6%fl(AqCL20Ka-#kRdjh`qA&CRACe[!5i +PSiKjh)6PJM4H$#5%&U%HF#GqF0F$MM6fH)T68dFSQ!hQ*["e3hGME'TS#e`Fmq Sl`'0qRTZMfEcM@b8M`(hV,a,kqB4N8iZ[4Sh5b!9ddQpT9YP#5UK!NX`BDbr,"E !TME)X#08Bm,*$)fP2Ci@G1bTGUbETe@@q%4QL60h[2d5)BQGX-U5,*6)q)99'NX bP3a1pJZTH#BC&"!P%4'5XP`!Fm82LidDE@#h&eejC#m'cSQd"k1C&S(CD`*"Va" S%C+TmmkE6aJ*6S3kTd8)4GS&PNjQ"#DY1419T&!JQT+cV-0*5@'9$$5+K-58Y"% N8Ea'&)q3!*!!UeBZ'qd'!&14D",LQVJ'$qTI1DUU3$%0cAD!e9HMkl`KaGAASBj TJ#pMhSb5Rq0c+LJ3l3LJkD2dcrJM2Q%3Kh&mZL-JR(&m+L$L-)j29b,%B4br8)j X!Y$j4ZUh`)[eI!A!R(d!4AHG`LH[d[f@re6*b2mAI`)H5F0aI+2XYq2iC)+N`6M qC$b5"Z2ij,N%KHI*24K!$k@Plm*Hm'Rd8-bci0h@*rK6m%JDM[-[aZ1Nhq+IKNH UJA&mE-V&'KM(2a129!2Mq2,5(2qIrSHmNfTSR2rTH+3D'XHRfL81irM8FE,Ep4r eTUeM[5Ra8bilkJJ6f!)lF0e(0'p*Cke+2Nq9ccEjh#UIZq6c&[RmM(3ZV*!!cL0 k&5l"Jp4$Ilc)-m$9BDMqeV0m$l6LhM(EAX9A,10lG,aR)2GNb6Sm29&b0@CfmMd &Mr!pHLh'hX&p"qiPVV#h)jIcaN(YAHVY!-im,lH&lp&Fc$pX!KD$+,qKqbMQh", @BjDAX[M-KFF0&bH!le%r'GC@E`LVXP9mKXdeG)3QcED[U18Vq4jY2c-fD8XFl$a Jb0pEdXPRCYXVR!e1c(f%qF`GKAUQcPT3T6E-YjCF2GYHhq#[aqa0'*p@XJl4r*8 qM(Fa(e1(MAb2DUZDVTq-SD2mJ+kFAj*ldAQmX-KFQf"C5i,E1fA&P2jHj`!8*c4 Cbq,eU+LUqmriLrQ-H$8"RJ(GXC,YKXYCKk(M!EcN!3MV-HG3b@DB@MEAd"P5,9[ 2CjDYplkH1ckr$1D5aNf'jH[,p0ehXaPCKe@(eI0#11SC',UQT)X9K3qD(G8hK#c C@GQUfADhU*AQPE#2X"A&i-9KaAUdDe$"bpQU)@mfJNfL,U61YQ4RBFiKFac+[hC Y@49Fi(Ye4UjKII9Fl[b`UM[(Ca+6ZhF[@mq`0Seer)R3*#Y$$IcK`pPc%EI6FKZ I`IV"'%bLZK'Mdl!5jqQ+3J!feU'k*f(FZf(EGY@@N!!CGAmMqd9@CrDD68d'jf( 3TlQV6AYhAEJlGh4$epjV3bSqBiDXKA!BPjeTVUYp1pI,DPfESAK1"2eSD[B-elh H#"KCEIFl0K-Um0E-CFr[,$HC6Hhc`fDr-eb-HmN5*`iSE-8)!#TL+mfKpUV"jrc $X6fMXIlRYZ5'5$I94YXX-&C(`""L$Dkf)VmVe*%)GZr'mh(#3i3EqlYKNKblRf* '9fi`h"aV43`ejERI0DPfA"MDB``XX)HHa#bYS3h1c!hCcPlQ0+mDh0Yr`mEU8Hk YrAmUXCIMj8SFBkA%6iNVCjRI%C(IMj&E3@l3G[C&a#hGId-rBQbXrT)c0e6q'2p eC)89`[fJmPd62,qrh"5fBCA-$%rb1d1R5hbj`ddQ1G,60%Q1l'T#EqB1)110@)h %i!95M+ekEiM0HfqSHM1k9UQY&%V$jTQPB&VZFVm*4FmG"[Acbff$#qbZ,a3IKUr B"VZ2A1J-[B%elK$paa&k8Z63JaakNVNdL$c1fP%+A`QGIJ'bm6iH0ZklkX(0S"E 8jP*3Mb,[3pbE@&fLD'2RS@ZY1`pG"kj1X1j#2R9*X*QX*TAMbYcVef*YX2)T6FA Q@D$Hf'AE5@VBGSP+2*elSqN#9T4Gc"`I)"SMr!P3K8hPL)Se--@E+!*#j8qBAdA F)f`H'*JMT!TSH@V*`'V2IZI1K@DpeEljYRXA2YJ9eU,IcfjLaVQJjXS%LTUELM' UNU1Q*M@HTVX(FV[-AA`QqadqFr3i9[JU81PlSB$r%d$A3iqhZfXV+KG!GjBeeU( [-cfI+9deX0(XqqDqeeCrEqGcqm6iUPf$i$#AQd`B@p0rSjJ6NR2d'hX'fX5-"MQ MU,pRS%(-F-NCDZeUk[$*BA*h$2XG9RaZHj-D6bq3!1YJC6AD61@QEFZ@lXi09,[ #3r`40LMRE"V0'C!!FecYKJh1Q(D[`hN%90BLbX@@Y!c8C8j3QmY!ApD)[GhVGTJ **CcApF6MTA!ZjkemqUrh9AKG,PI[cVeVI+q#h6`$QIm$kKcXmZ"@c&ph+[pbaRf +-2[6I1-)JqV1YQR9UpZ-&Cd9Uc'6i5P6JCdV6"8c-TKV%$1eQ*@af2(L22GJCe" VaTDFcfaEffcXh1Pef-$Pm$Vic)0VQmqbL$(+mRVQJpGcr8kVcZZakIJ-9F5"VJ2 A)XVacTfpDfd&ZhSY"9l2XleH6rpD3Epa6E1D10FlQJjH!G34SPGS&qM3*fC3Pe2 L`2L%lVY,CV!*T39qcpXH[fHHVQRU'%UAhk2&Qk`VKaD[,i2ZHk`cX2[6K&iQRrQ lbPXmS@QX)1Y!&RH`da"Y"8BfPYDc4GPC#3lV4AhlG+E(2&HTGaMM!VD)&65CaPL Dr4lQB&J09`k9kE(,mhf[0f[T[[2#[mfpH2-6*6k4bk,U5Z`kcd%Ia$UcfEZ2Z!G 1&'%PEF2B1aKl$'0hBH`R',X1BjX`pP1-h6AD-aHa8TJD0Z"T@[KdIJ$5L*0!R+1 )NmCi#mDEj(J5i`fS4KaV[49[Y[ASjjGJCfSIkdaR)f+)e-#cLpMMH4iTJQFE+B$ RFiN4RXfXNFpBZGXAc[3QM,G2Yh*CMh@3!(q8lFE6#ID-P'YZ"AefKT9M99N2Re% Z5UJ[cKd0UjR$Y@%N5eQr[bVdDANH1X3[2[#XjcJ0%Se1!jKa'U#f[M%BE`p&`TC @-mfEF*1J""c`J'Sc4b0!`0Q1cH9X!e(3aCl!)H`k4qIhpfYS1)*',+EMMLJR'JM *XAVRp4,L3*6EFHJLENI+bThcfZ@BBX$BV8U1Sr-@+@iljX&F'M+D6*J-'5#(%1k [1&EhlT'("@L3!%(&RA-a6V0,2#9X9%3D8*&8fT'k`V(k5V),NCZX$kh*MY@GDYV 4Y-8%c[bAlh!l-U6&69c*e@N4Mj-C)C2d+XbiMLZjUSJ3--Aq8HQ-$[R0RcMaPa8 e&lLqlpUj[TGS[iMVqri'VZr9AUl[KhZi[J-YA0r"GUl[d&eFhq'YA0rr0h*pEml RqYlHa2Ap"212)[Ba!pGh2-6e$Gc+p3dqbr80[FMe`hbZAjA&I4IA2aN0'##DQ-I F0B%8$M1bX*!!6V&dUi!$KD&N2-DNDAZFBic&F2BrKF2r6-!j%"D+4)8c'q,aD,f 3!-3j51B9SJP@RdlLA(j+(8X++A@L25E3BD9ki@,HV9l@i1F0$6KDbP$RC(bL'2* %ikP8)(QCZL15MXe30%"dDAVbI)DMURqBCV&i5b4dfDrbrk!LN!!@@#SGL#9B+*j N3JH#Y3HLV#@5r"fhhq@IS5Jp9LM&BLQF6+PSMTk2cbS%9c)KQ@5a90K#Sf4N5PN S5M[3da4hiQK)k+XiA(ND$YpSYSe-m)LIZ,6N5rL%!p$M"e)Z2G@JJJ8FXU,((EM pQ)@$C4*&(*ZN6`SqKSGP)q02Q+F@[iqA@RaFJFBHbCM4qfMF%h!%89`D('LN6e` k'KDkIh4i5)XM8r4*4)JcM9hKZ+)%Kcj2Rl4%aj+pAcSALTmN,qQmF&6[3Z`$k*0 %H%M18RJEF-b22R&0qM&+6,@P[&-a!BIik*1U!BGKe64B611lY)`iBNHI9"S+Ab9 l)JjKd5HT3V25,H+!P%`9Z`rkT%9kNCS1THY!pHQ6Q&%@$8)T99L%Sfhd5H*hI$J 64C28Y,C`Djl#m$6b!XGfTmrR*X8$d@L`Y6QkdK+%4i(E8[b59GP&,"cqQPC3ih4 MlA''N6k&X1iVfl4IfC%6%hNG3kaD8[4Nmd+LGcpXR+[Xb-XNFZZYEkLS`Q4G+Yd 5L413!'S-T`$1NR'U9P55`+R)+U%aM8!K9-"b-+[Xk$GR5FTkh)hN*rJB5@-L'EP %j(6IK+GdbSlH-e9"XT!!TkM$335*3-%BFqd`miD+#P4)M`VKJ,5STAS-5DFJ,A9 lRF6mdQ"V)#Q+K-c,[YUNl&M9XNEZ@PkXmY(k8'eCj+P3G[5T%69*)e+cY5@CqV" #$%SP0969B)9`fR3N*L#-jAfF#50kqURL8%pU-)M3+FmipZBILqkTH!E9YJip)aj %`mKhi"GMeDhkeqSZq1IU*VIi[,SeRcM3"dM$M['C$j!!BhcZ!m11mCN2&2k,$aK qi32[Hr5%Rh[d,hX-I&T(k6&F2UIBBc4(!m'9d93k(d+2NBr*-djj`D*SpBJAZ,f 9j!86F'3iZ$+9LDAqShqJf[jh,cLPbr2V[SPKZ8BUA*j'UT'@jR"M,2UIAFerUC* hbU&Hqqk24KaUB492qKV`$C4!&+Z"V#$rQ"GJ24rmKPrCa6X4KAZ0c$d@5+lmTal hVejS(qNI[*91V#iSP&p#b,2@2paR1A6E52mJe6FBBMJ1dGJL*2+9p3qIhj!![Bp M('C8fB"h)XK)5,I&%TpfThIZ`BHa&(9Vm2+9kL#QA,kQIZdYiIaLYrARRVV2f2q YNG[k'UGr%8DeBN-EK0EmEAlarTd(p5,rIHIa&j&hIpETLXk#R@jbC@-b,9jkj$[ SG20dc3jaep#MG,*Rm*9,kClGd#jFfLM2Qq@TmibVrRcNcU2@95h1CX5Efl"&%5r 8mURGV@U5ZdHGS,k4EYRemG4[EPCrFjZ4PqYQYFV$Li`LB4cI%5Ak4CIabTc4cV5 Z`5pfTSPdXM(B'Xb,d*RQlCVl-6rbfNK(iUpddhemB9))4J14@"k%hM42efh'efl %*i192U1qBE',qSa81Y2F(%qfjbIV-mbRlM2Dk!QiiGN-X@CeBXhQjHJG2R%#l)P %*m$r!"'46R)DGS+2k[XNTp(qiGGq@r81$FI)IYZ`[)lZM!cTba)YbQKh2VHq(T' iYATPahXMf583L9i#-b!5'SA3JP$LMk5FV"eL5P&e,)!2AM(fqq[&rAqqJEX3ZJ0 4GUAcq1#I[$MlrpXrj3jb$ZiY+2BkkdRM@qKR3r"mcb,mia%m2lM89dZ[Vqh!-,f QqNbpVjjZ29qJCq04M`2d!b+N'UT5MqGLqX832%q[Aej$mA2Gr%)2D,J,T!VQVUK `%6jhAB9V+HAI4,rjJHFl+Pb,m4eQEZZ5@KrPp5aF@N9GqC2+ql1S&YkPdTmG6Gr !qEV`09U+&4c&223NLQNk-DpALZNdR1mDqVXNM'QAB`crlBKL%mp(M*G"*FCZ`&J DZ&cZG*Ki-f,J@mmLMhX`*R29E-FB[Qe,XDNr4DlPFZc[1GrDKlkqQYkKeBBaYUl YEqK(@E3aM+N[HKM14ThU%2X*Hb(-`McNHXhpB"3j2BDaPJB6I!Ne%&qEaD`r`V` YU-G"k"3ar)MaKKaEKl'$NQC6hd1-Lq4B$Q0G-XB+e-BRajCJ,+'*V3bd4NrqAp, B[bJT[kddmXG*R(e#AIa5)9RRT[cr!`!!$3!*Cf0XD@)Y-LkjBe"33bkj!*!3qL) !N"!0"J!!,h3!N!6rN!438Np+5d&)6!%!UE6L#+X`0A!!!#*k!*!'$d%!N!43[J# 3#1j"$F$iCXbcEQ9ffFS2dS@*jbZl63NYVcACZY$0##1XPDZ$V[@ke[$dmVQ6K5h FYGEmE+(Rmc@246PGf0D9hF)@VNAi`VhS`KGM(GQA+lmmdfiI)f`c`Tq`63P23V[ Y`VEH`KHqX)9f(@(E*!Zrf-)@IZi)AhKXi3[E,M3j*432"&!HrHaD@&$M#f(,qq3 @XL1hN!$"3Rk6AcKCb%+1%di@J&@""TeG+a&(42abSQ*m9@@VL(4[%29TUPEGj%S NfN09'd1a&"q0T8,*F(-`0#85E)pZZ-eZrEB+Z[80G6A,A6ir2'5jYd$i*mlPdrI -@8-1XA6I6r6dUG[h&cAjUSAPI(dbhQEPDb0*+mqX6fN-*U1*9$3@'8GN$c0%(%0 GelfTH&Fd4Q0)jLrR%MNc2aM&pcf8d``Y,Ak!B(cHb*GQH1E2Phb'JLQq0Yi5)P* IZ&DMccNrDX`mDiN1BLbSE&MC!)B+3p!!(FM4Z3"pmf##5,64Fd39&fA9Eck6N4( q-Kr+TK`qGQ`-&dGPAb51%'Q'J"dB3bK$iZYMHPIm%$'QJ`j8f2l6cq5j@TmTYD& 8Dh0,2)CCjkGqG*&J+Y5CqU@IDmIQUUrh9q!`X*4GG$59b(1#DBYLrXT3Hc`B6B4 D3NZ)Zr'(SNLFq4ETPX+0#01J@-c9Mci&E"ETe"lZK'B2D682F5pVpcl#6cM0`cF VIh2RdI%LA6N'$6l@jXi1I@kfp+LX3395@i-*Bq1p(FdBDS-m*N)0#&FB@QXXRJV TqHr&d$F[UDca!YiDjchaf-C3%T1`bTUFNM26%1V@@T1GbH#dKP"R2*d-KU#5L)D 5FVQ)&NXr0"XEY)Prh,6j`NN!Fk+aB(Zk*F3lDTZ$[P"c5bMC1Arq8UD4i#5T15f KF$3@iP2*G)M2RB8&#LRFh0iTXfaMT'5S@aDD8))aK6DZ*"9[2BV(P+51c4hG,L+ c53S*k44Xa8Acmd49U9R$Xk-p6,4P'e,Rh4bZH3"e6"(G$Pjab5Ikh&MNk*3JKBH am`[rd,p4KJ)IdrpGAkQ!SYrdArSB+K6p(4q-kaYR%DeiK@MHTTrT+airpFpf(!c C6D6hMrH[fSGq[SpSi@NLdj2ApC8!q05rrM0pH5A%p,FGr*AqP!RpYPrTjl,kIr) Mrc0p)kiXJcl9Cb(1%'6hP`BRQ0MP'EU4U`lF@CCrSLp0(%#3!"HAp98B52*lSGq &ZrfkrM3CD5@kEp'%2R+m!*ldPFM#f(9p0R-`C#rdT5&)cLr`#Kk#rMULrlIXZ[j d'6P$Y0N+!(Y!54rDdc&h'$"brDYqB3l4$[hhr$0$4PE$2eXNb2ieb2fErJLM)1T RZCa*(rQIH68r2Xk[*I+#iKreEj!!r52r-kc1XRmYjSpI3ai@B(RaKIqI,BSqG$# E'MkH69X[ckB'iJEe$Qi`RhhAFB-&cq&lKKZFKRc"-D9m50)#'Z6Fp%2+jFLffS0 N5Tj%4@C5"GI&cC(ZFcD,h$e838lFZmM*m-eX'F$dP%A,,mqff[SF8$&N-KPiM91 9NF2XSa0J@f1fH(J8"hGPCVYkTSRLJ,V55r6R486P'%J,"U5PdFrVi(p*UM20Z#1 AjGIGE[0r"EdLeqdcjp[mNSplX,Y)hCYJ5aj0I@@G*jb-Gm65lHf-'iiR1d+aG!I M4Q-YACfKpTEfZ,40CpQLY-XkZ5B+lNFp6BS(cVppFXHLm)JE3biI%jRZ4TD29iR SY!R1P$QEBbjeBD*lqi'1GccMbIje'bEC1H@a56dI1a@*I@9pEqBF-qYcdaaAM`b 5FjP9B(QLVT*e4Aa$'kXN*T*FX[j[jrbLXcJ8Me@X&Eh%AL-JTT!!Gd4B3#S&rjI 6(0UBDSje*M'BT4+G-9BhC9*@-5jcH$[1@!XpJKl'$ZGDCHXmRb03ICB4reapCC! !(Mqj("6&rGSNfp+B@FQGKfZV'cfXb6ZLR8&V%2h"l5[mJ8hjJPR%eT0&kPUA"r- MPcHq*D-)FI[,GTp4[[$$5jiqJ&BGP+G#UkjaI6!H#dFM9NbNa28pDebXI1(,,(N ED'bUV!CChjPULFDCN!"U8NG00mXke@ZV@1Ge4VY$ke-3#PpeT"PAmJT`"+9)V,N pTl6IHLkVI,'RZ6PAIkpR2HXM[+GCRdK'0dVZpqGr6kpmXC'CT5KCd3'NL33K%LA eT(2pQ21Q5[3dR+GDX116UUkC9$)S5UXm2KGcINq`Y6NTP421bhiMS(ba5j&Vj+N 6f#aTQ1JNeElPhNVPLj`GVbDV%DYQDdZbmeS[j5Xpee4GLelLG+PS4`JbeUXka[& k0V$H4$f6H2FMHFHjNP0bI"Sd(Fh4'2DERk5`R-%10TmaEFjrI`$I68b$mrG)kq6 aHBBP*&LlQC0%8Xl9HQQfr9b!L@&XcMHPT*eJ*QI3,1Ibj`$iNqZ&q@YbPJ1Ha&! Tc3P+,rc(E-IjIaGE%9QEH@4l"'92bccba&FiN!#)&l6[jHikPAbI*GrYmVe9[[I )phhbr86Z2U8bGeIk!)'b%TGV)mAiNDCMGeGHc9GI%IUT&GqZ"BjUSA+ed+mA[-2 LXC)(FAZaC"ZB'D&IrCc3Ep!"HarI&r!YF8GmAD,SLj2'YmVA4CaPLEK2k0IH*6a V*Vk$fS9GI4I"H5aL!-[(@%*ka9$HA3N5qMA()VUDA4&9YPT)mi[cZX*6&cM@eJP 93VpZN!!h"R3P6RiqmI$[+mN)k3@15PH6#pcRH,qPD`T@&9NVUY3'[UeNf`)(%Um 4l0h!LdSHK&T$P4pi$qrR04'Md+mkS'(0E3aI&)EejF*+mAAAd"56T5l"Ckd*lZ6 dYG-("ec$9*M3CUehlN4&9Aer+0`PT+AR#H3GeRp3FMK[%pq9er8Y223JLKM!HEY N,mdU@jbA#DY@la65UhIkhK'(PTE4BPEM30kDR@@'[UIiiUc6TNIh["CTp`k2hPr 5`jXLjbc1QSI$eZbmE28#KdHUPIB[)RkQV95-AKqV@,pZ+bUiLHmHp@@M''(eB8f f*6X2R,FYF5Vrc4ePeE6)rfDaf,5cCM&h@d69*`VTa,5qikYhmZK0Ble`+6c9aU- '$C(cf9ZKQl&q68LMIi$490Bh%PU%6PbL0f'aB1Hl9(X5aT1l$Kj@l3YE82GhXer JkbdqLcQ3!1Fk6iB8YmemmZL+iq,&A6dRGi493YT#@5[6iERXA%YphBr&!El1[CF +&dD44l1b0lLIpNA*b0Ie[@mhS`,[c9hpkT&bXm8F@aUa0,JLKIL@V(3KLJm!)8* &l+8LDUmD1G8`KVdmJ3fHfLH1XVUTHZhcb&J6TE``hq4Z-c@i`ef*B0pah)HB(K3 H'HbMU6,f$BBChH*)C%0(+c3dM1IjL9Re`SV`bmEQ#NIi'&Lk[$Dk84behl,DCHN H16RiF'r0K2I@`Gr,ZCIaFJ8(9XVm+EKbPreGN!$mr6@mUF84qbhVQ,I8i-1$d1L YqD*,(#erAVJEVY!Kh&Y92c(6UfI+c4%lZQ4ZC'U$+c`cjjFl(c$,5(pJUS`F$5# EZE0`h)YZC!jHBaAMZcmFjCGm1&U$M9+Ne&j+T4(,h&)bVh&lrSC-Tmk6jY8epT% +KrZQ`[0dKhfNlm)+9rKGp,K6bKpRq*MNS4mHqT0LLL3I0lp35RH%Cbk#'pph)mE 6[h0S,fP#'NXTD5D86d2hbhap`Y5EHAZ(lFME$j!!1d1fSr"6Rb5lf@C@BB2jcJl d"Pmq29"SQ8HDhKll%9B0qe'T%Lq*l`B@mDEXREcc)d9M9,K%USLj(+VSJHQqK)Q BUR$*mLCd,r",+)phKPA01S'YCFRQb(lRkmXX"TYMlpHHARDS*k*$hLm)m'`$`C@ &''S*&!*9bDJjS-&YYQGB2'VT%G,Cl`MTLd2Sm'j5'3C),I`f)I@3!2%1,)HU+UJ [bkq[4qlc"L&GfMhFDr(rrZQrf[,p)kG15hMhd4&b@XV0CQ"E"aq41''CBqMY(fk 6'%db`c6B2p`N-G`b3k2E`LC4PM$L%f0jKiiA$`FdZ,h'8JHGYGjZ,MFIA,hUZ$K Fiik-#KIi%CQcHi)c,(2FXEaGVJlG5DIV!UPX*XE&5&T'QM)AD5aPC#KEMpRZ(3F @d#@FcrhLGd[T9XjApG)IRkldZGhZJ5-RYrVI*)HP'-lr3A8KTMck#[J2AZG[`VV Jha3@r)a[((G3NfNVUYR5CUc-9'i"NmFYABR*P@C*M$5iH4*6"eEDLVfl+"l+"(8 @M14#qZ$f$FE-%Cr66QkRcbQN$fhIF,09`KM,jee+2Zp$4fakRpHZ&p+X)mlfR0d "PD(-NB(YG[A4!D[DjheP`1FGh"ibp'lGS''H'jf"FrF4Q`L4&ES+2A+LQ%dj*8l JqAe2P46cqDAU"Zq2[3hH*IV!V%Q9RJD[$Y[IcD0hlLbM[MffBNarf[!E,'IqV1S aElL)9fHGF2%%2`0UDi(dPMEbbl2c%Kck4I2iE0i!RV[80kDaL&r1U`2Q5CH@"Lr [j0%0QdI,$*Mbr0mIb&Vl[VlL6mAA(hfaa#pj@9j6KDPc$R)3I@Chp&h`$&mbSC- 1!RXIf22!RJ6fYm!H!,BEf0m"Hh*LCMEaT63VNSGE8@5Q-%`Tk#5JFa%k+H!Y`!- bRJ6HK'V%dHZYf,SBN!$R'c'C1LBRd`93$,0Ui1jQlR&I`LU#Zje9!2GEQ52F,Ia k)@hM(PmfejF`2MlEaQ@pYK(Kfraah#la*h*F5bXCXX8fMUr1HS@dXLKKFl&i-D, KRHjGikbVar'Y9la$l2RB6pmR,LdS'+0CVLaC,H`"dT@r%Z!F2cScr3P3LVMhU0$ RDQ6lXmIBIJ6h2FZaT-(pd#Tr(GX$[`!BEfIS4+1rNEepHBe0*1LCXfaR!QFkYKh "[C!!E89`RpfiTTEKYhU%C9l5FSYb1eVZ[NShdqFHU(5[B[`[Xmd%lNp8ZZr%``V Z`-Sk2q2e,eY9c6DeamCH2MPq""hf),AJ0Z`'mAk4BHU,`2"fN@(D$$6B3eKJHLe ijh+BEJhfCmrNX"X@BR0iMP35pJI3b"!RLM2TKUm#`jj4mR%B@%X1Qrhh`&k8X3q "I82'4(M5h,f&[F[64H#l[1e2f"XKA3FdhPMh,0f#,XX(PR*-SARJ23cXC6*+rTj ($GBeQHQ,U+Ad,JkXA`G[(hJpP*%d'S#PC1a"B'rNDPDX"RC'a[6!hT)eeX&I3XE f-%rDMYpUEQfrmLafmJQYmYTfr+%XjmL[Mpm65YCl'2rr!!d!#'GMG'9cG#kjZ@0 38%-ZZ3#3%%0D!*!3(m-!!%+&!*!%rj!%8&*25NY"5%`"!+QdiJLV-$9B!!"5l3# 3"K+K!*!%$I3!N!Me"!i!pCQCc1abX2*Ef-,&mj8EA@KjV4fRQfkf--,fZP@[Eld Z$dq2VmN'A5Bp-hbAY9lHAJFXfQdl+AG,Z2)ME*&GEJRrA-libQIDl@-,fic`*fc 6K5HKhAEKE`YIq-)mEQiRK(pXXmb@iapGq-+kKCfFELT3q1c,IZ&ZXPf1@pl#b%) ffjdZC,)F@FK#&m,)B+r,!D4[CPq-FBbaqZ@-eH&@A,@%-I9,M(@V+THFE3i'I@, PFV%p`R[E)f,)lA5*'SmV)SBMaKm`"H(DkkSAQQdeb1%*lP8%I"Kcj(3rX&H6m0M IZTkaqjrj`UCT$PZ9X*!!V`m&fSamV5GNj#ReR!CAb"Z-H0XpDBqF`ePa(%eGaiT )S-2EcP+HcTr1B+bXmm9Kh'q$6Mf`X[$"KF4R$RhYV2*CXk3m49H%V`fdL)`T"cl J+-2j13Fpcq@-E8&E8'&IE%H%!Ne3,pZF#1HDf2Hf""Q,&l1('*Yr8%EphJ1GXSF r%JrNr)3rGBV*(aq@mf,a)FC8Kq$ER2+`6KCr)B9h0"r'+0,%0Xm[rQdqSqFB2cQ eBU69f4*S4krcbhc8LClZG$iIR'*cIAh0I"abUXM3iXkAEq$(ilQ,49r!j3f+,H) maNhp56c112ejNK@"P6JkPXIB&fjK8aKcR!drZX6iG+jqq&li[TdQiqM4U(!CR@& rGU+(,&FBA8QAdZJ+kKT@q*eSAPdm1Mm9!Sj'C"RE!a%aQhqm(IAaK-)B'-FE!ha jS(fj'%,(Uc#'FK,*f-@9@FC3113DEaI$J@M)*3)Pk"9$i'!+Qm`pccf[0,(*#J2 h%ZcNS8*JE#k(6ij38,[0q$[cVaRB"FIjhRDA,pSLmUCDTmXQ1P[%8(M@V%X))mK *81HhL'j[ZmK(3P'46jb,ab@$h%jI@)iU6J@&a*8bd!J5%NZ'TC%NDKY",5%K9lA %%1kQ%f8Z9IE(4kQ5X*9Mq!UPK%dirih2+53-k[E(m!QELQ!-Rl#ccq$6B)6Z-I` FQ(52iC0Hd6f'2a&QlKPm`YDG`5GX%V)aI-*'%r+rq)3prJ`qB9260)C2f"21i"- feI!B2QRI@@I`#A[5'Ic*-1NH`dIV+GeMrFY8Q(52j8mG(mdXar#TGUKe(X1R`pq T1G'EYSlfTT4IFZ446jL-RfpLA2G!eYX*@kf3!1dTXPdLfkfbh5AE'fAlbB5G8j' `4rJkCZFXKT(SUhpj-0jKc0+KVIl1dd)2DmAG-GY8*93X&AUb"HYJr,'#0E!H,EJ 1NCe#Mr)KS8HMKZmGh)rJ,V"iE"haZ#h!9,BPYJl''HE&0`Sp@9F+$qSClfFqB9h h3F6FlY%JbNC43[653pSVJdcS86hQ89H[mbKL98+8Rk[YF1I00PeH*e3+2HTqAYH N,LMMCc%HqGX+1SASE&1&f@&'l%0mMD%M4m1VBND`e)EiiS,VCTXD(2B'40m'rl5 #08#c9pE!hmAAm#U26ZK4E&E48%VR2LJ-CTF+Lq-[Q!rPj"[UJRc-'14f6EKm3Rq [HC!!63aQaBb,eS*44IHY`T9#9"TN-1YJpRX&fl4AmahDMZpMp-1B4i1Br38Ef*5 LZGT1Yf,T@L'kG+hYpILK5iVBA1+i5A[CfL*0plhmp&KCF6DUCir(CadF[VkJLmr hl$189GrN0XCQaUTQQmSPVV*HpY33GT)apN++X4le+M"i0Epbf"EcSZR0GUYL,E' CL0P[#,$5,pp39-AQe,`b2HjB@cfAZmLMk)i,dH$ilTe,er+S69fpF0LG9mb$!l[ R31a#i(BDla#LU"ri@"l9MH5GKNUFPjh[CUb%le$F&p6Y@VGPQf+Mf`$HhiaG`0F EE!CpNpCmJ'NLh(AkA6XZh4NrZ+jVe`eZK4!eX*L4F(JZ0X03ArHcH#pICpR!*Pl XK4j0L8ffh'rc-KeIere1L4i-[$eMkE2E5r8'IIXP(S2Gl*Q)Zf#a'@X,Qq&K$)b 8&-E"[@,S'A[+pp5)VrqCMI&KiNfa[Q3Qde9lQGE01baYqAD,Zb2SkYi*qa$K!H( QrQk@*rZq5ckG*6lNDIDh!N0&FHA[kK@2A1Tq5ZHFEh)rKLLeYSe0M3qAR,I8E&J jY+[rT[A9)lQhp[p4)R[CAjVd`eG)q5Ap59[1Ed$+lfq3!*Xb2P4bhK@8@k6rTRj JV+rq[$NqA2U`m"9NK3VKAUem9mqHIDj8lbP"PFc`j0R0lNQ*I,N$6AVCdp18*hY f0%'EZEh)H$fUN6,B3ica+pmIjZHp2ebp!DT9@&,)#Mf''B9-IjQPr#f@rm`"TRV fXT+Kq5E,f4-2X#q@$(82A'Tf[iND,j2dTmcpQ*4$$h,S#F8M6-VMR%F+f4IGNqB J'pZ22,VGhpLkJDP%PD'3!+P'N!"h!rF@[MkB[ljcr`h&frIIb#bGV(J(mUN2X4* pX9j4GNhmp4Y3'hcTK+D*KTP-YEkVC$Za8E*$BZ+*q*Y0FrMmf#+ql$LLcLXFCJU 2[K5SU)%*YQ!q)e6KX1%9i!l`mjL@,h-VR'U"@M4@E)Vpm1i&"NfaDF-GpbrBfZ9 43qpR0r'kZ8c&&BRN0640K&FKHr90+PMRPJr'GaLkK'MXKd,di#&8q%UQd23bTI" 9"Y@$aT[+kbSUjl2Z'0pB$phR08+dF1AJHN20YhDrGZhcfjrC,IPAlKKLCBC5[4k q9Idh5c&Z18Dc[QH`6BT`b"(jr6f$$LR#)NHSe0H#a(a5Q2KG+Ee$aFHh0DPJl5( 93@8ePZK,p9Z@,YNC(kbfH)D&!Aj)MVPY*'C3MV'dDpHCrHTGCHB"TLM1TeLdU%9 -9@4Q+N-4da3eSVGlhF4QX!,1CRRd4iAX3Xj@qF4Il+k`@5b@hZfl9Y@m`Nb'kFM m(e%[4TI(rJ6aDdl'AmecRb,-rM4HPmkJZV0Y@[@eEEU+cSTV%FR$LPDJFf96T)J SBV95T"T4851Qcr(ieNkAfS!@ABKZ@GfXkpaZ+bYKPM*EQ4$GZVVj(+2NSbLEp4* QXhjcHh'fc9U5,85T)[CflEd"+)FkYrHZ,P(Zk$8UEGDRHfh@rY@LC[fUCKAPh&$ @Y1rVM$T#D)9kIMCdBMTe139Pm1GfheX`RFmY90UY2l2DVI1bQkD-SR6CVHVV',Y QH0(D)YCpAr&dG(pClTG)CrkkmRDVHaU[M*8KLl[iXi"f16cV#a[iKE'C33leSVV cA&k$1%ZK,B8aKer)+j[dSeNDl&DqM%FeA$0FT%'A9r0mEmcBIIHPIa9riGZ2&Y4 )Z5bXVN6AH6jd%(9@BZSH+"mmR)p+fJ,I1r!p$0mpm2dGI$I#GaYmI`rI25-pFcj Ib+CiY,#QH5B*Jb`#R#"`$J)R!Rm,r%fb2`5r!f`%81ZYQ*CVS1I,dCQD4M[6f8" d%aZ`,C3pl(R%#1`5BJ$fKC34E!2I+%5,Z6XAc,!&GAHH@mc&V-9$`JriRE!1mdm QBJfY6"1EAXca96'V%%d15UJ[MKrdU2JbblTde+I(r2fRV)GU*0F[GKFZ'6FZ&@C !@&e$S`1V*BfZ3,[Ekc'f'QM#1TGaI6mfFAd[dRd&lTYa2mhe[DcQqPkGarAYVFD pRq[EGj!!kh[Gb2@pdFVerHebVZqYjlLqJ6bZladIehI`(Ul[(a4Fhf(J[@rMqRk qJHZ,jh2ph!,FAqIkPGrNqY@YA,rQDG`$A2piD5R$)dE#I+49a0+%1a6`miQp3Qa bq2hBFJaMcC%A-H[Lh9kI1084#2JDa"!f3ALEk![b$C%30K$$+Rp)$+Z#lAk4M'@ U"BZ%FY95Keh3%Y-m5!m&aNNZUbm3$MY$+e3GhSKrHRQY-ib9%UaRb2XM&r&Bb[Q $#1m2Y(MG+riPr[FUR"'4$dHFrL$[$S4iX30Jl8iIhq)0r5khhm926M)p@LJ6T9) i'P,4l,[)jI1kP[&L+-6l`aiMMHaaP!k@(kR(!$5jIF64)2HV9c"fkm2Bb8M[NA, 5*ahe$KKB9T9'TSPBKI4**`H4UR2Kk*+M&9J[`FHC*Q&NUD#pVUA83F[45Jadk'0 F3Yf1$dpTM65,Hfl&AGM3!#1U'a&eQabGKF82I&eA%c-D$%HjjT%"U4TMFAb*[&A h)@)HETXFRBf&$h`V0NVHj1U3!,`K#cY(qL511H*j`3MI14L%iN0H')LU%pY@kEb e@+I!ap@!&jDr$K6[395bNR+a,%&ISM6!LST@Uj*V5MUX3Y#A)"$4+kM@NKY`il$ S30pF$R`T#q@S*(BHeKMSieHp#Flf)`,0AQTaDcb@&2)PHQQ)5fb5Xdb1cXF+!Vj N8DB2,Ic5f4Kjid'T!M!XRlE0,$48%8&NcjVeLhiPLG[pfVbedR#BF'qX0CFl+(- SP#2N$)DCki1*FLTMEYAMF%qMfLlECUkT+5IZR$kIUlACYmcS)YhC12(&iZ3YB9' @5Q5*+ZHdkID)X$BCAmp+hXKTKT6AHm#U3r4C*hSQB(BrU*ZE[*&EJ[hH"NF&f1H b`j%@Ei"`&+-i5TRYhSDUbbZ*lE"hTGJB!9#%@0JA5pj3Yh-5l&V,'fQFRq0a03C $hZ956TYb(mp1hP#k+8NN)bQBbZ-#L*FT4c0ATc*h9&5!)3dB`XSCTF08SdMC5D3 Pj6BcCAk9Up8CNNK#jN9IDNVH8!QCSr)k39+0G(N`aFD&eSVN$99-XdNF%CZY,D( `"a@L69D5SkS@&F+T)ekr#"MM-CcF0*pfUMM`5Hd-*A450pjlk`mPT8VU"Y9h0R3 Mi#,4b)#J'D-9V[Mh#PIqZX**-8jAH0BrUp"aT*4UR0)#8Sh6@T!!8Se6@T!!maX Yd(kN"FGd1[HIG2TA[3DH,8Mf'TBDXp4V02ZFVQ8q2,U3!#'KemM%T"XRp@#KVcU Y"q@f5Y+$A#aMZCD&Srj`4S3qiL3hckljPY445pa8@+b09#FYcCj'[bpc@BGcr'Q !%69iq@)m[C*8URU(RG4!'ib%'PfYVS`*8j,-6"h[aReIXbG[D8k5c,e@cYh[$#h lT)pilFFr65[(JLU"+N',p`QF2Y40KM[Pq2-plHN1e&CT4R@a((P61@0C"rU4'Q` blVmMh8FNDTaTr9MRD@`4JjR-qSM6-pGM1,T84T8160L3!*%BDI-(2jh'hIh8YR5 r8BZ42Y@"2cR5GhfQ,m$+0,B(FZ(*qFCchdR[JG5Dl3[K98[0EFBhc6Jf!k'Hj$p R)(rUIIG)ebZT#lVHd,,'8%3DJQ5UfdlEP"@LKiU5A8P9!ff@U2hH-(@biF`FQ[( KV+6++NJeiI9JS(a#A@K@FPTGe,p@Pj4QR&)AdSc6kT,5M&2U3T15dqU5QT4mULl T5FPrl#eaeipXJ`L95k4YN!"fmDV'M(FlXp`hrMJpBDZc9%XlCB(Q0M6#dJJhdpT %2bZdFd30'KTT[d-6#2rA22prCQFCZHEjar[pNj2C69PYp)K@DM)V+8'fT!3C%RU 0$!Sc%%F&0K8NII&jQb@NScQPp1@%DKc0DD4,rDbV-ccd@PV(lCAPY$H4%a*G2UI ARl'MdM)(c3+5MpDF8)f1Rr4*kNc)faB*9I4DMcVDlZfJPej1UXfAEck8RMde1"C Ci0@')p(QjN#S(A*Mr%a[J*8"E)T3G!%pL5YhHBl+"RVj4bhpa)5,Y@G#d)*M[FH rp@3IGap(N9*kF+TlbrUSQrlA5IIaD[aidXeYj&CVNMH83&CM+!&9RaC+%&Q"[`% !PM5C'9(,)ph(*fUTr9!YMqT9DV2iP&iGfErj4+r'r8D[mMkHFibb02iMPNjf1PA [d("$VLh(CI8d(p1LX&VN*cJbP(8k[pfF2kE#ZPqTX(51-%LC%ZXU[a22)[*i8[E rZJ[cIcUGL4G#pHMBk,e2kCF0VX,2PP#E5Iik[#T1$qmHrqXJc[6'Fa2`XLUETTM $*YV-$D3cYp12%m#qEb(qhJ$feL8eGE5PqJMF0!YqXU&'QZAY39+9b(8[r8`"-MX Ah$6![T!!ITF!pTb'bfV*EbNA&PMaKL[H#UA+i@kTX"!qGeH&C3R&EkCI&X"$k6d 9PN9@f#m[VUY"R%+aB%N90%@4PhahPUZj([c3IkY-$A%eUr''+[Q8"m(LQS3[kcE 1G+!PiF[1j8b6mBiYqG4I![EZK'rFji"Ab"55leDmdYV+9*,[$[MHa&2kj,XIH(K 90KkIa-Ep'I$!Tj5(&h&2b4cN`,G2pSf$$kqZ5Vi*m(hh+pHLCV(B#pqMEAp*2`L K$S-ce482X[1!F4&mDd`jE#EL`-(e-DD6q,X(FCd12IXm1+#IdU#-2SFi1q)HB*d 54KI`ANVie'C`8jVJFZTNa%85A%ip'ebqP1"bkZr$jj-acJ0'8-Di!,i@'@-Q-2E *q68KTiMXZ`ja[9RqCFj@hp%rG"RpQjINMlqNrpQ&-qA@"ki53rAP&2rr!!!0$3p YGbpRBh4PFh3Z0MK,,VN!N""453#3%#pd!!"+8`#3"2q3"%e08&*0680$!3#V,jH ZUc!jB!!!"M%!!"R%!!!"V3!!"E(*MaZS!*!'[VXM4!iL+Pj0j%)PIdhl9fbRBC! !DR1(JAFp3hUJ2KNcZ@(k&LeHlIYc*cMM1X2GRCf"!*`N(81C&iAQNTm4&Ifii1" EpGII4h6#PiP+'R-jb[e$&IeM12rA3hh-XBk+D2XK9#@U!P9e!@eRU22XRT!!%ar %6jaP3[FjFKhiIjQ@hidE$&25cAm$`-IrIXai*1U*jZd88q%pXX1%F$M`RNJbAQS ih%%N0J*@A""6p[pE#%1,cL9X%K8j[Z%i38$F)*'R%8!QpTQQT&06TCMf4amme9+ jii[1iC(HE43E%aa#QlrCjZ4[GSL(8*!!e8D-E"#r6LR@&GN3aF6F'028K*cdTGk aT$fkUhhK6F,P(Tj11!CFTLJ+QQSXDINp,M$RL-+Cm9q6j"VK+Hr'rhrjXB16b1@ iec&AC&Z,)bAP)A[QZNkT`brFF9bj0@L(b*(4H3)$i*YCbh9`YK90aj%$0a!Gm&! ,de[B3!XlC'%$"-Eme,D0'(Z229-8DlB`9Q$FC!Y6@9L'KA%@PQm[")V0YM#PKBP $[mI#m!L#i#MfjAH50i4eE512Q3bj@@90I4m!N!--!'XcXfpJlh2Ij$4lRaZHF-P a`Tr-D)4&@%FjIAiV9hi5rZ3i@3NqRhV5`hI'm8m[3MNjENHi%AjN`!NMR"`rbB$ bTrc)FA,m$%r*F51Fm*03FTa`FTa`-Q#%%hlN'4R`Pa`RA(+FF+mMamRa)mq2m$2 #bB!#GjN8B'@Y6-+0iUpN*rl)-F)*2m)*8[#%!j-9H"9SN!!()1QkKK#+`Hm@K$S HJ&m,rN[#E`hmIJLEJ,q0bk)PQTCS@&q4J@q@4d"9U,FU)md-(0Yrf-'kLSC3Ech QTZ6PDfM!,6kXTJh48"8c3%-B$Af2ZR8CG9Ip2$-35k-p#&9[4Zd)$4`EE%%G46! ,R0"9-23T99CN34j4,-#2%@HJ4P(6T'aDQa#N[iMDX5G2a3J5j8hqU`G8AI)J-HU [2pc+8DXTel3Q5K1DDDe`rC'MeMLS#5QV5"2QC-jFKV@(Y,XiDUf$'TI6Q941+fY NIrEXmabeMLSdTZC&6Ae8m48krm8h(,@HFXdUSU`BRMk!q[lRHBlD3,RQ4#QENT@ #"cXRI2X+4ie6jif)dMfM+mkEUadrc9%E(G5'h+TKlGFqRHHS#3He,LFDrPe`h($ QCBlDa(3e*P+'jG["RP9riDM0,PI9V"`8d09SikJYP'YH1C5kHVfHlZ'SDkKIpI4 i+LIkaJ28)bpbe,88e9!N694cCG6ZNqFjkMUUN!"T6DE6ZT(h&AViKGmikRVU"NX TAdR(H9q1FY4@bY@D,XL9SfF2rY6286HiPp,*+'9G,aJIFG50p#Uce14Gj3Y'd81 Ek"h5cFV&)blrQ+1f8B8b8UTJU&0#eN-9cVh+8GXGe*U-j!-kU)P6p4b9*UB'dj* PCDb-E#IIrF$K4qBkCkfIRK)eFi@ZrFEXr4ae-h@$T1I(e%`C&K,!AUi3T&L#1U` I'P&bCG3h(rRp#Fje+d8&50fBrKHeFp&j@4Q5M3GV$pea1eGSfk+(0$9pa80R1GF ZCkfce*a5FDbGI1mKMRSpifUSq482fFRj!BlD6Id+#UPkaDr(MfcMU0YGVSSeRLY 8Z0V[F05H43q4)19lk0aM"lL(GMKViS"LkT1'T(MH+rPeTkZ3!*U"!([&H8FjkLl +0@RS306mKfX[64ZJ+`31D"5@fGUaCaUiVRd8Y@!C+5NVP42Ef6h&a0E[S,D5e*Z k$e*4k[,4R"1qUq@S0cKV-k$Hk86c@fiEqT2V*rYSlLHcfePEppip1YM9Hl2Del9 2!&`"@TQ,U#F1&[Z''jdelZ4b1(ZHmdimH"0(45eR)(&!*q9f)f6q6PCX0VTUBad IAd$pf!@`[ik1Br'KUlR)+fakrN"cHF(H36)2h%jb&H(+NrX0&jMF9VMIj$*$&L) T"p)0cLf`Yq1%"AXR6JQ`Yq'FKMf0GB,GdbRXPYLiZ+lq4#IBL8k`%jeJ*cV"6R5 #RHJ%1p%*GU)6l%3Rf)P1h%qc#+[@Y15RS-eL8qhT&"fJcd&k4dVkK,dC'pb'AVi MRZjKXmB'HccD3(IrcJ8G(KYmfk)&p1R"5Hkrqa'fKQc`$Bdfm0&Ek'dF5*Cm&25 6E"T+qQc(16M5i"iI4FpKHCCb3p#-XSR6I3[1YF$(e@dVrAm(hAhGA,f#1a4fVQ` D)a0bM1IcX19PNiJXd-QrQrjp$rTP0Nh4$ljDEE6C0*GdfSPEQNJ$[AaI"9dkQjE )"&rjZ5PSlpQXL6c)65I42'&jkHi((6HE659pGY(F%GhJrk#CBp-AQC!!QcfG`RF BE0C'2GbTm18(Qh@4"hI+cbI"'a-fkb-2I05,Qq*VI86`ZS90Dq6"IEUNPpZrZ6d IkmP@hp@`f9$5UmK,"LjZ2dGjKIdd'pTRSrf,Re6[[[HdcbYXX0R3aK[KcVI)#mr A-dm"R8jJFcLjAc2T0r!1Xr%Ph(NRKdhm"Y1PM9qd9#9(PFc#![X)[SNKr!e@jAm !N!-0$3pYGbpRBh4PFh3Z8&"$,VN!N"!4c!#3%%+&!*!)rj!%68e38Ne33d-"!+X [PkkV-$P&!!!'-3!!'Z!!!!'T!!!&bE5F%03!N!B"fL0%$L)UANhN3L9r6IYAE+G KN!"UFiH"Gce$HU!q'61jBIV#iB$[cjhJM1X-GhH'!`%ib6Q'-Lm+c58r)bVkFF( "YqU[[irS4$#9MENFjIkKL[iaR2rVS6lQ@%G&Y2d3UK*9JDUkJ,Bce(Pf6fJm&6R b2Z8HRJiXa'A+ir""h#2TreqK*11PKX-G4'@dI[MrP@fl(cXiL9b1Haec4BbeKmP aeJj"iNA$iL1d#Y1J+HR89#QQrG%86l98l[LLFhLNlhad)NaL2JK&0pZFr-d1m4! +XYS)fcSm[diTeKAC%-A8h"M6e)5Fp+AHXD3p1ZNm1FY%rabj$[`E!$0bi`E$P26 rG@!p"$aQr-JXH*CjLX,-Um9UPGj1-5VH)fY@`*(4VHaDSf,&r6CPrlq&--R1K6X *#r!9a`Q#"HZ@0$hdcLR&Z$Fm-LN%a%6I)NG'j`NF&EkCY9`(CaX9iFL4(fpK!IC B8#c-*P,XP1dG-@D4KE%@0XR#9"C'PcdhhF,ZXE"3#eYVB3-&a[CDHNU"FB-@YXI #PPJD!bcX5f0T(aH0)DaV'hR-C-M0+Q[Uq``!Da0l'f3fmMSr"jhCCQZ%N3NRNdf 14LJRP"rPR[a@3Sqr%8D1NjAJmk5Hp2#G-Ic6Le"1MJm)Pachb(2###I(6c*J%8k j%8k1RiHRj,J46[K*+$P11$P11"P3`JNrmS`-q)!-Z'6!D6eKj2L4C`f-F$+J`(8 Q"D$m9QE4e,T1r"&qK,q%%k6J#3FQ+c!qS%%HJ+LU#N)S",rE%'S`i2Fjq"D$ha, iI4qf+2P[K53BJQi)Q['&0I#IjBQL)Y4CP"42pjcUHm,'ZSf'8'HBF--Ck@qdLS0 b3K-d'HXH'L*+S#ZS9C93Dp(hThY##E32SH*'Y!@KRP2p0@MV!TJ"6QM*DZUi,'% T+JeJ!r"$PM03TD!SBLUKM%E&Qd60d0-c)3Z*mVDqK3&9&I13!!6eTfr[iUM&P'Y #%F4446G@Z(l(88YXe)LB`Z+S2TE@Pf(0!mTp(,A84Uf3!",*H&STD'4qmZcc(,@ -+M3XC`4&IJbl#Phql%Z1'UCF8eL3!,#@e`G3hrdd`e(,+GHd)+EL%XlQBDHLAlh -85ZSm`B%mB'K&HG0PBjFj+L90QTjHXf`jUXI6h28L)eDPKBdpblBE[Mm*BjDaA6 94Z1DiGV"R*4rj+M9$PGCAcdSS+ZfQD2@8+iCI$4qqhSpdmj4DkPIeF4)2#fiaJ2 8Bbpbe(889F1L)XMT!QVVKFXFYBiUT"YMLB5UC9b&(RhKCikkRVV"`)8VDEQKZf- V4kfRA)f*V,4kp-cqUedFGB0c+Hf-8Y$eQ[B"4pe)Vc*,6IQVI%eEm0!QHSG8IIA L@5lrN!#MEUCQhhrr8(p,Ec3@kie#4,V"pIbK)a`9-T!!GBlk-`E@KJ84,f%LG'i f[T!!!'KLUKNie$XiPM(N0&lQH[KU'dGYS"j+L['X*Sp(8hPGSl0R1'UMM9U5&&e !'c8b%qDSN!"L,3rTKL6Ki3+b'A[l2CZI0G[Y06`a,LMk#PhcpFQ(1'S6pDZSCSE PC!&fUR[r&Uj3-eASS(Td!+F,U1H1r2)8jpT#83&5e5EZS1kBGej+JZb9Kc82h(- h9kKehN1+R,MPS8ZFDjZpPPPABF@aCZbG`abeRA(9j-b+KmcBG!p(lD"q"B9NGG@ [CimeFp5G$PGXM+5cUec0YcMUVRN2@9(2pG$Xii2F3jhf'KR%ZMUQL6M[[CaIGcX +b8Q)f,HFGj+MGP'Z-8d&S[SrA2I32!5k3L5#cQ1CV4NkAXjer4pehS"JT*BMJmh eq+jHMVUAFXdD@Pa-LB8NHQRI3K)PI3p-0D6jHqhb!-,0lkJIrAq#kpTYIkZh1S$ iJj!!%H0,"hSUqR8TjiTU6d$LH!3qd"l'QVp5(*Z0MQj%N5IR8$IK#2YVk#b4%AU KAhRjVG*[D*cA0T*HB1mJp`hf9R+*B@mR9a,f0R*MBGp1mJVX655"`0j)XK,X1mL pKlf"*+irG2*l,$B1E[#"6T2S$,#X@[56ejba+FlV&"bJcm2dMZ6dm6Xk0U4jAES MHGhp&Sp0DH#"lZkGmrT#0Q@"!rVX)TRXhr[K0j4X`S%(2RS$[3RXDKCpj(@KE-T cqZ`NL6E3i"kI4160319LE["D@$B9G'mQ#4Ai1,Ued1qGG(GeFr6blT!!hqqbU3a -b$&jRrZ0-TY)B)&1lYedll[ACE1T#Rl`e9TlcUBkTp0ZdVF%-H4Z[lGR8a1Bi#X h0hN["GM8"KlNTJYSfQ*jrHjlI6UE66PpZQMZ#'l`[pH@XGNEQ*!!Qr-kq@mqf+` ,HVK6rLX60R@""hI+c5IHHaBfk`-2I,5(G,jrpK(H5aSfpB%(pqQkANlrj[4mV#G EHm2$CN01V`9H%R"aqMR+bhpj`iDqe%&p8bAIR!qTj%[4$kpFY(MK'lcmYcPXk&Z H1lcmlTi0lIT[mPVbJIFUL!elGjRM4BM8c8"+#$@"@kr%qK5GrJGH8d5JeDSp%6Z S`aY94TZmpLQ+$H(Nh"cl%r`RK-KrL#Vr!3#3!aq$!!!"!*!$!43!N!-8!*!$-Tr lRLe!rr#`!,K[$#eZd!6rm2rdd"lm`FAKdkSV8FY+$deKBe"bEfTPBh4c,R0TG!) !N!06594%8dP8)3#3"P0*9%46593K!*!BUc!jI3!!8M8!!!&'"1"2l'mDG@6JrHc K@5U#NI*HN@GK!Z"2kQ`FG&2UN!"S!!,L@5[48(adA`CdC!EJ6qj[8hJS!!EJEHl LEe5!)D$!FJC1ANl!*IrX51FI-#D`jL63G!*&0K!+1Li!&Ri!)VX-S"lbUKQJ(Z` 3!+SDI!$!#3ZT8,aIE!!!Q$!'8!6"aG!!N!-3!#X!"3%B!J#3"`-!N!-"!*!$!43 !N!-8!*!$-J$j(l!@#J#3!a`!-J!!8f9dC`#3!`S!!2rr!*!&q@G%'@B: synopsis-0.12/src/Synopsis/gc/typd_mlc.c0000664000076400007640000005764111104702315017654 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * opyright (c) 1999-2000 by Hewlett-Packard Company. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * */ /* * Some simple primitives for allocation with explicit type information. * Simple objects are allocated such that they contain a GC_descr at the * end (in the last allocated word). This descriptor may be a procedure * which then examines an extended descriptor passed as its environment. * * Arrays are treated as simple objects if they have sufficiently simple * structure. Otherwise they are allocated from an array kind that supplies * a special mark procedure. These arrays contain a pointer to a * complex_descriptor as their last word. * This is done because the environment field is too small, and the collector * must trace the complex_descriptor. * * Note that descriptors inside objects may appear cleared, if we encounter a * false refrence to an object on a free list. In the GC_descr case, this * is OK, since a 0 descriptor corresponds to examining no fields. * In the complex_descriptor case, we explicitly check for that case. * * MAJOR PARTS OF THIS CODE HAVE NOT BEEN TESTED AT ALL and are not testable, * since they are not accessible through the current interface. */ #include "private/gc_pmark.h" #include "gc_typed.h" # define TYPD_EXTRA_BYTES (sizeof(word) - EXTRA_BYTES) GC_bool GC_explicit_typing_initialized = FALSE; int GC_explicit_kind; /* Object kind for objects with indirect */ /* (possibly extended) descriptors. */ int GC_array_kind; /* Object kind for objects with complex */ /* descriptors and GC_array_mark_proc. */ /* Extended descriptors. GC_typed_mark_proc understands these. */ /* These are used for simple objects that are larger than what */ /* can be described by a BITMAP_BITS sized bitmap. */ typedef struct { word ed_bitmap; /* lsb corresponds to first word. */ GC_bool ed_continued; /* next entry is continuation. */ } ext_descr; /* Array descriptors. GC_array_mark_proc understands these. */ /* We may eventually need to add provisions for headers and */ /* trailers. Hence we provide for tree structured descriptors, */ /* though we don't really use them currently. */ typedef union ComplexDescriptor { struct LeafDescriptor { /* Describes simple array */ word ld_tag; # define LEAF_TAG 1 size_t ld_size; /* bytes per element */ /* multiple of ALIGNMENT */ size_t ld_nelements; /* Number of elements. */ GC_descr ld_descriptor; /* A simple length, bitmap, */ /* or procedure descriptor. */ } ld; struct ComplexArrayDescriptor { word ad_tag; # define ARRAY_TAG 2 size_t ad_nelements; union ComplexDescriptor * ad_element_descr; } ad; struct SequenceDescriptor { word sd_tag; # define SEQUENCE_TAG 3 union ComplexDescriptor * sd_first; union ComplexDescriptor * sd_second; } sd; } complex_descriptor; #define TAG ld.ld_tag ext_descr * GC_ext_descriptors; /* Points to array of extended */ /* descriptors. */ size_t GC_ed_size = 0; /* Current size of above arrays. */ # define ED_INITIAL_SIZE 100; size_t GC_avail_descr = 0; /* Next available slot. */ int GC_typed_mark_proc_index; /* Indices of my mark */ int GC_array_mark_proc_index; /* procedures. */ /* Add a multiword bitmap to GC_ext_descriptors arrays. Return */ /* starting index. */ /* Returns -1 on failure. */ /* Caller does not hold allocation lock. */ signed_word GC_add_ext_descriptor(GC_bitmap bm, word nbits) { size_t nwords = divWORDSZ(nbits + WORDSZ-1); signed_word result; size_t i; word last_part; size_t extra_bits; DCL_LOCK_STATE; LOCK(); while (GC_avail_descr + nwords >= GC_ed_size) { ext_descr * new; size_t new_size; word ed_size = GC_ed_size; UNLOCK(); if (ed_size == 0) { new_size = ED_INITIAL_SIZE; } else { new_size = 2 * ed_size; if (new_size > MAX_ENV) return(-1); } new = (ext_descr *) GC_malloc_atomic(new_size * sizeof(ext_descr)); if (new == 0) return(-1); LOCK(); if (ed_size == GC_ed_size) { if (GC_avail_descr != 0) { BCOPY(GC_ext_descriptors, new, GC_avail_descr * sizeof(ext_descr)); } GC_ed_size = new_size; GC_ext_descriptors = new; } /* else another thread already resized it in the meantime */ } result = GC_avail_descr; for (i = 0; i < nwords-1; i++) { GC_ext_descriptors[result + i].ed_bitmap = bm[i]; GC_ext_descriptors[result + i].ed_continued = TRUE; } last_part = bm[i]; /* Clear irrelevant bits. */ extra_bits = nwords * WORDSZ - nbits; last_part <<= extra_bits; last_part >>= extra_bits; GC_ext_descriptors[result + i].ed_bitmap = last_part; GC_ext_descriptors[result + i].ed_continued = FALSE; GC_avail_descr += nwords; UNLOCK(); return(result); } /* Table of bitmap descriptors for n word long all pointer objects. */ GC_descr GC_bm_table[WORDSZ/2]; /* Return a descriptor for the concatenation of 2 nwords long objects, */ /* each of which is described by descriptor. */ /* The result is known to be short enough to fit into a bitmap */ /* descriptor. */ /* Descriptor is a GC_DS_LENGTH or GC_DS_BITMAP descriptor. */ GC_descr GC_double_descr(GC_descr descriptor, word nwords) { if ((descriptor & GC_DS_TAGS) == GC_DS_LENGTH) { descriptor = GC_bm_table[BYTES_TO_WORDS((word)descriptor)]; }; descriptor |= (descriptor & ~GC_DS_TAGS) >> nwords; return(descriptor); } complex_descriptor * GC_make_sequence_descriptor(); /* Build a descriptor for an array with nelements elements, */ /* each of which can be described by a simple descriptor. */ /* We try to optimize some common cases. */ /* If the result is COMPLEX, then a complex_descr* is returned */ /* in *complex_d. */ /* If the result is LEAF, then we built a LeafDescriptor in */ /* the structure pointed to by leaf. */ /* The tag in the leaf structure is not set. */ /* If the result is SIMPLE, then a GC_descr */ /* is returned in *simple_d. */ /* If the result is NO_MEM, then */ /* we failed to allocate the descriptor. */ /* The implementation knows that GC_DS_LENGTH is 0. */ /* *leaf, *complex_d, and *simple_d may be used as temporaries */ /* during the construction. */ # define COMPLEX 2 # define LEAF 1 # define SIMPLE 0 # define NO_MEM (-1) int GC_make_array_descriptor(size_t nelements, size_t size, GC_descr descriptor, GC_descr *simple_d, complex_descriptor **complex_d, struct LeafDescriptor * leaf) { # define OPT_THRESHOLD 50 /* For larger arrays, we try to combine descriptors of adjacent */ /* descriptors to speed up marking, and to reduce the amount */ /* of space needed on the mark stack. */ if ((descriptor & GC_DS_TAGS) == GC_DS_LENGTH) { if (descriptor == (GC_descr)size) { *simple_d = nelements * descriptor; return(SIMPLE); } else if ((word)descriptor == 0) { *simple_d = (GC_descr)0; return(SIMPLE); } } if (nelements <= OPT_THRESHOLD) { if (nelements <= 1) { if (nelements == 1) { *simple_d = descriptor; return(SIMPLE); } else { *simple_d = (GC_descr)0; return(SIMPLE); } } } else if (size <= BITMAP_BITS/2 && (descriptor & GC_DS_TAGS) != GC_DS_PROC && (size & (sizeof(word)-1)) == 0) { int result = GC_make_array_descriptor(nelements/2, 2*size, GC_double_descr(descriptor, BYTES_TO_WORDS(size)), simple_d, complex_d, leaf); if ((nelements & 1) == 0) { return(result); } else { struct LeafDescriptor * one_element = (struct LeafDescriptor *) GC_malloc_atomic(sizeof(struct LeafDescriptor)); if (result == NO_MEM || one_element == 0) return(NO_MEM); one_element -> ld_tag = LEAF_TAG; one_element -> ld_size = size; one_element -> ld_nelements = 1; one_element -> ld_descriptor = descriptor; switch(result) { case SIMPLE: { struct LeafDescriptor * beginning = (struct LeafDescriptor *) GC_malloc_atomic(sizeof(struct LeafDescriptor)); if (beginning == 0) return(NO_MEM); beginning -> ld_tag = LEAF_TAG; beginning -> ld_size = size; beginning -> ld_nelements = 1; beginning -> ld_descriptor = *simple_d; *complex_d = GC_make_sequence_descriptor( (complex_descriptor *)beginning, (complex_descriptor *)one_element); break; } case LEAF: { struct LeafDescriptor * beginning = (struct LeafDescriptor *) GC_malloc_atomic(sizeof(struct LeafDescriptor)); if (beginning == 0) return(NO_MEM); beginning -> ld_tag = LEAF_TAG; beginning -> ld_size = leaf -> ld_size; beginning -> ld_nelements = leaf -> ld_nelements; beginning -> ld_descriptor = leaf -> ld_descriptor; *complex_d = GC_make_sequence_descriptor( (complex_descriptor *)beginning, (complex_descriptor *)one_element); break; } case COMPLEX: *complex_d = GC_make_sequence_descriptor( *complex_d, (complex_descriptor *)one_element); break; } return(COMPLEX); } } { leaf -> ld_size = size; leaf -> ld_nelements = nelements; leaf -> ld_descriptor = descriptor; return(LEAF); } } complex_descriptor * GC_make_sequence_descriptor(complex_descriptor *first, complex_descriptor *second) { struct SequenceDescriptor * result = (struct SequenceDescriptor *) GC_malloc(sizeof(struct SequenceDescriptor)); /* Can't result in overly conservative marking, since tags are */ /* very small integers. Probably faster than maintaining type */ /* info. */ if (result != 0) { result -> sd_tag = SEQUENCE_TAG; result -> sd_first = first; result -> sd_second = second; } return((complex_descriptor *)result); } #ifdef UNDEFINED complex_descriptor * GC_make_complex_array_descriptor(word nelements, complex_descriptor *descr) { struct ComplexArrayDescriptor * result = (struct ComplexArrayDescriptor *) GC_malloc(sizeof(struct ComplexArrayDescriptor)); if (result != 0) { result -> ad_tag = ARRAY_TAG; result -> ad_nelements = nelements; result -> ad_element_descr = descr; } return((complex_descriptor *)result); } #endif ptr_t * GC_eobjfreelist; ptr_t * GC_arobjfreelist; mse * GC_typed_mark_proc(word * addr, mse * mark_stack_ptr, mse * mark_stack_limit, word env); mse * GC_array_mark_proc(word * addr, mse * mark_stack_ptr, mse * mark_stack_limit, word env); /* Caller does not hold allocation lock. */ void GC_init_explicit_typing(void) { register int i; DCL_LOCK_STATE; /* Ignore gcc "no effect" warning. */ GC_STATIC_ASSERT(sizeof(struct LeafDescriptor) % sizeof(word) == 0); LOCK(); if (GC_explicit_typing_initialized) { UNLOCK(); return; } GC_explicit_typing_initialized = TRUE; /* Set up object kind with simple indirect descriptor. */ GC_eobjfreelist = (ptr_t *)GC_new_free_list_inner(); GC_explicit_kind = GC_new_kind_inner( (void **)GC_eobjfreelist, (((word)WORDS_TO_BYTES(-1)) | GC_DS_PER_OBJECT), TRUE, TRUE); /* Descriptors are in the last word of the object. */ GC_typed_mark_proc_index = GC_new_proc_inner(GC_typed_mark_proc); /* Set up object kind with array descriptor. */ GC_arobjfreelist = (ptr_t *)GC_new_free_list_inner(); GC_array_mark_proc_index = GC_new_proc_inner(GC_array_mark_proc); GC_array_kind = GC_new_kind_inner( (void **)GC_arobjfreelist, GC_MAKE_PROC(GC_array_mark_proc_index, 0), FALSE, TRUE); for (i = 0; i < WORDSZ/2; i++) { GC_descr d = (((word)(-1)) >> (WORDSZ - i)) << (WORDSZ - i); d |= GC_DS_BITMAP; GC_bm_table[i] = d; } UNLOCK(); } mse * GC_typed_mark_proc(word * addr, mse * mark_stack_ptr, mse * mark_stack_limit, word env) { word bm = GC_ext_descriptors[env].ed_bitmap; word * current_p = addr; word current; ptr_t greatest_ha = GC_greatest_plausible_heap_addr; ptr_t least_ha = GC_least_plausible_heap_addr; DECLARE_HDR_CACHE; INIT_HDR_CACHE; for (; bm != 0; bm >>= 1, current_p++) { if (bm & 1) { current = *current_p; FIXUP_POINTER(current); if ((ptr_t)current >= least_ha && (ptr_t)current <= greatest_ha) { PUSH_CONTENTS((ptr_t)current, mark_stack_ptr, mark_stack_limit, current_p, exit1); } } } if (GC_ext_descriptors[env].ed_continued) { /* Push an entry with the rest of the descriptor back onto the */ /* stack. Thus we never do too much work at once. Note that */ /* we also can't overflow the mark stack unless we actually */ /* mark something. */ mark_stack_ptr++; if (mark_stack_ptr >= mark_stack_limit) { mark_stack_ptr = GC_signal_mark_stack_overflow(mark_stack_ptr); } mark_stack_ptr -> mse_start = (ptr_t)(addr + WORDSZ); mark_stack_ptr -> mse_descr = GC_MAKE_PROC(GC_typed_mark_proc_index, env+1); } return(mark_stack_ptr); } /* Return the size of the object described by d. It would be faster to */ /* store this directly, or to compute it as part of */ /* GC_push_complex_descriptor, but hopefully it doesn't matter. */ word GC_descr_obj_size(complex_descriptor *d) { switch(d -> TAG) { case LEAF_TAG: return(d -> ld.ld_nelements * d -> ld.ld_size); case ARRAY_TAG: return(d -> ad.ad_nelements * GC_descr_obj_size(d -> ad.ad_element_descr)); case SEQUENCE_TAG: return(GC_descr_obj_size(d -> sd.sd_first) + GC_descr_obj_size(d -> sd.sd_second)); default: ABORT("Bad complex descriptor"); /*NOTREACHED*/ return 0; /*NOTREACHED*/ } } /* Push descriptors for the object at addr with complex descriptor d */ /* onto the mark stack. Return 0 if the mark stack overflowed. */ mse * GC_push_complex_descriptor(word *addr, complex_descriptor *d, mse *msp, mse *msl) { register ptr_t current = (ptr_t) addr; register word nelements; register word sz; register word i; switch(d -> TAG) { case LEAF_TAG: { register GC_descr descr = d -> ld.ld_descriptor; nelements = d -> ld.ld_nelements; if (msl - msp <= (ptrdiff_t)nelements) return(0); sz = d -> ld.ld_size; for (i = 0; i < nelements; i++) { msp++; msp -> mse_start = current; msp -> mse_descr = descr; current += sz; } return(msp); } case ARRAY_TAG: { register complex_descriptor *descr = d -> ad.ad_element_descr; nelements = d -> ad.ad_nelements; sz = GC_descr_obj_size(descr); for (i = 0; i < nelements; i++) { msp = GC_push_complex_descriptor((word *)current, descr, msp, msl); if (msp == 0) return(0); current += sz; } return(msp); } case SEQUENCE_TAG: { sz = GC_descr_obj_size(d -> sd.sd_first); msp = GC_push_complex_descriptor((word *)current, d -> sd.sd_first, msp, msl); if (msp == 0) return(0); current += sz; msp = GC_push_complex_descriptor((word *)current, d -> sd.sd_second, msp, msl); return(msp); } default: ABORT("Bad complex descriptor"); /*NOTREACHED*/ return 0; /*NOTREACHED*/ } } /*ARGSUSED*/ mse * GC_array_mark_proc(word * addr, mse * mark_stack_ptr, mse * mark_stack_limit, word env) { hdr * hhdr = HDR(addr); size_t sz = hhdr -> hb_sz; size_t nwords = BYTES_TO_WORDS(sz); complex_descriptor * descr = (complex_descriptor *)(addr[nwords-1]); mse * orig_mark_stack_ptr = mark_stack_ptr; mse * new_mark_stack_ptr; if (descr == 0) { /* Found a reference to a free list entry. Ignore it. */ return(orig_mark_stack_ptr); } /* In use counts were already updated when array descriptor was */ /* pushed. Here we only replace it by subobject descriptors, so */ /* no update is necessary. */ new_mark_stack_ptr = GC_push_complex_descriptor(addr, descr, mark_stack_ptr, mark_stack_limit-1); if (new_mark_stack_ptr == 0) { /* Doesn't fit. Conservatively push the whole array as a unit */ /* and request a mark stack expansion. */ /* This cannot cause a mark stack overflow, since it replaces */ /* the original array entry. */ GC_mark_stack_too_small = TRUE; new_mark_stack_ptr = orig_mark_stack_ptr + 1; new_mark_stack_ptr -> mse_start = (ptr_t)addr; new_mark_stack_ptr -> mse_descr = sz | GC_DS_LENGTH; } else { /* Push descriptor itself */ new_mark_stack_ptr++; new_mark_stack_ptr -> mse_start = (ptr_t)(addr + nwords - 1); new_mark_stack_ptr -> mse_descr = sizeof(word) | GC_DS_LENGTH; } return new_mark_stack_ptr; } GC_descr GC_make_descriptor(GC_bitmap bm, size_t len) { signed_word last_set_bit = len - 1; GC_descr result; signed_word i; # define HIGH_BIT (((word)1) << (WORDSZ - 1)) if (!GC_explicit_typing_initialized) GC_init_explicit_typing(); while (last_set_bit >= 0 && !GC_get_bit(bm, last_set_bit)) last_set_bit --; if (last_set_bit < 0) return(0 /* no pointers */); # if ALIGNMENT == CPP_WORDSZ/8 { register GC_bool all_bits_set = TRUE; for (i = 0; i < last_set_bit; i++) { if (!GC_get_bit(bm, i)) { all_bits_set = FALSE; break; } } if (all_bits_set) { /* An initial section contains all pointers. Use length descriptor. */ return (WORDS_TO_BYTES(last_set_bit+1) | GC_DS_LENGTH); } } # endif if (last_set_bit < BITMAP_BITS) { /* Hopefully the common case. */ /* Build bitmap descriptor (with bits reversed) */ result = HIGH_BIT; for (i = last_set_bit - 1; i >= 0; i--) { result >>= 1; if (GC_get_bit(bm, i)) result |= HIGH_BIT; } result |= GC_DS_BITMAP; return(result); } else { signed_word index; index = GC_add_ext_descriptor(bm, (word)last_set_bit+1); if (index == -1) return(WORDS_TO_BYTES(last_set_bit+1) | GC_DS_LENGTH); /* Out of memory: use conservative */ /* approximation. */ result = GC_MAKE_PROC(GC_typed_mark_proc_index, (word)index); return result; } } ptr_t GC_clear_stack(); #define GENERAL_MALLOC(lb,k) \ (void *)GC_clear_stack(GC_generic_malloc((word)lb, k)) #define GENERAL_MALLOC_IOP(lb,k) \ (void *)GC_clear_stack(GC_generic_malloc_ignore_off_page(lb, k)) void * GC_malloc_explicitly_typed(size_t lb, GC_descr d) { ptr_t op; ptr_t * opp; size_t lg; DCL_LOCK_STATE; lb += TYPD_EXTRA_BYTES; if(SMALL_OBJ(lb)) { lg = GC_size_map[lb]; opp = &(GC_eobjfreelist[lg]); LOCK(); if( (op = *opp) == 0 ) { UNLOCK(); op = (ptr_t)GENERAL_MALLOC((word)lb, GC_explicit_kind); if (0 == op) return 0; lg = GC_size_map[lb]; /* May have been uninitialized. */ } else { *opp = obj_link(op); obj_link(op) = 0; GC_bytes_allocd += GRANULES_TO_BYTES(lg); UNLOCK(); } } else { op = (ptr_t)GENERAL_MALLOC((word)lb, GC_explicit_kind); if (op != NULL) lg = BYTES_TO_GRANULES(GC_size(op)); } if (op != NULL) ((word *)op)[GRANULES_TO_WORDS(lg) - 1] = d; return((void *) op); } void * GC_malloc_explicitly_typed_ignore_off_page(size_t lb, GC_descr d) { ptr_t op; ptr_t * opp; size_t lg; DCL_LOCK_STATE; lb += TYPD_EXTRA_BYTES; if( SMALL_OBJ(lb) ) { lg = GC_size_map[lb]; opp = &(GC_eobjfreelist[lg]); LOCK(); if( (op = *opp) == 0 ) { UNLOCK(); op = (ptr_t)GENERAL_MALLOC_IOP(lb, GC_explicit_kind); lg = GC_size_map[lb]; /* May have been uninitialized. */ } else { *opp = obj_link(op); obj_link(op) = 0; GC_bytes_allocd += GRANULES_TO_BYTES(lg); UNLOCK(); } } else { op = (ptr_t)GENERAL_MALLOC_IOP(lb, GC_explicit_kind); if (op != NULL) lg = BYTES_TO_WORDS(GC_size(op)); } if (op != NULL) ((word *)op)[GRANULES_TO_WORDS(lg) - 1] = d; return((void *) op); } void * GC_calloc_explicitly_typed(size_t n, size_t lb, GC_descr d) { ptr_t op; ptr_t * opp; size_t lg; GC_descr simple_descr; complex_descriptor *complex_descr; register int descr_type; struct LeafDescriptor leaf; DCL_LOCK_STATE; descr_type = GC_make_array_descriptor((word)n, (word)lb, d, &simple_descr, &complex_descr, &leaf); switch(descr_type) { case NO_MEM: return(0); case SIMPLE: return(GC_malloc_explicitly_typed(n*lb, simple_descr)); case LEAF: lb *= n; lb += sizeof(struct LeafDescriptor) + TYPD_EXTRA_BYTES; break; case COMPLEX: lb *= n; lb += TYPD_EXTRA_BYTES; break; } if( SMALL_OBJ(lb) ) { lg = GC_size_map[lb]; opp = &(GC_arobjfreelist[lg]); LOCK(); if( (op = *opp) == 0 ) { UNLOCK(); op = (ptr_t)GENERAL_MALLOC((word)lb, GC_array_kind); if (0 == op) return(0); lg = GC_size_map[lb]; /* May have been uninitialized. */ } else { *opp = obj_link(op); obj_link(op) = 0; GC_bytes_allocd += GRANULES_TO_BYTES(lg); UNLOCK(); } } else { op = (ptr_t)GENERAL_MALLOC((word)lb, GC_array_kind); if (0 == op) return(0); lg = BYTES_TO_GRANULES(GC_size(op)); } if (descr_type == LEAF) { /* Set up the descriptor inside the object itself. */ volatile struct LeafDescriptor * lp = (struct LeafDescriptor *) ((word *)op + GRANULES_TO_WORDS(lg) - (BYTES_TO_WORDS(sizeof(struct LeafDescriptor)) + 1)); lp -> ld_tag = LEAF_TAG; lp -> ld_size = leaf.ld_size; lp -> ld_nelements = leaf.ld_nelements; lp -> ld_descriptor = leaf.ld_descriptor; ((volatile word *)op)[GRANULES_TO_WORDS(lg) - 1] = (word)lp; } else { extern unsigned GC_finalization_failures; unsigned ff = GC_finalization_failures; size_t lw = GRANULES_TO_WORDS(lg); ((word *)op)[lw - 1] = (word)complex_descr; /* Make sure the descriptor is cleared once there is any danger */ /* it may have been collected. */ (void) GC_general_register_disappearing_link((void * *) ((word *)op+lw-1), (void *) op); if (ff != GC_finalization_failures) { /* Couldn't register it due to lack of memory. Punt. */ /* This will probably fail too, but gives the recovery code */ /* a chance. */ return(GC_malloc(n*lb)); } } return((void *) op); } synopsis-0.12/src/Synopsis/gc/PCR-Makefile0000664000076400007640000000332311104702315017743 0ustar stefanstefan# # Default target # default: gc.o include ../config/common.mk # # compilation flags, etc. # CPPFLAGS = $(INCLUDE) $(CONFIG_CPPFLAGS) \ -DPCR_NO_RENAME -DPCR_NO_HOSTDEP_ERR #CFLAGS = -DPCR $(CONFIG_CFLAGS) CFLAGS = -DPCR $(CONFIG_CFLAGS) SPECIALCFLAGS = # For code involving asm's ASPPFLAGS = $(INCLUDE) $(CONFIG_ASPPFLAGS) \ -DPCR_NO_RENAME -DPCR_NO_HOSTDEP_ERR -DASM ASFLAGS = $(CONFIG_ASFLAGS) LDRFLAGS = $(CONFIG_LDRFLAGS) LDFLAGS = $(CONFIG_LDFLAGS) # # # # # BEGIN PACKAGE-SPECIFIC PART # # # # # Fix to point to local pcr installation directory. PCRDIR= .. COBJ= alloc.o reclaim.o allchblk.o misc.o os_dep.o mark_rts.o headers.o mark.o obj_map.o pcr_interface.o blacklst.o finalize.o new_hblk.o real_malloc.o dyn_load.o dbg_mlc.o malloc.o stubborn.o checksums.o solaris_threads.o typd_mlc.o ptr_chck.o mallocx.o CSRC= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c solaris_threads.c typd_mlc.c ptr_chck.c mallocx.c SHELL= /bin/sh default: gc.o gc.o: $(COBJ) mach_dep.o $(LDR) $(CONFIG_LDRFLAGS) -o gc.o $(COBJ) mach_dep.o mach_dep.o: mach_dep.c mips_mach_dep.s rs6000_mach_dep.s if_mach if_not_there rm -f mach_dep.o ./if_mach MIPS "" as -o mach_dep.o mips_mach_dep.s ./if_mach POWERPC AIX as -o mach_dep.o rs6000_mach_dep.s ./if_mach ALPHA "" as -o mach_dep.o alpha_mach_dep.s ./if_mach SPARC SOLARIS as -o mach_dep.o sparc_mach_dep.s ./if_not_there mach_dep.o $(CC) -c $(SPECIALCFLAGS) mach_dep.c if_mach: if_mach.c gcconfig.h $(CC) $(CFLAGS) -o if_mach if_mach.c if_not_there: if_not_there.c $(CC) $(CFLAGS) -o if_not_there if_not_there.c synopsis-0.12/src/Synopsis/gc/atomic_ops_sysdeps.S0000664000076400007640000000046211104702316021716 0ustar stefanstefan/* * Include the appropriate system-dependent assembly file, if any. * This is used only if the platform supports neither inline assembly * code, nor appropriate compiler intrinsics. */ #if !defined(__GNUC__) && (defined(sparc) || defined(__sparc)) # include "atomic_ops/sysdeps/sunc/sparc.S" #endif synopsis-0.12/src/Synopsis/gc/stubborn.c0000664000076400007640000000260611104702321017663 0ustar stefanstefan/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* Boehm, July 31, 1995 5:02 pm PDT */ #include "private/gc_priv.h" #if defined(MANUAL_VDB) /* Stubborn object (hard to change, nearly immutable) allocation. */ /* This interface is deprecated. We mostly emulate it using */ /* MANUAL_VDB. But that imposes the additional constraint that */ /* written, but not yet GC_dirty()ed objects must be referenced */ /* by a stack. */ void * GC_malloc_stubborn(size_t lb) { return(GC_malloc(lb)); } /*ARGSUSED*/ void GC_end_stubborn_change(void *p) { GC_dirty(p); } /*ARGSUSED*/ void GC_change_stubborn(void *p) { } #else /* !MANUAL_VDB */ void * GC_malloc_stubborn(size_t lb) { return(GC_malloc(lb)); } /*ARGSUSED*/ void GC_end_stubborn_change(void *p) { } /*ARGSUSED*/ void GC_change_stubborn(void *p) { } #endif /* !MANUAL_VDB */ synopsis-0.12/src/Synopsis/gc/setjmp_t.c0000664000076400007640000001013511104702317017653 0ustar stefanstefan/* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * * Permission is hereby granted to use or copy this program * for any purpose, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ /* Check whether setjmp actually saves registers in jmp_buf. */ /* If it doesn't, the generic mark_regs code won't work. */ /* Compilers vary as to whether they will put x in a */ /* (callee-save) register without -O. The code is */ /* contrived such that any decent compiler should put x in */ /* a callee-save register with -O. Thus it is is */ /* recommended that this be run optimized. (If the machine */ /* has no callee-save registers, then the generic code is */ /* safe, but this will not be noticed by this piece of */ /* code.) This test appears to be far from perfect. */ #include #include #include #include "private/gc_priv.h" #ifdef OS2 /* GETPAGESIZE() is set to getpagesize() by default, but that */ /* doesn't really exist, and the collector doesn't need it. */ #define INCL_DOSFILEMGR #define INCL_DOSMISC #define INCL_DOSERRORS #include int getpagesize() { ULONG result[1]; if (DosQuerySysInfo(QSV_PAGE_SIZE, QSV_PAGE_SIZE, (void *)result, sizeof(ULONG)) != NO_ERROR) { fprintf(stderr, "DosQuerySysInfo failed\n"); result[0] = 4096; } return((int)(result[0])); } #endif struct {char a_a; char * a_b;} a; int * nested_sp() { int dummy; return(&dummy); } int main() { int dummy; long ps = GETPAGESIZE(); jmp_buf b; register int x = (int)strlen("a"); /* 1, slightly disguised */ static int y = 0; printf("This appears to be a %s running %s\n", MACH_TYPE, OS_TYPE); if (nested_sp() < &dummy) { printf("Stack appears to grow down, which is the default.\n"); printf("A good guess for STACKBOTTOM on this machine is 0x%lx.\n", ((unsigned long)(&dummy) + ps) & ~(ps-1)); } else { printf("Stack appears to grow up.\n"); printf("Define STACK_GROWS_UP in gc_private.h\n"); printf("A good guess for STACKBOTTOM on this machine is 0x%lx.\n", ((unsigned long)(&dummy) + ps) & ~(ps-1)); } printf("Note that this may vary between machines of ostensibly\n"); printf("the same architecture (e.g. Sun 3/50s and 3/80s).\n"); printf("On many machines the value is not fixed.\n"); printf("A good guess for ALIGNMENT on this machine is %ld.\n", (unsigned long)(&(a.a_b))-(unsigned long)(&a)); printf("The following is a very dubious test of one root marking" " strategy.\n"); printf("Results may not be accurate/useful:\n"); /* Encourage the compiler to keep x in a callee-save register */ x = 2*x-1; printf(""); x = 2*x-1; setjmp(b); if (y == 1) { if (x == 2) { printf("Setjmp-based generic mark_regs code probably wont work.\n"); printf("But we rarely try that anymore. If you have getcontect()\n"); printf("this probably doesn't matter.\n"); } else if (x == 1) { printf("Setjmp-based register marking code may work.\n"); } else { printf("Very strange setjmp implementation.\n"); } } y++; x = 2; if (y == 1) longjmp(b,1); printf("Some GC internal configuration stuff: \n"); printf("\tWORDSZ = %d, ALIGNMENT = %d, GC_GRANULE_BYTES = %d\n", WORDSZ, ALIGNMENT, GC_GRANULE_BYTES); printf("\tUsing one mark "); # if defined(USE_MARK_BYTES) printf("byte"); # elif defined(USE_MARK_BITS) printf("bit"); # endif printf(" per "); # if defined(MARK_BIT_PER_OBJ) printf("object.\n"); # elif defined(MARK_BIT_PER_GRANULE) printf("granule.\n"); # endif # ifdef THREAD_LOCAL_ALLOC printf("Thread local allocation enabled.\n"); # endif # ifdef PARALLEL_MARK printf("Parallel marking enabled.\n"); # endif return(0); } int g(x) int x; { return(x); } synopsis-0.12/src/Synopsis/PTree.hh0000664000076400007640000000071011125155555016640 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_PTree_hh_ #define Synopsis_PTree_hh_ #include #include #include #include #include #include #endif synopsis-0.12/src/Synopsis/PTree/0000775000076400007640000000000011172123233016307 5ustar stefanstefansynopsis-0.12/src/Synopsis/PTree/Node.hh0000664000076400007640000000554711104702314017526 0ustar stefanstefan// // Copyright (C) 1997-2000 Shigeru Chiba // Copyright (C) 2000 Stefan Seefeld // Copyright (C) 2000 Stephen Davies // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_PTree_Node_hh_ #define Synopsis_PTree_Node_hh_ #include #include #include #include #include #include namespace Synopsis { namespace PTree { class Node : public LightObject { public: virtual ~Node() {} virtual bool is_atom() const = 0; virtual void accept(Visitor *visitor) = 0; //. return the start address of this Ptree in the buffer const char *begin() const; //. return the one-past-the-end address of this Ptree in the buffer const char *end() const; const char *position() const { return my_data.leaf.position;} size_t length() const { return my_data.leaf.length;} const Node *car() const { return my_data.nonleaf.child;} Node *car() { return my_data.nonleaf.child;} const Node *cdr() const { return my_data.nonleaf.next;} Node *cdr() { return my_data.nonleaf.next;} void set_car(Node *p) { my_data.nonleaf.child = p;} void set_cdr(Node *p) { my_data.nonleaf.next = p;} virtual Encoding encoded_type() const { return Encoding();} virtual Encoding encoded_name() const { return Encoding();} protected: //. used by Atom Node(const char *ptr, size_t len); //. used by List Node(Node *p, Node *q); private: union { struct { Node *child; Node *next; } nonleaf; struct { const char* position; int length; } leaf; } my_data; }; class Iterator : public LightObject { public: Iterator(Node *p) { ptree = p;} Node *operator () () { return pop();} Node *pop(); bool next(Node *&); void reset(Node *p) { ptree = p;} Node *get() { return ptree ? ptree->car() : 0;} Node *operator *() { return get();} Node *operator ++() { pop(); return get();} Node *operator ++(int) { return pop();} bool empty() { return ptree == 0;} private: Node *ptree; }; class Array : public LightObject { public: Array(size_t = 8); size_t number() { return num;} Node *&operator [] (size_t index) { return ref(index);} Node *&ref(size_t index); void append(Node *); void clear() { num = 0;} Node *all(); private: size_t num, size; Node **array; Node *default_buf[8]; }; class Atom : public Node { public: Atom(const char *p, size_t l) : Node(p, l) {} Atom(const Token &t) : Node(t.ptr, t.length) {} bool is_atom() const { return true;} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class List : public Node { public: List(Node *p, Node *q) : Node(p, q) {} bool is_atom() const { return false;} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; } } #endif synopsis-0.12/src/Synopsis/PTree/Lists.hh0000664000076400007640000003003511122312026017722 0ustar stefanstefan// // Copyright (C) 1997-2000 Shigeru Chiba // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_PTree_Lists_hh_ #define Synopsis_PTree_Lists_hh_ #include #include namespace Synopsis { namespace PTree { class Brace : public List { public: Brace(Node *p, Node *q) : List(p, q) {} Brace(Node *ob, Node *body, Node *cb) : List(ob, list(body, cb)) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class Block : public Brace { public: Block(Node *p, Node *q) : Brace(p, q) {} Block(Node *ob, Node *bdy, Node *cb) : Brace(ob, bdy, cb) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class ClassBody : public Brace { public: ClassBody(Node *p, Node *q) : Brace(p, q) {} ClassBody(Node *ob, Node *bdy, Node *cb) : Brace(ob, bdy, cb) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class TemplateDecl : public List { public: TemplateDecl(Node *p, Node *q) : List(p, q) {} TemplateDecl(Node *p) : List(p, 0) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class TemplateInstantiation : public List { public: TemplateInstantiation(Node *p) : List(p, 0) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class ExternTemplate : public List { public: ExternTemplate(Node *p, Node *q) : List(p, q) {} ExternTemplate(Node *p) : List(p, 0) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class MetaclassDecl : public List { public: MetaclassDecl(Node *p, Node *q) : List(p, q) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class LinkageSpec : public List { public: LinkageSpec(Node *p, Node *q) : List(p, q) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class NamespaceSpec : public List { public: NamespaceSpec(Node *p, Node *q) : List(p, q), my_comments(0) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} Node *get_comments() { return my_comments;} void set_comments(Node *c) { my_comments = c;} private: Node *my_comments; }; class Declaration : public List { public: Declaration(Node *p, Node *q) : List(p, q), my_comments(0) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} Node *get_comments() { return my_comments;} void set_comments(Node *c) { my_comments = c;} private: Node *my_comments; }; class Typedef : public Declaration { public: Typedef(Node *p) : Declaration(p, 0) {} Typedef(Node *p, Node *q) : Declaration(p, q) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class UsingDirective : public Declaration { public: UsingDirective(Node *p) : Declaration(p, 0) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class UsingDeclaration : public Declaration { public: UsingDeclaration(Node *p, Node *q) : Declaration(p, q) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class NamespaceAlias : public Declaration { public: NamespaceAlias(Node *p, Node *q) : Declaration(p, q) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class FunctionDefinition : public Declaration { public: FunctionDefinition(Node *p, Node *q) : Declaration(p, q) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class ParameterDeclaration : public List { public: ParameterDeclaration(Node *mod, Node *type, Node *decl) : List(mod, list(type, decl)) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class Declarator : public List { public: Declarator(Node *); Declarator(Node *, Encoding const&, Encoding const&, Node *); Declarator(Encoding const&, Encoding const&, Node *); Declarator(Node *, Node *, Encoding const&, Encoding const&, Node *); Declarator(Node *, Encoding const&); Declarator(Encoding const&); Declarator(Declarator*, Node *, Node *); virtual void accept(Visitor *visitor) { visitor->visit(this);} Encoding encoded_type() const { return my_type;} Encoding encoded_name() const { return my_name;} void set_encoded_type(const Encoding &t) { my_type = t;} Node *name() { return my_declared_name;} Node *initializer(); Node *get_comments() { return my_comments;} void set_comments(Node *c) { my_comments = c;} private: Encoding my_type; Encoding my_name; Node *my_declared_name; Node *my_comments; }; class Name : public List { public: Name(Node *, const Encoding &); virtual void accept(Visitor *visitor) { visitor->visit(this);} Encoding encoded_name() const { return my_name;} private: Encoding my_name; }; class FstyleCastExpr : public List { public: FstyleCastExpr(const Encoding &, Node *, Node *); virtual void accept(Visitor *visitor) { visitor->visit(this);} Encoding encoded_type() const { return my_type;} private: Encoding my_type; }; class ClassSpec : public List { public: ClassSpec(Node *, Node *, Node *); ClassSpec(const Encoding &, Node *, Node *, Node *); virtual void accept(Visitor *visitor) { visitor->visit(this);} Encoding encoded_name() const { return my_name;} void set_encoded_name(const Encoding &n) { my_name = n;} Node *get_comments() { return my_comments;} //. The list of base classes, i.e. [: [public A] , [public virtual B] ...] Node const *base_clause() const { return static_cast(PTree::third(this));} //. The following assumes proper C++, i.e. no OpenC++ extension. ClassBody *body(); private: Encoding my_name; Node *my_comments; }; class EnumSpec : public List { public: EnumSpec(Node *head) : List(head, 0) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} Encoding encoded_name() const { return my_name;} void set_encoded_name(const Encoding &n) { my_name = n;} private: Encoding my_name; }; class TypeParameter : public List { public: TypeParameter(Node *p, Node *q) : List(p, q) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class AccessSpec : public List { public: AccessSpec(Node *p, Node *q, Node *c) : List(p, q), my_comments(c) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} Node *get_comments() { return my_comments;} private: Node *my_comments; }; class AccessDecl : public List { public: AccessDecl(Node *p, Node *q) : List(p, q) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class UserAccessSpec : public List { public: UserAccessSpec(Node *p, Node *q) : List(p, q) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class UserdefKeyword : public List { public: UserdefKeyword(Node *p, Node *q) : List(p, q) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; template class StatementT : public List { public: StatementT(Node *p, Node *q) : List(p, q) {} virtual void accept(Visitor *visitor) { visitor->visit(static_cast(this));} }; class IfStatement : public StatementT { public: IfStatement(Node *p, Node *q) : StatementT(p, q) {} }; class SwitchStatement : public StatementT { public: SwitchStatement(Node *p, Node *q) : StatementT(p, q) {} }; class WhileStatement : public StatementT { public: WhileStatement(Node *p, Node *q) : StatementT(p, q) {} }; class DoStatement : public StatementT { public: DoStatement(Node *p, Node *q) : StatementT(p, q) {} }; class ForStatement : public StatementT { public: ForStatement(Node *p, Node *q) : StatementT(p, q) {} }; class TryStatement : public StatementT { public: TryStatement(Node *p, Node *q) : StatementT(p, q) {} }; class BreakStatement : public StatementT { public: BreakStatement(Node *p, Node *q) : StatementT(p, q) {} }; class ContinueStatement : public StatementT { public: ContinueStatement(Node *p, Node *q) : StatementT(p, q) {} }; class ReturnStatement : public StatementT { public: ReturnStatement(Node *p, Node *q) : StatementT(p, q) {} }; class GotoStatement : public StatementT { public: GotoStatement(Node *p, Node *q) : StatementT(p, q) {} }; class CaseStatement : public StatementT { public: CaseStatement(Node *p, Node *q) : StatementT(p, q) {} }; class DefaultStatement : public StatementT { public: DefaultStatement(Node *p, Node *q) : StatementT(p, q) {} }; class LabelStatement : public StatementT { public: LabelStatement(Node *p, Node *q) : StatementT(p, q) {} }; class ExprStatement : public StatementT { public: ExprStatement(Node *p, Node *q) : StatementT(p, q) {} }; class Expression : public List { public: Expression(Node *p, Node *q) : List(p, q) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; template class ExpressionT : public List { public: ExpressionT(Node *p, Node *q) : List(p, q) {} virtual void accept(Visitor *visitor) { visitor->visit(static_cast(this));} }; class AssignExpr : public ExpressionT { public: AssignExpr(Node *p, Node *q) : ExpressionT(p, q) {} }; class CondExpr : public ExpressionT { public: CondExpr(Node *p, Node *q) : ExpressionT(p, q) {} }; class InfixExpr : public ExpressionT { public: InfixExpr(Node *p, Node *q) : ExpressionT(p, q) {} }; class PmExpr : public ExpressionT { public: PmExpr(Node *p, Node *q) : ExpressionT(p, q) {} }; class CastExpr : public ExpressionT { public: CastExpr(Node *p, Node *q) : ExpressionT(p, q) {} }; class UnaryExpr : public ExpressionT { public: UnaryExpr(Node *p, Node *q) : ExpressionT(p, q) {} }; class ThrowExpr : public ExpressionT { public: ThrowExpr(Node *p, Node *q) : ExpressionT(p, q) {} }; class SizeofExpr : public ExpressionT { public: SizeofExpr(Node *p, Node *q) : ExpressionT(p, q) {} }; class OffsetofExpr : public ExpressionT { public: OffsetofExpr(Node *p, Node *q) : ExpressionT(p, q) {} }; class TypeidExpr : public ExpressionT { public: TypeidExpr(Node *p, Node *q) : ExpressionT(p, q) {} }; class TypeofExpr : public ExpressionT { public: TypeofExpr(Node *p, Node *q) : ExpressionT(p, q) {} }; class NewExpr : public ExpressionT { public: NewExpr(Node *p, Node *q) : ExpressionT(p, q) {} }; class DeleteExpr : public ExpressionT { public: DeleteExpr(Node *p, Node *q) : ExpressionT(p, q) {} }; class ArrayExpr : public ExpressionT { public: ArrayExpr(Node *p, Node *q) : ExpressionT(p, q) {} }; class FuncallExpr : public ExpressionT { public: FuncallExpr(Node *p, Node *q) : ExpressionT(p, q) {} }; class PostfixExpr : public ExpressionT { public: PostfixExpr(Node *p, Node *q) : ExpressionT(p, q) {} }; class UserStatementExpr : public ExpressionT { public: UserStatementExpr(Node *p, Node *q) : ExpressionT(p, q) {} }; class DotMemberExpr : public ExpressionT { public: DotMemberExpr(Node *p, Node *q) : ExpressionT(p, q) {} }; class ArrowMemberExpr : public ExpressionT { public: ArrowMemberExpr(Node *p, Node *q) : ExpressionT(p, q) {} }; class ParenExpr : public ExpressionT { public: ParenExpr(Node *p, Node *q) : ExpressionT(p, q) {} }; class StaticUserStatementExpr : public ExpressionT { public: StaticUserStatementExpr(Node *p, Node *q) : ExpressionT(p, q) {} }; } } #endif synopsis-0.12/src/Synopsis/PTree/Encoding.hh0000664000076400007640000002010411151603460020355 0ustar stefanstefan// // Copyright (C) 1997 Shigeru Chiba // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_PTree_Encoding_hh_ #define Synopsis_PTree_Encoding_hh_ #include #include #include #include #include // for EOF namespace Synopsis { namespace PTree { class Node; class Atom; //. An Encoding represents a mangled (type) name. Here is a quick reference of the grammar: //. //. - `b`: boolean //. - `c`: char //. - `w`: wchar_t //. - `i`: int (signed, unsigned) //. - `s`: short (short int) //. - `l`: long (long int) //. - `j`: long long //. - `f`: float //. - `d`: double //. - `r`: long double //. - `v`: void //. - `T`: template class (e.g. `Foo` ==> `T[3]Foo[2]ic`. `[2]` means //. the length of `ic`. It doesn't mean the number of template arguments. //. //. - `e`: ... //. - `?`: no return type. the return type of constructors //. - `*`: non-type template parameter //. //. - `S`: `signed` //. - `U`: `unsigned` //. - `C`: `const` //. - `V`: `volatile` //. //. - `P`: pointer //. - `R`: reference //. - `A`: array (e.g. `char[16]` ==> `A16_c`) //. - `F`: function (e.g. `char foo(int)` ==> `Fi_c`) //. - `M`: pointer to member (e.g. `Type::*` ==> `M[4]Type`) //. //. - `Q`: qualified class (e.g. `X::YY` ==> `Q[2][1]X[2]YY`, `::YY` ==> `Q[2][0][2]YY`) //. //. - `[x]`: means `0x80 + x` //. - `0`: means `::` (global scope) //. //. Special function names: //. //. - operator + ==> + //. - operator new[] ==> new[] //. - operator ==> @ cast operator //. class Encoding { public: struct char_traits { typedef unsigned char char_type; typedef unsigned long int_type; typedef std::streampos pos_type; typedef std::streamoff off_type; typedef std::mbstate_t state_type; static void assign(char_type &c1, const char_type &c2) { c1 = c2;} static bool eq(const char_type &c1, const char_type &c2) { return c1 == c2;} static bool lt(const char_type &c1, const char_type &c2) { return c1 < c2;} static int compare(const char_type *s1, const char_type *s2, std::size_t n) { return memcmp(s1, s2, n);} static std::size_t length(const char_type *s) { return strlen((const char *)s);} static const char_type *find(const char_type *s, std::size_t n, const char_type &a) { return static_cast(memchr(s, a, n));} static char_type *move(char_type *s1, const char_type *s2, std::size_t n) { return static_cast(memmove(s1, s2, n));} static char_type *copy(char_type *s1, const char_type *s2, std::size_t n) { return static_cast(memcpy(s1, s2, n));} static char_type *assign(char_type *s, std::size_t n, char_type a) { return static_cast(memset(s, a, n));} static char_type to_char_type(const int_type &c) { return static_cast(c);} static int_type to_int_type(const char_type &c) { return static_cast(c);} static bool eq_int_type(const int_type &c1, const int_type &c2) { return c1 == c2;} static int_type eof() { return static_cast(EOF);} static int_type not_eof(const int_type &c) { return !eq_int_type(c, eof()) ? c : to_int_type(char_type());} }; typedef std::basic_string Code; typedef Code::const_iterator iterator; static void do_init_static(); Encoding() {} Encoding(const Code &b) : my_buffer(b) {} Encoding(const char *b) : my_buffer(b, b + strlen(b)) {} Encoding(const char *b, size_t s) : my_buffer(b, b + s) {} Encoding(iterator b, iterator e) : my_buffer(b, e) {} static Encoding simple_name(PTree::Atom const *name); void clear() { my_buffer.clear();} bool empty() const { return my_buffer.empty();} size_t size() const { return my_buffer.size();} iterator begin() const { return my_buffer.begin();} iterator end() const { return my_buffer.end();} unsigned char front() const { return *begin();} unsigned char at(size_t i) const { return my_buffer.at(i);} //. return a copy of the underlaying buffer //. FIXME: this is a temporary workaround while there are //. still places that use raw strings const char *copy() const; bool operator == (const Encoding &e) const { return my_buffer == e.my_buffer;} bool operator == (const std::string &s) const { return my_buffer == (const unsigned char *)s.c_str();} bool operator == (const char *s) const { return my_buffer == (const unsigned char *)s;} void prepend(unsigned char c) { my_buffer.insert(my_buffer.begin(), c);} void prepend(const char *p, size_t s) { my_buffer.insert(0, (const unsigned char *)p, s);} void prepend(const Encoding &e) { my_buffer.insert(0, e.my_buffer);} void append(unsigned char c) { my_buffer.append(1, c);} void append(const char *p, size_t s) { my_buffer.append((const unsigned char *)p, s);} void append(const Encoding &e) { my_buffer.append(e.my_buffer);} void append_with_length(const char *s, size_t n) { append(0x80 + n); append((const char *)s, n);} void append_with_length(const Encoding &e) { append(0x80 + e.size()); append(e);} unsigned char pop(); void pop(size_t n) { my_buffer.erase(my_buffer.begin(), my_buffer.begin() + n);} void cv_qualify(const Node *, const Node * = 0); void simple_const() { append("Ci", 2);} void global_scope(); void simple_name(const Node *); void anonymous(); void template_(const Node *, const Encoding &); void qualified(int); void destructor(const Node *); void ptr_operator(int); void ptr_to_member(const Encoding &, int); void cast_operator(const Encoding &); void array() { prepend("A_", 2);} void array(unsigned long s); void function(const Encoding &e) { prepend(e);} void recursion(const Encoding &e) { prepend(e);} void start_func_args() { append('F');} void end_func_args() { append('_');} void void_() { append('v');} void ellipsis_arg() { append('e');} void no_return_type() { append('?');} void value_temp_param() { append('*');} //. if this Encoding represents a qualified name, //. return the name of the outer scope Encoding get_scope() const; //. if this Encoding represents a qualified name, //. return the name of the symbol inside the outer scope, //. else return the unmodified name Encoding get_symbol() const; Encoding get_template_arguments() const; std::string unmangled() const; PTree::Node *make_name(); PTree::Node *make_qname(); PTree::Node *make_ptree(PTree::Node *); bool is_simple_name() const { return front() >= 0x80;} bool is_global_scope() const { return front() == 0x80 && size() == 1;} bool is_qualified() const { return front() == 'Q';} bool is_function() const; bool is_template() const { return front() == 'T';} PTree::Node *name_to_ptree(); friend bool operator < (const Encoding &, const Encoding &); friend std::ostream &operator << (std::ostream &, const Encoding &); private: iterator end_of_scope() const; Code my_buffer; public: static PTree::Node *bool_t, *char_t, *wchar_t_t, *int_t, *short_t, *long_t, *float_t, *double_t, *void_t; static PTree::Node *signed_t, *unsigned_t, *const_t, *volatile_t; static PTree::Node *operator_name, *new_operator, *anew_operator, *delete_operator, *adelete_operator; static PTree::Node *star, *ampersand, *comma, *dots, *scope, *tilder, *left_paren, *right_paren, *left_bracket, *right_bracket, *left_angle, *right_angle; }; inline bool operator < (const Encoding &e1, const Encoding &e2) { return e1.my_buffer < e2.my_buffer; } inline std::ostream &operator << (std::ostream &os, const Encoding &e) { for (Encoding::iterator i = e.begin(); i != e.end(); ++i) if(*i < 0x80) os.put(static_cast(*i)); else os << '[' << static_cast(*i - 0x80) << ']'; return os; } inline unsigned char Encoding::pop() { unsigned char code = my_buffer[0]; my_buffer.erase(0, 1); return code; } inline bool Encoding::is_function() const { if (front() == 'F') return true; // const (member) function. else if (front() == 'C' && *(begin() + 1) == 'F') return true; else return false; } } } #endif synopsis-0.12/src/Synopsis/PTree/operations.hh0000664000076400007640000000656011104702314021020 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_PTree_operations_hh_ #define Synopsis_PTree_operations_hh_ #include #include namespace Synopsis { namespace PTree { bool operator == (const Node &p, char c); inline bool operator != (const Node &p, char c) { return !operator == (p, c);} bool operator == (const Node &p, const char *str); inline bool operator != (const Node &p, const char *str) { return !operator == (p, str);} bool operator == (const Node &p, const Node &q); inline bool operator != (const Node &p, const Node &q) { return !operator == (p, q);} bool equal(const Node &p, const char *str, size_t len); bool equal(const Node *p, const Node *q); bool equiv(const Node *p, const Node *q); //. Return the last cons cell. const Node *last(const Node *); //. Return the last cons cell. Node *last(Node *); inline const Node *first(const Node *p) { return p ? p->car() : 0;} inline Node *first(Node *p) { return p ? p->car() : 0;} inline const Node *rest(const Node *p) { return p ? p->cdr() : 0;} inline Node *rest(Node *p) { return p ? p->cdr() : 0;} inline const Node *nth(const Node *p, size_t n) { while(p && n-- > 0) p = p->cdr(); return p ? p->car() : 0; } inline Node *nth(Node *p, size_t n) { while(p && n-- > 0) p = p->cdr(); return p ? p->car() : 0; } inline const Node *tail(const Node *p, size_t k) { while(p && k-- > 0) p = p->cdr(); return p; } inline Node *tail(Node *p, size_t k) { while(p && k-- > 0) p = p->cdr(); return p; } const Node *second(const Node *); Node *second(Node *); const Node *third(const Node *); Node *third(Node *); int length(const Node *); inline const Node *cadr(const Node *p) { return p->cdr()->car();} inline Node *cadr(Node *p) { return p->cdr()->car();} inline const Node *cddr(const Node *p) { return p->cdr()->cdr();} inline Node *cddr(Node *p) { return p->cdr()->cdr();} //. compute Caa..ar const Node *ca_ar(const Node *); Node *ca_ar(Node *); Node *cons(Node *, Node *); List *list(); List *list(Node *); List *list(Node *, Node *); List *list(Node *, Node *, Node *); List *list(Node *, Node *, Node *, Node *); List *list(Node *, Node *, Node *, Node *, Node *); List *list(Node *, Node *, Node *, Node *, Node *, Node *); List *list(Node *, Node *, Node *, Node *, Node *, Node *, Node *); List *list(Node *, Node *, Node *, Node *, Node *, Node *, Node *, Node *); Node *copy(Node *); Node *append(Node *, Node *); Node *replace_all(Node *, Node *, Node *); Node *subst(Node *, Node *, Node *); Node *subst(Node *, Node *, Node *, Node *, Node *); Node *subst(Node *, Node *, Node *, Node *, Node *, Node *, Node *); Node *shallow_subst(Node *, Node *, Node *); Node *shallow_subst(Node *, Node *, Node *, Node *, Node *); Node *shallow_subst(Node *, Node *, Node *, Node *, Node *, Node *, Node *); Node *shallow_subst(Node *, Node *, Node *, Node *, Node *, Node *, Node *, Node *, Node *); Node *subst_sublist(Node *, Node *, Node *); /* they cause side-effect */ Node *nconc(Node *, Node *); Node *nconc(Node *, Node *, Node *); template N *nconc(N *p, Node *q) { assert(p); last(p)->set_cdr(q); return p; } Node *snoc(Node *, Node *); template N *snoc(N *p, Node *q) { return nconc(p, cons(q, 0)); } } } #endif synopsis-0.12/src/Synopsis/PTree/Display.hh0000664000076400007640000000453211104702314020237 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_PTree_Display_hh_ #define Synopsis_PTree_Display_hh_ #include namespace Synopsis { namespace PTree { //. The Display class provides an annotated view of the ptree, //. for debugging purposes class Display : private Visitor { public: Display(std::ostream &os, bool encoded); void display(Node const *); virtual void visit(Atom *); virtual void visit(List *); // atoms... virtual void visit(DupAtom *); // ...lists... virtual void visit(Brace *); virtual void visit(Block *b) { visit(static_cast(b));} virtual void visit(ClassBody *b) { visit(static_cast(b));} virtual void visit(Declarator *l) { print_encoded(l);} virtual void visit(Name *l) { print_encoded(l);} virtual void visit(FstyleCastExpr *l) { print_encoded(l);} private: void newline(); bool too_deep(); void print_encoded(List *); std::ostream &my_os; size_t my_indent; bool my_encoded; }; class RTTIDisplay : private Visitor { public: RTTIDisplay(std::ostream &os, bool encoded); void display(Node const *); virtual void visit(Atom *); virtual void visit(List *); virtual void visit(DupAtom *); private: void newline(); std::ostream &my_os; size_t my_indent; bool my_encoded; }; class DotFileGenerator : public PTree::Visitor { public: DotFileGenerator(std::ostream &); void write(PTree::Node const *ptree); private: virtual void visit(PTree::Atom *a); virtual void visit(PTree::List *l); std::ostream &my_os; }; //. Display the given parse tree segment on the given output stream. //. If 'encoded' is set to 'true', print encoded names / types //. on appropriate nodes. If 'typeinfo' is set to 'true', print //. the class names of the nodes. inline void display(Node const *node, std::ostream &os, bool encoded = false, bool typeinfo = false) { if (typeinfo) { RTTIDisplay d(os, encoded); d.display(node); } else { Display d(os, encoded); d.display(node); } } //. Generate a dot file for the given parse tree segment. inline void generate_dot_file(Node const *node, std::ostream &os) { DotFileGenerator generator(os); generator.write(node); } } } #endif synopsis-0.12/src/Synopsis/PTree/Node.cc0000644000076400007640000000432611125155565017521 0ustar stefanstefan// // Copyright (C) 1997-2000 Shigeru Chiba // Copyright (C) 2000 Stefan Seefeld // Copyright (C) 2000 Stephen Davies // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include #include #include #include #include #include using namespace Synopsis; using namespace PTree; namespace { //. Make sure the garbage collector is properly initialized. struct Initializer { Initializer() { init_gc();} } initializer; } Node::Node(const char *ptr, size_t len) { my_data.leaf.position = ptr; my_data.leaf.length = len; } Node::Node(Node *p, Node *q) { my_data.nonleaf.child = p; my_data.nonleaf.next = q; } const char *Node::begin() const { if (is_atom()) return position(); else { for (const Node *p = this; p; p = p->cdr()) { const char *b = p->car() ? p->car()->begin() : 0; if (b) return b; } return 0; } } const char *Node::end() const { if (is_atom()) return position() + length(); else { int n = PTree::length(this); while(n > 0) { const char *e = PTree::nth(this, --n)->end(); if (e) return e; } return 0; } } Node *Iterator::pop() { if(!ptree) return 0; else { Node *p = ptree->car(); ptree = ptree->cdr(); return p; } } bool Iterator::next(Node *& car) { if(!ptree) return false; else { car = ptree->car(); ptree = ptree->cdr(); return true; } } Array::Array(size_t s) { num = 0; if(s > 8) { size = s; array = new (GC) Node *[s]; } else { size = 8; array = default_buf; } } void Array::append(Node *p) { if(num >= size) { size += 8; Node **a = new (GC) Node *[size]; memmove(a, array, size_t(num * sizeof(Node *))); array = a; } array[num++] = p; } Node *&Array::ref(size_t i) { if(i < num) return array[i]; else throw std::range_error("Array: out of range"); } Node *Array::all() { Node *lst = 0; for(int i = number() - 1; i >= 0; --i) lst = cons(ref(i), lst); return lst; } synopsis-0.12/src/Synopsis/PTree/Visitor.hh0000664000076400007640000001537311104702314020276 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_PTree_Visitor_hh_ #define Synopsis_PTree_Visitor_hh_ #include namespace Synopsis { namespace PTree { //. The Visitor class is used to dynamically resolve //. type information about a given Node. //. The default implementation does nothing, so you //. only need to implement the methods you actually need. //. Any types for which no corresponding 'visit' methods //. exist will be caught by the 'visit' of the closest parent. class Visitor { public: virtual ~Visitor() {} virtual void visit(Node *) {} virtual void visit(Atom *) {} virtual void visit(List *) {} // atoms... virtual void visit(Literal *); virtual void visit(CommentedAtom *); virtual void visit(DupAtom *); virtual void visit(Identifier *); virtual void visit(Keyword *); virtual void visit(Kwd::Auto *); virtual void visit(Kwd::Break *); virtual void visit(Kwd::Bool *); virtual void visit(Kwd::Case *); virtual void visit(Kwd::Catch *); virtual void visit(Kwd::Char *); virtual void visit(Kwd::Class *); virtual void visit(Kwd::Continue *); virtual void visit(Kwd::Const *); virtual void visit(Kwd::Default *); virtual void visit(Kwd::Delete *); virtual void visit(Kwd::Double *); virtual void visit(Kwd::Do *); virtual void visit(Kwd::Else *); virtual void visit(Kwd::Extern *); virtual void visit(Kwd::Float *); virtual void visit(Kwd::For *); virtual void visit(Kwd::Friend *); virtual void visit(Kwd::Goto *); virtual void visit(Kwd::Inline *); virtual void visit(Kwd::If *); virtual void visit(Kwd::Int *); virtual void visit(Kwd::Long *); virtual void visit(Kwd::Mutable *); virtual void visit(Kwd::Namespace *); virtual void visit(Kwd::New *); virtual void visit(Kwd::Operator *); virtual void visit(Kwd::Private *); virtual void visit(Kwd::Protected *); virtual void visit(Kwd::Public *); virtual void visit(Kwd::Register *); virtual void visit(Kwd::Return *); virtual void visit(Kwd::Short *); virtual void visit(Kwd::Signed *); virtual void visit(Kwd::Static *); virtual void visit(Kwd::Struct *); virtual void visit(Kwd::Switch *); virtual void visit(Kwd::Template *); virtual void visit(Kwd::This *); virtual void visit(Kwd::Throw *); virtual void visit(Kwd::Try *); virtual void visit(Kwd::Typedef *); virtual void visit(Kwd::Typename *); virtual void visit(Kwd::Union *); virtual void visit(Kwd::Unsigned *); virtual void visit(Kwd::Using *); virtual void visit(Kwd::Virtual *); virtual void visit(Kwd::Void *); virtual void visit(Kwd::Volatile *); virtual void visit(Kwd::WChar *); virtual void visit(Kwd::While *); //. [ { [ * ] } ] virtual void visit(Brace *); //. [ { [ * ] } ] virtual void visit(Block *); virtual void visit(ClassBody *); virtual void visit(Typedef *); //. [ template < [types] > [decl] ] virtual void visit(TemplateDecl *); virtual void visit(TemplateInstantiation *); virtual void visit(ExternTemplate *); virtual void visit(MetaclassDecl *); //. [ extern ["C++"] [{ body }] ] virtual void visit(LinkageSpec *); //. [ namespace [{ body }] ] virtual void visit(NamespaceSpec *); //. [ using namespace Foo ; ] virtual void visit(UsingDirective *); //. One of: //. //. - Variables: [ [modifiers] name [declarators] ; ] //. - Function: prototype: [ [modifiers] name [declarators] ; ] //. - Typedef: ? //. - Class definition: [ [modifiers] [class foo ...] [declarators]? ; ] virtual void visit(Declaration *); //. [ namespace Foo = Bar ; ] virtual void visit(NamespaceAlias *); //. Function definition: [ [modifiers] name declarator [ { ... } ] ] virtual void visit(FunctionDefinition *); //. One of: //. //. - [ decl-specifier-seq ] //. - [ decl-specifier-seq declarator ] //. - [ decl-specifier-seq declarator = assignment-expression ] //. - [ decl-specifier-seq abstract-declarator ] //. - [ decl-specifier-seq abstract-declarator = assignment-expression ] //. - [ decl-specifier-seq = assignment-expression ] virtual void visit(ParameterDeclaration *); //. [ using Foo `::` x ; ] virtual void visit(UsingDeclaration *); //. [ [ declarator { = } ] , ... ] virtual void visit(Declarator *); virtual void visit(Name *); //. [ [type] ( [expr] ) ] virtual void visit(FstyleCastExpr *); virtual void visit(ClassSpec *); //. [ enum [name] [{ [name [= value] ]* }] ] virtual void visit(EnumSpec *); //. One of: //. //. - [typename] //. - [typename identifier] //. - [typename identifier = type-id] virtual void visit(TypeParameter *); virtual void visit(AccessSpec *); virtual void visit(AccessDecl *); virtual void visit(UserAccessSpec *); //. [ if ( expr ) statement (else statement)? ] virtual void visit(IfStatement *); //. [ switch ( expr ) statement ] virtual void visit(SwitchStatement *); //. [ while ( expr ) statement ] virtual void visit(WhileStatement *); //. [ do [{ ... }] while ( [...] ) ; ] virtual void visit(DoStatement *); //. [ for ( stmt expr ; expr ) statement ] virtual void visit(ForStatement *); //. [ try [{}] [catch ( arg ) [{}] ]* ] virtual void visit(TryStatement *); //. [ break ; ] virtual void visit(BreakStatement *); virtual void visit(ContinueStatement *); virtual void visit(ReturnStatement *); virtual void visit(GotoStatement *); //. [ case expr : [expr] ] virtual void visit(CaseStatement *); //. [ default : [expr] ] virtual void visit(DefaultStatement *); virtual void visit(LabelStatement *); virtual void visit(ExprStatement *); //. [ expr (, expr)* ] virtual void visit(Expression *); //. [left = right] virtual void visit(AssignExpr *); virtual void visit(CondExpr *); //. [left op right] virtual void visit(InfixExpr *); virtual void visit(PmExpr *); //. ( type-expr ) expr ..type-expr is type encoded virtual void visit(CastExpr *); //. [op expr] virtual void visit(UnaryExpr *); //. [ throw [expr] ] virtual void visit(ThrowExpr *); //. [ sizeof ( [type [???] ] ) ] virtual void visit(SizeofExpr *); virtual void visit(OffsetofExpr *); virtual void visit(TypeidExpr *); virtual void visit(TypeofExpr *); virtual void visit(NewExpr *); //. [ delete [expr] ] virtual void visit(DeleteExpr *); //. \[ \] virtual void visit(ArrayExpr *); //. [ postfix ( args ) ] virtual void visit(FuncallExpr *); //. [ expr ++ ] virtual void visit(PostfixExpr *); //. [ postfix . name ] virtual void visit(DotMemberExpr *); //. [ postfix -> name ] virtual void visit(ArrowMemberExpr *); //. [ ( expr ) ] virtual void visit(ParenExpr *); }; } } #endif synopsis-0.12/src/Synopsis/PTree/NodesFwd.hh0000664000076400007640000000722111104702314020341 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_PTree_NodesFwd_hh_ #define Synopsis_PTree_NodesFwd_hh_ #include namespace Synopsis { namespace PTree { class Node; class Atom; class List; class Literal; class CommentedAtom; class DupAtom; class Identifier; class Keyword; template class KeywordT; namespace Kwd { typedef KeywordT Auto; typedef KeywordT Bool; typedef KeywordT Break; typedef KeywordT Case; typedef KeywordT Catch; typedef KeywordT Char; typedef KeywordT Class; typedef KeywordT Continue; typedef KeywordT Const; typedef KeywordT Default; typedef KeywordT Delete; typedef KeywordT Double; typedef KeywordT Do; typedef KeywordT Else; typedef KeywordT Enum; typedef KeywordT Extern; typedef KeywordT Float; typedef KeywordT For; typedef KeywordT Friend; typedef KeywordT Goto; typedef KeywordT Inline; typedef KeywordT If; typedef KeywordT Int; typedef KeywordT Long; typedef KeywordT Mutable; typedef KeywordT Namespace; typedef KeywordT New; typedef KeywordT Operator; typedef KeywordT Private; typedef KeywordT Protected; typedef KeywordT Public; typedef KeywordT Register; typedef KeywordT Return; typedef KeywordT Short; typedef KeywordT Signed; typedef KeywordT Static; typedef KeywordT Struct; typedef KeywordT Switch; typedef KeywordT Template; typedef KeywordT This; typedef KeywordT Throw; typedef KeywordT Try; typedef KeywordT Typedef; typedef KeywordT Typename; typedef KeywordT Typeof; typedef KeywordT Union; typedef KeywordT Unsigned; typedef KeywordT Using; typedef KeywordT Virtual; typedef KeywordT Void; typedef KeywordT Volatile; typedef KeywordT WChar; typedef KeywordT While; } class Brace; class Block; class ClassBody; class Typedef; class TemplateDecl; class TemplateInstantiation; class ExternTemplate; class MetaclassDecl; class LinkageSpec; class NamespaceSpec; class NamespaceAlias; class UsingDirective; class Declaration; class FunctionDefinition; class ParameterDeclaration; class UsingDeclaration; class Declarator; class Name; class FstyleCastExpr; class ClassSpec; class EnumSpec; class TypeParameter; class AccessSpec; class AccessDecl; class UserAccessSpec; class IfStatement; class SwitchStatement; class WhileStatement; class DoStatement; class ForStatement; class TryStatement; class BreakStatement; class ContinueStatement; class ReturnStatement; class GotoStatement; class CaseStatement; class DefaultStatement; class LabelStatement; class ExprStatement; class Expression; class AssignExpr; class CondExpr; class InfixExpr; class PmExpr; class CastExpr; class UnaryExpr; class ThrowExpr; class SizeofExpr; class OffsetofExpr; class TypeidExpr; class TypeofExpr; class NewExpr; class DeleteExpr; class ArrayExpr; class FuncallExpr; class PostfixExpr; class DotMemberExpr; class ArrowMemberExpr; class ParenExpr; } } #endif synopsis-0.12/src/Synopsis/PTree/o.hh0000664000076400007640000000034411164463721017101 0ustar stefanstefan#include template N *nconc(N *p, Node *q) { assert(p); last(p)->set_cdr(q); return p; } Node *snoc(Node *, Node *); template N *snoc(N *p, Node *q) { return nconc(p, cons(q, 0)); } synopsis-0.12/src/Synopsis/PTree/Atoms.hh0000664000076400007640000000452211104702314017714 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_PTree_Atoms_hh_ #define Synopsis_PTree_Atoms_hh_ #include #include namespace Synopsis { namespace PTree { class Literal : public Atom { public: Literal(Token const &tk) : Atom(tk), my_type(tk.type) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} Token::Type type() const { return my_type;} private: Token::Type my_type; }; class CommentedAtom : public Atom { public: CommentedAtom(Token const &tk, Node *c = 0) : Atom(tk), my_comments(c) {} CommentedAtom(char const *p, size_t l, Node *c = 0) : Atom(p, l), my_comments(c) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} Node *get_comments() { return my_comments;} void set_comments(Node *c) { my_comments = c;} private: Node *my_comments; }; // class DupLeaf is used by Ptree::Make() and QuoteClass (qMake()). // The string given to the constructors are duplicated. class DupAtom : public CommentedAtom { public: DupAtom(char const *, size_t); DupAtom(char const *, size_t, char const *, size_t); virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class Identifier : public CommentedAtom { public: Identifier(Token const &t) : CommentedAtom(t) {} Identifier(char const *p, size_t l) : CommentedAtom(p, l) {} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class Keyword : public CommentedAtom { public: Keyword(Token const &t) : CommentedAtom(t) {} Keyword(char const *str, int len) : CommentedAtom(str, len) {} virtual Token::Type token() const = 0; virtual void accept(Visitor *visitor) { visitor->visit(this);} }; template class KeywordT : public Keyword { public: KeywordT(Token const &tk) : Keyword(tk) {} KeywordT(char const *ptr, size_t length) : Keyword(ptr, length) {} virtual Token::Type token() const { return t;} virtual void accept(Visitor *visitor) { visitor->visit(this);} }; class UserKeyword : public Keyword { public: UserKeyword(Token const &t) : Keyword(t) {} virtual Token::Type token() const { return my_type;} virtual void accept(Visitor *visitor) { visitor->visit(this);} private: Token::Type my_type; }; } } #endif synopsis-0.12/src/Synopsis/PTree/GC-enabled.tmpl0000664000076400007640000000071611104702314021070 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_PTree_GC_hh_ #define Synopsis_PTree_GC_hh_ #include namespace Synopsis { namespace PTree { using ::GC; using ::NoGC; typedef gc LightObject; typedef gc_cleanup Object; inline void init_gc() { GC_INIT();} inline void cleanup_gc() { GC_gcollect();} } } #endif synopsis-0.12/src/Synopsis/PTree/Atoms.cc0000664000076400007640000000155311104702314017703 0ustar stefanstefan// // Copyright (C) 1997-2000 Shigeru Chiba // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include "Synopsis/PTree/Atoms.hh" using namespace Synopsis; using namespace PTree; namespace { // little helper for initialization char *dup_alloc(const char *str1, size_t len1, const char *str2, size_t len2) { char *buffer = new (GC) char[len1 + len2]; memmove(buffer, str1, len1); memmove(buffer + len1, str2, len2); return buffer; } } using namespace PTree; DupAtom::DupAtom(const char *str, size_t len) : CommentedAtom(static_cast(memmove(new (GC) char[len], str, len)), len) { } DupAtom::DupAtom(const char *str1, size_t len1, const char *str2, size_t len2) : CommentedAtom(dup_alloc(str1, len1, str2, len2), len1 + len2) { } synopsis-0.12/src/Synopsis/PTree/Writer.cc0000664000076400007640000000270211104702314020071 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include using namespace Synopsis; using namespace PTree; Writer::Writer(std::ostream &os) : my_os(os), my_indent(0), my_lines(0) { } unsigned long Writer::write(Node const *n) { const_cast(n)->accept(this); unsigned long lines = my_lines; my_lines = 0; return lines; } void Writer::visit(Atom *a) { const char *ptr = a->position(); size_t len = a->length(); while(len-- > 0) { char c = *ptr++; if(c == '\n') newline(); else my_os.put(c); } } void Writer::visit(List *l) { Node *p = l; while(true) { Node *head = p->car(); if(head != 0) head->accept(this); p = p->cdr(); if(!p) break; else if(p->is_atom()) throw std::runtime_error("Writer::visit(List *): not list"); else my_os.put(' '); } } void Writer::visit(Brace *l) { my_os << '{'; ++my_indent; Node *p = cadr(l); while(p) { if(p->is_atom()) throw std::runtime_error("Writer::visit(Brace *): non list"); else { newline(); Node *q = p->car(); p = p->cdr(); if(q) q->accept(this); } } --my_indent; newline(); my_os << '}'; } void Writer::newline() { my_os.put('\n'); for(size_t i = 0; i != my_indent; ++i) my_os.put(' '); ++my_lines; } synopsis-0.12/src/Synopsis/PTree/Visitor.cc0000664000076400007640000002055611104702314020263 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include using namespace Synopsis; using namespace PTree; void Visitor::visit(Literal *a) { visit(static_cast(a));} void Visitor::visit(CommentedAtom *a) { visit(static_cast(a));} void Visitor::visit(DupAtom *a) { visit(static_cast(a));} void Visitor::visit(Identifier *a) { visit(static_cast(a));} void Visitor::visit(Keyword *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Auto *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Bool *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Break *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Case *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Catch *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Char *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Class *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Continue *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Const *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Default *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Delete *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Double *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Do *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Else *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Extern *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Float *a) { visit(static_cast(a));} void Visitor::visit(Kwd::For *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Friend *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Goto *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Inline *a) { visit(static_cast(a));} void Visitor::visit(Kwd::If *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Int *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Long *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Mutable *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Namespace *a) { visit(static_cast(a));} void Visitor::visit(Kwd::New *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Operator *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Private *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Protected *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Public *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Register *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Return *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Short *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Signed *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Static *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Struct *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Switch *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Template *a) { visit(static_cast(a));} void Visitor::visit(Kwd::This *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Throw *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Try *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Typedef *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Typename *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Union *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Unsigned *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Using *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Virtual *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Void *a) { visit(static_cast(a));} void Visitor::visit(Kwd::Volatile *a) { visit(static_cast(a));} void Visitor::visit(Kwd::WChar *a) { visit(static_cast(a));} void Visitor::visit(Kwd::While *a) { visit(static_cast(a));} void Visitor::visit(Brace *l) { visit(static_cast(l));} void Visitor::visit(Block *l) { visit(static_cast(l));} void Visitor::visit(ClassBody *l) { visit(static_cast(l));} void Visitor::visit(Typedef *l) { visit(static_cast(l));} void Visitor::visit(TemplateDecl *l) { visit(static_cast(l));} void Visitor::visit(TemplateInstantiation *l) { visit(static_cast(l));} void Visitor::visit(ExternTemplate *l) { visit(static_cast(l));} void Visitor::visit(MetaclassDecl *l) { visit(static_cast(l));} void Visitor::visit(LinkageSpec *l) { visit(static_cast(l));} void Visitor::visit(NamespaceSpec *l) { visit(static_cast(l));} void Visitor::visit(Declaration *l) { visit(static_cast(l));} void Visitor::visit(NamespaceAlias *l) { visit(static_cast(l));} void Visitor::visit(UsingDirective *l) { visit(static_cast(l));} void Visitor::visit(UsingDeclaration *l) { visit(static_cast(l));} void Visitor::visit(FunctionDefinition *l) { visit(static_cast(l));} void Visitor::visit(ParameterDeclaration *l) { visit(static_cast(l));} void Visitor::visit(Declarator *l) { visit(static_cast(l));} void Visitor::visit(Name *l) { visit(static_cast(l));} void Visitor::visit(FstyleCastExpr *l) { visit(static_cast(l));} void Visitor::visit(ClassSpec *l) { visit(static_cast(l));} void Visitor::visit(EnumSpec *l) { visit(static_cast(l));} void Visitor::visit(TypeParameter *l) { visit(static_cast(l));} void Visitor::visit(AccessSpec *l) { visit(static_cast(l));} void Visitor::visit(AccessDecl *l) { visit(static_cast(l));} void Visitor::visit(UserAccessSpec *l) { visit(static_cast(l));} void Visitor::visit(IfStatement *l) { visit(static_cast(l));} void Visitor::visit(SwitchStatement *l) { visit(static_cast(l));} void Visitor::visit(WhileStatement *l) { visit(static_cast(l));} void Visitor::visit(DoStatement *l) { visit(static_cast(l));} void Visitor::visit(ForStatement *l) { visit(static_cast(l));} void Visitor::visit(TryStatement *l) { visit(static_cast(l));} void Visitor::visit(BreakStatement *l) { visit(static_cast(l));} void Visitor::visit(ContinueStatement *l) { visit(static_cast(l));} void Visitor::visit(ReturnStatement *l) { visit(static_cast(l));} void Visitor::visit(GotoStatement *l) { visit(static_cast(l));} void Visitor::visit(CaseStatement *l) { visit(static_cast(l));} void Visitor::visit(DefaultStatement *l) { visit(static_cast(l));} void Visitor::visit(LabelStatement *l) { visit(static_cast(l));} void Visitor::visit(ExprStatement *l) { visit(static_cast(l));} void Visitor::visit(Expression *l) { visit(static_cast(l));} void Visitor::visit(AssignExpr *l) { visit(static_cast(l));} void Visitor::visit(CondExpr *l) { visit(static_cast(l));} void Visitor::visit(InfixExpr *l) { visit(static_cast(l));} void Visitor::visit(PmExpr *l) { visit(static_cast(l));} void Visitor::visit(CastExpr *l) { visit(static_cast(l));} void Visitor::visit(UnaryExpr *l) { visit(static_cast(l));} void Visitor::visit(ThrowExpr *l) { visit(static_cast(l));} void Visitor::visit(SizeofExpr *l) { visit(static_cast(l));} void Visitor::visit(OffsetofExpr *l) { visit(static_cast(l));} void Visitor::visit(TypeidExpr *l) { visit(static_cast(l));} void Visitor::visit(TypeofExpr *l) { visit(static_cast(l));} void Visitor::visit(NewExpr *l) { visit(static_cast(l));} void Visitor::visit(DeleteExpr *l) { visit(static_cast(l));} void Visitor::visit(ArrayExpr *l) { visit(static_cast(l));} void Visitor::visit(FuncallExpr *l) { visit(static_cast(l));} void Visitor::visit(PostfixExpr *l) { visit(static_cast(l));} void Visitor::visit(DotMemberExpr *l) { visit(static_cast(l));} void Visitor::visit(ArrowMemberExpr *l) { visit(static_cast(l));} void Visitor::visit(ParenExpr *l) { visit(static_cast(l));} synopsis-0.12/src/Synopsis/PTree/Writer.hh0000664000076400007640000000155411166260707020124 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_PTree_Writer_hh_ #define Synopsis_PTree_Writer_hh_ #include #include namespace Synopsis { namespace PTree { class Writer : private Visitor { public: Writer(std::ostream &os); unsigned long write(Node const *); private: virtual void visit(Atom *); virtual void visit(List *); virtual void visit(Brace *); void newline(); std::ostream &my_os; size_t my_indent; unsigned long my_lines; }; inline std::string reify(Node const *p) { if (!p) return ""; else if (p->is_atom()) return std::string(p->position(), p->length()); std::ostringstream oss; Writer writer(oss); writer.write(p); return oss.str(); } } } #endif synopsis-0.12/src/Synopsis/PTree/TypeVisitor.hh0000664000076400007640000001242311104702314021131 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_PTree_TypeVisitor_hh_ #define Synopsis_PTree_TypeVisitor_hh_ #include #include #include namespace Synopsis { namespace PTree { class TypeVisitor : public Visitor { public: TypeVisitor() : my_type(Token::BadToken) {} Token::Type type_of(Node *node) { node->accept(this); return my_type;} virtual void visit(Literal *) { my_type = Token::Constant;} virtual void visit(Identifier *) { my_type = Token::Identifier;} virtual void visit(Keyword *kwd) { my_type = kwd->token();} virtual void visit(Typedef *) {my_type = Token::ntTypedef;} virtual void visit(TemplateDecl *) { my_type = Token::ntTemplateDecl;} virtual void visit(TemplateInstantiation *) { my_type = Token::ntTemplateInstantiation;} virtual void visit(ExternTemplate *) { my_type = Token::ntExternTemplate;} virtual void visit(MetaclassDecl *) { my_type = Token::ntMetaclassDecl;} virtual void visit(ParameterDeclaration *) { my_type = Token::ntParameterDecl;} virtual void visit(LinkageSpec *) { my_type = Token::ntLinkageSpec;} virtual void visit(NamespaceSpec *) { my_type = Token::ntNamespaceSpec;} virtual void visit(NamespaceAlias *) { my_type = Token::ntNamespaceAlias;} virtual void visit(UsingDirective *) { my_type = Token::ntUsing;} virtual void visit(Declaration *) { my_type = Token::ntDeclaration;} virtual void visit(UsingDeclaration *) { my_type = Token::ntUsing;} virtual void visit(Declarator *) { my_type = Token::ntDeclarator;} virtual void visit(Name *) { my_type = Token::ntName;} virtual void visit(FstyleCastExpr *) { my_type = Token::ntFstyleCast;} virtual void visit(ClassSpec *) { my_type = Token::ntClassSpec;} virtual void visit(EnumSpec *) { my_type = Token::ntEnumSpec;} virtual void visit(TypeParameter *) { my_type = 0;} // FIXME !!! virtual void visit(AccessSpec *) { my_type = Token::ntAccessSpec;} virtual void visit(AccessDecl *) { my_type = Token::ntAccessDecl;} virtual void visit(UserAccessSpec *) { my_type = Token::ntUserAccessSpec;} virtual void visit(IfStatement *) { my_type = Token::ntIfStatement;} virtual void visit(SwitchStatement *) { my_type = Token::ntSwitchStatement;} virtual void visit(WhileStatement *) { my_type = Token::ntWhileStatement;} virtual void visit(DoStatement *) { my_type = Token::ntDoStatement;} virtual void visit(ForStatement *) { my_type = Token::ntForStatement;} virtual void visit(TryStatement *) { my_type = Token::ntTryStatement;} virtual void visit(BreakStatement *) { my_type = Token::ntBreakStatement;} virtual void visit(ContinueStatement *) { my_type = Token::ntContinueStatement;} virtual void visit(ReturnStatement *) { my_type = Token::ntReturnStatement;} virtual void visit(GotoStatement *) { my_type = Token::ntGotoStatement;} virtual void visit(CaseStatement *) { my_type = Token::ntCaseStatement;} virtual void visit(DefaultStatement *) { my_type = Token::ntDefaultStatement;} virtual void visit(LabelStatement *) { my_type = Token::ntLabelStatement;} virtual void visit(ExprStatement *) { my_type = Token::ntExprStatement;} virtual void visit(Expression *) { my_type = Token::ntCommaExpr;} virtual void visit(AssignExpr *) { my_type = Token::ntAssignExpr;} virtual void visit(CondExpr *) { my_type = Token::ntCondExpr;} virtual void visit(InfixExpr *) { my_type = Token::ntInfixExpr;} virtual void visit(PmExpr *) { my_type = Token::ntPmExpr;} virtual void visit(CastExpr *) { my_type = Token::ntCastExpr;} virtual void visit(UnaryExpr *) { my_type = Token::ntUnaryExpr;} virtual void visit(ThrowExpr *) { my_type = Token::ntThrowExpr;} virtual void visit(SizeofExpr *) { my_type = Token::ntSizeofExpr;} virtual void visit(TypeidExpr *) { my_type = Token::ntTypeidExpr;} virtual void visit(TypeofExpr *) { my_type = Token::ntTypeofExpr;} virtual void visit(NewExpr *) { my_type = Token::ntNewExpr;} virtual void visit(DeleteExpr *) { my_type = Token::ntDeleteExpr;} virtual void visit(ArrayExpr *) { my_type = Token::ntArrayExpr;} virtual void visit(FuncallExpr *) { my_type = Token::ntFuncallExpr;} virtual void visit(PostfixExpr *) { my_type = Token::ntPostfixExpr;} virtual void visit(DotMemberExpr *) { my_type = Token::ntDotMemberExpr;} virtual void visit(ArrowMemberExpr *) { my_type = Token::ntArrowMemberExpr;} virtual void visit(ParenExpr *) { my_type = Token::ntParenExpr;} private: Token::Type my_type; }; inline Token::Type type_of(const Node *node) { assert(node); TypeVisitor v; return v.type_of(const_cast(node)); } inline bool is_a(const Node *node, Token::Type t) { if (!node) return false; TypeVisitor v; Token::Type type = v.type_of(const_cast(node)); return type == t; } inline bool is_a(const Node *node, Token::Type t1, Token::Type t2) { if (!node) return false; TypeVisitor v; Token::Type type = v.type_of(const_cast(node)); return type == t1 || type == t2; } inline bool is_a(const Node *node, Token::Type t1, Token::Type t2, Token::Type t3) { if (!node) return false; TypeVisitor v; Token::Type type = v.type_of(const_cast(node)); return type == t1 || type == t2 || type == t3; } } } #endif synopsis-0.12/src/Synopsis/PTree/Lists.cc0000664000076400007640000000464311104702314017721 0ustar stefanstefan// // Copyright (C) 1997-2000 Shigeru Chiba // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include using namespace Synopsis; using namespace PTree; Declarator::Declarator(Node *n) : List(n ? n->car() : 0, n ? n->cdr() : 0), my_declared_name(0), my_comments(0) { } Declarator::Declarator(Node *list, Encoding const &t, Encoding const &n, Node *dname) : List(list->car(), list->cdr()), my_type(t), my_name(n), my_declared_name(dname), my_comments(0) { } Declarator::Declarator(Encoding const &t, Encoding const &n, Node *dname) : List(0, 0), my_type(t), my_name(n), my_declared_name(dname), my_comments(0) { } Declarator::Declarator(Node *p, Node *q, Encoding const &t, Encoding const &n, Node *dname) : List(p, q), my_type(t), my_name(n), my_declared_name(dname), my_comments(0) { } Declarator::Declarator(Node *list, Encoding const &t) : List(list->car(), list->cdr()), my_type(t), my_declared_name(0), my_comments(0) { } Declarator::Declarator(Encoding const &t) : List(0, 0), my_type(t), my_declared_name(0), my_comments(0) { } Declarator::Declarator(Declarator *decl, Node *p, Node *q) : List(p, q), my_type(decl->my_type), my_name(decl->my_name), my_declared_name(decl->my_declared_name), my_comments(0) { } Node *Declarator::initializer() { size_t l = PTree::length(this); if (l < 2) return 0; if (Node *assign = nth(this, l - 2)) if (*assign == '=') return tail(this, l - 1); // initializer-clause if (Node *expr = nth(this, l - 1)) if (!expr->is_atom() && first(expr) && *first(expr) == '(') return second(expr); // expression-list return 0; } Name::Name(Node *p, const Encoding &name) : List(p->car(), p->cdr()), my_name(name) { } FstyleCastExpr::FstyleCastExpr(const Encoding &type, Node *p, Node *q) : List(p, q), my_type(type) { } ClassSpec::ClassSpec(Node *p, Node *q, Node *c) : List(p, q), my_comments(c) { } ClassSpec::ClassSpec(const Encoding &name, Node *car, Node *cdr, Node *c) : List(car, cdr), my_name(name), my_comments(c) { } ClassBody *ClassSpec::body() { return dynamic_cast(PTree::nth(this, 3)); } synopsis-0.12/src/Synopsis/PTree/GC.hh.in0000664000076400007640000000001411104702314017517 0ustar stefanstefan@GC_BRIDGE@ synopsis-0.12/src/Synopsis/PTree/Display.cc0000664000076400007640000001340311104702314020222 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include #if defined(__GNUC__) && __GNUC__ >= 3 # include # if __GNUC__ == 3 && __GNUC_MINOR__ == 0 namespace abi { extern "C" char* __cxa_demangle(char const*, char*, std::size_t*, int*); } # endif #endif namespace { struct free_mem { free_mem(char *p) : p(p) {} ~free_mem() { std::free(p);} char * p; }; std::string demangle(char const *mangled) { #if defined(__GNUC__) && __GNUC__ >= 3 std::string demangled; int status; free_mem keeper(abi::__cxa_demangle(mangled, 0, 0, &status)); assert(status != -3); // invalid argument error if (status == -1) { throw std::bad_alloc();} else // On failure return the mangled name. demangled = status == -2 ? mangled : keeper.p; return demangled.substr(17); // skip 'Synopsis::PTree::' prefix #else return mangled; #endif } } using namespace Synopsis; using namespace PTree; Display::Display(std::ostream &os, bool encoded) : my_os(os), my_indent(0), my_encoded(encoded) { } void Display::display(Node const *n) { if (n) const_cast(n)->accept(this); else my_os << "nil"; my_os.put('\n'); } void Display::visit(Atom *a) { char const *p = a->position(); size_t n = a->length(); // Recall that [, ], and @ are special characters. if(n < 1) return; else if(n == 1 && *p == '@') { my_os << "\\@"; return; } char c = *p++; if(c == '[' || c == ']') my_os << '\\' << c; // [ and ] at the beginning are escaped. else my_os << c; while(--n > 0) my_os << *p++; } void Display::visit(List *l) { Node *rest = l; my_os << '['; while(rest != 0) { if(rest->is_atom()) { my_os << "@ "; rest->accept(this); rest = 0; } else { Node *head = rest->car(); if(head == 0) my_os << "nil"; else { head->accept(this); } rest = rest->cdr(); if(rest != 0) my_os << ' '; } } my_os << ']'; } void Display::visit(DupAtom *a) { char const *pos = a->position(); size_t length = a->length(); if(length == 1 && *pos == '@') { my_os << "\\@"; return; } my_os << '`'; for(size_t i = 0; i < length; ++i) if(pos[i] == '[' || pos[i] == ']') my_os << '\\' << pos[i]; else my_os << pos[i]; my_os << '`'; } void Display::visit(Brace *l) { ++my_indent; my_os << "[{"; Node *body = second(l); if(!body) { newline(); my_os << "nil"; } else while(body) { newline(); if(body->is_atom()) { my_os << "@ "; body->accept(this); } else { Node *head = body->car(); if(!head) my_os << "nil"; else { head->accept(this); } } body = body->cdr(); } --my_indent; newline(); my_os << "}]"; } void Display::newline() { my_os.put('\n'); for(size_t i = 0; i != my_indent; ++i) my_os.put(' '); } void Display::print_encoded(List *l) { if (my_encoded) { Encoding const &type = l->encoded_type(); if(!type.empty()) my_os << '#' << type; Encoding const &name = l->encoded_name(); if(!name.empty()) my_os << '@' << name; } visit(static_cast(l)); } RTTIDisplay::RTTIDisplay(std::ostream &os, bool encoded) : my_os(os), my_indent(0), my_encoded(encoded) { } void RTTIDisplay::display(Node const *n) { if (n) const_cast(n)->accept(this); else my_os << "nil"; my_os.put('\n'); } void RTTIDisplay::visit(Atom *a) { newline(); my_os << demangle(typeid(*a).name()) << ": "; char const *p = a->position(); size_t n = a->length(); if(n < 1) return; else if(n == 1 && *p == '@') { my_os << "\\@"; return; } my_os << *p++; while(--n > 0) my_os << *p++; } void RTTIDisplay::visit(List *l) { newline(); my_os << demangle(typeid(*l).name()) << ": "; if (my_encoded) { Encoding type = l->encoded_type(); if(!type.empty()) { my_os << "type=" << type << ' '; } Encoding name = l->encoded_name(); if(!name.empty()) { my_os << "name=" << name; } } ++my_indent; Node *rest = l; while(rest != 0) { if(rest->is_atom()) { rest->accept(this); rest = 0; } else { Node *head = rest->car(); if(head == 0) { newline(); my_os << "nil"; } else { head->accept(this); } rest = rest->cdr(); } } --my_indent; } void RTTIDisplay::visit(DupAtom *a) { newline(); my_os << demangle(typeid(*a).name()) << ": "; char const *pos = a->position(); size_t length = a->length(); if(length == 1 && *pos == '@') { my_os << "\\@"; return; } my_os << '`'; for(size_t i = 0; i < length; ++i) my_os << pos[i]; my_os << '`'; } void RTTIDisplay::newline() { my_os.put('\n'); for(size_t i = 0; i != my_indent; ++i) my_os.put(' '); } DotFileGenerator::DotFileGenerator(std::ostream &os) : my_os(os) {} void DotFileGenerator::write(PTree::Node const *ptree) { my_os << "digraph PTree\n{\n" << "node[fillcolor=\"#ffffcc\", pencolor=\"#424242\" style=\"filled\"];\n"; const_cast(ptree)->accept(this); my_os << '}' << std::endl; } void DotFileGenerator::visit(PTree::Atom *a) { my_os << (long)a << " [label=\"" << std::string(a->position(), a->length()) << "\" fillcolor=\"#ffcccc\"];\n"; } void DotFileGenerator::visit(PTree::List *l) { my_os << (long)l << " [label=\"" << demangle(typeid(*l).name()) << "\"];\n"; if (l->car()) { l->car()->accept(this); my_os << (long)l << "->" << (long)l->car() << ';' << std::endl; } if (l->cdr()) { l->cdr()->accept(this); my_os << (long)l << "->" << (long)l->cdr() << ';' << std::endl; } } synopsis-0.12/src/Synopsis/PTree/Encoding.cc0000664000076400007640000004304511104702315020351 0ustar stefanstefan// // Copyright (C) 1997 Shigeru Chiba // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include #include #include #include #include using namespace Synopsis; using namespace PTree; Node *Encoding::bool_t = 0; Node *Encoding::char_t = 0; Node *Encoding::wchar_t_t = 0; Node *Encoding::int_t = 0; Node *Encoding::short_t = 0; Node *Encoding::long_t = 0; Node *Encoding::float_t = 0; Node *Encoding::double_t = 0; Node *Encoding::void_t = 0; Node *Encoding::signed_t = 0; Node *Encoding::unsigned_t = 0; Node *Encoding::const_t = 0; Node *Encoding::volatile_t = 0; Node *Encoding::operator_name = 0; Node *Encoding::new_operator = 0; Node *Encoding::anew_operator = 0; Node *Encoding::delete_operator = 0; Node *Encoding::adelete_operator = 0; Node *Encoding::star = 0; Node *Encoding::ampersand = 0; Node *Encoding::comma = 0; Node *Encoding::dots = 0; Node *Encoding::scope = 0; Node *Encoding::tilder = 0; Node *Encoding::left_paren = 0; Node *Encoding::right_paren = 0; Node *Encoding::left_bracket = 0; Node *Encoding::right_bracket = 0; Node *Encoding::left_angle = 0; Node *Encoding::right_angle = 0; namespace { class Unmangler { public: typedef Encoding::iterator iterator; Unmangler(iterator begin, iterator end) : my_cursor(begin), my_end(end) {} std::string unmangle(); std::string unmangle_name(); std::string unmangle_qname(); std::string unmangle_template(); std::string unmangle_func(std::string&); private: iterator my_cursor; iterator const my_end; }; std::string Unmangler::unmangle_name() { Trace trace("Unmangler::unmangle_name()", Trace::PTREE); size_t length = *my_cursor++ - 0x80; std::string name(length, '\0'); std::copy(my_cursor, my_cursor + length, name.begin()); my_cursor += length; return name; } std::string Unmangler::unmangle() { Trace trace("Unmangler::unmangle()", Trace::PTREE); std::string premod, postmod; std::string name; std::string base; while (my_cursor != my_end && !name.length() && !base.length()) { int c = *my_cursor++; switch (c) { case 'P': postmod += "*"; break; case 'R': postmod += "&"; break; case 'S': premod += "signed "; break; case 'U': premod += "unsigned "; break; case 'C': premod += "const "; break; case 'V': premod += "volatile "; break; case 'A': { std::string array("["); while (*my_cursor != '_') array += *my_cursor++; array += ']'; ++my_cursor; postmod += array; break; } case '*': base = "*"; break; case 'i': name = "int"; break; case 'v': name = "void"; break; case 'b': name = "bool"; break; case 's': name = "short"; break; case 'c': name = "char"; break; case 'w': name = "wchar_t"; break; case 'l': name = "long"; break; case 'j': name = "long long"; break; case 'f': name = "float"; break; case 'd': name = "double"; break; case 'r': name = "long double"; break; case 'e': name = "..."; break; case '?': return ""; //FIXME ! case 'Q': base = unmangle_qname(); break; case '_': --my_cursor; return ""; // end of func params case 'F': base = unmangle_func(postmod); break; case 'T': base = unmangle_template(); break; case 'M': // Pointer to member. Format is same as for named types name = unmangle_name() + "::*"; break; default: assert(c > 0x80); --my_cursor; name = unmangle_name(); break; } // switch } // while if (!base.length() && !name.length()) throw std::runtime_error("unmangling error"); if (!base.length()) base = name; return premod + base + postmod; } std::string Unmangler::unmangle_qname() { Trace trace("Unmangler::unmangle_qname()", Trace::PTREE); // Qualified type: first is num of scopes (at least one), each a name. std::string qname; int scopes = *my_cursor++ - 0x80; while (scopes--) { std::string name; // Only handle two things here: names and templates if (*my_cursor >= 0x80) name = unmangle_name(); else if (*my_cursor == 'T') { ++my_cursor; name = unmangle_name(); name += '<'; iterator tend = my_cursor; tend += *my_cursor++ - 0x80; bool first = true; while (my_cursor <= tend) { if (!first) name += ','; else first = false; name += unmangle(); } name += '>'; } else { //std::cerr << "Warning: Unknown type inside Q: " << *my_cursor << std::endl; // FIXME //std::cerr << " Decoding " << my_string << std::endl; } if (qname.length()) qname += "::" + name; else qname = name; } return qname; } std::string Unmangler::unmangle_func(std::string& postmod) { Trace trace("Unmangler::unmangle_func()", Trace::PTREE); // Function ptr. Encoded same as function std::string premod; // Move * from postmod to funcptr's premod. This makes the output be // "void (*convert)()" instead of "void (convert)()*" if (postmod.size() > 0 && postmod[0] == '*') { premod += postmod[0]; postmod.erase(postmod.begin()); } std::vector params; while (true) { std::string type = unmangle(); if (type.empty()) break; else params.push_back(type); } ++my_cursor; // skip over '_' std::string returnType = unmangle(); std::string ret = returnType + "(*)("; if (params.size()) ret += params[0]; for (size_t p = 1; p != params.size(); ++p) ret += "," + params[p]; ret += ")"; return ret; } std::string Unmangler::unmangle_template() { Trace trace("Unmangler::unmangle_template()", Trace::PTREE); // Template type: Name first, then size of arg field, then arg // types eg: T6vector54cell <-- 5 is len of 4cell if (*my_cursor == 'T') ++my_cursor; std::string name = unmangle_name(); iterator tend = my_cursor; tend += *my_cursor++ - 0x80; name += "<"; if (my_cursor <= tend) name += unmangle(); while (my_cursor <= tend) name += "," + unmangle(); name += ">"; return name; } } void Encoding::do_init_static() { Encoding::bool_t = new PTree::Kwd::Bool("bool", 4); Encoding::char_t = new PTree::Kwd::Char("char", 4); Encoding::wchar_t_t = new PTree::Kwd::WChar("wchar_t", 7); Encoding::int_t = new PTree::Kwd::Int("int", 3); Encoding::short_t = new PTree::Kwd::Short("short", 5); Encoding::long_t = new PTree::Kwd::Long("long", 4); Encoding::float_t = new PTree::Kwd::Float("float", 5); Encoding::double_t = new PTree::Kwd::Double("double", 6); Encoding::void_t = new PTree::Kwd::Void("void", 4); Encoding::signed_t = new PTree::Kwd::Signed("signed", 6); Encoding::unsigned_t = new PTree::Kwd::Unsigned("unsigned", 8); Encoding::const_t = new PTree::Kwd::Const("const", 5); Encoding::volatile_t = new PTree::Kwd::Volatile("volatile", 8); Encoding::operator_name = new PTree::Kwd::Operator("operator", 8); Encoding::new_operator = new PTree::Kwd::New("new", 3); Encoding::anew_operator = new PTree::Kwd::New("new[]", 5); Encoding::delete_operator = new PTree::Kwd::Delete("delete", 6); Encoding::adelete_operator = new PTree::Kwd::Delete("delete[]", 8); Encoding::star = new PTree::Atom("*", 1); Encoding::ampersand = new PTree::Atom("&", 1); Encoding::comma = new PTree::Atom(",", 1); Encoding::dots = new PTree::Atom("...", 3); Encoding::scope = new PTree::Atom("::", 2); Encoding::tilder = new PTree::Atom("~", 1); Encoding::left_paren = new PTree::Atom("(", 1); Encoding::right_paren = new PTree::Atom(")", 1); Encoding::left_bracket = new PTree::Atom("[", 1); Encoding::right_bracket = new PTree::Atom("]", 1); Encoding::left_angle = new PTree::Atom("<", 1); Encoding::right_angle = new PTree::Atom(">", 1); } Encoding Encoding::simple_name(PTree::Atom const *name) { Encoding retn; retn.append_with_length(name->position(), name->length()); return retn; } const char *Encoding::copy() const { return strcpy(new (GC) char[my_buffer.size() + 1], (const char *)my_buffer.c_str()); } void Encoding::cv_qualify(const PTree::Node *cv1, const PTree::Node *cv2) { bool c = false, v = false; if(cv1 && !cv1->is_atom()) while(cv1) { int kind = PTree::type_of(cv1->car()); cv1 = cv1->cdr(); if(kind == Token::CONST) c = true; else if(kind == Token::VOLATILE) v = true; } if(cv2 && !cv2->is_atom()) while(cv2) { int kind = PTree::type_of(cv2->car()); cv2 = cv2->cdr(); if(kind == Token::CONST) c = true; else if(kind == Token::VOLATILE) v = true; } if(v) prepend('V'); if(c) prepend('C'); } void Encoding::global_scope() { append(0x80); } // simple_name() is also used for operator names void Encoding::simple_name(const PTree::Node *id) { append_with_length(id->position(), id->length()); } // anonymous() generates an internal name for anonymous enum and class // declarations. void Encoding::anonymous() { static int i = 0; static char name[] = "`0000"; int n = i++; name[1] = n / 1000 + '0'; name[2] = (n / 100) % 10 + '0'; name[3] = (n / 10) % 10 + '0'; name[4] = n % 10 + '0'; append_with_length(name, 5); } void Encoding::template_(const PTree::Node *name, const Encoding &args) { append('T'); simple_name(name); append_with_length(args); } void Encoding::qualified(int n) { prepend(0x80 + n); prepend('Q'); } void Encoding::destructor(const PTree::Node *class_name) { size_t len = class_name->length(); append((unsigned char)(0x80 + len + 1)); append('~'); append(class_name->position(), len); } void Encoding::ptr_operator(int t) { if(t == '*') prepend('P'); else prepend('R'); } void Encoding::ptr_to_member(const Encoding &enc, int n) { prepend(enc); if(n >= 2) { prepend((unsigned char)(0x80 + n)); prepend('Q'); } prepend('M'); } void Encoding::cast_operator(const Encoding &type) { append((unsigned char)(0x80 + type.size() + 1)); append('@'); append(type); } void Encoding::array(unsigned long s) { std::ostringstream oss; oss << 'A' << s << '_'; std::string str = oss.str(); prepend(str.c_str(), str.size()); } Encoding::iterator Encoding::end_of_scope() const { if (!is_qualified()) return end(); // no scope iterator i = begin() + 2; // skip 'Q' and if (*i >= 0x80) return i + *i - 0x80 + 1; // simple name if (*i == 'T') // template { i += *(i+1) - 0x80 + 2; // skip 'T' and simple name i += *i - 0x80 + 1; // skip template parameters return i; } // never get here std::ostringstream oss; oss << "internal error in qualified name encoding " << my_buffer; throw std::domain_error(oss.str()); } Encoding Encoding::get_scope() const { if (!is_qualified()) return ""; // no scope return Encoding(begin() + 2, end_of_scope()); } Encoding Encoding::get_symbol() const { if (!is_qualified()) return *this; // no scope iterator i = ++begin(); size_t size = static_cast(*i - 0x80); Encoding retn(end_of_scope(), end()); if (size > 2) retn.qualified(size - 1); return retn; } std::string Encoding::unmangled() const { if (empty()) return ""; Unmangler unmangler(begin(), end()); return unmangler.unmangle(); } Encoding Encoding::get_template_arguments() const { int m = my_buffer[0] - 0x80; size_t length = my_buffer[1] - 0x80; if(m <= 0) { return Encoding(my_buffer.begin() + 2, my_buffer.begin() + 2 + length); } else { return Encoding(my_buffer.begin() + 2 + m, my_buffer.begin() + 2 + m + length); } } PTree::Node *Encoding::make_name() { PTree::Node *name; int len = my_buffer[0] - 0x80; if(len > 0) name = new PTree::Identifier((const char*)&*(my_buffer.begin() + 1), len); else name = 0; my_buffer.erase(my_buffer.begin(), my_buffer.begin() + len + 1); return name; } PTree::Node *Encoding::make_qname() { int n = my_buffer[0] - 0x80; PTree::Node *qname = 0; while(n-- > 0) { PTree::Node *name = make_name(); if(name) qname = snoc(qname, name); if(n > 0) qname = snoc(qname, scope); } return qname; } PTree::Node *Encoding::make_ptree(PTree::Node *decl) { PTree::Node *cv; PTree::Node *typespec = 0; if(decl) decl = PTree::list(decl); while(true) { cv = 0; unsigned char code = pop(); switch(code) { case 'b' : typespec = PTree::snoc(typespec, bool_t); return PTree::list(typespec, decl); case 'c' : typespec = PTree::snoc(typespec, char_t); return PTree::list(typespec, decl); case 'w' : typespec = PTree::snoc(typespec, wchar_t_t); return PTree::list(typespec, decl); case 'i' : typespec = PTree::snoc(typespec, int_t); return PTree::list(typespec, decl); case 's' : typespec = PTree::snoc(typespec, short_t); return PTree::list(typespec, decl); case 'l' : typespec = PTree::snoc(typespec, long_t); return PTree::list(typespec, decl); break; case 'j' : typespec = PTree::nconc(typespec, PTree::list(long_t, long_t)); return PTree::list(typespec, decl); break; case 'f' : typespec = PTree::snoc(typespec, float_t); return PTree::list(typespec, decl); break; case 'd' : typespec = PTree::snoc(typespec, double_t); return PTree::list(typespec, decl); break; case 'r' : typespec = PTree::nconc(typespec, PTree::list(long_t, double_t)); return PTree::list(typespec, decl); case 'v' : typespec = PTree::snoc(typespec, void_t); return PTree::list(typespec, decl); case 'e' : return dots; case '?' : return PTree::list(typespec, decl); case 'Q' : typespec = PTree::snoc(typespec, make_qname()); return PTree::list(typespec, decl); case 'S' : typespec = PTree::snoc(typespec, signed_t); break; case 'U' : typespec = PTree::snoc(typespec, unsigned_t); break; case 'C' : if(my_buffer[0] == 'V') { pop(); cv = PTree::list(const_t, volatile_t); } else cv = PTree::list(const_t); goto const_or_volatile; case 'V' : cv = PTree::list(volatile_t); const_or_volatile : switch(my_buffer[0]) { case 'M' : case 'P' : case 'R' : decl = PTree::nconc(cv, decl); break; case 'F' : pop(); goto cv_function; default : typespec = PTree::nconc(cv, typespec); break; } break; case 'M' : { PTree::Node *ptr; if(my_buffer[0] == 'Q') { pop(); ptr = make_qname(); } else ptr = make_name(); ptr = PTree::list(ptr, scope, star); decl = PTree::cons(ptr, decl); } goto pointer_or_reference; case 'P' : decl = PTree::cons(star, decl); goto pointer_or_reference; case 'R' : decl = PTree::cons(ampersand, decl); pointer_or_reference : if(my_buffer[0] == 'A' || my_buffer[0] == 'F') decl = PTree::list(PTree::list(left_paren, decl, right_paren)); break; case 'A' : { char c = 'A'; do { c = front(); pop(); } while (c != '_'); // FIXME: need to put the actual dimension into the generated tree. decl = PTree::nconc(decl, PTree::list(left_bracket, right_bracket)); break; } case 'F' : cv_function : { PTree::Node *args = 0; while(my_buffer[0] != '\0') { if(my_buffer[0] == '_') { pop(); break; } else if(my_buffer[0] == 'v') { pop(2); break; } if(args != 0) args = PTree::snoc(args, comma); args = PTree::snoc(args, make_ptree(0)); } decl = PTree::nconc(decl, PTree::list(left_paren, args, right_paren)); if(cv) decl = PTree::nconc(decl, cv); } break; case '\0' : return PTree::list(typespec, decl); case 'T' : { PTree::Node *tlabel = make_name(); PTree::Node *args = 0; int n = pop() - 0x80; const unsigned char *stop = &*my_buffer.begin() + n; while(&*my_buffer.begin() < stop) { if(args) args = PTree::snoc(args, comma); args = PTree::snoc(args, make_ptree(0)); } tlabel = PTree::list(tlabel, PTree::list(left_angle, args, right_angle)); typespec = PTree::nconc(typespec, tlabel); return PTree::list(typespec, decl); } case '*' : goto error; default : prepend(code); // 'unget' if(code >= 0x80) { if(typespec == 0) typespec = make_name(); else typespec = PTree::snoc(typespec, make_name()); return PTree::list(typespec, decl); } error : throw std::runtime_error("Encoding::make_ptree(): sorry, cannot handle this type"); break; } } } PTree::Node *Encoding::name_to_ptree() { if(my_buffer.empty()) return 0; if(my_buffer == (const unsigned char *)"new[]") return PTree::list(operator_name, anew_operator); else if(my_buffer == (const unsigned char *)"new") return PTree::list(operator_name, new_operator); else if(my_buffer == (const unsigned char *)"delete[]") return PTree::list(operator_name, adelete_operator); else if(my_buffer == (const unsigned char *)"delete") return PTree::list(operator_name, delete_operator); else if(my_buffer[0] == '~') { PTree::Encoding encoded(my_buffer.begin() + 1, my_buffer.end()); return PTree::list(tilder, new PTree::Identifier(encoded.copy(), encoded.size())); } else if(my_buffer[0] == '@') { // cast operator PTree::Encoding encoded(my_buffer.begin() + 1, my_buffer.end()); return PTree::list(operator_name, encoded.make_ptree(0)); } if(is_letter(my_buffer[0])) return new PTree::Identifier(copy(), my_buffer.size()); else return PTree::list(operator_name, new PTree::Identifier(copy(), my_buffer.size())); } namespace Synopsis { namespace PTree { } } synopsis-0.12/src/Synopsis/PTree/GC-disabled.tmpl0000664000076400007640000000131011104702314021234 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_PTree_GC_hh_ #define Synopsis_PTree_GC_hh_ #include // for size_t // define dummy replacements for GC allocator operators namespace Synopsis { namespace PTree { enum GCPlacement {GC, NoGC}; class LightObject {}; class Object {}; inline void init_gc() {} inline void cleanup_gc() {} } } inline void *operator new(size_t size, Synopsis::PTree::GCPlacement) { return ::operator new(size); } inline void *operator new [](size_t size, Synopsis::PTree::GCPlacement) { return ::operator new [](size); } #endif synopsis-0.12/src/Synopsis/PTree/operations.cc0000664000076400007640000002363011104702314021003 0ustar stefanstefan// // Copyright (C) 1997-2000 Shigeru Chiba // Copyright (C) 2000 Stefan Seefeld // Copyright (C) 2000 Stephen Davies // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include "Synopsis/PTree/operations.hh" namespace Synopsis { namespace PTree { bool operator == (const Node &p, char c) { return p.is_atom() && p.length() == 1 && *p.position() == c; } bool operator == (const Node &n, const char *str) { if (!n.is_atom()) return false; const char *p = n.position(); size_t l = n.length(); size_t i = 0; for(; i < l; ++i) if(p[i] != str[i] || str[i] == '\0') return false; return str[i] == '\0'; } bool operator == (const Node &p, const Node &q) { if(!p.is_atom() || !q.is_atom()) return false; size_t plen = p.length(); size_t qlen = q.length(); if(plen == qlen) { const char *pstr = p.position(); const char *qstr = q.position(); while(plen-- > 0) if(pstr[plen] != qstr[plen]) return false; return true; } else return false; } bool equal(const Node &n, const char *str, size_t len) { if(!n.is_atom()) return false; const char *p = n.position(); size_t l = n.length(); if(l == len) { for(size_t i = 0; i < l; ++i) if(p[i] != str[i]) return false; return true; } else return false; } bool equal(const Node *p, const Node *q) { if(p == q) return true; else if(p == 0 || q == 0) return false; else if(p->is_atom() || q->is_atom()) return *p == *q; else return equal(p->car(), q->car()) && equal(p->cdr(), q->cdr()); } /* equiv() returns true even if p and q are lists and all the elements are equal respectively. */ bool equiv(const Node *p, const Node *q) { if(p == q) return true; else if(p == 0 || q == 0) return false; else if(p->is_atom() || q->is_atom()) return *p == *q; else { while(p != 0 && q != 0) if(p->car() != q->car()) return false; else { p = p->cdr(); q = q->cdr(); } return p == 0 && q == 0; } } const Node *last(const Node *p) { if(!p) return 0; const Node *next; while((next = p->cdr())) p = next; return p; } Node *last(Node *p) { if(!p) return 0; Node *next; while((next = p->cdr())) p = next; return p; } const Node *second(const Node *p) { if(p) { p = p->cdr(); if(p) return p->car(); } return 0; } Node *second(Node *p) { if(p) { p = p->cdr(); if(p) return p->car(); } return p; } const Node *third(const Node *p) { if(p) { p = p->cdr(); if(p) { p = p->cdr(); if(p) return p->car(); } } return p; } Node *third(Node *p) { if(p) { p = p->cdr(); if(p) { p = p->cdr(); if(p) return p->car(); } } return p; } const Node *ca_ar(const Node *p) { while(p != 0 && !p->is_atom()) p = p->car(); return p; } Node *ca_ar(Node *p) { while(p != 0 && !p->is_atom()) p = p->car(); return p; } /* length() returns a negative number if p is not a list. */ int length(const Node *p) { int i = 0; if(p && p->is_atom()) return -2; /* p is not a pair */ while(p) { ++i; if(p->is_atom()) return -1; /* p is a pair, but not a list. */ else p = p->cdr(); } return i; } Node *cons(Node *p, Node *q) { return new List(p, q); } List *list() { return 0; } List *list(Node *p) { return new PTree::List(p, 0); } List *list(Node *p, Node *q) { return new PTree::List(p, new PTree::List(q, 0)); } List *list(Node *p1, Node *p2, Node *p3) { return new PTree::List(p1, new PTree::List(p2, new PTree::List(p3, 0))); } List *list(Node *p1, Node *p2, Node *p3, Node *p4) { return new List(p1, list(p2, p3, p4)); } List *list(Node *p1, Node *p2, Node *p3, Node *p4, Node *p5) { return nconc(list(p1, p2), list(p3, p4, p5)); } List *list(Node *p1, Node *p2, Node *p3, Node *p4, Node *p5, Node *p6) { return nconc(list(p1, p2, p3), list(p4, p5, p6)); } List *list(Node *p1, Node *p2, Node *p3, Node *p4, Node *p5, Node *p6, Node *p7) { return nconc(list(p1, p2, p3), list(p4, p5, p6, p7)); } List *list(Node *p1, Node *p2, Node *p3, Node *p4, Node *p5, Node *p6, Node *p7, Node *p8) { return nconc(list(p1, p2, p3, p4), list(p5, p6, p7, p8)); } Node *copy(Node *p) { return append(p, 0); } // q may be a leaf // Node *append(Node *p, Node *q) { Node *result, *tail; if(!p) { if(q->is_atom()) return cons(q, 0); else return q; } result = tail = cons(p->car(), 0); p = p->cdr(); while(p != 0) { Node *cell = cons(p->car(), 0); tail->set_cdr(cell); tail = cell; p = p->cdr(); } if(q != 0 && q->is_atom()) tail->set_cdr(cons(q, 0)); else tail->set_cdr(q); return result; } /* replace_all() substitutes SUBST for all occurences of ORIG in LIST. It recursively searches LIST for ORIG. */ Node *replace_all(Node *list, Node *orig, Node *subst) { if(list && orig && *list == *orig) return subst; else if(list == 0 || list->is_atom()) return list; else { Array newlist; bool changed = false; Node *rest = list; while(rest != 0) { Node *p = rest->car(); Node *q = replace_all(p, orig, subst); newlist.append(q); if(p != q) changed = true; rest = rest->cdr(); } if(changed) return newlist.all(); else return list; } } Node *subst(Node *newone, Node *old, Node *tree) { if(old == tree) return newone; else if(tree== 0 || tree->is_atom()) return tree; else { Node *head = tree->car(); Node *head2 = subst(newone, old, head); Node *tail = tree->cdr(); Node *tail2 = tail == 0 ? tail : subst(newone, old, tail); if(head == head2 && tail == tail2) return tree; else return cons(head2, tail2); } } Node *subst(Node *newone1, Node *old1, Node *newone2, Node *old2, Node *tree) { if(old1 == tree) return newone1; else if(old2 == tree) return newone2; else if(tree == 0 || tree->is_atom()) return tree; else { Node *head = tree->car(); Node *head2 = subst(newone1, old1, newone2, old2, head); Node *tail = tree->cdr(); Node *tail2 = tail == 0 ? tail : subst(newone1, old1, newone2, old2, tail); if(head == head2 && tail == tail2) return tree; else return cons(head2, tail2); } } Node *subst(Node *newone1, Node *old1, Node *newone2, Node *old2, Node *newone3, Node *old3, Node *tree) { if(old1 == tree) return newone1; else if(old2 == tree) return newone2; else if(old3 == tree) return newone3; else if(tree == 0 || tree->is_atom()) return tree; else { Node *head = tree->car(); Node *head2 = subst(newone1, old1, newone2, old2, newone3, old3, head); Node *tail = tree->cdr(); Node *tail2 = tail == 0 ? tail : subst(newone1, old1, newone2, old2, newone3, old3, tail); if(head == head2 && tail == tail2) return tree; else return cons(head2, tail2); } } // shallow_subst() doesn't recursively apply substitution to a subtree. Node *shallow_subst(Node *newone, Node *old, Node *tree) { if(old == tree) return newone; else if(tree== 0 || tree->is_atom()) return tree; else { Node *head, *head2; head = tree->car(); if(old == head) head2 = newone; else head2 = head; Node *tail = tree->cdr(); Node *tail2 = (tail == 0) ? tail : shallow_subst(newone, old, tail); if(head == head2 && tail == tail2) return tree; else return cons(head2, tail2); } } Node *shallow_subst(Node *newone1, Node *old1, Node *newone2, Node *old2, Node *tree) { if(old1 == tree) return newone1; else if(old2 == tree) return newone2; else if(tree == 0 || tree->is_atom()) return tree; else { Node *head, *head2; head = tree->car(); if(old1 == head) head2 = newone1; else if(old2 == head) head2 = newone2; else head2 = head; Node *tail = tree->cdr(); Node *tail2 = tail == 0 ? tail : shallow_subst(newone1, old1, newone2, old2, tail); if(head == head2 && tail == tail2) return tree; else return cons(head2, tail2); } } Node *shallow_subst(Node *newone1, Node *old1, Node *newone2, Node *old2, Node *newone3, Node *old3, Node *tree) { if(old1 == tree) return newone1; else if(old2 == tree) return newone2; else if(old3 == tree) return newone3; else if(tree == 0 || tree->is_atom()) return tree; else { Node *head, *head2; head = tree->car(); if(old1 == head) head2 = newone1; else if(old2 == head) head2 = newone2; else if(old3 == head) head2 = newone3; else head2 = head; Node *tail = tree->cdr(); Node *tail2 = tail == 0 ? tail : shallow_subst(newone1, old1, newone2, old2, newone3, old3, tail); if(head == head2 && tail == tail2) return tree; else return cons(head2, tail2); } } Node *shallow_subst(Node *newone1, Node *old1, Node *newone2, Node *old2, Node *newone3, Node *old3, Node *newone4, Node *old4, Node *tree) { if(old1 == tree) return newone1; else if(old2 == tree) return newone2; else if(old3 == tree) return newone3; else if(old4 == tree) return newone4; else if(tree == 0 || tree->is_atom()) return tree; else { Node *head, *head2; head = tree->car(); if(old1 == head) head2 = newone1; else if(old2 == head) head2 = newone2; else if(old3 == head) head2 = newone3; else if(old4 == head) head2 = newone4; else head2 = head; Node *tail = tree->cdr(); Node *tail2 = tail == 0 ? tail : shallow_subst(newone1, old1, newone2, old2, newone3, old3, newone4, old4, tail); if(head == head2 && tail == tail2) return tree; else return cons(head2, tail2); } } Node *subst_sublist(Node *newsub, Node *oldsub, Node *lst) { if(lst == oldsub) return newsub; else return cons(lst->car(), subst_sublist(newsub, oldsub, lst->cdr())); } Node *snoc(Node *p, Node *q) { return nconc(p, cons(q, 0)); } /* nconc is desctructive append */ Node *nconc(Node *p, Node *q) { if(!p) return q; else { last(p)->set_cdr(q); return p; } } Node *nconc(Node *p, Node *q, Node *r) { return nconc(p, nconc(q, r)); } } } synopsis-0.12/src/Synopsis/SymbolFactory.cc0000664000076400007640000004114111104702322020372 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include #include #include #include #include using namespace Synopsis; using namespace PTree; using namespace SymbolLookup; using namespace TypeAnalysis; namespace { PTree::Node const *strip_cv_from_integral_type(PTree::Node const *integral) { if(integral == 0) return 0; if(!integral->is_atom()) { if(PTree::is_a(integral->car(), Token::CONST, Token::VOLATILE)) return PTree::second(integral); else if(PTree::is_a(PTree::second(integral), Token::CONST, Token::VOLATILE)) return integral->car(); } return integral; } PTree::ClassSpec const *get_class_template_spec(PTree::Node const *body) { if(*PTree::third(body) == ';') // template declaration { PTree::Node const *spec = strip_cv_from_integral_type(PTree::second(body)); return dynamic_cast(spec); } return 0; } //. Look up the scope corresponding to a base-specifier. //. FIXME: The lookup may require a template instantiation, or //. fail because it involves a dependent name. This requires //. more design. class BaseClassScopeFinder : private PTree::Visitor { public: BaseClassScopeFinder(Scope const *scope) : my_scope(scope), my_result(0) {} Class *lookup(PTree::Node const *node) { const_cast(node)->accept(this); return my_result; } private: virtual void visit(Identifier *node) { Encoding name = Encoding::simple_name(node); SymbolSet symbols = my_scope->lookup(name, Scope::ELABORATE); if (symbols.empty()) throw Undefined(name, node); else { ClassName const *class_ = dynamic_cast(*symbols.begin()); if (!class_) throw InternalError("Base specifier not a class."); my_result = class_->as_scope(); } } virtual void visit(Name *node) { Encoding name = node->encoded_name(); // FIXME: This will fail if the name is a template or a dependent name. SymbolSet symbols = my_scope->lookup(name, Scope::ELABORATE); if (symbols.empty()) throw Undefined(name, node); else { ClassName const *class_ = dynamic_cast(*symbols.begin()); if (!class_) throw InternalError("Base specifier not a class."); my_result = class_->as_scope(); } } Scope const *my_scope; Class * my_result; }; } SymbolFactory::SymbolFactory(Language l) : my_language(l), my_prototype(0), my_template_parameters(0) { // define the global scope my_scopes.push(new Namespace(0, 0)); } void SymbolFactory::enter_scope(PTree::NamespaceSpec const *spec) { Trace trace("SymbolFactory::enter_scope(NamespaceSpec)", Trace::SYMBOLLOOKUP); if (my_language == NONE) return; // Namespaces are only valid within namespaces. Namespace *scope = dynamic_cast(my_scopes.top()); assert(scope); Namespace *namespace_ = 0; // If the namespace was already opened before, we add a reference // to it under the current NamespaceSpec, too. if ((namespace_ = scope->find_namespace(spec))) { scope->declare_scope(spec, namespace_); } else { // This is a new namespace. Declare it. namespace_ = new Namespace(spec, scope); scope->declare_scope(spec, namespace_); } my_scopes.push(namespace_); } void SymbolFactory::enter_scope(PTree::ClassSpec const *spec) { Trace trace("SymbolFactory::enter_scope(ClassSpec)", Trace::SYMBOLLOOKUP); if (my_language == NONE) return; BaseClassScopeFinder base_finder(my_scopes.top()); Class::Bases bases; for (PTree::Node const *base_clause = spec->base_clause(); base_clause; base_clause = PTree::rest(PTree::rest(base_clause))) { // The last node is the name, the others access specs or 'virtual' PTree::Node const *parent = PTree::last(PTree::second(base_clause))->car(); Class *class_ = base_finder.lookup(parent); if (class_) bases.push_back(class_); else ; // FIXME } Scope *scope = my_scopes.top(); Class *class_ = new Class(spec, scope, bases, my_template_parameters); scope->declare_scope(spec, class_); my_scopes.push(class_); my_template_parameters = 0; } void SymbolFactory::enter_scope(PTree::Node const *decl) { Trace trace("SymbolFactory::enter_scope(Node)", Trace::SYMBOLLOOKUP); if (my_language == NONE) return; Scope *scope = my_scopes.top(); // Create a PrototypeScope. If this is part of a function definition, we will // later convert it into a FunctionScope. my_prototype = new PrototypeScope(decl, scope, my_template_parameters); scope->declare_scope(decl, my_prototype); my_scopes.push(my_prototype); my_template_parameters = 0; } void SymbolFactory::enter_scope(PTree::FunctionDefinition const *decl) { Trace trace("SymbolFactory::enter_scope(FunctionDefinition)", Trace::SYMBOLLOOKUP); if (my_language == NONE) return; Scope *scope = my_scopes.top(); assert(my_prototype); my_prototype->ref(); scope->remove_scope(my_prototype->declaration()); // look at the declarator's encoded name Encoding name = PTree::third(decl)->encoded_name(); if (name.is_qualified()) scope = lookup_scope_of_qname(name, PTree::third(decl)); // Transfer all symbols from the previously seen function declaration // into the newly created FunctionScope, and remove the PrototypeScope. FunctionScope *func = new FunctionScope(decl, my_prototype, scope); scope->declare_scope(decl, func); my_prototype = 0; my_scopes.push(func); } void SymbolFactory::enter_scope(PTree::TemplateDecl const *params) { Trace trace("SymbolFactory::enter_scope(TemplateDecl)", Trace::SYMBOLLOOKUP); if (my_language == NONE) return; Scope *scope = my_scopes.top(); TemplateParameterScope *templ = new TemplateParameterScope(params, scope); scope->declare_scope(params, templ); my_scopes.push(templ); } void SymbolFactory::enter_scope(PTree::Block const *block) { Trace trace("SymbolFactory::enter_scope(Block)", Trace::SYMBOLLOOKUP); if (my_language == NONE) return; Scope *scope = my_scopes.top(); LocalScope *local = new LocalScope(block, scope); scope->declare_scope(block, local); my_scopes.push(local); } void SymbolFactory::leave_scope() { Trace trace("SymbolFactory::leave_scope", Trace::SYMBOLLOOKUP); if (my_language == NONE) return; Scope *scope = my_scopes.top(); my_scopes.pop(); // If this was a function prototype, keep it in case we see // the function body and want to transform it into a function // scope. if (PrototypeScope *ps = dynamic_cast(scope)) my_prototype = ps; else if (TemplateParameterScope *ts = dynamic_cast(scope)) my_template_parameters = ts; else scope->unref(); } void SymbolFactory::declare(PTree::Declaration const *d) { Trace trace("SymbolFactory::declare(Declaration *)", Trace::SYMBOLLOOKUP); if (my_language == NONE) return; PTree::Node const *decls = PTree::third(d); if(PTree::is_a(decls, Token::ntDeclarator)) { // function definition, // declare it only once (but allow overloading) PTree::Encoding name = decls->encoded_name(); PTree::Encoding type = decls->encoded_type(); // If the name is qualified, it has to be // declared already. If it hasn't, raise an error. Scope *scope = my_scopes.top(); if (name.is_qualified()) { scope = lookup_scope_of_qname(name, decls); SymbolSet symbols = scope->find(name, Scope::DECLARATION); // FIXME: We need type analysis / overload resolution // here to take the right symbol. Symbol const *symbol = *symbols.begin(); // TODO: check whether this is the definition of a previously // declared function, according to 3.1/2 [basic.def] scope->remove(symbol); } scope->declare(name, new FunctionName(type, d, true, scope)); } else { // Function or variable declaration. // PTree::Node const *storage_spec = PTree::first(d); // PTree::Node const *type_spec = PTree::second(d); if (decls->is_atom()) ; // it is a ';' else { for (; decls; decls = decls->cdr()) { PTree::Node const *decl = decls->car(); if (PTree::is_a(decl, Token::ntDeclarator)) { PTree::Encoding name = decl->encoded_name(); PTree::Encoding const &type = decl->encoded_type(); Scope *scope = my_scopes.top(); if (name.is_qualified()) { SymbolSet symbols = scope->lookup(name, Scope::DECLARATION); if (symbols.empty()) throw Undefined(name, decl); // FIXME: We need type analysis / overload resolution // here to take the right symbol. Symbol const *symbol = *symbols.begin(); while (name.is_qualified()) name = name.get_symbol(); scope = symbol->scope(); // TODO: check whether this is the definition of a previously // declared variable, according to 3.1/2 [basic.def] scope->remove(symbol); } if (type.is_function()) // It's a function declaration. scope->declare(name, new FunctionName(type, decl, false, scope)); else // It's a variable definition. scope->declare(name, new VariableName(type, decl, true, scope)); } } } } } void SymbolFactory::declare(Typedef const *td) { Trace trace("SymbolFactory::declare(Typedef *)", Trace::SYMBOLLOOKUP); if (my_language == NONE) return; PTree::Node const *declarations = third(td); while(declarations) { PTree::Node const *d = declarations->car(); if(type_of(d) == Token::ntDeclarator) { Encoding const &name = d->encoded_name(); Encoding const &type = d->encoded_type(); Scope *scope = my_scopes.top(); scope->declare(name, new TypedefName(type, d, scope)); } declarations = tail(declarations, 2); } } void SymbolFactory::declare(EnumSpec const *spec) { Trace trace("SymbolFactory::declare(EnumSpec *)", Trace::SYMBOLLOOKUP); if (my_language == NONE) return; PTree::Node const *tag = second(spec); Encoding const &name = spec->encoded_name(); Encoding const &type = spec->encoded_type(); Scope *scope = my_scopes.top(); if(tag && tag->is_atom()) scope->declare(name, new EnumName(type, spec, my_scopes.top())); // else it's an anonymous enum PTree::Node const *body = third(spec); // The numeric value of an enumerator is either specified // by an explicit initializer or it is determined by incrementing // by one the value of the previous enumerator. // The default value for the first enumerator is 0 long value = -1; for (PTree::Node const *e = second(body); e; e = rest(rest(e))) { PTree::Node const *enumerator = e->car(); bool defined = true; if (enumerator->is_atom()) ++value; else // [identifier = initializer] { PTree::Node const *initializer = third(enumerator); defined = evaluate_const(current_scope(), initializer, value); enumerator = enumerator->car(); #ifndef NDEBUG if (!defined) { std::cerr << "Error in evaluating enum initializer:\n" << "Expression doesn't evaluate to a constant integral value:\n" << reify(initializer) << std::endl; } #endif } assert(enumerator->is_atom()); PTree::Encoding name(enumerator->position(), enumerator->length()); if (defined) scope->declare(name, new ConstName(type, value, enumerator, true, scope)); else scope->declare(name, new ConstName(type, enumerator, true, scope)); } } void SymbolFactory::declare(NamespaceSpec const *spec) { Trace trace("SymbolFactory::declare(NamespaceSpec *)", Trace::SYMBOLLOOKUP); if (my_language == NONE) return; // Beware anonymous namespaces ! Encoding name; if (second(spec)) name.simple_name(second(spec)); else name.append_with_length(""); Scope *scope = my_scopes.top(); // Namespaces can be reopened, so only declare it if it isn't already known. SymbolSet symbols = scope->find(name, Scope::SCOPE); if (symbols.empty()) { scope->declare(name, new NamespaceName(spec->encoded_type(), spec, true, scope)); } // FIXME: assert that the found symbol really refers to a namespace ! } void SymbolFactory::declare(ClassSpec const *spec) { Trace trace("SymbolFactory::declare(ClassSpec *)", Trace::SYMBOLLOOKUP); if (my_language == NONE) return; Encoding const &name = spec->encoded_name(); // If class spec contains a class body, it's a definition. PTree::ClassBody const *body = const_cast(spec)->body(); Scope *scope = my_scopes.top(); SymbolSet symbols = scope->find(name, Scope::DEFAULT); for (SymbolSet::iterator i = symbols.begin(); i != symbols.end(); ++i) { // If the symbol was defined as a different type, the program is ill-formed. // Else if the symbol corresponds to a forward-declared class, replace it. if (ClassName const *class_ = dynamic_cast(*i)) { if (class_->is_definition()) { if (body) throw MultiplyDefined(name, spec, class_->ptree()); // ODR else return; // Ignore forward declaration if symbol is already defined. } else if (body) scope->remove(*i); // Remove forward declaration. else return; // Don't issue another forward declaration. } else if (TypeName const *type = dynamic_cast(*i)) // Symbol already defined as different type. throw MultiplyDefined(name, spec, type->ptree()); } if (body) scope->declare(name, new ClassName(spec->encoded_type(), spec, true, scope)); else scope->declare(name, new ClassName(spec->encoded_type(), spec, false, scope)); } void SymbolFactory::declare(TemplateDecl const *tdecl) { Trace trace("SymbolFactory::declare(TemplateDecl *)", Trace::SYMBOLLOOKUP); if (my_language == NONE) return; PTree::Node const *body = PTree::nth(tdecl, 4); PTree::ClassSpec const *class_spec = get_class_template_spec(body); Scope *scope = my_scopes.top(); if (class_spec) { Encoding const &name = class_spec->encoded_name(); scope->declare(name, new ClassTemplateName(Encoding(), tdecl, true, scope)); } else { PTree::Node const *decl = PTree::third(body); PTree::Encoding const &name = decl->encoded_name(); scope->declare(name, new FunctionTemplateName(Encoding(), decl, scope)); } } void SymbolFactory::declare(PTree::TypeParameter const *tparam) { Trace trace("SymbolFactory::declare(TypeParameter *)", Trace::SYMBOLLOOKUP); Scope *scope = my_scopes.top(); PTree::Node const *first = PTree::first(tparam); if (dynamic_cast(first) || dynamic_cast(first)) { PTree::Node const *second = PTree::second(tparam); PTree::Encoding name; name.simple_name(second); scope->declare(name, new TypeName(Encoding(), tparam, true, scope)); } else if (PTree::TemplateDecl const *tdecl = dynamic_cast(first)) { // tdecl has 4 or 5 members: // [template < parameter-list > class id] // [template < parameter-list > class] Encoding name; PTree::Node const *pname = PTree::nth(tdecl, 5); if (pname) name.simple_name(pname); scope->declare(name, new ClassTemplateName(Encoding(), tdecl, true, scope)); } } void SymbolFactory::declare(PTree::UsingDirective const *usingdir) { Trace trace("SymbolFactory::declare(UsingDirective *)", Trace::SYMBOLLOOKUP); if (my_language == NONE) return; my_scopes.top()->use(usingdir); } void SymbolFactory::declare(PTree::ParameterDeclaration const *pdecl) { Trace trace("SymbolFactory::declare(ParameterDeclaration *)", Trace::SYMBOLLOOKUP); if (my_language == NONE) return; PTree::Node const *decl = PTree::third(pdecl); PTree::Encoding const &name = decl->encoded_name(); PTree::Encoding const &type = decl->encoded_type(); if (!name.empty()) { Scope *scope = my_scopes.top(); scope->declare(name, new VariableName(type, decl, true, scope)); } } void SymbolFactory::declare(PTree::UsingDeclaration const *) { Trace trace("SymbolFactory::declare(UsingDeclaration *)", Trace::SYMBOLLOOKUP); trace << "TBD !"; if (my_language == NONE) return; } Scope *SymbolFactory::lookup_scope_of_qname(PTree::Encoding &name, PTree::Node const *decl) { Trace trace("SymbolFactory::lookup_scope_of_qname", Trace::SYMBOLLOOKUP); Scope *scope = my_scopes.top(); SymbolSet symbols = scope->lookup(name, Scope::DECLARATION); if (symbols.empty()) throw Undefined(name, decl); Symbol const *symbol = *symbols.begin(); while (name.is_qualified()) name = name.get_symbol(); scope = symbol->scope(); return scope; } synopsis-0.12/src/Synopsis/config.hh0000664000076400007640000000226711104702314017063 0ustar stefanstefan// // Copyright (C) 2007 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_config_hh_ #define Synopsis_config_hh_ // The following code is an adaptation from suggestions made // at http://gcc.gnu.org/wiki/Visibility // Shared library support #ifdef WIN32 #define SYN_IMPORT __declspec(dllimport) #define SYN_EXPORT __declspec(dllexport) #define SYN_DSO_LOCAL #define SYN_DSO_PUBLIC #else #define SYN_IMPORT #ifdef GCC_HASCLASSVISIBILITY #define SYN_IMPORT __attribute__ ((visibility("default"))) #define SYN_EXPORT __attribute__ ((visibility("default"))) #define SYN_DSO_LOCAL __attribute__ ((visibility("hidden"))) #define SYN_DSO_PUBLIC __attribute__ ((visibility("default"))) #else #define SYN_IMPORT #define SYN_EXPORT #define SYN_DSO_LOCAL #define SYN_DSO_PUBLIC #endif #endif // Define SYNOPSIS_API for DSO builds #ifdef SYNOPSIS_DSO #ifdef SYNOPSIS_DSO_EXPORTS #define SYNOPSIS_API SYN_EXPORT #else #define SYNOPSIS_API SYN_IMPORT #endif // SYNOPSIS_DSO_EXPORTS #else #define SYNOPSIS_API #endif // SYNOPSIS_DSO #endif synopsis-0.12/src/Synopsis/Timer.hh0000664000076400007640000000071411104702314016671 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_Timer_hh_ #define Synopsis_Timer_hh_ #include namespace Synopsis { class Timer { public: Timer() : my_start(std::clock()) {} double elapsed() const { return double(std::clock() - my_start) / CLOCKS_PER_SEC;} private: std::clock_t my_start; }; } #endif synopsis-0.12/src/Synopsis/Lexer.cc0000664000076400007640000004340011164451333016665 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include "Synopsis/Lexer.hh" #include "Synopsis/Buffer.hh" #include #include #include using namespace Synopsis; Lexer::Lexer(Buffer *buffer, int tokenset) : my_buffer(buffer), my_token(my_buffer->ptr(), 0, '\n') { my_keywords["asm"] = Token::ATTRIBUTE; my_keywords["auto"] = Token::AUTO; my_keywords["break"] = Token::BREAK; my_keywords["case"] = Token::CASE; my_keywords["char"] = Token::CHAR; // FIXME: Add support for _Complex to Parser. my_keywords["_Complex"] = Token::Ignore; my_keywords["const"] = Token::CONST; my_keywords["continue"] = Token::CONTINUE; my_keywords["default"] = Token::DEFAULT; my_keywords["do"] = Token::DO; my_keywords["double"] = Token::DOUBLE; my_keywords["else"] = Token::ELSE; my_keywords["enum"] = Token::ENUM; my_keywords["extern"] = Token::EXTERN; my_keywords["float"] = Token::FLOAT; my_keywords["for"] = Token::FOR; my_keywords["goto"] = Token::GOTO; my_keywords["if"] = Token::IF; my_keywords["inline"] = Token::INLINE; my_keywords["int"] = Token::INT; my_keywords["long"] = Token::LONG; my_keywords["register"] = Token::REGISTER; my_keywords["return"] = Token::RETURN; my_keywords["short"] = Token::SHORT; my_keywords["signed"] = Token::SIGNED; my_keywords["sizeof"] = Token::SIZEOF; my_keywords["static"] = Token::STATIC; my_keywords["struct"] = Token::STRUCT; my_keywords["switch"] = Token::SWITCH; my_keywords["typedef"] = Token::TYPEDEF; my_keywords["union"] = Token::UNION; my_keywords["unsigned"] = Token::UNSIGNED; my_keywords["void"] = Token::VOID; my_keywords["volatile"] = Token::VOLATILE; my_keywords["while"] = Token::WHILE; if (tokenset & CXX) { my_keywords["bool"] = Token::BOOLEAN; my_keywords["catch"] = Token::CATCH; my_keywords["class"] = Token::CLASS; my_keywords["delete"] = Token::DELETE; my_keywords["false"] = Token::Constant; my_keywords["friend"] = Token::FRIEND; my_keywords["mutable"] = Token::MUTABLE; my_keywords["namespace"] = Token::NAMESPACE; my_keywords["new"] = Token::NEW; my_keywords["operator"] = Token::OPERATOR; my_keywords["private"] = Token::PRIVATE; my_keywords["protected"] = Token::PROTECTED; my_keywords["public"] = Token::PUBLIC; my_keywords["template"] = Token::TEMPLATE; my_keywords["this"] = Token::THIS; my_keywords["throw"] = Token::THROW; my_keywords["true"] = Token::Constant; my_keywords["try"] = Token::TRY; my_keywords["typeid"] = Token::TYPEID; my_keywords["typename"] = Token::TYPENAME; my_keywords["using"] = Token::USING; my_keywords["virtual"] = Token::VIRTUAL; my_keywords["wchar_t"] = Token::WCHAR; } if (tokenset & GCC) { my_keywords["__alignof__"] = Token::SIZEOF; my_keywords["__asm"] = Token::ATTRIBUTE; my_keywords["__asm__"] = Token::ATTRIBUTE; my_keywords["__attribute__"] = Token::ATTRIBUTE; my_keywords["__builtin_offsetof"] = Token::OFFSETOF; my_keywords["__builtin_va_arg"] = Token::EXTENSION; // Is this correct ? my_keywords["__complex__"] = Token::Ignore; my_keywords["__const"] = Token::CONST; my_keywords["__extension__"] = Token::EXTENSION; my_keywords["__imag__"] = Token::Ignore; my_keywords["__inline"] = Token::INLINE; my_keywords["__inline__"] = Token::INLINE; my_keywords["__real__"] = Token::Ignore; my_keywords["__restrict"] = Token::Ignore; my_keywords["__restrict__"] = Token::Ignore; my_keywords["__signed"] = Token::SIGNED; my_keywords["__signed__"] = Token::SIGNED; my_keywords["typeof"] = Token::TYPEOF; my_keywords["__typeof"] = Token::TYPEOF; my_keywords["__typeof__"] = Token::TYPEOF; } if (tokenset & MSVC) { my_keywords["cdecl"] = Token::Ignore; my_keywords["_cdecl"] = Token::Ignore; my_keywords["__cdecl"] = Token::Ignore; my_keywords["_fastcall"] = Token::Ignore; my_keywords["__fastcall"] = Token::Ignore; my_keywords["_stdcall"] = Token::Ignore; my_keywords["__stdcall"] = Token::Ignore; my_keywords["__thiscall"] = Token::Ignore; my_keywords["_based"] = Token::Ignore; my_keywords["__based"] = Token::Ignore; my_keywords["_asm"] = Token::ASM; my_keywords["__asm"] = Token::ASM; my_keywords["_inline"] = Token::INLINE; my_keywords["__inline"] = Token::INLINE; my_keywords["__declspec"] = Token::DECLSPEC; my_keywords["__pragma"] = Token::PRAGMA; my_keywords["__int8"] = Token::CHAR; my_keywords["__int16"] = Token::SHORT; my_keywords["__int32"] = Token::INT; my_keywords["__int64"] = Token::INT64; my_keywords["__w64"] = Token::Ignore; } } Token::Type Lexer::get_token(Token &t) { if (!fill(1)) return Token::BadToken; t = my_tokens.front(); my_tokens.pop(); return t.type; } Token::Type Lexer::look_ahead(size_t offset) { if (!fill(offset + 1)) return Token::BadToken; return my_tokens.at(offset).type; } Token::Type Lexer::look_ahead(size_t offset, Token &t) { if (!fill(offset + 1)) return Token::BadToken; t = my_tokens.at(offset); return t.type; } const char *Lexer::save() { if (!fill(1)) throw std::runtime_error("unexpected EOF"); Token current = my_tokens.front(); return current.ptr; } void Lexer::restore(const char *pos) { my_token.type = '\n'; my_token.ptr = my_buffer->ptr(); my_token.length = 0; my_tokens.clear(); rewind(pos); } unsigned long Lexer::origin(const char *ptr, std::string &filename) const { return my_buffer->origin(ptr, filename); } void Lexer::rewind(const char *p) { my_buffer->reset(p - my_buffer->ptr()); } Token::Type Lexer::read_token(const char *&ptr, size_t &length) { Token::Type t = Token::BadToken; while(true) { t = read_line(); if(t == Token::Ignore) continue; my_token.type = t; if(t == Token::ATTRIBUTE) { skip_attribute(); continue; } else if(t == Token::EXTENSION) { t = skip_extension(ptr, length); if(t == Token::Ignore) continue; else return t; } else if(t == Token::ASM) { skip_asm(); continue; } else if(t == Token::DECLSPEC) { skip_declspec(); continue; } else if(t == Token::PRAGMA) { skip_pragma(); continue; } if(t != '\n') break; } ptr = my_token.ptr; length = my_token.length; return t; } bool Lexer::fill(size_t o) { while (my_tokens.size() < o) { Token t; t.type = read_token(t.ptr, t.length); if (t.type == Token::BadToken) return false; my_tokens.push(t); } return true; } void Lexer::skip_attribute() { char c; do { c = my_buffer->get();} while(c != '(' && c != '\0'); if (c == '\0') return; skip_paren(); } Token::Type Lexer::skip_extension(const char *&ptr, size_t &length) { ptr = my_token.ptr; length = my_token.length; char c; do { c = my_buffer->get();} while(is_blank(c) || c == '\n'); #if 0 // FIXME: Figure out under what circumstances we need to skip // __extension__ (...) if(c != '(') { my_buffer->unget(); return Token::Ignore; // if no (..) follows, ignore __extension__ } skip_paren(); return Token::Identifier; // regards it as the identifier __extension__ #else my_buffer->unget(); return Token::Ignore; // if no (..) follows, ignore __extension__ #endif } inline bool check_end_of_instruction(Buffer *buffer, char c, const char *delimiter) { if (c == '\0') return true; if (strchr(delimiter, c)) { buffer->unget(); return true; } return false; } void Lexer::skip_paren() { size_t i = 1; do { char c = my_buffer->get(); if (c == '\0') return; if(c == '(') ++i; else if(c == ')') --i; } while(i > 0); } void Lexer::skip_line() { char c; do { c = my_buffer->get();} while(c != '\n' && c != '\0'); } /* You can have the following : Just count the '{' and '}' and it should be ok __asm { mov ax,1 mov bx,1 } Stop when EOL found. Note that the first ';' after an __asm instruction is an ASM comment ! int v; __asm mov ax,1 __asm mov bx,1; v=1; Stop when '}' found if (cond) {__asm mov ax,1 __asm mov bx,1} and certainly more... */ void Lexer::skip_asm() { char c; do { c = my_buffer->get(); if (check_end_of_instruction(my_buffer, c, "")) return; } while(is_blank(c) || c == '\n'); if(c == '{') { size_t i = 1; do { c = my_buffer->get(); if (check_end_of_instruction(my_buffer, c, "")) return; if(c == '{') ++i; else if(c == '}') --i; } while(i > 0); } else { while(true) { if (check_end_of_instruction(my_buffer, c, "}\n")) return; c = my_buffer->get(); } } } void Lexer::skip_declspec() { char c; do { c = my_buffer->get(); if (check_end_of_instruction(my_buffer, c, "")) return; } while(is_blank(c)); if (c == '(') { size_t i = 1; do { c = my_buffer->get(); if (check_end_of_instruction(my_buffer, c, "};")) return; if(c == '(') ++i; else if(c == ')') --i; } while(i > 0); } } void Lexer::skip_pragma() { char c = get_next_non_white_char(); if (c == '(') { size_t i = 1; do { c = my_buffer->get(); if (check_end_of_instruction(my_buffer, c, "};")) return; if(c == '(') ++i; else if(c == ')') --i; } while(i > 0); c = get_next_non_white_char(); // assume ';' } } char Lexer::get_next_non_white_char() { char c; while(true) { do { c = my_buffer->get();} while(is_blank(c)); if(c != '\\') break; c = my_buffer->get(); if(c != '\n' && c!= '\r') { my_buffer->unget(); break; } } return c; } Token::Type Lexer::read_line() { char c = get_next_non_white_char(); unsigned long top = my_buffer->position(); my_token.ptr = my_buffer->ptr(top); if(c == '\0') { my_buffer->unget(); return '\0'; } else if(c == '\n') return '\n'; else if(c == '#' && my_token.type == '\n') { skip_line(); return '\n'; } else if(c == '\'' || c == '"') { if(c == '\'') { if(read_char_const(top)) return Token::CharConst; } else { if(read_str_const(top)) return Token::StringL; } my_buffer->reset(top + 1); my_token.length = 1; return single_char_op(c); } else if(is_digit(c)) return read_number(c, top); else if(c == '.') { c = my_buffer->get(); if(is_digit(c)) return read_float(top); else { my_buffer->unget(); return read_separator('.', top); } } else if(is_letter(c)) { if (c == 'L') { c = my_buffer->get(); if (c == '\'' || c == '"') { if (c == '\'') { if (read_char_const(top+1)) { ++my_token.length; return Token::WideCharConst; } } else { if(read_str_const(top+1)) { ++my_token.length; return Token::WideStringL; } } } my_buffer->reset(top); } return read_identifier(top); } else return read_separator(c, top); } bool Lexer::read_char_const(unsigned long top) { while(true) { char c = my_buffer->get(); if(c == '\\') { c = my_buffer->get(); if(c == '\0') return false; } else if(c == '\'') { my_token.length = static_cast(my_buffer->position() - top + 1); return true; } else if(c == '\n' || c == '\0') return false; } } /* If text is a sequence of string constants like: "string1" "string2" L"string3" then the string constants are delt with as a single constant. */ bool Lexer::read_str_const(unsigned long top) { // Skip the L if there is one if (my_buffer->at(top) == 'L') my_buffer->get(); while(true) { char c = my_buffer->get(); if(c == '\\') { c = my_buffer->get(); if(c == '\0') return false; } else if(c == '"') { // We are past one string literal token now. // Any following whitespace needs to be skipped // before looking for anything else. unsigned long pos = my_buffer->position() + 1; while (true) { int nline = 0; // Consume whitespace. do { c = my_buffer->get(); if(c == '\n') ++nline; } while(is_blank(c) || c == '\n'); // Consume comment. if (c == '/') { char d = my_buffer->get(); if (d == '/' || d == '*') read_comment(d, my_buffer->position() - 2); else { my_buffer->unget(); break; } } else break; } if(c == '"') /* line_number += nline; */ ; else { my_token.length = static_cast(pos - top); my_buffer->reset(pos); return true; } } else if(c == '\n' || c == '\0') return false; } } Token::Type Lexer::read_number(char c, unsigned long top) { char c2 = my_buffer->get(); if(c == '0' && is_xletter(c2)) { do { c = my_buffer->get();} while(is_hexdigit(c)); while(is_int_suffix(c)) c = my_buffer->get(); my_buffer->unget(); my_token.length = static_cast(my_buffer->position() - top + 1); return Token::Constant; } while(is_digit(c2)) c2 = my_buffer->get(); if(is_int_suffix(c2)) do { c2 = my_buffer->get();} while(is_int_suffix(c2)); else if(c2 == '.') return read_float(top); else if(is_eletter(c2)) { my_buffer->unget(); return read_float(top); } my_buffer->unget(); my_token.length = static_cast(my_buffer->position() - top + 1); return Token::Constant; } Token::Type Lexer::read_float(unsigned long top) { char c; do { c = my_buffer->get();} while(is_digit(c)); if(is_float_suffix(c)) do { c = my_buffer->get();} while(is_float_suffix(c)); else if(is_eletter(c)) { unsigned long p = my_buffer->position(); c = my_buffer->get(); if(c == '+' || c == '-') { c = my_buffer->get(); if(!is_digit(c)) { my_buffer->reset(p); my_token.length = static_cast(p - top); return Token::Constant; } } else if(!is_digit(c)) { my_buffer->reset(p); my_token.length = static_cast(p - top); return Token::Constant; } do { c = my_buffer->get();} while(is_digit(c)); while(is_float_suffix(c)) c = my_buffer->get(); } my_buffer->unget(); my_token.length = static_cast(my_buffer->position() - top + 1); return Token::Constant; } Token::Type Lexer::read_identifier(unsigned long top) { char c; do { c = my_buffer->get();} while(is_letter(c) || is_digit(c)); my_token.length = static_cast(my_buffer->position() - top); my_buffer->unget(); return screen(my_buffer->ptr(top), my_token.length); } Token::Type Lexer::screen(const char *identifier, size_t length) { Dictionary::iterator i = my_keywords.find(std::string(identifier, length)); if (i != my_keywords.end()) return i->second; return Token::Identifier; } Token::Type Lexer::read_separator(char c, unsigned long top) { char c1 = my_buffer->get(); if (c1 == '\0') return Token::BadToken; my_token.length = 2; if(c1 == '=') { switch(c) { case '*' : case '/' : case '%' : case '+' : case '-' : case '&' : case '^' : case '|' : return Token::AssignOp; case '=' : case '!' : return Token::EqualOp; case '<' : case '>' : return Token::RelOp; default : my_buffer->unget(); my_token.length = 1; return single_char_op(c); } } else if(c == c1) { switch(c) { case '<' : case '>' : if(my_buffer->get() != '=') { my_buffer->unget(); return Token::ShiftOp; } else { my_token.length = 3; return Token::AssignOp; } case '|' : return Token::LogOrOp; case '&' : return Token::LogAndOp; case '+' : case '-' : return Token::IncOp; case ':' : return Token::Scope; case '.' : if(my_buffer->get() == '.') { my_token.length = 3; return Token::Ellipsis; } else my_buffer->unget(); case '/' : return read_comment(c1, top); default : my_buffer->unget(); my_token.length = 1; return single_char_op(c); } } else if(c == '.' && c1 == '*') return Token::PmOp; else if(c == '-' && c1 == '>') if(my_buffer->get() == '*') { my_token.length = 3; return Token::PmOp; } else { my_buffer->unget(); return Token::ArrowOp; } else if(c == '/' && c1 == '*') return read_comment(c1, top); else { my_buffer->unget(); my_token.length = 1; return single_char_op(c); } std::cerr << "*** An invalid character has been found! (" << (int)c << ',' << (int)c1 << ")\n"; return Token::BadToken; } Token::Type Lexer::single_char_op(unsigned char c) { /* !"#$%&'()*+,-./0123456789:;<=>? */ static char valid[] = "x xx xxxxxxxx xxxxxx"; if('!' <= c && c <= '?' && valid[c - '!'] == 'x') return c; else if(c == '[' || c == ']' || c == '^') return c; else if('{' <= c && c <= '~') return c; else if(c == '#') { // Skip to end of line do{ c = my_buffer->get();} while(c != '\n' && c != '\0'); return Token::Ignore; } else { std::cerr << "*** An invalid character has been found! ("<<(char)c<<")"<< std::endl; return Token::BadToken; } } Token::Type Lexer::read_comment(char c, unsigned long top) { unsigned long len = 0; if (c == '*') // a nested C-style comment is prohibited. do { c = my_buffer->get(); if (c == '*') { c = my_buffer->get(); if (c == '/') { len = 1; break; } else my_buffer->unget(); } } while(c != '\0'); else /* if (c == '/') */ do { c = my_buffer->get();} while(c != '\n' && c != '\0'); len += my_buffer->position() - top; my_token.length = static_cast(len); my_comments.push_back(Token(my_buffer->ptr(top), my_token.length, Token::Comment)); return Token::Ignore; } Lexer::Comments Lexer::get_comments() { Comments c = my_comments; my_comments.clear(); return c; } synopsis-0.12/src/Synopsis/Python/0000775000076400007640000000000011172123233016551 5ustar stefanstefansynopsis-0.12/src/Synopsis/Python/Object.hh0000664000076400007640000005417311171627616020327 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef _Synopsis_Python_Object_hh #define _Synopsis_Python_Object_hh #include #include #include #include #if PY_VERSION_HEX >= 0x02030000 # define PYTHON_HAS_BOOL 1 #else # define PYTHON_HAS_BOOL 0 #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #endif namespace Synopsis { namespace Python { class List; class Tuple; class Dict; class Module; class Interpreter; //. Object provides basic //. functionality to access the underlaying //. python object, to be used in subclasses and //. generic accessors such as (python) lists and tuples class Object { friend class List; friend class Tuple; friend class Dict; friend class Module; friend class Interpreter; public: struct TypeError : std::invalid_argument { TypeError(const std::string &msg = "") : std::invalid_argument(msg) {} }; struct AttributeError : std::invalid_argument { AttributeError(const std::string &msg = "") : std::invalid_argument(msg) {} }; struct KeyError : std::invalid_argument { KeyError(const std::string &msg = "") : std::invalid_argument(msg) {} }; struct ImportError : std::invalid_argument { ImportError(const std::string &msg = "") : std::invalid_argument(msg) {} }; Object() : my_impl(Py_None) { Py_INCREF(Py_None);} Object(PyObject *); Object(const Object &o) : my_impl(o.my_impl) { Py_INCREF(my_impl);} Object(const std::string &value) : my_impl(PyString_FromString(value.c_str())) {} Object(const char *value) : my_impl(PyString_FromString(value)) {} Object(char value) : my_impl(PyString_FromStringAndSize(&value, 1)) {} Object(double value) : my_impl(PyFloat_FromDouble(value)) {} Object(int value) : my_impl(PyInt_FromLong(value)) {} Object(unsigned int value) : my_impl(PyInt_FromLong(value)) {} Object(long value) : my_impl(PyInt_FromLong(value)) {} Object(bool value) : my_impl(PyInt_FromLong(value)) {} virtual ~Object() { Py_DECREF(my_impl);} Object &operator = (const Object &o); int hash() const { return PyObject_Hash(my_impl);} operator bool () const { int retn = PyObject_IsTrue(my_impl); if (retn == -1) check_exception(); return retn == 1; } Object type() const { return PyObject_Type(my_impl);} Object repr() const { return PyObject_Repr(my_impl);} Object str() const { return PyObject_Str(my_impl);} int cmp(Object o) const; Object boolean() const { return PyObject_IsTrue(my_impl);} bool is_instance(Object) const; void assert_type(const char *module, const char *type) const throw(TypeError); //. callable interface Object operator () (); Object operator () (Tuple); Object operator () (Tuple, Dict); Object get(Object) const; //. try to downcast to T, throw on failure template static T narrow(Object) throw(TypeError); //. more relaxed form of downcast, return None on failure template static T try_narrow(Object); static Object import(const std::string &name); Object attr(const std::string &) const; bool set_attr(const std::string &, Object); PyObject *ref() { Py_INCREF(my_impl); return my_impl;} int ref_count() const { return my_impl->ob_refcnt;} private: //. check for an exception and if set translate into //. a C++ exception that is thrown void check_exception() const; PyObject *my_impl; }; inline bool operator == (Object o1, Object o2) { return !o1.cmp(o2);} inline bool operator < (Object o1, Object o2) { return o1.cmp(o2) < 0;} inline bool operator > (Object o1, Object o2) { return o1.cmp(o2)> 0;} class Tuple : public Object { public: Tuple() : Object(PyTuple_New(0)) {} explicit Tuple(PyObject *); size_t size() const { return PyTuple_GET_SIZE(my_impl);} bool empty() const { return !size();} Tuple(Object); Tuple(Object, Object); Tuple(Object, Object, Object); Tuple(Object, Object, Object, Object); Tuple(Object, Object, Object, Object, Object); Tuple(Object, Object, Object, Object, Object, Object); Tuple(Object, Object, Object, Object, Object, Object, Object); Tuple(Object, Object, Object, Object, Object, Object, Object, Object); Tuple(Object, Object, Object, Object, Object, Object, Object, Object, Object); Object get(size_t i) const; }; class List : public Object { public: class iterator; class reverse_iterator; List(size_t i = 0) : Object(PyList_New(i)) {} List(Object) throw(TypeError); template List(I begin, I end); Tuple tuple() const { return Tuple(PyList_AsTuple(my_impl));} size_t size() const { return PyList_GET_SIZE(my_impl);} bool empty() const { return !size();} void set(int i, Object o); Object get(int i) const; void append(Object o) { PyList_Append(my_impl, o.my_impl);} void insert(int i, Object o) { PyList_Insert(my_impl, i, o.my_impl);} void extend(List l); void del(int i) { PySequence_DelItem(my_impl, i);} iterator begin() const; iterator end() const; iterator erase(iterator); reverse_iterator rbegin() const; reverse_iterator rend() const; List get_slice(int low, int high) const; List copy() const { return get_slice(0, -1);} bool sort() { return PyList_Sort(my_impl) == 0;} bool reverse() { return PyList_Reverse(my_impl) == 0;} private: PyObject *impl() { return my_impl;} // extend friendship }; class List::iterator { friend class List; public: iterator(const iterator &i) : my_list(i.my_list), my_pos(i.my_pos), my_current(i.my_current) {} iterator &operator = (const iterator &); bool operator == (iterator i); bool operator != (iterator i) { return !operator==(i);} const Object &operator *() { return my_current;} const Object *operator ->() { return &(operator *());} iterator operator ++(int) { incr(); return *this;} iterator operator ++() { iterator tmp = *this; incr(); return tmp;} iterator operator +(int i); iterator operator --(int) { decr(); return *this;} iterator operator --() { iterator tmp = *this; decr(); return tmp;} iterator operator -(int i); private: iterator(List l, int i) : my_list(l), my_pos(i) { if (my_pos >= 0) my_current = my_list.get(my_pos);} void incr(); void decr(); List my_list; Py_ssize_t my_pos; Object my_current; }; class List::reverse_iterator { friend class List; public: reverse_iterator(const reverse_iterator &i) : my_list(i.my_list), my_pos(i.my_pos), my_current(i.my_current) {} reverse_iterator &operator = (const reverse_iterator &); bool operator == (reverse_iterator i); bool operator != (reverse_iterator i) { return !operator==(i);} const Object &operator *() { return my_current;} const Object *operator ->() { return &(operator *());} reverse_iterator operator ++(int) { incr(); return *this;} reverse_iterator operator ++() { reverse_iterator tmp = *this; incr(); return tmp;} reverse_iterator operator +(int i); reverse_iterator operator --(int) { decr(); return *this;} reverse_iterator operator --() { reverse_iterator tmp = *this; decr(); return tmp;} reverse_iterator operator -(int i); private: reverse_iterator(List l, int i) : my_list(l), my_pos(i) { if (my_pos >= 0) my_current = my_list.get(my_pos);} void incr(); void decr(); List my_list; Py_ssize_t my_pos; Object my_current; }; class Dict : public Object { public: class iterator; friend class iterator; Dict() : Object(PyDict_New()) {} Dict(Object o) throw(TypeError) : Object(o) { if (!PyDict_Check(o.my_impl)) throw TypeError("object not a dict");} void set(Object k, Object v); Object get(Object k, Object d = Object()) const; bool has_key(Object k) const; bool del(Object k); iterator begin() const; iterator end() const; void clear() { PyDict_Clear(my_impl);} Dict copy() const { return Object(PyDict_Copy(my_impl));} bool update(Dict d) { return PyDict_Update(my_impl, d.my_impl) == 0;} List keys() const { return List(Object(PyDict_Keys(my_impl)));} List values() const { return List(Object(PyDict_Values(my_impl)));} List items() const { return List(Object(PyDict_Items(my_impl)));} private: PyObject *impl() { return my_impl;} // extend friendship }; class Dict::iterator { friend class Dict; public: iterator(const iterator &i) : my_dict(i.my_dict), my_pos(i.my_pos) {} iterator &operator = (const iterator &); bool operator == (iterator i); bool operator != (iterator i) { return !operator==(i);} const Tuple &operator *() { return my_current;} const Tuple *operator ->() { return &(operator *());} iterator operator ++(int) { incr(); return *this;} iterator operator ++() { iterator tmp = *this; incr(); return tmp;} private: iterator(Dict, int); void incr(); Dict my_dict; Py_ssize_t my_pos; Tuple my_current; }; inline Object::Object(PyObject *o) : my_impl(o) { if (!my_impl) { check_exception(); my_impl = Py_None; Py_INCREF(Py_None); } } inline Object &Object::operator = (const Object &o) { if (my_impl != o.my_impl) { Py_DECREF(my_impl); my_impl = o.my_impl; Py_INCREF(my_impl); } return *this; } inline int Object::cmp(Object o) const { int result = PyObject_Compare(my_impl, o.my_impl); check_exception(); return result; } inline bool Object::is_instance(Object o) const { return PyObject_IsInstance(my_impl, o.my_impl) == 1; } inline void Object::assert_type(const char *module_name, const char *type_name) const throw(TypeError) { Object module = Object::import(module_name); if (!is_instance(module.attr(type_name))) { std::string msg = "object not a "; msg += module_name; msg += "."; msg += type_name; msg += " (was "; Object type = attr("__class__").repr(); msg += PyString_AS_STRING(type.my_impl); msg += ")"; throw TypeError(msg); } } inline Object Object::import(const std::string &name) { PyObject *retn = PyImport_ImportModule(const_cast(name.c_str())); if (!retn) throw ImportError(name); else return Object(retn); } inline Object Object::attr(const std::string &name) const { PyObject *retn = PyObject_GetAttrString(my_impl, const_cast(name.c_str())); if (!retn) throw AttributeError(name.c_str()); else return Object(retn); } inline bool Object::set_attr(const std::string &name, Object value) { int retn = PyObject_SetAttrString(my_impl, const_cast(name.c_str()), value.ref()); return retn != -1; } inline Object Object::get(Object k) const { PyObject *retn = PyObject_GetItem(my_impl, k.my_impl); if (!retn) check_exception(); Py_INCREF(retn); return Object(retn); } template inline T Object::narrow(Object o) throw(Object::TypeError) { T retn(o.my_impl); Py_INCREF(o.my_impl); return retn; } template inline T Object::try_narrow(Object o) { try { T retn(o.my_impl); Py_INCREF(o.my_impl); return retn; } catch (const TypeError &) { return T();} } template <> inline char Object::narrow(Object o) throw(Object::TypeError) { if (!PyString_Check(o.my_impl) || PyString_GET_SIZE(o.my_impl) != 1) throw TypeError("object not a character"); char *value; Py_ssize_t length; PyString_AsStringAndSize(o.my_impl, &value, &length); return value[0]; } template <> inline const char *Object::narrow(Object o) throw(Object::TypeError) { if (!PyString_Check(o.my_impl)) throw TypeError("object not a string"); return PyString_AS_STRING(o.my_impl); } template <> inline std::string Object::narrow(Object o) throw(Object::TypeError) { if (!PyString_Check(o.my_impl)) throw TypeError("object not a string"); return PyString_AS_STRING(o.my_impl); } template <> inline double Object::narrow(Object o) throw(Object::TypeError) { if (!PyFloat_Check(o.my_impl)) throw TypeError("object not a float"); return PyFloat_AsDouble(o.my_impl); } template <> inline long Object::narrow(Object o) throw(Object::TypeError) { if (!PyInt_Check(o.my_impl)) throw TypeError("object not an integer"); return PyInt_AsLong(o.my_impl); } template <> inline bool Object::narrow(Object o) throw(Object::TypeError) { #if 0 //PYTHON_HAS_BOOL if (!PyBool_Check(o.my_impl)) throw TypeError("object not a boolean"); #else if (!PyInt_Check(o.my_impl)) throw TypeError("object not an integer"); #endif return PyInt_AsLong(o.my_impl); } inline void Object::check_exception() const { PyObject *exc = PyErr_Occurred(); if (!exc) return; PyObject *type, *value, *trace; // PyErr_Print(); PyErr_Fetch(&type, &value, &trace); Object t(type), v(value), tr(trace); // to release the reference at end of scope std::cerr << trace << ' ' << Object::narrow(tr.str()) << std::endl; if (exc == PyExc_KeyError) throw KeyError(Object::narrow(v.str())); else if (exc == PyExc_TypeError) throw TypeError(Object::narrow(v.str())); else if (exc == PyExc_AttributeError) throw AttributeError(); throw std::runtime_error(PyString_AsString(value)); } inline std::ostream &operator << (std::ostream &os, const Object &o) { return os << Object::narrow(o.str()); } inline Object Object::operator () () { return PyObject_CallObject(my_impl, 0); } inline Object Object::operator () (Tuple args) { return PyObject_Call(my_impl, args.my_impl, 0); } inline Object Object::operator () (Tuple args, Dict kwds) { return PyObject_Call(my_impl, args.my_impl, kwds.my_impl); } inline Tuple::Tuple(PyObject *o) : Object(o) { if (!PyTuple_Check(o)) throw TypeError("object not a tuple"); } inline Tuple::Tuple(Object o) : Object(PyTuple_New(1)) { PyTuple_SET_ITEM(my_impl, 0, o.my_impl); Py_INCREF(o.my_impl); } inline Tuple::Tuple(Object o1, Object o2) : Object(PyTuple_New(2)) { PyTuple_SET_ITEM(my_impl, 0, o1.my_impl); Py_INCREF(o1.my_impl); PyTuple_SET_ITEM(my_impl, 1, o2.my_impl); Py_INCREF(o2.my_impl); } inline Tuple::Tuple(Object o1, Object o2, Object o3) : Object(PyTuple_New(3)) { PyTuple_SET_ITEM(my_impl, 0, o1.my_impl); Py_INCREF(o1.my_impl); PyTuple_SET_ITEM(my_impl, 1, o2.my_impl); Py_INCREF(o2.my_impl); PyTuple_SET_ITEM(my_impl, 2, o3.my_impl); Py_INCREF(o3.my_impl); } inline Tuple::Tuple(Object o1, Object o2, Object o3, Object o4) : Object(PyTuple_New(4)) { PyTuple_SET_ITEM(my_impl, 0, o1.my_impl); Py_INCREF(o1.my_impl); PyTuple_SET_ITEM(my_impl, 1, o2.my_impl); Py_INCREF(o2.my_impl); PyTuple_SET_ITEM(my_impl, 2, o3.my_impl); Py_INCREF(o3.my_impl); PyTuple_SET_ITEM(my_impl, 3, o4.my_impl); Py_INCREF(o4.my_impl); } inline Tuple::Tuple(Object o1, Object o2, Object o3, Object o4, Object o5) : Object(PyTuple_New(5)) { PyTuple_SET_ITEM(my_impl, 0, o1.my_impl); Py_INCREF(o1.my_impl); PyTuple_SET_ITEM(my_impl, 1, o2.my_impl); Py_INCREF(o2.my_impl); PyTuple_SET_ITEM(my_impl, 2, o3.my_impl); Py_INCREF(o3.my_impl); PyTuple_SET_ITEM(my_impl, 3, o4.my_impl); Py_INCREF(o4.my_impl); PyTuple_SET_ITEM(my_impl, 4, o5.my_impl); Py_INCREF(o5.my_impl); } inline Tuple::Tuple(Object o1, Object o2, Object o3, Object o4, Object o5, Object o6) : Object(PyTuple_New(6)) { PyTuple_SET_ITEM(my_impl, 0, o1.my_impl); Py_INCREF(o1.my_impl); PyTuple_SET_ITEM(my_impl, 1, o2.my_impl); Py_INCREF(o2.my_impl); PyTuple_SET_ITEM(my_impl, 2, o3.my_impl); Py_INCREF(o3.my_impl); PyTuple_SET_ITEM(my_impl, 3, o4.my_impl); Py_INCREF(o4.my_impl); PyTuple_SET_ITEM(my_impl, 4, o5.my_impl); Py_INCREF(o5.my_impl); PyTuple_SET_ITEM(my_impl, 5, o6.my_impl); Py_INCREF(o6.my_impl); } inline Tuple::Tuple(Object o1, Object o2, Object o3, Object o4, Object o5, Object o6, Object o7) : Object(PyTuple_New(7)) { PyTuple_SET_ITEM(my_impl, 0, o1.my_impl); Py_INCREF(o1.my_impl); PyTuple_SET_ITEM(my_impl, 1, o2.my_impl); Py_INCREF(o2.my_impl); PyTuple_SET_ITEM(my_impl, 2, o3.my_impl); Py_INCREF(o3.my_impl); PyTuple_SET_ITEM(my_impl, 3, o4.my_impl); Py_INCREF(o4.my_impl); PyTuple_SET_ITEM(my_impl, 4, o5.my_impl); Py_INCREF(o5.my_impl); PyTuple_SET_ITEM(my_impl, 5, o6.my_impl); Py_INCREF(o6.my_impl); PyTuple_SET_ITEM(my_impl, 6, o7.my_impl); Py_INCREF(o7.my_impl); } inline Tuple::Tuple(Object o1, Object o2, Object o3, Object o4, Object o5, Object o6, Object o7, Object o8) : Object(PyTuple_New(8)) { PyTuple_SET_ITEM(my_impl, 0, o1.my_impl); Py_INCREF(o1.my_impl); PyTuple_SET_ITEM(my_impl, 1, o2.my_impl); Py_INCREF(o2.my_impl); PyTuple_SET_ITEM(my_impl, 2, o3.my_impl); Py_INCREF(o3.my_impl); PyTuple_SET_ITEM(my_impl, 3, o4.my_impl); Py_INCREF(o4.my_impl); PyTuple_SET_ITEM(my_impl, 4, o5.my_impl); Py_INCREF(o5.my_impl); PyTuple_SET_ITEM(my_impl, 5, o6.my_impl); Py_INCREF(o6.my_impl); PyTuple_SET_ITEM(my_impl, 6, o7.my_impl); Py_INCREF(o7.my_impl); PyTuple_SET_ITEM(my_impl, 7, o8.my_impl); Py_INCREF(o8.my_impl); } inline Tuple::Tuple(Object o1, Object o2, Object o3, Object o4, Object o5, Object o6, Object o7, Object o8, Object o9) : Object(PyTuple_New(9)) { PyTuple_SET_ITEM(my_impl, 0, o1.my_impl); Py_INCREF(o1.my_impl); PyTuple_SET_ITEM(my_impl, 1, o2.my_impl); Py_INCREF(o2.my_impl); PyTuple_SET_ITEM(my_impl, 2, o3.my_impl); Py_INCREF(o3.my_impl); PyTuple_SET_ITEM(my_impl, 3, o4.my_impl); Py_INCREF(o4.my_impl); PyTuple_SET_ITEM(my_impl, 4, o5.my_impl); Py_INCREF(o5.my_impl); PyTuple_SET_ITEM(my_impl, 5, o6.my_impl); Py_INCREF(o6.my_impl); PyTuple_SET_ITEM(my_impl, 6, o7.my_impl); Py_INCREF(o7.my_impl); PyTuple_SET_ITEM(my_impl, 7, o8.my_impl); Py_INCREF(o8.my_impl); PyTuple_SET_ITEM(my_impl, 8, o9.my_impl); Py_INCREF(o9.my_impl); } inline Object Tuple::get(size_t i) const { PyObject *retn = PyTuple_GetItem(my_impl, i); if (!retn) check_exception(); Py_INCREF(retn); return Object(retn); } inline List::List(Object o) throw(TypeError) : Object(o) { if (PyTuple_Check(o.my_impl)) // copy elements into new list { Py_DECREF(my_impl); my_impl = PyList_New(PyTuple_Size(o.my_impl)); for (int i = 0; i != PyList_Size(my_impl); ++i) { PyObject *item = PyTuple_GetItem(o.my_impl, i); Py_INCREF(item); PyList_SetItem(my_impl, i, item); } } else if (!PyList_Check(o.my_impl)) throw TypeError("object not a list"); } template List::List(I begin, I end) : Object(PyList_New(0)) { for (I i = begin; i != end; ++i) append(*i); } inline void List::set(int i, Object o) { Py_INCREF(o.my_impl); PyList_SetItem(my_impl, i, o.my_impl); } inline Object List::get(int i) const { PyObject *retn = PyList_GetItem(my_impl, i); if (!retn) check_exception(); Py_INCREF(retn); return Object(retn); } inline void List::extend(List l) { for (List::iterator i = l.begin(); i != l.end(); ++i) append(*i); } inline List::iterator List::begin() const { return iterator(*this, size() ? 0 : -1); } inline List::iterator List::end() const { return iterator(*this, -1); } inline List::iterator List::erase(List::iterator i) { if (i.my_pos >= 0) del(i.my_pos); if (i.my_pos >= size()) // if the erased element was the last... --i.my_pos; // ... decrement the iterator by one return i; } inline List::reverse_iterator List::rbegin() const { return reverse_iterator(*this, size() - 1); } inline List::reverse_iterator List::rend() const { return reverse_iterator(*this, -1); } inline List List::get_slice(int low, int high) const { return List(PyList_GetSlice(my_impl, low, high)); } inline List::iterator &List::iterator::operator = (const List::iterator &i) { my_list = i.my_list; my_pos = i.my_pos; my_current = i.my_current; return *this; } inline bool List::iterator::operator == (List::iterator i) { return i.my_list.impl() == my_list.impl() && i.my_pos == my_pos; } inline List::iterator List::iterator::operator + (int i) { if (my_pos != -1) my_pos += i; if (my_pos < my_list.size()) my_current = my_list.get(my_pos); else my_pos = -1; return *this; } inline List::iterator List::iterator::operator - (int i) { my_pos = my_pos == -1 ? my_list.size() - i : my_pos - i; if (my_pos > -1) my_current = my_list.get(my_pos); else my_pos = -1; return *this; } inline void List::iterator::incr() { operator + (1); } inline void List::iterator::decr() { operator - (1); } inline bool List::reverse_iterator::operator == (List::reverse_iterator i) { return i.my_list.impl() == my_list.impl() && i.my_pos == my_pos; } inline List::reverse_iterator List::reverse_iterator::operator + (int i) { my_pos = my_pos == -1 ? my_list.size() - i : my_pos - i; if (my_pos > -1) my_current = my_list.get(my_pos); else my_pos = -1; return *this; } inline List::reverse_iterator List::reverse_iterator::operator - (int i) { my_pos += i; if (my_pos < my_list.size()) my_current = my_list.get(my_pos); else my_pos = -1; return *this; } inline void List::reverse_iterator::incr() { operator + (1); } inline void List::reverse_iterator::decr() { operator - (1); } inline void Dict::set(Object k, Object v) { PyObject_SetItem(my_impl, k.my_impl, v.my_impl); } inline Object Dict::get(Object k, Object d) const { PyObject *retn = PyDict_GetItem(my_impl, k.my_impl); if (retn) Py_INCREF(retn); return retn ? Object(retn) : d; } inline bool Dict::has_key(Object k) const { return PyObject_GetItem(my_impl, k.my_impl) != 0; } inline bool Dict::del(Object k) { return PyObject_DelItem(my_impl, k.my_impl) == 0; } inline Dict::iterator Dict::begin() const { return iterator(*this, 0); } inline Dict::iterator Dict::end() const { return iterator(*this, -1); } inline Dict::iterator::iterator(Dict dict, int pos) : my_dict(dict), my_pos(pos) { if (pos != -1) incr(); } inline Dict::iterator &Dict::iterator::operator = (const Dict::iterator &i) { my_dict = i.my_dict; my_pos = i.my_pos; my_current = i.my_current; return *this; } inline void Dict::iterator::incr() { PyObject *key = 0, *value = 0; bool valid = PyDict_Next(my_dict.impl(), &my_pos, &key, &value); if (!valid) my_pos = -1; else { Py_INCREF(key); Py_INCREF(value); my_current = Tuple(key, value); } } inline bool Dict::iterator::operator == (Dict::iterator i) { return i.my_dict.impl() == my_dict.impl() && i.my_pos == my_pos; } } } #endif synopsis-0.12/src/Synopsis/Python/Module.hh0000664000076400007640000000207011104702321020312 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef _Synopsis_Python_Module_hh #define _Synopsis_Python_Module_hh #include namespace Synopsis { namespace Python { class Module : public Object { public: Module(const Object &o) : Object(o) {} std::string name() const { return PyModule_GetName(my_impl);} std::string filename() const { return PyModule_GetFilename(my_impl);} Dict dict() const; static Module import(const std::string &name) { return Object::import(name);} static Module define(const std::string &name, PyMethodDef *methods); private: Module(PyObject *m) : Object(m) {} }; inline Module Module::define(const std::string &name, PyMethodDef *methods) { PyObject *m = Py_InitModule(const_cast(name.c_str()), methods); Py_INCREF(m); return Module(m); } inline Dict Module::dict() const { PyObject *d = PyModule_GetDict(my_impl); Py_INCREF(d); return Object(d); } } } #endif synopsis-0.12/src/Synopsis/Python/Kit.hh0000664000076400007640000000107411104702321017617 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef _Synopsis_Python_Kit_hh #define _Synopsis_Python_Kit_hh #include namespace Synopsis { namespace Python { class Kit : public Module { public: Kit(const std::string &name) : Module(Module::import(name)) {} template T create(const char *name, const Tuple &t = Tuple(), const Dict &d = Dict()) { return dict().get(name)(t, d);} }; } } #endif synopsis-0.12/src/Synopsis/Python/TypedList.hh0000664000076400007640000000277011104702321021015 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef _Synopsis_Python_TypedList_hh #define _Synopsis_Python_TypedList_hh #include namespace Synopsis { namespace Python { //. A typed list replace some modifiers by a 'more typed' variant //. This is really just provided to allow more expressive statements template class TypedList : public List { public: TypedList(size_t i = 0) : List(i) {} TypedList(Object o) : List(o) {} // should we typecheck here all items ? TypedList(const T &); TypedList(const T &, const T &); TypedList(const T &, const T &, const T &); TypedList(const T &, const T &, const T &, const T &); void set(int i, const T &s) { List::set(i, s);} T get(int i) const { return narrow(List::get(i));} void append(const T &s) { List::append(s);} void insert(int i, const T &s) { List::insert(i, s);} }; template inline TypedList::TypedList(const T &t1) { append(t1); } template inline TypedList::TypedList(const T &t1, const T &t2) { append(t1); append(t2); } template inline TypedList::TypedList(const T &t1, const T &t2, const T &t3) { append(t1); append(t2); append(t3); } template inline TypedList::TypedList(const T &t1, const T &t2, const T &t3, const T &t4) { append(t1); append(t2); append(t3); append(t4); } } } #endif synopsis-0.12/src/Synopsis/Python/Interpreter.hh0000664000076400007640000000266111104702321021376 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef _Synopsis_Python_Interpreter_hh #define _Synopsis_Python_Interpreter_hh #include #include namespace Synopsis { namespace Python { class Interpreter { public: struct Exception { Exception() {} }; enum Mode { EVAL = Py_eval_input, FILE = Py_file_input, SINGLE = Py_single_input}; Interpreter() {} ~Interpreter() {} Object run_string(const std::string &, Mode, Object, Object); Object run_file(const std::string &, Mode, Object, Object); private: }; inline Object Interpreter::run_string(const std::string &code, Mode m, Object globals, Object locals) { PyObject *retn = PyRun_String(const_cast(code.c_str()), m, globals.my_impl, locals.my_impl); if (!retn) throw Exception(); return retn; } inline Object Interpreter::run_file(const std::string &script, Mode m, Object globals, Object locals) { ::FILE *file = fopen(script.c_str(), "r"); if (!file) throw std::invalid_argument(script + " : no such file"); PyObject *retn = PyRun_File(file, const_cast(script.c_str()), m, globals.my_impl, locals.my_impl); fclose(file); if (!retn) throw Exception(); return retn; } } } #endif synopsis-0.12/src/Synopsis/Lexer.hh0000664000076400007640000000775311104702321016700 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_Lexer_hh_ #define Synopsis_Lexer_hh_ #include #include #include #include #include namespace Synopsis { class Buffer; //. a Lexer reads tokens from a stream. class Lexer { public: //. Define sets of token that are to be recognized as special //. keywords (as opposed to identifiers). They can be or'ed. //. If CXX is not specified, the Lexer will operate in 'C mode'. enum TokenSet { C=0x0, CXX=0x01, GCC=0x02, MSVC=0x04}; typedef std::vector Comments; struct InvalidChar : std::runtime_error { InvalidChar(const std::string &msg) : std::runtime_error(msg) {} }; //. Construct a Lexer on the given Buffer using the given //. token set. The default token set is CXX with GCC extensions. Lexer(Buffer *, int tokenset = CXX|GCC); Token::Type get_token(Token &); Token::Type look_ahead(size_t); Token::Type look_ahead(size_t, Token &); const char *save(); void restore(const char *); Comments get_comments(); //. Return the origin of the given pointer //. (filename and line number) unsigned long origin(const char *, std::string &) const; private: //. a Queue is used to read in tokens from a stream //. without consuming them class Queue { public: typedef std::deque Container; typedef Container::size_type size_type; bool empty() const { return my_container.empty();} size_type size() const { return my_container.size();} const Token &front() const { return my_container.front();} const Token &back() const { return my_container.back();} const Token &at(size_type i) const { return my_container.at(i);} void push(const Token &t) { my_container.push_back(t);} void pop() { my_container.pop_front();} void clear() { my_container.clear();} private: Container my_container; }; typedef std::map Dictionary; void rewind(const char *); Token::Type read_token(const char *&, size_t &); //. try to fill the token cache to contain //. at least o tokens. Returns false if //. there are not enough tokens. bool fill(size_t o); //. skip till end of paren void skip_paren(); //. skip till end of line void skip_line(); //. skip __attribute__(...), ___asm__(...), ... void skip_attribute(); //. skip __extension__(...). Token::Type skip_extension(const char *&, size_t &); //. skip __asm ... void skip_asm(); //. skip __declspec(...). void skip_declspec(); //. skip __pragma(...);. void skip_pragma(); char get_next_non_white_char(); Token::Type read_line(); bool read_char_const(unsigned long top); bool read_str_const(unsigned long top); Token::Type read_number(char c, unsigned long top); Token::Type read_float(unsigned long top); Token::Type read_identifier(unsigned long top); Token::Type screen(const char *identifier, size_t len); Token::Type read_separator(char c, unsigned long top); Token::Type single_char_op(unsigned char c); Token::Type read_comment(char c, unsigned long top); Buffer *my_buffer; Queue my_tokens; Dictionary my_keywords; Token my_token; Comments my_comments; }; inline bool is_blank(char c) { return c == ' ' || c == '\t' || c == '\f' || c == '\r'; } inline bool is_letter(char c) { return ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z') || (c == '_' || c == '$'); } inline bool is_digit(char c){ return '0' <= c && c <= '9';} inline bool is_xletter(char c){ return c == 'X' || c == 'x';} inline bool is_eletter(char c){ return c == 'E' || c == 'e';} inline bool is_hexdigit(char c) { return is_digit(c) || ('A' <= c && c <= 'F') || ('a' <= c && c <= 'f'); } inline bool is_int_suffix(char c) { return c == 'U' || c == 'u' || c == 'L' || c == 'l'; } inline bool is_float_suffix(char c) { return c == 'F' || c == 'f' || c == 'L' || c == 'l'; } } #endif synopsis-0.12/src/Synopsis/Trace.cc0000664000076400007640000000045311104702322016634 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include using namespace Synopsis; unsigned int Trace::my_mask = Trace::NONE; size_t Trace::my_level = 0; synopsis-0.12/src/synopsis.py.in0000664000076400007640000000173011104702314016306 0ustar stefanstefan#! /usr/bin/env python from Synopsis import config from Synopsis.process import process from Synopsis.Processor import * from Synopsis.Processors import * from Synopsis.Parsers import Cxx from distutils import sysconfig import sys, os, os.path srcdir = '@srcdir@' topdir = os.path.dirname(srcdir) cppflags = ['-I.', '-I%s'%(srcdir + '/Synopsis/gc/include'), '-I%s'%(srcdir), '-I%s'%(sysconfig.get_python_inc())] cxx = Cxx.Parser(base_path = srcdir + os.sep, cppflags = cppflags, sxr_prefix = 'sxr') cxx_sxr = Cxx.Parser(base_path = topdir + os.sep, cppflags = cppflags, sxr_prefix = 'sxr') link = Linker(MacroFilter(pattern=r'^Synopsis_(.*)_hh_$'), Comments.Translator(markup='rst', filter = Comments.SSDFilter()), sxr_prefix = 'sxr') process(cxx = cxx, cxx_sxr = cxx_sxr, link = link) synopsis-0.12/src/synopsis-uninstalled.pc.in0000664000076400007640000000042611104702314020601 0ustar stefanstefanprefix= exec_prefix= libdir=@abs_builddir@/lib includedir=@abs_srcdir@ Name: Synopsis Description: C/C++ source code introspection tool Version: @PACKAGE_VERSION@ Requires: Libs: -L${libdir} -lSupport -lSynopsis Cflags: -I@abs_top_builddir@ -I${includedir} @GC_CPP@ @CPPFLAGS@ synopsis-0.12/src/Makefile.in0000664000076400007640000001353211122312027015506 0ustar stefanstefan# # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # SHELL := /bin/sh srcdir := @srcdir@ builddir:= @builddir@ PLATFORM:= @PLATFORM@ PYTHON := @PYTHON@ SYNOPSIS:= $(PYTHON) synopsis.py CXX := @CXX@ LDSHARED:= @LDSHARED@ LDSONAME:= @LDSONAME@ MAKEDEP := $(CXX) -M AR := @AR@ RANLIB := @RANLIB@ LN_S := @LN_S@ CPPFLAGS:= @CPPFLAGS@ -D SYNOPSIS_SRC -I $(builddir) -I $(srcdir) CXXFLAGS:= @CXXFLAGS@ LDFLAGS := @LDFLAGS@ LIBS := @LIBS@ LIBEXT := @LIBEXT@ INSTALL := @INSTALL@ INSTALL_DATA := @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT := @INSTALL_SCRIPT@ MAJOR := @MAJOR@ MINOR := @MINOR@ prefix := @prefix@ exec_prefix := @exec_prefix@ datarootdir := @datarootdir@ datadir := @datadir@ includedir := @includedir@ libdir := @libdir@ sbindir := @sbindir@ bindir := @bindir@ ifneq ($(findstring -fPIC, $(CXXFLAGS)),) GC_CFLAGS := CFLAGS="@CFLAGS@ -fPIC" endif GC_LIB := @GC_LIB@ ifdef GC_LIB CPPFLAGS+= -I $(srcdir)/Synopsis/gc/include endif define make_dep @echo generating dependencies for $(@D)/$( $@' endef define compile @echo compiling $(@D)/$(@F) $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< endef ifneq ($(findstring $(PLATFORM), nt cygwin),) define link_dso @echo linking $@ $(LDSHARED) $(LDFLAGS) -o $@ $^ $(LIBS) endef define install_dso @echo installing $@ $(INSTALL_PROGRAM) lib/libSynopsis$(LIBEXT) \ $(DESTDIR)$(libdir)/libSynopsis$(LIBEXT) endef else define link_dso @echo linking $@ rm -f $@ $@.$(MAJOR) $@.$(MAJOR).$(MINOR) $(LDSHARED) $(LDFLAGS) $(LDSONAME)$(@F).$(MAJOR).$(MINOR) \ -o $@.$(MAJOR).$(MINOR) $^ $(LIBS) (cd $(@D) && $(LN_S) $(@F).$(MAJOR).$(MINOR) $(@F).$(MAJOR)) (cd $(@D) && $(LN_S) $(@F).$(MAJOR) $(@F)) endef define install_dso @echo installing libSynopsis$(LIBEXT) rm -f $(DESTDIR)$(libdir)/libSynopsis$(LIBEXT) \ $(DESTDIR)$(libdir)/libSynopsis$(LIBEXT).$(MAJOR) \ $(DESTDIR)$(libdir)/libSynopsis$(LIBEXT).$(MAJOR).$(MINOR) $(INSTALL_PROGRAM) lib/libSynopsis$(LIBEXT).$(MAJOR).$(MINOR) \ $(DESTDIR)$(libdir)/libSynopsis$(LIBEXT).$(MAJOR).$(MINOR) (cd $(DESTDIR)$(libdir) && $(LN_S) libSynopsis$(LIBEXT).$(MAJOR).$(MINOR) libSynopsis$(LIBEXT).$(MAJOR)) (cd $(DESTDIR)$(libdir) && $(LN_S) libSynopsis$(LIBEXT).$(MAJOR) libSynopsis$(LIBEXT)) endef endif define link_app @echo linking $@ $(CXX) -Llib $(LDFLAGS) -o $@ $< -lSynopsis $(LIBS) endef SRC := Trace \ PTree/Node PTree/Encoding PTree/operations \ PTree/Atoms PTree/Lists \ PTree/Visitor PTree/Display PTree/Writer \ SymbolLookup/Symbol SymbolLookup/Scope SymbolLookup/Scopes \ SymbolLookup/Display SymbolLookup/Walker \ TypeAnalysis/Type TypeAnalysis/Kit \ TypeAnalysis/TypeEvaluator \ TypeAnalysis/ConstEvaluator \ TypeAnalysis/OverloadResolver \ Buffer Lexer SymbolFactory Parser SRC := $(patsubst %, Synopsis/%.cc, $(SRC)) SUP := $(patsubst %, Support/%.cc, Path ErrorHandler) HDR := $(patsubst $(srcdir)/%, %, $(wildcard $(srcdir)/Synopsis/*.hh)) HDR += $(patsubst $(srcdir)/%, %, $(wildcard $(srcdir)/Synopsis/PTree/*.hh)) HDR += $(patsubst $(srcdir)/%, %, $(wildcard $(srcdir)/Synopsis/SymbolLookup/*.hh)) HDR += $(patsubst $(srcdir)/%, %, $(wildcard $(srcdir)/Synopsis/TypeAnalysis/*.hh)) OBJ := $(patsubst %.cc, %.o, $(SRC)) CC_SYN := $(patsubst %, %.sxr.syn, $(SRC)) HDR_SYN := $(patsubst %, %.syn, $(HDR)) HDR_SXR_SYN:= $(patsubst %, %.sxr.syn, $(HDR)) DEP := $(patsubst %.cc, %.d, $(SRC) tools/display-ptree.cc tools/display-symbols.cc) LIBRARY := lib/libSynopsis$(LIBEXT) SUPPORT := lib/libSupport.a TOOLS := bin/display-ptree bin/display-symbols TARGETS := $(LIBRARY) $(SUPPORT) $(TOOLS) vpath %.cc $(srcdir) vpath %.c $(srcdir) vpath %.h $(srcdir) vpath %.hh $(srcdir) $(builddir) all: $(TARGETS) $(LIBRARY): $(OBJ) $(GC_LIB) $(link_dso) $(SUPPORT): $(patsubst %.cc, %.o, $(SUP)) $(AR) cru $@ $^ $(RANLIB) $@ $(TOOLS): bin/%: tools/%.o $(LIBRARY) $(link_app) doc: cxx.syn cxx-sxr.syn cxx.syn: $(HDR_SYN) @echo linking C++ headers together $(SYNOPSIS) link --output=$@ $^ cxx-sxr.syn: $(HDR_SXR_SYN) $(CC_SYN) @echo linking all C++ files together $(SYNOPSIS) link --output=$@ $^ %.d: %.cc $(make_dep) %.o: %.cc $(compile) Makefile: $(srcdir)/Makefile.in ./config.status --file Makefile $(HDR_SYN): %.syn: % @echo parsing $^ mkdir -p $(dir $@) $(SYNOPSIS) cxx --output=$@ $? $(HDR_SXR_SYN): %.sxr.syn: % @echo parsing $^ mkdir -p $(dir $@) $(SYNOPSIS) cxx_sxr --output=$@ $? $(CC_SYN): %.cc.sxr.syn: %.cc @echo parsing $^ mkdir -p $(dir $@) $(SYNOPSIS) cxx_sxr --output=$@ $? # This calls make in the gc dir to create the gc.a file $(GC_LIB): $(MAKE) -C Synopsis/gc $(GC_CFLAGS) install: $(INSTALL) -d $(DESTDIR)$(libdir) $(install_dso) $(INSTALL) -d $(DESTDIR)$(includedir)/Synopsis $(INSTALL) -d $(DESTDIR)$(includedir)/Synopsis/PTree $(INSTALL) -d $(DESTDIR)$(includedir)/Synopsis/SymbolLookup $(INSTALL) -d $(DESTDIR)$(includedir)/Synopsis/TypeAnalysis for header in $(HDR); do \ $(INSTALL_DATA) $(srcdir)/$$header \ $(DESTDIR)$(includedir)/`dirname $$header`; \ done $(INSTALL) -d $(DESTDIR)$(libdir)/pkgconfig $(INSTALL_DATA) synopsis.pc \ $(DESTDIR)$(libdir)/pkgconfig/synopsis.pc clean: rm -f Synopsis/*~ Synopsis/*.o Synopsis/*.d Synopsis/*.syn \ Synopsis/PTree/*.~ Synopsis/PTree/*.o Synopsis/PTree/*.d Synopsis/PTree/*.syn \ Synopsis/SymbolLookup/*.~ Synopsis/SymbolLookup/*.o Synopsis/SymbolLookup/*.d Synopsis/SymbolLookup/*.syn \ Synopsis/TypeAnalysis/*.~ Synopsis/TypeAnalysis/*.o Synopsis/TypeAnalysis/*.d Synopsis/TypeAnalysis/*.syn \ tools/*.~ tools/*.o tools/*.d \ *.dll *.so *core \ base_lib ifeq (,$(filter $(MAKECMDGOALS), depend clean distclean)) -include $(DEP) endif synopsis-0.12/src/configure.ac0000664000076400007640000000722711122312027015733 0ustar stefanstefandnl dnl Copyright (C) 2003 Stefan Seefeld dnl All rights reserved. dnl Licensed to the public under the terms of the GNU LGPL (>= 2), dnl see the file COPYING for details. dnl dnl ------------------------------------------------------------------ dnl Autoconf initialization dnl ------------------------------------------------------------------ AC_PREREQ(2.56) AC_REVISION($Revision: 1.9 $) AC_INIT(libSynopsis, 1.0, synopsis-devel@fresco.org) AC_ARG_ENABLE(version, [AC_HELP_STRING([--enable-version=VERSION],[specify the Synopsis version to build])], [version=$enableval], [version="1.0"] ) AC_ARG_WITH(python, [AC_HELP_STRING([--with-python=PATH],[specify the Python interpreter])], PYTHON="$with_python", PYTHON="python" ) AC_ARG_ENABLE(threads, [AC_HELP_STRING([--disable-threads], [disable threading support])], [],[enable_threads=yes]) AC_ARG_ENABLE([gc], [AC_HELP_STRING([--disable-gc],[don't use garbage collector (default is enabled)])], [ac_cv_enable_gc=no], [ac_cv_enable_gc=yes]) AC_ARG_WITH([gc_prefix], [AC_HELP_STRING([--with-gc-prefix=PATH],[specify the prefix to the garbage collector])], [ac_cv_with_gc_prefix="$with_gc_prefix"], [ac_cv_with_gc_prefix=""]) AC_PROG_CPP AC_PROG_CC AC_PROG_CXX AC_PROG_RANLIB AC_CHECK_PROGS(AR, ar aal xiar, ar) AC_CHECK_PROGS(LD, ld xild, ld) AC_SUBST(AR) AC_SUBST(LD) AC_PROG_LN_S AC_PROG_INSTALL # Determine major, minor, and bugfix version if echo "$version" | grep -q '\.'; then # there's one or more '.'s in release (e.g. 0.8 or 0.9.1) major=$(echo "$version" | sed -e 's/\.[[0-9.]]*$//') minor=$(echo "$version" | sed -e 's/^[[0-9]]*\.//') else # there's no '.' in release (e.g. 9) major=$version fi AC_SUBST(MAJOR, $major) AC_SUBST(MINOR, $minor) if test -n "$PYTHON" -a "$PYTHON" != yes; then AC_CHECK_PROG(PYTHON,,AC_MSG_ERROR([Cannot find Python interpreter])) else AC_PATH_PROG(PYTHON, python2 python, python) fi if test "$ac_cv_enable_gc" == "yes"; then GC_BRIDGE=$srcdir/Synopsis/PTree/GC-enabled.tmpl if test -n "$ac_cv_with_gc_prefix"; then CPPFLAGS="$CPPFLAGS -I$ac_cv_with_gc_prefix/include/gc" LIBS="-L$ac_cv_with_gc_prefix/lib -lgc $LIBS" else GC_CPP="-I\${includedir}/Synopsis/gc/include" GC_LIB="Synopsis/gc/.libs/libgc.a" dnl We need to link with posix threads since libgc wants it. if test $enable_threads != no then SYN_SEARCH_PTHREAD fi fi else GC_BRIDGE=$srcdir/Synopsis/PTree/GC-disabled.tmpl fi AC_SUBST(GC_CPP) AC_SUBST(GC_LIB) AC_SUBST_FILE(GC_BRIDGE) PLATFORM=`$PYTHON -c "import os; print os.name" | tr -d "\r"` case `uname -s` in CYGWIN*) LIBEXT=".dll" LDSHARED="$CXX -shared" LDSONAME="-Wl,--soname," CXXFLAGS="-D_REENTRANT $CXXFLAGS" if test "$PLATFORM" == "nt"; then if test "$CXX" == "g++"; then CPPFLAGS="$CPPFLAGS -D PARSE_MSVC" CFLAGS="-mno-cygwin $CFLAGS" CXXFLAGS="-mno-cygwin $CXXFLAGS" LDFLAGS="-mno-cygwin $LDFLAGS" fi else PLATFORM="cygwin" fi ;; Darwin) LIBEXT=".dylib" LDSHARED="$CXX -dynamiclib" LDSONAME="-Wl,-install_name," CXXFLAGS="-D_REENTRANT $CXXFLAGS -fPIC" ;; *) LIBEXT=".so" LDSHARED="$CXX -shared" LDSONAME="-Wl,--soname," CXXFLAGS="-D_REENTRANT $CXXFLAGS -fPIC" ;; esac AC_SUBST(PLATFORM) AC_SUBST(LIBEXT) AC_SUBST(LDSHARED) AC_SUBST(LDSONAME) AC_CONFIG_FILES([Synopsis/PTree/GC.hh Makefile synopsis.py synopsis-uninstalled.pc synopsis.pc]) mkdir -p lib mkdir -p bin mkdir -p Synopsis/gc mkdir -p Synopsis/PTree mkdir -p Synopsis/SymbolLookup mkdir -p Synopsis/TypeAnalysis mkdir -p Support mkdir -p tools AC_OUTPUT synopsis-0.12/src/Support/0000775000076400007640000000000011172123233015115 5ustar stefanstefansynopsis-0.12/src/Support/Path.hh0000664000076400007640000000224711104702322016334 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_Path_hh_ #define Synopsis_Path_hh_ #include #include namespace Synopsis { class Path { public: static const char SEPARATOR; //. take a possibly relative path //. and turn it into an absolute one. Path(const std::string &from) : my_impl(from) {} //. return the file component in the path std::string basename() const; //. return the directory component in the path Path dirname() const; //. return absolute path Path abs() const { return Path(normalize(my_impl));} //. strip prefix void strip(const std::string &prefix); //. return the path as a string std::string str() const { return my_impl;} //. return the current working directory static std::string cwd(); private: //. return the normalized and absolutized path static std::string normalize(const std::string &); std::string my_impl; }; //. create directory, makes all intermediate-level directories //. needed to contain the leaf directory. void makedirs(const Path &); } #endif synopsis-0.12/src/Support/ErrorHandler.cc0000664000076400007640000000313311104702322020010 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include "ErrorHandler.hh" #include #include #ifndef _WIN32 # include # include # ifdef __GLIBC__ # include # endif #endif namespace { Synopsis::ErrorHandler::Callback callback = 0; #ifndef _WIN32 struct sigaction olda; struct sigaction newa; #endif void print_stack() { #ifdef __GLIBC__ void *bt[128]; int bt_size = backtrace(bt, sizeof(bt) / sizeof(void *)); char **symbols = backtrace_symbols (bt, bt_size); for (int i = 0; i < bt_size; i++) std::cout << symbols[i] << std::endl; #endif } void sighandler(int signo) { std::string signame = "Signal"; #ifndef _WIN32 switch (signo) { case SIGABRT: signame = "Abort"; break; case SIGBUS: signame = "Bus error"; break; case SIGSEGV: signame = "Segmentation Violation"; break; default: signame = "unknown"; break; }; #endif std::cerr << signame << " caught" << std::endl; if (callback) callback(); print_stack(); exit(-1); } } using namespace Synopsis; ErrorHandler::ErrorHandler(Callback c) { callback = c; #ifndef _WIN32 newa.sa_handler = &sighandler; sigaction(SIGSEGV, &newa, &olda); sigaction(SIGBUS, &newa, &olda); sigaction(SIGABRT, &newa, &olda); #endif } ErrorHandler::~ErrorHandler() { #ifndef _WIN32 sigaction(SIGABRT, &olda, 0); sigaction(SIGBUS, &olda, 0); sigaction(SIGSEGV, &olda, 0); #endif } synopsis-0.12/src/Support/Path-posix.cc0000664000076400007640000000554111104702322017462 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include "Path.hh" #include #include #include #include #include #include #include #include using namespace Synopsis; const char Path::SEPARATOR = '/'; std::string Path::cwd() { static std::string path; if (path.empty()) for (long path_max = 32;; path_max *= 2) { char *buf = new char[path_max]; if (::getcwd(buf, path_max) == 0) { if (errno != ERANGE) { delete [] buf; throw std::runtime_error(strerror(errno)); } } else { path = buf; delete [] buf; return path; } delete [] buf; } return path; } std::string Path::normalize(const std::string &filename) { std::string value = filename; char separator = '/'; const char *pat1 = "/./"; const char *pat2 = "/../"; if (value[0] != separator) value.insert(0, Path::cwd() + separator); // nothing to do... if (value.find(pat1) == std::string::npos && value.find(pat2) == std::string::npos) return value; // for the rest we'll operate on a decomposition of the filename... typedef std::vector Components; Components components; std::string::size_type b = 0; while (b < value.size()) { std::string::size_type e = value.find(separator, b); components.push_back(value.substr(b, e-b)); b = e == std::string::npos ? std::string::npos : e + 1; } // remove all '.' and '' components components.erase(std::remove(components.begin(), components.end(), "."), components.end()); components.erase(std::remove(components.begin(), components.end(), ""), components.end()); // now collapse '..' components with the preceding one while (true) { Components::iterator i = std::find(components.begin(), components.end(), ".."); if (i == components.end()) break; if (i == components.begin()) throw std::invalid_argument("invalid path"); components.erase(i - 1, i + 1); // remove two components } // now rebuild the path as a string std::string retn = '/' + components.front(); for (Components::iterator i = components.begin() + 1; i != components.end(); ++i) retn += '/' + *i; return retn; } namespace Synopsis { void makedirs(const Path &path) { const std::string &dir = path.str(); if (dir.empty()) throw std::runtime_error("empty path in 'makedirs'"); std::string::size_type cursor = 0; while (cursor != std::string::npos) { cursor = dir.find(Path::SEPARATOR, cursor + 1); struct stat st; int error; if ((error = stat(dir.substr(0, cursor).c_str(), &st)) == -1 && errno == ENOENT) mkdir(dir.substr(0, cursor).c_str(), 0755); else if (error) throw std::runtime_error(strerror(errno)); } } } synopsis-0.12/src/Support/Path-win32.cc0000664000076400007640000000577011104702322017266 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include "Path.hh" #include #include #include #include #include #include #include #include #include #include using namespace Synopsis; const char Path::SEPARATOR = '\\'; std::string Path::cwd() { static std::string path; if (path.empty()) { DWORD size; if ((size = ::GetCurrentDirectoryA(0, 0)) == 0) { throw std::runtime_error("error accessing current working directory"); } char *buf = new char[size]; if (::GetCurrentDirectoryA(size, buf) == 0) { delete [] buf; throw std::runtime_error("error accessing current working directory"); } path = buf; delete [] buf; } return path; } std::string Path::normalize(const std::string &filename) { std::string value = filename; char separator = '\\'; const char *pat1 = "\\.\\"; const char *pat2 = "\\..\\"; if (value[0] != separator && value.size() > 2 && value[1] != ':' && value[2] != '\\') value.insert(0, cwd() + separator); // nothing to do... if (value.find(pat1) == std::string::npos && value.find(pat2) == std::string::npos) return value; // for the rest we'll operate on a decomposition of the filename... typedef std::vector Components; Components components; std::string::size_type b = 0; while (b < value.size()) { std::string::size_type e = value.find(separator, b); components.push_back(value.substr(b, e-b)); b = e == std::string::npos ? std::string::npos : e + 1; } // remove all '.' and '' components components.erase(std::remove(components.begin(), components.end(), "."), components.end()); components.erase(std::remove(components.begin(), components.end(), ""), components.end()); // now collapse '..' components with the preceding one while (true) { Components::iterator i = std::find(components.begin(), components.end(), ".."); if (i == components.end()) break; if (i == components.begin()) throw std::invalid_argument("invalid path"); components.erase(i - 1, i + 1); // remove two components } // now rebuild the path as a string std::string retn = '/' + components.front(); for (Components::iterator i = components.begin() + 1; i != components.end(); ++i) retn += '/' + *i; return retn; } namespace Synopsis { void makedirs(const Path &path) { const std::string &dir = path.str(); if (dir.empty()) throw std::runtime_error("empty path in 'makedirs'"); std::string::size_type cursor = 0; while (cursor != std::string::npos) { cursor = dir.find(Path::SEPARATOR, cursor + 1); struct stat st; int error; if ((error = stat(dir.substr(0, cursor).c_str(), &st)) == -1 && errno == ENOENT) _mkdir(dir.substr(0, cursor).c_str()); else if (error) throw std::runtime_error(strerror(errno)); } } } synopsis-0.12/src/Support/fspath.hh0000664000076400007640000000231111104702322016715 0ustar stefanstefan// // Copyright (C) 2007 Bernhard Fischer // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // // #ifndef Support_fspath_hh_ #define Support_fspath_hh_ #include namespace Synopsis { //. Get normalized absolute path of a filename. inline boost::filesystem::path get_path(std::string const &filename) { using namespace boost::filesystem; return system_complete(path(filename, native)).normalize(); } //. Return true if base_path is set and path p contains base_path. inline bool matches_path(std::string const &p, std::string const &base_path) { return !base_path.empty() && p.substr(0,base_path.size()) == base_path; } //. Return the string representation of file in native path //. nomenclature. inline std::string make_full_path(std::string const &p) { return get_path(p).native_file_string(); } //. Given a path, strip the base_path. inline std::string make_short_path(std::string const &p, std::string const &base_path) { std::string short_fname = make_full_path(p); if (matches_path(short_fname, base_path)) short_fname.erase(0, base_path.size()); return short_fname; } } #endif synopsis-0.12/src/Support/ErrorHandler.hh0000664000076400007640000000061411104702322020023 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Synopsis_ErrorHandler_hh_ #define Synopsis_ErrorHandler_hh_ #include namespace Synopsis { struct ErrorHandler { typedef void (*Callback)(); ErrorHandler(Callback = 0); ~ErrorHandler(); }; } #endif synopsis-0.12/src/Support/Path.cc0000664000076400007640000000156011104702322016317 0ustar stefanstefan// // Copyright (C) 2004 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include "Path.hh" #ifdef _WIN32 # include "Path-win32.cc" #else # include "Path-posix.cc" #endif using namespace Synopsis; std::string Path::basename() const { if (my_impl.empty()) return ""; std::string::size_type i = my_impl.rfind(Path::SEPARATOR); return i == std::string::npos ? my_impl : my_impl.substr(i + 1); } Path Path::dirname() const { if (my_impl.empty()) return Path(""); std::string::size_type i = my_impl.rfind(Path::SEPARATOR); return i == std::string::npos ? Path("") : Path(my_impl.substr(0, i)); } void Path::strip(const std::string &prefix) { if (prefix.empty()) return; if (prefix == my_impl.substr(0, prefix.size())) my_impl = my_impl.substr(prefix.size()); } synopsis-0.12/src/install.sh0000755000076400007640000001124311104702322015442 0ustar stefanstefan#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5. # # 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. # # 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}" tranformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 synopsis-0.12/src/aclocal.m40000664000076400007640000000117211126175471015314 0ustar stefanstefan# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_include([../config/pthread.m4]) synopsis-0.12/autogen.sh0000755000076400007640000000136611104702314014655 0ustar stefanstefan#!/bin/sh # record_revision() { if test -n "`svn info 2> /dev/null`" then echo "Recording current revision..." rev=`svn info | awk '/Revision:/ {print $2}'` echo $rev > revision fi } conf() { (cd $1 echo "Generating $1/configure..." aclocal -I `echo /$1 | sed 's,/[^\\/]*,../,g'`config autoconf ) } conf_with_header() { (cd $1 echo "Generating $1/configure..." aclocal -I `echo /$1 | sed 's,/[^\\/]*,../,g'`config autoconf autoheader ) } record_revision conf src conf src/Synopsis/gc conf src/Synopsis/gc/libatomic_ops-1.2 conf Synopsis/Parsers/Cpp/ucpp conf Synopsis/Parsers/Cpp/wave conf_with_header Synopsis/Parsers/IDL conf Synopsis/Parsers/C conf Synopsis/Parsers/Cxx conf tests conf doc conf sandbox synopsis-0.12/config/0000775000076400007640000000000011172123232014116 5ustar stefanstefansynopsis-0.12/config/pthread.m40000664000076400007640000000176111104703266016022 0ustar stefanstefan# The following is an adaptation of AC_SEARCH_LIBS to # check for flags required to link with pthread # SYN_SEARCH_PTHREAD # -------------------------------------------------------- # Search for a library defining FUNC, if it's not already available. AC_DEFUN([SYN_SEARCH_PTHREAD], [AC_CACHE_CHECK([for flags needed for threading], [ac_cv_search_pthread_create], [ac_func_search_save_LIBS=$LIBS ac_cv_search_pthread_create=no AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_create])], [ac_cv_search_pthread_create="none required"]) if test "$ac_cv_search_pthread_create" = no; then for ac_lib in -lpthread -Kpthread -Kthread -pthread; do LIBS="$ac_lib $5 $ac_func_search_save_LIBS" AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_create])], [ac_cv_search_pthread_create="$ac_lib" break]) done fi LIBS=$ac_func_search_save_LIBS]) AS_IF([test "$ac_cv_search_pthread_create" != no], [test "$ac_cv_search_pthread_create" = "none required" || LIBS="$ac_cv_search_pthread_create $LIBS"], [])dnl ]) synopsis-0.12/config/boost.m40000664000076400007640000002511111122312025015501 0ustar stefanstefan# Copyright (C) 2007 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # # The code in this file got heavily inspired from monotone's m4 code. # # AC_BOOST([MINIMUM-VERSION]) # # Test for the Boost C++ libraries of a particular version (or newer) # # If no path to the installed boost library is given the macro # searchs under /usr, /usr/local, and /opt, and evaluates the # $BOOST_ROOT environment variable. # # This macro substitutes: # # BOOST_VERSION, BOOST_CPPFLAGS, and BOOST_LDFLAGS # # and sets: # # HAVE_BOOST # AC_DEFUN([AC_BOOST], [ AC_ARG_WITH([boost_prefix], AS_HELP_STRING([--with-boost-prefix=PREFIX], [specify boost installation prefix])) AC_ARG_WITH([boost_version], AS_HELP_STRING([--with-boost-version=VERSION], [specify boost version]), [boost_version="$withval"],[boost_version=$1]) boost_version_req=ifelse([$boost_version], ,1.35.0,$boost_version) boost_version_req_shorten=`expr $boost_version_req : '\([[0-9]]*\.[[0-9]]*\)'` boost_version_req_major=`expr $boost_version_req : '\([[0-9]]*\)'` boost_version_req_minor=`expr $boost_version_req : '[[0-9]]*\.\([[0-9]]*\)'` boost_version_req_sub_minor=`expr $boost_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` if test "x$boost_version_req_sub_minor" = "x" ; then boost_version_req_sub_minor="0" fi REQ_BOOST_VERSION=`expr $boost_version_req_major \* 100000 \+ $boost_version_req_minor \* 100 \+ $boost_version_req_sub_minor` AC_MSG_CHECKING(for boost >= $boost_version_req) succeeded=no dnl first we check the system location for boost libraries dnl this location ist chosen if boost libraries are installed dnl with the --layout=system option. if test "$with_boost_prefix" != ""; then BOOST_LDFLAGS="-L$with_boost_prefix/lib" BOOST_CPPFLAGS="-I$with_boost_prefix/include" else for prefix in /usr /usr/local /opt ; do if test -d "$prefix/include/boost" && test -r "$prefix/include/boost"; then BOOST_LDFLAGS="-L$prefix/lib" BOOST_CPPFLAGS="-I$prefix/include" break; fi done fi CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" AC_LANG_PUSH(C++) AC_RUN_IFELSE([ AC_LANG_PROGRAM( [ #include #include ], [dnl #if BOOST_VERSION >= $REQ_BOOST_VERSION std::ofstream ofs("conftest.out"); ofs << BOOST_VERSION / 100000 << '.' << BOOST_VERSION / 100 % 1000; #else # error Boost version is too old #endif ])], [ BOOST_VERSION=`cat conftest.out` AC_MSG_RESULT(yes) succeeded=yes found_system=yes ], []) AC_LANG_POP([C++]) dnl if we found no boost with system layout we search for boost libraries dnl built and installed without the --layout=system option dnl or for a staged(not installed) version if test "x$succeeded" != "xyes"; then _version=0 if test "$with_boost_prefix" != ""; then BOOST_LDFLAGS="-L$with_boost_prefix/lib" if test -d "$with_boost_prefix" && test -r "$with_boost_prefix"; then for i in `ls -d $with_boost_prefix/include/boost-* 2>/dev/null`; do _version_tmp=`echo $i | sed "s#$with_boost_prefix##" | sed 's/\/include\/boost-//' | sed 's/_/./'` V_CHECK=`expr $_version_tmp \> $_version` if test "$V_CHECK" = "1" ; then _version=$_version_tmp fi VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` BOOST_CPPFLAGS="-I$with_boost_prefix/include/boost-$VERSION_UNDERSCORE" done fi else for prefix in /usr /usr/local /opt ; do if test -d "$prefix" && test -r "$prefix"; then for i in `ls -d $prefix/include/boost-* 2>/dev/null`; do _version_tmp=`echo $i | sed "s#$prefix##" | sed 's/\/include\/boost-//' | sed 's/_/./'` V_CHECK=`expr $_version_tmp \> $_version` if test "$V_CHECK" = "1" ; then _version=$_version_tmp best_path=$prefix fi done fi done VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE" BOOST_LDFLAGS="-L$best_path/lib" if test "x$BOOST_ROOT" != "x"; then if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'` stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'` stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'` V_CHECK=`expr $stage_version_shorten \>\= $_version` if test "$V_CHECK" = "1" ; then AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT) BOOST_CPPFLAGS="-I$BOOST_ROOT" BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib" fi fi fi fi CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" AC_LANG_PUSH(C++) AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[#include ]], [[#if BOOST_VERSION >= $REQ_BOOST_VERSION // Everything is okay #else # error Boost version is too old #endif ]])], [ AC_MSG_RESULT(yes) succeeded=yes found_system=yes ],[]) AC_LANG_POP([C++]) BOOST_VERSION="$_version" fi if test "$succeeded" != "yes" ; then if test "$_version" = "0" ; then AC_MSG_ERROR([We could not detect the boost libraries (version $boost_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in . See http://randspringer.de/boost for more documentation.]) else AC_MSG_ERROR([boost $_version too old; version $boost_version_req or newer required.]) fi else AC_SUBST(BOOST_VERSION) AC_SUBST(BOOST_CPPFLAGS) AC_SUBST(BOOST_LDFLAGS) AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available]) fi CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" ]) # Boost libraries have a string suffix that identifies the compiler # they were built with, among other details. For example, it can be # '-gcc', '-gcc-mt', '-gcc-mt-1_31', and many other combinations # depending on the build system. Some systems provide symlinks that # hide these suffixes, avoiding this mess. However, other systems # don't; we have to provide a way to let the user manually specify a # suffix. Guessing can be very difficult, given the variety of # possibilities. Note that you cannot expand a variable inside the # second argument to AC_ARG_VAR, so we're stuck listing it twice. AC_DEFUN([BOOST_LIB_SUFFIX_ARG], [AC_ARG_VAR([BOOST_LIB_SUFFIX], [Space-separated list of suffixes to try appending to the names of Boost libraries. "none" means no suffix. The default is: "none -gcc -mipspro -mt -sunpro -sw -mgw -gcc-mt -gcc-mt-s"]) if test x"$BOOST_LIB_SUFFIX" = x; then BOOST_LIB_SUFFIX="none -gcc -mipspro -mt -sunpro -sw -mgw -gcc-mt -gcc-mt-s" fi ]) # Alteratively, allow users to set the suffix (list) via --with-boost-suffix AC_DEFUN([WITH_BOOST_LIB_SUFFIX], [AC_ARG_WITH([boost-lib-suffix], AS_HELP_STRING([--with-boost-lib-suffix=list], [use the given list of suffixes when searching for boost libraries.]), [ BOOST_LIB_SUFFIX="$withval"], [ BOOST_LIB_SUFFIX="none -gcc -mipspro -mt -sunpro -sw -mgw -gcc-mt -gcc-mt-s"])] ) # BOOST_LIB_IFELSE(library, testprog, if_found, if_not_found) # This is tricksome, as we only want to process a list of suffixes # until we've selected one; once we've done that, it must be used for # all libraries. (But we need the shell loop in all uses, as previous # scans might be unsuccessful.) AC_DEFUN([BOOST_LIB_IFELSE], [AC_LANG_ASSERT(C++) AC_REQUIRE([WITH_BOOST_LIB_SUFFIX]) dnl AC_REQUIRE([BOOST_STATIC_LINK_OPTION]) found=no LIBS_SAVED="$LIBS" CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" for s in $BOOST_LIB_SUFFIX do if test "x$s" = xnone; then s='' fi if test "x${BOOST_LIBDIR}" != x; then lib="${BOOST_LIBDIR}/libboost_$1${s}.a" else lib="-lboost_$1$s" fi LIBS="$lib $BOOST_LIBS $LIBS_SAVED" cv=AS_TR_SH([ac_cv_boost_lib_$1${s}_${BOOST_LIBDIR}]) AC_CACHE_CHECK([for the boost_$1$s library], $cv, [AC_LINK_IFELSE([$2], [eval $cv=yes], [eval $cv=no])]) if eval "test \"\${$cv}\" = yes"; then found=yes break fi done CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" LIBS="$LIBS_SAVED" AS_IF([test $found = yes], [BOOST_LIB_SUFFIX=${s:-none} $3], [$4]) ]) # Checks for specific boost libraries. # These are named SYN_BOOST_* because their actions are synopsis-specific. AC_DEFUN([SYN_NEED_BOOST_LIB], [BOOST_LIB_IFELSE([$1], [$2], [BOOST_LIBS="$lib $BOOST_LIBS"], [AC_MSG_FAILURE([the boost_$1 library is required])]) AC_SUBST(BOOST_LIBS) ]) AC_DEFUN([SYN_MAY_NEED_BOOST_LIB], [BOOST_LIB_IFELSE([$1], [$2], [BOOST_LIBS="$lib $BOOST_LIBS"]) AC_SUBST(BOOST_LIBS) ]) AC_DEFUN([SYN_BOOST_LIB_FILESYSTEM], [SYN_MAY_NEED_BOOST_LIB([system], [AC_LANG_PROGRAM([[ #include using namespace boost::system; ]],[[ error_code c; ]])]) SYN_NEED_BOOST_LIB([filesystem], [AC_LANG_PROGRAM([[ #include #include using namespace boost::filesystem; ]],[[ exists(path("/boot")); ]])])]) AC_DEFUN([SYN_BOOST_LIB_REGEX], [SYN_NEED_BOOST_LIB([regex], [AC_LANG_PROGRAM([[ #include using namespace boost; ]],[[ regex expr("foo"); ]])])]) AC_DEFUN([SYN_BOOST_LIB_WAVE], [SYN_MAY_NEED_BOOST_LIB([thread], [AC_LANG_PROGRAM([[ #include using namespace boost; ]],[[ thread t; ]])]) SYN_NEED_BOOST_LIB([wave], [AC_LANG_PROGRAM([[ #include #include #include using namespace boost::wave; typedef cpplexer::lex_token<> Token; typedef cpplexer::lex_iterator lex_iterator_type; ]],[[ return 0; ]])])]) AC_DEFUN([SYN_BOOST_LIB_PYTHON], [ save_LIBS=$LIBS LIBS="$LIBS $PYTHON_LIBS" SYN_NEED_BOOST_LIB([python], [AC_LANG_PROGRAM([[ #include using namespace boost::python; ]],[[ object("dummy"); ]])]) LIBS=$save_LIBS ]) synopsis-0.12/config/python_ext.m40000664000076400007640000000661011171623767016605 0ustar stefanstefan# # Copyright (C) 2007 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # AC_DEFUN([AC_PYTHON_EXT], [AC_MSG_CHECKING(for python extension module build information) AC_MSG_RESULT([]) AC_ARG_WITH(python, [ --with-python=PATH specify the Python interpreter], [PYTHON="$with_python"], [PYTHON="python"] ) if test -n "$PYTHON" -a "$PYTHON" != yes; then AC_CHECK_PROG(PYTHON, $PYTHON, AC_MSG_ERROR([Cannot find Python interpreter])) else AC_PATH_PROG(PYTHON, python2 python, python) fi PYTHON_PREFIX=`$PYTHON -c "import sys; print(sys.prefix)" | tr -d "\r"` AC_MSG_CHECKING(for Python development environment) PYTHON_INCLUDE=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_inc())" | tr -d "\r"` PYTHON_H=`$PYTHON -c "from os.path import *; h = join('$PYTHON_INCLUDE', 'Python.h'); print(exists(h) and h or '')"` if test $PYTHON_H then AC_MSG_RESULT(yes) else AC_MSG_ERROR([Python.h not found.]) fi AC_SUBST(PYTHON) AC_SUBST(PYTHON_INCLUDE) LIBEXT=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_var('SO'))" | tr -d "\r"` case `uname -s` in CYGWIN*) if test `$PYTHON -c "import os; print(os.name)" | tr -d "\r"` = posix; then PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d'%(sys.version_info[[0]],sys.version_info[[1]]))"` PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" dnl Cygwin doesn't have an -lutil, but some versions of distutils tell us to use it anyway. dnl It would be better to check for each library it tells us to use with AC_CHECK_LIB, but dnl to do that, we need the name of a function in each one, so we'll just hack -lutil out dnl of the list. PYTHON_DEP_LIBS=`$PYTHON -c "from distutils import sysconfig; import re; print(re.sub(r'\\s*-lutil', '', sysconfig.get_config_var('LIBS') or ''))"` else dnl this is 'nt' if test "$CXX" = "g++"; then CPPFLAGS="$CPPFLAGS -D PARSE_MSVC" CFLAGS="-mno-cygwin $CFLAGS" CXXFLAGS="-mno-cygwin $CXXFLAGS" LDFLAGS="-mno-cygwin $LDFLAGS" PYTHON_VERSION=`$PYTHON -c "import sys; print('%d%d'%(sys.version_info[[0]],sys.version_info[[1]]))" | tr -d "\r"` PYTHON_LIBS="-L`cygpath -a $PYTHON_PREFIX | tr -d \"\r\"`/Libs -lpython$PYTHON_VERSION" fi PYTHON_INCLUDE=`cygpath -a $PYTHON_INCLUDE | tr -d "\r"` PYTHON_DEP_LIBS=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_var('LIBS') or '')" | tr -d "\r"` fi LDSHARED="$CXX -shared" CXXFLAGS="-D_REENTRANT $CXXFLAGS" LIBS="$LIBS $PYTHON_LIBS $PYTHON_DEP_LIBS" ;; Darwin) PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d'%(sys.version_info[[0]],sys.version_info[[1]]))"` PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" CFLAGS="$CFLAGS -fPIC" CXXFLAGS="$CXXFLAGS -fPIC" LDSHARED="$CXX -dynamiclib -Wl,-undefined,dynamic_lookup" ;; *) PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d'%(sys.version_info[[0]],sys.version_info[[1]]))"` PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" CFLAGS="$CFLAGS -fPIC" CXXFLAGS="$CXXFLAGS -fPIC" LDSHARED="$CXX -shared" ;; esac dnl do not substitute PYTHON_LIBS, as it is only defined for further configuration AC_SUBST(LIBEXT) AC_SUBST(LDSHARED) ])dnl synopsis-0.12/scripts/0000775000076400007640000000000011172123232014340 5ustar stefanstefansynopsis-0.12/scripts/synopsis0000775000076400007640000002266111133220234016161 0ustar stefanstefan#!/usr/bin/env python # # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import config from Synopsis.getoptions import get_options from Synopsis import IR from Synopsis.Processor import Processor, Composite, Error from Synopsis.Processors import * import sys, os, os.path, getopt def error(msg): """Write an error message and exit.""" sys.stderr.write('Error: %s\n'%msg) sys.exit(-1) def __import__(name, verbose): """Import a named processor. Instead of returning the module, this reimplementation returns the processor itself. Exits on error.""" from Synopsis.import_processor import import_processor try: return import_processor(name) except ImportError, msg: if verbose: print 'Unable to import %s'%name print 'Reason :', msg else: print 'Error : no processor \'%s\''%'.'.join(name.split('.')[-2:]) sys.exit(-1) def usage(): """Print a little usage text""" print 'Usage : %s [options] '%'synopsis' print """ List of options: -h, --help Display usage summary. -V, --version Display version information. -v --verbose Operate verbosely. -d --debug Operate in debug mode. -P --profile Profile execution. -o , --output= Write output to . -p , --parser= Select a parser for . -Wp,[,...] Send to the parser. -t [] --translate[=] Translate comments to doc-strings, processing it as (typical values are 'javadoc' or 'rst'). --cfilter= Specify a comment filter. --cprocessor= Specify a comment processor. -Wc,[,...] Send to the comment translator. -l Run the linker. -Wl,[,...] Send to the linker. --linker= Link, and invoke . -f , --formatter= Select a formatter for . -Wf,[,...] Send to the formatter. -I Add to list of include paths. -D Add to list of predefined macros. -s , --sxr= Specify sxr directory. If given, process source cross-references. --probe Probe the specified processor. """ def make_processor(argv): """Parse command line options and translate them to processor commands and arguments.""" parser = None parser_opts = {} translator_opts = {} cfilters = {'ss': Comments.SSFilter, 'sss': Comments.SSSFilter, 'ssd': Comments.SSDFilter, 'c': Comments.CFilter, 'qt': Comments.QtFilter, 'java': Comments.JavaFilter} cprocessors = {'previous': Comments.Previous, 'grouper': Comments.Grouper} linker = None linker_opts = {'processors':[]} formatter = None formatter_opts = {} options = {} help = False probe = False opts, args = getopt.getopt(argv, 'o:p:t:lf:s:I:D:W:jvhVdP', ['output=', 'parser=', 'translate=', 'cfilter=', 'cprocessor=', 'linker=', 'formatter=', 'sxr=', 'version', 'help', 'verbose', 'debug', 'profile', 'probe']) for o, a in opts: if o in ['-V', '--version']: print 'synopsis version %s (revision %s)'%(config.version, config.revision) sys.exit(0) if o in ['-v', '--verbose']: options['verbose'] = True elif o in ['-d', '--debug']: options['debug'] = True elif o in ['-P', '--profile']: options['profile'] = True elif o in ['-o', '--output']: options['output'] = a elif o in ['-p', '--parser']: if parser: error('Multiple parsers specified.') parser = __import__('Synopsis.Parsers.%s.Parser'%a, 'verbose' in options) elif o in ['-t', '--translate']: if 'markup' in translator_opts: error('Multiple translators specified.') translator_opts['markup'] = a or '' elif o == '--cfilter': if a not in cfilters: error('%s is not a known comment filter.\n' '\t possible values are : %s' %(a, ', '.join([f for f in cfilters]))) translator_opts['filter'] = cfilters[a]() elif o == '--cprocessor': if a not in cprocessors: error('%s is not a known comment processor.\n' '\t possible values are : %s' %(a, ', '.join([p for p in cprocessors]))) if not translator_opts.get('processor'): translator_opts['processor'] = [] translator_opts['processor'].append(cprocessors[a]()) elif o == '-l': if not linker: linker = __import__('Synopsis.Processors.Linker', 'verbose' in options) elif o == '--linker': if not linker: linker = __import__('Synopsis.Processors.Linker', 'verbose' in options) linker_opts['processors'].extend([__import__('Synopsis.Processors.%s'%x, 'verbose' in options)() for x in a.split(',')]) elif o in ['-f', '--formatter']: if formatter: error('Multiple formatters specified.') formatter = __import__('Synopsis.Formatters.%s.Formatter'%a, 'verbose' in options) elif o == '-I': if not parser_opts.get('cppflags'): parser_opts['cppflags'] = [] parser_opts['cppflags'].append('-I%s'%a) elif o == '-D': if not parser_opts.get('cppflags'): parser_opts['cppflags'] = [] parser_opts['cppflags'].append('-D%s'%a) elif o == '-W': if a[0] == "p": for o,a in get_options(a[2:].split(','), expect_non_options = False): parser_opts[o.replace('-', '_')] = a elif a[0] == "l": for o,a in get_options(a[2:].split(','), expect_non_options = False): linker_opts[o.replace('-', '_')] = a elif a[0] == "f": for o,a in get_options(a[2:].split(','), expect_non_options = False): formatter_opts[o.replace('-', '_')] = a elif o in ['-s', '--sxr']: parser_opts['sxr_prefix'] = a linker_opts['sxr_prefix'] = a formatter_opts['sxr_prefix'] = a elif o in ['-h', '--help']: help = True elif o == '--probe': probe = True if help: for p in parser, linker, formatter: if not p: continue processor = p() print "Parameters for processor '%s':"%p.__module__ parameters = processor.get_parameters() tab = max(map(lambda x:len(x), parameters.keys())) for p in parameters: print " %-*s %s"%(tab, p, parameters[p].doc) if not (parser or linker or formatter): usage() sys.exit(0) # quick hack: if the parser is Cpp, rename the 'cppflags' # options to just 'flags' if parser and parser.__module__ == 'Synopsis.Parsers.Cpp': if parser_opts.has_key('cppflags'): parser_opts['flags'] = parser_opts['cppflags'] del parser_opts['cppflags'] if probe: if parser and parser.__module__ == 'Synopsis.Parsers.Cpp': cpp = parser(**parser_opts) info = cpp.probe() if not info: print 'Error: no compiler found' else: print 'Compiler:', info.compiler print 'Flags:', ', '.join(info.flags) print 'Language:', info.language print 'Header search path:\n %s\n'%'\n '.join(info.include_paths) macros = [k + (v and '=%s'%v or '') for (k,v) in info.macros] print 'Macro definitions:\n %s\n'%'\n '.join(macros) else: print 'Only the Cpp processor supports probing at this time.' sys.exit(0) if not args: usage() sys.exit(0) if translator_opts.has_key('processor'): processor = translator_opts['processor'] options['input'] = args #now instantiate the processor processors = [] if parser: processors.append(parser(**parser_opts)) if translator_opts: processors.append(Comments.Translator(**translator_opts)) if linker: processors.append(linker(**linker_opts)) if formatter: processors.append(formatter(**formatter_opts)) return Composite(*processors, **options) def main(): processor = make_processor(sys.argv[1:]) processor.process(IR.IR()) if __name__ == '__main__': try: main() except getopt.GetoptError, e: error(str(e)) except Error, e: error(str(e)) except KeyboardInterrupt, e: print 'KeyboardInterrupt' except IOError, e: error(str(e)) synopsis-0.12/scripts/html-validator0000775000076400007640000000725311104703266017232 0ustar stefanstefan#!/usr/bin/env python # # Copyright (C) 2004 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from xml.sax import saxexts, saxlib, saxutils import sys, os, string, urllib, urlparse import getopt verbose = False class Reference: def __init__(self, orig, line, ref): self.orig = orig self.line = line self.ref = ref class DocumentHandler(saxlib.DocumentHandler): """Store urefs with the linenumbers they were encountered in, so we can either traverse them, too, or report errors with specific line numbers.""" def __init__(self): self.urefs = {} self.locator = None def get_urefs(self): urefs = [Reference(self.locator.getSystemId(), l, u) for (u, l) in self.urefs.items()] self.urefs = {} self.locator = None return urefs def setDocumentLocator(self, locator): "Receive an object for locating the origin of SAX document events." self.locator = locator def startElement(self, name, attrs): "Look for ancors and store links." if name == 'a': href = attrs.getValue('href') if not self.urefs.has_key(href): self.urefs[href] = self.locator.getLineNumber() from xml.sax.drivers import drv_xmlproc SAXparser=drv_xmlproc.SAX_XPParser() handler = DocumentHandler() SAXparser.setDocumentHandler(handler) SAXparser.setErrorHandler(saxutils.ErrorRaiser()) def validate(url): """validate (x)html conformance using 'tidy'.""" if verbose: print 'validating', url status = os.system('tidy -errors -quiet "%s"'%url) if os.WIFSIGNALED(status): print 'internal error:', os.WTERMSIG(status) elif os.WIFEXITED(status): if os.WEXITSTATUS(status) == 2: print 'validation failed' return else: print 'internal error !' def usage(): print 'Usage : %s [options] '%sys.argv[0] print """ List of options: -h, --help help -p, --print provide verbose feedback during validation -m, --maximum maximum number of pages to validate -v, --validate call http://validator.w3.org to validate html -e, --external follow external links """ def main(): global verbose max = 50 external = False do_validate = False opts, args = getopt.getopt(sys.argv[1:], 'pm:evh', ['print', 'maximum=', 'external', 'validate', 'help']) for o, a in opts: if o in ['-h', '--help']: usage() sys.exit(0) elif o in ['-p', '--print']: verbose = True elif o in ['-m', '--maximum']: max = int(a) elif o in ['-e', '--external']: external = True elif o in ['-v', '--validate']: do_validate = True if not args: usage() sys.exit(0) done = [] urefs = [Reference('.', 0, args[0])] while urefs and (max == -1 or len(done) < max): uref = urefs.pop(0) url = urlparse.urljoin(uref.orig, uref.ref) scheme, location, path, query, fragment = urlparse.urlsplit(url) if not external and scheme and scheme != 'file': continue url = urlparse.urlunsplit((scheme, location, path, query, '')) if url in done: continue try: if verbose: print 'parsing', url SAXparser.parse(url) if do_validate: validate(url) done.append(url) urefs.extend(handler.get_urefs()) except saxlib.SAXParseException, e: sys.stderr.write('%s; processing aborted\n'%e) break if __name__ == '__main__': main() synopsis-0.12/scripts/sxr-server0000775000076400007640000001155211104703266016420 0ustar stefanstefan#!/usr/bin/env python # # Copyright (C) 2004 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import config from Synopsis.SXRServer import SXRServer from BaseHTTPServer import HTTPServer from CGIHTTPServer import CGIHTTPRequestHandler import sys, os, os.path, getopt, socket, urllib, cgi class SXRConfig: """Mixin base class to hold config parameters.""" cgi_url = '' src_url = '' document_root = '.' debug = False sxr_server = None class RequestHandler(CGIHTTPRequestHandler, SXRConfig): """This little demo server emulates apache's 'Alias' and 'ScriptAlias' options to serve source files and data generated from sxr.cgi""" def translate_path(self, path): """Translate URL into local path.""" if path.endswith('sxr.cgi'): path = os.path.join(config.datadir, path[1:]) else: path = os.path.join(self.document_root, path[1:]) return path def is_cgi(self): """If the path starts with the configured cgi_uri, it is a CGI.""" if self.path.startswith(self.cgi_url): self.cgi_info = ('/cgi-bin', 'sxr.cgi' + self.path[len(self.cgi_url):]) return True return False def run_cgi(self): """Execute the CGI, either in-process or as a sub-process.""" if not self.sxr_server: CGIHTTPRequestHandler.run_cgi(self) else: command = self.path[len(self.cgi_url) + 1:] i = command.rfind('?') if i >= 0: command, query = command[:i], command[i+1:] else: query = '' if self.debug: print command, query arguments = cgi.parse_qs(query) if self.debug: print arguments self.send_response(200, 'Script output follows') self.send_header('Content-type', 'text/html') self.end_headers() if command == 'file': pattern = arguments.get('string', []) self.wfile.write(self.sxr_server.search_file(pattern[0])) elif command == 'ident': name = arguments.get('string', []) qualified = arguments.has_key('full') self.wfile.write(self.sxr_server.search_ident(name[0], qualified)) def usage(): print 'Usage : %s [options]'%'sxr-server' print """ List of options: -h, --help Display usage summary -V, --version Display version information. -d, --debug print debug output -p, --port port to listen for requests -r, --document_root document root, i.e. top level directory for static files -u, --url base url under which to reach sxr.cgi -s, --src base url under which to reach source files --cgi use cgi script instead of in-process SXRServer (for testing) """ def run(): port = 8000 env = {} opts, args = getopt.getopt(sys.argv[1:], 'p:r:u:s:dhV', ['port=', 'document_root=', 'url=', 'src=', 'cgi', 'debug', 'help', 'version']) cgi = False for o, a in opts: if o in ['-h', '--help']: usage() sys.exit(0) elif o in ['-V', '--version']: print 'sxr-server version %s (revision %s)'%(config.version, config.revision) sys.exit(0) elif o in ['-p', '--port']: port = int(a) elif o in ['-r', '--document_root']: env['SXR_ROOT_DIR'] = a SXRConfig.document_root = a elif o in ['-u', '--url']: env['SXR_CGI_URL'] = a SXRConfig.cgi_url = a elif o in ['-s', '--src']: env['SXR_SRC_URL'] = a SXRConfig.src_url = a elif o in ['-d', '--debug']: SXRConfig.debug = True elif o == '--cgi': cgi = True if cgi: # For testing purposes only: run ordinary http server that invokes # sxr.cgi for appropriate URLs. os.environ.update(env) httpd = HTTPServer(('', port), RequestHandler) else: # Instantiate an SXRServer object, and set up a request handler that # calls into it. SXRConfig.sxr_server = SXRServer(SXRConfig.document_root, SXRConfig.cgi_url, SXRConfig.src_url, os.path.join(SXRConfig.document_root, 'sxr-template.html')) httpd = HTTPServer(('', port), RequestHandler) print 'SXR server running, please connect to http://%s:%d ...'%(socket.gethostname(), port) try: httpd.serve_forever() except KeyboardInterrupt: print 'Keyboard Interrupt: exiting' if __name__ == '__main__': run() synopsis-0.12/revision0000664000076400007640000000000511172115473014435 0ustar stefanstefan2029 synopsis-0.12/Synopsis/0000775000076400007640000000000011172123232014500 5ustar stefanstefansynopsis-0.12/Synopsis/DeclarationSorter.py0000664000076400007640000001062211170474371020512 0ustar stefanstefan# # Copyright (C) 2007 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import Parametrized, Parameter from Synopsis import ASG # The names of the access specifiers _access_specs = {ASG.DEFAULT: '', ASG.PUBLIC: 'Public ', ASG.PROTECTED: 'Protected ', ASG.PRIVATE: 'Private '} # The predefined order for section names _section_order = ('Packages', 'Modules', 'Namespaces', 'Macros', 'Class templates', 'Classes', 'Interfaces', 'Typedefs', 'Structs', 'Enums', 'Unions', 'Member function templates', 'Member functions', 'Function templates', 'Functions') def _compare(a, b): """Compare two section names.""" ai, bi = 0, 0 an, bn = a, b for i in range(1,4): access = _access_specs[i] len_access = len(access) is_a = (a[:len_access] == access) is_b = (b[:len_access] == access) if is_a: if not is_b: return -1 # a before b # Both matched an = a[len_access:] bn = b[len_access:] break if is_b: return 1 # b before a # Neither matched # Same access, sort by predefined order for section in _section_order: if an == section: return -1 # a before b if bn == section: return 1 # b before a return 0 class DeclarationSorter(Parametrized, ASG.Visitor): """Sort declarations by type and accessibility.""" struct_as_class = Parameter(False, 'Fuse structs and classes into the same section.') group_as_section = Parameter(True, 'Map group to section, instead of keeping it as a single declaration.') def __init__(self, declarations = None, **args): super(DeclarationSorter, self).__init__(**args) self.__sections = {} self.__sorted_keys = [] if not declarations: # This is a prototype return for d in declarations: d.accept(self) self.__sorted_keys = self.__sections.keys() self.__sorted_keys.sort(_compare) def __iter__(self): return iter(self.__sorted_keys) def __getitem__(self, i): return self.__sections[i] def get(self, *args): return self.__sections.get(*args) def has_key(self, k): return self.__sections.haskey(k) def keys(self): return self.__sorted_keys def values(self): return self.__sections.values() def _section_of(self, decl, name = None): """Generate a section name for the given declaration.""" section = name or decl.type.capitalize() if self.struct_as_class and section == 'Struct': section = 'Class' if section[-1] == 's': section += 'es' else: section += 's' if decl.accessibility != ASG.DEFAULT: section = _access_specs[decl.accessibility] + section return section def _add_declaration(self, decl, section): "Adds the given declaration with given name and section." if section not in self.__sections: self.__sections[section] = [decl] else: self.__sections[section].append(decl) def visit_declaration(self, decl): self._add_declaration(decl, self._section_of(decl)) def visit_builtin(self, decl): pass def visit_macro(self, decl): self._add_declaration(decl, self._section_of(decl, 'Macro')) def visit_forward(self, decl): if decl.template: self.visit_class_template(decl) else: self.visit_declaration(decl) def visit_group(self, group): if self.group_as_section: section = group.name[-1] for d in group.declarations: self._add_declaration(d, section) else: self.visit_declaration(group) def visit_scope(self, decl): self.visit_declaration(decl) def visit_class_template(self, decl): self._add_declaration(decl, self._section_of(decl, 'Class template')) def visit_function(self, decl): self.visit_declaration(decl) def visit_function_template(self, decl): self._add_declaration(decl, self._section_of(decl, 'Function template')) synopsis-0.12/Synopsis/QualifiedName.py0000664000076400007640000000275711104703265017576 0ustar stefanstefan# # Copyright (C) 2008 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # class QualifiedName(tuple): sep = '' def __getitem__(self, i): """If i is a slice, make sure a QualifiedName is returned.""" result = super(QualifiedName, self).__getitem__(i) if type(i) is slice: # Wrap the result return type(self)(result) else: return result def __getslice__(self, begin, end): """This method exists because python < 3.0 still uses __getslice__ for builtin types. (See http://bugs.python.org/issue2041)""" return self.__getitem__(slice(begin, end, None)) def __add__(self, other): """Overload self + other to preserve the type.""" return type(self)(tuple(self) + other) def prune(self, other): """Return a copy of other with any prefix it shares with self removed. e.g. ('A', 'B', 'C', 'D').prune(('A', 'B', 'D')) -> ('C', 'D')""" target = list(other) i = 0 while (len(target) > 1 and i < len(self) and target[0] == self[i]): del target[0] i += 1 return type(other)(target) class QualifiedCxxName(QualifiedName): sep = '::' def __str__(self): return '::'.join(self) class QualifiedPythonName(QualifiedName): sep = '.' def __str__(self): return '.'.join(self) synopsis-0.12/Synopsis/config.py0000664000076400007640000000102611104703266016324 0ustar stefanstefan# # Copyright (C) 2007 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # """This module contains configuration data that are specific to a particular release / installation such as version, data paths, etc.""" import os, os.path # The following variables are adjusted during installation. version = 'devel' prefix = os.path.join(os.path.dirname(__file__), os.pardir) datadir = os.path.join(prefix, 'share', 'synopsis') revision = 'unknown' synopsis-0.12/Synopsis/import_processor.py0000664000076400007640000000125711104703266020476 0ustar stefanstefan# # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # def import_processor(name, verbose=False): """Import a named processor and return it. Throws ImportError on failure.""" i = name.rfind('.') if i == -1: raise ImportError, '%s does not name a valid processor'%name module, processor = name[:i], name.split('.') mod = __import__(module) for c in processor[1:]: try: mod = getattr(mod, c) except AttributeError, msg: raise ImportError, "Unable to find %s in %s"%(c, repr(mod)) return mod synopsis-0.12/Synopsis/SourceFile.py0000664000076400007640000000453411171267705017135 0ustar stefanstefan# # Copyright (C) 2006 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # class Include: """Information about an include directive in a SourceFile. If the include directive required a macro expansion to get the filename, the is_macro will return true. If the include directive was actually an include_next, then is_next will return true. """ def __init__(self, target, name, is_macro, is_next): self.target = target """The target SourceFile object being referenced.""" self.name = name """The name by which the target is referenced.""" self.is_macro = is_macro """True if the directive uses a macro.""" self.is_next = is_next """True if this is using #include_next (GNU extension).""" class MacroCall: """A class to support mapping from positions in a preprocessed file back to positions in the original file.""" def __init__(self, name, start, end, expanded_start, expanded_end): self.name = name "The name of the macro being called." self.start = start "(line, column) pair indicating the start of the call." self.end = end "(line, column) pair indicating the end of the call." self.expanded_start = expanded_start "(line, column) pair indicating the start of the expansion in the preprocessed file." self.expanded_end = expanded_end "(line, column) pair indicating the end of the expansion in the preprocessed file." class SourceFile: """The information about a file that the ASG was generated from. Contains filename, all declarations from this file (even nested ones) and includes (aka imports) from this file.""" def __init__(self, name, abs_name, language, primary = False): """Constructor""" self.name = name """The filename.""" self.abs_name = abs_name """The absolute filename.""" self.annotations = {'language':language, 'primary':primary} """Dictionary with file annotations.""" self.includes = [] """List of includes this file contains.""" self.declarations = [] """List of declarations this file contains.""" self.macro_calls = [] """List of macro calls this file contains.""" synopsis-0.12/Synopsis/Processors/0000775000076400007640000000000011172123232016642 5ustar stefanstefansynopsis-0.12/Synopsis/Processors/SXRCompiler.py0000664000076400007640000000670611170770126021404 0ustar stefanstefan# # Copyright (C) 2008 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import SXR from Synopsis.Processor import * from Synopsis.QualifiedName import * from xml.dom.minidom import parse import os.path class SXRCompiler(Processor): """This class compiles symbol references stored in sxr files into a single symbol table.""" prefix = Parameter('', 'where to look for sxr files') no_locals = Parameter(True, '') def process(self, ir, **kwds): self.set_parameters(kwds) if not self.prefix: raise MissingArgument('prefix') self.ir = self.merge_input(ir) def prefix(filename): "Map filename to sxr filename." # Even though filenames shouldn't be absolute, we protect ourselves # against accidents. if os.path.isabs(filename): filename = os.path.splitdrive(filename)[1][1:] return os.path.join(self.prefix, filename) + '.sxr' for f in self.ir.files.values(): if f.annotations['primary'] and os.path.exists(prefix(f.name)): self.compile(prefix(f.name), f.annotations['language']) self.ir.sxr.generate_index() return self.ir def compile(self, filename, language): if language == 'Python': QName = lambda name: QualifiedPythonName(str(name).split('.')) else: QName = lambda name: QualifiedCxxName(str(name).split('::')) if self.verbose: print "SXRCompiler: Reading", filename try: document = parse(filename) except: if self.debug: print 'Error parsing', filename raise else: raise InternalError('parsing %s'%filename) sxr = document.documentElement filename = sxr.getAttribute('filename') lines = sxr.getElementsByTagName('line') for lineno, line in enumerate(lines): for a in line.getElementsByTagName('a'): if a.getAttribute('continuation') == 'true': continue qname = QName(a.getAttribute('href')) origin = QName(a.getAttribute('from')) type = str(a.getAttribute('type')) if self.no_locals: bad = False for i in range(len(qname)): if len(qname[i]) > 0 and qname[i][0] == '`': # Don't store local function variables bad = True break if bad: continue for i in range(len(origin)): if len(origin[i]) > 0 and origin[i][0] == '`': # Function scope, truncate here origin = origin[:i] + (origin[i][1:],) break entry = self.ir.sxr.setdefault(qname, SXR.Entry()) if type == 'definition': entry.definitions.append((filename, lineno + 1, origin)) elif type == 'call': entry.calls.append((filename, lineno + 1, origin)) elif type == 'reference': entry.references.append((filename, lineno + 1, origin)) else: print 'Warning: Unknown sxr type in %s:%d : %s'%(filename, lineno + 1, type) synopsis-0.12/Synopsis/Processors/ScopeStripper.py0000664000076400007640000001124211104703265022023 0ustar stefanstefan# # Copyright (C) 2000 Stefan Seefeld # Copyright (C) 2000 Stephen Davies # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import * from Synopsis import ASG class ScopeStripper(Processor, ASG.Visitor): """Strip common prefix from the declaration's name. Keep a list of root nodes, such that children whos parent scopes are not accepted but which themselfs are correct can be maintained as new root nodes.""" scope = Parameter('', 'strip all but the given scope') def __init__(self, **kwds): Processor.__init__(self, **kwds) self.declarations = [] self.inside = False self._scope = () def process(self, ir, **kwds): self.set_parameters(kwds) if not self.scope: raise MissingArgument('scope') self.ir = self.merge_input(ir) if '::' in self.scope: self._scope = tuple(self.scope.split('::')) else: self._scope = tuple(self.scope.split('.')) # strip prefixes and remove non-matching declarations self.strip_declarations(self.ir.asg.declarations) # Remove types not in strip self.strip_types(self.ir.asg.types) return self.output_and_return_ir() def strip_name(self, name): depth = len(self._scope) if name[:depth] == self._scope: if len(name) == depth: return None return name[depth:] return None def strip_declarations(self, declarations): for decl in declarations: decl.accept(self) declarations[:] = self.declarations def strip_types(self, types): # Remove the empty type (caused by C++ with extract_tails) if types.has_key(()): del types[()] for name, type in types.items(): try: del types[name] name = self.strip_name(name) if name: type.name = name types[name] = type except: print "ERROR Processing:", name, types[name] raise def strip(self, declaration): """test whether the declaration matches one of the prefixes, strip it off, and return success. Success means that the declaration matches the prefix set and thus should not be removed from the ASG.""" passed = False if not self._scope: return True depth = len(self._scope) name = declaration.name if name[:depth] == self._scope and len(name) > depth: if self.verbose: print "symbol", '::'.join(name), declaration.name = name[depth:] if self.verbose: print "stripped to", '::'.join(declaration.name) passed = True if self.verbose and not passed: print "symbol", '::'.join(declaration.name), "removed" return passed def visit_scope(self, scope): root = self.strip(scope) and not self.inside if root: self.inside = True self.declarations.append(scope) for declaration in scope.declarations: declaration.accept(self) if root: self.inside = False def visit_class(self, class_): self.visit_scope(class_) def visit_class_template(self, class_): self.visit_class(class_) templ = class_.template if templ: name = self.strip_name(templ.name) if name: templ.name = name def visit_declaration(self, decl): if self.strip(decl) and not self.inside: self.declarations.append(decl) def visit_enumerator(self, enumerator): self.strip(enumerator) def visit_enum(self, enum): self.visit_declaration(enum) for e in enum.enumerators: e.accept(self) def visit_function(self, function): self.visit_declaration(function) for parameter in function.parameters: parameter.accept(self) def visit_parameter(self, parameter): self.strip(parameter) def visit_function_template(self, function): self.visit_function(function) if function.template: name = self.strip_name(function.template.name) if name: function.template.name = name def visit_operation(self, operation): self.visit_function(operation) def visit_operation_template(self, operation): self.visit_function_template(operation) def visit_meta_module(self, module): self.visit_scope(module) for d in module.module_declarations: name = self.strip_name(d.name) if name: d.name = name synopsis-0.12/Synopsis/Processors/Comments/0000775000076400007640000000000011172123232020427 5ustar stefanstefansynopsis-0.12/Synopsis/Processors/Comments/Grouper.py0000664000076400007640000001214611104703265022435 0ustar stefanstefan# # Copyright (C) 2005 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import ASG from Synopsis.QualifiedName import QualifiedName from Synopsis.Processors.Transformer import Transformer import re class Grouper(Transformer): """A class that detects grouping tags and moves the enclosed nodes into a subnode (a 'Group')""" tags = r'^\s*((?P@group\s*(?P.*){)|(?P\s*}))\s*\Z' def __init__(self, **kwds): Transformer.__init__(self, **kwds) self.__group_stack = [[]] self.tags = re.compile(Grouper.tags, re.M) def strip_dangling_groups(self): """As groups must not overlap with 'real' scopes, make sure all groups created in the current scope are closed when leaving the scope.""" if self.__group_stack[-1]: print 'Warning: group stack is non-empty !' while (self.__group_stack[-1]): group = self.__group_stack[-1][-1] print 'forcing closing of group %s (opened near %s:%d)'%(group.name, group.file.name, group.line) self.pop_group() def finalize(self): """replace the ASG with the newly created one""" self.strip_dangling_groups() super(Grouper, self).finalize() def push(self): """starts a new group stack to be able to validate group scopes""" Transformer.push(self) self.__group_stack.append([]) def pop(self, decl): """Make sure the current group stack is empty.""" self.strip_dangling_groups() self.__group_stack.pop() Transformer.pop(self, decl) def push_group(self, group): """Push new group scope to the stack.""" self.__group_stack[-1].append(group) Transformer.push(self) def pop_group(self, decl=None): """Pop a group scope from the stack. decl -- an optional declaration from which to extract the context, used for the error message if needed. """ if self.__group_stack[-1]: group = self.__group_stack[-1].pop() group.declarations = self.current_scope() Transformer.pop(self, group) else: if decl: print "Warning: no group open in current scope (near %s:%d), ignoring."%(decl.file.name, decl.line) else: print "Warning: no group open in current scope, ignoring." def process_comments(self, decl): """Checks for grouping tags. If an opening tag is found in the middle of a comment, a new Group is generated, the preceeding comments are associated with it, and is pushed onto the scope stack as well as the groups stack. """ comments = [] for c in decl.annotations.get('comments', []): if c is None: comments.append(None) continue tag = self.tags.search(c) if not tag: comments.append(c) continue elif tag.group('open'): if self.debug: print 'found group open tag in', decl.name # Open the group. is remainder of line. label = tag.group('name') or 'unnamed' label = label.strip() # The comment before the open marker becomes the group comment. if tag.start('open') > 0: c = c[:tag.start('open')] comments.append(c) group = ASG.Group(decl.file, decl.line, 'group', QualifiedName((label,))) group.annotations['comments'] = comments comments = [] self.push_group(group) elif tag.group('close'): if self.debug: print 'found group close tag in', decl.name self.pop_group(decl) decl.annotations['comments'] = comments def visit_declaration(self, decl): self.process_comments(decl) self.add(decl) def visit_scope(self, scope): """Visits all children of the scope in a new scope. The value of current_scope() at the end of the list is used to replace scope's list of declarations - hence you can remove (or insert) declarations from the list.""" self.process_comments(scope) self.push() for d in scope.declarations: d.accept(self) scope.declarations = self.current_scope() self.pop(scope) def visit_enum(self, enum): """Does the same as visit_scope, but for the enum's list of enumerators""" self.process_comments(enum) self.push() for enumor in enum.enumerators: enumor.accept(self) enum.enumerators = self.current_scope() self.pop(enum) def visit_enumerator(self, enumor): """Removes dummy enumerators""" if enumor.type == "dummy": return #This wont work since Core.ASG.Enumerator forces type to "enumerator" if not len(enumor.name): return # workaround. self.add(enumor) synopsis-0.12/Synopsis/Processors/Comments/Filter.py0000664000076400007640000001204511104703265022235 0ustar stefanstefan# # Copyright (C) 2005 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import Processor from Synopsis import ASG import re class Filter(Processor, ASG.Visitor): """Base class for comment filters.""" def process(self, ir, **kwds): self.set_parameters(kwds) self.ir = self.merge_input(ir) for d in ir.asg.declarations: d.accept(self) return self.output_and_return_ir() def visit_declaration(self, decl): comments = decl.annotations.get('comments', []) comments[:] = [c is not None and self.filter_comment(c) or None for c in comments] visit_builtin = visit_declaration def filter_comment(self, comment): """Filter comment.""" return comment class CFilter(Filter): """A class that filters C-style comments.""" comment = r'/[\*]+[ \t]*(?P.*)(?P(\n[ \t]*.*)*?)(\n[ \t]*)?[\*]+/' # Match lines with and without asterisk. # Preserve space after asterisk so empty lines are formatted correctly. line = r'\n[ \t]*([ \t]*[\*]+(?=[ \t\n]))*(?P.*)' def __init__(self, **kwds): """Compiles the regular expressions""" Filter.__init__(self, **kwds) self.comment = re.compile(CFilter.comment) self.line = re.compile(CFilter.line) def filter_comment(self, comment): """Finds comments in the C format. The format is /* ... */. It has to cater for all five line forms: "/* ...", " * ...", " ...", " */" and the one-line "/* ... */". """ text = [] mo = self.comment.search(comment) while mo: text.append(mo.group('text')) lines = mo.group('lines') if lines: mol = self.line.search(lines) while mol: text.append(mol.group('text')) mol = self.line.search(lines, mol.end()) mo = self.comment.search(comment, mo.end()) return '\n'.join(text) class SSFilter(Filter): """A class that selects only // comments.""" ss = r'^[ \t]*// ?(.*)$' def __init__(self, **kwds): "Compiles the regular expressions" Filter.__init__(self, **kwds) self.ss = re.compile(SSFilter.ss, re.M) def filter_comment(self, comment): """""" return '\n'.join(self.ss.findall(comment)) class SSDFilter(Filter): """A class that selects only //. comments.""" ssd = r'^[ \t]*//\. ?(.*)$' def __init__(self, **kwds): "Compiles the regular expressions" Filter.__init__(self, **kwds) self.ssd = re.compile(SSDFilter.ssd, re.M) def filter_comment(self, comment): """""" return '\n'.join(self.ssd.findall(comment)) class SSSFilter(Filter): """A class that selects only /// comments.""" sss = r'^[ \t]*/// ?(.*)$' def __init__(self, **kwds): "Compiles the regular expressions" Filter.__init__(self, **kwds) self.sss = re.compile(SSSFilter.sss, re.M) def filter_comment(self, comment): """""" return '\n'.join(self.sss.findall(comment)) class QtFilter(Filter): """A class that finds Qt style comments. These have two styles: //! ... and /*! ... */. The first means "brief comment" and there must only be one. The second type is the detailed comment.""" brief = r"[ \t]*//!(.*)" detail = r"[ \t]*/\*!(.*)\*/[ \t\n]*" def __init__(self, **kwds): "Compiles the regular expressions" Filter.__init__(self, **kwds) self.brief = re.compile(QtFilter.brief) self.detail = re.compile(QtFilter.detail, re.S) def filter_comment(self, comment): "Matches either brief or detailed comments." mo = self.brief.match(comment) if mo: return mo.group(1) else: mo = self.detail.match(comment) if mo: return mo.group(1) return '' class JavaFilter(Filter): """A class that selects java /** style comments""" java = r'/\*\*[ \t]*(?P.*)(?P(\n[ \t]*\*.*)*?)(\n[ \t]*)?\*/' line = r'\n[ \t]*\*[ \t]*(?P.*)' def __init__(self): "Compiles the regular expressions" self.java = re.compile(JavaFilter.java) self.line = re.compile(JavaFilter.line) def filter_comment(self, comment): """Finds comments in the java format. The format is /** ... */, and it has to cater for all four line forms: "/** ...", " * ...", " */" and the one-line "/** ... */". """ text_list = [] mo = self.java.search(comment) while mo: text_list.append(mo.group('text')) lines = mo.group('lines') if lines: mol = self.line.search(lines) while mol: text_list.append(mol.group('text')) mol = self.line.search(lines, mol.end()) mo = self.java.search(comment, mo.end()) return '\n'.join(text_list) synopsis-0.12/Synopsis/Processors/Comments/Previous.py0000664000076400007640000000530511104703265022625 0ustar stefanstefan# # Copyright (C) 2005 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import Processor, Parameter from Synopsis import ASG class Previous(Processor, ASG.Visitor): """A class that maps comments that begin with '<' to the previous declaration""" def process(self, ir, **kwds): """decorates process() to initialise last and laststack""" self.set_parameters(kwds) self.ir = self.merge_input(ir) self.last = None self.__laststack = [] for d in ir.asg.declarations: d.accept(self) self.last = d return self.output_and_return_ir() def push(self): """decorates push() to also push 'last' onto 'laststack'""" self.__laststack.append(self.last) self.last = None def pop(self): """decorates pop() to also pop 'last' from 'laststack'""" self.last = self.__laststack.pop() def visit_scope(self, scope): """overrides visit_scope() to set 'last' after each declaration""" self.push() for d in scope.declarations: d.accept(self) self.last = d self.pop() def visit_declaration(self, decl): self.process_comments(decl) def visit_builtin(self, decl): if decl.type == 'EOS': # treat it if it is an 'end of scope' marker self.process_comments(decl) def visit_enum(self, enum): """Does the same as visit_scope but for enum and enumerators""" self.push() for enumor in enum.enumerators: enumor.accept(self) self.last = enumor if enum.eos: enum.eos.accept(self) self.pop() def visit_enumerator(self, enumor): """Checks previous comment and removes dummies""" self.process_comments(enumor) def process_comments(self, decl): """Checks a decl to see if the comment should be moved. If the comment begins with a less-than sign, then it is moved to the 'last' declaration""" comments = decl.annotations.get('comments', []) if comments and self.last: first = comments[0] if first and first[0] == "<" and self.last: if self.debug: print 'found comment for previous in', decl.name comments = self.last.annotations.get('comments', []) comments.append(first[1:]) # Remove '<' self.last.annotations['comments'] = comments del comments[0] synopsis-0.12/Synopsis/Processors/Comments/__init__.py0000664000076400007640000000017211104703265022545 0ustar stefanstefanfrom Filter import * from Previous import Previous from Grouper import Grouper from Translator import Translator synopsis-0.12/Synopsis/Processors/Comments/Translator.py0000664000076400007640000000345611104703265023147 0ustar stefanstefan# # Copyright (C) 2006 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import ASG from Synopsis.DocString import DocString from Synopsis.Processor import Processor, Parameter from Filter import * class Translator(Processor, ASG.Visitor): """A Translator translates comments into documentation.""" filter = Parameter(SSFilter(), 'A comment filter to apply.') processor = Parameter(None, 'A comment processor to run.') markup = Parameter('', 'The markup type for this declaration.') concatenate = Parameter(False, 'Whether or not to concatenate adjacent comments.') primary_only = Parameter(True, 'Whether or not to preserve secondary comments.') def process(self, ir, **kwds): self.set_parameters(kwds) self.ir = self.merge_input(ir) if self.filter: self.ir = self.filter.process(self.ir) if self.processor: self.ir = self.processor.process(self.ir) for decl in self.ir.asg.declarations: decl.accept(self) return self.output_and_return_ir() def visit_declaration(self, decl): """Map comments to a doc string.""" comments = decl.annotations.get('comments') if comments: text = None if self.primary_only: text = comments[-1] elif self.combine: text = ''.join([c for c in comments if c]) else: comments = comments[:] comments.reverse() for c in comments: if c is not None: text = c break doc = DocString(text or '', self.markup) decl.annotations['doc'] = doc synopsis-0.12/Synopsis/Processors/Transformer.py0000664000076400007640000000323711104703265021530 0ustar stefanstefan# # Copyright (C) 2005 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import ASG from Synopsis.Processor import Processor class Transformer(Processor, ASG.Visitor): """A class that creates a new ASG from an old one. This is a helper base for more specialized classes that manipulate the ASG based on the comments in the nodes""" def __init__(self, **kwds): """Constructor""" Processor.__init__(self, **kwds) self.__scopes = [] self.__current = [] def process(self, ir, **kwds): self.set_parameters(kwds) self.ir = self.merge_input(ir) for decl in ir.asg.declarations: decl.accept(self) self.finalize() return self.output_and_return_ir() def finalize(self): """replace the ASG with the newly created one""" self.ir.asg.declarations[:] = self.__current def push(self): """Pushes the current scope onto the stack and starts a new one""" self.__scopes.append(self.__current) self.__current = [] def pop(self, decl): """Pops the current scope from the stack, and appends the given declaration to it""" self.__current = self.__scopes.pop() self.__current.append(decl) def add(self, decl): """Adds the given decl to the current scope""" self.__current.append(decl) def current_scope(self): """Returns the current scope: a list of declarations""" return self.__current def visit_builtin(self, decl): self.visit_declaration(decl) synopsis-0.12/Synopsis/Processors/Linker.py0000664000076400007640000003057711170650351020461 0ustar stefanstefan# # Copyright (C) 2000 Stefan Seefeld # Copyright (C) 2000 Stephen Davies # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import Composite, Parameter from Synopsis import ASG from Synopsis.QualifiedName import * from Synopsis.Processors import TemplateLinker class Linker(Composite, ASG.Visitor): """Visitor that removes duplicate declarations""" remove_empty_modules = Parameter(True, 'Remove empty modules.') sort_modules = Parameter(True, 'Sort module content alphabetically.') sxr_prefix = Parameter('', 'Compile sxr data, if defined.') def process(self, ir, **kwds): self.set_parameters(kwds) self.ir = self.merge_input(ir) root = ASG.MetaModule("", QualifiedName()) self.__scopes = [root] global_dict = {} self.__dict_map = {id(root) : global_dict} self.__dicts = [global_dict] self.types = self.ir.asg.types try: for d in self.ir.asg.declarations: d.accept(self) self.ir.asg.declarations = root.declarations except TypeError, e: import traceback traceback.print_exc() print 'linker error :', e for file in self.ir.files.values(): self.visit_source_file(file) self.ir = TemplateLinker.TemplateLinker().process(self.ir, debug=self.debug) if self.remove_empty_modules: import ModuleFilter self.ir = ModuleFilter.ModuleFilter().process(self.ir, debug=self.debug) if self.sort_modules: import ModuleSorter self.ir = ModuleSorter.ModuleSorter().process(self.ir, debug=self.debug) if self.sxr_prefix: import SXRCompiler sxrcompiler = SXRCompiler.SXRCompiler(prefix=self.sxr_prefix) self.ir = sxrcompiler.process(self.ir, debug=self.debug) # now deal with the sub-processors, if any output = self.output self.ir = Composite.process(self, self.ir, input=[], output='') self.output = output return self.output_and_return_ir() def lookup(self, name): """look whether the current scope already contains a declaration with the given name""" return self.__dicts[-1].get(name) def append(self, declaration): """append declaration to the current scope""" self.__scopes[-1].declarations.append(declaration) self.__dicts[-1][declaration.name] = declaration def push(self, scope): """push new scope on the stack""" self.__scopes.append(scope) dict = self.__dict_map.setdefault(id(scope), {}) self.__dicts.append(dict) def pop(self): """restore the previous scope""" del self.__scopes[-1] del self.__dicts[-1] def top(self): return self.__scopes[-1] def top_dict(self): return self.__dicts[-1] def link_type(self, type): "Returns the same or new proxy type" self.__type = type if type is not None: type.accept(self) return self.__type #################### Type Visitor ########################################### def visit_builtin_type_id(self, type): if self.types.has_key(type.name): self.__type = self.types[type.name] def visit_unknown_type_id(self, type): if self.types.has_key(type.name): self.__type = self.types[type.name] def visit_declared_type_id(self, type): if self.types.has_key(type.name): self.__type = self.types[type.name] else: print "Couldn't find declared type-id:",type.name def visit_template_id(self, type): # Should be a Declared with the same name if not self.types.has_key(type.name): return declared = self.types[type.name] if isinstance(declared, ASG.UnknownTypeId): #the type was declared in a file for which no ASG is retained return elif not isinstance(declared, ASG.DeclaredTypeId): print "Warning: template declaration was not a declaration:",type.name,declared.__class__.__name__ return decl = declared.declaration if not hasattr(decl, 'template'): #print "Warning: non-class/function template",type.name, decl.__class__.__name__ return if decl.template: self.__type = decl.template else: print "Warning: template type disappeared:",type.name def visit_modifier_type_id(self, type): alias = self.link_type(type.alias) if alias is not type.alias: type.alias = alias self.__type = type def visit_array_type_id(self, type): alias = self.link_type(type.alias) if alias is not type.alias: type.alias = alias self.__type = type def visit_parametrized_type_id(self, type): templ = self.link_type(type.template) if templ is not type.template: type.template = templ type.parameters = [self.link_type(p) for p in type.parameters] self.__type = type def visit_function_type_id(self, type): ret = self.link_type(type.return_type) if ret is not type.return_type: type.return_type = ret type.parameters = [self.link_type(p) for p in type.parameters] self.__type = type #################### ASG Visitor ############################################ def visit_source_file(self, file): """Resolves any duplicates in the list of declarations from this file""" types = self.types # Clear the list and refill it declarations = file.declarations file.declarations = [] for d in declarations: # If this is a forward declaration try to # replace it by the definition... if types.has_key(d.name): declared = types[d.name] if isinstance(declared, ASG.DeclaredTypeId): d = declared.declaration # ...and only declare it once. if d not in file.declarations: file.declarations.append(d) # TODO: includes. def visit_module(self, module): #hmm, we assume that the parent node is a MetaModule. Can that ever fail ? metamodule = self.lookup(module.name) if metamodule is None: metamodule = ASG.MetaModule(module.type,module.name) self.append(metamodule) elif not isinstance(metamodule, ASG.MetaModule): raise TypeError, 'symbol type mismatch: Synopsis.ASG.Module and %s both match "%s"'%(metamodule.__class__, str(module.name)) metamodule.module_declarations.append(module) # Merge comments. self.merge_comments(metamodule, module) self.push(metamodule) for d in module.declarations: d.accept(self) module.declarations = [] self.pop() def visit_group(self, group): previous = self.lookup(group.name) if not previous: self.append(group) elif isinstance(previous, ASG.Group): previous.declarations.append(group.declarations) self.merge_comments(previous, group) group = previous else: raise TypeError, 'symbol type mismatch: Synopsis.ASG.Group and %s both match "%s"'%(previous.__class__, str(previous.name)) self.push(group) for d in group.declarations: d.accept(self) self.pop() def merge_comments(self, metamodule, module): """Append the module comments into the metamodule.""" if module.annotations.has_key('comments'): new_comments = module.annotations['comments'] metamodule.annotations.setdefault('comments', []) comments = metamodule.annotations['comments'] if comments[-len(new_comments):] != new_comments: comments.extend(new_comments) def visit_meta_module(self, module): #hmm, we assume that the parent node is a MetaModule. Can that ever fail ? metamodule = self.lookup(module.name) if metamodule is None: metamodule = ASG.MetaModule(module.type,module.name) self.append(metamodule) elif not isinstance(metamodule, ASG.MetaModule): raise TypeError, 'symbol type mismatch: Synopsis.ASG.MetaModule and %s both match "%s"'%(metamodule.__class__, '::'.join(module.name)) metamodule.module_declarations.extend(module.module_declarations) self.merge_comments(metamodule, module) self.push(metamodule) for d in module.declarations: d.accept(self) module.declarations = [] self.pop() def add_declaration(self, decl): """Adds a declaration to the current (top) scope. If there is already a Forward declaration, then this replaces it unless this is also a Forward. """ name = decl.name dict = self.__dicts[-1] decls = self.top().declarations if dict.has_key(name): prev = dict[name] if not isinstance(prev, ASG.Forward): return if not isinstance(decl, ASG.Forward): decls.remove(prev) decls.append(decl) dict[name] = decl # overwrite prev return decls.append(decl) dict[name] = decl def visit_builtin(self, builtin): """preserve builtins unconditionally""" self.top().declarations.append(builtin) def visit_named_type(self, decl): name = decl.name if self.lookup(decl.name): return self.add_declaration(decl) visit_declaration = add_declaration visit_forward = add_declaration visit_enum = add_declaration def visit_function(self, func): if not isinstance(self.top(), (ASG.Class, ASG.ClassTemplate)): for d in self.top().declarations: if not isinstance(d, ASG.Function): continue if func.name == d.name: return ret = self.link_type(func.return_type) if ret is not func.return_type: func.return_type = ret for param in func.parameters: self.visit_parameter(param) self.top().declarations.append(func) visit_operation = visit_function def visit_variable(self, var): #if not scopedNameOkay(var.name): return vt = self.link_type(var.vtype) if vt is not var.vtype: var.vtype = vt self.add_declaration(var) def visit_typedef(self, tdef): alias = self.link_type(tdef.alias) if alias is not tdef.alias: tdef.alias = alias self.add_declaration(tdef) def visit_class(self, class_): prev = self.lookup(class_.name) if prev: if isinstance(prev, ASG.Forward): # Forward declaration, replace it self.top().declarations.remove(prev) del self.top_dict()[class_.name] elif isinstance(prev, (ASG.Class, ASG.ClassTemplate)): # Previous class. Would ignore duplicate but class_ may have # class declarations that prev doesn't. (forward declared # nested -- see ThreadData.hh for example) self.push(prev) for d in class_.declarations: if isinstance(d, (ASG.Class, ASG.ClassTemplate)): d.accept(self) self.pop() return else: raise TypeError, 'symbol type mismatch: Synopsis.ASG.Class and %s both match "%s"'%(prev.__class__, '::'.join(class_.name)) self.add_declaration(class_) for p in class_.parents: p.accept(self) declarations = class_.declarations class_.declarations = [] self.push(class_) for d in declarations: d.accept(self) self.pop() def visit_inheritance(self, parent): type = parent.parent if isinstance(type, (ASG.DeclaredTypeId, ASG.UnknownTypeId)): ltype = self.link_type(type) if ltype is not type: parent.parent = ltype elif isinstance(type, ASG.ParametrizedTypeId): ltype = self.link_type(type.template) if ltype is not type.template: # Must find a ASG.TemplateId from it if not isinstance(ltype, ASG.DeclaredTypeId): # Error return decl = ltype.declaration if isinstance(decl, ASG.ClassTemplate): type.template = decl.template else: # Unknown type in class inheritance pass def visit_parameter(self, param): type = self.link_type(param.type) if type is not param.type: param.type = type def visit_const(self, const): ct = self.link_type(const.ctype) if ct is not const.ctype: const.ctype = ct self.add_declaration(const) synopsis-0.12/Synopsis/Processors/__init__.py0000664000076400007640000000106111104703265020756 0ustar stefanstefan"""ASG processors. There is much that can be done to an ASG to manipulate it. This includes: merging multiple ASG trees, mapping links to different languages, pruning the tree, mapping names to different scopes, and dealing with comment prefixes and groupings.""" from Linker import * from ScopeStripper import * from NameMapper import * from MacroFilter import * from ModuleFilter import * from SXRCompiler import * from AccessRestrictor import * from TypedefFolder import * from TypeMapper import * from TemplateLinker import TemplateLinker import Comments synopsis-0.12/Synopsis/Processors/TypeMapper.py0000664000076400007640000000104011104703265021302 0ustar stefanstefan# # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import Processor, Parameter from Synopsis import ASG class TypeMapper(Processor, ASG.Visitor): """Base class for type mapping""" def process(self, ir, **kwds): self.set_parameters(kwds) self.ir = self.merge_input(ir) for type in self.ir.asg.types.values(): type.accept(self) return self.output_and_return_ir() synopsis-0.12/Synopsis/Processors/MacroFilter.py0000664000076400007640000000170211104703265021430 0ustar stefanstefan# # Copyright (C) 2005 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import * from Synopsis import ASG import re class MacroFilter(Processor, ASG.Visitor): """A MacroFilter allows macros to be filtered, based on pattern matching. Macros with matching names will be removed.""" pattern = Parameter('', 'Regular expression to match macro names with.') def process(self, ir, **kwds): self.set_parameters(kwds) self._pattern = re.compile(self.pattern) self.ir = self.merge_input(ir) for decl in self.ir.asg.declarations[:]: decl.accept(self) return self.output_and_return_ir() def visit_macro(self, node): if self._pattern.match(node.name[-1]): # Macros always live in the top-most scope. self.ir.asg.declarations.remove(node) synopsis-0.12/Synopsis/Processors/AccessRestrictor.py0000664000076400007640000000311111104703265022477 0ustar stefanstefan# # Copyright (C) 2000 Stefan Seefeld # Copyright (C) 2000 Stephen Davies # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import Processor, Parameter from Synopsis import ASG class AccessRestrictor(Processor, ASG.Visitor): """This class processes declarations, and removes those that need greated access than the maximum passed to the constructor""" access = Parameter(None, 'specify up to which accessibility level the interface should be documented') def __init__(self, **kwds): self.set_parameters(kwds) self.__scopestack = [] self.__currscope = [] def process(self, ir, **kwds): self.set_parameters(kwds) self.ir = self.merge_input(ir) if self.access is not None: for decl in ir.asg.declarations: decl.accept(self) ir.asg.declarations = self.__currscope return self.output_and_return_ir() def push(self): self.__scopestack.append(self.__currscope) self.__currscope = [] def pop(self, decl): self.__currscope = self.__scopestack.pop() self.__currscope.append(decl) def add(self, decl): self.__currscope.append(decl) def visit_declaration(self, decl): if decl.accessibility > self.access: return self.add(decl) def visit_scope(self, scope): if scope.accessibility > self.access: return self.push() for decl in scope.declarations: decl.accept(self) scope.declarations = self.__currscope self.pop(scope) synopsis-0.12/Synopsis/Processors/ModuleSorter.py0000664000076400007640000000163011104703265021645 0ustar stefanstefan# # Copyright (C) 2006 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import Processor, Parameter from Synopsis import ASG class ModuleSorter(Processor, ASG.Visitor): """A processor that sorts declarations in a module alphabetically.""" def process(self, ir, **kwds): self.set_parameters(kwds) self.ir = self.merge_input(ir) self.__scopestack = [] self.__currscope = [] for decl in self.ir.asg.declarations: decl.accept(self) return self.output_and_return_ir() def visit_meta_module(self, module): """Visits all children of the module, and if there are no declarations after that removes the module""" def compare(a, b): return cmp(a.name, b.name) module.declarations.sort(compare) synopsis-0.12/Synopsis/Processors/TemplateLinker.py0000644000076400007640000000210411104703265022134 0ustar stefanstefan# # Copyright (C) 2008 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import * from Synopsis import ASG class TemplateLinker(Processor, ASG.Visitor): """Link template specializations to their primary templates, and vice versa.""" def process(self, ir, **kwds): self.set_parameters(kwds) self.ir = self.merge_input(ir) for d in ir.asg.declarations: d.accept(self) return self.output_and_return_ir() def link(self, d): if d.is_template_specialization: primary_name = d.name[:-1] + (d.name[-1].split('<')[0].strip(),) primary = self.ir.asg.types.get(primary_name) d.primary_template = primary_name if (type(primary) is ASG.DeclaredTypeId and d.name not in primary.declaration.specializations): primary.declaration.specializations.append(d.name) visit_forward = link visit_class = link visit_class_template = link synopsis-0.12/Synopsis/Processors/NameMapper.py0000664000076400007640000000463311104703265021254 0ustar stefanstefan# # Copyright (C) 2000 Stefan Seefeld # Copyright (C) 2000 Stephen Davies # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import Processor, Parameter from Synopsis import ASG class NameMapper(Processor, ASG.Visitor): """Abstract base class for name mapping.""" def visit_scope(self, node): """Recursively visits declarations under this scope.""" self.visit_declaration(node) for d in node.declarations: d.accept(self) def visit_group(self, node): """Recursively visits declarations under this group.""" self.visit_declaration(node) for d in node.declarations: d.accept(self) class NamePrefixer(NameMapper): """This class adds a prefix to all declaration and type names.""" prefix = Parameter([], 'the prefix which to prepend to all declared types') type = Parameter('Language', 'type to use for the new toplevel modules') def process(self, ir, **kwds): self.set_parameters(kwds) self.ir = self.merge_input(ir) if not self.prefix: return self.output_and_return_ir() for decl in self.ir.asg.declarations: decl.accept(self) # Now we need to put the declarations in actual nested MetaModules for index in range(len(self.prefix), 0, -1): module = ASG.MetaModule(self.type, self.prefix[:index]) module.declarations.extend(self.ir.asg.declarations) self.ir.asg.types[module.name] = ASG.DeclaredTypeId('', module.name, module) self.ir.asg.declarations[:] = [module] return self.output_and_return_ir() def visit_declaration(self, decl): """Changes the name of this declaration and its associated type""" # Change the name of the decl name = decl.name new_name = tuple(self.prefix + list(name)) decl.name = new_name # Change the name of the associated type try: type = self.ir.asg.types[name] del self.ir.asg.types[name] type.name = new_name self.ir.asg.types[new_name] = type except KeyError, msg: if self.verbose: print "Warning: Unable to map name of type:",msg synopsis-0.12/Synopsis/Processors/TypedefFolder.py0000664000076400007640000000327511122312026021753 0ustar stefanstefan# # Copyright (C) 2008 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import * from Synopsis import ASG class TypedefFolder(Processor, ASG.Visitor): """Fold (anonymous) types into enclosing typedefs.""" anonymous_only = Parameter(True, "Whether or not folding should be restricted to unnamed types.") def process(self, ir, **kwds): self.set_parameters(kwds) self.ir = self.merge_input(ir) self.scopes = [] # Iterate over a copy so we can safely modify # the original in the process. decls = self.ir.asg.declarations[:] for d in decls: d.accept(self) return self.output_and_return_ir() def visit_scope(self, s): self.scopes.append(s) decls = s.declarations[:] for d in decls: d.accept(self) self.scopes.pop() visit_group = visit_scope def visit_typedef(self, t): if t.constr: if self.verbose: print 'replace', t.alias.name, 'by', t.name alias = self.ir.asg.types.pop(t.alias.name) alias.declaration.name = alias.name = t.name self.ir.asg.types[alias.name] = alias if len(self.scopes): decls = self.scopes[-1].declarations else: decls = self.ir.asg.declarations del decls[decls.index(t)] if type(alias.declaration) == ASG.Class: i = len(alias.declaration.name) for d in alias.declaration.declarations: d.name = d.name[:i-1] + (alias.name[-1],) + d.name[i:] synopsis-0.12/Synopsis/Processors/ModuleFilter.py0000664000076400007640000000461511104703265021622 0ustar stefanstefan# # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import Processor, Parameter from Synopsis import ASG class ModuleFilter(Processor, ASG.Visitor): """A processor that filters modules.""" modules = Parameter([], 'List of modules to be filtered out.') remove_empty = Parameter(True, 'Whether or not to remove empty modules.') def process(self, ir, **kwds): self.set_parameters(kwds) self.ir = self.merge_input(ir) self.__scopestack = [] self.__currscope = [] for decl in self.ir.asg.declarations: decl.accept(self) self.ir.asg.declarations[:] = self.__currscope return self.output_and_return_ir() def push(self): """Pushes the current scope onto the stack and starts a new one""" self.__scopestack.append(self.__currscope) self.__currscope = [] def pop(self, decl): """Pops the current scope from the stack, and appends the given declaration to it""" self.__currscope = self.__scopestack.pop() self.__currscope.append(decl) def pop_only(self): """Only pops, doesn't append to scope""" self.__currscope = self.__scopestack.pop() def add(self, decl): """Adds the given decl to the current scope""" self.__currscope.append(decl) def visit_declaration(self, decl): """Adds declaration to scope""" self.add(decl) visit_builtin = visit_declaration visit_group = visit_declaration visit_scope = visit_declaration visit_enum = visit_declaration def visit_module(self, module): """Visits all children of the module, and if there are no declarations after that removes the module""" if module.name in self.modules: return self.push() for d in module.declarations: d.accept(self) module.declarations = self.__currscope # count the number of non-forward declarations in the current scope count = reduce(lambda x, y: x + y, [not isinstance(x, (ASG.Forward, ASG.Builtin)) for x in self.__currscope], 0) if not self.remove_empty or count: self.pop(module) else: self.pop_only() synopsis-0.12/Synopsis/__init__.py0000664000076400007640000000042611104703264016617 0ustar stefanstefan"""Package for all Synopsis modules. This package contains the Synopsis modules loaded at runtime. These modules are organised into four subpackages: Core, Parser, Linker and Formatter. There is also the Config module, which contains all the default configuration settings.""" synopsis-0.12/Synopsis/FileTree.py0000664000076400007640000000552211104703265016562 0ustar stefanstefan# # Copyright (C) 2000 Stefan Seefeld # Copyright (C) 2000 Stephen Davies # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # import os.path class Node: """Base class for directories and files in the tree. @attr path the path of this node as a string. @attr filename the name of the node, i.e. the last element of the path string """ def __init__(self, path, filename): self.path = path self.filename = filename class Directory(Node): """FileTree node for directories. @attr path the path of this node as a string. @attr filename the name of the directory, i.e. the last element of the path string @attr children the children of this directory, each Directory or File objects. """ def __init__(self, path, filename): Node.__init__(self, path, filename) self.children = [] class File(Node): """FileTree node for files. @attr path the path of this node as a string. @attr filename the name of the file, i.e. the last element of the path string @attr decls the list of declarations in this file. """ def __init__(self, path, filename, declarations): Node.__init__(self, path, filename) self.declarations = declarations def make_file_tree(files): tmp_dirs = {} root = Directory('', '') def insert_dir(path): """Recursively add a directory to the tree""" parent_dir, filename = os.path.split(path) if parent_dir == path: # The root directory is added below the root node # This is in case absolute filenames are mixed with relative ones parent = root filename = '/' else: parent_dir, filename = os.path.split(path) if parent_dir: if tmp_dirs.has_key(parent_dir): parent = tmp_dirs[parent_dir] else: parent = insert_dir(parent_dir) else: # No parent means a relative name like 'home/foo/bar' parent = root new_dir = Directory(path, filename) tmp_dirs[path] = new_dir parent.children.append(new_dir) return new_dir def insert_file(file, declarations): parent_dir, filename = os.path.split(file) if parent_dir: if tmp_dirs.has_key(parent_dir): parent = tmp_dirs[parent_dir] else: parent = insert_dir(parent_dir) else: # No parent means an relative name like 'home/foo/bar' parent = root new_file = File(file, filename, declarations) parent.children.append(new_file) for f in files: if f.annotations['primary']: insert_file(f.name, f.declarations) return root synopsis-0.12/Synopsis/DocString.py0000664000076400007640000000047611104703266016763 0ustar stefanstefan# # Copyright (C) 2006 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # class DocString: """A doc-string for ASG nodes.""" def __init__(self, text, markup): self.text = text self.markup = markup synopsis-0.12/Synopsis/process.py0000664000076400007640000000473711104703264016547 0ustar stefanstefan# # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Processor import Processor, Error import IR from getoptions import get_options import sys def error(msg): """Write an error message and exit.""" sys.stderr.write(msg) sys.stderr.write('\n') sys.exit(-1) def process(argv = sys.argv, **commands): """Accept a set of commands and process according to command line options. The typical call will start with the name of the processor to be executed, followed by a set of parameters, followed by non-parameter arguments. All parameters are either of the form 'name=value', or '--name=value'. The first form expects 'value' to be valid python, the second a string. The remaining non-parameter arguments are associated with the 'input' parameter. Once this initialization is done, the named command's 'process' method is executed. """ #first make sure the function was called with the correct argument types for c in commands: if not isinstance(commands[c], Processor): error("command '%s' isn't a valid processor"%c) if len(argv) < 2: error("Usage : %s [args] [input files]"%argv[0]) elif argv[1] == '--help': print "Usage: %s --help"%argv[0] print " or: %s --help"%argv[0] print " or: %s [parameters]"%argv[0] print "" print "Available commands:" for c in commands: print " %s"%c sys.exit(0) command = argv[1] args = argv[2:] if '--help' in args: print "Parameters for command '%s'"%command parameters = commands[command].get_parameters() tab = max(map(lambda x:len(x), parameters.keys())) for p in parameters: print " %-*s %s"%(tab, p, parameters[p].doc) sys.exit(0) props = {} # process all option arguments... for o, a in get_options(args): props[o.replace('-', '_')] = a # ...and keep remaining (non-option) arguments as 'input' if args: props['input'] = args if command in commands: ir = IR.IR() try: commands[command].process(ir, **props) except Error, e: error(str(e)) except KeyboardInterrupt, e: print 'KeyboardInterrupt' except IOError, e: error(str(e)) else: error('no command "%s"'%command) synopsis-0.12/Synopsis/SXRServer.py0000664000076400007640000001307311104703264016725 0ustar stefanstefan# # Copyright (C) 2006 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import IR import os, fnmatch def escape(text): """escape special characters ('&', '\"', '<', '>')""" text = text.replace('&', '&') text = text.replace('"', '"') text = text.replace('<', '<') text = text.replace('>', '>') return text default_template = """ Synopsis Cross-Reference

    Synopsis Cross-Reference

    @CONTENT@ """ file_search_form = """
    Enter a file name to search:
    """ ident_search_form = """
    Enter a variable, type, or function name to search:
    """ class SXRServer: def __init__(self, root, cgi_url, src_url, template_file = None, sxr_prefix='/sxr'): self.cgi_url = cgi_url self.src_url = src_url self.src_dir = os.path.join(root, 'Source') ir = IR.load(os.path.join(root, 'sxr.syn')) self.data = ir.sxr self.index = ir.sxr.index() if template_file: template = open(template_file).read() else: template = default_template self.template = template.split("@CONTENT@") def ident_ref(self, file, line, scope): if len(scope): text = '::'.join(scope) else: text = '' return '%s:%s: %s'\ %(self.src_url, file, line, file, line, escape(text)) def file_ref(self, file, name = None): if not name: name = file name = name[:-5] # strip of trailing '.html' return "%s"%(self.src_url, file, name) def list_refs(self, data, name): html = '' if not data.has_key(name): return '\n' html += '

    %s

    \n'%escape('::'.join(name)) entry = data[name] if entry.definitions: html += '
  • Defined at:
    \n' html += '
      \n' for file, line, scope in entry.definitions: html += '
    • %s
    • \n'%(self.ident_ref(file, line, scope)) html += '
  • \n' if entry.calls: html += '
  • Called from:
    \n' html += '
      \n' for file, line, scope in entry.calls: html += '
    • %s
    • \n'%(self.ident_ref(file, line, scope)) html += '
  • \n' if entry.references: html += '
  • Referenced from:
    \n' html += '
      \n' for file, line, scope in entry.references: html += '
    • %s
    • \n'%(self.ident_ref(file, line, scope)) html += '
  • \n' return html def search_file(self, pattern): """Generate a file search listing.""" html = self.template[0] html += file_search_form%{'script': self.cgi_url} base_path_len = len(self.src_dir) def find(result, base, files): result.extend([os.path.join(base[base_path_len + 1:], file) for file in files if os.path.isfile(os.path.join(base, file)) and fnmatch.fnmatch(os.path.splitext(file)[0], pattern)]) result = [] os.path.walk(self.src_dir, find, result) if result: html += '
      \n' for f in result: html += '
    • %s
    • \n'%(self.file_ref(f.strip())) html += '
    \n' html += self.template[1] return html def search_ident(self, name, qualified = False): """Generate an identifier listing.""" html = self.template[0] html += ident_search_form%{'script' : self.cgi_url} if qualified: if '::' in name: name = tuple(name.split('::')) else: name = tuple(name.split('.')) found = False # Check for exact match if self.data.has_key(name): html += 'Found exact match:
    \n' html += self.list_refs(self.data, name) found = True # Search for last part of name in index if self.index.has_key(name[-1]): matches = self.index[name[-1]] html += 'Found (%d) possible matches:
    \n'%(len(matches)) html += '
      \n' for name in matches: html += self.list_refs(self.data, name) html += '
    \n' found = True if not found: html += "No matches found
    \n" elif self.index.has_key(name): matches = self.index[name] html += 'Found (%d) possible matches:
    \n'%(len(matches)) html += '
      \n' for name in matches: html += self.list_refs(self.data, name) html += '
    \n' else: html += 'No matches found
    \n' html += self.template[1] return html synopsis-0.12/Synopsis/getoptions.py0000664000076400007640000000400711104703265017253 0ustar stefanstefan# # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from __future__ import generators from Processor import Error import sys class CommandLineError(Error): pass def parse_option(arg): """The required format is '--option[=[arg]]' or 'option=arg'. In the former case the optional argument is interpreted as a string (only '--option' sets the value to True, '--option=' sets it to the empty string), in the latter case the argument is evaluated as a python expression. Returns (None, None) for non-option argument""" if arg.find('=') == -1 and not arg.startswith('--'): return None, None # we are done attribute = arg.split('=', 1) if len(attribute) == 2: name, value = attribute if name.startswith('--'): name = name[2:] # value is a string else: try: value = eval(value) # it's a python expression except: sys.stderr.write("""an error occured trying to evaluate the value of \'%s\' (\'%s\') to pass this as a string, please use %s="'%s'" \n"""%(name, value, name, value)) sys.exit(-1) else: name, value = attribute[0][2:], True # flag the attribute as 'set' return name, value def get_options(args, parse_arg = parse_option, expect_non_options = True): """provide an iterator over the options in args. All found options are stripped, such that args will contain the remainder, i.e. non-option arguments. Pass each argument to the parse_option function to extract the (name,value) pair. Returns as soon as the first non-option argument was detected. """ while args: name, value = parse_arg(args[0]) if name: args[:] = args[1:] yield name, value elif not expect_non_options: raise CommandLineError("expected option, got '%s'"%args[0]) else: return synopsis-0.12/Synopsis/dist/0000775000076400007640000000000011172123232015443 5ustar stefanstefansynopsis-0.12/Synopsis/dist/__init__.py0000664000076400007640000000000011104703265017547 0ustar stefanstefansynopsis-0.12/Synopsis/dist/command/0000775000076400007640000000000011172123232017061 5ustar stefanstefansynopsis-0.12/Synopsis/dist/command/config.py0000664000076400007640000001554711171620151020715 0ustar stefanstefan# # Copyright (C) 2004 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # import os, sys, string from distutils.command.build_ext import build_ext from distutils.util import get_platform from distutils.dir_util import mkpath from distutils.spawn import spawn, find_executable from shutil import * class config(build_ext): """derive from build since we use almost all the same options""" description = "configure the package" user_options = [o for o in build_ext.user_options if o[0] in ['inplace', 'build-lib=', 'build-temp=']] + [ ('prefix=', None, "installation prefix"), ('libdir=', None, "library installation directory"), ('disable-threads', None, "whether or not to enable thread-support"), ('disable-gc', None, "whether or not to build the C++ parser with the garbage collector"), ('with-gc-prefix=', None, "the prefix to the garbage collector."), ('with-boost', None, 'whether to use boost libraries in backends.'), ('with-boost-version=', None, 'the boost version.'), ('with-boost-prefix=', None, 'the prefix to the boost libraries.'), ('with-boost-lib-suffix=', None, 'the library suffix to the used for boost libraries.')] boolean_options = build_ext.boolean_options[:] + ['disable-threads', 'disable-gc', 'with-boost'] def initialize_options(self): self.prefix = None self.libdir = None build_ext.initialize_options(self) self.disable_threads = 0 self.disable_gc = 0 self.with_gc_prefix = '' self.with_boost = False self.with_boost_prefix = '' self.with_boost_version = '' self.with_boost_lib_suffix = '' def finalize_options(self): if not self.prefix: # default to default prefix used by the install command install = self.distribution.get_command_obj('install') install.ensure_finalized() self.prefix = install.prefix # set build_clib to build_lib if it was explicitely given, # overriding the default value. if self.build_temp: self.build_ctemp = self.build_temp else: self.build_ctemp = os.path.join('build', 'ctemp.' + get_platform()) if self.build_lib: self.build_clib = self.build_lib else: self.build_clib = os.path.join('build', 'clib.' + get_platform()) build_ext.finalize_options(self) # only append the path once self.extensions = [] for e in self.distribution.ext_modules: if e[0] not in self.extensions: self.extensions.append(e[0]) if self.with_boost: self.extensions[0] = 'Synopsis/Parsers/Cpp/wave' def run(self): version = self.distribution.get_version() libdir_option = self.libdir and ' --libdir=%s'%self.libdir or '' self.config('src', self.build_ctemp, self.build_clib, '--enable-version=%s%s'%(version, libdir_option)) if not self.disable_gc and not self.with_gc_prefix: if os.name == 'nt': # for the gc configuration on the win32 native platform # set 'CC' explicitely to 'gcc -mno-cygwin' os.environ['CC'] = "gcc -mno-cygwin" self.config('src/Synopsis/gc', self.build_ctemp, self.build_clib) if os.name == 'nt': syn_cxx = '`cygpath -a "%s/src"`'%os.path.abspath(self.build_ctemp) #syn_cxx = syn_cxx.replace('\\', '\\\\\\\\\\\\\\\\') else: syn_cxx = '%s/src'%os.path.abspath(self.build_ctemp) for ext in self.extensions: if not self.rpath: self.config(ext, self.build_temp, self.build_lib, '--with-syn-cxx=%s'%syn_cxx) else: self.config(ext, self.build_temp, self.build_lib, '--with-syn-cxx=%s LDFLAGS=-Wl,-rpath,%s'%(syn_cxx, self.rpath[0])) self.config('tests', self.build_temp, self.build_lib, '--with-syn-cxx="%s"'%syn_cxx) self.config('doc', self.build_temp, self.build_lib) #self.config('sandbox', self.build_temp, self.build_lib, # '--with-syn-cxx="%s"'%syn_cxx) def config(self, component, build_temp, build_lib, args=''): """Configure a component. Depending on whether it depends on the Python C API, it will be compiled into 'build_lib' or 'build_clib'.""" self.announce("configuring '%s'" % component) path = os.path.join(build_temp, component) mkpath (path, int('777', 8), self.verbose, self.dry_run) srcdir = os.path.abspath(component) tempdir = os.path.abspath(os.path.join(build_temp, component)) builddir = os.path.abspath(os.path.join(build_lib, component)) cwd = os.getcwd() mkpath(tempdir, int('777', 8), self.verbose, self.dry_run) os.chdir(tempdir) if os.name == 'nt': # the path to the configure script has to be expressed in posix style # because even if we are compiling for windows, this part is run within # a cygwin shell configure = ('../' * (build_temp.count('\\') + component.count('/') + 2) + component + '/configure') python = '`cygpath -a "%s"`'%os.path.dirname(sys.executable) python += '/' + os.path.basename(sys.executable) #python.replace('\\', '\\\\\\\\\\\\\\\\') prefix = '`cygpath -a "%s"`'%sys.prefix else: configure = srcdir + '/configure' python = sys.executable prefix = self.prefix command = '%s --prefix="%s" --with-python="%s"'%(configure, prefix, python) if self.disable_threads: command += ' --disable-threads' if self.disable_gc: command += ' --disable-gc' elif self.with_gc_prefix: command += ' --with-gc-prefix="%s"'%self.with_gc_prefix if self.with_boost_version: command += ' --with-boost-version="%s"'%self.with_boost_version if self.with_boost_prefix: command += ' --with-boost-prefix="%s"'%self.with_boost_prefix if self.with_boost_lib_suffix: command += ' --with-boost-lib-suffix="%s"'%self.with_boost_lib_suffix command += ' %s'%args self.announce(command) # Work around a hack in distutils.spawn by an even more evil hack: # on NT, the whole command will get quoted, so we need to escape our own # quoting marks. if os.name == 'nt': command = command.replace('"', '\\"') spawn(['sh', '-c', command], self.verbose, self.dry_run) os.chdir(cwd) synopsis-0.12/Synopsis/dist/command/build.py0000664000076400007640000000100511104703265020533 0ustar stefanstefan# # Copyright (C) 2008 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from distutils.command.build import build as base class build(base): user_options = base.user_options + [ ('with-boost', None, 'whether to use boost libraries in backends.')] boolean_options = base.boolean_options + ['with-boost'] def initialize_options(self): base.initialize_options(self) self.with_boost = None synopsis-0.12/Synopsis/dist/command/build_doc.py0000644000076400007640000002327411171620405021370 0ustar stefanstefan# # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # import os, sys from stat import * import os.path from shutil import * import glob from distutils.command import build from distutils.spawn import spawn, find_executable from distutils.dep_util import newer, newer_group from distutils.dir_util import copy_tree, remove_tree, mkpath from distutils.file_util import copy_file from distutils import sysconfig class build_doc(build.build): """Defines the specific procedure to build synopsis' documentation.""" description = "build documentation" user_options = [('man-page', 'm', "build the man-pages only"), ('ref-manual', 'r', "build the API reference manual only"), ('tutorial', 't', "build the tutorial, development guide, and examples only"), ('examples', 'e', "build examples only"), ('html', 'h', "build for html output only"), ('printable', 'p', "build for pdf output only"), ('sxr=', 'x', "build the sxr database for synopsis for the given URL (requires -m)")] boolean_options = ['man-page', 'ref-manual', 'tutorial', 'examples', 'html', 'printable'] def initialize_options(self): build.build.initialize_options(self) self.man_page = False self.ref_manual = False self.tutorial = False self.examples = False self.html = False self.printable = False self.sxr = '' def finalize_options(self): # If no media option was given, do all media. if not (self.html or self.printable or self.sxr): self.html = self.printable = True # If no kind option is given, do them all. if not (self.man_page or self.ref_manual or self.tutorial or self.examples): self.man_page = self.ref_manual = self.tutorial = True build.build.finalize_options(self) def run(self): """Run this command, i.e. do the actual document generation.""" if not os.path.exists(self.build_temp): self.run_command('config') self.build_lib = '.' if self.man_page: self.build_man_page() if self.ref_manual or self.sxr: self.build_ref_manual() if self.tutorial: self.build_tutorial() elif self.examples: self.build_examples() def build_man_page(self): """Build man pages for all installable programs.""" self.announce("building man pages") descriptions = {} descriptions['synopsis'] = """simple frontend to the Synopsis framework, a multi-language source code introspection tool that provides a variety of representations for the parsed code, to enable further processing such as documentation extraction, reverse engineering, and source-to-source translation.""" descriptions['sxr-server'] = """the Synopsis Cross-Reference http server. Allows users to query and browse cross-referenced source code.""" help2man = find_executable('help2man') if not help2man: self.warn("cannot build man pages") return gzip = find_executable('gzip') section = 1 man_dir = 'share/man/man%d'%section mkpath(man_dir, int('777', 8), self.verbose, self.dry_run) for s in ['synopsis', 'sxr-server']: command = [help2man, '-N', '-n', descriptions[s]] executable = os.path.join('scripts', s) output = '%s/%s.%d'%(man_dir, s, section) command += ['-o', output, executable] spawn(command) if gzip: spawn(['gzip', '-f', output]) def build_ref_manual(self): """Build the API reference manual.""" self.announce("building API reference manual") tmp_man_dir = os.path.abspath(os.path.join(self.build_temp, 'doc/Manual')) make = os.environ.get('MAKE', 'make') build_clib = self.distribution.get_command_obj('build_clib') build_clib.ensure_finalized() tmpdir = os.path.join(build_clib.build_ctemp, 'src') # build the 'doc' target spawn([make, '-C', tmpdir, 'doc']) for d in ['cxx.syn', 'cxx-sxr.syn']: src, dest = os.path.join(tmpdir, d), os.path.join(tmp_man_dir, d) if os.path.exists(src) and newer(src, dest): copy_file(src, dest) else: self.announce('not copying %s'%src) src, dest = os.path.join(tmpdir, 'sxr'), os.path.join(tmp_man_dir, 'sxr') if os.path.exists(src) and newer(src, dest): copy_tree(src, dest) else: self.announce('not copying %s'%src) # now run make inside doc/Manual to do the rest srcdir = os.path.abspath('doc/Manual/') cwd = os.getcwd() mkpath(tmp_man_dir, int('777', 8), self.verbose, self.dry_run) if self.html: spawn([make, '-C', tmp_man_dir, 'html']) if self.printable: spawn([make, '-C', tmp_man_dir, 'pdf']) if self.sxr: spawn([make, '-C', tmp_man_dir, 'sxr', 'sxr=%s'%self.sxr]) builddir = os.path.abspath(os.path.join(self.build_lib, 'share/doc/synopsis/html/Manual')) if self.html: for d in ['python', 'cxx']: src = os.path.join(tmp_man_dir, 'html', d) dest = os.path.join(builddir, d) if newer(src, dest): rmtree(dest, True) copy_tree(src, dest) if self.sxr: src = os.path.join(tmp_man_dir, 'html', 'sxr') builddir = os.path.abspath(os.path.join(self.build_lib, 'share/doc/synopsis/html/')) dest = os.path.join(builddir, 'SXR') if newer(src, dest): rmtree(dest, True) copy_tree(src, dest) if self.printable: builddir = os.path.abspath(os.path.join(self.build_lib, 'share/doc/synopsis/print')) mkpath(builddir, int('777', 8), self.verbose, self.dry_run) copy_file(os.path.join(tmp_man_dir, 'Manual.pdf'), os.path.join(builddir, 'Manual.pdf')) def build_tutorial(self): """Build the tutorial.""" self.announce("building tutorial et al.") srcdir = os.path.abspath('doc/Tutorial/') tempdir = os.path.abspath(os.path.join(self.build_temp, 'doc/Tutorial')) cwd = os.getcwd() mkpath(tempdir, int('777', 8), self.verbose, self.dry_run) self.build_examples() make = os.environ.get('MAKE', 'make') if self.html: spawn([make, '-C', tempdir, 'html']) if self.printable: spawn([make, '-C', tempdir, 'pdf']) builddir = os.path.abspath(os.path.join(self.build_lib, 'share/doc/synopsis')) if self.html: for component in ('Tutorial', 'DevGuide'): if os.path.isdir(os.path.join(builddir, 'html', component)): rmtree(os.path.join(builddir, 'html', component), 1) copy_tree(os.path.join(tempdir, 'html', component), os.path.join(builddir, 'html', component)) if self.printable: builddir = os.path.abspath(os.path.join(self.build_lib, 'share/doc/synopsis/print')) mkpath(builddir, int('777', 8), self.verbose, self.dry_run) copy_file(os.path.join(tempdir, 'Tutorial.pdf'), os.path.join(builddir, 'Tutorial.pdf')) copy_file(os.path.join(tempdir, 'DevGuide.pdf'), os.path.join(builddir, 'DevGuide.pdf')) def build_examples(self): self.announce("building examples") srcdir = os.path.abspath('doc/Tutorial/') tempdir = os.path.abspath(os.path.join(self.build_temp, 'doc/Tutorial')) cwd = os.getcwd() mkpath(tempdir, int('777', 8), self.verbose, self.dry_run) # Copy examples sources into build tree. examples = [] def visit(arg, base, files): if '.svn' in files: del files[files.index('.svn')] arg.extend([os.path.join(base, f) for f in files if os.path.isfile(os.path.join(base, f))]) os.path.walk('doc/Tutorial/examples', visit, examples) for e in examples: dirname = os.path.dirname(os.path.join(self.build_temp, e)) mkpath(dirname, int('777', 8), self.verbose, self.dry_run) copy_file(e, dirname) make = os.environ.get('MAKE', 'make') if self.html: spawn([make, '-C', tempdir, 'html/examples']) builddir = os.path.abspath(os.path.join(self.build_lib, 'share/doc/synopsis')) # Copy examples output into installation directory if os.path.isdir(os.path.join(builddir, 'html/examples')): rmtree(os.path.join(builddir, 'html/examples'), 1) copy_tree(os.path.join(tempdir, 'html/examples'), os.path.join(builddir, 'html/examples')) if self.printable: spawn([make, '-C', tempdir, 'print/examples']) builddir = os.path.abspath(os.path.join(self.build_lib, 'share/doc/synopsis')) # Copy examples output into installation directory if os.path.isdir(os.path.join(builddir, 'print/examples')): rmtree(os.path.join(builddir, 'print/examples'), 1) copy_tree(os.path.join(tempdir, 'print/examples'), os.path.join(builddir, 'print/examples')) # Copy examples sources into installation directory. spawn([make, '-C', os.path.join(tempdir, 'examples'), 'install-src', 'prefix=%s/examples'%builddir]) synopsis-0.12/Synopsis/dist/command/build_py.py0000664000076400007640000000121311104703265021244 0ustar stefanstefan# # Copyright (C) 2007 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from distutils.command.build_py import build_py as base from Synopsis.dist.command import reset_config_variables import os class build_py(base): def run(self): # Do the default actions. base.run(self) config_file = os.path.join(self.build_lib, 'Synopsis', 'config.py') self.announce("adjusting config parameters") reset_config_variables(config_file, prefix=os.getcwd(), revision=self.distribution.revision) synopsis-0.12/Synopsis/dist/command/__init__.py0000664000076400007640000000667411171620111021204 0ustar stefanstefan# # Copyright (C) 2007 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # import os, re from distutils import sysconfig from distutils.dir_util import mkpath from distutils.file_util import copy_file from distutils.util import get_platform def reset_config_variables(config_file, **vars): """Reset specific variables in the given config file to new values. 'config_file' -- The config file to modify. 'vars' -- dict object containing variables to reset, with their new values. """ script = open(config_file, 'r').read() for v in vars: script, found = re.subn('%s[ \t]*=.*'%v,'%s = %s'%(v, repr(vars[v])), script) if not found: script += '%s = %s'%(v, repr(vars[v])) c = open(config_file, 'w') c.write(script) c.close() def shared_library_outputs(name, version, dest): """Returns a list of file names corresponding to the installed files. 'name' -- The name of the library. 'version' -- The version of the library. 'dest' -- The destination directory.""" major, minor = version.split('.', 1) if os.name == 'nt': LIBEXT = '.dll' elif os.uname()[0] == 'Darwin': LIBEXT = '.dylib' else: LIBEXT = sysconfig.get_config_var('SO') library = 'lib%s%s'%(name, LIBEXT) outputs = [] if os.name == 'posix' and not os.uname()[0].startswith('CYGWIN'): outputs.append(os.path.join(dest, '%s.%s'%(library, version))) for target in '%s.%s'%(library, major), library: outputs.append(os.path.join(dest, target)) else: outputs.append(os.path.join(dest, library)) return outputs def copy_shared_library(name, version, src, dest, verbose, dry_run): """Copies shared library and assorted links from src to dest. 'name' -- The name of the library. 'version' -- The version of the library. 'src' -- The source directory. 'dest' -- The destination directory. 'verbose' -- Whether or not to operate verbosely. 'dry_run' -- Whether or not to operate in dry-run mode.""" major, minor = version.split('.', 1) if os.name == 'nt': LIBEXT = '.dll' elif os.uname()[0] == 'Darwin': LIBEXT = '.dylib' else: LIBEXT = sysconfig.get_config_var('SO') library = 'lib%s%s'%(name, LIBEXT) mkpath (dest, int('777', 8), verbose, dry_run) if os.name == 'posix' and not os.uname()[0].startswith('CYGWIN'): # Copy versioned DSO copy_file(os.path.join(src, 'lib', '%s.%s'%(library, version)), os.path.join(dest, '%s.%s'%(library, version)), 1, 1, 0, None, verbose, dry_run) for target in '%s.%s'%(library, major), library: src_file = os.path.join(src, 'lib', target) if (os.path.islink(src_file)) and not dry_run: dest_file = os.path.join(dest, target) if os.path.exists(dest_file): os.remove(dest_file) linkto = os.readlink(src_file) os.symlink(linkto, dest_file) else: copy_file(os.path.join(src, 'lib', target), os.path.join(dest, target), 1, 1, 0, None, verbose, dry_run) else: # Copy unversioned DSO copy_file(os.path.join(src, 'lib', library), os.path.join(dest, library), 1, 1, 0, None, verbose, dry_run) synopsis-0.12/Synopsis/dist/command/clean.py0000664000076400007640000000422511104703265020525 0ustar stefanstefan# # Copyright (C) 2005 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from distutils.core import Command from distutils.dir_util import remove_tree from distutils import log import os from distutils.command.clean import clean as base class clean(base): def finalize_options(self): base.finalize_options(self) build_clib = self.distribution.get_command_obj('build_clib') build_clib.ensure_finalized() self.build_ctemp = build_clib.build_ctemp self.build_clib = build_clib.build_clib def run(self): base.run(self) # Remove the build/ctemp. directory (unless it's already # gone). if os.path.exists(self.build_ctemp): remove_tree(self.build_ctemp, dry_run=self.dry_run) if self.all: # Remove the build/clib. directory (unless it's already # gone). libdir = os.path.join(self.build_clib, 'lib') incdir = os.path.join(self.build_clib, 'include') bindir = os.path.join(self.build_clib, 'bin') for d in [libdir, incdir, bindir]: if os.path.exists(d): remove_tree(d, dry_run=self.dry_run) pc = os.path.join(self.build_clib, 'synopsis.pc') if os.path.exists(pc) and not self.dry_run: os.remove(pc) # Remove the generated documentation. prefix = 'share/doc/synopsis/html/Manual' for d in ['cxx', 'python', 'sxr']: if os.path.exists(os.path.join(prefix, d)): remove_tree(os.path.join(prefix, d), dry_run=self.dry_run) prefix = 'share/doc/synopsis/html' for d in ['Tutorial', 'DevGuide']: if os.path.exists(os.path.join(prefix, d)): remove_tree(os.path.join(prefix, d), dry_run=self.dry_run) prefix = 'share/doc/synopsis' if os.path.exists(os.path.join(prefix, 'examples')): remove_tree(os.path.join(prefix, 'examples'), dry_run=self.dry_run) synopsis-0.12/Synopsis/dist/command/install_clib.py0000644000076400007640000000735511144350376022114 0ustar stefanstefan# # Copyright (C) 2005 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from distutils.core import Command from distutils.errors import DistutilsOptionError from distutils.dir_util import mkpath from distutils.file_util import copy_file from distutils.util import get_platform from distutils.spawn import spawn from distutils.util import change_root from distutils import sysconfig import os from Synopsis.dist.command import shared_library_outputs, copy_shared_library def header_collector(prefix): def collect_headers(arg, path, files): """Collect headers to be installed.""" # For now at least the following are not part of the public API if os.path.split(path)[1] in ['Support', 'Python', 'ASG']: return arg.extend([(os.path.join(path, f), os.path.join(path, f)[len(prefix) + 1:]) for f in files if f.endswith('.hh') or f.endswith('.h')]) return collect_headers class install_clib(Command): description = "install libSynopsis.so" user_options = [('prefix=', None, "installation prefix"), ('home=', None, "(Unix only) home directory to install under")] def initialize_options(self): self.prefix = None self.build_dir = None self.home = None def finalize_options(self): self.set_undefined_options('install', ('prefix', 'prefix'), ('home', 'home')) self.set_undefined_options('build_clib', ('build_clib', 'build_dir')) # the bdist commands set a 'root' attribute (equivalent to # make's DESTDIR), which we have to merge in, if it exists. install = self.distribution.get_command_obj('install') install.ensure_finalized() self.root = getattr(install, 'root') def run(self): version = self.distribution.get_version() build_ctemp = os.path.join('build', 'ctemp.' + get_platform()) if os.name == 'nt': # same as in config.py here: even on 'nt' we have to # use posix paths because we run in a cygwin shell at this point path = build_ctemp.replace('\\', '/') + '/src' LIBEXT = '.dll' else: path = os.path.join(build_ctemp, 'src') LIBEXT = sysconfig.get_config_var('SO') target = 'libSynopsis%s'%LIBEXT if not os.path.isfile(os.path.join(self.build_dir, 'lib', target)): self.run_command('build_clib') make = os.environ.get('MAKE', 'make') command = '%s -C "%s" %s'%(make, path, 'install') if self.root: command += ' DESTDIR=%s'%self.root spawn(['sh', '-c', command], self.verbose, self.dry_run) def get_outputs(self): if self.root: prefix = change_root(self.root, self.prefix) else: prefix = self.prefix version = self.distribution.get_version() libdir = os.path.join(prefix, 'lib') libs = shared_library_outputs('Synopsis', version, libdir) pkgconfig = os.path.join(prefix, 'lib', 'pkgconfig', 'synopsis.pc') headers = [] os.path.walk(os.path.join('src', 'Synopsis'), header_collector('src'), headers) os.path.walk(os.path.join(self.build_dir, 'include', 'Synopsis'), header_collector(os.path.join(self.build_dir, 'include')), headers) include_dir = os.path.join(prefix, 'include') headers = [os.path.join(include_dir, dest) for (src, dest) in headers] return libs + [pkgconfig] + headers synopsis-0.12/Synopsis/dist/command/build_ext.py0000664000076400007640000001053111171622050021413 0ustar stefanstefan# # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from distutils.command.build_ext import build_ext as base from distutils.dir_util import mkpath from distutils.file_util import copy_file from distutils.spawn import spawn, find_executable from shutil import * import os class build_ext(base): description = "build C++ extension packages" user_options = [('build-lib=', 'b', "directory for compiled extension modules"), ('build-temp=', 't', "directory for temporary files (build by-products)"), ('inplace', 'i', "ignore build-lib and put compiled extensions into the source " + "directory alongside your pure Python modules"), ('with-boost', None, 'whether to use boost libraries in backends.')] boolean_options = ['inplace', 'with-boost'] def initialize_options(self): base.initialize_options(self) self.with_boost = None def finalize_options(self): base.finalize_options(self) self.set_undefined_options('build', ('with_boost', 'with_boost')) if self.with_boost: self.extensions[0] = ('Synopsis/Parsers/Cpp/wave', 'ParserImpl.so') def run(self): if not os.path.exists(self.build_temp): self.run_command('config') self.run_command('build_clib') # If 'Synopsis/Parsers/Cpp/ucpp' doesn't exist in the build tree, assume # --with-boost was used during configure. if not os.path.exists(os.path.join(self.build_temp, 'Synopsis/Parsers/Cpp/ucpp')): self.extensions[0] = ('Synopsis/Parsers/Cpp/wave', 'ParserImpl.so') for ext in self.extensions: self.build_extension(ext) def check_extensions_list (self, extensions): pass # do nothing, trust that the extensions are correct def get_source_files(self): def collect(arg, path, files): arg.extend([os.path.join(path, file) for file in files]) sources = [] for ext in self.extensions: os.path.walk(ext[0], collect, sources) return sources def get_outputs(self): output = [] for ext in self.extensions: # FIXME: this ugly hack is needed since the ucpp module # should be installed in the Cpp package, not Cpp.ucpp if os.path.basename(ext[0]) in ['ucpp', 'wave']: path = os.path.join(self.build_lib, os.path.dirname(ext[0]), ext[1]) else: path = os.path.join(self.build_lib, ext[0], ext[1]) #only append the files that actually could be built if os.path.isfile(path): output.append(path) return output def build_extension(self, ext, copy=True): self.announce("building '%s' in %s"%(ext[1], ext[0])) # FIXME: this ugly hack is needed since the ucpp module # should be installed in the Cpp package, not Cpp.ucpp if os.path.basename(ext[0]) in ['ucpp', 'wave']: target = os.path.dirname(ext[0]) else: target = ext[0] if os.name == 'nt': # same as in config.py here: even on 'nt' we have to # use posix paths because we run in a cygwin shell at this point path = self.build_temp.replace('\\', '/') + '/' + ext[0] temp_target = self.build_temp.replace('\\', '/') + '/' + ext[0] else: path = os.path.join(self.build_temp, ext[0]) temp_target = os.path.join(self.build_temp, ext[0]) make = os.environ.get('MAKE', 'make') command = '%s -C "%s" %s'%(make, path, ext[1]) spawn(['sh', '-c', command], self.verbose, self.dry_run) #The extension may not be compiled. For now just skip it. if copy and os.path.isfile(os.path.join(temp_target, ext[1])): if self.inplace: build_path = target else: build_path = os.path.join(self.build_lib, target) mkpath (build_path, int('777', 8), self.verbose, self.dry_run) copy_file(os.path.join(path, ext[1]), os.path.join(build_path, ext[1]), 1, 1, 0, None, self.verbose, self.dry_run) synopsis-0.12/Synopsis/dist/command/install.py0000664000076400007640000000046211104703265021110 0ustar stefanstefan# # Copyright (C) 2007 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from distutils.command.install import install as base class install(base): sub_commands = base.sub_commands + [('install_clib', None)] synopsis-0.12/Synopsis/dist/command/bdist_dpkg.py0000664000076400007640000002275211171622257021567 0ustar stefanstefan"""distutils.command.bdist_dpkg Implements the Distutils 'bdist_dpkg' command (create a Debian package). """ # This module should be kept compatible with Python 1.5.2. import sys, os, string import glob from types import * from distutils.core import Command from distutils.debug import DEBUG from distutils.util import get_platform, convert_path from distutils.file_util import write_file, copy_file from distutils.dir_util import mkpath from distutils.errors import * from distutils import log import time MARKER_STRING = "GENERATED BY BDIST_DPKG" class bdist_dpkg (Command): description = "create a DPKG distribution" user_options = [ ('gain-root-command=', 'r', 'command that allows to gain root rights'), # XXX this option name is a bit odd; what would be a better one? ('do-not-build', None, 'do not build the package, just create the debian/ stuff') ] boolean_options = [ 'do-not-build' ] def initialize_options (self): self.gain_root_command = None self.do_not_build = None # initialize_options() def finalize_options (self): if os.name != 'posix': raise DistutilsPlatformError \ ("don't know how to create DPKG " "distributions on platform %s" % os.name) # finalize_options() def run (self): if DEBUG: print("before _get_package_data():") self._create_dpkg_files() if not self.do_not_build: # build package log.info("building DPKG") build_command = [ "dpkg-buildpackage" ] if self.gain_root_command is not None: build_command.append ('-r%s' % self.gain_root_command) self.spawn(build_command) # run() def _create_dpkg_files (self): # Files to create: # changelog, control, # Optional: docs, copyright # log.info("creating debian control files") if not os.path.exists('debian'): log.info("creating debian/ subdirectory") os.mkdir('debian') dist = self.distribution dirlist = "" for i in dist.packages or []: dir = i # XXX ugh! this replacement really needs to # be available in the Distutils API somewhere, but it's not. dirlist += ' ' + dir.replace('.', '/') pyversion = '%i.%i' % sys.version_info[0:2] # Temporary hack to build everything with 2.2 -- # I'm running out of the CVS trunk, but don't have it # installed as python2.4. package_name = 'python%s-%s' % (pyversion, dist.get_name().lower()) d = {'name':dist.get_name(), 'package_name':package_name, 'pyversion': pyversion, 'dirlist':dirlist, 'license':dist.get_license(), 'marker':MARKER_STRING, 'maintainer':dist.get_maintainer(), 'maintainer_email':dist.get_maintainer_email(), 'now':time.strftime ("%a, %d %b %Y %H:%M:%S %z"), 'author':dist.get_author(), 'author_email':dist.get_author_email(), 'url':dist.get_url() } if not self._is_user_file('changelog') or True: log.info('writing changelog file') output = self._write_file('changelog') output.write("""%s (%s-%i) unstable; urgency=low * Dummy changelog line -- %s <%s> %s """ % (package_name, dist.get_version(), 1, # XXX build version? dist.get_maintainer(), dist.get_maintainer_email(), d['now'])) output.close() if not self._is_user_file('control') or True: log.info('writing control file') output = self._write_file('control') #output.write('XXX-Dummy-Field: %s\n' % MARKER_STRING) output.write("Source: %s\n" % package_name) output.write("Priority: optional\n") output.write("Maintainer: %s <%s>\n" % (dist.get_maintainer(), dist.get_maintainer_email())) output.write("""Build-Depends: debhelper (>> 3.0.0) Standards-Version: 3.5.8 Section: libs """) output.write('\n') # Separator line output.write("Package: %s\n" % package_name) #added missing Version information to control --- Vinzenz Feenstra (evilissimo@users.sf.net) output.write("Version: %s\n" % dist.get_version() ) output.write("""Section: libs Architecture: any\n""") output.write("Depends: python%(pyversion)s\n" % d) output.write("Description: %s\n" % dist.get_description()) s = dist.get_long_description() s = string.replace(s, '\n', '\n ') output.write(' ' + s) output.close() if dist.has_pure_modules() and not self._is_user_file('postinst'): log.info('writing postinst file') output = self._write_file('postinst') output.write(POSTINST_FILE % d) output.close() if dist.has_pure_modules() and not self._is_user_file('prerm'): log.info('writing prerm file') output = self._write_file('prerm') output.write(PRERM_FILE % d) output.close() if not self._is_user_file('rules'): log.info('writing rules file') output = self._write_file('rules') output.write(RULES_FILE % d) output.close() os.chmod('debian/rules', int('755', 8)) if not self._is_user_file('copyright'): log.info('writing copyright file') output = self._write_file('copyright') output.write(COPYRIGHT_FILE % d) output.close() mkpath('debian/tmp/DEBIAN', int('755', 8)) copy_file('debian/control', 'debian/tmp/DEBIAN/control') def _write_file (self, filename): path = os.path.join('debian', filename) assert not self._is_user_file(path) output = open(path, 'w') return output def _is_user_file (self, filename): path = os.path.join('debian', filename) if not os.path.exists(path): return False input = open(path, 'r') while 1: L = input.readline() if L == "": break elif L.find(MARKER_STRING) != -1: return False return True # class bdist_dpkg PRERM_FILE = """#! /bin/sh # %(marker)s -- remove this line if you edit this file # prerm script for %(name)s set -e PACKAGE=%(name)s VERSION=%(pyversion)s LIB=/usr/lib/python$VERSION DIRLIST="%(dirlist)s" case "$1" in remove|upgrade|failed-upgrade) for i in $DIRLIST ; do find $LIB/site-packages/$i -name '*.py[co]' -exec rm \{\} \; done ;; *) echo "prerm called with unknown argument \`$1'" >&2 exit 1 ;; esac exit 0 """ POSTINST_FILE = """#! /bin/sh # %(marker)s -- remove this line if you edit this file # postinst script for %(name)s # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `configure' # * `abort-upgrade' # * `abort-remove' `in-favour' # # * `abort-deconfigure' `in-favour' # `removing' # # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package # # quoting from the policy: # Any necessary prompting should almost always be confined to the # post-installation script, and should be protected with a conditional # so that unnecessary prompting doesn't happen if a package's # installation fails and the `postinst' is called with `abort-upgrade', # `abort-remove' or `abort-deconfigure'. PACKAGE=%(name)s VERSION=%(pyversion)s LIB=/usr/lib/python$VERSION DIRLIST="%(dirlist)s" case "$1" in configure|abort-upgrade|abort-remove|abort-deconfigure) for i in $DIRLIST ; do /usr/bin/python$VERSION -O $LIB/compileall.py -q $LIB/site-packages/$i /usr/bin/python$VERSION $LIB/compileall.py -q $LIB/site-packages/$i done ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac exit 0 """ RULES_FILE = """#!/usr/bin/make -f # %(marker)s -- remove this line if you edit this file # Sample debian/rules that uses debhelper. # GNU copyright 1997 to 1999 by Joey Hess. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # This is the debhelper compatibility version to use. export DH_COMPAT=4 build: build-stamp /usr/bin/python%(pyversion)s setup.py build build-stamp: touch build-stamp configure: # Do nothing clean: dh_testdir dh_testroot rm -f build-stamp -rm -rf build dh_clean install: build dh_testdir dh_testroot dh_clean -k /usr/bin/python%(pyversion)s setup.py install --no-compile --prefix=$(CURDIR)/debian/%(package_name)s/usr # Build architecture-independent files here. binary-indep: install dh_testdir dh_testroot dh_installdocs dh_installdeb dh_gencontrol dh_md5sums dh_builddeb # We have nothing to do by default. binary: binary-indep .PHONY: build clean binary-indep binary install """ COPYRIGHT_FILE = '''This package was debianized by %(maintainer)s <%(maintainer_email)s> on %(now)s It was downloaded from %(url)s Upstream Author: %(author)s <%(author_email)s> Copyright: %(license)s ''' synopsis-0.12/Synopsis/dist/command/bdist_rpm.py0000664000076400007640000000763011171653137021437 0ustar stefanstefan# # Copyright (C) 2009 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # import os, sys, string from distutils.core import Command from distutils.util import get_platform from distutils.file_util import write_file, copy_file from distutils.errors import * from distutils.sysconfig import get_python_version class bdist_rpm (Command): description = "create an RPM distribution" user_options = [ ('bdist-base=', None, "base directory for creating built distributions"), ('rpm-base=', None, "base directory for creating RPMs (defaults to \"rpm\" under " "--bdist-base; must be specified for RPM 2)"), ('dist-dir=', 'd', "directory to put final RPM files in " "(and .spec files if --spec-only)"), ('python=', None, "path to Python interpreter to hard-code in the .spec file " "(default: \"python\")"), ('source-only', None, "only generate source RPM"), ('binary-only', None, "only generate binary RPM"), ('use-bzip2', None, "use bzip2 instead of gzip to create source distribution"), # Actions to take when building RPM ('keep-temp', 'k', "don't clean up RPM build directory"), ('no-keep-temp', None, "clean up RPM build directory [default]"), # Allow a packager to explicitly force an architecture ('force-arch=', None, "Force an architecture onto the RPM build process"), ] boolean_options = ['keep-temp'] negative_opt = {'no-keep-temp': 'keep-temp'} def initialize_options(self): self.bdist_base = None self.rpm_base = None self.dist_dir = None self.binary_only = None self.source_only = None self.use_bzip2 = None self.keep_temp = 0 self.force_arch = None # initialize_options() def finalize_options(self): self.set_undefined_options('bdist', ('bdist_base', 'bdist_base')) if self.rpm_base is None: self.rpm_base = os.path.join(self.bdist_base, "rpm") if os.name != 'posix': raise DistutilsPlatformError \ ("don't know how to create RPM " "distributions on platform %s" % os.name) if self.binary_only and self.source_only: raise DistutilsOptionError \ ("cannot supply both '--source-only' and '--binary-only'") self.set_undefined_options('bdist', ('dist_dir', 'dist_dir')) def run(self): rpm_dir = {} for d in ('SOURCES', 'SPECS', 'BUILD', 'RPMS', 'SRPMS'): rpm_dir[d] = os.path.join(self.rpm_base, d) self.mkpath(rpm_dir[d]) spec_dir = rpm_dir['SPECS'] copy_file('synopsis.spec', '%s/synopsis.spec'%spec_dir) # Make a source distribution and copy to SOURCES directory saved_dist_files = self.distribution.dist_files[:] sdist = self.reinitialize_command('sdist') if self.use_bzip2: sdist.formats = ['bztar'] else: sdist.formats = ['gztar'] self.run_command('sdist') self.distribution.dist_files = saved_dist_files source = sdist.get_archive_files()[0] source_dir = rpm_dir['SOURCES'] self.copy_file(source, source_dir) # build package self.announce("building RPMs") rpm_cmd = ['rpmbuild'] if self.source_only: # what kind of RPMs? rpm_cmd.append('-bs') elif self.binary_only: rpm_cmd.append('-bb') else: rpm_cmd.append('-ba') rpm_cmd.extend(['--define', '_topdir %s' % os.path.abspath(self.rpm_base)]) if not self.keep_temp: rpm_cmd.append('--clean') rpm_cmd.append('%s/synopsis.spec'%spec_dir) self.spawn(rpm_cmd) synopsis-0.12/Synopsis/dist/command/test.py0000664000076400007640000000365211172012364020423 0ustar stefanstefan# # Copyright (C) 2004 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # import os, sys, string from distutils.errors import * from distutils.core import setup from distutils.command.build_ext import build_ext from distutils.util import get_platform from distutils.dir_util import mkpath from distutils.spawn import spawn, find_executable from shutil import * class test(build_ext): """derive from build since we use almost all the same options""" description = "run unit test" user_options = build_ext.user_options[:] + [ ('suite=', 's', "the id of a test suite to run."), ('expectation=', 'e', "an expectation file to compare the results against."), ('interactive', None, "run the web iterface to the testing engine.")] boolean_options = build_ext.boolean_options[:] + ['interactive'] def initialize_options (self): build_ext.initialize_options(self) self.suite = '' self.expectation = '' self.interactive = False def finalize_options (self): build_ext.finalize_options(self) def run(self): cwd = os.getcwd() if self.expectation: self.expectation = os.path.join(cwd, self.expectation) os.environ['QMTEST_CLASS_PATH'] = os.path.join(cwd, 'tests', 'QMTest') test_dir = os.path.join(self.build_temp, 'tests') os.chdir(test_dir) command = 'qmtest ' command += self.interactive and 'gui ' or 'run ' if self.expectation: command += '-O %s '%self.expectation command += self.suite self.announce(command) try: spawn(['sh', '-c', command], self.verbose, self.dry_run) # As qmtest returns a non-zero exit code if some tests fail, we # simply ignore exec errors here. except DistutilsExecError: pass synopsis-0.12/Synopsis/dist/command/install_lib.py0000664000076400007640000000320711104703265021736 0ustar stefanstefan# # Copyright (C) 2007 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from distutils.command.install_lib import install_lib as base from Synopsis.dist.command import reset_config_variables import os.path class install_lib(base): def run(self): # Do the standard installation. base.run(self) config_file = os.path.join(self.install_dir, 'Synopsis', 'config.py') self.announce("adjusting config parameters") i = self.distribution.get_command_obj('install') version = self.distribution.get_version() datadir=os.path.join(i.prefix, 'share', 'synopsis-%s'%version) reset_config_variables(config_file, prefix=i.prefix, version=version, revision=self.distribution.revision, datadir=datadir) # Make sure the new config file gets recompiled, or else python may # not notice it is in fact different from the original config file. files = [config_file] from distutils.util import byte_compile install_root = self.get_finalized_command('install').root if self.compile: byte_compile(files, optimize=0, force=1, prefix=install_root, dry_run=self.dry_run) if self.optimize > 0: byte_compile(files, optimize=self.optimize, force=1, prefix=install_root, verbose=self.verbose, dry_run=self.dry_run) synopsis-0.12/Synopsis/dist/command/build_clib.py0000644000076400007640000000746311171625121021536 0ustar stefanstefan# # Copyright (C) 2004 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # import os from distutils.core import Command from distutils import sysconfig from distutils.dir_util import mkpath from distutils.file_util import copy_file from distutils.util import get_platform from distutils.spawn import spawn from shutil import * from Synopsis.dist.command import copy_shared_library class build_clib(Command): description = "build common C/C++ stuff used by all extensions" user_options = [('build-clib', 'b', "directory to build C/C++ libraries to"), ('build-temp', 't', "directory to put temporary build by-products")] def initialize_options(self): self.build_base = 'build' self.build_clib = None self.build_ctemp = None def finalize_options(self): if self.build_ctemp is None: self.build_ctemp = os.path.join(self.build_base, 'ctemp.' + get_platform()) if self.build_clib is None: self.build_clib = os.path.join(self.build_base, 'clib.' + get_platform()) def run(self): version = self.distribution.get_version() self.announce("building 'Synopsis' shared library") if os.name == 'nt': # same as in config.py here: even on 'nt' we have to # use posix paths because we run in a cygwin shell at this point path = self.build_ctemp.replace('\\', '/') + '/src' else: path = os.path.join(self.build_ctemp, 'src') make = os.environ.get('MAKE', 'make') command = '%s -C "%s" %s'%(make, path, 'all') spawn(['sh', '-c', command], self.verbose, self.dry_run) # copy library build_path = os.path.join(self.build_clib, 'lib') copy_shared_library('Synopsis', version, path, build_path, self.verbose, self.dry_run) # copy headers headers = [] for root, dirs, files in os.walk(os.path.join(self.build_ctemp, 'src', 'Synopsis')): headers.extend([os.path.join(root, f) for f in files if f.endswith('.hh') or f.endswith('.h')]) # For now at least the following are not part of the public API for d in ['Python', 'ASG']: if d in dirs: dirs.remove(d) incdir = os.path.join(self.build_clib, 'include') for header in headers: target = os.path.join(incdir, header[len(self.build_ctemp) + 5:]) mkpath (os.path.dirname(target), int('777', 8), self.verbose, self.dry_run) copy_file(header, target, 1, 1, 0, None, self.verbose, self.dry_run) # copy tools build_path = os.path.join(self.build_clib, 'bin') mkpath (build_path, int('777', 8), self.verbose, self.dry_run) for tool in os.listdir(os.path.join(path, 'bin')): copy_file(os.path.join(path, 'bin', tool), os.path.join(build_path, tool), 1, 1, 0, None, self.verbose, self.dry_run) # copy pkgconfig file copy_file(os.path.join(path, 'synopsis.pc'), os.path.join(self.build_clib, 'synopsis.pc'), 1, 1, 0, None, self.verbose, self.dry_run) def get_source_files(self): src = [] for root, dirs, files in os.walk('src'): src.extend([os.path.join(root, f) for f in files if f[0] != '.']) # skip hidden files if '.svn' in dirs: dirs.remove('.svn') return src def get_outputs(self): return [] # nothing to report here synopsis-0.12/Synopsis/dist/distribution.py0000664000076400007640000000360011171651244020543 0ustar stefanstefan# # Copyright (C) 2007 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from distutils import dist from Synopsis.dist.command.config import config from Synopsis.dist.command.build import build from Synopsis.dist.command.build_doc import build_doc from Synopsis.dist.command.build_clib import build_clib from Synopsis.dist.command.build_ext import build_ext from Synopsis.dist.command.build_py import build_py from Synopsis.dist.command.test import test from Synopsis.dist.command.install_clib import install_clib from Synopsis.dist.command.install_lib import install_lib from Synopsis.dist.command.install import install from Synopsis.dist.command.bdist_dpkg import bdist_dpkg from Synopsis.dist.command.bdist_rpm import bdist_rpm from Synopsis.dist.command.clean import clean # patch distutils if it can't cope with the "classifiers" keyword from distutils.dist import DistributionMetadata if not hasattr(DistributionMetadata, 'classifiers'): DistributionMetadata.classifiers = None DistributionMetadata.download_url = None class Distribution(dist.Distribution): """Add additional parameters and commands.""" def __init__(self, attrs=None): self.revision = None dist.Distribution.__init__(self, attrs) self.cmdclass['config'] = config self.cmdclass['build'] = build self.cmdclass['build_doc'] = build_doc self.cmdclass['build_clib'] = build_clib self.cmdclass['build_ext'] = build_ext self.cmdclass['build_py'] = build_py self.cmdclass['test'] = test self.cmdclass['install_clib'] = install_clib self.cmdclass['install_lib'] = install_lib self.cmdclass['install'] = install self.cmdclass['bdist_dpkg'] = bdist_dpkg self.cmdclass['bdist_rpm'] = bdist_rpm self.cmdclass['clean'] = clean synopsis-0.12/Synopsis/Parsers/0000775000076400007640000000000011172123232016117 5ustar stefanstefansynopsis-0.12/Synopsis/Parsers/C/0000775000076400007640000000000011172123232016301 5ustar stefanstefansynopsis-0.12/Synopsis/Parsers/C/ASGTranslator.hh0000664000076400007640000000545711122312025021314 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef ASGTranslator_hh_ #define ASGTranslator_hh_ #include #include #include #include using namespace Synopsis; class ASGTranslator : private PTree::Visitor { public: ASGTranslator(std::string const &filename, std::string const &base_path, bool primary_file_only, IR a, bool v, bool d); void translate(PTree::Node *, Buffer &); private: typedef std::stack ScopeStack; virtual void visit(PTree::CommentedAtom *); virtual void visit(PTree::List *); virtual void visit(PTree::Declarator *); virtual void visit(PTree::Declaration *); virtual void visit(PTree::FunctionDefinition *); virtual void visit(PTree::ClassSpec *); virtual void visit(PTree::EnumSpec *); virtual void visit(PTree::Typedef *); void translate_parameters(PTree::Node *, ASG::TypeIdList, ASG::Function::Parameters &); void add_comments(ASG::Declaration, PTree::Node *); //. Update positional information for the given //. node. This will reset 'my_lineno' and may change //. 'my_file'. //. Return whether or not the node should be translated, //. according to the current file and the 'primary_file_only' flag. bool update_position(PTree::Node *); //. look up and return the named type. If this is a derived type, //. it may create a modifier and return that. ASG::TypeId lookup(PTree::Encoding const &name); ASG::TypeId lookup_function_types(PTree::Encoding const &name, ASG::TypeIdList &); void declare(ASG::Declaration); ASG::TypeId declare_type(ScopedName name, ASG::Declaration declaration); ASG::TypeId declare_type(ScopedName name); PTree::Encoding::iterator decode_type(PTree::Encoding::iterator, ASG::TypeId &); PTree::Encoding::iterator decode_func_ptr(PTree::Encoding::iterator, ASG::TypeId &type, ASG::Modifiers &postmod); PTree::Encoding::iterator decode_name(PTree::Encoding::iterator, std::string &name); Python::Object qname_; ASG::ASGKit asg_kit_; SourceFileKit sf_kit_; Python::List declarations_; Python::Dict types_; Python::Dict files_; SourceFile file_; std::string raw_filename_; std::string base_path_; bool primary_file_only_; unsigned long lineno_; ScopeStack scope_; bool verbose_; bool debug_; Buffer *buffer_; PTree::Declaration *declaration_; //. True if we have just seen a class-specifier or enum-specifier //. inside a decl-specifier-seq. bool defines_class_or_enum_; PTree::Encoding name_; }; #endif synopsis-0.12/Synopsis/Parsers/C/__init__.py0000664000076400007640000000516711104703264020427 0ustar stefanstefan# # Copyright (C) 2004 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import * import ParserImpl import os, os.path, tempfile class Parser(Processor): preprocess = Parameter(True, 'whether or not to preprocess the input') emulate_compiler = Parameter('cc', 'a compiler to emulate') compiler_flags = Parameter([], 'list of flags for the emulated compiler') cppflags = Parameter([], 'list of preprocessor flags such as -I or -D') primary_file_only = Parameter(True, 'should only primary file be processed') base_path = Parameter('', 'path prefix to strip off of the file names') sxr_prefix = Parameter(None, 'path prefix (directory) to contain syntax info') def process(self, ir, **kwds): self.set_parameters(kwds) if not self.input: raise MissingArgument('input') self.ir = ir if self.preprocess: from Synopsis.Parsers import Cpp cpp = Cpp.Parser(base_path = self.base_path, language = 'C', flags = self.cppflags, emulate_compiler = self.emulate_compiler, compiler_flags = self.compiler_flags) base_path = self.base_path and os.path.abspath(self.base_path) + os.sep or '' for file in self.input: i_file = file if self.preprocess: if self.output: i_file = os.path.splitext(self.output)[0] + '.i' else: i_file = os.path.join(tempfile.gettempdir(), 'synopsis-%s.i'%os.getpid()) self.ir = cpp.process(self.ir, cpp_output = i_file, input = [file], primary_file_only = self.primary_file_only, verbose = self.verbose, debug = self.debug) try: self.ir = ParserImpl.parse(self.ir, i_file, os.path.abspath(file), self.primary_file_only, base_path, self.sxr_prefix, self.verbose, self.debug) finally: if self.preprocess: os.remove(i_file) return self.output_and_return_ir() synopsis-0.12/Synopsis/Parsers/C/configure0000775000076400007640000042102211171624011020211 0ustar stefanstefan#! /bin/sh # From configure.ac Revision: 1.4 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for Synopsis 1.0. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='Synopsis' PACKAGE_TARNAME='synopsis' PACKAGE_VERSION='1.0' PACKAGE_STRING='Synopsis 1.0' PACKAGE_BUGREPORT='synopsis-devel@fresco.org' ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP CXX CXXFLAGS ac_ct_CXX SYN_CPP SYN_LIBS PYTHON PYTHON_INCLUDE LIBEXT LDSHARED LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP CXX CXXFLAGS CCC' # 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. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_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 ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_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'` 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 ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_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'` 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; }; } 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 directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $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 test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures Synopsis 1.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/synopsis] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of Synopsis 1.0:";; esac cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-syn-cxx=PATH specify the Synopsis C++ library prefix --with-python=PATH specify the Python interpreter Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF Synopsis configure 1.0 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by Synopsis $as_me 1.0, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file 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 $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { 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 # Check whether --with-syn-cxx was given. if test "${with_syn_cxx+set}" = set; then withval=$with_syn_cxx; SYN_CXX="$with_syn_cxx" else SYN_CXX="/usr/local" 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { 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` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then 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 # Check that 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' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 that 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 { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { 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 ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { 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` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { 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 ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { 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 g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { 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 if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { 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 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 SYN_CPP="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --cflags synopsis-uninstalled`" SYN_LIBS="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --libs synopsis-uninstalled`" { echo "$as_me:$LINENO: checking for python extension module build information" >&5 echo $ECHO_N "checking for python extension module build information... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: " >&5 echo "${ECHO_T}" >&6; } # Check whether --with-python was given. if test "${with_python+set}" = set; then withval=$with_python; PYTHON="$with_python" else PYTHON="python" fi if test -n "$PYTHON" -a "$PYTHON" != yes; then # Extract the first word of "$PYTHON", so it can be a program name with args. set dummy $PYTHON; 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_PYTHON+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$PYTHON"; then ac_cv_prog_PYTHON="$PYTHON" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PYTHON="{ { echo "$as_me:$LINENO: error: Cannot find Python interpreter" >&5 echo "$as_me: error: Cannot find Python interpreter" >&2;} { (exit 1); exit 1; }; }" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PYTHON=$ac_cv_prog_PYTHON if test -n "$PYTHON"; then { echo "$as_me:$LINENO: result: $PYTHON" >&5 echo "${ECHO_T}$PYTHON" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi else # Extract the first word of "python2 python", so it can be a program name with args. set dummy python2 python; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_PYTHON+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $PYTHON in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_PYTHON" && ac_cv_path_PYTHON="python" ;; esac fi PYTHON=$ac_cv_path_PYTHON if test -n "$PYTHON"; then { echo "$as_me:$LINENO: result: $PYTHON" >&5 echo "${ECHO_T}$PYTHON" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi PYTHON_PREFIX=`$PYTHON -c "import sys; print(sys.prefix)" | tr -d "\r"` { echo "$as_me:$LINENO: checking for Python development environment" >&5 echo $ECHO_N "checking for Python development environment... $ECHO_C" >&6; } PYTHON_INCLUDE=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_inc())" | tr -d "\r"` PYTHON_H=`$PYTHON -c "from os.path import *; h = join('$PYTHON_INCLUDE', 'Python.h'); print(exists(h) and h or '')"` if test $PYTHON_H then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else { { echo "$as_me:$LINENO: error: Python.h not found." >&5 echo "$as_me: error: Python.h not found." >&2;} { (exit 1); exit 1; }; } fi LIBEXT=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_var('SO'))" | tr -d "\r"` case `uname -s` in CYGWIN*) if test `$PYTHON -c "import os; print(os.name)" | tr -d "\r"` = posix; then PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d'%(sys.version_info[0],sys.version_info[1]))"` PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" PYTHON_DEP_LIBS=`$PYTHON -c "from distutils import sysconfig; import re; print(re.sub(r'\\s*-lutil', '', sysconfig.get_config_var('LIBS') or ''))"` else if test "$CXX" = "g++"; then CPPFLAGS="$CPPFLAGS -D PARSE_MSVC" CFLAGS="-mno-cygwin $CFLAGS" CXXFLAGS="-mno-cygwin $CXXFLAGS" LDFLAGS="-mno-cygwin $LDFLAGS" PYTHON_VERSION=`$PYTHON -c "import sys; print('%d%d'%(sys.version_info[0],sys.version_info[1]))" | tr -d "\r"` PYTHON_LIBS="-L`cygpath -a $PYTHON_PREFIX | tr -d \"\r\"`/Libs -lpython$PYTHON_VERSION" fi PYTHON_INCLUDE=`cygpath -a $PYTHON_INCLUDE | tr -d "\r"` PYTHON_DEP_LIBS=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_var('LIBS') or '')" | tr -d "\r"` fi LDSHARED="$CXX -shared" CXXFLAGS="-D_REENTRANT $CXXFLAGS" LIBS="$LIBS $PYTHON_LIBS $PYTHON_DEP_LIBS" ;; Darwin) PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d'%(sys.version_info[0],sys.version_info[1]))"` PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" CFLAGS="$CFLAGS -fPIC" CXXFLAGS="$CXXFLAGS -fPIC" LDSHARED="$CXX -dynamiclib -Wl,-undefined,dynamic_lookup" ;; *) PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d'%(sys.version_info[0],sys.version_info[1]))"` PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" CFLAGS="$CFLAGS -fPIC" CXXFLAGS="$CXXFLAGS -fPIC" LDSHARED="$CXX -shared" ;; esac ac_config_files="$ac_config_files Makefile synopsis.py" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${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 more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by Synopsis $as_me 1.0, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" _ACEOF 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 and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ Synopsis config.status 1.0 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' _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 ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "synopsis.py") CONFIG_FILES="$CONFIG_FILES synopsis.py" ;; *) { { 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 fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for 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 _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim CPP!$CPP$ac_delim CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim ac_ct_CXX!$ac_ct_CXX$ac_delim SYN_CPP!$SYN_CPP$ac_delim SYN_LIBS!$SYN_LIBS$ac_delim PYTHON!$PYTHON$ac_delim PYTHON_INCLUDE!$PYTHON_INCLUDE$ac_delim LIBEXT!$LIBEXT$ac_delim LDSHARED!$LDSHARED$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 56; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF 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&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; esac done # for ac_tag { (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 synopsis-0.12/Synopsis/Parsers/C/ParserImpl.cc0000644000076400007640000000611411104703264020672 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include #include #include #include #include #include #include #include "ASGTranslator.hh" // #include "SXRGenerator.hh" #include #include using namespace Synopsis; namespace { PyObject *error; //. Override unexpected() to print a message before we abort void unexpected() { std::cout << "Warning: Aborting due to unexpected exception." << std::endl; throw std::bad_exception(); } PyObject *parse(PyObject * /* self */, PyObject *args) { PyObject *py_ir; const char *src, *cppfile; char const * base_path = ""; char const * sxr_prefix = 0; int primary_file_only, verbose, debug; if (!PyArg_ParseTuple(args, "Ossizzii", &py_ir, &cppfile, &src, &primary_file_only, &base_path, &sxr_prefix, &verbose, &debug)) return 0; Py_INCREF(py_ir); IR ir(py_ir); Py_INCREF(py_ir); std::set_unexpected(unexpected); ErrorHandler error_handler(); // if (verbose) ::verbose = true; if (debug) Synopsis::Trace::enable(Trace::TRANSLATION); if (!src || *src == '\0') { PyErr_SetString(PyExc_RuntimeError, "no input file"); return 0; } try { std::ifstream ifs(cppfile); Buffer buffer(ifs.rdbuf(), src); Lexer lexer(&buffer, Lexer::GCC); SymbolFactory symbols(SymbolFactory::NONE); Parser parser(lexer, symbols, Parser::GCC); PTree::Node *ptree = parser.parse(); const Parser::ErrorList &errors = parser.errors(); if (!errors.empty()) { for (Parser::ErrorList::const_iterator i = errors.begin(); i != errors.end(); ++i) (*i)->write(std::cerr); throw std::runtime_error("The input contains errors."); } else if (ptree) { ASGTranslator translator(src, base_path, primary_file_only, ir, verbose, debug); translator.translate(ptree, buffer); // if (sxr_prefix) // { // SXRGenerator sxr_generator(src, base_path, primary_file_only, ir, verbose, debug); // srx_generator.generate(ptree, buffer); // } } } catch (std::exception const &e) { PyErr_SetString(error, e.what()); return 0; } return py_ir; } PyMethodDef methods[] = {{(char*)"parse", parse, METH_VARARGS}, {0}}; } extern "C" void initParserImpl() { Python::Module module = Python::Module::define("ParserImpl", methods); module.set_attr("version", "0.1"); Python::Object processor = Python::Object::import("Synopsis.Processor"); Python::Object error_base = processor.attr("Error"); error = PyErr_NewException("ParserImpl.ParseError", error_base.ref(), 0); module.set_attr("ParseError", error); } synopsis-0.12/Synopsis/Parsers/C/ASGTranslator.cc0000664000076400007640000005706311122312025021302 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include "ASGTranslator.hh" #include #include // for PTree::reify #include using namespace Synopsis; namespace { ScopedName sname(std::string const &name) { return ScopedName(name);} class UnknownSymbol : public std::runtime_error { public: explicit UnknownSymbol(std::string const &n) : std::runtime_error("Unknown symbol: " + n) {} }; } #define qname(arg) qname_(Python::Tuple(arg)) ASGTranslator::ASGTranslator(std::string const &filename, std::string const &base_path, bool primary_file_only, Synopsis::IR ir, bool v, bool d) : asg_kit_("C"), sf_kit_("C"), declarations_(ir.declarations()), types_(ir.types()), files_(ir.files()), raw_filename_(filename), base_path_(base_path), primary_file_only_(primary_file_only), lineno_(0), verbose_(v), debug_(d), buffer_(0), declaration_(0), defines_class_or_enum_(false) { Trace trace("ASGTranslator::ASGTranslator", Trace::TRANSLATION); Python::Module qn = Python::Module::import("Synopsis.QualifiedName"); qname_ = qn.attr("QualifiedCxxName"); // determine canonical filenames Path path = Path(raw_filename_).abs(); std::string long_filename = path.str(); path.strip(base_path_); std::string short_filename = path.str(); SourceFile file = files_.get(short_filename); if (file) file_ = file; else { file_ = sf_kit_.create_source_file(short_filename, long_filename); files_.set(short_filename, file_); } file_.set_primary(true); Python::Object define = types_.attr("__setitem__"); types_.set(qname(sname("char")), asg_kit_.create_builtin_type_id(sname("char"))); types_.set(qname(sname("short")), asg_kit_.create_builtin_type_id(sname("short"))); types_.set(qname(sname("int")), asg_kit_.create_builtin_type_id(sname("int"))); types_.set(qname(sname("long")), asg_kit_.create_builtin_type_id(sname("long"))); types_.set(qname(sname("unsigned")), asg_kit_.create_builtin_type_id(sname("unsigned"))); types_.set(qname(sname("unsigned long")), asg_kit_.create_builtin_type_id(sname("unsigned long"))); types_.set(qname(sname("float")), asg_kit_.create_builtin_type_id(sname("float"))); types_.set(qname(sname("double")), asg_kit_.create_builtin_type_id(sname("double"))); types_.set(qname(sname("void")), asg_kit_.create_builtin_type_id(sname("void"))); types_.set(qname(sname("...")), asg_kit_.create_builtin_type_id(sname("..."))); types_.set(qname(sname("long long")), asg_kit_.create_builtin_type_id(sname("long long"))); types_.set(qname(sname("long double")), asg_kit_.create_builtin_type_id(sname("long double"))); // some GCC extensions... types_.set(qname(sname("__builtin_va_list")), asg_kit_.create_builtin_type_id(sname("__builtin_va_list"))); } void ASGTranslator::translate(PTree::Node *ptree, Buffer &buffer) { Trace trace("ASGTranslator::translate", Trace::TRANSLATION); buffer_ = &buffer; ptree->accept(this); } void ASGTranslator::visit(PTree::CommentedAtom *node) { // The only purpose of this method is to filter // out those atoms that are used as end markers. // They can be recognized by having length() == 0. if (node->length() == 0) { bool visible = update_position(node); ASG::Builtin eos = asg_kit_.create_builtin(file_, lineno_, "EOS", sname(std::string("EOS"))); add_comments(eos, node->get_comments()); if (visible) declare(eos); } // else // visit(static_cast(node)); } void ASGTranslator::visit(PTree::List *node) { if (node->car()) node->car()->accept(this); if (node->cdr()) node->cdr()->accept(this); } void ASGTranslator::visit(PTree::Declarator *declarator) { Trace trace("ASGTranslator::visit(PTree::Declarator *)", Trace::TRANSLATION); trace << declarator; if (!declaration_ || !PTree::first(declarator)) return; // empty bool visible = update_position(declarator); PTree::Encoding name = declarator->encoded_name(); PTree::Encoding type = declarator->encoded_type(); if (type.is_function()) { trace << "declare function " << name << " (" << type << ')' << raw_filename_ << ':' << lineno_; ASG::TypeIdList parameter_types; ASG::TypeId return_type = lookup_function_types(type, parameter_types); ASG::Function::Parameters parameters; PTree::Node *p = PTree::rest(declarator); while (p && p->car() && *p->car() != '(') p = PTree::rest(p); translate_parameters(PTree::second(p), parameter_types, parameters); size_t length = (name.front() - 0x80); ScopedName sname(std::string(name.begin() + 1, name.begin() + 1 + length)); ASG::Modifiers pre; ASG::Modifiers post; ASG::Function function = asg_kit_.create_function(file_, lineno_, "function", pre, return_type, post, sname, sname.get(0)); function.parameters().extend(parameters); if (declaration_) add_comments(function, declaration_->get_comments()); add_comments(function, declarator->get_comments()); if (visible) declare(function); } else { ASG::TypeId t = lookup(type); size_t length = (name.front() - 0x80); ScopedName sname; if (scope_.size()) sname = scope_.top().name(); sname.append(std::string(name.begin() + 1, name.begin() + 1 + length)); std::string vtype; if (scope_.size()) { vtype = scope_.top().type(); if (vtype == "class" || vtype == "struct" || vtype == "union") vtype = "data member"; else if (vtype == "function") vtype = "local variable"; } else vtype += "variable"; ASG::Variable variable = asg_kit_.create_variable(file_, lineno_, vtype, sname, t, false); if (declaration_) add_comments(variable, declaration_->get_comments()); add_comments(variable, declarator->get_comments()); if (visible) declare(variable); } } void ASGTranslator::visit(PTree::Declaration *declaration) { Trace trace("ASGTranslator::visit(PTree::Declaration *)", Trace::TRANSLATION); // Cache the declaration while traversing the individual declarators; // the comments are passed through. declaration_ = declaration; visit(static_cast(declaration)); declaration_ = 0; } void ASGTranslator::visit(PTree::FunctionDefinition *def) { Trace trace("ASGTranslator::visit(PTree::FunctionDefinition *)", Trace::TRANSLATION); // Cache the declaration while traversing the individual declarators; // the comments are passed through. declaration_ = def; // Only traverse declaration-specifier-seq and declarator, but not body if (PTree::first(def)) PTree::first(def)->accept(this); PTree::second(def)->accept(this); declaration_ = 0; } void ASGTranslator::visit(PTree::ClassSpec *class_spec) { Trace trace("ASGTranslator::visit(PTree::ClassSpec *)", Trace::TRANSLATION); bool visible = update_position(class_spec); size_t size = PTree::length(class_spec); if (size == 2) // forward declaration ? { // [ class|struct ] PTree::Encoding t = class_spec->encoded_name(); try { ASG::TypeId tt = lookup(t); // The type is known, thus nothing to do. Move on. return; } catch (UnknownSymbol const &e) {} std::string type = PTree::reify(PTree::first(class_spec)); std::string name = PTree::reify(PTree::second(class_spec)); ScopedName sname(name); ASG::Forward forward = asg_kit_.create_forward(file_, lineno_, type, sname); add_comments(forward, class_spec->get_comments()); if (visible) { declare(forward); declare_type(sname, forward); } else declare_type(sname); defines_class_or_enum_ = true; return; } std::string type = PTree::reify(PTree::first(class_spec)); std::string name; PTree::ClassBody *body = 0; if (size == 4) // struct definition { // [ class|struct [{ body }] ] name = PTree::reify(PTree::second(class_spec)); body = static_cast(PTree::nth(class_spec, 3)); } else if (size == 3) // anonymous struct definition { // [ struct [nil nil] [{ ... }] ] PTree::Encoding ename = class_spec->encoded_name(); size_t length = (ename.front() - 0x80); name = std::string(ename.begin() + 1, ename.begin() + 1 + length); body = static_cast(PTree::nth(class_spec, 2)); } ScopedName sname(name); ASG::Class class_ = asg_kit_.create_class(file_, lineno_, type, sname); add_comments(class_, class_spec->get_comments()); if (visible) { declare(class_); declare_type(sname, class_); } else declare_type(sname); scope_.push(class_); defines_class_or_enum_ = false; body->accept(this); scope_.pop(); defines_class_or_enum_ = true; } void ASGTranslator::visit(PTree::EnumSpec *enum_spec) { Trace trace("ASGTranslator::visit(PTree::EnumSpec *)", Trace::TRANSLATION); bool visible = update_position(enum_spec); std::string name; if (!PTree::second(enum_spec)) //anonymous { PTree::Encoding ename = enum_spec->encoded_name(); size_t length = (ename.front() - 0x80); name = std::string(ename.begin() + 1, ename.begin() + 1 + length); } else name = PTree::reify(PTree::second(enum_spec)); ASG::Enumerators enumerators; PTree::Node *enode = PTree::second(PTree::third(enum_spec)); PTree::Encoding t = enum_spec->encoded_name(); try { ASG::TypeId tt = lookup(t); // The type is known. If we find a body, this is a parse error: // if (enode) // throw std::runtime_error("redefinition of 'enum " + name + "'"); // Else it may be an elaborate specifier, or a forward declaration. // Nothing to do. Move on. return; } catch (UnknownSymbol const &e) {} ASG::Enumerator enumerator; while (enode) { // quite a costly way to update the line number... update_position(enode); PTree::Node *penumor = PTree::first(enode); if (penumor->is_atom()) { // Just a name ScopedName sname(PTree::reify(penumor)); enumerator = asg_kit_.create_enumerator(file_, lineno_, sname, ""); add_comments(enumerator, static_cast(penumor)->get_comments()); } else { // Name = Value ScopedName sname(PTree::reify(PTree::first(penumor))); std::string value; if (PTree::length(penumor) == 3) value = PTree::reify(PTree::third(penumor)); enumerator = asg_kit_.create_enumerator(file_, lineno_, sname, value); add_comments(enumerator, static_cast(PTree::first(penumor))->get_comments()); } enumerators.append(enumerator); enode = PTree::rest(enode); // Skip comma if (enode && enode->car() && *enode->car() == ',') enode = PTree::rest(enode); } // Add a dummy enumerator at the end to absorb trailing comments. PTree::Node *close = PTree::third(PTree::third(enum_spec)); ASG::Builtin eos = asg_kit_.create_builtin(file_, lineno_, "EOS", sname(std::string("EOS"))); add_comments(eos, static_cast(close)->get_comments()); enumerators.append(eos); // Create ASG.Enum object ASG::Enum enum_ = asg_kit_.create_enum(file_, lineno_, name, enumerators); if (visible) { declare(enum_); declare_type(ScopedName(name), enum_); } else declare_type(ScopedName(name)); defines_class_or_enum_ = true; } void ASGTranslator::visit(PTree::Typedef *typed) { Trace trace("ASGTranslator::visit(PTree::Typedef *)", Trace::TRANSLATION); defines_class_or_enum_ = false; bool visible = update_position(typed); // the second child node may be an inlined class spec, i.e. // typedef struct {...} type; PTree::second(typed)->accept(this); for (PTree::Node *d = PTree::third(typed); d; d = PTree::tail(d, 2)) { if(PTree::type_of(d->car()) != Token::ntDeclarator) // is this check necessary continue; PTree::Declarator *declarator = static_cast(d->car()); PTree::Encoding name = declarator->encoded_name(); PTree::Encoding type = declarator->encoded_type(); trace << "declare type " << name << " (" << type << ')' << raw_filename_ << ':' << lineno_; assert(name.is_simple_name()); size_t length = (name.front() - 0x80); ScopedName sname(std::string(name.begin() + 1, name.begin() + 1 + length)); ASG::TypeId alias = lookup(type); ASG::Declaration declaration = asg_kit_.create_typedef(file_, lineno_, "typedef", sname, alias, defines_class_or_enum_); add_comments(declaration, declarator->get_comments()); if (visible) { declare(declaration); declare_type(sname, declaration); } else declare_type(sname); } defines_class_or_enum_ = false; } void ASGTranslator::translate_parameters(PTree::Node *node, ASG::TypeIdList types, ASG::Function::Parameters ¶meters) { Trace trace("ASGTranslator::translate_parameters", Trace::TRANSLATION); if (PTree::length(node) == 1 && *node->car() == "void") return; while (node) { // A parameter has a type, possibly a name and possibly a value. // Treat the value as a string, i.e. don't analyse the expression further. std::string name, value; ASG::Modifiers premods, postmods; if (*node->car() == ',') node = node->cdr(); PTree::Node *parameter = PTree::first(node); ASG::TypeId type = types.get(0); types.del(0); // pop one value if (PTree::length(parameter) == 3) { PTree::Declarator *decl = static_cast(PTree::nth(parameter, 2)); name = PTree::reify(decl->name()); value = PTree::reify(decl->initializer()); // Skip keywords (eg: register) which are Leaves PTree::Node *atom = PTree::nth(parameter, 0); if (atom) premods.append(PTree::reify(atom)); } ASG::Parameter p = asg_kit_.create_parameter(premods, type, postmods, name, value); parameters.append(p); node = PTree::rest(node); } } void ASGTranslator::add_comments(ASG::Declaration declarator, PTree::Node *c) { Trace trace("ASGTranslator::add_comments", Trace::TRANSLATION); if (!declarator || !c) return; Python::List comments; // Loop over all comments in the list // If the last comment is separated from the declaration by more than a single '\n', // we add a None to the list. bool suspect = false; for (PTree::Node *next = PTree::rest(c); c && !c->is_atom(); next = PTree::rest(c)) { PTree::Node *first = PTree::first(c); if (!first || !first->is_atom()) { c = next; continue; } // Check if comment is continued, eg: consecutive C++ comments while (next && PTree::first(next) && PTree::first(next)->is_atom()) { if (!strncmp(first->position() + first->length() - 2, "*/", 2)) break; if (strncmp(PTree::first(next)->position(), "//", 2)) break; char const *next_pos = PTree::first(next)->position(); char const *start_pos = PTree::first(c)->position(); char const *curr_pos = start_pos + PTree::first(c)->length(); // Must only be whitespace between current comment and next // and only one newline int newlines = 0; while (curr_pos < next_pos && strchr(" \t\r\n", *curr_pos)) if (*curr_pos == '\n' && newlines > 0) break; else if (*curr_pos++ == '\n') ++newlines; if (curr_pos < next_pos) break; // Current comment stretches to end of next int len = int(next_pos - start_pos + PTree::first(next)->length()); c->set_car(first = new PTree::Atom(start_pos, len)); // Skip the combined comment next = PTree::rest(next); } suspect = false; char const *pos = first->position() + first->length(); while (*pos && strchr(" \t\r", *pos)) ++pos; if (*pos == '\n') { ++pos; // Found only allowed \n while (*pos && strchr(" \t\r", *pos)) ++pos; if (*pos == '\n' || !strncmp(pos, "/*", 2)) suspect = true; } Python::Object comment = PTree::reify(first); comments.append(comment); // if (links_) links_->long_span(first, "file-comment"); // Set first to 0 so we dont accidentally do them twice (eg: // when parsing expressions) c->set_car(0); c = next; } if (suspect) comments.append(Python::Object()); declarator.annotations().set("comments", comments); } bool ASGTranslator::update_position(PTree::Node *node) { Trace trace("ASGTranslator::update_position", Trace::TRANSLATION); std::string filename; lineno_ = buffer_->origin(node->begin(), filename); if (filename != raw_filename_) { if (primary_file_only_) // raw_filename_ remains the primary file's name // and all declarations from elsewhere are ignored return false; raw_filename_ = filename; // determine canonical filenames Path path = Path(filename).abs(); std::string long_filename = path.str(); path.strip(base_path_); std::string short_filename = path.str(); SourceFile file = files_.get(short_filename); if (file) file_ = file; else { file_ = sf_kit_.create_source_file(short_filename, long_filename); files_.set(short_filename, file_); } } return true; } ASG::TypeId ASGTranslator::lookup(PTree::Encoding const &name) { Trace trace("ASGTranslator::lookup", Trace::SYMBOLLOOKUP); trace << name; name_ = name; ASG::TypeId type; decode_type(name.begin(), type); return type; } ASG::TypeId ASGTranslator::lookup_function_types(PTree::Encoding const &name, ASG::TypeIdList ¶meters) { Trace trace("ASGTranslator::lookup_function_types", Trace::SYMBOLLOOKUP); trace << name; name_ = name; PTree::Encoding::iterator i = name.begin(); assert(*i == 'F'); ++i; while (true) { ASG::TypeId parameter; i = decode_type(i, parameter); if (parameter) parameters.append(parameter); else break; } ++i; // skip over '_' ASG::TypeId return_type; i = decode_type(i, return_type); return return_type; } void ASGTranslator::declare(ASG::Declaration declaration) { if (scope_.size()) scope_.top().declarations().append(declaration); else declarations_.append(declaration); file_.declarations().append(declaration); } ASG::TypeId ASGTranslator::declare_type(ScopedName name, ASG::Declaration declaration) { Trace trace("ASGTranslator::declare_type", Trace::SYMBOLLOOKUP); trace << name; ASG::TypeId type = asg_kit_.create_declared_type_id(name, declaration); types_.set(qname(name), type); return type; } ASG::TypeId ASGTranslator::declare_type(ScopedName name) { Trace trace("ASGTranslator::declare_type(unknown)", Trace::SYMBOLLOOKUP); trace << name; ASG::TypeId type = asg_kit_.create_unknown_type_id(name); types_.set(qname(name), type); return type; } // This is almost a verbatim copy of the Decoder::decode // methods from Synopsis/Parsers/Cxx/syn/decoder.cc // with some minor modifications to disable the C++ specific things. // FIXME: this ought to be part of SymbolLookup::Type. PTree::Encoding::iterator ASGTranslator::decode_name(PTree::Encoding::iterator i, std::string &name) { Trace trace("ASGTranslator::decode_name", Trace::PARSING); size_t length = *i++ - 0x80; name = std::string(length, '\0'); std::copy(i, i + length, name.begin()); i += length; return i; } PTree::Encoding::iterator ASGTranslator::decode_type(PTree::Encoding::iterator i, ASG::TypeId &type) { Trace trace("ASGTranslator::decode_type", Trace::PARSING); ASG::Modifiers premod, postmod; std::string name; ASG::TypeId base; // Loop forever until broken while (i != name_.end() && !name.length() && !base) { int c = *i++; switch (c) { case 'P': postmod.insert(0, "*"); break; // case 'R': // postmod.insert(0, "&"); // break; case 'S': premod.append("signed"); break; case 'U': premod.append("unsigned"); break; case 'C': premod.append("const"); break; case 'V': premod.append("volatile"); break; case 'A': { std::string array("["); while (*i != '_') array.push_back(*i++); array.push_back(']'); ++i; postmod.append(array); break; } // case '*': // { // ScopedName n; // n.push_back("*"); // base = new Types::Dependent(n); // break; // } case 'i': name = "int"; break; case 'v': name = "void"; break; // case 'b': // name = "bool"; // break; case 's': name = "short"; break; case 'c': name = "char"; break; // case 'w': // name = "wchar_t"; // break; case 'l': name = "long"; break; case 'j': name = "long long"; break; case 'f': name = "float"; break; case 'd': name = "double"; break; case 'r': name = "long double"; break; case 'e': name = "..."; break; case '?': name = "int"; // in C, no return type spec defaults to int break; // case 'Q': // base = decodeQualType(); // break; case '_': --i; type = ASG::TypeId(); return i; // end of func params case 'F': i = decode_func_ptr(i, base, postmod); break; // case 'T': // base = decodeTemplate(); // break; // case 'M': // // Pointer to member. Format is same as for named types // name = decodeName() + "::*"; // break; default: if (c > 0x80) { --i; i = decode_name(i, name); break; } // FIXME // std::cerr << "\nUnknown char decoding '"< 0 && postmod.get(0) == "*") { premod.append(postmod.get(0)); postmod.erase(postmod.begin()); } ASG::TypeIdList parameters; while (true) { ASG::TypeId parameter; i = decode_type(i, parameter); if (parameter) parameters.append(parameter); else break; } ++i; // skip over '_' i = decode_type(i, type); type = asg_kit_.create_function_type_id(type, premod, parameters); return i; } synopsis-0.12/Synopsis/Parsers/C/synopsis.py.in0000664000076400007640000000127611104703264021161 0ustar stefanstefan#! /usr/bin/env python from Synopsis import config from Synopsis.process import process from Synopsis.Processor import * from Synopsis.Processors import * from Synopsis.Parsers import Cxx from distutils import sysconfig import sys, os.path topdir = '@topdir@' srcdir = '@srcdir@' cppflags = ['-I.', '-I%s'%(topdir + '/Cxx-API/include'), '-I%s'%(srcdir), '-I%s'%(sysconfig.get_python_inc())] cxx = Cxx.Parser(base_path = topdir + '/', cppflags = cppflags, syntax_prefix = 'links', xref_prefix = 'xref') link = Linker(Comments.Translator(filter = Comments.SSDFilter())) process(cxx = cxx, link = link) synopsis-0.12/Synopsis/Parsers/C/Makefile.in0000664000076400007640000000214311104703264020352 0ustar stefanstefan# # Copyright (C) 2005 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # SHELL := /bin/sh srcdir := @srcdir@ builddir:= @builddir@ PYTHON := @PYTHON@ SYNOPSIS:= $(PYTHON) synopsis.py CXX := @CXX@ LDSHARED:= @LDSHARED@ MAKEDEP := $(CXX) -M CPPFLAGS:= @CPPFLAGS@ -I . CPPFLAGS+= -I $(srcdir) CPPFLAGS+= @SYN_CPP@ -I @PYTHON_INCLUDE@ CXXFLAGS:= @CXXFLAGS@ LDFLAGS := @LDFLAGS@ LIBS := @SYN_LIBS@ @LIBS@ LIBRARY_EXT := @LIBEXT@ SRC := ASGTranslator.cc ParserImpl.cc OBJ := $(patsubst %.cc, %.o, $(SRC)) DEP := $(patsubst %.cc, %.d, $(SRC)) TARGET := ParserImpl$(LIBRARY_EXT) vpath %.hh $(srcdir) vpath %.cc $(srcdir) all: $(TARGET) $(TARGET): $(OBJ) $(LDSHARED) $(LDFLAGS) -o $@ $^ $(LIBS) clean: rm -f $(CTOOL_SO) rm -rf $(OBJ) $(DEP) %.o: %.cc $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< %.d: %.cc $(SHELL) -ec '$(MAKEDEP) $(CPPFLAGS) $< | sed "s/$*\\.o[ :]*/$*\\.d $*\\.o : /g" > $@' Makefile: $(srcdir)/Makefile.in ./config.status --file Makefile ifeq (,$(filter $(MAKECMDGOALS), clean)) -include $(DEP) endif synopsis-0.12/Synopsis/Parsers/C/configure.ac0000664000076400007640000000156411104703264020601 0ustar stefanstefandnl dnl Copyright (C) 2004 Stefan Seefeld dnl All rights reserved. dnl Licensed to the public under the terms of the GNU LGPL (>= 2), dnl see the file COPYING for details. dnl dnl ------------------------------------------------------------------ dnl Autoconf initialization dnl ------------------------------------------------------------------ AC_PREREQ(2.56) AC_REVISION($Revision: 1.4 $) AC_INIT(Synopsis, 1.0, synopsis-devel@fresco.org) AC_ARG_WITH(syn-cxx, [ --with-syn-cxx=PATH specify the Synopsis C++ library prefix], SYN_CXX="$with_syn_cxx", SYN_CXX="/usr/local" ) AC_PROG_CPP AC_PROG_CC AC_PROG_CXX SYN_CPP="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --cflags synopsis-uninstalled`" SYN_LIBS="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --libs synopsis-uninstalled`" AC_SUBST(SYN_CPP) AC_SUBST(SYN_LIBS) AC_PYTHON_EXT AC_CONFIG_FILES([Makefile synopsis.py]) AC_OUTPUT synopsis-0.12/Synopsis/Parsers/C/aclocal.m40000664000076400007640000000120311171624010020134 0ustar stefanstefan# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_include([../../../config/python_ext.m4]) synopsis-0.12/Synopsis/Parsers/__init__.py0000664000076400007640000000043011104703261020226 0ustar stefanstefan"""Package for all source parsers. Each parser is in its own sub-package. Only the C++ parser is written in C++, the rest use Python. The IDL parser uses the IDL compiler from omniORB, directly importing its parsing modules. """ # this file is intentionally left empty # -stefan synopsis-0.12/Synopsis/Parsers/Cpp/0000775000076400007640000000000011172123232016641 5ustar stefanstefansynopsis-0.12/Synopsis/Parsers/Cpp/__init__.py0000664000076400007640000000452711164216275020775 0ustar stefanstefan# # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # """Preprocessor for C, C++, IDL""" from Synopsis.Processor import * from Emulator import get_compiler_info from ParserImpl import parse import os.path class Parser(Processor): emulate_compiler = Parameter('', 'a compiler to emulate') compiler_flags = Parameter([], 'list of flags for the emulated compiler') flags = Parameter([], 'list of preprocessor flags such as -I or -D') primary_file_only = Parameter(True, 'should only primary file be processed') cpp_output = Parameter(None, 'filename for preprocessed file') base_path = Parameter(None, 'path prefix to strip off of the filenames') language = Parameter('C++', 'source code programming language of the given input file') def probe(self, **kwds): self.set_parameters(kwds) if type(self.compiler_flags) != list: raise InvalidArgument('compiler_flags=%s (expected list)'%repr(self.compiler_flags)) return get_compiler_info(self.language, self.emulate_compiler, self.compiler_flags) def process(self, ir, **kwds): self.set_parameters(kwds) if not self.input: raise MissingArgument('input') self.ir = ir system_flags = [] # Accept either a string or a list. flags = type(self.flags) is str and self.flags.split() or self.flags base_path = self.base_path and os.path.abspath(self.base_path) + os.sep or '' info = get_compiler_info(self.language, self.emulate_compiler, self.compiler_flags) system_flags += ['-I%s'%x for x in info.include_paths] system_flags += ['-D%s'%k + (v and '=%s'%v or '') for (k,v) in info.macros] for file in self.input: self.ir = parse(self.ir, os.path.abspath(file), base_path, self.cpp_output, self.language, system_flags, flags, self.primary_file_only, self.verbose, self.debug, self.profile) return self.output_and_return_ir() synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/0000775000076400007640000000000011172123232017610 5ustar stefanstefansynopsis-0.12/Synopsis/Parsers/Cpp/ucpp/ucpp.10000664000076400007640000001025311163213136020645 0ustar stefanstefan.TH UCPP 1 "Oct 21 2000" .SH NAME ucpp \- C preprocessor .SH SYNOPSIS .B ucpp [ .I options ] [ .I file ] .SH DESCRIPTION .LP .B ucpp is a C preprocessor mostly compatible with ISO-C99. It is rather strict and uses only a small amount of memory. It uses standard input as primary input if no file argument is given. .SH OPTIONS There are several classes of options. .TP .B Language Options .TP .BI \-C keep comments in the output. .TP .BI \-s if a rogue '#' is encountered, do not emit an error and keep it in the output. .TP .BI \-l supress the emission of '#line' directives in the output. .TP .BI \-lg convert the '#line' to the gcc-style equivalent. .TP .BI \-CC disable C++-like comments (a '//' begins a comment, up to the end of the line). Use this option to get closer to C90 behaviour. .TP .B \-a, \-na handle assertions (defined with #assert); .B \-a also defines the standard assertions .I #machine , .I #cpu and .I #system (see .B \-e to get the local definition of such assertions). .TP .BI \-a0 disable assertion support. .TP .BI \-V disable support for macros with a variable number of arguments: in C99, a macro may be declared with .I ... as the last argument; inside the replacement list, .I __VA_ARGS__ is replaced with the optional extra arguments given in the call to the macro. Use this option to get closer to C90 behaviour. .TP .BI \-u enable UTF-8 support: with this option, the source is considered as an ISO/10646 source, encoded in UTF-8. Characters represented as two bytes or more are considered as alphabetic characters, like letters, and therefore usable in identifiers. These characters hold the same syntactic value than the corresponding Universal Character Names. .TP .BI \-X enable .B \-a, \-u and .B \-Y. This should make .B ucpp behave closer to what is requested from a "modern" C preprocessor. .TP .BI \-c90 enable .B \-V and .B \-CC, and do not define .B __STDC_VERSION__. This should make .B ucpp mimic older C90 behaviour. .TP .BI \-t disable trigraph support; this seems to be required for some legacy code. .TP .B Warning Options .TP .BI \-wt emit a final warning when trigraphs are encountered. .TP .BI \-wtt emit warnings for each trigraph encountered. .TP .BI \-wa emit annoying warnings (these are usually useless). .TP .BI \-w0 supress standard warnings. .TP .B Directory Options .TP .BI \-I directory .TP .BI "\-I " directory add .I directory to the include path, before the standard include path. .TP .BI \-J directory .TP .BI "\-J " directory add .I directory to the include path, after the standard include path. .TP .BI \-zI do not use the standard (compile-time) include path. .TP .BI \-M emit only the names of encountered files, separated by spaces; this is intended for automatic generation of Makefile dependencies. .TP .BI \-Ma do the same as .B \-M but also for system files. .TP .BI "\-o " file direct the ouput to .I file instead of standard output. .TP .B Macro Options .TP .BI \-D macro predefine .I macro with content .B 1. .TP .BI \-D macro=def predefine .I macro with the content .I def. .TP .BI \-U macro undefine .I macro. .TP .BI \-Y predefine system-dependant macros. .TP .BI \-Z do not predefine special macros such as .B __TIME__. .TP .BI \-A foo(bar) add .I foo(bar) to the list of assertions. .TP .BI \-B foo(bar) remove .I foo(bar) of the list of assertions; you may also use .BI \-B foo to remove all .BI \-B foo(xxx) from the list of assertions. .TP .BI \-d instead of normal output, emit '#define' directives representing all macros defined during processing. .TP .BI \-e instead of normal output, emit '#assert' directives representing all assertions defined during processing. .TP .B Miscellaneous Options .TP .BI \-v print version number, include path and (optionaly) defined assertions. .TP .BI \-h print some help. .SH ENVIRONMENT .PP .B ucpp is not itself affected by environment variables. However, it uses library functions that might be affected, depending on the system. .SH AUTHOR Thomas Pornin .SH BUGS .PP .B ucpp is considered stable software. However improbable it is, please report bugs to the author (possibly with a file that exhibits the problem) if the latest version, available from this site: .TP http://pornin.nerim.net/ucpp/ .PP has the bug. synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/README0000664000076400007640000011301311163213164020473 0ustar stefanstefanucpp-1.3 is a C preprocessor compliant to ISO-C99. Author: Thomas Pornin Main site: http://pornin.nerim.net/ucpp/ INTRODUCTION ------------ A C preprocessor is a part of a C compiler responsible for macro replacement, conditional compilation and inclusion of header files. It is often found as a stand-alone program on Unix systems. ucpp is such a preprocessor; it is designed to be quick and light, but anyway fully compliant to the ISO standard 9899:1999, also known as C99. ucpp can be compiled as a stand-alone program, or linked to some other code; in the latter case, ucpp will output tokens, one at a time, on demand, as an integrated lexer. ucpp operates in two modes: -- lexer mode: ucpp is linked to some other code and outputs a stream of tokens (each call to the lex() function will yield one token) -- non-lexer mode: ucpp preprocesses text and outputs the resulting text to a file descriptor; if linked to some other code, the cpp() function must be called repeatedly, otherwise ucpp is a stand-alone binary. INSTALLATION ------------ 1. Uncompress the archive file and extract the source files. 2. Edit tune.h. Here is a short explanation of compile-time options: LOW_MEM Enable memory-saving functions; this is for low-end and old systems, but seems to be good for larger systems too. Keep it. NO_LIBC_BUF NO_UCPP_BUF Two options used to disable the two bufferings inside ucpp. Define both options for maximum memory savings but you will probably want to keep libc buffering for decent performance. Define none on large systems (modern 32 or 64-bit systems). UCPP_MMAP With this option, if ucpp internal buffering is active, ucpp will try to mmap() the input files. This might yield a slight performance improvement, but will work only on a limited set of architectures. PRAGMA_TOKENIZE Make ucpp generate tokenized PRAGMA tokens on #pragma and _Pragma(); tokenization is made this way: tokens are assembled as a null terminated array of unsigned chars; if a token has a string value (as defined by the STRING_TOKEN macro), the value follows the token, terminated by PRAGMA_TOKEN_END (by default, a newline character cast to unsigned char). Whitespace tokens are skipped. The "name" value of the PRAGMA token is a pointer to that array. This setting is irrelevant in non-lexer mode. PRAGMA_DUMP In non-lexer mode, keep #pragma in output; non-void _Pragma() are translated to the equivalent #pragma. Irrelevant in lexer mode. NO_PRAGMA_IN_DIRECTIVE Do not evaluate _Pragma() inside #if, #include, #include_next and #line directives; instead, emit an error (since the remaining _Pragma will surely imply a syntax error). DSHARP_TOKEN_MERGE When two tokens are to be merged with the `##' operator, but fail because they do not merge into a single valid token, ucpp keeps those two tokens separate by adding an extra space between them in text output. With this option on, that extra space is not added, which means that some tokens may merge partially if the text output is preprocessed again. See tune.h for details. INMACRO_FLAG In lexer mode, set the inmacro flag to 1 if the current token comes from a macro replacement, 0 otherwise. macro_count maintains an increasing counter of such replacements. CONTEXT tokens count as one macro replacement each. #pragma, and _Pragma() that do not come from a macro replacement, also count as one macro replacement each. This setting is irrelevant in non-lexer mode. STD_INCLUDE_PATH Default include path in stand-alone ucpp. STD_MACROS Default predefined macros in stand-alone ucpp. STD_ASSERT Default assertions in stand-alone ucpp. NATIVE_SIGNED NATIVE_UNSIGNED NATIVE_UNSIGNED_BITS NATIVE_SIGNED_MIN NATIVE_SIGNED_MAX SIMUL_ARITH_SUBTYPE SIMUL_SUBTYPE_BITS SIMUL_NUMBITS WCHAR_SIGNEDNESS Those options define how #if expressions are evaluated; see the cross-compilation section of this file for more info, and the comments in tune.h. Extra info is found in arith.h and arith.c, at the possible expense of your mental health. DEFAULT_LEXER_FLAGS DEFAULT_CPP_FLAGS Default flags in respectively lexer and non-lexer modes. POSIX_JMP Define this if your architecture defines sigsetjmp() and siglongjmp(); it is known to (very slightly) improve performance on AIX systems. MAX_CHAR_VAL ucpp will consider characters whose value is equal or above MAX_CHAR_VAL as outside the C source charset (so they will be treated just like '@', for instance). For ASCII systems, 128 is fine. 256 is a safer value, but uses more (static) memory. For performance reasons, use a power of two. If MAX_CHAR_VAL is correctly adjusted, ucpp should be compatible with any character set. UNBREAKABLE_SPACE If you want an extra-whitespace character, define this macro to that character. For instance, define this to 160 on an ISO-8859-1 system if you want the 'unbreakable space' to be considered as whitespace. SEMPER_FIDELIS With this option set, ucpp, when used as a lexer, will pass whitespace tokens to its caller, and those tokens will have their true content; this is intended for reconstruction of the source line. Beware that some comments may have embedded newlines. COPY_LINE_LENGTH ucpp can maintain a copy of the current source line, up to that length. Irrelevant to stand-alone version. *_MEMG Those settings modify ucpp behaviour, wrt memory allocations. With higher values, ucpp will perform less malloc() calls and will run faster, but it will use more memory. Reduce INPUT_BUF_MEMG and OUTPUT_BUF_MEMG on low-memory systems, if you kept ucpp buffering (see NO_UCPP_BUF option). 3. Edit the Makefile. You should define the variables CC and FLAGS; there are the following options: -DAUDIT Enable internal sanity checks; this slows down a bit ucpp. Do not define unless you plan to debug ucpp. -DMEM_CHECK With this setting, ucpp will check for the return value of malloc() and exit with a diagnostic when out of memory. MEM_CHECK is implied by AUDIT. -DMEM_DEBUG Enable memory debug code. This will track memory leaks and several occurrences of memory management errors; it will also slow down things and increase memory consumption, so you probably do not want to use this option. -DINLINE=foobar The ucpp code uses "inline" qualifier for some functions; by default, that qualifier is macro-replaced with nothing. Define INLINE to the correct replacement for your compiler, if supported. Note that all "inline" functions in ucpp are also "static". For any C99-compliant compiler, the GNU compiler (gcc), and the Compaq C compiler under Linux/Alpha, no -DINLINE is needed (see tune.h for details). 4. Compile by typing "make". This should produce the ucpp executable file. You might see some warning messages, especially with gcc: gcc believes some variables might be used prior to their initialization; ignore those messages. 5. Install wherever you want the binary and the man page ucpp.1. I have not provided an install sequence because I didn't bother. 6. If you do not have the make utility, compile each file separately and link them together. The exact details depend on your compiler. You must define the macro STAND_ALONE when compiling cpp.c (there is such a definition, commented out, in cpp.c, line 34). There is no "configure" script because: -- I do not like the very idea of a "configure" script. -- ucpp is written in ANSI-C and should be fairly portable. -- There is no such thing as "standard" settings for a C preprocessor. The predefined system macros, standard assertions,... must be tuned by the sysadmin. -- The primary goal of ucpp is to be included in compilers. The stand-alone version is mainly a debugging tool. Please note that you need an ISO-C90 (formerly ANSI) C compiler suite (including the standard library) to compile ucpp. If your compiler is not C99 (or later), read the cross-compilation section in this README file. The C90 and C99 standards state that external linkage names might be considered equal or different based upon only their first 6 characters; this rule might make ucpp not compile on a conformant C implementation. I have yet to see such an implementation, however. If you want to use ucpp as an integrated preprocessor and lexer, see the section REUSE. Compiling ucpp as a library is an exercise left to the reader. With the LOW_MEM code enabled, ucpp can run on a Minix-i86 or Msdos 16-bit small-memory-model machine. It will not be fully compliant on such an architecture to C99, since C99 states that at least one source code with 4095 simultaneously defined macros must be processed; ucpp will be limited to about 1500 macros (at most) due to memory restrictions. At least ucpp can preprocess its own code in these conditions. LOW_MEM is on by default because it seems to improve performance on large systems. LICENSE ------- The copyright notice and license is at the beginning of the Makefile and each source file. It is basically a BSD license, without the advertising subclause (which BSD dropped recently anyway) and with no reference to Berkeley (since the code is all mine, written from scratch). Informally, this means that you can reuse and redistribute the code as you want, provided that you state in the documentation (or any substantial part of the software) of redistributed code that I am the original author. (If you press a cdrom with 200 software packages, I do not insist on having my name on the cover of the cdrom -- just keep a Readme file somewhere on the cdrom, with the copyright notice included.) As a courteous gesture, if you reuse my code, please drop me a mail. It raises my self-esteem. REUSE ----- The code has been thought as part of a bigger project; it might be used as an integrated lexer, that will read files, process them as a C preprocessor, and output a stream of C tokens. To include this code into a project, compile with STAND_ALONE undefined. To use the preprocessor and lexer, several steps should be performed. See the file 'sample.c' for an example. 1. call init_cpp(). This function initializes the lexer automaton. 2. set the following global variables: no_special_macros non-zero if the special macros (__FILE__ and others) should not be defined. This is a global flag since it affects the redefinition of such macros (which are allowed if the special macros are not defined) c99_compliant if non-zero, define __STDC_VERSION__ to 199901L; this is the default; otherwise, do not define __STDC_VERSION__. Note that ucpp will accept to undefine __STDC_VERSION__ with a #undef directive. c99_hosted if strictly positive, define __STDC_HOSTED__ to 1. If zero, define __STDC_HOSTED__ to 0. If negative, do not define __STDC_HOSTED__. The default is 1. emit_defines and emit_assertions should be set to 0 for the step 3. 3. call init_tables(). This function initializes the macro table and other things; it will intialize assertions if it has a non-zero argument. 4. call init_include_path(). This function will reset the include path to the list of paths given as argument. 5. set the following global variables emit_dependencies set to 1 if dependencies should be emitted during preprocessing set to 2 if dependencies should also be emitted for system include files emit_defines set to non-zero if #define macro definitions should be emitted when macros are defined emit_assertions set to non-zero if #define macro definitions should be emitted when macros are defined emit_output the FILE * where the above items are sent if one of the three emit_ variables is set to non zero transient_characters this is for some cross-compilation; see the relevant part in this README file for details 6. call set_init_filename() with the initial filename as argument; the second argument indicates whether the filename is real or conventional ("real" means "an fopen() on it will work"). 7. initialize your struct lexer_state: call init_lexer_state() call init_lexer_mode() if the preprocessor is supposed to output a list of tokens, otherwise set the flags field to DEFAULT_CPP_FLAGS and set the output field to the FILE * where output should be sent (init_lexer_mode(), if called at all, must be called after init_lexer_state()) adjust the flags field; here is the meaning of flags: WARN_STANDARD emit the standard warnings WARN_ANNOYING emit the useless and annoying warnings WARN_TRIGRAPHS count trigraphs encountered; it is up to the caller to emit a warning if some trigraphs were indeed encountered; the count is stored in the count_trigraphs field of the struct lexer_state WARN_TRIGRAPHS_MORE emit a warning for each trigraph encountered WARN_PRAGMA emit a warning for each non-void _Pragma encountered in non-lexer mode (because these are dumped as #pragma in the output) and for each #pragma too, if ucpp was compiled without PRAGMA_DUMP FAIL_SHARP emit errors on '#' tokens beginning a line and not followed by a valid cpp directive CCHARSET emit errors when non-C characters are encountered; if this flag is not set, each non-C character will be considered as a BUNCH token (since C99 states that non-C characters are allowed as long as they "disappear" during preprocessing [through macro replacement and stringification for instance], this flag must not be set, for maximum C99 compliance) DISCARD_COMMENTS do not keep comments in output (irrelevant in lexer mode) CPLUSPLUS_COMMENTS understand new style comments (//) (mandatory for C99) LINE_NUM emit #line directives when entering a file, if not in lexer mode; emit CONTEXT token in lexer mode for #line and new files GCC_LINE_NUM if LINE_NUM is set, emit gcc-like directives instead of #line HANDLE_ASSERTIONS understand assertions in #if expressions (and #assert, #unassert) HANDLE_PRAGMA make PRAGMA tokens for #pragma; irrelevant in non-lexer mode (handling of some pragmas is required in C99 but is not of the competence of the preprocessor; without this flag, ucpp will ignore the contents of #pragma and _Pragma directives) MACRO_VAARG understand macros with a variable number of arguments (mandatory for C99) UTF8_SOURCE understand UTF-8 encoding: multibyte characters are considered equivalent to letters as far as syntax is concerned (they can be used in identifiers) LEXER act as a lexer, outputting tokens TEXT_OUTPUT this flag should be set to 0 if ucpp works as a lexer, 1 otherwise. It is somehow redundant with the LEXER flag, but the presence of those two different flags is needed in ucpp. KEEP_OUTPUT in non-lexer mode, emit the result of preprocessing COPY_LINE maintain a copy of the last read line in the copy_line field of the struct lexer_state ; see below for how to use this buffer HANDLE_TRIGRAPHS understand trigraphs, such as ??/ for \. This option should be set by default, except for some legacy code. There are other flags, but they are for private usage of ucpp. 8. adjust the input field in the lexer_state to the FILE * from where source file is read. If you use the UCPP_MMAP compile-time option, and your input file is eligible to mmap(), then you can call fopen_mmap_file() to open it, then set_input_file() to set ls->input and some other internal options. Do not call set_input_file() unless you just called fopen_mmap_file() just before on the same file. 9. call add_incpath() to add an include path, define_macro() and undef_macro() to add or remove macros, make_assertion() and destroy_assertion() to add or remove assertions. 10. call enter_file() (this is needed only in non-lexer mode, or if LINE_NUM is set). Afterwards: -- if you are in lexer mode, call lex(); each call will make the ctok field point to the next token. A non-zero return value is an error. lex() skips whitespace tokens. The memory used by the string value of some tokens (identifiers, numbers...) is automatically freed, so copy the contents of each such token if you want to keep it (tokens with a string content are identified by the STRING_TOKEN macro applied to their type). When lex() returned a non-zero value: if it is CPPERR_EOF, then end-of-input was reached. Otherwise, it is a genuine error and ls->ctok is an undefined token; skip it and call lex() again to ignore the error. -- otherwise, call cpp(); each call will analyze one or more tokens (one token if it did find neither a cpp directive nor a macro name). A positive return value is an error. For both functions, if the return value is CPPERR_EOF (which is a strictly positive value), then it means that the end of file was reached. Call check_cpp_errors() after end of file for pending errors (unfinished #if constructions for instance). In non-lexer mode, call flush_output(). In the struct lexer_state, the following fields might be read: line the current input line number oline the current output line number (in non-lexer mode) flags the flags described above count_trigraphs the number of trigraphs encountered inmacro the current token comes from a macro macro_count the current macro counter "flags" is an unsigned long and might be modified; the three others are of long type. To perform another preprocessing: use free_lexer_state() to release memory used by the buffers referenced in lexer_state, and go back to step 2. The different tables (macros, assertions...) should be reset to their respective initial contents. There is also the wipeout() function: when called, it should release (almost) all memory blocks allocated dynamically. After a wipeout(), ucpp should be back to its state at step 2 (init_cpp() initializes only static tables, that are never freed nor modified afterwards). The COPY_LINE buffer: the struct lexer_state contains two interesting fields, copy_line[] and cli. If the COPY_LINE flag is on, each read line is stored in this buffer, up to (at most) COPY_LINE_LENGTH - 1 characters (COPY_LINE_LENGTH is defined in tune.h). The last character of the buffer is always a zero, and if the line was read entirely, it is zero terminated; the trailing newline is not included. The purpose of this buffer is error-reporting. When an error occurs (cpp() returns a strictly positive value, or lex() returns a non-zero value), if your struct lexer_state is called ls, use this code: if (ls.cli != 0) ls.copy_line[ls.cli] = 0; This will add a trailing 0 if the line was not read entirely. ucpp may be configured at runtime to accept alternate characters as possible parts of identifiers. Typical intended usage is for the '$' and '@' characters. The two relevant functions are set_identifier_char() and unset_identifier_char(). When this call is issued: set_identifier_char('$'); then for all the remaining input, the '$' character will be considered as just another letter, as far as identifier tokenizing is concerned. This is for identifiers only; numeric constants are not modified by that setting. This call resets things back: unset_identifier_char('$'); Those two functions modify the static table which is initialized by init_cpp(). You may call init_cpp() at any time to restore the table to its standard state. When using this feature, take care of the following points: -- Do NOT use a character whose numeric value (as an `unsigned char' cast into an `int') is greater than or equal to MAX_CHAR_VAL (in tune.h). This would lead to unpredictable results, including an abrupt crash of ucpp. ucpp makes absolutely no check whatsoever on that matter: this is the programmer's responsibility. -- If you use a standard character such as '+' or '{', tokens which begin with those characters cease to exist. This can be troublesome. If you use set_identifier_char() on the '<' character, the handling of #include directives will be greatly disturbed. Therefore the use of any standard C character in set_identifier_char() of unset_identifier_char() is declared unsupported, forbidden and altogether unwise. -- Stricto sensu, when an extra character is declared as part of an identifier, ucpp behaviour cease to conform to C99, which mandates that characters such as '$' or '@' must be treated as independant tokens of their own. Therefore, if your purpose is to use ucpp in a conformant C implementation, the use of set_identifier_char() should be made at least a runtime option. -- When enabling a new character in the middle of a macro replacement, the effect of that replacement may be delayed up to the end of that macro (but this is a "may" !). If you wish to trigger this feature with a custom #pragma or _Pragma(), you should remember it (for instance, usine _Pragma() in a macro replacement, and then the extra character in the same macro replacement, is not reliable). COMPATIBILITY NOTES ------------------- The C language has a lengthening history. Nowadays, C comes in three flavours: -- Traditional C, aka "K&R". This is the language first described by Brian Kernighan and Dennis Ritchie, and implemented in the first C compiler that was ever coded. There are actually several dialects of K&R, and all of them are considered deprecated. -- ISO 9899:1990, aka C90, aka C89, aka ANSI-C. Formalized by ANSI in 1989 and adopted by ISO the next year, it is the C flavour many C compilers understand. It is mostly backward compatible with K&R C, but with enhancements, clarifications and several new features. -- ISO 9899:1999, aka C99. This is an evolution on C90, almost fully backward compatible with C90. C99 introduces many new and useful features, however, including in the preprocessor. There was also a normative addendum in 1995, that added a few features to C90 (for instance, digraphs) that are also present in C99. It is sometimes refered to as "C95" or "AMD 1". ucpp implements the C99 standard, but can be used in a stricter mode, to enforce C90 compatibility (it will, however, still recognize some constructions that are not in plain C90). ucpp also knows about several extensions to C99: -- Assertions: this is an extension to the defined() operator, with its own namespace. Assertions seem to be used in several places, therefore ucpp knows about them. It is recommended to enable assertions by default on Solaris systems. -- Unicode: the C99 norm specifies that extended characters, from the ISO-10646 charset (aka "unicode") can be used in identifiers with the notations \u and \U. ucpp also accepts (with the proper flag) the UTF-8 encoding in the source file for such characters. -- #include_next directive: it works as a #include, but will look for files only in the directories specified in the include path after the one the current file was found. This is a GNU-ism that is useful for writing transparent wrappers around header files. Assertions and unicode are activated by specific flags; the #include_next support is always active. The ucpp code itself should be compatible with any ISO-C90 compiler. The cpp.c file is rather big (~ 64kB), it might confuse old 16-bit C compilers; the macro.c file is somewhat large also (~ 47kB). The evaluation of #if expressions is subject to some subtleties, see the section "cross-compilation". The lexer code makes no assumption about the source character set, but the following: source characters (those which have a syntactic value in C; comment and string literal contents are not concerned) must have a strictly positive value that is strictly lower than MAX_CHAR_VAL. The strict positivity is already assured by the C standard, so you just need to adjust MAX_CHAR_VAL. ucpp has been tested succesfully on ASCII/ISO-8859-1 and EBCDIC systems. Beware that UTF-8 is NOT compatible with EBCDIC. Pragma handling: when used in non-lexer mode, ucpp tries to output a source text that, when read again, will yield the exact same stream of tokens. This is not completely true with regards to line numbering in some tricky macro replacements, but it should work correctly otherwise, especially with pragma directives if the compile-time option PRAGMA_DUMP was set: #pragma are dumped, non-void _Pragma() are converted to the corresponding #pragma and dumped also. ucpp does not macro-replace the contents of #pragma and _Pragma(); If you want a macro-replaced pragma, use this: #define pragma_(x) _Pragma(#x) #define pragma(x) pragma_(x) Anyway, pragmas do not nest (an _Pragma() cannot be evaluated if it is inside a #pragma or another _Pragma). I wrote ucpp according to what is found in "The C Programming Language" from Brian Kernighan and Dennis Ritchie (2nd edition) and the C99 standard; but I could have misinterpreted some points. On some tricky points I got help from the helpful people from the comp.std.c newsgroup. For assertions and #include_next, I mimicked the behaviour of GNU cpp, as is stated in the GNU cpp info documentation. An open question is related to the following code: #define undefined ! #define makeun(x) un ## x #if makeun(defined foo) qux #else bar #endif ucpp will replace 'defined foo' with 0 first (since foo is not defined), then it will replace the macro makeun, and the expression will become 'un0', which is replaced by 0 since this is a remaining identifier. The expression evaluates to false, and 'bar' is emitted. However, some other preprocessors will replace makeun first, considering that it is not part of a 'defined' operator application; this will produce the macro 'undefined', which is replaced, and the expression becomes '!foo'. 'foo' is replaced by 0, the expression evaluates to true, and 'qux' is emitted. My opinion is that the behaviour is undefined, because use of the 'defined' operator does not match an allowed form prior to macro replacement (I mean, its syntax matches, but its use is reconverted to inexistant and therefore is not anymore matching). Other people think that the behaviour is well-specified, and contrary to what ucpp does. The only thing clear to me is that the wording of the standard (paragraph 6.10.1.3) is unclear. Since the ucpp behaviour makes ucpp code simpler and cleaner, and that it is unlikely that any real-life code would ever be disturbed by that interpretation of the standard, ucpp will keep its current behaviour until convincing evidence of my misinterpretation of the standard is given to me. The problem can only occur if one uses ## to make a 'defined' operator disappear from a #if expression (everybody agrees that the generation of a 'defined' operator triggers undefined behaviour). Another point about macro replacement has been discussed at length in several occasions. It is about the following code: #define CAT(a, b) CAT_(a, b) #define CAT_(a, b) a ## b #define AB(x, y) CAT(x, y) CAT(A, B)(X, Y) ucpp will produce `CAT(X,Y)' as replacement for the last line, whereas some other preprocessors output `XY'. The answer to the question "which behaviour is correct" seems to be "this is not defined by the C standard". It is the answer that has been actually given by the C standardization committee in 1992, to the defect report #017, question 23, which asked that very same question. Since the wording of the standard has not changed in these parts from the 1990 to the 1999 version, the preprocessor behaviour on the above-stated code should still be considered as undefined. It seems, however, that there used to be a time (around 1988) when the committee members agreed upon a precise macro-replacement algorithm, which specified quite clearly the preprocessor behaviour in such situation. ucpp behaviour is occasionnaly claimed as "incorrect" with regards to that algorithm. Since that macro replacement algorithm has never been published, and the committee itself backed out from it in 1992, I decided to disregard those feeble claims. It is possible, however, that at some point in the future I rewrite the ucpp macro replacement code, since that code is a bit messy and might be made to use less memory in some occasions. It is then possible that, in the aftermath of such a rewrite, the ucpp behaviour for the above stated code become tunable. Don't hold your breath, though. About _Pragma: the standard is not clear about when this operator is evaluated, and if it is allowed inside #if directives and such. For ucpp, I coded _Pragma as a special macro with lazy replacement: it will be evaluated wherever a macro could be replaced, and only at the end of the macro replacement (for practical purposes, _Pragma can be considered as a macro taking one argument, and being replaced by nothing, except for some tricky uses of the # and ## operators). This means that, by default, ucpp will evaluate _Pragma inside some directives (mainly, #if, #include, #include_next and #line), but it can be taught not to do so by defining NO_PRAGMA_IN_DIRECTIVE in tune.h. CROSS-COMPILATION ----------------- If compiled with a C99 development suite, ucpp should be fully C99-compliant on the host platform (up to my own understanding of the standard -- remember that this software is distributed as-is, without any guarantee). However, if a pre-C99 compiler is used, or if the target machine is not the host machine (for instance when you build a cross-compiler), the evaluation of #if expressions is subject to some cross-compiling issues: -- character constants: when evaluating expressions, character constants are interpreted in the source character set context; this is allowed by the standard but this can lead to problems with code that expects this interpretation to match the one made in the C code. To ease cross-compilation, you can define a conversion array, and make the global variable transient_characters point to it. The array should contain 256 int; transient_characters[x] is the value of the character whose value is x in the source character set. This facility is provided for inclusion of ucpp inside another code; if you want a stand-alone ucpp with that conversion, hard-code the conversion table into eval.c and make transient_characters[] statically point to it. Alternatively, you could provide an option syntax to provide such a table on command-line, if you feel like it. -- wide character constants signedness: by default, ucpp makes wide characters as signed as what plain chars are on the build host. To force wide character constant signedness, define WCHAR_SIGNEDNESS to 0 (for unsigned) or 1 (for signed). Beware, however, that "native" wide character constants, even signed, are considered positive. Non-wide character constants are, according to the C99 standard, of type int, and therefore always signed. -- evaluation type: C90 states that all constants in #if expressions are considered as either long or unsigned long, and that the evaluation is performed with operands of that size. In C99, the situation is equivalent, except that the types used are intmax_t and uintmax_t, as defined in . ucpp can use two expression evaluators: one uses native integer types (one signed and one unsigned), the other evaluator emulates big integer numbers by representing them with two values of some unsigned type. The emulated type handles signed values in two's complement representation, and can be any width ranging from 2 bits to twice the size of the underlying native unsigned type used. An odd width is allowed. When right shifting an emulated signed negative value, it is left-padded with bits set to 1 (this is sign extension). When the ARITHMETIC_CHECKS macro is defined in tune.h, all occurrences of implementation-defined or undefined behaviour during arithmetic evaluation are reported as errors or warned upon. This includes all overflows and underflows on signed quantities, constants too large, and so on. Errors (which terminate immediately evaluation) are emitted for division by 0 (on / and % operators) and overflow (on / operator); otherwise, warnings are emitted and the faulty evaluation takes place. This prevents ucpp from crashing on typical x86 machines, while still allowing to use some extensions. FUTURE EVOLUTIONS ----------------- ucpp is quite complete now. There was a longstanding project of "traditional" preprocessing, but I dropped it because it would not map cleanly on the token-based ucpp structure. Maybe I will code a string-based preprocessor one day; it would certainly use some of the code from lexer.c, eval.c, mem.c and nhash.c. However, making such a tool is almost irrelevant nowadays. If one wants to handle such project, using ucpp as code base, I would happily provide some help, if needed. CHANGES ------- From 1.2 to 1.3: * brand new integer evaluation code, with precise evaluation and checks * new hash table implementation, with binary trees * relaxed attitude on failed `##' operators * bugfix on macro definition on command-line wrt nesting macros * support for up to 32766 macro arguments in LOW_MEM code * support for optional additional "identifier" characters such as '$' or '@' * bugfix: memory leak on void #assert From 1.1 to 1.2: * bugfix: numerous memory leaks * new function: wipeout(); this should release all malloc() blocks * bugfix: missing "newline" and trailing "context" tokens * improved included files name caching * included memory leak detection code From 1.0 to 1.1: * bugfix: missing newline when exiting from a non-newline-terminated file * bugfix: crash when resetting due to definition of the _Pragma pseudo-macro * bugfix: handling of additional "optional" whitespace with SEMPER_FIDELIS * improved handling of unreplaced arg macros wrt output line * tricky handling of utterly tricky #include * bugfix: spurious token `~=' eliminated From 0.9 to 1.0: * bugfix: crash after erroneous #assert * changed ERR_SHARP to FAIL_SHARP, EMUL_UINTMAX to SIMUL_UINTMAX * made "inline" default on gcc and DEC ccc (Linux/Alpha) * semantic of -I is now Unix-like (added directories are looked first) * added -J flag (to add include directories after the system ones) * cleaned up non-ascii issues * bugfix: missing brace in no-LOW_MEM code * bugfix: argument number check in variadic macros * bugfix: crash in non-lexer mode after some cases of unreplaced macro * bugfix: _Pragma() handling wrt # and ## * made evaluation of _Pragma() optional in #if, #include and #line * bugfix: re-dump of multiline #pragma * added the inmacro and macro_count flags * added mmap() support * added option to retain whitespace content in lexer mode From 0.8 to 0.9: * added check for division by 0 in #if evaluation * added check for non-standard line numbers * added check for trailing garbage in most directives * corrected signedness of char constants (always int, therefore always signed) * made LOW_MEM code, so that ucpp runs smoothly on low memory architectures * multiple bugfixes (using the GNU cpp testsuite) * added handling of _Pragma (as a macro) * added tokenization of pragma directives * added conservation of pragma directives in text output * produced Msdos 16-bit small memory model executable * produced Minix-86 executable From 0.7 to 0.8: * added some support for Amiga systems * fixed extra spacing in stringified tokens * fixed bug related to %:% and tolerated rogue sharps * namespace cleanup * bugfix for macro redefinition * added warning for evaluated comma operators in #if (ISO requirement) * -Dfoo now defines foo with content 1 (and not void content) * trigraphs can be disabled (for incorrect but legacy code) * fixed semantics for #include "file" (local directory) * fixed detection of protected files * produced a Msdos 16-bit executable From 0.6 to 0.7: * officially changed the goal to full C99 compliance * added the CONTEXT token and let NEWLINE tokens go * added report_context() for error reporting * enforced matching of #if/#endif (file-global nesting level = 0) * added support of C99 digraphs * added UTF-8 encoding support * added universal character names * rewrote #if expressions (sizes fixed, bignum, signed/unsigned fixed) * fixed incomplete evaluation of #if expressions * added transient_characters[] From 0.5 to 0.6: * disappearance of error_nonl() * added extra optional warnings for trigraphs * some bugfixes, especially in lexer mode * handled MacIntosh files correctly From 0.4 to 0.5: * nicer #pragma handling (a token can be emitted) * bugfix in lexer mode after #line and #error * sample.c an example of code linked with ucpp * made #if expressions conforming to standard signed/unsigned handling * added the copy_line[] buffer feature From 0.3 to 0.4: * relaxed interpretation of '#include foo' when foo ends up, after macro substitution, with a '' content * corrected the 'double-dot' bug * corrected two bugs related to the treatment of macro aborted calls (due to lack of arguments) * some namespaces cleanup, to ease integration into other code * documented the way to include ucpp into another program * made newlines embedded into strings illegal (and reported as such) From 0.2 to 0.3: * added support for system predefined macros * made several bugfixes * checked C99 compliance for most of the features * ucpp now accepts non-C characters on standard when used stand-alone * removed many useless spaces in the output From 0.1 to 0.2: * added support for assertions * added support for macros with variable arguments * split the pharaonic cpp.c file into many * made several bugfixes * relaxed the behaviour with regards to the void arguments * made C++-like comments an option THANKS TO --------- Volker Barthelmann, Neil Booth, Stephen Davies, Stéphane Ecolivet, Marc Espie, Marcus Holland-Moritz, Antoine Leca, Cyrille Lefevre, Dave Rivers, Loic Tortay and Laurent Wacrenier, for suggestions and beta-testing. Paul Eggert, Douglas A. Gwyn, Clive D.W. Feather, and the other guys from comp.std.c, for explanations about the standard. Dave Brolley, Jamie Lokier and Neil Booth, for discussion about tricky points on nesting macros. Brian Kernighan and Dennis Ritchie, for bringing C to mortal Men. synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/arith.c0000644000076400007640000011354711163214654021105 0ustar stefanstefan/* * Integer arithmetic evaluation. * * (c) Thomas Pornin 2002 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. The name of the authors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #include #include "arith.h" #define ARITH_OCTAL(x) ((x) >= '0' && (x) <= '7') #define ARITH_OVAL(x) ((x) - '0') #define ARITH_DECIM(x) ((x) >= '0' && (x) <= '9') #define ARITH_DVAL(x) ((x) - '0') #define ARITH_HEXAD(x) (ARITH_DECIM(x) \ || (x) == 'a' || (x) == 'A' \ || (x) == 'b' || (x) == 'B' \ || (x) == 'c' || (x) == 'C' \ || (x) == 'd' || (x) == 'D' \ || (x) == 'e' || (x) == 'E' \ || (x) == 'f' || (x) == 'F') #define ARITH_HVAL(x) (ARITH_DECIM(x) ? ARITH_DVAL(x) \ : (x) == 'a' || (x) == 'A' ? 10 \ : (x) == 'b' || (x) == 'B' ? 11 \ : (x) == 'c' || (x) == 'C' ? 12 \ : (x) == 'd' || (x) == 'D' ? 13 \ : (x) == 'e' || (x) == 'E' ? 14 : 15) #ifdef NATIVE_SIGNED /* ====================================================================== */ /* Arithmetics with native types */ /* ====================================================================== */ /* * The following properties are imposed by the C standard: * * -- Arithmetics on the unsigned type should never overflow; every * result is reduced modulo some power of 2. The macro NATIVE_UNSIGNED_BITS * should have been defined to that specific exponent. * * -- The signed type should use either two's complement, one's complement * or a sign bit and a magnitude. There should be an integer N such that * the maximum signed value is (2^N)-1 and the minimum signed value is * either -(2^N) or -((2^N)-1). -(2^N) is possible only for two's complement. * * -- The maximum signed value is at most equal to the maximum unsigned * value. * * -- Trap representations can only be: * ** In two's complement, 1 as sign bit and 0 for all value bits. * This can happen only if the minimum signed value is -((2^N)-1). * ** In one's complement, all bits set to 1. * ** In mantissa + sign, sign bit to 1 and 0 for all value bits. * Unsigned values have no trap representation achievable with numerical * operators. Only signed values can have such representations, with * operators &, |, ^, ~, << and >>. If trap representations are possible, * such occurrences are reported as warnings. * * -- The operators +, -, * and << may overflow or underflow on signed * quantities, which is potentially an error. A warning is emitted. * * -- The operator >> yields an implementation-defined result on * signed negative quantities. Usually, the sign is extended, but this * is not guaranteed. A warning is emitted. * * -- The operators / and % used with a second operand of 0 cannot work. * An error is emitted when such a call is performed. Furthermore, in * two's complemement representation, with NATIVE_SIGNED_MIN == -(2^N) * for some N, the expression `NATIVE_SIGNED_MIN / (-1)' yields an * unrepresentable result, which is also an error. * * * For the value checks, we need to consider those different cases. So * we calculate the following macros: * -- TWOS_COMPLEMENT: is 1 if representation is two's complement, 0 * otherwise. * -- ONES_COMPLEMENT: is 1 if representation is one's complement, 0 * otherwise. * -- SIGNED_IS_BIGGER: 1 if the maximum signed value is equal to the * maximum unsigned value, 0 otherwise. NATIVE_SIGNED_MAX cannot * exceed the maximum unsigned value. If SIGNED_IS_BIGGER is 0, then * the maximum unsigned value is strictly superior to twice the * value of NATIVE_SIGNED_MAX (e.g. 65535 to 32767). * -- TRAP_REPRESENTATION: 1 if a trap representation is possible, 0 * otherwise. The only way trap representations are guaranteed * impossible is when TWOS_COMPLEMENT is set, and NATIVE_SIGNED_MIN * is equal to -NATIVE_SIGNED_MAX - 1. * * Those macros are calculated by some preprocessor directives. This * supposes that the implementation conforms to C99. Rules on preprocessing * were quite looser in C90, and it could be that an old compiler, used * for a cross-compiling task, does not get those right. Therefore, if * ARCH_DEFINED is defined prior to the inclusion of this file, those * four macros are supposed to be already defined. Otherwise they are * (re)defined. The macro ARCH_TRAP_DEFINED has the same meaning, but * is limited to the TRAP_REPRESENTATION macro (if ARCH_TRAP_DEFINED is * defined, the macro TRAP_REPRESENTATION is supposed to be already * defined; the three other macros are recalculated). * * * To sum up: * -- Whenever a division operator (/ or %) is invoked and would yield * an unrepresentable result, ARITH_ERROR() is invoked. * -- With ARITHMETIC_CHECKS undefined, ARITH_WARNING() is never invoked. * -- With ARITHMETIC_CHECKS defined: * ** If ARCH_DEFINED is defined, the including context must provide * the macros TWOS_COMPLEMENT, ONES_COMPLEMENT, SIGNED_IS_BIGGER * and TRAP_REPRESENTATION. * ** Otherwise, if ARCH_TRAP_DEFINED is defined, the including context * must provide the macro TRAP_REPRESENTATION. * The code then detects all operator invokations that would yield an * overflow, underflow, trap representation, or any implementation * defined result or undefined behaviour. The macro ARITH_WARNING() is * invoked for each detection. * -- Trap representation detection code supposes that the operands are * _not_ trap representation. */ #ifndef ARCH_DEFINED #undef TWOS_COMPLEMENT #undef ONES_COMPLEMENT #undef SIGNED_IS_BIGGER #ifndef ARCH_TRAP_DEFINED #undef TRAP_REPRESENTATION #endif #if (-1) & 3 == 3 /* * Two's complement. */ #define TWOS_COMPLEMENT 1 #define ONES_COMPLEMENT 0 #ifndef ARCH_TRAP_DEFINED #if NATIVE_SIGNED_MIN < -NATIVE_SIGNED_MAX #define TRAP_REPRESENTATION 0 #else #define TRAP_REPRESENTATION 1 #endif #endif #elif (-1) & 3 == 2 /* * One's complement. */ #define TWOS_COMPLEMENT 0 #define ONES_COMPLEMENT 1 #ifndef ARCH_TRAP_DEFINED #define TRAP_REPRESENTATION 1 #endif #else /* * Mantissa + sign. */ #define TWOS_COMPLEMENT 0 #define ONES_COMPLEMENT 0 #ifndef ARCH_TRAP_DEFINED #define TRAP_REPRESENTATION 1 #endif #endif /* * Maximum native unsigned value. The first macro is for #if directives, * the second macro is for use as constant expression in C code. */ #define NATIVE_UNSIGNED_MAX ((((1U << (NATIVE_UNSIGNED_BITS - 1)) - 1U) \ << 1) + 1U) #define NATIVE_UNSIGNED_MAX_A (((((arith_u)1 << (NATIVE_UNSIGNED_BITS - 1)) \ - (arith_u)1) << 1) + (arith_u)1) #if NATIVE_SIGNED_MAX == NATIVE_UNSIGNED_MAX #define SIGNED_IS_BIGGER 1 #else #define SIGNED_IS_BIGGER 0 #endif #endif #undef NEGATIVE_IS_BIGGER #if NATIVE_SIGNED_MIN < -NATIVE_SIGNED_MAX #define NEGATIVE_IS_BIGGER 1 #else #define NEGATIVE_IS_BIGGER 0 #endif /* sanity check: we cannot have a trap representation if we have two's complement with NATIVE_SIGNED_MIN < -NATIVE_SIGNED_MAX */ #if TRAP_REPRESENTATION && NEGATIVE_IS_BIGGER #error Impossible to get trap representations. #endif /* operations on the unsigned type */ ARITH_DECL_MONO_S_U(to_u) { return (arith_u)x; } ARITH_DECL_MONO_I_U(fromint) { return (arith_u)x; } ARITH_DECL_MONO_L_U(fromulong) { return (arith_u)x; } ARITH_DECL_MONO_U_I(toint) { #if NATIVE_UNSIGNED_MAX > INT_MAX if (x > (arith_u)INT_MAX) return INT_MAX; #endif return (int)x; } ARITH_DECL_MONO_U_L(toulong) { #if NATIVE_UNSIGNED_MAX > LONG_MAX if (x > (arith_u)LONG_MAX) return LONG_MAX; #endif return (long)x; } ARITH_DECL_MONO_U_U(neg) { return -x; } ARITH_DECL_MONO_U_U(not) { return ~x; } ARITH_DECL_MONO_U_I(lnot) { return !x; } ARITH_DECL_MONO_U_I(lval) { return x != 0; } ARITH_DECL_BI_UU_U(plus) { return x + y; } ARITH_DECL_BI_UU_U(minus) { return x - y; } ARITH_DECL_BI_UU_I(lt) { return x < y; } ARITH_DECL_BI_UU_I(leq) { return x <= y; } ARITH_DECL_BI_UU_I(gt) { return x > y; } ARITH_DECL_BI_UU_I(geq) { return x >= y; } ARITH_DECL_BI_UU_I(same) { return x == y; } ARITH_DECL_BI_UU_I(neq) { return x != y; } ARITH_DECL_BI_UU_U(and) { return x & y; } ARITH_DECL_BI_UU_U(xor) { return x ^ y; } ARITH_DECL_BI_UU_U(or) { return x | y; } ARITH_DECL_BI_UU_U(star) { return x * y; } ARITH_DECL_BI_UI_U(lsh) { #ifdef ARITHMETIC_CHECKS if (y >= NATIVE_UNSIGNED_BITS) ARITH_WARNING(ARITH_EXCEP_LSH_W); else if (y < 0) ARITH_WARNING(ARITH_EXCEP_LSH_C); #endif return x << y; } ARITH_DECL_BI_UI_U(rsh) { #ifdef ARITHMETIC_CHECKS if (y >= NATIVE_UNSIGNED_BITS) ARITH_WARNING(ARITH_EXCEP_RSH_W); else if (y < 0) ARITH_WARNING(ARITH_EXCEP_RSH_C); #endif return x >> y; } ARITH_DECL_BI_UU_U(slash) { if (y == 0) ARITH_ERROR(ARITH_EXCEP_SLASH_D); return x / y; } ARITH_DECL_BI_UU_U(pct) { if (y == 0) ARITH_ERROR(ARITH_EXCEP_PCT_D); return x % y; } /* operations on the signed type */ ARITH_DECL_MONO_U_S(to_s) { #ifdef ARITHMETIC_CHECKS #if !SIGNED_IS_BIGGER if (x > (arith_u)NATIVE_SIGNED_MAX) ARITH_WARNING(ARITH_EXCEP_CONV_O); #endif #endif return (arith_s)x; } ARITH_DECL_MONO_I_S(fromint) { return (arith_s)x; } ARITH_DECL_MONO_L_S(fromlong) { return (arith_s)x; } ARITH_DECL_MONO_S_I(toint) { #if NATIVE_SIGNED_MIN < INT_MIN if (x < (arith_s)INT_MIN) return INT_MIN; #endif #if NATIVE_SIGNED_MAX > INT_MAX if (x > (arith_s)INT_MAX) return INT_MAX; #endif return (int)x; } ARITH_DECL_MONO_S_L(tolong) { #if NATIVE_SIGNED_MIN < LONG_MIN if (x < (arith_s)LONG_MIN) return LONG_MIN; #endif #if NATIVE_SIGNED_MAX > LONG_MAX if (x > (arith_s)LONG_MAX) return LONG_MAX; #endif return (long)x; } ARITH_DECL_MONO_S_S(neg) { #ifdef ARITHMETIC_CHECKS #if NEGATIVE_IS_BIGGER if (x == NATIVE_SIGNED_MIN) ARITH_WARNING(ARITH_EXCEP_NEG_O); #endif #endif return -x; } ARITH_DECL_MONO_S_S(not) { #ifdef ARITHMETIC_CHECKS #if TRAP_REPRESENTATION if ( #if TWOS_COMPLEMENT (x == NATIVE_SIGNED_MAX) #elif ONES_COMPLEMENT (x == 0) #else (x == NATIVE_SIGNED_MAX) #endif ) ARITH_WARNING(ARITH_EXCEP_NOT_T); #endif #endif return ~x; } ARITH_DECL_MONO_S_I(lnot) { return !x; } ARITH_DECL_MONO_S_I(lval) { return x != 0; } /* * Addition of signed values: * -- overflows occur only when both operands are strictly positive * -- underflows occur only when both operands are strictly negative * -- overflow check (both operands > 0): * ** if SIGNED_IS_BIGGER == 1, overflows are kept as such in the * unsigned world (if the signed addition overflows, so does the * unsigned, and vice versa) * ** if SIGNED_IS_BIGGER == 0, no overflow can happen in the unsigned * world * -- underflow check (both operands < 0): * ** if NEGATIVE_IS_BIGGER == 1 (must be two's complement) * ++ we have a guaranteed underflow if one of the operand is equal * to NATIVE_SIGNED_MIN; otherwise, -x and -y are valid integers, * and we cast them into the unsigned world * ++ if SIGNED_IS_BIGGER == 1, underflows become unsigned overflows * with a non-zero result * ++ if SIGNED_IS_BIGGER == 0, no overflow happens in the unsigned * world; we use the fact that -NATIVE_SIGNED_MIN is then * exaxctly 1 more than NATIVE_SIGNED_MAX * ** if NEGATIVE_IS_BIGGER == 0, underflow check is identical to * overflow check on (signed) -x and -y. */ ARITH_DECL_BI_SS_S(plus) { #ifdef ARITHMETIC_CHECKS if (x > 0 && y > 0 && ( #if SIGNED_IS_BIGGER ((arith_u)((arith_u)x + (arith_u)y) < (arith_u)x) #else (((arith_u)x + (arith_u)y) > (arith_u)NATIVE_SIGNED_MAX) #endif )) ARITH_WARNING(ARITH_EXCEP_PLUS_O); else if (x < 0 && y < 0 && ( #if NEGATIVE_IS_BIGGER (x == NATIVE_SIGNED_MIN || y == NATIVE_SIGNED_MIN) || #if SIGNED_IS_BIGGER (((arith_u)(-x) + (arith_u)(-y) != 0) && (arith_u)((arith_u)(-x) + (arith_u)(-y)) < (arith_u)(-x)) #else (((arith_u)(-x) + (arith_u)(-y)) > ((arith_u)1 + (arith_u)NATIVE_SIGNED_MAX)) #endif #else #if SIGNED_IS_BIGGER ((arith_u)((arith_u)(-x) + (arith_u)(-y)) < (arith_u)(-x)) #else (((arith_u)(-x) + (arith_u)(-y)) > (arith_u)NATIVE_SIGNED_MAX) #endif #endif )) ARITH_WARNING(ARITH_EXCEP_PLUS_U); #endif return x + y; } /* * Subtraction of signed values: * -- overflow: only if x > 0 and y < 0 * ** if NEGATIVE_IS_BIGGER == 1 (must be two's complement) and * y == NATIVE_SIGNED_MIN then overflow * ** otherwise, cast x and -y to unsigned, then add and check * for overflows * -- underflow: only if x < 0 and y > 0 * ** if NEGATIVE_IS_BIGGER == 1 (must be two's complement): * ++ if x == NATIVE_SIGNED_MIN then underflow * ++ cast -x and y to unsigned, then add. If SIGNED_IS_BIGGER == 0, * just check. Otherwise, check for overflow with non-zero result. * ** if NEGATIVE_IS_BIGGER == 0: cast -x and y to unsigned, then * add. Overflow check as in addition. */ ARITH_DECL_BI_SS_S(minus) { #ifdef ARITHMETIC_CHECKS if (x > 0 && y < 0 && ( #if NEGATIVE_IS_BIGGER (y == NATIVE_SIGNED_MIN) || #endif #if SIGNED_IS_BIGGER ((arith_u)((arith_u)x + (arith_u)(-y)) < (arith_u)x) #else (((arith_u)x + (arith_u)(-y)) > (arith_u)NATIVE_SIGNED_MAX) #endif )) ARITH_WARNING(ARITH_EXCEP_MINUS_O); else if (x < 0 && y > 0 && ( #if NEGATIVE_IS_BIGGER (x == NATIVE_SIGNED_MIN) || #if SIGNED_IS_BIGGER ((((arith_u)(-x) + (arith_u)y) != 0) && ((arith_u)((arith_u)(-x) + (arith_u)y) < (arith_u)(-x))) #else (((arith_u)(-x) + (arith_u)y) > ((arith_u)1 + (arith_u)NATIVE_SIGNED_MAX)) #endif #else #if SIGNED_IS_BIGGER ((arith_u)((arith_u)(-x) + (arith_u)y) < (arith_u)(-x)) #else (((arith_u)(-x) + (arith_u)y) > (arith_u)NATIVE_SIGNED_MAX) #endif #endif )) ARITH_WARNING(ARITH_EXCEP_MINUS_U); #endif return x - y; } ARITH_DECL_BI_SS_I(lt) { return x < y; } ARITH_DECL_BI_SS_I(leq) { return x <= y; } ARITH_DECL_BI_SS_I(gt) { return x > y; } ARITH_DECL_BI_SS_I(geq) { return x >= y; } ARITH_DECL_BI_SS_I(same) { return x == y; } ARITH_DECL_BI_SS_I(neq) { return x != y; } /* * Provided neither x nor y is a trap representation: * -- one's complement: impossible to get a trap representation * -- two's complement and sign + mantissa: trap representation if and * only if x and y are strictly negative and (-x) & (-y) == 0 * (in two's complement, -x is safe because overflow would occur only * if x was already a trap representation). */ ARITH_DECL_BI_SS_S(and) { #ifdef ARITHMETIC_CHECKS #if TRAP_REPRESENTATION && !ONES_COMPLEMENT if (x < 0 && y < 0 && ((-x) & (-y)) == 0) ARITH_WARNING(ARITH_EXCEP_AND_T); #endif #endif return x & y; } /* * Provided neither x nor y is a trap representation: * -- two's complement: trap if and only if x != NATIVE_SIGNED_MAX && ~x == y * -- one's complement: trap if and only if x != 0 && ~x == y * -- mantissa + sign: trap if and only if x != 0 && -x == y */ ARITH_DECL_BI_SS_S(xor) { #ifdef ARITHMETIC_CHECKS #if TRAP_REPRESENTATION if ( #if TWOS_COMPLEMENT (x != NATIVE_SIGNED_MAX && ~x == y) #elif ONES_COMPLEMENT (x != 0 && ~x == y) #else (x != 0 && -x == y) #endif ) ARITH_WARNING(ARITH_EXCEP_XOR_T); #endif #endif return x ^ y; } /* * Provided neither x nor y is a trap representation: * -- two's complement: impossible to trap * -- one's complement: trap if and only if x != 0 && y != 0 && (~x & ~y) == 0 * -- mantissa + sign: impossible to trap */ ARITH_DECL_BI_SS_S(or) { #ifdef ARITHMETIC_CHECKS #if TRAP_REPRESENTATION #if ONES_COMPLEMENT if (x != 0 && y != 0 && (~x & ~y) == 0) ARITH_WARNING(ARITH_EXCEP_OR_T); #endif #endif #endif return x | y; } /* * Left-shifting by a negative or greater than type width count is * forbidden. Left-shifting a negative value is forbidden (underflow). * Left-shifting a positive value can trigger an overflow. We check it * by casting into the unsigned world and simulating a truncation. * * If SIGNED_IS_BIGGER is set, then the signed type width is 1 more * than the unsigned type width (the sign bit is included in the width); * otherwise, if W is the signed type width, 1U << (W-1) is equal to * NATIVE_SIGNED_MAX + 1. */ ARITH_DECL_BI_SI_S(lsh) { #ifdef ARITHMETIC_CHECKS if (y < 0) ARITH_WARNING(ARITH_EXCEP_LSH_C); else if ( #if SIGNED_IS_BIGGER y > NATIVE_UNSIGNED_BITS #else y >= NATIVE_UNSIGNED_BITS || (y > 0 && (((arith_u)1 << (y - 1)) > (arith_u)NATIVE_SIGNED_MAX)) #endif ) ARITH_WARNING(ARITH_EXCEP_LSH_W); else if (x < 0) ARITH_WARNING(ARITH_EXCEP_LSH_U); else if (x > 0 && ((((arith_u)x << y) & NATIVE_SIGNED_MAX) >> y) != (arith_u)x) ARITH_WARNING(ARITH_EXCEP_LSH_O); #endif return x << y; } /* * Right-shifting is handled as left-shifting, except that the problem * is somehow simpler: there is no possible overflow or underflow. Only * right-shifting a negative value yields an implementation defined * result (_not_ an undefined behaviour). */ ARITH_DECL_BI_SI_S(rsh) { #ifdef ARITHMETIC_CHECKS if (y < 0) ARITH_WARNING(ARITH_EXCEP_RSH_C); else if ( #if SIGNED_IS_BIGGER y > NATIVE_UNSIGNED_BITS #else y >= NATIVE_UNSIGNED_BITS || (y > 0 && (((arith_u)1 << (y - 1)) > (arith_u)NATIVE_SIGNED_MAX)) #endif ) ARITH_WARNING(ARITH_EXCEP_RSH_W); else if (x < 0) ARITH_WARNING(ARITH_EXCEP_RSH_N); #endif return x >> y; } /* * Overflow can happen only if both operands have the same sign. * Underflow can happen only if both operands have opposite signs. * * Overflow checking: this is done quite inefficiently by performing * a division on the result and check if it matches the initial operand. */ ARITH_DECL_BI_SS_S(star) { #ifdef ARITHMETIC_CHECKS if (x == 0 || y == 0) return 0; if (x > 0 && y > 0) { if ((((arith_u)x * (arith_u)y) & (arith_u)NATIVE_SIGNED_MAX) / (arith_u)y != (arith_u)x) ARITH_WARNING(ARITH_EXCEP_STAR_O); } else if (x < 0 && y < 0) { if ( #if NEGATIVE_IS_BIGGER (x == NATIVE_SIGNED_MIN || y == NATIVE_SIGNED_MIN) || #endif (((arith_u)(-x) * (arith_u)(-y)) & (arith_u)NATIVE_SIGNED_MAX) / (arith_u)(-y) != (arith_u)(-x)) ARITH_WARNING(ARITH_EXCEP_STAR_O); } else if (x > 0 && y < 0) { if ((arith_u)x > (arith_u)1 && ( #if NEGATIVE_IS_BIGGER y == NATIVE_SIGNED_MIN || #endif (((arith_u)x * (arith_u)(-y)) & (arith_u)NATIVE_SIGNED_MAX) / (arith_u)(-y) != (arith_u)x)) ARITH_WARNING(ARITH_EXCEP_STAR_U); } else { if ((arith_u)y > (arith_u)1 && ( #if NEGATIVE_IS_BIGGER x == NATIVE_SIGNED_MIN || #endif (((arith_u)y * (arith_u)(-x)) & (arith_u)NATIVE_SIGNED_MAX) / (arith_u)(-x) != (arith_u)y)) ARITH_WARNING(ARITH_EXCEP_STAR_U); } #endif return x * y; } /* * Division by 0 is an error. The only other possible problem is an * overflow of the result. Such an overflow can only happen in two's * complement representation, when NEGATIVE_IS_BIGGER is set, and * one attempts to divide NATIVE_SIGNED_MIN by -1: the result is then * -NATIVE_SIGNED_MIN, which is not representable by the type. This is * considered as an error, not a warning, because it actually triggers * an exception on modern Pentium-based PC. */ ARITH_DECL_BI_SS_S(slash) { if (y == 0) ARITH_ERROR(ARITH_EXCEP_SLASH_D); #if NEGATIVE_IS_BIGGER else if (x == NATIVE_SIGNED_MIN && y == (arith_s)(-1)) ARITH_ERROR(ARITH_EXCEP_SLASH_O); #endif return x / y; } /* * Only division by 0 needs to be checked. */ ARITH_DECL_BI_SS_S(pct) { if (y == 0) ARITH_ERROR(ARITH_EXCEP_PCT_D); return x % y; } ARITH_DECL_MONO_ST_US(octconst) { arith_u z = 0; for (; ARITH_OCTAL(*c); c ++) { arith_u w = ARITH_OVAL(*c); if (z > (NATIVE_UNSIGNED_MAX_A / 8)) ARITH_ERROR(ARITH_EXCEP_CONST_O); z *= 8; #if 0 /* obsolete */ /* NATIVE_UNSIGNED_MAX_A is 2^N - 1, 0 <= w <= 7 and 8 divides z */ if (z > (NATIVE_UNSIGNED_MAX_A - w)) ARITH_ERROR(ARITH_EXCEP_CONST_O); #endif z += w; } *ru = z; #if SIGNED_IS_BIGGER *rs = z; *sp = 1; #else if (z > NATIVE_SIGNED_MAX) { *sp = 0; } else { *rs = z; *sp = 1; } #endif return c; } ARITH_DECL_MONO_ST_US(decconst) { arith_u z = 0; for (; ARITH_DECIM(*c); c ++) { arith_u w = ARITH_DVAL(*c); if (z > (NATIVE_UNSIGNED_MAX_A / 10)) ARITH_ERROR(ARITH_EXCEP_CONST_O); z *= 10; if (z > (NATIVE_UNSIGNED_MAX_A - w)) ARITH_ERROR(ARITH_EXCEP_CONST_O); z += w; } *ru = z; #if SIGNED_IS_BIGGER *rs = z; *sp = 1; #else if (z > NATIVE_SIGNED_MAX) { *sp = 0; } else { *rs = z; *sp = 1; } #endif return c; } ARITH_DECL_MONO_ST_US(hexconst) { arith_u z = 0; for (; ARITH_HEXAD(*c); c ++) { arith_u w = ARITH_HVAL(*c); if (z > (NATIVE_UNSIGNED_MAX_A / 16)) ARITH_ERROR(ARITH_EXCEP_CONST_O); z *= 16; #if 0 /* obsolete */ /* NATIVE_UNSIGNED_MAX_A is 2^N - 1, 0 <= w <= 15 and 16 divides z */ if (z > (NATIVE_UNSIGNED_MAX_A - w)) ARITH_ERROR(ARITH_EXCEP_CONST_O); #endif z += w; } *ru = z; #if SIGNED_IS_BIGGER *rs = z; *sp = 1; #else if (z > NATIVE_SIGNED_MAX) { *sp = 0; } else { *rs = z; *sp = 1; } #endif return c; } #else /* ====================================================================== */ /* Arithmetics with a simple simulated type */ /* ====================================================================== */ /* * We simulate a type with the following characteristics: * -- the signed type width is equal to the unsigned type width (which * means that there is one less value bit in the signed type); * -- the signed type uses two's complement representation; * -- there is no trap representation; * -- overflows and underflows are truncated (but a warning is emitted * if ARITHMETIC_CHECKS is defined); * -- overflow on integer division is still an error; * -- right-shifting of a negative value extends the sign; * -- the shift count value is first cast to unsigned, then reduced modulo * the type size. * * These characteristics follow what is usually found on modern * architectures. * * The maximum emulated type size is twice the size of the unsigned native * type which is used to emulate the type. */ #undef SIMUL_ONE_TMP #undef SIMUL_MSW_TMP1 #undef SIMUL_MSW_MASK #undef SIMUL_LSW_TMP1 #undef SIMUL_LSW_MASK #define SIMUL_ONE_TMP ((SIMUL_ARITH_SUBTYPE)1) #define SIMUL_MSW_TMP1 (SIMUL_ONE_TMP << (SIMUL_MSW_WIDTH - 1)) #define SIMUL_MSW_MASK (SIMUL_MSW_TMP1 | (SIMUL_MSW_TMP1 - SIMUL_ONE_TMP)) #define SIMUL_LSW_TMP1 (SIMUL_ONE_TMP << (SIMUL_LSW_WIDTH - 1)) #define SIMUL_LSW_MASK (SIMUL_LSW_TMP1 | (SIMUL_LSW_TMP1 - SIMUL_ONE_TMP)) #undef TMSW #undef TLSW #define TMSW(x) ((x) & SIMUL_MSW_MASK) #define TLSW(x) ((x) & SIMUL_LSW_MASK) #undef SIMUL_ZERO #undef SIMUL_ONE #define SIMUL_ZERO arith_strc(ARITH_TYPENAME, _zero) #define SIMUL_ONE arith_strc(ARITH_TYPENAME, _one) static arith_u SIMUL_ZERO = { 0, 0 }; static arith_u SIMUL_ONE = { 0, 1 }; /* * We use the fact that both the signed and unsigned type are the same * structure. The difference between the signed and the unsigned type * is a type information, and, as such, is considered compile-time and * not maintained in the value structure itself. This is a job for * the programmer / compiler. */ ARITH_DECL_MONO_S_U(to_u) { return x; } ARITH_DECL_MONO_I_U(fromint) { arith_u z; if (x < 0) return arith_op_u(neg)(arith_op_u(fromint)(-x)); /* * This code works because types smaller than int are promoted * by the C compiler before evaluating the >> operator. */ z.msw = TMSW(((SIMUL_ARITH_SUBTYPE)x >> (SIMUL_LSW_WIDTH - 1)) >> 1); z.lsw = TLSW((SIMUL_ARITH_SUBTYPE)x); return z; } ARITH_DECL_MONO_L_U(fromulong) { arith_u z; #if (ULONG_MAX >> (SIMUL_LSW_WIDTH - 1)) >> 1 == 0 z.msw = 0; z.lsw = x; #else z.msw = TMSW(x >> SIMUL_LSW_WIDTH); z.lsw = TLSW((SIMUL_ARITH_SUBTYPE)x); #endif return z; } ARITH_DECL_MONO_U_I(toint) { #if ((INT_MAX >> (SIMUL_LSW_WIDTH - 1)) >> 1) == 0 if (x.msw != 0 || x.lsw > (SIMUL_ARITH_SUBTYPE)INT_MAX) return INT_MAX; return (int)x.lsw; #else #if (INT_MAX >> (SIMUL_SUBTYPE_BITS - 1)) == 0 if (x.msw > (SIMUL_ARITH_SUBTYPE)(INT_MAX >> SIMUL_LSW_WIDTH)) return INT_MAX; #endif return ((int)x.msw << SIMUL_LSW_WIDTH) | (int)x.lsw; #endif } ARITH_DECL_MONO_U_L(toulong) { #if ((ULONG_MAX >> (SIMUL_LSW_WIDTH - 1)) >> 1) == 0 if (x.msw != 0 || x.lsw > (SIMUL_ARITH_SUBTYPE)ULONG_MAX) return ULONG_MAX; return (unsigned long)x.lsw; #else #if (ULONG_MAX >> (SIMUL_SUBTYPE_BITS - 1)) == 0 if (x.msw > (SIMUL_ARITH_SUBTYPE)(ULONG_MAX >> SIMUL_LSW_WIDTH)) return ULONG_MAX; #endif return ((unsigned long)x.msw << SIMUL_LSW_WIDTH) | (unsigned long)x.lsw; #endif } ARITH_DECL_MONO_U_U(neg) { x = arith_op_u(not)(x); return arith_op_u(plus)(x, SIMUL_ONE); } ARITH_DECL_MONO_U_U(not) { x.msw = TMSW(~x.msw); x.lsw = TLSW(~x.lsw); return x; } ARITH_DECL_MONO_U_I(lnot) { return x.msw == 0 && x.lsw == 0; } ARITH_DECL_MONO_U_I(lval) { return x.msw != 0 || x.lsw != 0; } ARITH_DECL_BI_UU_U(plus) { x.lsw = TLSW(x.lsw + y.lsw); x.msw = TMSW(x.msw + y.msw); if (x.lsw < y.lsw) x.msw = TMSW(x.msw + 1); return x; } ARITH_DECL_BI_UU_U(minus) { return arith_op_u(plus)(x, arith_op_u(neg)(y)); } ARITH_DECL_BI_UI_U(lsh) { if (y == 0) return x; #ifdef ARITHMETIC_CHECKS if (y < 0) ARITH_WARNING(ARITH_EXCEP_LSH_C); else if (y >= SIMUL_NUMBITS) ARITH_WARNING(ARITH_EXCEP_LSH_W); #endif y = (unsigned)y % SIMUL_NUMBITS; if (y >= SIMUL_LSW_WIDTH) { /* * We use here the fact that the LSW size is always * equal to or greater than the MSW size. */ x.msw = TMSW(x.lsw << (y - SIMUL_LSW_WIDTH)); x.lsw = 0; return x; } x.msw = TMSW((x.msw << y) | (x.lsw >> (SIMUL_LSW_WIDTH - y))); x.lsw = TLSW(x.lsw << y); return x; } ARITH_DECL_BI_UI_U(rsh) { #ifdef ARITHMETIC_CHECKS if (y < 0) ARITH_WARNING(ARITH_EXCEP_RSH_C); else if (y >= SIMUL_NUMBITS) ARITH_WARNING(ARITH_EXCEP_RSH_W); #endif y = (unsigned)y % SIMUL_NUMBITS; if (y >= SIMUL_LSW_WIDTH) { x.lsw = x.msw >> (y - SIMUL_LSW_WIDTH); x.msw = 0; return x; } x.lsw = TLSW((x.lsw >> y) | (x.msw << (SIMUL_LSW_WIDTH - y))); x.msw >>= y; return x; } ARITH_DECL_BI_UU_I(lt) { return x.msw < y.msw || (x.msw == y.msw && x.lsw < y.lsw); } ARITH_DECL_BI_UU_I(leq) { return x.msw < y.msw || (x.msw == y.msw && x.lsw <= y.lsw); } ARITH_DECL_BI_UU_I(gt) { return arith_op_u(lt)(y, x); } ARITH_DECL_BI_UU_I(geq) { return arith_op_u(leq)(y, x); } ARITH_DECL_BI_UU_I(same) { return x.msw == y.msw && x.lsw == y.lsw; } ARITH_DECL_BI_UU_I(neq) { return !arith_op_u(same)(x, y); } ARITH_DECL_BI_UU_U(and) { x.msw &= y.msw; x.lsw &= y.lsw; return x; } ARITH_DECL_BI_UU_U(xor) { x.msw ^= y.msw; x.lsw ^= y.lsw; return x; } ARITH_DECL_BI_UU_U(or) { x.msw |= y.msw; x.lsw |= y.lsw; return x; } #undef SIMUL_LSW_ODDLEN #undef SIMUL_LSW_HALFLEN #undef SIMUL_LSW_HALFMASK #define SIMUL_LSW_ODDLEN (SIMUL_LSW_WIDTH & 1) #define SIMUL_LSW_HALFLEN (SIMUL_LSW_WIDTH / 2) #define SIMUL_LSW_HALFMASK (~(~(SIMUL_ARITH_SUBTYPE)0 << SIMUL_LSW_HALFLEN)) ARITH_DECL_BI_UU_U(star) { arith_u z; SIMUL_ARITH_SUBTYPE a = x.lsw, b = y.lsw, t00, t01, t10, t11, c = 0, t; #if SIMUL_LSW_ODDLEN SIMUL_ARITH_SUBTYPE bms = b & (SIMUL_ONE_TMP << (SIMUL_LSW_WIDTH - 1)); b &= ~(SIMUL_ONE_TMP << (SIMUL_LSW_WIDTH - 1)); #endif t00 = (a & SIMUL_LSW_HALFMASK) * (b & SIMUL_LSW_HALFMASK); t01 = (a & SIMUL_LSW_HALFMASK) * (b >> SIMUL_LSW_HALFLEN); t10 = (a >> SIMUL_LSW_HALFLEN) * (b & SIMUL_LSW_HALFMASK); t11 = (a >> SIMUL_LSW_HALFLEN) * (b >> SIMUL_LSW_HALFLEN); t = z.lsw = t00; z.lsw = TLSW(z.lsw + (t01 << SIMUL_LSW_HALFLEN)); if (t > z.lsw) c ++; t = z.lsw; z.lsw = TLSW(z.lsw + (t10 << SIMUL_LSW_HALFLEN)); if (t > z.lsw) c ++; #if SIMUL_LSW_ODDLEN t = z.lsw; z.lsw = TLSW(z.lsw + (t11 << (2 * SIMUL_LSW_HALFLEN))); if (t > z.lsw) c ++; if (bms && (a & SIMUL_ONE_TMP)) { t = z.lsw; z.lsw = TLSW(z.lsw + b); if (t > z.lsw) c ++; } #endif z.msw = TMSW(x.lsw * y.msw + x.msw * y.lsw + c + (t01 >> (SIMUL_LSW_WIDTH - SIMUL_LSW_HALFLEN)) + (t10 >> (SIMUL_LSW_WIDTH - SIMUL_LSW_HALFLEN)) + (t11 >> (SIMUL_LSW_WIDTH - (2 * SIMUL_LSW_HALFLEN)))); return z; } /* * This function calculates the unsigned integer division, yielding * both quotient and remainder. The divider (y) MUST be non-zero. */ static void arith_op_u(udiv)(arith_u x, arith_u y, arith_u *q, arith_u *r) { int i, j; arith_u a; *q = SIMUL_ZERO; for (i = SIMUL_NUMBITS - 1; i >= 0; i --) { if (i >= (int)SIMUL_LSW_WIDTH && (y.msw & (SIMUL_ONE_TMP << (i - SIMUL_LSW_WIDTH)))) break; if (i < (int)SIMUL_LSW_WIDTH && (y.lsw & (SIMUL_ONE_TMP << i))) break; } a = arith_op_u(lsh)(y, SIMUL_NUMBITS - 1 - i); for (j = SIMUL_NUMBITS - 1 - i; j >= SIMUL_LSW_WIDTH; j --) { if (arith_op_u(leq)(a, x)) { x = arith_op_u(minus)(x, a); q->msw |= SIMUL_ONE_TMP << (j - SIMUL_LSW_WIDTH); } a = arith_op_u(rsh)(a, 1); } for (; j >= 0; j --) { if (arith_op_u(leq)(a, x)) { x = arith_op_u(minus)(x, a); q->lsw |= SIMUL_ONE_TMP << j; } a = arith_op_u(rsh)(a, 1); } *r = x; } ARITH_DECL_BI_UU_U(slash) { arith_u q, r; if (arith_op_u(same)(y, SIMUL_ZERO)) ARITH_ERROR(ARITH_EXCEP_SLASH_D); arith_op_u(udiv)(x, y, &q, &r); return q; } ARITH_DECL_BI_UU_U(pct) { arith_u q, r; if (arith_op_u(same)(y, SIMUL_ZERO)) ARITH_ERROR(ARITH_EXCEP_PCT_D); arith_op_u(udiv)(x, y, &q, &r); return r; } #undef SIMUL_TRAP #undef SIMUL_TRAPL #define SIMUL_TRAP (SIMUL_ONE_TMP << (SIMUL_MSW_WIDTH - 1)) #define SIMUL_TRAPL (SIMUL_ONE_TMP << (SIMUL_LSW_WIDTH - 1)) ARITH_DECL_MONO_U_S(to_s) { #ifdef ARITHMETIC_CHECKS if (x.msw & SIMUL_TRAP) ARITH_WARNING(ARITH_EXCEP_CONV_O); #endif return x; } ARITH_DECL_MONO_I_S(fromint) { return arith_op_u(fromint)(x); } ARITH_DECL_MONO_L_S(fromlong) { if (x < 0) return arith_op_u(neg)( arith_op_u(fromulong)((unsigned long)(-x))); return arith_op_u(fromulong)((unsigned long)x); } ARITH_DECL_MONO_S_I(toint) { if (x.msw & SIMUL_TRAP) return -arith_op_u(toint)(arith_op_u(neg)(x)); return arith_op_u(toint)(x); } ARITH_DECL_MONO_S_L(tolong) { if (x.msw & SIMUL_TRAP) return -(long)arith_op_u(toulong)(arith_op_u(neg)(x)); return (long)arith_op_u(toulong)(x); } ARITH_DECL_MONO_S_S(neg) { #ifdef ARITHMETIC_CHECKS if (x.lsw == 0 && x.msw == SIMUL_TRAP) ARITH_WARNING(ARITH_EXCEP_NEG_O); #endif return arith_op_u(neg)(x); } ARITH_DECL_MONO_S_S(not) { return arith_op_u(not)(x); } ARITH_DECL_MONO_S_I(lnot) { return arith_op_u(lnot)(x); } ARITH_DECL_MONO_S_I(lval) { return arith_op_u(lval)(x); } ARITH_DECL_BI_SS_S(plus) { arith_u z = arith_op_u(plus)(x, y); #ifdef ARITHMETIC_CHECKS if (x.msw & y.msw & ~z.msw & SIMUL_TRAP) ARITH_WARNING(ARITH_EXCEP_PLUS_U); else if (~x.msw & ~y.msw & z.msw & SIMUL_TRAP) ARITH_WARNING(ARITH_EXCEP_PLUS_O); #endif return z; } ARITH_DECL_BI_SS_S(minus) { arith_s z = arith_op_u(minus)(x, y); #ifdef ARITHMETIC_CHECKS if (x.msw & ~y.msw & ~z.msw & SIMUL_TRAP) ARITH_WARNING(ARITH_EXCEP_MINUS_U); else if (~x.msw & y.msw & z.msw & SIMUL_TRAP) ARITH_WARNING(ARITH_EXCEP_MINUS_O); #endif return z; } /* * Since signed and unsigned widths are equal for the simulated type, * we can use the unsigned left shift function, which performs the * the checks on the type width. */ ARITH_DECL_BI_SI_S(lsh) { arith_s z = arith_op_u(lsh)(x, y); #ifdef ARITHMETIC_CHECKS if (x.msw & SIMUL_TRAP) ARITH_WARNING(ARITH_EXCEP_LSH_U); else { /* * To check for possible overflow, we right shift the * result. We need to make the shift count proper so that * we do not emit a double-warning. Besides, the left shift * could have been untruncated but yet affet the sign bit, * so we must test this explicitly. */ arith_s w = arith_op_u(rsh)(z, (unsigned)y % SIMUL_NUMBITS); if ((z.msw & SIMUL_TRAP) || w.msw != x.msw || w.lsw != x.lsw) ARITH_WARNING(ARITH_EXCEP_LSH_O); } #endif return z; } /* * We define that right shifting a negative value, besides being worth a * warning, duplicates the sign bit. This is the most useful and most * usually encountered behaviour, and the standard allows it. */ ARITH_DECL_BI_SI_S(rsh) { int xn = (x.msw & SIMUL_TRAP) != 0; arith_s z = arith_op_u(rsh)(x, y); int gy = (unsigned)y % SIMUL_NUMBITS; #ifdef ARITHMETIC_CHECKS if (xn) ARITH_WARNING(ARITH_EXCEP_RSH_N); #endif if (xn && gy > 0) { if (gy <= SIMUL_MSW_WIDTH) { z.msw |= TMSW(~(SIMUL_MSW_MASK >> gy)); } else { z.msw = SIMUL_MSW_MASK; z.lsw |= TLSW(~(SIMUL_LSW_MASK >> (gy - SIMUL_MSW_WIDTH))); } } return z; } ARITH_DECL_BI_SS_I(lt) { int xn = (x.msw & SIMUL_TRAP) != 0; int yn = (y.msw & SIMUL_TRAP) != 0; if (xn == yn) { return x.msw < y.msw || (x.msw == y.msw && x.lsw < y.lsw); } else { return xn; } } ARITH_DECL_BI_SS_I(leq) { int xn = (x.msw & SIMUL_TRAP) != 0; int yn = (y.msw & SIMUL_TRAP) != 0; if (xn == yn) { return x.msw < y.msw || (x.msw == y.msw && x.lsw <= y.lsw); } else { return xn; } } ARITH_DECL_BI_SS_I(gt) { return arith_op_s(lt)(y, x); } ARITH_DECL_BI_SS_I(geq) { return arith_op_s(leq)(y, x); } ARITH_DECL_BI_SS_I(same) { return x.msw == y.msw && x.lsw == y.lsw; } ARITH_DECL_BI_SS_I(neq) { return !arith_op_s(same)(x, y); } ARITH_DECL_BI_SS_S(and) { return arith_op_u(and)(x, y); } ARITH_DECL_BI_SS_S(xor) { return arith_op_u(xor)(x, y); } ARITH_DECL_BI_SS_S(or) { return arith_op_u(or)(x, y); } /* * This function calculates the signed integer division, yielding * both quotient and remainder. The divider (y) MUST be non-zero. */ static void arith_op_s(sdiv)(arith_s x, arith_s y, arith_s *q, arith_s *r) { arith_u a = x, b = y, c, d; int xn = 0, yn = 0; if (x.msw & SIMUL_TRAP) { a = arith_op_u(neg)(x); xn = 1; } if (y.msw & SIMUL_TRAP) { b = arith_op_u(neg)(y); yn = 1; } arith_op_u(udiv)(a, b, &c, &d); if (xn != yn) *q = arith_op_u(neg)(c); else *q = c; if (xn != yn) *r = arith_op_u(neg)(d); else *r = d; } /* * Overflow/underflow check is done the following way: obvious cases * are checked (both upper words non-null, both upper words null...) * and border-line occurrences are verified with an unsigned division * (which is quite computationaly expensive). */ ARITH_DECL_BI_SS_S(star) { #ifdef ARITHMETIC_CHECKS arith_s z = arith_op_u(star)(x, y); int warn = 0; if (x.msw > 0) { if (y.msw > 0 #if SIMUL_LSW_ODDLEN || (y.lsw & SIMUL_TRAPL) #endif ) warn = 1; } #if SIMUL_LSW_ODDLEN else if (y.msw > 0 && (x.lsw & SIMUL_TRAPL)) warn = 1; #endif if (!warn && (x.msw > 0 || y.msw > 0 #if SIMUL_LSW_ODDLEN || ((x.lsw | y.lsw) & SIMUL_TRAPL) #endif )) { if (x.msw == SIMUL_MSW_MASK && x.lsw == SIMUL_LSW_MASK) { if (y.msw == SIMUL_TRAP && y.lsw == 0) warn = 1; } else if (!(x.msw == 0 && x.lsw == 0) && !arith_op_s(same)(arith_op_s(slash)(z, x), y)) { } warn = 1; } if (warn) ARITH_WARNING(((x.msw ^ y.msw) & SIMUL_TRAP) ? ARITH_EXCEP_STAR_U : ARITH_EXCEP_STAR_O); return z; #else return arith_op_u(star)(x, y); #endif } ARITH_DECL_BI_SS_S(slash) { arith_s q, r; if (arith_op_s(same)(y, SIMUL_ZERO)) ARITH_ERROR(ARITH_EXCEP_SLASH_D); else if (x.msw == SIMUL_TRAP && x.lsw == 0 && y.msw == SIMUL_MSW_MASK && y.lsw == SIMUL_LSW_MASK) ARITH_ERROR(ARITH_EXCEP_SLASH_O); arith_op_s(sdiv)(x, y, &q, &r); return q; } ARITH_DECL_BI_SS_S(pct) { arith_s q, r; if (arith_op_s(same)(y, SIMUL_ZERO)) ARITH_ERROR(ARITH_EXCEP_PCT_D); arith_op_s(sdiv)(x, y, &q, &r); return r; } ARITH_DECL_MONO_ST_US(octconst) { arith_u z = { 0, 0 }; for (; ARITH_OCTAL(*c); c ++) { unsigned w = ARITH_OVAL(*c); if (z.msw > (SIMUL_MSW_MASK / 8)) ARITH_ERROR(ARITH_EXCEP_CONST_O); z = arith_op_u(lsh)(z, 3); z.lsw |= w; } *ru = z; if (z.msw & SIMUL_TRAP) { *sp = 0; } else { *rs = z; *sp = 1; } return c; } ARITH_DECL_MONO_ST_US(decconst) { #define ARITH_ALPHA_TRAP (1U << (SIMUL_MSW_WIDTH - 1)) #define ARITH_ALPHA_MASK (ARITH_ALPHA_TRAP | (ARITH_ALPHA_TRAP - 1)) #define ARITH_ALPHA ((ARITH_ALPHA_MASK - 10 * (ARITH_ALPHA_TRAP / 5)) + 1) #define ARITH_ALPHA_A ((SIMUL_MSW_MASK - 10 * (SIMUL_TRAP / 5)) + 1) arith_u z = { 0, 0 }; for (; ARITH_DECIM(*c); c ++) { unsigned w = ARITH_DVAL(*c); SIMUL_ARITH_SUBTYPE t; if (z.msw > (SIMUL_MSW_MASK / 10) || (z.msw == (SIMUL_MSW_MASK / 10) && /* ARITH_ALPHA is between 1 and 9, inclusive. */ #if ARITH_ALPHA == 5 z.lsw >= SIMUL_TRAPL #else z.lsw > ((SIMUL_TRAPL / 5) * ARITH_ALPHA_A + ((SIMUL_TRAPL % 5) * ARITH_ALPHA_A) / 5) #endif )) ARITH_ERROR(ARITH_EXCEP_CONST_O); z = arith_op_u(plus)(arith_op_u(lsh)(z, 3), arith_op_u(lsh)(z, 1)); t = TLSW(z.lsw + w); if (t < z.lsw) z.msw ++; z.lsw = t; } *ru = z; if (z.msw & SIMUL_TRAP) { *sp = 0; } else { *rs = z; *sp = 1; } return c; #undef ARITH_ALPHA_A #undef ARITH_ALPHA #undef ARITH_ALPHA_TRAP #undef ARITH_ALPHA_MASK } ARITH_DECL_MONO_ST_US(hexconst) { arith_u z = { 0, 0 }; for (; ARITH_HEXAD(*c); c ++) { unsigned w = ARITH_HVAL(*c); if (z.msw > (SIMUL_MSW_MASK / 16)) ARITH_ERROR(ARITH_EXCEP_CONST_O); z = arith_op_u(lsh)(z, 4); z.lsw |= w; } *ru = z; if (z.msw & SIMUL_TRAP) { *sp = 0; } else { *rs = z; *sp = 1; } return c; } #endif #undef ARITH_HVAL #undef ARITH_HEXAD #undef ARITH_DVAL #undef ARITH_DECIM #undef ARITH_OVAL #undef ARITH_OCTAL synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/cpp.h0000664000076400007640000002070711167361450020563 0ustar stefanstefan/* * (c) Thomas Pornin 1999 - 2002 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. The name of the authors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef UCPP__CPP__ #define UCPP__CPP__ /* * Uncomment the following if you want ucpp to use externally provided * error-reporting functions (ucpp_warning(), ucpp_error() and ucpp_ouch()) */ /* #define NO_UCPP_ERROR_FUNCTIONS */ /* * Tokens (do not change the order unless checking operators_name[] in cpp.c) * * It is important that the token NONE is 0 * Check the STRING_TOKEN macro */ #define CPPERR 512 enum { NONE, /* whitespace */ NEWLINE, /* newline */ COMMENT, /* comment */ NUMBER, /* number constant */ NAME, /* identifier */ BUNCH, /* non-C characters */ PRAGMA, /* a #pragma directive */ CONTEXT, /* new file or #line */ STRING, /* constant "xxx" */ CHAR, /* constant 'xxx' */ SLASH, /* / */ ASSLASH, /* /= */ MINUS, /* - */ MMINUS, /* -- */ ASMINUS, /* -= */ ARROW, /* -> */ PLUS, /* + */ PPLUS, /* ++ */ ASPLUS, /* += */ LT, /* < */ LEQ, /* <= */ LSH, /* << */ ASLSH, /* <<= */ GT, /* > */ GEQ, /* >= */ RSH, /* >> */ ASRSH, /* >>= */ ASGN, /* = */ SAME, /* == */ #ifdef CAST_OP CAST, /* => */ #endif NOT, /* ~ */ NEQ, /* != */ AND, /* & */ LAND, /* && */ ASAND, /* &= */ OR, /* | */ LOR, /* || */ ASOR, /* |= */ PCT, /* % */ ASPCT, /* %= */ STAR, /* * */ ASSTAR, /* *= */ CIRC, /* ^ */ ASCIRC, /* ^= */ LNOT, /* ! */ LBRA, /* { */ RBRA, /* } */ LBRK, /* [ */ RBRK, /* ] */ LPAR, /* ( */ RPAR, /* ) */ COMMA, /* , */ QUEST, /* ? */ SEMIC, /* ; */ COLON, /* : */ DOT, /* . */ MDOTS, /* ... */ SHARP, /* # */ DSHARP, /* ## */ OPT_NONE, /* optional space to separate tokens in text output */ DIGRAPH_TOKENS, /* there begin digraph tokens */ /* for DIG_*, do not change order, unless checking undig() in cpp.c */ DIG_LBRK, /* <: */ DIG_RBRK, /* :> */ DIG_LBRA, /* <% */ DIG_RBRA, /* %> */ DIG_SHARP, /* %: */ DIG_DSHARP, /* %:%: */ DIGRAPH_TOKENS_END, /* digraph tokens end here */ LAST_MEANINGFUL_TOKEN, /* reserved words will go there */ MACROARG, /* special token for representing macro arguments */ UPLUS = CPPERR, /* unary + */ UMINUS /* unary - */ }; #include "tune.h" #include #include struct token { int type; long line; char *name; #ifdef SYNOPSIS long pos; #endif }; struct token_fifo { struct token *t; size_t nt, art; }; struct lexer_state { /* input control */ FILE *input; #ifndef NO_UCPP_BUF unsigned char *input_buf; #ifdef UCPP_MMAP int from_mmap; unsigned char *input_buf_sav; #endif #endif unsigned char *input_string; size_t ebuf; size_t pbuf; int lka[2]; int nlka; int macfile; int last; int discard; unsigned long utf8; unsigned char copy_line[COPY_LINE_LENGTH]; int cli; /* output control */ FILE *output; struct token_fifo *output_fifo, *toplevel_of; #ifndef NO_UCPP_BUF unsigned char *output_buf; #endif size_t sbuf; /* token control */ struct token *ctok; struct token *save_ctok; size_t tknl; int ltwnl; int pending_token; #ifdef INMACRO_FLAG int inmacro; long macro_count; #endif /* lexer options */ long line; long oline; #ifdef SYNOPSIS long column; /*< Position of next read token is column + discard */ long ocolumn; /*< Position of next written token is ocolumn */ #endif unsigned long flags; long count_trigraphs; struct garbage_fifo *gf; int ifnest; int condnest; int condcomp; int condmet; unsigned long condf[2]; }; /* * Flags for struct lexer_state */ /* warning flags */ #define WARN_STANDARD 0x000001UL /* emit standard warnings */ #define WARN_ANNOYING 0x000002UL /* emit annoying warnings */ #define WARN_TRIGRAPHS 0x000004UL /* warn when trigraphs are used */ #define WARN_TRIGRAPHS_MORE 0x000008UL /* extra-warn for trigraphs */ #define WARN_PRAGMA 0x000010UL /* warn for pragmas in non-lexer mode */ /* error flags */ #define FAIL_SHARP 0x000020UL /* emit errors on rogue '#' */ #define CCHARSET 0x000040UL /* emit errors on non-C characters */ /* emission flags */ #define DISCARD_COMMENTS 0x000080UL /* discard comments from text output */ #define CPLUSPLUS_COMMENTS 0x000100UL /* understand C++-like comments */ #define LINE_NUM 0x000200UL /* emit #line directives in output */ #define GCC_LINE_NUM 0x000400UL /* same as #line, with gcc-syntax */ /* language flags */ #define HANDLE_ASSERTIONS 0x000800UL /* understand assertions */ #define HANDLE_PRAGMA 0x001000UL /* emit PRAGMA tokens in lexer mode */ #define MACRO_VAARG 0x002000UL /* understand macros with '...' */ #define UTF8_SOURCE 0x004000UL /* identifiers are in UTF8 encoding */ #define HANDLE_TRIGRAPHS 0x008000UL /* handle trigraphs */ /* global ucpp behaviour */ #define LEXER 0x010000UL /* behave as a lexer */ #define KEEP_OUTPUT 0x020000UL /* emit the result of preprocessing */ #define COPY_LINE 0x040000UL /* make a copy of the parsed line */ /* internal flags */ #define READ_AGAIN 0x080000UL /* emit again the last token */ #define TEXT_OUTPUT 0x100000UL /* output text */ /* * Public function prototypes */ #ifndef NO_UCPP_BUF void flush_output(struct lexer_state *); #endif void init_assertions(void); int make_assertion(char *); int destroy_assertion(char *); void print_assertions(void); void init_macros(void); int define_macro(struct lexer_state *, char *); int undef_macro(struct lexer_state *, char *); void print_defines(void); void set_init_filename(char *, int); void init_cpp(void); void init_include_path(char *[]); void init_lexer_state(struct lexer_state *); void init_lexer_mode(struct lexer_state *); void free_lexer_state(struct lexer_state *); void wipeout(void); int lex(struct lexer_state *); int check_cpp_errors(struct lexer_state *); void add_incpath(char *); void init_tables(int); int enter_file(struct lexer_state *, unsigned long, unsigned long enter_exit); int cpp(struct lexer_state *); void set_identifier_char(int c); void unset_identifier_char(int c); #ifdef UCPP_MMAP FILE *fopen_mmap_file(char *); void set_input_file(struct lexer_state *, FILE *); #endif struct stack_context { char *long_name, *name; long line; }; struct stack_context *report_context(void); extern int no_special_macros, system_macros, emit_dependencies, emit_defines, emit_assertions; extern int c99_compliant, c99_hosted; extern FILE *emit_output; extern char *current_filename, *current_long_filename; extern char *operators_name[]; extern struct protect { char *macro; int state; struct found_file *ff; } protect_detect; void ucpp_ouch(char *, ...); void ucpp_error(long, char *, ...); void ucpp_warning(long, char *, ...); extern int *transient_characters; /* * Errors from CPPERR_EOF and above are not real erros, only show-stoppers. * Errors below CPPERR_EOF are real ones. */ #define CPPERR_NEST 900 #define CPPERR_EOF 1000 /* * This macro tells whether the name field of a given token type is * relevant, or not. Irrelevant name field means that it might point * to outerspace. */ #ifdef SEMPER_FIDELIS #define STRING_TOKEN(x) ((x) == NONE || ((x) >= COMMENT && (x) <= CHAR)) #else #define STRING_TOKEN(x) ((x) >= NUMBER && (x) <= CHAR) #endif #endif synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/ucppi.h0000664000076400007640000001340511163213133021104 0ustar stefanstefan/* * (c) Thomas Pornin 1999 - 2002 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. The name of the authors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef UCPP__UCPPI__ #define UCPP__UCPPI__ #include "tune.h" #include "cpp.h" #include "nhash.h" /* * A macro represented in a compact form; simple tokens are represented * by one byte, containing their number. Tokens with a string value are * followed by the value (string finished by a 0). Macro arguments are * followed by the argument number (in one byte -- thus implying a hard * limit of 254 arguments (number 255 is for __VA_ARGS__). */ struct comp_token_fifo { size_t length; size_t rp; unsigned char *t; }; /* These declarations are used only internally by ucpp */ /* * S_TOKEN(x) checks whether x is a token type with an embedded string * ttMWS(x) checks whether x is macro whitespace (space, comment...) * ttWHI(x) checks whether x is whitespace (MWS or newline) */ #define S_TOKEN(x) STRING_TOKEN(x) #define ttMWS(x) ((x) == NONE || (x) == COMMENT || (x) == OPT_NONE) #define ttWHI(x) (ttMWS(x) || (x) == NEWLINE) /* * Function prototypes */ /* * from lexer.c */ #define init_cppm ucpp_init_cppm #define put_char ucpp_put_char #define discard_char ucpp_discard_char #define next_token ucpp_next_token #define grap_char ucpp_grap_char #define space_char ucpp_space_char void init_cppm(void); void put_char(struct lexer_state *, unsigned char); void discard_char(struct lexer_state *); int next_token(struct lexer_state *); int grap_char(struct lexer_state *); int space_char(int); /* * from assert.c */ struct assert { hash_item_header head; /* first field */ size_t nbval; struct token_fifo *val; }; #define cmp_token_list ucpp_cmp_token_list #define handle_assert ucpp_handle_assert #define handle_unassert ucpp_handle_unassert #define get_assertion ucpp_get_assertion #define wipe_assertions ucpp_wipe_assertions int cmp_token_list(struct token_fifo *, struct token_fifo *); int handle_assert(struct lexer_state *); int handle_unassert(struct lexer_state *); struct assert *get_assertion(char *); void wipe_assertions(void); /* * from macro.c */ struct macro { hash_item_header head; /* first field */ int narg; char **arg; int nest; int vaarg; #ifdef LOW_MEM struct comp_token_fifo cval; #else struct token_fifo val; #endif }; #define print_token ucpp_print_token #define handle_define ucpp_handle_define #define handle_undef ucpp_handle_undef #define handle_ifdef ucpp_handle_ifdef #define handle_ifndef ucpp_handle_ifndef #define substitute_macro ucpp_substitute_macro #define get_macro ucpp_get_macro #define wipe_macros ucpp_wipe_macros #define dsharp_lexer ucpp_dsharp_lexer #define compile_time ucpp_compile_time #define compile_date ucpp_compile_date #ifdef PRAGMA_TOKENIZE #define tokenize_lexer ucpp_tokenize_lexer #endif void print_token(struct lexer_state *, struct token *, long); int handle_define(struct lexer_state *); int handle_undef(struct lexer_state *); int handle_ifdef(struct lexer_state *); int handle_ifndef(struct lexer_state *); int substitute_macro(struct lexer_state *, struct macro *, struct token_fifo *, int, int, long); struct macro *get_macro(char *); void wipe_macros(void); extern struct lexer_state dsharp_lexer; extern char compile_time[], compile_date[]; #ifdef PRAGMA_TOKENIZE extern struct lexer_state tokenize_lexer; #endif /* * from eval.c */ #define strtoconst ucpp_strtoconst #define eval_expr ucpp_eval_expr #define eval_line ucpp_eval_line unsigned long strtoconst(char *); unsigned long eval_expr(struct token_fifo *, int *, int); extern long eval_line; #define eval_exception ucpp_eval_exception #ifdef POSIX_JMP #define JMP_BUF sigjmp_buf #define catch(x) sigsetjmp((x), 0) #define throw(x) siglongjmp((x), 1) #else #define JMP_BUF jmp_buf #define catch(x) setjmp((x)) #define throw(x) longjmp((x), 1) #endif extern JMP_BUF eval_exception; /* * from cpp.c */ #define token_name ucpp_token_name #define throw_away ucpp_throw_away #define garbage_collect ucpp_garbage_collect #define init_buf_lexer_state ucpp_init_buf_lexer_state #ifdef PRAGMA_TOKENIZE #define compress_token_list ucpp_compress_token_list #endif char *token_name(struct token *); void throw_away(struct garbage_fifo *, char *); void garbage_collect(struct garbage_fifo *); void init_buf_lexer_state(struct lexer_state *, int); #ifdef PRAGMA_TOKENIZE struct comp_token_fifo compress_token_list(struct token_fifo *); #endif #define ouch ucpp_ouch #define error ucpp_error #define warning ucpp_warning #endif synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/tune.h0000664000076400007640000004154611167012770020756 0ustar stefanstefan/* * (c) Thomas Pornin 1999 - 2002 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. The name of the authors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef UCPP__TUNE__ #define UCPP__TUNE__ #ifdef UCPP_CONFIG #include "config.h" #else /* ====================================================================== */ /* * The LOW_MEM macro triggers the use of macro storage which uses less * memory. It actually also improves performance on large, modern machines * (due to less cache pressure). This option implies no limitation (except * on the number of arguments a macro may, which is then limited to 32766) * so it is on by default. Non-LOW_MEM code is considered deprecated. */ #define LOW_MEM /* ====================================================================== */ /* * Define AMIGA for systems using "drive letters" at the beginning of * some paths; define MSDOS on systems with drive letters and using * backslashes to seperate directory components. */ /* #define AMIGA */ /* #define MSDOS */ /* ====================================================================== */ /* * Define this if your compiler does not know the strftime() function; * TurboC 2.01 under Msdos does not know strftime(). */ /* #define NOSTRFTIME */ /* ====================================================================== */ /* * Buffering: there are two levels of buffering on input and output streams: * the standard libc buffering (manageable with setbuf() and setvbuf()) * and some buffering provided by ucpp itself. The ucpp buffering uses * two buffers, of size respectively INPUT_BUF_MEMG and OUTPUT_BUF_MEMG * (as defined below). * You can disable one or both of these bufferings by defining the macros * NO_LIBC_BUF and NO_UCPP_BUF. */ /* #define NO_LIBC_BUF */ /* #define NO_UCPP_BUF */ /* * On Unix stations, the system call mmap() might be used on input files. * This option is a subclause of ucpp internal buffering. On one station, * a 10% speed improvement was observed. Do not define this unless the * host architecture has the following characteristics: * -- Posix / Single Unix compliance * -- Text files correspond one to one with memory representation * If a file is not seekable or not mmapable, ucpp will revert to the * standard fread() solution. * * This feature is still considered beta quality. On some systems where * files can be bigger than memory address space (mainly, 32-bit systems * with files bigger than 4 GB), this option makes ucpp fail to operate * on those extremely large files. */ #define UCPP_MMAP /* * Performance issues: * -- On memory-starved systems, such as Minix-i86, do not use ucpp * buffering; keep only libc buffering. * -- If you do not use libc buffering, activate the UCPP_MMAP option. * Note that the UCPP_MMAP option is ignored if ucpp buffering is not * activated. * * On an Athlon 1200 running FreeBSD 4.7, the best performances are * achieved when libc buffering is activated and/or UCPP_MMAP is on. */ /* ====================================================================== */ /* * Define this if you want ucpp to generate tokenized PRAGMA tokens; * otherwise, it will generate raw string contents. This setting is * irrelevant to the stand-alone version of ucpp. */ #define PRAGMA_TOKENIZE /* * Define this to the special character that marks the end of tokens with * a string value inside a tokenized PRAGMA token. The #pragma and _Pragma() * directives which use this character will be a bit more difficult to * decode (but ucpp will not mind). 0 cannot be used. '\n' is fine because * it cannot appear inside a #pragma or _Pragma(), since newlines cannot be * embedded inside tokens, neither directly nor by macro substitution and * stringization. Besides, '\n' is portable. */ #define PRAGMA_TOKEN_END ((unsigned char)'\n') /* * Define this if you want ucpp to include encountered #pragma directives * in its output in non-lexer mode; _Pragma() are translated to equivalent * #pragma directives. */ #define PRAGMA_DUMP /* * According to my interpretation of the C99 standard, _Pragma() are * evaluated wherever macro expansion could take place. However, Neil Booth, * whose mother language is English (contrary to me) and who is well aware * of the C99 standard (and especially the C preprocessor) told me that * it was unclear whether _Pragma() are evaluated inside directives such * as #if, #include and #line. If you want to disable the evaluation of * _Pragma() inside such directives, define the following macro. */ /* #define NO_PRAGMA_IN_DIRECTIVE */ /* * The C99 standard mandates that the operator `##' must yield a single, * valid token, lest undefined behaviour befall upon thy head. Hence, * for instance, `+ ## +=' is forbidden, because `++=' is not a valid * token (although it is a valid list of two tokens, `++' and `='). * However, ucpp only emits a warning for such sin, and unmerges the * tokens (thus emitting `+' then `+=' for that example). When ucpp * produces text output, those two tokens will be separated by a space * character so that the basic rule of text output is preserved: when * parsed again, text output yields the exact same stream of tokens. * That extra space is virtual: it does not count as a true whitespace * token for stringization. * * However, it might be desirable, for some uses other than preprocessing * C source code, not to emit that extra space at all. To make ucpp behave * that way, define the DSHARP_TOKEN_MERGE macro. Please note that this * can trigger spurious token merging. For instance, with that macro * activated, `+ ## +=' will be output as `++=' which, if preprocessed * again, will read as `++' followed by `='. * * All this is irrelevant to lexer mode; and trying to merge incompatible * tokens is a shooting offence, anyway. */ /* #define DSHARP_TOKEN_MERGE */ /* ====================================================================== */ /* * Define INMACRO_FLAG to include two flags to the structure lexer_state, * that tell whether tokens come from a macro-replacement, and count those * macro-replacements. */ /* #define INMACRO_FLAG */ /* ====================================================================== */ /* * Paths where files are looked for by default, when #include is used. * Typical path is /usr/local/include and /usr/include, in that order. * If you want to set up no path, define the macro to 0. * * For Linux, get gcc includes too, or you will miss things like stddef.h. * The exact path varies much, depending on the distribution. */ #define STD_INCLUDE_PATH "/usr/local/include", "/usr/include" /* ====================================================================== */ /* * Arithmetic code for evaluation of #if expressions. Evaluation * uses either a native machine type, or an emulated two's complement * type. Division by 0 and overflow on division are considered as errors * and reported as such. If ARITHMETIC_CHECKS is defined, all other * operations that imply undefined or implementation-defined behaviour * are reported as warnings but otherwise performed nonetheless. * * For native type evaluation, the following macros should be defined: * NATIVE_SIGNED the native signed type * NATIVE_UNSIGNED the native corresponding unsigned type * NATIVE_UNSIGNED_BITS the native unsigned type width, in bits * NATIVE_SIGNED_MIN the native signed type minimum value * NATIVE_SIGNED_MAX the native signed type maximum value * * The code in the arith.c file performs some tricky detection * operations on the native type representation and possible existence * of a trap representation. These operations assume a C99-compliant * compiler; on a C90-only compiler, the operations are valid but may * yield incorrect results. You may force those settings with some * more macros: see the comments in arith.c (look for "ARCH_DEFINED"). * Remember that this is mostly a non-issue, unless you are building * ucpp with a pre-C99 cross-compiler and either the host or target * architecture uses a non-two's complement representation of signed * integers. Such a combination is pretty rare nowadays, so the best * you can do is forgetting completely this paragraph and live in peace. * * * If you do not have a handy native type (for instance, you compile ucpp * with a C90 compiler which lacks the "long long" type, or you compile * ucpp for a cross-compiler which should support an evaluation integer * type of a size that is not available on the host machine), you may use * a simulated type. The type uses two's complement representation and * may have any width from 2 bits to twice the underlying native type * width, inclusive (odd widths are allowed). To use an emulated type, * make sure that NATIVE_SIGNED is not defined, and define the following * macros: * SIMUL_ARITH_SUBTYPE the native underlying type to use * SIMUL_SUBTYPE_BITS the native underlying type width * SIMUL_NUMBITS the emulated type width * * Undefined and implementation-defined behaviours are warned upon, if * ARITHMETIC_CHECKS is defined. Results are truncated to the type * width; shift count for the << and >> operators is reduced modulo the * emulatd type width; right shifting of a signed negative value performs * sign extension (the result is left-padded with bits set to 1). */ /* * For native type evaluation with a 64-bit "long long" type. */ #define NATIVE_SIGNED long long #define NATIVE_UNSIGNED unsigned long long #define NATIVE_UNSIGNED_BITS 64 #define NATIVE_SIGNED_MIN (-9223372036854775807LL - 1) #define NATIVE_SIGNED_MAX 9223372036854775807LL /* * For emulation of a 64-bit type using a native 32-bit "unsigned long" * type. #undef NATIVE_SIGNED #define SIMUL_ARITH_SUBTYPE unsigned long #define SIMUL_SUBTYPE_BITS 32 #define SIMUL_NUMBITS 64 */ /* * Comment out the following line if you want to deactivate arithmetic * checks (warnings upon undefined and implementation-defined * behaviour). Arithmetic checks slow down a bit arithmetic operations, * especially multiplications, but this should not be an issue with * typical C source code. */ #define ARITHMETIC_CHECKS /* ====================================================================== */ /* * To force signedness of wide character constants, define WCHAR_SIGNEDNESS * to 0 for unsigned, 1 for signed. By default, wide character constants * are signed if the native `char' type is signed, and unsigned otherwise. #define WCHAR_SIGNEDNESS 0 */ /* * Standard assertions. They should include one cpu() assertion, one machine() * assertion (identical to cpu()), and one or more system() assertions. * * for Linux/PC: cpu(i386), machine(i386), system(unix), system(linux) * for Linux/Alpha: cpu(alpha), machine(alpha), system(unix), system(linux) * for Sparc/Solaris: cpu(sparc), machine(sparc), system(unix), system(solaris) * * These are only suggestions. On Solaris, machine() should be defined * for i386 or sparc (standard system header use such an assertion). For * cross-compilation, define assertions related to the target architecture. * * If you want no standard assertion, define STD_ASSERT to 0. */ /* #define STD_ASSERT "cpu(i386)", "machine(i386)", "system(unix)", \ "system(freebsd)" */ /* ====================================================================== */ /* * System predefined macros. Nothing really mandatory, but some programs * might rely on those. * Each string must be either "name" or "name=token-list". If you want * no predefined macro, define STD_MACROS to 0. */ /* #define STD_MACROS "__FreeBSD=4", "__unix", "__i386", \ "__FreeBSD__=4", "__unix__", "__i386__" */ /* ====================================================================== */ /* * Default flags; HANDLE_ASSERTIONS is required for Solaris system headers. * See cpp.h for the definition of these flags. */ #define DEFAULT_CPP_FLAGS (DISCARD_COMMENTS | WARN_STANDARD \ | WARN_PRAGMA | FAIL_SHARP | MACRO_VAARG \ | CPLUSPLUS_COMMENTS | LINE_NUM | TEXT_OUTPUT \ | KEEP_OUTPUT | HANDLE_TRIGRAPHS \ | HANDLE_ASSERTIONS) #define DEFAULT_LEXER_FLAGS (DISCARD_COMMENTS | WARN_STANDARD | FAIL_SHARP \ | MACRO_VAARG | CPLUSPLUS_COMMENTS | LEXER \ | HANDLE_TRIGRAPHS | HANDLE_ASSERTIONS) /* ====================================================================== */ /* * Define this to use sigsetjmp()/siglongjmp() instead of setjmp()/longjmp(). * This is non-ANSI, but it improves performance on some POSIX system. * On typical C source code, such improvement is completely negligeable. */ /* #define POSIX_JMP */ /* ====================================================================== */ /* * Maximum value (plus one) of a character handled by the lexer; 128 is * alright for ASCII native source code, but 256 is needed for EBCDIC. * 256 is safe in both cases; you will have big problems if you set * this value to INT_MAX or above. On Minix-i86 or Msdos (small memory * model), define MAX_CHAR_VAL to 128. * * Set MAX_CHAR_VAL to a power of two to increase lexing speed. Beware * that lexer.c defines a static array of size MSTATE * MAX_CHAR_VAL * values of type int (MSTATE is defined in lexer.c and is about 40). */ #define MAX_CHAR_VAL 128 /* * If you want some extra character to be considered as whitespace, * define this macro to that space. On ISO-8859-1 machines, 160 is * the code for the unbreakable space. */ /* #define UNBREAKABLE_SPACE 160 */ /* * If you want whitespace tokens contents to be recorded (making them * tokens with a string content), define this. The macro STRING_TOKEN * will be adjusted accordingly. * Without this option, whitespace tokens are not even returned by the * lex() function. This is irrelevant for the non-lexer mode (almost -- * it might slow down a bit ucpp, and with this option, comments will be * kept inside #pragma directives). */ #define SEMPER_FIDELIS /* * Some additions to the preprocessor that may or may not make it into mainline. */ #define SYNOPSIS #endif /* End of options overridable by UCPP_CONFIG and config.h */ /* ====================================================================== */ /* * Some constants used for memory increment granularity. Increasing these * values reduces the number of calls to malloc() but increases memory * consumption. * * Values should be powers of 2. */ /* for cpp.c */ #define COPY_LINE_LENGTH 80 #define INPUT_BUF_MEMG 8192 #define OUTPUT_BUF_MEMG 8192 #define TOKEN_NAME_MEMG 64 /* must be at least 4 */ #define TOKEN_LIST_MEMG 32 #define INCPATH_MEMG 16 #define GARBAGE_LIST_MEMG 32 #define LS_STACK_MEMG 4 #define FNAME_MEMG 32 /* ====================================================================== */ /* To protect the innocent. */ #if defined(NO_UCPP_BUF) && defined(UCPP_MMAP) #undef UCPP_MMAP #endif #if defined(UCPP_MMAP) || defined(POSIX_JMP) #ifndef _POSIX_SOURCE #define _POSIX_SOURCE 1 #endif #endif /* * C90 does not know about the "inline" keyword, but C99 does know, * and some C90 compilers know it as an extension. This part detects * these occurrences. */ #ifndef INLINE #if __STDC__ && __STDC_VERSION__ >= 199901L /* this is a C99 compiler, keep inline unchanged */ #elif defined(__GNUC__) /* this is GNU gcc; modify inline. The semantics is not identical to C99 but the differences are irrelevant as long as inline functions are static */ #undef inline #define inline __inline__ #elif defined(__DECC) && defined(__linux__) /* this is Compaq C under Linux, use __inline__ */ #undef inline #define inline __inline__ #else /* unknown compiler -> deactivate inline */ #undef inline #define inline #endif #else /* INLINE has been set, use its value */ #undef inline #define inline INLINE #endif #endif synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/configure0000775000076400007640000042113311171624002021523 0ustar stefanstefan#! /bin/sh # From configure.ac Revision: 1.10 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for ucpp 1.0. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ucpp' PACKAGE_TARNAME='ucpp' PACKAGE_VERSION='1.0' PACKAGE_STRING='ucpp 1.0' PACKAGE_BUGREPORT='synopsis-devel@fresco.org' ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP CXX CXXFLAGS ac_ct_CXX SYN_CPP SYN_LIBS PYTHON PYTHON_INCLUDE LIBEXT LDSHARED topdir LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP CXX CXXFLAGS CCC' # 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. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_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 ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_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'` 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 ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_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'` 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; }; } 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 directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $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 test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures ucpp 1.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/ucpp] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of ucpp 1.0:";; esac cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-syn-cxx=PATH specify the Synopsis C++ library prefix --with-python=PATH specify the Python interpreter Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF ucpp configure 1.0 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by ucpp $as_me 1.0, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file 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 $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { 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 # Check whether --with-syn-cxx was given. if test "${with_syn_cxx+set}" = set; then withval=$with_syn_cxx; SYN_CXX="$with_syn_cxx" else SYN_CXX="/usr/local" 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { 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` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then 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 # Check that 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' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 that 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 { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { 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 ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { 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` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { 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 ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { 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 g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { 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 if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { 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 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 SYN_CPP="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --cflags synopsis-uninstalled`" SYN_LIBS="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --libs synopsis-uninstalled`" { echo "$as_me:$LINENO: checking for python extension module build information" >&5 echo $ECHO_N "checking for python extension module build information... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: " >&5 echo "${ECHO_T}" >&6; } # Check whether --with-python was given. if test "${with_python+set}" = set; then withval=$with_python; PYTHON="$with_python" else PYTHON="python" fi if test -n "$PYTHON" -a "$PYTHON" != yes; then # Extract the first word of "$PYTHON", so it can be a program name with args. set dummy $PYTHON; 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_PYTHON+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$PYTHON"; then ac_cv_prog_PYTHON="$PYTHON" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PYTHON="{ { echo "$as_me:$LINENO: error: Cannot find Python interpreter" >&5 echo "$as_me: error: Cannot find Python interpreter" >&2;} { (exit 1); exit 1; }; }" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PYTHON=$ac_cv_prog_PYTHON if test -n "$PYTHON"; then { echo "$as_me:$LINENO: result: $PYTHON" >&5 echo "${ECHO_T}$PYTHON" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi else # Extract the first word of "python2 python", so it can be a program name with args. set dummy python2 python; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_PYTHON+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $PYTHON in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_PYTHON" && ac_cv_path_PYTHON="python" ;; esac fi PYTHON=$ac_cv_path_PYTHON if test -n "$PYTHON"; then { echo "$as_me:$LINENO: result: $PYTHON" >&5 echo "${ECHO_T}$PYTHON" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi PYTHON_PREFIX=`$PYTHON -c "import sys; print(sys.prefix)" | tr -d "\r"` { echo "$as_me:$LINENO: checking for Python development environment" >&5 echo $ECHO_N "checking for Python development environment... $ECHO_C" >&6; } PYTHON_INCLUDE=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_inc())" | tr -d "\r"` PYTHON_H=`$PYTHON -c "from os.path import *; h = join('$PYTHON_INCLUDE', 'Python.h'); print(exists(h) and h or '')"` if test $PYTHON_H then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else { { echo "$as_me:$LINENO: error: Python.h not found." >&5 echo "$as_me: error: Python.h not found." >&2;} { (exit 1); exit 1; }; } fi LIBEXT=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_var('SO'))" | tr -d "\r"` case `uname -s` in CYGWIN*) if test `$PYTHON -c "import os; print(os.name)" | tr -d "\r"` = posix; then PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d'%(sys.version_info[0],sys.version_info[1]))"` PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" PYTHON_DEP_LIBS=`$PYTHON -c "from distutils import sysconfig; import re; print(re.sub(r'\\s*-lutil', '', sysconfig.get_config_var('LIBS') or ''))"` else if test "$CXX" = "g++"; then CPPFLAGS="$CPPFLAGS -D PARSE_MSVC" CFLAGS="-mno-cygwin $CFLAGS" CXXFLAGS="-mno-cygwin $CXXFLAGS" LDFLAGS="-mno-cygwin $LDFLAGS" PYTHON_VERSION=`$PYTHON -c "import sys; print('%d%d'%(sys.version_info[0],sys.version_info[1]))" | tr -d "\r"` PYTHON_LIBS="-L`cygpath -a $PYTHON_PREFIX | tr -d \"\r\"`/Libs -lpython$PYTHON_VERSION" fi PYTHON_INCLUDE=`cygpath -a $PYTHON_INCLUDE | tr -d "\r"` PYTHON_DEP_LIBS=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_var('LIBS') or '')" | tr -d "\r"` fi LDSHARED="$CXX -shared" CXXFLAGS="-D_REENTRANT $CXXFLAGS" LIBS="$LIBS $PYTHON_LIBS $PYTHON_DEP_LIBS" ;; Darwin) PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d'%(sys.version_info[0],sys.version_info[1]))"` PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" CFLAGS="$CFLAGS -fPIC" CXXFLAGS="$CXXFLAGS -fPIC" LDSHARED="$CXX -dynamiclib -Wl,-undefined,dynamic_lookup" ;; *) PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d'%(sys.version_info[0],sys.version_info[1]))"` PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" CFLAGS="$CFLAGS -fPIC" CXXFLAGS="$CXXFLAGS -fPIC" LDSHARED="$CXX -shared" ;; esac topdir=`$PYTHON -c "from os.path import *; print normpath('$srcdir/../../../..')"` ac_config_files="$ac_config_files Makefile synopsis.py" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${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 more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by ucpp $as_me 1.0, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" _ACEOF 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 and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ ucpp config.status 1.0 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' _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 ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "synopsis.py") CONFIG_FILES="$CONFIG_FILES synopsis.py" ;; *) { { 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 fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for 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 _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim CPP!$CPP$ac_delim CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim ac_ct_CXX!$ac_ct_CXX$ac_delim SYN_CPP!$SYN_CPP$ac_delim SYN_LIBS!$SYN_LIBS$ac_delim PYTHON!$PYTHON$ac_delim PYTHON_INCLUDE!$PYTHON_INCLUDE$ac_delim LIBEXT!$LIBEXT$ac_delim LDSHARED!$LDSHARED$ac_delim topdir!$topdir$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 57; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF 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&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; esac done # for ac_tag { (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 synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/mem.c0000664000076400007640000001567111163213145020547 0ustar stefanstefan/* * Memory manipulation routines * (c) Thomas Pornin 1998 - 2002 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. The name of the authors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #include "mem.h" #include #include #include /* * Shifting a pointer of that some bytes is supposed to satisfy * alignment requirements. This is *not* guaranteed by the standard * but should work everywhere anyway. */ #define ALIGNSHIFT (sizeof(long) > sizeof(long double) \ ? sizeof(long) : sizeof(long double)) #ifdef AUDIT void die(void) { abort(); } static void suicide(unsigned long e) { fprintf(stderr, "ouch: Schrodinger's beef is not dead ! %lx\n", e); die(); } #else void die(void) { exit(EXIT_FAILURE); } #endif #if defined AUDIT || defined MEM_CHECK || defined MEM_DEBUG /* * This function is equivalent to a malloc(), but will display an error * message and exit if the wanted memory is not available */ #ifdef MEM_DEBUG static void *getmem_raw(size_t x) #else void *(getmem)(size_t x) #endif { void *m; #ifdef AUDIT m = malloc(x + ALIGNSHIFT); #else m = malloc(x); #endif if (m == 0) { fprintf(stderr, "ouch: malloc() failed\n"); die(); } #ifdef AUDIT *((unsigned long *)m) = 0xdeadbeefUL; return (void *)(((char *)m) + ALIGNSHIFT); #else return m; #endif } #endif #ifndef MEM_DEBUG /* * This function is equivalent to a realloc(); if the realloc() call * fails, it will try a malloc() and a memcpy(). If not enough memory is * available, the program exits with an error message */ void *(incmem)(void *m, size_t x, size_t nx) { void *nm; #ifdef AUDIT m = (void *)(((char *)m) - ALIGNSHIFT); if (*((unsigned long *)m) != 0xdeadbeefUL) suicide(*((unsigned long *)m)); x += ALIGNSHIFT; nx += ALIGNSHIFT; #endif if (!(nm = realloc(m, nx))) { if (x > nx) x = nx; nm = (getmem)(nx); memcpy(nm, m, x); /* free() and not freemem(), because of the Schrodinger beef */ free(m); } #ifdef AUDIT return (void *)(((char *)nm) + ALIGNSHIFT); #else return nm; #endif } #endif #if defined AUDIT || defined MEM_DEBUG /* * This function frees the given block */ #ifdef MEM_DEBUG static void freemem_raw(void *x) #else void (freemem)(void *x) #endif { #ifdef AUDIT void *y = (void *)(((char *)x) - ALIGNSHIFT); if ((*((unsigned long *)y)) != 0xdeadbeefUL) suicide(*((unsigned long *)y)); *((unsigned long *)y) = 0xfeedbabeUL; free(y); #else free(x); #endif } #endif #ifdef AUDIT /* * This function copies n bytes from src to dest */ void *mmv(void *dest, void *src, size_t n) { return memcpy(dest, src, n); } /* * This function copies n bytes from src to dest */ void *mmvwo(void *dest, void *src, size_t n) { return memmove(dest, src, n); } #endif #ifndef MEM_DEBUG /* * This function creates a new char * and fills it with a copy of src */ char *(sdup)(char *src) { size_t n = 1 + strlen(src); char *x = getmem(n); mmv(x, src, n); return x; } #endif #ifdef MEM_DEBUG /* * We include here special versions of getmem(), freemem() and incmem() * that track allocations and are used to detect memory leaks. * * Each allocation is referenced in a list, with a serial number. */ /* * Define "true" functions for applications that need pointers * to such functions. */ void *(getmem)(size_t n) { return getmem(n); } void (freemem)(void *x) { freemem(x); } void *(incmem)(void *x, size_t s, size_t ns) { return incmem(x, s, ns); } char *(sdup)(char *s) { return sdup(s); } static long current_serial = 0L; /* must be a power of two */ #define MEMDEBUG_MEMG 128U static struct mem_track { void *block; long serial; char *file; int line; } *mem = 0; static size_t meml = 0; static unsigned int current_ptr = 0; static void *true_incmem(void *x, size_t old_size, size_t new_size) { void * y = realloc(x, new_size); if (y == 0) { y = malloc(new_size); if (y == 0) { fprintf(stderr, "ouch: malloc() failed\n"); die(); } mmv(y, x, old_size < new_size ? old_size : new_size); free(x); } return y; } static long find_free_block(void) { unsigned int n; size_t i; for (i = 0, n = current_ptr; i < meml; i ++) { if (mem[n].block == 0) { current_ptr = n; return n; } n = (n + 1) & (meml - 1U); } if (meml == 0) { size_t j; meml = MEMDEBUG_MEMG; mem = malloc(meml * sizeof(struct mem_track)); current_ptr = 0; for (j = 0; j < meml ; j ++) mem[j].block = 0; } else { size_t j; mem = true_incmem(mem, meml * sizeof(struct mem_track), 2 * meml * sizeof(struct mem_track)); current_ptr = meml; for (j = meml; j < 2 * meml ; j ++) mem[j].block = 0; meml *= 2; } return current_ptr; } void *getmem_debug(size_t n, char *file, int line) { void *x = getmem_raw(n + ALIGNSHIFT); long i = find_free_block(); *(long *)x = i; mem[i].block = x; mem[i].serial = current_serial ++; mem[i].file = file; mem[i].line = line; return (void *)((unsigned char *)x + ALIGNSHIFT); } void freemem_debug(void *x, char *file, int line) { void *y = (unsigned char *)x - ALIGNSHIFT; long i = *(long *)y; if (i < 0 || (size_t)i >= meml || mem[i].block != y) { fprintf(stderr, "ouch: freeing free people (from %s:%d)\n", file, line); die(); } mem[i].block = 0; freemem_raw(y); } void *incmem_debug(void *x, size_t ol, size_t nl, char *file, int line) { void *y = getmem_debug(nl, file, line); mmv(y, x, ol < nl ? ol : nl); freemem_debug(x, file, line); return y; } char *sdup_debug(char *src, char *file, int line) { size_t n = 1 + strlen(src); char *x = getmem_debug(n, file, line); mmv(x, src, n); return x; } void report_leaks(void) { size_t i; for (i = 0; i < meml; i ++) { if (mem[i].block) fprintf(stderr, "leak: serial %ld, %s:%d\n", mem[i].serial, mem[i].file, mem[i].line); } } #endif synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/eval.c0000664000076400007640000004203611163213153020712 0ustar stefanstefan/* * (c) Thomas Pornin 1999 - 2002 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. The name of the authors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #include "tune.h" #include #include #include #include #include "ucppi.h" #include "mem.h" JMP_BUF eval_exception; long eval_line; static int emit_eval_warnings; /* * If you want to hardcode a conversion table, define a static array * of 256 int, and make transient_characters point to it. */ int *transient_characters = 0; #define OCTAL(x) ((x) >= '0' && (x) <= '7') #define DECIM(x) ((x) >= '0' && (x) <= '9') #define HEXAD(x) (DECIM(x) \ || (x) == 'a' || (x) == 'b' || (x) == 'c' \ || (x) == 'd' || (x) == 'e' || (x) == 'f' \ || (x) == 'A' || (x) == 'B' || (x) == 'C' \ || (x) == 'D' || (x) == 'E' || (x) == 'F') #define OVAL(x) ((int)((x) - '0')) #define DVAL(x) ((int)((x) - '0')) #define HVAL(x) (DECIM(x) ? DVAL(x) \ : (x) == 'a' || (x) == 'A' ? 10 \ : (x) == 'b' || (x) == 'B' ? 11 \ : (x) == 'c' || (x) == 'C' ? 12 \ : (x) == 'd' || (x) == 'D' ? 13 \ : (x) == 'e' || (x) == 'E' ? 14 : 15) #define ARITH_TYPENAME big #define ARITH_FUNCTION_HEADER static inline #define ARITH_ERROR(type) z_error(type) static void z_error(int type); #ifdef ARITHMETIC_CHECKS #define ARITH_WARNING(type) z_warn(type) static void z_warn(int type); #endif #include "arith.c" static void z_error(int type) { switch (type) { case ARITH_EXCEP_SLASH_D: error(eval_line, "division by 0"); break; case ARITH_EXCEP_SLASH_O: error(eval_line, "overflow on division"); break; case ARITH_EXCEP_PCT_D: error(eval_line, "division by 0 on modulus operator"); break; case ARITH_EXCEP_CONST_O: error(eval_line, "constant too large for destination type"); break; #ifdef AUDIT default: ouch("erroneous integer error: %d", type); #endif } throw(eval_exception); } #ifdef ARITHMETIC_CHECKS static void z_warn(int type) { switch (type) { case ARITH_EXCEP_CONV_O: warning(eval_line, "overflow on integer conversion"); break; case ARITH_EXCEP_NEG_O: warning(eval_line, "overflow on unary minus"); break; case ARITH_EXCEP_NOT_T: warning(eval_line, "bitwise inversion yields trap representation"); break; case ARITH_EXCEP_PLUS_O: warning(eval_line, "overflow on addition"); break; case ARITH_EXCEP_PLUS_U: warning(eval_line, "underflow on addition"); break; case ARITH_EXCEP_MINUS_O: warning(eval_line, "overflow on subtraction"); break; case ARITH_EXCEP_MINUS_U: warning(eval_line, "underflow on subtraction"); break; case ARITH_EXCEP_AND_T: warning(eval_line, "bitwise AND yields trap representation"); break; case ARITH_EXCEP_XOR_T: warning(eval_line, "bitwise XOR yields trap representation"); break; case ARITH_EXCEP_OR_T: warning(eval_line, "bitwise OR yields trap representation"); break; case ARITH_EXCEP_LSH_W: warning(eval_line, "left shift count greater than " "or equal to type width"); break; case ARITH_EXCEP_LSH_C: warning(eval_line, "left shift count negative"); break; case ARITH_EXCEP_LSH_O: warning(eval_line, "overflow on left shift"); break; case ARITH_EXCEP_RSH_W: warning(eval_line, "right shift count greater than " "or equal to type width"); break; case ARITH_EXCEP_RSH_C: warning(eval_line, "right shift count negative"); break; case ARITH_EXCEP_RSH_N: warning(eval_line, "right shift of negative value"); break; case ARITH_EXCEP_STAR_O: warning(eval_line, "overflow on multiplication"); break; case ARITH_EXCEP_STAR_U: warning(eval_line, "underflow on multiplication"); break; #ifdef AUDIT default: ouch("erroneous integer warning: %d", type); #endif } } #endif typedef struct { int sign; union { u_big uv; s_big sv; } u; } ppval; static int boolval(ppval x) { return x.sign ? big_s_lval(x.u.sv) : big_u_lval(x.u.uv); } #if !defined(WCHAR_SIGNEDNESS) # if CHAR_MIN == 0 # define WCHAR_SIGNEDNESS 0 # else # define WCHAR_SIGNEDNESS 1 # endif #endif /* * Check the suffix, return 1 if it is signed, 0 otherwise. 1 is * returned for a void suffix. Legal suffixes are: * unsigned: u U ul uL Ul UL lu Lu lU LU ull uLL Ull ULL llu LLu llU LLU * signed: l L ll LL */ static int pp_suffix(char *d, char *refc) { if (!*d) return 1; if (*d == 'u' || *d == 'U') { if (!*(++ d)) return 0; if (*d == 'l' || *d == 'L') { char *e = d + 1; if (*e && *e != *d) goto suffix_error; if (!*e || !*(e + 1)) return 0; goto suffix_error; } goto suffix_error; } if (*d == 'l' || *d == 'L') { if (!*(++ d)) return 1; if (*d == *(d - 1)) { d ++; if (!*d) return 1; } if (*d == 'u' || *d == 'U') { d ++; if (!*d) return 0; } goto suffix_error; } suffix_error: error(eval_line, "invalid integer constant '%s'", refc); throw(eval_exception); return 666; } static unsigned long pp_char(char *c, char *refc) { unsigned long r = 0; c ++; if (*c == '\\') { int i; c ++; switch (*c) { case 'n': r = '\n'; c ++; break; case 't': r = '\t'; c ++; break; case 'v': r = '\v'; c ++; break; case 'b': r = '\b'; c ++; break; case 'r': r = '\r'; c ++; break; case 'f': r = '\f'; c ++; break; case 'a': r = '\a'; c ++; break; case '\\': r = '\\'; c ++; break; case '\?': r = '\?'; c ++; break; case '\'': r = '\''; c ++; break; case '\"': r = '\"'; c ++; break; case 'u': for (i = 0, c ++; i < 4 && HEXAD(*c); i ++, c ++) { r = (r * 16) + HVAL(*c); } if (i != 4) { error(eval_line, "malformed UCN in %s", refc); throw(eval_exception); } break; case 'U': for (i = 0, c ++; i < 8 && HEXAD(*c); i ++, c ++) { r = (r * 16) + HVAL(*c); } if (i != 8) { error(eval_line, "malformed UCN in %s", refc); throw(eval_exception); } break; case 'x': for (c ++; HEXAD(*c); c ++) r = (r * 16) + HVAL(*c); break; default: if (OCTAL(*c)) { r = OVAL(*(c ++)); if (OCTAL(*c)) r = (r * 8) + OVAL(*(c ++)); if (OCTAL(*c)) r = (r * 8) + OVAL(*(c ++)); } else { error(eval_line, "invalid escape sequence " "'\\%c'", *c); throw(eval_exception); } } } else if (*c == '\'') { error(eval_line, "empty character constant"); throw(eval_exception); } else { r = *((unsigned char *)(c ++)); } if (transient_characters && r < 256) { r = transient_characters[(size_t)r]; } if (*c != '\'' && emit_eval_warnings) { warning(eval_line, "multicharacter constant"); } return r; } static ppval pp_strtoconst(char *refc) { ppval q; char *c = refc, *d; u_big ru; s_big rs; int sp, dec; if (*c == '\'' || *c == 'L') { q.sign = (*c == 'L') ? WCHAR_SIGNEDNESS : 1; if (*c == 'L' && *(++ c) != '\'') { error(eval_line, "invalid wide character constant: %s", refc); throw(eval_exception); } if (q.sign) { q.u.sv = big_s_fromlong(pp_char(c, refc)); } else { q.u.uv = big_u_fromulong(pp_char(c, refc)); } return q; } if (*c == '0') { /* octal or hexadecimal */ dec = 0; c ++; if (*c == 'x' || *c == 'X') { c ++; d = big_u_hexconst(c, &ru, &rs, &sp); } else { d = big_u_octconst(c, &ru, &rs, &sp); } } else { dec = 1; d = big_u_decconst(c, &ru, &rs, &sp); } q.sign = pp_suffix(d, refc); if (q.sign) { if (!sp) { if (dec) { error(eval_line, "constant too large " "for destination type"); throw(eval_exception); } else { warning(eval_line, "constant is so large " "that it is unsigned"); } q.u.uv = ru; q.sign = 0; } else { q.u.sv = rs; } } else { q.u.uv = ru; } return q; } /* * Used by #line directives -- anything beyond what can be put in an * unsigned long, is considered absurd. */ unsigned long strtoconst(char *c) { ppval q = pp_strtoconst(c); if (q.sign) q.u.uv = big_s_to_u(q.u.sv); return big_u_toulong(q.u.uv); } #define OP_UN(x) ((x) == LNOT || (x) == NOT || (x) == UPLUS \ || (x) == UMINUS) static ppval eval_opun(int op, ppval v) { if (op == LNOT) { v.sign = 1; v.u.sv = big_s_fromint(big_s_lnot(v.u.sv)); return v; } if (v.sign) { switch (op) { case NOT: v.u.sv = big_s_not(v.u.sv); break; case UPLUS: break; case UMINUS: v.u.sv = big_s_neg(v.u.sv); break; } } else { switch (op) { case NOT: v.u.uv = big_u_not(v.u.uv); break; case UPLUS: break; case UMINUS: v.u.uv = big_u_neg(v.u.uv); break; } } return v; } #define OP_BIN(x) ((x) == STAR || (x) == SLASH || (x) == PCT \ || (x) == PLUS || (x) == MINUS || (x) == LSH \ || (x) == RSH || (x) == LT || (x) == LEQ \ || (x) == GT || (x) == GEQ || (x) == SAME \ || (x) == NEQ || (x) == AND || (x) == CIRC \ || (x) == OR || (x) == LAND || (x) == LOR \ || (x) == COMMA) static ppval eval_opbin(int op, ppval v1, ppval v2) { ppval r; int iv2 = 0; switch (op) { case STAR: case SLASH: case PCT: case PLUS: case MINUS: case AND: case CIRC: case OR: /* promote operands, adjust signedness of result */ if (!v1.sign || !v2.sign) { if (v1.sign) { v1.u.uv = big_s_to_u(v1.u.sv); v1.sign = 0; } else if (v2.sign) { v2.u.uv = big_s_to_u(v2.u.sv); v2.sign = 0; } r.sign = 0; } else { r.sign = 1; } break; case LT: case LEQ: case GT: case GEQ: case SAME: case NEQ: /* promote operands */ if (!v1.sign || !v2.sign) { if (v1.sign) { v1.u.uv = big_s_to_u(v1.u.sv); v1.sign = 0; } else if (v2.sign) { v2.u.uv = big_s_to_u(v2.u.sv); v2.sign = 0; } } /* fall through */ case LAND: case LOR: /* result is signed anyway */ r.sign = 1; break; case LSH: case RSH: /* result is as signed as left operand; convert right operand to int */ r.sign = v1.sign; if (v2.sign) { iv2 = big_s_toint(v2.u.sv); } else { iv2 = big_u_toint(v2.u.uv); } break; case COMMA: if (emit_eval_warnings) { warning(eval_line, "ISO C forbids evaluated comma " "operators in #if expressions"); } r.sign = v2.sign; break; #ifdef AUDIT default: ouch("a good operator is a dead operator"); #endif } #define SBINOP(x) if (r.sign) r.u.sv = big_s_ ## x (v1.u.sv, v2.u.sv); \ else r.u.uv = big_u_ ## x (v1.u.uv, v2.u.uv); #define NSSBINOP(x) if (v1.sign) r.u.sv = big_s_fromint(big_s_ ## x \ (v1.u.sv, v2.u.sv)); else r.u.sv = big_s_fromint( \ big_u_ ## x (v1.u.uv, v2.u.uv)); #define LBINOP(x) if (v1.sign) r.u.sv = big_s_fromint( \ big_s_lval(v1.u.sv) x big_s_lval(v2.u.sv)); \ else r.u.sv = big_s_fromint( \ big_u_lval(v1.u.uv) x big_u_lval(v2.u.uv)); #define ABINOP(x) if (r.sign) r.u.sv = big_s_ ## x (v1.u.sv, iv2); \ else r.u.uv = big_u_ ## x (v1.u.uv, iv2); switch (op) { case STAR: SBINOP(star); break; case SLASH: SBINOP(slash); break; case PCT: SBINOP(pct); break; case PLUS: SBINOP(plus); break; case MINUS: SBINOP(minus); break; case LSH: ABINOP(lsh); break; case RSH: ABINOP(rsh); break; case LT: NSSBINOP(lt); break; case LEQ: NSSBINOP(leq); break; case GT: NSSBINOP(gt); break; case GEQ: NSSBINOP(geq); break; case SAME: NSSBINOP(same); break; case NEQ: NSSBINOP(neq); break; case AND: SBINOP(and); break; case CIRC: SBINOP(xor); break; case OR: SBINOP(or); break; case LAND: LBINOP(&&); break; case LOR: LBINOP(||); break; case COMMA: r = v2; break; } return r; } #define ttOP(x) (OP_UN(x) || OP_BIN(x) || (x) == QUEST || (x) == COLON) static int op_prec(int op) { switch (op) { case LNOT: case NOT: case UPLUS: case UMINUS: return 13; case STAR: case SLASH: case PCT: return 12; case PLUS: case MINUS: return 11; case LSH: case RSH: return 10; case LT: case LEQ: case GT: case GEQ: return 9; case SAME: case NEQ: return 8; case AND: return 7; case CIRC: return 6; case OR: return 5; case LAND: return 4; case LOR: return 3; case QUEST: return 2; case COMMA: return 1; } #ifdef AUDIT ouch("an unknown species should have a higher precedence"); #endif return 666; } /* * Perform the hard work of evaluation. * * This function works because: * -- all unary operators are right to left associative, and with * identical precedence * -- all binary operators are left to right associative * -- there is only one non-unary and non-binary operator: the quest-colon * * If do_eval is 0, the evaluation of operators is not done. This is * for sequence point operators (&&, || and ?:). */ static ppval eval_shrd(struct token_fifo *tf, int minprec, int do_eval) { ppval top; struct token *ct; top.sign = 1; if (tf->art == tf->nt) goto trunc_err; ct = tf->t + (tf->art ++); if (ct->type == LPAR) { top = eval_shrd(tf, 0, do_eval); if (tf->art == tf->nt) goto trunc_err; ct = tf->t + (tf->art ++); if (ct->type != RPAR) { error(eval_line, "a right parenthesis was expected"); throw(eval_exception); } } else if (ct->type == NUMBER || ct->type == CHAR) { top = pp_strtoconst(ct->name); } else if (OP_UN(ct->type)) { top = eval_opun(ct->type, eval_shrd(tf, op_prec(ct->type), do_eval)); goto eval_loop; } else if (ttOP(ct->type)) goto rogue_op_err; else { goto invalid_token_err; } eval_loop: if (tf->art == tf->nt) { return top; } ct = tf->t + (tf->art ++); if (OP_BIN(ct->type)) { int bp = op_prec(ct->type); if (bp > minprec) { ppval tr; if ((ct->type == LOR && boolval(top)) || (ct->type == LAND && !boolval(top))) { tr = eval_shrd(tf, bp, 0); if (do_eval) { top.sign = 1; if (ct->type == LOR) top.u.sv = big_s_fromint(1); if (ct->type == LAND) top.u.sv = big_s_fromint(0); } } else { tr = eval_shrd(tf, bp, do_eval); if (do_eval) top = eval_opbin(ct->type, top, tr); } goto eval_loop; } } else if (ct->type == QUEST) { int bp = op_prec(QUEST); ppval r1, r2; if (bp >= minprec) { int qv = boolval(top); r1 = eval_shrd(tf, bp, qv ? do_eval : 0); if (tf->art == tf->nt) goto trunc_err; ct = tf->t + (tf->art ++); if (ct->type != COLON) { error(eval_line, "a colon was expected"); throw(eval_exception); } r2 = eval_shrd(tf, bp, qv ? 0 : do_eval); if (do_eval) { if (qv) top = r1; else top = r2; } goto eval_loop; } } tf->art --; return top; trunc_err: error(eval_line, "truncated constant integral expression"); throw(eval_exception); rogue_op_err: error(eval_line, "rogue operator '%s' in constant integral " "expression", operators_name[ct->type]); throw(eval_exception); invalid_token_err: error(eval_line, "invalid token in constant integral expression"); throw(eval_exception); } #define UNARY(x) ((x) != NUMBER && (x) != NAME && (x) != CHAR \ && (x) != RPAR) /* * Evaluate the integer expression contained in the given token_fifo. * Evaluation is made by precedence of operators, as described in the * Dragon Book. The unary + and - are distinguished from their binary * counterparts using the Fortran way: a + or a - is considered unary * if it does not follow a constant, an identifier or a right parenthesis. */ unsigned long eval_expr(struct token_fifo *tf, int *ret, int ew) { size_t sart; ppval r; emit_eval_warnings = ew; if (catch(eval_exception)) goto eval_err; /* first, distinguish unary + and - from binary + and - */ for (sart = tf->art; tf->art < tf->nt; tf->art ++) { if (tf->t[tf->art].type == PLUS) { if (sart == tf->art || UNARY(tf->t[tf->art - 1].type)) tf->t[tf->art].type = UPLUS; } else if (tf->t[tf->art].type == MINUS) { if (sart == tf->art || UNARY(tf->t[tf->art - 1].type)) tf->t[tf->art].type = UMINUS; } } tf->art = sart; r = eval_shrd(tf, 0, 1); if (tf->art < tf->nt) { error(eval_line, "trailing garbage in constant integral " "expression"); goto eval_err; } *ret = 0; return boolval(r); eval_err: *ret = 1; return 0; } synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/Makefile.in,orig0000664000076400007640000000426211163215300022614 0ustar stefanstefan# # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # SHELL := /bin/sh srcdir := @srcdir@ PYTHON := @PYTHON@ SYNOPSIS:= $(PYTHON) synopsis.py CC := @CC@ CXX := @CXX@ LDSHARED:= @LDSHARED@ MAKEDEP := $(CXX) -M CPPFLAGS:= @CPPFLAGS@ -I $(srcdir) CPPFLAGS+= @SYN_CPP@ -I/usr/local/include -I @PYTHON_INCLUDE@ CFLAGS := @CFLAGS@ CXXFLAGS:= @CXXFLAGS@ LDFLAGS := @LDFLAGS@ LIBS := @SYN_LIBS@ @LIBS@ LIBRARY_EXT := @LIBEXT@ UCPP_FLAGS:= -DSEMPER_FIDELIS UCPP_FILES:= mem hashtable cpp lexer assert macro eval HDR := $(patsubst $(srcdir)/%, %, $(wildcard $(srcdir)/*.h)) SRC := $(patsubst %, %.c, $(UCPP_FILES)) ucpp.cc ParserImpl.cc OBJ := $(patsubst %, %.o, $(basename $(SRC))) HDR_SYN := $(patsubst %, %.syn, $(HDR)) CC_SYN := $(patsubst %, %.syn, $(SRC)) DEP := $(patsubst %.o, %.d, $(OBJ)) TARGET := ParserImpl$(LIBRARY_EXT) vpath %.c $(srcdir) vpath %.h $(srcdir) vpath %.cc $(srcdir) all: $(TARGET) doc: ucpp.syn ucpp-impl.syn # Link C++ files together ucpp.syn: $(HDR_SYN) @echo linking C++ headers together $(SYNOPSIS) link --output=$@ $^ ucpp-impl.syn: $(HDR_SYN) $(C_SYN) @echo linking all C++ files together $(SYNOPSIS) link --output=$@ $^ %.d: %.cc @echo generating dependencies for $( $@' %.d: %.c @echo generating dependencies for $( $@' %.o : %.cc @echo compiling $(@F) $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< %.o : %.c @echo compiling $(@F) $(CC) $(CPPFLAGS) $(CFLAGS) $(UCPP_FLAGS) -c -o $@ $< Makefile: $(srcdir)/Makefile.in ./config.status --file Makefile # Compile C++ .h files $(HDR_SYN): %.syn: % @echo parsing $^ mkdir -p $(dir $@) $(SYNOPSIS) cxx --output=$@ $? # Compile C++ .cc files $(CC_SYN): %.syn: % @echo parsing $^ mkdir -p $(dir $@) $(SYNOPSIS) cxx --output=$@ $? $(TARGET): $(OBJ) $(LDSHARED) $(LDFLAGS) -o $@ $^ $(LIBS) clean : rm -f *~ *.o $(TARGET) *.syn *.d *.pyc *.pyo base_lib ifeq (,$(filter $(MAKECMDGOALS), depend clean distclean)) -include $(DEP) endif synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/cpp.c0000664000076400007640000020611211171730621020545 0ustar stefanstefan/* * C and T preprocessor, and integrated lexer * (c) Thomas Pornin 1999 - 2002 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. The name of the authors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #define VERS_MAJ 1 #define VERS_MIN 3 /* uncomment the following if you cannot set it with a compiler flag */ /* #define STAND_ALONE */ #include "tune.h" #include #include #include #include #include #include #include #include "ucppi.h" #include "mem.h" #include "nhash.h" #ifdef UCPP_MMAP #include #include #include #include #endif /* * The standard path where includes are looked for. */ #ifdef STAND_ALONE static char *include_path_std[] = { STD_INCLUDE_PATH, 0 }; #endif static char **include_path; static size_t include_path_nb = 0; int no_special_macros = 0; int emit_dependencies = 0, emit_defines = 0, emit_assertions = 0; FILE *emit_output; #ifdef STAND_ALONE static char *system_macros_def[] = { STD_MACROS, 0 }; static char *system_assertions_def[] = { STD_ASSERT, 0 }; #endif char *current_filename = 0, *current_long_filename = 0; static int current_incdir = -1; #ifdef SYNOPSIS void synopsis_macro_hook(const char* name, int start_line, int start_col, int end_line, int end_col, int e_start_line, int e_start_col, int e_end_line, int e_end_col); void synopsis_include_hook(const char* source_file, const char* target_file, const char *fname, int system, int is_macro, int is_next); void synopsis_file_hook(const char* file, int new_file); #endif /* * send a reduced whitespace token to the output */ static void print_newline(struct lexer_state *ls) { struct token t; t.type = NEWLINE; t.name = "\n"; t.line = ls->line; print_token(ls, &t, 0); } #ifndef NO_UCPP_ERROR_FUNCTIONS /* * "ouch" is the name for an internal ucpp error. If AUDIT is not defined, * no code calling this function will be generated; a "ouch" may still be * emitted by getmem() (in mem.c) if MEM_CHECK is defined, but this "ouch" * does not use this function. */ void ucpp_ouch(char *fmt, ...) { va_list ap; va_start(ap, fmt); fprintf(stderr, "%s: ouch, ", current_filename); vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); va_end(ap); die(); } /* * report an error, with current_filename, line, and printf-like syntax */ void ucpp_error(long line, char *fmt, ...) { va_list ap; va_start(ap, fmt); if (line > 0) fprintf(stderr, "%s: line %ld: ", current_filename, line); else if (line == 0) fprintf(stderr, "%s: ", current_filename); vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); if (line >= 0) { struct stack_context *sc = report_context(); size_t i; for (i = 0; sc[i].line >= 0; i ++) fprintf(stderr, "\tincluded from %s:%ld\n", sc[i].long_name ? sc[i].long_name : sc[i].name, sc[i].line); freemem(sc); } va_end(ap); } /* * like error(), with the mention "warning" */ void ucpp_warning(long line, char *fmt, ...) { va_list ap; va_start(ap, fmt); if (line > 0) fprintf(stderr, "%s: warning: line %ld: ", current_filename, line); else if (line == 0) fprintf(stderr, "%s: warning: ", current_filename); else fprintf(stderr, "warning: "); vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); if (line >= 0) { struct stack_context *sc = report_context(); size_t i; for (i = 0; sc[i].line >= 0; i ++) fprintf(stderr, "\tincluded from %s:%ld\n", sc[i].long_name ? sc[i].long_name : sc[i].name, sc[i].line); freemem(sc); } va_end(ap); } #endif /* NO_UCPP_ERROR_FUNCTIONS */ /* * Some memory allocations are manually garbage-collected; essentially, * strings duplicated in the process of macro replacement. Each such * string is referenced in the garbage_fifo, which is cleared when all * nested macros have been resolved. */ struct garbage_fifo { char **garbage; size_t ngarb, memgarb; }; /* * throw_away() marks a string to be collected later */ void throw_away(struct garbage_fifo *gf, char *n) { wan(gf->garbage, gf->ngarb, n, gf->memgarb); } /* * free marked strings */ void garbage_collect(struct garbage_fifo *gf) { size_t i; for (i = 0; i < gf->ngarb; i ++) freemem(gf->garbage[i]); gf->ngarb = 0; } static void init_garbage_fifo(struct garbage_fifo *gf) { gf->garbage = getmem((gf->memgarb = GARBAGE_LIST_MEMG) * sizeof(char *)); gf->ngarb = 0; } static void free_garbage_fifo(struct garbage_fifo *gf) { garbage_collect(gf); freemem(gf->garbage); freemem(gf); } /* * order is important: it must match the token-constants declared as an * enum in the header file. */ char *operators_name[] = { " ", "\n", " ", "0000", "name", "bunch", "pragma", "context", "\"dummy string\"", "'dummy char'", "/", "/=", "-", "--", "-=", "->", "+", "++", "+=", "<", "<=", "<<", "<<=", ">", ">=", ">>", ">>=", "=", "==", #ifdef CAST_OP "=>", #endif "~", "!=", "&", "&&", "&=", "|", "||", "|=", "%", "%=", "*", "*=", "^", "^=", "!", "{", "}", "[", "]", "(", ")", ",", "?", ";", ":", ".", "...", "#", "##", " ", "ouch", "<:", ":>", "<%", "%>", "%:", "%:%:" }; /* the ascii representation of a token */ #ifdef SEMPER_FIDELIS #define tname(x) (ttWHI((x).type) ? " " : S_TOKEN((x).type) \ ? (x).name : operators_name[(x).type]) #else #define tname(x) (S_TOKEN((x).type) ? (x).name \ : operators_name[(x).type]) #endif char *token_name(struct token *t) { return tname(*t); } /* * To speed up deeply nested and repeated inclusions, we: * -- use a hash table to remember where we found each file * -- remember when the file is protected by a #ifndef/#define/#endif * construction; we can then avoid including several times a file * when this is not necessary. * -- remember in which directory, in the include path, the file was found. */ struct found_file { hash_item_header head; /* first field */ char *name; char *protect; }; /* * For files from system include path. */ struct found_file_sys { hash_item_header head; /* first field */ struct found_file *rff; int incdir; }; static HTT found_files, found_files_sys; static int found_files_init_done = 0, found_files_sys_init_done = 0; static struct found_file *new_found_file(void) { struct found_file *ff = getmem(sizeof(struct found_file)); ff->name = 0; ff->protect = 0; return ff; } static void del_found_file(void *m) { struct found_file *ff = (struct found_file *)m; if (ff->name) freemem(ff->name); if (ff->protect) freemem(ff->protect); freemem(ff); } static struct found_file_sys *new_found_file_sys(void) { struct found_file_sys *ffs = getmem(sizeof(struct found_file_sys)); ffs->rff = 0; ffs->incdir = -1; return ffs; } static void del_found_file_sys(void *m) { struct found_file_sys *ffs = (struct found_file_sys *)m; freemem(ffs); } /* * To keep up with the #ifndef/#define/#endif protection mechanism * detection. */ struct protect protect_detect; static struct protect *protect_detect_stack = 0; void set_init_filename(char *x, int real_file) { if (current_filename) freemem(current_filename); current_filename = sdup(x); current_long_filename = 0; current_incdir = -1; if (real_file) { protect_detect.macro = 0; protect_detect.state = 1; protect_detect.ff = new_found_file(); protect_detect.ff->name = sdup(x); HTT_put(&found_files, protect_detect.ff, x); } else { protect_detect.state = 0; } } static void init_found_files(void) { if (found_files_init_done) HTT_kill(&found_files); HTT_init(&found_files, del_found_file); found_files_init_done = 1; if (found_files_sys_init_done) HTT_kill(&found_files_sys); HTT_init(&found_files_sys, del_found_file_sys); found_files_sys_init_done = 1; } /* * Set the lexer state at the beginning of a file. */ static void reinit_lexer_state(struct lexer_state *ls, int wb) { #ifndef NO_UCPP_BUF ls->input_buf = wb ? getmem(INPUT_BUF_MEMG) : 0; #ifdef UCPP_MMAP ls->from_mmap = 0; #endif #endif ls->input = 0; ls->ebuf = ls->pbuf = 0; ls->nlka = 0; ls->macfile = 0; ls->discard = 1; ls->last = 0; /* we suppose '\n' is not 0 */ ls->line = 1; ls->ltwnl = 1; ls->oline = 1; #ifdef SYNOPSIS ls->column = 0; ls->ocolumn = 0; #endif ls->pending_token = 0; ls->cli = 0; ls->copy_line[COPY_LINE_LENGTH - 1] = 0; ls->ifnest = 0; ls->condf[0] = ls->condf[1] = 0; } /* * Initialize the struct lexer_state, with optional input and output buffers. */ void init_buf_lexer_state(struct lexer_state *ls, int wb) { reinit_lexer_state(ls, wb); #ifndef NO_UCPP_BUF ls->output_buf = wb ? getmem(OUTPUT_BUF_MEMG) : 0; #endif ls->sbuf = 0; ls->output_fifo = 0; ls->ctok = getmem(sizeof(struct token)); ls->ctok->name = getmem(ls->tknl = TOKEN_NAME_MEMG); ls->pending_token = 0; ls->flags = 0; ls->count_trigraphs = 0; ls->gf = getmem(sizeof(struct garbage_fifo)); init_garbage_fifo(ls->gf); ls->condcomp = 1; ls->condnest = 0; #ifdef INMACRO_FLAG ls->inmacro = 0; ls->macro_count = 0; #endif } /* * Initialize the (complex) struct lexer_state. */ void init_lexer_state(struct lexer_state *ls) { init_buf_lexer_state(ls, 1); ls->input = 0; } /* * Restore what is needed from a lexer_state. This is used for #include. */ static void restore_lexer_state(struct lexer_state *ls, struct lexer_state *lsbak) { #ifndef NO_UCPP_BUF freemem(ls->input_buf); ls->input_buf = lsbak->input_buf; #ifdef UCPP_MMAP ls->from_mmap = lsbak->from_mmap; ls->input_buf_sav = lsbak->input_buf_sav; #endif #endif ls->input = lsbak->input; ls->ebuf = lsbak->ebuf; ls->pbuf = lsbak->pbuf; ls->nlka = lsbak->nlka; ls->discard = lsbak->discard; ls->line = lsbak->line; ls->oline = lsbak->oline; ls->ifnest = lsbak->ifnest; ls->condf[0] = lsbak->condf[0]; ls->condf[1] = lsbak->condf[1]; } /* * close input file operations on a struct lexer_state */ static void close_input(struct lexer_state *ls) { #ifdef UCPP_MMAP if (ls->from_mmap) { munmap((void *)ls->input_buf, ls->ebuf); ls->from_mmap = 0; ls->input_buf = ls->input_buf_sav; } #endif if (ls->input) { fclose(ls->input); ls->input = 0; } } /* * file_context (and the two functions push_ and pop_) are used to save * all that is needed when including a file. */ static struct file_context { struct lexer_state ls; char *name, *long_name; int incdir; } *ls_stack; static size_t ls_depth = 0; static void push_file_context(struct lexer_state *ls) { struct file_context fc; fc.name = current_filename; fc.long_name = current_long_filename; fc.incdir = current_incdir; mmv(&(fc.ls), ls, sizeof(struct lexer_state)); aol(ls_stack, ls_depth, fc, LS_STACK_MEMG); ls_depth --; aol(protect_detect_stack, ls_depth, protect_detect, LS_STACK_MEMG); protect_detect.macro = 0; } static void pop_file_context(struct lexer_state *ls) { #ifdef AUDIT if (ls_depth <= 0) ouch("prepare to meet thy creator"); #endif close_input(ls); restore_lexer_state(ls, &(ls_stack[-- ls_depth].ls)); if (protect_detect.macro) freemem(protect_detect.macro); protect_detect = protect_detect_stack[ls_depth]; if (current_filename) freemem(current_filename); current_filename = ls_stack[ls_depth].name; current_long_filename = ls_stack[ls_depth].long_name; current_incdir = ls_stack[ls_depth].incdir; if (ls_depth == 0) { freemem(ls_stack); freemem(protect_detect_stack); } } /* * report_context() returns the list of successive includers of the * current file, ending with a dummy entry with a negative line number. * The caller is responsible for freeing the returned pointer. */ struct stack_context *report_context(void) { struct stack_context *sc; size_t i; sc = getmem((ls_depth + 1) * sizeof(struct stack_context)); for (i = 0; i < ls_depth; i ++) { sc[i].name = ls_stack[ls_depth - i - 1].name; sc[i].long_name = ls_stack[ls_depth - i - 1].long_name; sc[i].line = ls_stack[ls_depth - i - 1].ls.line - 1; } sc[ls_depth].line = -1; return sc; } /* * init_lexer_mode() is used to end initialization of a struct lexer_state * if it must be used for a lexer */ void init_lexer_mode(struct lexer_state *ls) { ls->flags = DEFAULT_LEXER_FLAGS; ls->output_fifo = getmem(sizeof(struct token_fifo)); ls->output_fifo->art = ls->output_fifo->nt = 0; ls->toplevel_of = ls->output_fifo; ls->save_ctok = ls->ctok; } /* * release memory used by a struct lexer_state; this implies closing * any input stream held by this structure. */ void free_lexer_state(struct lexer_state *ls) { close_input(ls); #ifndef NO_UCPP_BUF if (ls->input_buf) { freemem(ls->input_buf); ls->input_buf = 0; } if (ls->output_buf) { freemem(ls->output_buf); ls->output_buf = 0; } #endif if (ls->ctok && (!ls->output_fifo || ls->output_fifo->nt == 0)) { freemem(ls->ctok->name); freemem(ls->ctok); ls->ctok = 0; } if (ls->gf) { free_garbage_fifo(ls->gf); ls->gf = 0; } if (ls->output_fifo) { freemem(ls->output_fifo); ls->output_fifo = 0; } } /* * Print line information. */ static void print_line_info(struct lexer_state *ls, unsigned long flags, unsigned long enter_leave) { char *fn = current_long_filename ? current_long_filename : current_filename; char *b, *d; b = getmem(50 + strlen(fn)); if (flags & GCC_LINE_NUM) { if (enter_leave != 0) sprintf(b, "# %ld \"%s\" %d\n", ls->line, fn, enter_leave); else sprintf(b, "# %ld \"%s\"\n", ls->line, fn); } else { if (enter_leave != 0) sprintf(b, "#line %ld \"%s\" %d\n", ls->line, fn, enter_leave); else sprintf(b, "#line %ld \"%s\"\n", ls->line, fn); } for (d = b; *d; d ++) put_char(ls, (unsigned char)(*d)); freemem(b); } /* * Enter a file; this implies the possible emission of a #line directive. * The flags used are passed as second parameter instead of being * extracted from the struct lexer_state. * * As a command-line option, gcc-like directives (with only a '#', * without 'line') may be produced. * * enter_file() returns 1 if a (CONTEXT) token was produced, 0 otherwise. */ int enter_file(struct lexer_state *ls, unsigned long flags, unsigned long enter_leave) { char *fn = current_long_filename ? current_long_filename : current_filename; if (!(flags & LINE_NUM)) return 0; if ((flags & LEXER) && !(flags & TEXT_OUTPUT)) { struct token t; t.type = CONTEXT; t.line = ls->line; t.name = fn; print_token(ls, &t, 0); #ifdef SYNOPSIS if (enter_leave != 0) synopsis_file_hook(fn, enter_leave == 1); #endif return 1; } print_line_info(ls, flags, enter_leave); ls->oline --; /* emitted #line troubled oline */ return 0; } #ifdef UCPP_MMAP /* * We open() the file, then fdopen() it and fseek() to its end. If the * fseek() worked, we try to mmap() the file, up to the point where we * arrived. * On an architecture where end-of-lines are multibytes and translated * into single '\n', bad things could happen. We strongly hope that, if * we could fseek() to the end but could not mmap(), then we can get back. */ static void *find_file_map; static size_t map_length; FILE *fopen_mmap_file(char *name) { FILE *f; int fd; long l; find_file_map = 0; fd = open(name, O_RDONLY, 0); if (fd < 0) return 0; l = lseek(fd, 0, SEEK_END); f = fdopen(fd, "r"); if (!f) { close(fd); return 0; } if (l < 0) return f; /* not seekable */ map_length = l; if ((find_file_map = mmap(0, map_length, PROT_READ, MAP_PRIVATE, fd, 0)) == MAP_FAILED) { /* we could not mmap() the file; get back */ find_file_map = 0; if (fseek(f, 0, SEEK_SET)) { /* bwaah... can't get back. This file is cursed. */ fclose(f); return 0; } } return f; } void set_input_file(struct lexer_state *ls, FILE *f) { ls->input = f; if (find_file_map) { ls->from_mmap = 1; ls->input_buf_sav = ls->input_buf; ls->input_buf = find_file_map; ls->pbuf = 0; ls->ebuf = map_length; } else { ls->from_mmap = 0; } } #endif /* * Find a file by looking through the include path. * return value: a FILE * on the file, opened in "r" mode, or 0. * * find_file_error will contain: * FF_ERROR on error (file not found or impossible to read) * FF_PROTECT file is protected and therefore useless to read * FF_KNOWN file is already known * FF_UNKNOWN file was not already known */ static int find_file_error; enum { FF_ERROR, FF_PROTECT, FF_KNOWN, FF_UNKNOWN }; static FILE *find_file(char *name, int localdir) { FILE *f; int i, incdir = -1; size_t nl = strlen(name); char *s = 0; struct found_file *ff = 0, *nff; int lf = 0; int nffa = 0; find_file_error = FF_ERROR; protect_detect.state = -1; protect_detect.macro = 0; if (localdir) { int i; char *rfn = current_long_filename ? current_long_filename : current_filename; for (i = strlen(rfn) - 1; i >= 0; i --) #ifdef MSDOS if (rfn[i] == '\\') break; #else if (rfn[i] == '/') break; #endif #if defined MSDOS if (i >= 0 && *name != '\\' && (nl < 2 || name[1] != ':')) #elif defined AMIGA if (i >= 0 && *name != '/' && (nl < 2 || name[1] != ':')) #else if (i >= 0 && *name != '/') #endif { /* * current file is somewhere else, and the provided * file name is not absolute, so we must adjust the * base for looking for the file; besides, * found_files and found_files_loc are irrelevant * for this search. */ s = getmem(i + 2 + nl); mmv(s, rfn, i); #ifdef MSDOS s[i] = '\\'; #else s[i] = '/'; #endif mmv(s + i + 1, name, nl); s[i + 1 + nl] = 0; ff = HTT_get(&found_files, s); } else ff = HTT_get(&found_files, name); } if (!ff) { struct found_file_sys *ffs = HTT_get(&found_files_sys, name); if (ffs) { ff = ffs->rff; incdir = ffs->incdir; } } /* * At that point: if the file was found in the cache, ff points to * the cached descriptive structure; its name is s if s is not 0, * name otherwise. */ if (ff) goto found_file_cache; /* * This is the first time we find the file, or it was not protected. */ protect_detect.ff = new_found_file(); nffa = 1; if (localdir && #ifdef UCPP_MMAP (f = fopen_mmap_file(s ? s : name)) #else (f = fopen(s ? s : name, "r")) #endif ) { lf = 1; goto found_file; } /* * If s contains a name, that name is now irrelevant: it was a * filename for a search in the current directory, and the file * was not found. */ if (s) { freemem(s); s = 0; } for (i = 0; (size_t)i < include_path_nb; i ++) { size_t ni = strlen(include_path[i]); s = getmem(ni + nl + 2); mmv(s, include_path[i], ni); #ifdef AMIGA /* contributed by Volker Barthelmann */ if (ni == 1 && *s == '.') { *s = 0; ni = 0; } if (ni > 0 && s[ni - 1] != ':' && s[ni - 1] != '/') { s[ni] = '/'; mmv(s + ni + 1, name, nl + 1); } else { mmv(s + ni, name, nl + 1); } #else s[ni] = '/'; mmv(s + ni + 1, name, nl + 1); #endif #ifdef MSDOS /* on msdos systems, replace all / by \ */ { char *c; for (c = s; *c; c ++) if (*c == '/') *c = '\\'; } #endif incdir = i; if ((ff = HTT_get(&found_files, s)) != 0) { /* * The file is known, but not as a system include * file under the name provided. */ struct found_file_sys *ffs = new_found_file_sys(); ffs->rff = ff; ffs->incdir = incdir; HTT_put(&found_files_sys, ffs, name); freemem(s); s = 0; if (nffa) { del_found_file(protect_detect.ff); protect_detect.ff = 0; nffa = 0; } goto found_file_cache; } #ifdef UCPP_MMAP f = fopen_mmap_file(s); #else f = fopen(s, "r"); #endif if (f) goto found_file; freemem(s); s = 0; } zero_out: if (s) freemem(s); if (nffa) { del_found_file(protect_detect.ff); protect_detect.ff = 0; nffa = 0; } return 0; /* * This part is invoked when the file was found in the * cache. */ found_file_cache: if (ff->protect) { if (get_macro(ff->protect)) { /* file is protected, do not include it */ find_file_error = FF_PROTECT; goto zero_out; } /* file is protected but the guardian macro is not available; disable guardian detection. */ protect_detect.state = 0; } protect_detect.ff = ff; #ifdef UCPP_MMAP f = fopen_mmap_file(HASH_ITEM_NAME(ff)); #else f = fopen(HASH_ITEM_NAME(ff), "r"); #endif if (!f) goto zero_out; find_file_error = FF_KNOWN; goto found_file_2; /* * This part is invoked when we found a new file, which was not * yet referenced. If lf == 1, then the file was found directly, * otherwise it was found in some system include directory. * A new found_file structure has been allocated and is in * protect_detect.ff */ found_file: if (f && ((emit_dependencies == 1 && lf && current_incdir == -1) || emit_dependencies == 2)) { fprintf(emit_output, " %s", s ? s : name); } nff = protect_detect.ff; nff->name = sdup(name); #ifdef AUDIT if ( #endif HTT_put(&found_files, nff, s ? s : name) #ifdef AUDIT ) ouch("filename collided with a wraith") #endif ; if (!lf) { struct found_file_sys *ffs = new_found_file_sys(); ffs->rff = nff; ffs->incdir = incdir; HTT_put(&found_files_sys, ffs, name); } if (s) freemem(s); s = 0; find_file_error = FF_UNKNOWN; ff = nff; found_file_2: if (s) freemem(s); current_long_filename = HASH_ITEM_NAME(ff); #ifdef NO_LIBC_BUF setbuf(f, 0); #endif current_incdir = incdir; return f; } /* * Find the named file by looking through the end of the include path. * This is for #include_next directives. * #include_next and #include_next "foo" are considered identical, * for all practical purposes. */ static FILE *find_file_next(char *name) { int i; size_t nl = strlen(name); FILE *f; struct found_file *ff; find_file_error = FF_ERROR; protect_detect.state = -1; protect_detect.macro = 0; for (i = current_incdir + 1; (size_t)i < include_path_nb; i ++) { char *s; size_t ni = strlen(include_path[i]); s = getmem(ni + nl + 2); mmv(s, include_path[i], ni); s[ni] = '/'; mmv(s + ni + 1, name, nl + 1); #ifdef MSDOS /* on msdos systems, replace all / by \ */ { char *c; for (c = s; *c; c ++) if (*c == '/') *c = '\\'; } #endif ff = HTT_get(&found_files, s); if (ff) { /* file was found in the cache */ if (ff->protect) { if (get_macro(ff->protect)) { find_file_error = FF_PROTECT; freemem(s); return 0; } /* file is protected but the guardian macro is not available; disable guardian detection. */ protect_detect.state = 0; } protect_detect.ff = ff; #ifdef UCPP_MMAP f = fopen_mmap_file(HASH_ITEM_NAME(ff)); #else f = fopen(HASH_ITEM_NAME(ff), "r"); #endif if (!f) { /* file is referenced but yet unavailable. */ freemem(s); return 0; } find_file_error = FF_KNOWN; freemem(s); s = HASH_ITEM_NAME(ff); } else { #ifdef UCPP_MMAP f = fopen_mmap_file(s); #else f = fopen(s, "r"); #endif if (f) { if (emit_dependencies == 2) { fprintf(emit_output, " %s", s); } ff = protect_detect.ff = new_found_file(); ff->name = sdup(s); #ifdef AUDIT if ( #endif HTT_put(&found_files, ff, s) #ifdef AUDIT ) ouch("filename collided with a wraith") #endif ; find_file_error = FF_UNKNOWN; freemem(s); s = HASH_ITEM_NAME(ff); } } if (f) { current_long_filename = s; current_incdir = i; return f; } freemem(s); } return 0; } /* * The #if directive. This function parse the expression, performs macro * expansion (and handles the "defined" operator), and call eval_expr. * return value: 1 if the expression is true, 0 if it is false, -1 on error. */ static int handle_if(struct lexer_state *ls) { struct token_fifo tf, tf1, tf2, tf3, *save_tf; long l = ls->line; unsigned long z; int ret = 0, ltww = 1; /* first, get the whole line */ tf.art = tf.nt = 0; while (!next_token(ls) && ls->ctok->type != NEWLINE) { struct token t; if (ltww && ttMWS(ls->ctok->type)) continue; ltww = ttMWS(ls->ctok->type); t.type = ls->ctok->type; t.line = l; if (S_TOKEN(ls->ctok->type)) { t.name = sdup(ls->ctok->name); throw_away(ls->gf, t.name); } aol(tf.t, tf.nt, t, TOKEN_LIST_MEMG); } if (ltww && tf.nt) if ((-- tf.nt) == 0) freemem(tf.t); if (tf.nt == 0) { error(l, "void condition for a #if/#elif"); return -1; } /* handle the "defined" operator */ tf1.art = tf1.nt = 0; while (tf.art < tf.nt) { struct token *ct, rt; struct macro *m; size_t nidx, eidx; ct = tf.t + (tf.art ++); if (ct->type == NAME && !strcmp(ct->name, "defined")) { if (tf.art >= tf.nt) goto store_token; nidx = tf.art; if (ttMWS(tf.t[nidx].type)) if (++ nidx >= tf.nt) goto store_token; if (tf.t[nidx].type == NAME) { eidx = nidx; goto check_macro; } if (tf.t[nidx].type != LPAR) goto store_token; if (++ nidx >= tf.nt) goto store_token; if (ttMWS(tf.t[nidx].type)) if (++ nidx >= tf.nt) goto store_token; if (tf.t[nidx].type != NAME) goto store_token; eidx = nidx + 1; if (eidx >= tf.nt) goto store_token; if (ttMWS(tf.t[eidx].type)) if (++ eidx >= tf.nt) goto store_token; if (tf.t[eidx].type != RPAR) goto store_token; goto check_macro; } store_token: aol(tf1.t, tf1.nt, *ct, TOKEN_LIST_MEMG); continue; check_macro: m = get_macro(tf.t[nidx].name); rt.type = NUMBER; rt.name = m ? "1L" : "0L"; aol(tf1.t, tf1.nt, rt, TOKEN_LIST_MEMG); tf.art = eidx + 1; } freemem(tf.t); if (tf1.nt == 0) { error(l, "void condition (after expansion) for a #if/#elif"); return -1; } /* perform all macro substitutions */ tf2.art = tf2.nt = 0; save_tf = ls->output_fifo; ls->output_fifo = &tf2; while (tf1.art < tf1.nt) { struct token *ct; ct = tf1.t + (tf1.art ++); if (ct->type == NAME) { struct macro *m = get_macro(ct->name); if (m) { if (substitute_macro(ls, m, &tf1, 0, #ifdef NO_PRAGMA_IN_DIRECTIVE 1, #else 0, #endif ct->line)) { ls->output_fifo = save_tf; goto error1; } continue; } } else if ((ct->type == SHARP || ct->type == DIG_SHARP) && (ls->flags & HANDLE_ASSERTIONS)) { /* we have an assertion; parse it */ int nnp, ltww = 1; size_t i = tf1.art; struct token_fifo atl; char *aname; struct assert *a; int av = 0; struct token rt; atl.art = atl.nt = 0; while (i < tf1.nt && ttMWS(tf1.t[i].type)) i ++; if (i >= tf1.nt) goto assert_error; if (tf1.t[i].type != NAME) goto assert_error; aname = tf1.t[i ++].name; while (i < tf1.nt && ttMWS(tf1.t[i].type)) i ++; if (i >= tf1.nt) goto assert_generic; if (tf1.t[i].type != LPAR) goto assert_generic; i ++; for (nnp = 1; nnp && i < tf1.nt; i ++) { if (ltww && ttMWS(tf1.t[i].type)) continue; if (tf1.t[i].type == LPAR) nnp ++; else if (tf1.t[i].type == RPAR && (-- nnp) == 0) { tf1.art = i + 1; break; } ltww = ttMWS(tf1.t[i].type); aol(atl.t, atl.nt, tf1.t[i], TOKEN_LIST_MEMG); } if (nnp) goto assert_error; if (ltww && atl.nt && (-- atl.nt) == 0) freemem(atl.t); if (atl.nt == 0) goto assert_error; /* the assertion is in aname and atl; check it */ a = get_assertion(aname); if (a) for (i = 0; i < a->nbval; i ++) if (!cmp_token_list(&atl, a->val + i)) { av = 1; break; } rt.type = NUMBER; rt.name = av ? "1" : "0"; aol(tf2.t, tf2.nt, rt, TOKEN_LIST_MEMG); if (atl.nt) freemem(atl.t); continue; assert_generic: tf1.art = i; rt.type = NUMBER; rt.name = get_assertion(aname) ? "1" : "0"; aol(tf2.t, tf2.nt, rt, TOKEN_LIST_MEMG); continue; assert_error: error(l, "syntax error for assertion in #if"); ls->output_fifo = save_tf; goto error1; } aol(tf2.t, tf2.nt, *ct, TOKEN_LIST_MEMG); } ls->output_fifo = save_tf; freemem(tf1.t); if (tf2.nt == 0) { error(l, "void condition (after expansion) for a #if/#elif"); return -1; } /* * suppress whitespace and replace rogue identifiers by 0 */ tf3.art = tf3.nt = 0; while (tf2.art < tf2.nt) { struct token *ct = tf2.t + (tf2.art ++); if (ttMWS(ct->type)) continue; if (ct->type == NAME) { /* * a rogue identifier; we replace it with "0". */ struct token rt; rt.type = NUMBER; rt.name = "0"; aol(tf3.t, tf3.nt, rt, TOKEN_LIST_MEMG); continue; } aol(tf3.t, tf3.nt, *ct, TOKEN_LIST_MEMG); } freemem(tf2.t); if (tf3.nt == 0) { error(l, "void condition (after expansion) for a #if/#elif"); return -1; } eval_line = l; z = eval_expr(&tf3, &ret, (ls->flags & WARN_STANDARD) != 0); freemem(tf3.t); if (ret) return -1; return (z != 0); error1: if (tf1.nt) freemem(tf1.t); if (tf2.nt) freemem(tf2.t); return -1; } /* * A #include was found; parse the end of line, replace macros if * necessary. * * If nex is set to non-zero, the directive is considered as a #include_next * (extension to C99, mimicked from GNU) */ static int handle_include(struct lexer_state *ls, unsigned long flags, int nex) { int c, string_fname = 0; char *fname; unsigned char *fname2; size_t fname_ptr = 0; long l = ls->line; int x, y; FILE *f; struct token_fifo tf, tf2, *save_tf; size_t nl; int tgd; int is_macro = 0; struct lexer_state alt_ls; #define left_angle(t) ((t) == LT || (t) == LEQ || (t) == LSH \ || (t) == ASLSH || (t) == DIG_LBRK || (t) == LBRA) #define right_angle(t) ((t) == GT || (t) == RSH || (t) == ARROW \ || (t) == DIG_RBRK || (t) == DIG_RBRA) while ((c = grap_char(ls)) >= 0 && c != '\n') { if (space_char(c)) { discard_char(ls); continue; } if (c == '<') { discard_char(ls); while ((c = grap_char(ls)) >= 0) { discard_char(ls); if (c == '\n') goto include_last_chance; if (c == '>') break; aol(fname, fname_ptr, (char)c, FNAME_MEMG); } aol(fname, fname_ptr, (char)0, FNAME_MEMG); string_fname = 0; goto do_include; } else if (c == '"') { discard_char(ls); while ((c = grap_char(ls)) >= 0) { discard_char(ls); if (c == '\n') { /* macro replacements won't save that one */ if (fname_ptr) freemem(fname); goto include_error; } if (c == '"') break; aol(fname, fname_ptr, (char)c, FNAME_MEMG); } aol(fname, fname_ptr, (char)0, FNAME_MEMG); string_fname = 1; goto do_include; } goto include_macro; } include_last_chance: /* * We found a '<' but not the trailing '>'; so we tokenize the * line, and try to act upon it. The standard lets us free in that * matter, and no sane programmer would use such a construct, but * it is no reason not to support it. */ if (fname_ptr == 0) goto include_error; fname2 = getmem(fname_ptr + 1); mmv(fname2 + 1, fname, fname_ptr); fname2[0] = '<'; /* * We merely copy the lexer_state structure; this should be ok, * since we do want to share the memory structure (garbage_fifo), * and do not touch any other context-full thing. */ alt_ls = *ls; alt_ls.input = 0; alt_ls.input_string = fname2; alt_ls.pbuf = 0; alt_ls.ebuf = fname_ptr + 1; tf.art = tf.nt = 0; while (!next_token(&alt_ls)) { if (!ttMWS(alt_ls.ctok->type)) { struct token t; t.type = alt_ls.ctok->type; t.line = l; if (S_TOKEN(alt_ls.ctok->type)) { t.name = sdup(alt_ls.ctok->name); throw_away(alt_ls.gf, t.name); } aol(tf.t, tf.nt, t, TOKEN_LIST_MEMG); } } freemem(fname2); if (alt_ls.pbuf < alt_ls.ebuf) goto include_error; /* tokenizing failed */ goto include_macro2; include_error: error(l, "invalid '#include'"); return 1; include_macro: tf.art = tf.nt = 0; while (!next_token(ls) && ls->ctok->type != NEWLINE) { if (!ttMWS(ls->ctok->type)) { struct token t; t.type = ls->ctok->type; t.line = l; if (S_TOKEN(ls->ctok->type)) { t.name = sdup(ls->ctok->name); throw_away(ls->gf, t.name); } aol(tf.t, tf.nt, t, TOKEN_LIST_MEMG); } } include_macro2: is_macro = 1; tf2.art = tf2.nt = 0; save_tf = ls->output_fifo; ls->output_fifo = &tf2; while (tf.art < tf.nt) { struct token *ct; ct = tf.t + (tf.art ++); if (ct->type == NAME) { struct macro *m = get_macro(ct->name); if (m) { if (substitute_macro(ls, m, &tf, 0, #ifdef NO_PRAGMA_IN_DIRECTIVE 1, #else 0, #endif ct->line)) { ls->output_fifo = save_tf; return -1; } continue; } } aol(tf2.t, tf2.nt, *ct, TOKEN_LIST_MEMG); } freemem(tf.t); ls->output_fifo = save_tf; for (x = 0; (size_t)x < tf2.nt && ttWHI(tf2.t[x].type); x ++); for (y = tf2.nt - 1; y >= 0 && ttWHI(tf2.t[y].type); y --); if ((size_t)x >= tf2.nt) goto include_macro_err; if (tf2.t[x].type == STRING) { if (y != x) goto include_macro_err; if (tf2.t[x].name[0] == 'L') { if (ls->flags & WARN_STANDARD) warning(l, "wide string for #include"); fname = sdup(tf2.t[x].name); nl = strlen(fname); *(fname + nl - 1) = 0; mmvwo(fname, fname + 2, nl - 2); } else { fname = sdup(tf2.t[x].name); nl = strlen(fname); *(fname + nl - 1) = 0; mmvwo(fname, fname + 1, nl - 1); } string_fname = 1; } else if (left_angle(tf2.t[x].type) && right_angle(tf2.t[y].type)) { int i, j; if (ls->flags & WARN_ANNOYING) warning(l, "reconstruction " "of in #include"); for (j = 0, i = x; i <= y; i ++) if (!ttWHI(tf2.t[i].type)) j += strlen(tname(tf2.t[i])); fname = getmem(j + 1); for (j = 0, i = x; i <= y; i ++) { if (ttWHI(tf2.t[i].type)) continue; strcpy(fname + j, tname(tf2.t[i])); j += strlen(tname(tf2.t[i])); } *(fname + j - 1) = 0; mmvwo(fname, fname + 1, j); string_fname = 0; } else goto include_macro_err; freemem(tf2.t); goto do_include_next; include_macro_err: error(l, "macro expansion did not produce a valid filename " "for #include"); if (tf2.nt) freemem(tf2.t); return 1; do_include: tgd = 1; while (!next_token(ls)) { if (tgd && !ttWHI(ls->ctok->type) && (ls->flags & WARN_STANDARD)) { warning(l, "trailing garbage in #include"); tgd = 0; } if (ls->ctok->type == NEWLINE) break; } /* the increment of ls->line is intended so that the line numbering is reported correctly in report_context() even if the #include is at the end of the file with no trailing newline */ if (ls->ctok->type != NEWLINE) ls->line ++; do_include_next: if (!(ls->flags & LEXER) && (ls->flags & KEEP_OUTPUT)) put_char(ls, '\n'); push_file_context(ls); reinit_lexer_state(ls, 1); #ifdef MSDOS /* on msdos systems, replace all / by \ */ { char *d; for (d = fname; *d; d ++) if (*d == '/') *d = '\\'; } #endif f = nex ? find_file_next(fname) : find_file(fname, string_fname); if (!f) { #ifdef SYNOPSIS if (find_file_error == FF_PROTECT) { // Still record protected includes (those not included // because they have a #ifndef/define/endif protection and // have already been included) char *cfn = current_long_filename ? current_long_filename : current_filename; synopsis_include_hook(ls_stack[ls_depth-1].long_name, cfn, fname, string_fname, is_macro, nex); } /* file was found, but it is useless to include it again. However, we need to adjust the line number due to the include directive that just got removed from the token stream.*/ if ((ls->flags & LEXER) && !(ls->flags & TEXT_OUTPUT)) { struct token t; t.type = CONTEXT; t.line = ls->line; t.name = current_long_filename ? current_long_filename : current_filename; print_token(ls, &t, 0); } #endif current_filename = 0; pop_file_context(ls); if (find_file_error == FF_ERROR) { error(l, "file '%s' not found", fname); freemem(fname); return 1; } /* file was found, but it is useless to include it again. */ freemem(fname); return 0; } #ifdef UCPP_MMAP set_input_file(ls, f); #else ls->input = f; #endif current_filename = fname; #ifdef SYNOPSIS synopsis_include_hook(ls_stack[ls_depth-1].long_name, current_long_filename, fname, string_fname, is_macro, nex); #endif enter_file(ls, flags, 1); return 0; #undef left_angle #undef right_angle } /* * for #line directives */ static int handle_line(struct lexer_state *ls, unsigned long flags) { char *fname; long l = ls->line; struct token_fifo tf, tf2, *save_tf; size_t nl, j; unsigned long z; tf.art = tf.nt = 0; while (!next_token(ls) && ls->ctok->type != NEWLINE) { if (!ttMWS(ls->ctok->type)) { struct token t; t.type = ls->ctok->type; t.line = l; if (S_TOKEN(ls->ctok->type)) { t.name = sdup(ls->ctok->name); throw_away(ls->gf, t.name); } aol(tf.t, tf.nt, t, TOKEN_LIST_MEMG); } } tf2.art = tf2.nt = 0; save_tf = ls->output_fifo; ls->output_fifo = &tf2; while (tf.art < tf.nt) { struct token *ct; ct = tf.t + (tf.art ++); if (ct->type == NAME) { struct macro *m = get_macro(ct->name); if (m) { if (substitute_macro(ls, m, &tf, 0, #ifdef NO_PRAGMA_IN_DIRECTIVE 1, #else 0, #endif ct->line)) { ls->output_fifo = save_tf; return -1; } continue; } } aol(tf2.t, tf2.nt, *ct, TOKEN_LIST_MEMG); } freemem(tf.t); for (tf2.art = 0; tf2.art < tf2.nt && ttWHI(tf2.t[tf2.art].type); tf2.art ++); ls->output_fifo = save_tf; if (tf2.art == tf2.nt || (tf2.t[tf2.art].type != NUMBER && tf2.t[tf2.art].type != CHAR)) { error(l, "not a valid number for #line"); goto line_macro_err; } for (j = 0; tf2.t[tf2.art].name[j]; j ++) if (tf2.t[tf2.art].name[j] < '0' || tf2.t[tf2.art].name[j] > '9') if (ls->flags & WARN_STANDARD) warning(l, "non-standard line number in #line"); if (catch(eval_exception)) goto line_macro_err; z = strtoconst(tf2.t[tf2.art].name); if (j > 10 || z > 2147483647U) { error(l, "out-of-bound line number for #line"); goto line_macro_err; } ls->oline = ls->line = z; if ((++ tf2.art) < tf2.nt) { size_t i; for (i = tf2.art; i < tf2.nt && ttMWS(tf2.t[i].type); i ++); if (i < tf2.nt) { if (tf2.t[i].type != STRING) { error(l, "not a valid filename for #line"); goto line_macro_err; } if (tf2.t[i].name[0] == 'L') { if (ls->flags & WARN_STANDARD) { warning(l, "wide string for #line"); } fname = sdup(tf2.t[i].name); nl = strlen(fname); *(fname + nl - 1) = 0; mmvwo(fname, fname + 2, nl - 2); } else { fname = sdup(tf2.t[i].name); nl = strlen(fname); *(fname + nl - 1) = 0; mmvwo(fname, fname + 1, nl - 1); } if (current_filename) freemem(current_filename); current_filename = fname; } for (i ++; i < tf2.nt && ttMWS(tf2.t[i].type); i ++); if (i < tf2.nt && (ls->flags & WARN_STANDARD)) { warning(l, "trailing garbage in #line"); } } freemem(tf2.t); enter_file(ls, flags, 0); return 0; line_macro_err: if (tf2.nt) freemem(tf2.t); return 1; } /* * a #error directive: we emit the message without any modification * (except the usual backslash+newline and trigraphs) */ static void handle_error(struct lexer_state *ls) { int c; size_t p = 0, lp = 128; long l = ls->line; unsigned char *buf = getmem(lp); while ((c = grap_char(ls)) >= 0 && c != '\n') { discard_char(ls); wan(buf, p, (unsigned char)c, lp); } wan(buf, p, 0, lp); error(l, "#error%s", buf); freemem(buf); } /* * convert digraph tokens to their standard equivalent. */ static int undig(int type) { static int ud[6] = { LBRK, RBRK, LBRA, RBRA, SHARP, DSHARP }; return ud[type - DIG_LBRK]; } #ifdef PRAGMA_TOKENIZE /* * Make a compressed representation of a token list; the contents of * the token_fifo are freed. Values equal to 0 are replaced by * PRAGMA_TOKEN_END (by default, (unsigned char)'\n') and the compressed * string is padded by a 0 (so that it may be * handled like a string). * Digraph tokens are replaced by their non-digraph equivalents. */ struct comp_token_fifo compress_token_list(struct token_fifo *tf) { struct comp_token_fifo ct; size_t l; for (l = 0, tf->art = 0; tf->art < tf->nt; tf->art ++) { l ++; if (S_TOKEN(tf->t[tf->art].type)) l += strlen(tf->t[tf->art].name) + 1; } ct.t = getmem((ct.length = l) + 1); for (l = 0, tf->art = 0; tf->art < tf->nt; tf->art ++) { int tt = tf->t[tf->art].type; if (tt == 0) tt = PRAGMA_TOKEN_END; if (tt > DIGRAPH_TOKENS && tt < DIGRAPH_TOKENS_END) tt = undig(tt); ct.t[l ++] = tt; if (S_TOKEN(tt)) { char *tn = tf->t[tf->art].name; size_t sl = strlen(tn); mmv(ct.t + l, tn, sl); l += sl; ct.t[l ++] = PRAGMA_TOKEN_END; freemem(tn); } } ct.t[l] = 0; if (tf->nt) freemem(tf->t); ct.rp = 0; return ct; } #endif /* * A #pragma directive: we make a PRAGMA token containing the rest of * the line. * * We strongly hope that we are called only in LEXER mode. */ static void handle_pragma(struct lexer_state *ls) { unsigned char *buf; struct token t; long l = ls->line; #ifdef PRAGMA_TOKENIZE struct token_fifo tf; tf.art = tf.nt = 0; while (!next_token(ls) && ls->ctok->type != NEWLINE) if (!ttMWS(ls->ctok->type)) break; if (ls->ctok->type != NEWLINE) { do { struct token t; t.type = ls->ctok->type; if (ttMWS(t.type)) continue; if (S_TOKEN(t.type)) t.name = sdup(ls->ctok->name); aol(tf.t, tf.nt, t, TOKEN_LIST_MEMG); } while (!next_token(ls) && ls->ctok->type != NEWLINE); } if (tf.nt == 0) { /* void pragma are silently ignored */ return; } buf = (compress_token_list(&tf)).t; #else int c, x = 1, y = 32; while ((c = grap_char(ls)) >= 0 && c != '\n') { discard_char(ls); if (!space_char(c)) break; } /* void #pragma are ignored */ if (c == '\n') return; buf = getmem(y); buf[0] = c; while ((c = grap_char(ls)) >= 0 && c != '\n') { discard_char(ls); wan(buf, x, c, y); } for (x --; x >= 0 && space_char(buf[x]); x --); x ++; wan(buf, x, 0, y); #endif t.type = PRAGMA; t.line = l; t.name = (char *)buf; aol(ls->output_fifo->t, ls->output_fifo->nt, t, TOKEN_LIST_MEMG); throw_away(ls->gf, (char *)buf); } /* * We saw a # at the beginning of a line (or preceeded only by whitespace). * We check the directive name and act accordingly. */ static int handle_cpp(struct lexer_state *ls, int sharp_type) { #define condfset(x) do { \ ls->condf[(x) / 32] |= 1UL << ((x) % 32); \ } while (0) #define condfclr(x) do { \ ls->condf[(x) / 32] &= ~(1UL << ((x) % 32)); \ } while (0) #define condfval(x) ((ls->condf[(x) / 32] & (1UL << ((x) % 32))) != 0) long l = ls->line; unsigned long save_flags = ls->flags; int ret = 0; save_flags = ls->flags; ls->flags |= LEXER; while (!next_token(ls)) { int t = ls->ctok->type; switch (t) { case COMMENT: if (ls->flags & WARN_ANNOYING) { warning(l, "comment in the middle of " "a cpp directive"); } /* fall through */ case NONE: continue; case NEWLINE: /* null directive */ if (ls->flags & WARN_ANNOYING) { /* truly an annoying warning; null directives are rare but may increase readability of some source files, and they are legal */ warning(l, "null cpp directive"); } if (!(ls->flags & LEXER)) put_char(ls, '\n'); goto handle_exit2; case NAME: break; default: if (ls->flags & FAIL_SHARP) { /* LPS 20050602 - ignores '#!' if on the first line */ if( ( l == 1 ) && ( ls->condcomp ) ) { ret = 1; } else /* LPS 20050602 */ if (ls->condcomp) { error(l, "rogue '#'"); ret = 1; } else { if (ls->flags & WARN_STANDARD) { warning(l, "rogue '#' in code " "compiled out"); ret = 0; } } ls->flags = save_flags; goto handle_warp_ign; } else { struct token u; u.type = sharp_type; u.line = l; ls->flags = save_flags; print_token(ls, &u, 0); print_token(ls, ls->ctok, 0); if (ls->flags & WARN_ANNOYING) { warning(l, "rogue '#' dumped"); } goto handle_exit3; } } if (ls->condcomp) { if (!strcmp(ls->ctok->name, "define")) { ret = handle_define(ls); goto handle_exit; } else if (!strcmp(ls->ctok->name, "undef")) { ret = handle_undef(ls); goto handle_exit; } else if (!strcmp(ls->ctok->name, "if")) { if ((++ ls->ifnest) > 63) goto too_many_if; condfclr(ls->ifnest - 1); ret = handle_if(ls); if (ret > 0) ret = 0; else if (ret == 0) { ls->condcomp = 0; ls->condmet = 0; ls->condnest = ls->ifnest - 1; } else ret = 1; goto handle_exit; } else if (!strcmp(ls->ctok->name, "ifdef")) { if ((++ ls->ifnest) > 63) goto too_many_if; condfclr(ls->ifnest - 1); ret = handle_ifdef(ls); if (ret > 0) ret = 0; else if (ret == 0) { ls->condcomp = 0; ls->condmet = 0; ls->condnest = ls->ifnest - 1; } else ret = 1; goto handle_exit; } else if (!strcmp(ls->ctok->name, "ifndef")) { if ((++ ls->ifnest) > 63) goto too_many_if; condfclr(ls->ifnest - 1); ret = handle_ifndef(ls); if (ret > 0) ret = 0; else if (ret == 0) { ls->condcomp = 0; ls->condmet = 0; ls->condnest = ls->ifnest - 1; } else ret = 1; goto handle_exit; } else if (!strcmp(ls->ctok->name, "else")) { if (ls->ifnest == 0 || condfval(ls->ifnest - 1)) { error(l, "rogue #else"); ret = 1; goto handle_warp; } condfset(ls->ifnest - 1); if (ls->ifnest == 1) protect_detect.state = 0; ls->condcomp = 0; ls->condmet = 1; ls->condnest = ls->ifnest - 1; goto handle_warp; } else if (!strcmp(ls->ctok->name, "elif")) { if (ls->ifnest == 0 || condfval(ls->ifnest - 1)) { error(l, "rogue #elif"); ret = 1; goto handle_warp_ign; } if (ls->ifnest == 1) protect_detect.state = 0; ls->condcomp = 0; ls->condmet = 1; ls->condnest = ls->ifnest - 1; goto handle_warp_ign; } else if (!strcmp(ls->ctok->name, "endif")) { if (ls->ifnest == 0) { error(l, "unmatched #endif"); ret = 1; goto handle_warp; } if ((-- ls->ifnest) == 0 && protect_detect.state == 2) { protect_detect.state = 3; } goto handle_warp; } else if (!strcmp(ls->ctok->name, "include")) { ret = handle_include(ls, save_flags, 0); goto handle_exit3; } else if (!strcmp(ls->ctok->name, "include_next")) { ret = handle_include(ls, save_flags, 1); goto handle_exit3; } else if (!strcmp(ls->ctok->name, "pragma")) { if (!(save_flags & LEXER)) { #ifdef PRAGMA_DUMP /* dump #pragma in output */ struct token u; u.type = sharp_type; u.line = l; ls->flags = save_flags; print_token(ls, &u, 0); print_token(ls, ls->ctok, 0); while (ls->flags |= LEXER, !next_token(ls)) { long save_line; ls->flags &= ~LEXER; save_line = ls->line; ls->line = l; print_token(ls, ls->ctok, 0); ls->line = save_line; if (ls->ctok->type == NEWLINE) break; } goto handle_exit3; #else if (ls->flags & WARN_PRAGMA) warning(l, "#pragma ignored " "and not dumped"); goto handle_warp_ign; #endif } if (!(ls->flags & HANDLE_PRAGMA)) goto handle_warp_ign; handle_pragma(ls); goto handle_exit; } else if (!strcmp(ls->ctok->name, "error")) { ret = 1; handle_error(ls); goto handle_exit; } else if (!strcmp(ls->ctok->name, "line")) { ret = handle_line(ls, save_flags); goto handle_exit; } else if ((ls->flags & HANDLE_ASSERTIONS) && !strcmp(ls->ctok->name, "assert")) { ret = handle_assert(ls); goto handle_exit; } else if ((ls->flags & HANDLE_ASSERTIONS) && !strcmp(ls->ctok->name, "unassert")) { ret = handle_unassert(ls); goto handle_exit; } } else { if (!strcmp(ls->ctok->name, "else")) { if (condfval(ls->ifnest - 1) && (ls->flags & WARN_STANDARD)) { warning(l, "rogue #else in code " "compiled out"); } if (ls->condnest == ls->ifnest - 1) { if (!ls->condmet) ls->condcomp = 1; } condfset(ls->ifnest - 1); if (ls->ifnest == 1) protect_detect.state = 0; goto handle_warp; } else if (!strcmp(ls->ctok->name, "elif")) { if (condfval(ls->ifnest - 1) && (ls->flags & WARN_STANDARD)) { warning(l, "rogue #elif in code " "compiled out"); } if (ls->condnest != ls->ifnest - 1 || ls->condmet) goto handle_warp_ign; if (ls->ifnest == 1) protect_detect.state = 0; ret = handle_if(ls); if (ret > 0) { ls->condcomp = 1; ls->condmet = 1; ret = 0; } else if (ret < 0) ret = 1; goto handle_exit; } else if (!strcmp(ls->ctok->name, "endif")) { if ((-- ls->ifnest) == ls->condnest) { if (ls->ifnest == 0 && protect_detect.state == 2) protect_detect.state = 3; ls->condcomp = 1; } goto handle_warp; } else if (!strcmp(ls->ctok->name, "if") || !strcmp(ls->ctok->name, "ifdef") || !strcmp(ls->ctok->name, "ifndef")) { if ((++ ls->ifnest) > 63) goto too_many_if; condfclr(ls->ifnest - 1); } goto handle_warp_ign; } /* * Unrecognized directive. We emit either an error or * an annoying warning, depending on a command-line switch. */ if (ls->flags & FAIL_SHARP) { error(l, "unknown cpp directive '#%s'", ls->ctok->name); goto handle_warp_ign; } else { struct token u; u.type = sharp_type; u.line = l; ls->flags = save_flags; print_token(ls, &u, 0); print_token(ls, ls->ctok, 0); if (ls->flags & WARN_ANNOYING) { warning(l, "rogue '#' dumped"); } } } return 1; handle_warp_ign: while (!next_token(ls)) if (ls->ctok->type == NEWLINE) break; goto handle_exit; handle_warp: while (!next_token(ls)) { if (!ttWHI(ls->ctok->type) && (ls->flags & WARN_STANDARD)) { warning(l, "trailing garbage in " "preprocessing directive"); } if (ls->ctok->type == NEWLINE) { /* We are about to skip an conditional block, so line numbers are wrong. Emitting a line directive should fix that. */ ls->oline = ls->line; struct token t; t.type = CONTEXT; t.line = ls->line; t.name = current_long_filename ? current_long_filename : current_filename; print_token(ls, &t, 0); break; } } goto handle_exit3; handle_exit: if (!(ls->flags & LEXER)) put_char(ls, '\n'); else print_newline(ls); handle_exit3: if (protect_detect.state == 1) { protect_detect.state = 0; } else if (protect_detect.state == -1) { /* just after the #include */ protect_detect.state = 1; } handle_exit2: ls->flags = save_flags; return ret; too_many_if: error(l, "too many levels of conditional inclusion (max 63)"); ret = 1; goto handle_warp; #undef condfset #undef condfclr #undef condfval } /* * This is the main entry function. It maintains count of #, and call the * appropriate functions when it encounters a cpp directive or a macro * name. * return value: positive on error; CPPERR_EOF means "end of input reached" */ int cpp(struct lexer_state *ls) { int r = 0; while (next_token(ls)) { if (protect_detect.state == 3) { /* * At that point, protect_detect.ff->protect might * be non-zero, if the file has been recursively * included, and a guardian detected. */ if (!protect_detect.ff->protect) { /* Cool ! A new guardian has been detected. */ protect_detect.ff->protect = protect_detect.macro; } else if (protect_detect.macro) { /* We found a guardian but an old one. */ freemem(protect_detect.macro); } protect_detect.macro = 0; } if (ls->ifnest) { error(ls->line, "unterminated #if construction " "(depth %ld)", ls->ifnest); r = CPPERR_NEST; } if (ls_depth == 0) return CPPERR_EOF; close_input(ls); if (!(ls->flags & LEXER) && !ls->ltwnl) put_char(ls, '\n'); pop_file_context(ls); ls->oline ++; if (enter_file(ls, ls->flags, 2)) break; } if (!(ls->ltwnl && (ls->ctok->type == SHARP || ls->ctok->type == DIG_SHARP)) && protect_detect.state == 1 && !ttWHI(ls->ctok->type)) { /* the first non-whitespace token encountered is not a sharp introducing a cpp directive */ protect_detect.state = 0; } if (protect_detect.state == 3 && !ttWHI(ls->ctok->type)) { /* a non-whitespace token encountered after the #endif */ protect_detect.state = 0; } if (ls->condcomp) { if (ls->ltwnl && (ls->ctok->type == SHARP || ls->ctok->type == DIG_SHARP)) { int x = handle_cpp(ls, ls->ctok->type); ls->ltwnl = 1; return r ? r : x; } if (ls->ctok->type == NAME) { struct macro *m; if ((m = get_macro(ls->ctok->name)) != 0) { int x; #ifdef SYNOPSIS int o_pos_start, o_pos_end, o_line_start, o_line_end; int i_pos_start, i_pos_end, i_line_start, i_line_end; /* ucpp counts columns from 1, Synopsis counts from 0. */ ls->ocolumn = ls->ctok->pos; i_pos_start = ls->ctok->pos - 1; i_line_start = ls->line; o_line_start = ls->oline; o_pos_start = ls->ocolumn; x = substitute_macro(ls, m, 0, 1, 0, ls->ctok->line); if (!(ls->flags & LEXER)) garbage_collect(ls->gf); i_line_end = ls->line; o_line_end = ls->oline; i_pos_end = ls->column + (ls->discard ? 1 : 0) - 1; o_pos_end = ls->ocolumn - 1; synopsis_macro_hook(HASH_ITEM_NAME(m), i_line_start, i_pos_start, i_line_end, i_pos_end, o_line_start, o_pos_start, o_line_end, o_pos_end); #else x = substitute_macro(ls, m, 0, 1, 0, ls->ctok->line); if (!(ls->flags & LEXER)) garbage_collect(ls->gf); #endif return r ? r : x; } if (!(ls->flags & LEXER)) print_token(ls, ls->ctok, 0); } } else { if (ls->ltwnl && (ls->ctok->type == SHARP || ls->ctok->type == DIG_SHARP)) { int x = handle_cpp(ls, ls->ctok->type); ls->ltwnl = 1; return r ? r : x; } } if (ls->ctok->type == NEWLINE) ls->ltwnl = 1; else if (!ttWHI(ls->ctok->type)) ls->ltwnl = 0; return r ? r : -1; } #ifndef STAND_ALONE /* * llex() and lex() are the lexing functions, when the preprocessor is * linked to another code. llex() should be called only by lex(). */ static int llex(struct lexer_state *ls) { struct token_fifo *tf = ls->output_fifo; int r; if (tf->nt != 0) { if (tf->art < tf->nt) { #ifdef INMACRO_FLAG if (!ls->inmacro) { ls->inmacro = 1; ls->macro_count ++; } #endif ls->ctok = tf->t + (tf->art ++); if (ls->ctok->type > DIGRAPH_TOKENS && ls->ctok->type < DIGRAPH_TOKENS_END) { ls->ctok->type = undig(ls->ctok->type); } return 0; } else { #ifdef INMACRO_FLAG ls->inmacro = 0; #endif freemem(tf->t); tf->art = tf->nt = 0; garbage_collect(ls->gf); ls->ctok = ls->save_ctok; } } r = cpp(ls); if (ls->ctok->type > DIGRAPH_TOKENS && ls->ctok->type < LAST_MEANINGFUL_TOKEN) { ls->ctok->type = undig(ls->ctok->type); } if (r > 0) return r; if (r < 0) return 0; return llex(ls); } /* * lex() reads the next token from the processed stream and stores it * into ls->ctok. * return value: non zero on error (including CPPERR_EOF, which is not * quite an error) */ int lex(struct lexer_state *ls) { int r; do { r = llex(ls); #ifdef SEMPER_FIDELIS } while (!r && !ls->condcomp); #else } while (!r && (!ls->condcomp || (ttWHI(ls->ctok->type) && (!(ls->flags & LINE_NUM) || ls->ctok->type != NEWLINE)))); #endif return r; } #endif /* * check_cpp_errors() must be called when the end of input is reached; * it checks pending errors due to truncated constructs (actually none, * this is reserved for future evolutions). */ int check_cpp_errors(struct lexer_state *ls) { if (ls->flags & KEEP_OUTPUT) { put_char(ls, '\n'); } if (emit_dependencies) fputc('\n', emit_output); #ifndef NO_UCPP_BUF if (!(ls->flags & LEXER)) { flush_output(ls); } #endif if ((ls->flags & WARN_TRIGRAPHS) && ls->count_trigraphs) warning(0, "%ld trigraph(s) encountered", ls->count_trigraphs); return 0; } /* * init_cpp() initializes static tables inside ucpp. It needs not be * called more than once. */ void init_cpp(void) { init_cppm(); } /* * (re)init the global tables. * If standard_assertions is non 0, init the assertions table. */ void init_tables(int with_assertions) { time_t t; struct tm *ct; init_buf_lexer_state(&dsharp_lexer, 0); #ifdef PRAGMA_TOKENIZE init_buf_lexer_state(&tokenize_lexer, 0); #endif time(&t); ct = localtime(&t); #ifdef NOSTRFTIME /* we have a quite old compiler, that does not know the (standard since 1990) strftime() function. */ { char *c = asctime(ct); compile_time[0] = '"'; mmv(compile_time + 1, c + 11, 8); compile_time[9] = '"'; compile_time[10] = 0; compile_date[0] = '"'; mmv(compile_date + 1, c + 4, 7); mmv(compile_date + 8, c + 20, 4); compile_date[12] = '"'; compile_date[13] = 0; } #else strftime(compile_time, 12, "\"%H:%M:%S\"", ct); strftime(compile_date, 24, "\"%b %d %Y\"", ct); #endif init_macros(); if (with_assertions) init_assertions(); init_found_files(); } /* * Resets the include path. */ void init_include_path(char *incpath[]) { if (include_path_nb) { size_t i; for (i = 0; i < include_path_nb; i ++) freemem(include_path[i]); freemem(include_path); include_path_nb = 0; } if (incpath) { int i; for (i = 0; incpath[i]; i ++) aol(include_path, include_path_nb, sdup(incpath[i]), INCPATH_MEMG); } } /* * add_incpath() adds "path" to the standard include path. */ void add_incpath(char *path) { aol(include_path, include_path_nb, sdup(path), INCPATH_MEMG); } /* * This function cleans the memory. It should release all allocated * memory structures and may be called even if the current pre-processing * is not finished or reported an error. */ void wipeout() { struct lexer_state ls; if (include_path_nb > 0) { size_t i; for (i = 0; i < include_path_nb; i ++) freemem(include_path[i]); freemem(include_path); include_path = 0; include_path_nb = 0; } if (current_filename) freemem(current_filename); current_filename = 0; current_long_filename = 0; current_incdir = -1; protect_detect.state = 0; if (protect_detect.macro) freemem(protect_detect.macro); protect_detect.macro = 0; protect_detect.ff = 0; init_lexer_state(&ls); while (ls_depth > 0) pop_file_context(&ls); free_lexer_state(&ls); free_lexer_state(&dsharp_lexer); #ifdef PRAGMA_TOKENIZE free_lexer_state(&tokenize_lexer); #endif if (found_files_init_done) HTT_kill(&found_files); found_files_init_done = 0; if (found_files_sys_init_done) HTT_kill(&found_files_sys); found_files_sys_init_done = 0; wipe_macros(); wipe_assertions(); } #ifdef STAND_ALONE /* * print some help */ static void usage(char *command_name) { fprintf(stderr, "Usage: %s [options] [file]\n" "language options:\n" " -C keep comments in output\n" " -s keep '#' when no cpp directive is recognized\n" " -l do not emit line numbers\n" " -lg emit gcc-like line numbers\n" " -CC disable C++-like comments\n" " -a, -na, -a0 handle (or not) assertions\n" " -V disable macros with extra arguments\n" " -u understand UTF-8 in source\n" " -X enable -a, -u and -Y\n" " -c90 mimic C90 behaviour\n" " -t disable trigraph support\n" "warning options:\n" " -wt emit a final warning when trigaphs are encountered\n" " -wtt emit warnings for each trigaph encountered\n" " -wa emit warnings that are usually useless\n" " -w0 disable standard warnings\n" "directory options:\n" " -I directory add 'directory' before the standard include path\n" " -J directory add 'directory' after the standard include path\n" " -zI do not use the standard include path\n" " -M emit Makefile-like dependencies instead of normal " "output\n" " -Ma emit also dependancies for system files\n" " -o file store output in file\n" "macro and assertion options:\n" " -Dmacro predefine 'macro'\n" " -Dmacro=def predefine 'macro' with 'def' content\n" " -Umacro undefine 'macro'\n" " -Afoo(bar) assert foo(bar)\n" " -Bfoo(bar) unassert foo(bar)\n" " -Y predefine system-dependant macros\n" " -Z do not predefine special macros\n" " -d emit defined macros\n" " -e emit assertions\n" "misc options:\n" " -v print version number and settings\n" " -h show this help\n", command_name); } /* * print version and compile-time settings */ static void version(void) { size_t i; fprintf(stderr, "ucpp version %d.%d\n", VERS_MAJ, VERS_MIN); fprintf(stderr, "search path:\n"); for (i = 0; i < include_path_nb; i ++) fprintf(stderr, " %s\n", include_path[i]); } /* * parse_opt() initializes many things according to the command-line * options. * Return values: * 0 on success * 1 on semantic error (redefinition of a special macro, for instance) * 2 on syntaxic error (unknown options for instance) */ static int parse_opt(int argc, char *argv[], struct lexer_state *ls) { int i, ret = 0; char *filename = 0; int with_std_incpath = 1; int print_version = 0, print_defs = 0, print_asserts = 0; int system_macros = 0, standard_assertions = 1; init_lexer_state(ls); ls->flags = DEFAULT_CPP_FLAGS; emit_output = ls->output = stdout; for (i = 1; i < argc; i ++) if (argv[i][0] == '-') { if (!strcmp(argv[i], "-h")) { return 2; } else if (!strcmp(argv[i], "-C")) { ls->flags &= ~DISCARD_COMMENTS; } else if (!strcmp(argv[i], "-CC")) { ls->flags &= ~CPLUSPLUS_COMMENTS; } else if (!strcmp(argv[i], "-a")) { ls->flags |= HANDLE_ASSERTIONS; } else if (!strcmp(argv[i], "-na")) { ls->flags |= HANDLE_ASSERTIONS; standard_assertions = 0; } else if (!strcmp(argv[i], "-a0")) { ls->flags &= ~HANDLE_ASSERTIONS; } else if (!strcmp(argv[i], "-V")) { ls->flags &= ~MACRO_VAARG; } else if (!strcmp(argv[i], "-u")) { ls->flags |= UTF8_SOURCE; } else if (!strcmp(argv[i], "-X")) { ls->flags |= HANDLE_ASSERTIONS; ls->flags |= UTF8_SOURCE; system_macros = 1; } else if (!strcmp(argv[i], "-c90")) { ls->flags &= ~MACRO_VAARG; ls->flags &= ~CPLUSPLUS_COMMENTS; c99_compliant = 0; c99_hosted = -1; } else if (!strcmp(argv[i], "-t")) { ls->flags &= ~HANDLE_TRIGRAPHS; } else if (!strcmp(argv[i], "-wt")) { ls->flags |= WARN_TRIGRAPHS; } else if (!strcmp(argv[i], "-wtt")) { ls->flags |= WARN_TRIGRAPHS_MORE; } else if (!strcmp(argv[i], "-wa")) { ls->flags |= WARN_ANNOYING; } else if (!strcmp(argv[i], "-w0")) { ls->flags &= ~WARN_STANDARD; ls->flags &= ~WARN_PRAGMA; } else if (!strcmp(argv[i], "-s")) { ls->flags &= ~FAIL_SHARP; } else if (!strcmp(argv[i], "-l")) { ls->flags &= ~LINE_NUM; } else if (!strcmp(argv[i], "-lg")) { ls->flags |= GCC_LINE_NUM; } else if (!strcmp(argv[i], "-M")) { ls->flags &= ~KEEP_OUTPUT; emit_dependencies = 1; } else if (!strcmp(argv[i], "-Ma")) { ls->flags &= ~KEEP_OUTPUT; emit_dependencies = 2; } else if (!strcmp(argv[i], "-Y")) { system_macros = 1; } else if (!strcmp(argv[i], "-Z")) { no_special_macros = 1; } else if (!strcmp(argv[i], "-d")) { ls->flags &= ~KEEP_OUTPUT; print_defs = 1; } else if (!strcmp(argv[i], "-e")) { ls->flags &= ~KEEP_OUTPUT; print_asserts = 1; } else if (!strcmp(argv[i], "-zI")) { with_std_incpath = 0; } else if (!strcmp(argv[i], "-I") || !strcmp(argv[i], "-J")) { i ++; } else if (!strcmp(argv[i], "-o")) { if ((++ i) >= argc) { error(-1, "missing filename after -o"); return 2; } if (argv[i][0] == '-' && argv[i][1] == 0) { emit_output = ls->output = stdout; } else { ls->output = fopen(argv[i], "w"); if (!ls->output) { error(-1, "failed to open for " "writing: %s", argv[i]); return 2; } emit_output = ls->output; } } else if (!strcmp(argv[i], "-v")) { print_version = 1; } else if (argv[i][1] != 'I' && argv[i][1] != 'J' && argv[i][1] != 'D' && argv[i][1] != 'U' && argv[i][1] != 'A' && argv[i][1] != 'B') warning(-1, "unknown option '%s'", argv[i]); } else { if (filename != 0) { error(-1, "spurious filename '%s'", argv[i]); return 2; } filename = argv[i]; } init_tables(ls->flags & HANDLE_ASSERTIONS); init_include_path(0); if (filename) { #ifdef UCPP_MMAP FILE *f = fopen_mmap_file(filename); ls->input = 0; if (f) set_input_file(ls, f); #else ls->input = fopen(filename, "r"); #endif if (!ls->input) { error(-1, "file '%s' not found", filename); return 1; } #ifdef NO_LIBC_BUF setbuf(ls->input, 0); #endif set_init_filename(filename, 1); } else { ls->input = stdin; set_init_filename("", 0); } for (i = 1; i < argc; i ++) if (argv[i][0] == '-' && argv[i][1] == 'I') add_incpath(argv[i][2] ? argv[i] + 2 : argv[i + 1]); if (system_macros) for (i = 0; system_macros_def[i]; i ++) ret = ret || define_macro(ls, system_macros_def[i]); for (i = 1; i < argc; i ++) if (argv[i][0] == '-' && argv[i][1] == 'D') ret = ret || define_macro(ls, argv[i] + 2); for (i = 1; i < argc; i ++) if (argv[i][0] == '-' && argv[i][1] == 'U') ret = ret || undef_macro(ls, argv[i] + 2); if (ls->flags & HANDLE_ASSERTIONS) { if (standard_assertions) for (i = 0; system_assertions_def[i]; i ++) make_assertion(system_assertions_def[i]); for (i = 1; i < argc; i ++) if (argv[i][0] == '-' && argv[i][1] == 'A') ret = ret || make_assertion(argv[i] + 2); for (i = 1; i < argc; i ++) if (argv[i][0] == '-' && argv[i][1] == 'B') ret = ret || destroy_assertion(argv[i] + 2); } else { for (i = 1; i < argc; i ++) if (argv[i][0] == '-' && (argv[i][1] == 'A' || argv[i][1] == 'B')) warning(-1, "assertions disabled"); } if (with_std_incpath) { for (i = 0; include_path_std[i]; i ++) add_incpath(include_path_std[i]); } for (i = 1; i < argc; i ++) if (argv[i][0] == '-' && argv[i][1] == 'J') add_incpath(argv[i][2] ? argv[i] + 2 : argv[i + 1]); if (print_version) { version(); return 1; } if (print_defs) { print_defines(); emit_defines = 1; } if (print_asserts && (ls->flags & HANDLE_ASSERTIONS)) { print_assertions(); emit_assertions = 1; } return ret; } int main(int argc, char *argv[]) { struct lexer_state ls; int r, fr = 0; init_cpp(); if ((r = parse_opt(argc, argv, &ls)) != 0) { if (r == 2) usage(argv[0]); return EXIT_FAILURE; } enter_file(&ls, ls.flags, 0); while ((r = cpp(&ls)) < CPPERR_EOF) fr = fr || (r > 0); fr = fr || check_cpp_errors(&ls); free_lexer_state(&ls); wipeout(); #ifdef MEM_DEBUG report_leaks(); #endif return fr ? EXIT_FAILURE : EXIT_SUCCESS; } #endif synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/nhash.c0000644000076400007640000003135311163213575021072 0ustar stefanstefan/* * Mixed hash table / binary tree code. * (c) Thomas Pornin 2002 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. The name of the authors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #include #include #include #include "nhash.h" #include "mem.h" /* * Hash a string into an `unsigned' value. This function is derived * from the hash function used in the ELF binary object file format * hash tables. The result size is a 32-bit number if the `unsigned' * type is big enough to hold 32-bit arbitrary numbers, a 16-bit number * otherwise. */ static unsigned hash_string(char *name) { unsigned h = 0; for (h = 0; *name; name ++) { unsigned g; h = (h << 4) + *(unsigned char *)name; #if UINT_MAX >= 0xffffffffU g = h & 0xF0000000U; h ^= (g >> 24); #else g = h & 0xF000U; h ^= (g >> 12); #endif h &= ~g; } return h; } /* * Each item in the table is a structure beginning with a `hash_item_header' * structure. Those headers define binary trees such that all left-descendants * (respectively right-descendants) of a given tree node have an associated * hash value strictly smaller (respectively greater) than the hash value * associated with this node. * * The `ident' field points to an array of char. The `sizeof(unsigned)' * first `char' contain a copy of an `unsigned' value which is the hashed * string, except the least significant bit. When this bit is set to 0, * the node contains the unique item using that hash value. If the bit * is set to 1, then there are several items with that hash value. * * When several items share the same hash value, they are linked together * in a linked list by their `left' field. The node contains no data; * it is a "fake item". * * The `char' following the hash value encode the item name for true items. * For fake items, they contain the pointer to the first true item of the * corresponding link list (suitably aligned). * * There are HTT_NUM_TREES trees; the items are sorted among trees by the * lest significant bits of their hash value. */ static void internal_init(HTT *htt, void (*deldata)(void *), int reduced) { htt->deldata = deldata; if (reduced) { HTT2 *htt2 = (HTT2 *)htt; htt2->tree[0] = htt2->tree[1] = NULL; } else { unsigned u; for (u = 0; u < HTT_NUM_TREES; u ++) htt->tree[u] = NULL; } } /* see nhash.h */ void HTT_init(HTT *htt, void (*deldata)(void *)) { internal_init(htt, deldata, 0); } /* see nhash.h */ void HTT2_init(HTT2 *htt, void (*deldata)(void *)) { internal_init((HTT *)htt, deldata, 1); } #define PTR_SHIFT (sizeof(hash_item_header *) * \ ((sizeof(unsigned) + sizeof(hash_item_header *) - 1) / \ sizeof(hash_item_header *))) #define TREE(u) (*(reduced ? ((HTT2 *)htt)->tree + ((u) & 1) \ : htt->tree + ((u) & (HTT_NUM_TREES - 1)))) /* * Find a node for the given hash value. If `father' is not NULL, fill * `*father' with a pointer to the node's father. * If the return value is NULL, then no existing node was found; if `*father' * is also NULL, the tree is empty. If the return value is not NULL but * `*father' is NULL, then the found node is the tree root. * * If `father' is not NULL, then `*leftson' is filled with 1 if the node * was looked for as the father left son, 0 otherwise. */ static hash_item_header *find_node(HTT *htt, unsigned u, hash_item_header **father, int *leftson, int reduced) { hash_item_header *node = TREE(u); hash_item_header *nodef = NULL; int ls; u &= ~1U; while (node != NULL) { unsigned v = *(unsigned *)(node->ident); unsigned w = v & ~1U; if (u == w) break; nodef = node; if (u < w) { node = node->left; ls = 1; } else { node = node->right; ls = 0; } } if (father != NULL) { *father = nodef; *leftson = ls; } return node; } static void *internal_get(HTT *htt, char *name, int reduced) { unsigned u = hash_string(name), v; hash_item_header *node = find_node(htt, u, NULL, NULL, reduced); if (node == NULL) return NULL; v = *(unsigned *)(node->ident); if ((v & 1U) == 0) { return (strcmp(HASH_ITEM_NAME(node), name) == 0) ? node : NULL; } node = *(hash_item_header **)(node->ident + PTR_SHIFT); while (node != NULL) { if (strcmp(HASH_ITEM_NAME(node), name) == 0) return node; node = node->left; } return NULL; } /* see nhash.h */ void *HTT_get(HTT *htt, char *name) { return internal_get(htt, name, 0); } /* see nhash.h */ void *HTT2_get(HTT2 *htt, char *name) { return internal_get((HTT *)htt, name, 1); } /* * Make an item identifier from its name and its hash value. */ static char *make_ident(char *name, unsigned u) { size_t n = strlen(name) + 1; char *ident = getmem(n + sizeof(unsigned)); *(unsigned *)ident = u & ~1U; memcpy(ident + sizeof(unsigned), name, n); return ident; } /* * Make an identifier for a fake item, pointing to a true item. */ static char *make_fake_ident(unsigned u, hash_item_header *next) { char *ident = getmem(PTR_SHIFT + sizeof(hash_item_header *)); *(unsigned *)ident = u | 1U; *(hash_item_header **)(ident + PTR_SHIFT) = next; return ident; } /* * Adding an item is straightforward: * 1. look for its emplacement * 2. if no node is found, use the item as a new node and link it to the tree * 3. if a node is found: * 3.1. if the node is real, check for name inequality, then create a * fake node and assemble the two-element linked list * 3.2. if the node is fake, look for the name in the list; if not found, * add the node at the list end */ static void *internal_put(HTT *htt, void *item, char *name, int reduced) { unsigned u = hash_string(name), v; int ls; hash_item_header *father; hash_item_header *node = find_node(htt, u, &father, &ls, reduced); hash_item_header *itemg = item, *pnode; if (node == NULL) { itemg->left = itemg->right = NULL; itemg->ident = make_ident(name, u); if (father == NULL) { TREE(u) = itemg; } else if (ls) { father->left = itemg; } else { father->right = itemg; } return NULL; } v = *(unsigned *)(node->ident); if ((v & 1U) == 0) { if (strcmp(HASH_ITEM_NAME(node), name) == 0) return node; pnode = getmem(sizeof *pnode); pnode->left = node->left; pnode->right = node->right; pnode->ident = make_fake_ident(u, node); node->left = itemg; node->right = NULL; itemg->left = itemg->right = NULL; itemg->ident = make_ident(name, u); if (father == NULL) { TREE(u) = pnode; } else if (ls) { father->left = pnode; } else { father->right = pnode; } return NULL; } node = *(hash_item_header **)(node->ident + PTR_SHIFT); while (node != NULL) { if (strcmp(HASH_ITEM_NAME(node), name) == 0) return node; pnode = node; node = node->left; } itemg->left = itemg->right = NULL; itemg->ident = make_ident(name, u); pnode->left = itemg; return NULL; } /* see nhash.h */ void *HTT_put(HTT *htt, void *item, char *name) { return internal_put(htt, item, name, 0); } /* see nhash.h */ void *HTT2_put(HTT2 *htt, void *item, char *name) { return internal_put((HTT *)htt, item, name, 1); } /* * A fake node subnode list has shrunk to one item only; make the * node real again. * fnode the fake node * node the last remaining node * father the fake node father (NULL if the fake node is root) * leftson 1 if the fake node is a left son, 0 otehrwise * u the hash value for this node */ static void shrink_node(HTT *htt, hash_item_header *fnode, hash_item_header *node, hash_item_header *father, int leftson, unsigned u, int reduced) { node->left = fnode->left; node->right = fnode->right; if (father == NULL) { TREE(u) = node; } else if (leftson) { father->left = node; } else { father->right = node; } freemem(fnode->ident); freemem(fnode); } /* * Deletion algorithm: * 1. look for the node; if not found, exit * 2. if the node is real: * 2.1. check for equality; exit otherwise * 2.2. delete the node * 2.3. promote the leftest of right descendants or rightest of left * descendants * 3. if the node is fake: * 3.1. check the list items for equality; exit otherwise * 3.2. delete the correct item * 3.3. if there remains only one item, supress the fake node */ static int internal_del(HTT *htt, char *name, int reduced) { unsigned u = hash_string(name), v; int ls; hash_item_header *father; hash_item_header *node = find_node(htt, u, &father, &ls, reduced); hash_item_header *pnode, *fnode, *znode; char *tmp; if (node == NULL) return 0; v = *(unsigned *)(node->ident); if ((v & 1U) != 0) { fnode = node; node = znode = *(hash_item_header **)(node->ident + PTR_SHIFT); pnode = NULL; while (node != NULL) { if (strcmp(HASH_ITEM_NAME(node), name) == 0) break; pnode = node; node = node->left; } if (node == NULL) return 0; if (pnode == NULL) { /* * We supress the first item in the list. */ *(hash_item_header **)(fnode->ident + PTR_SHIFT) = node->left; if (node->left->left == NULL) { shrink_node(htt, fnode, node->left, father, ls, u, reduced); } } else { pnode->left = node->left; if (pnode->left == NULL && znode == pnode) { shrink_node(htt, fnode, pnode, father, ls, u, reduced); } } } else { if (strcmp(HASH_ITEM_NAME(node), name) != 0) return 0; if (node->left != NULL) { for (znode = node, pnode = node->left; pnode->right; znode = pnode, pnode = pnode->right); if (znode != node) { znode->right = pnode->left; pnode->left = node->left; } pnode->right = node->right; } else if (node->right != NULL) { for (znode = node, pnode = node->right; pnode->left; znode = pnode, pnode = pnode->left); if (znode != node) { znode->left = pnode->right; pnode->right = node->right; } pnode->left = node->left; } else pnode = NULL; if (father == NULL) { TREE(u) = pnode; } else if (ls) { father->left = pnode; } else { father->right = pnode; } } tmp = node->ident; htt->deldata(node); freemem(tmp); return 1; } /* see nhash.h */ int HTT_del(HTT *htt, char *name) { return internal_del(htt, name, 0); } /* see nhash.h */ int HTT2_del(HTT2 *htt, char *name) { return internal_del((HTT *)htt, name, 1); } /* * Apply `action()' on all nodes of the tree whose root is given as * parameter `node'. If `wipe' is non-zero, the nodes are removed * from memory. */ static void scan_node(hash_item_header *node, void (*action)(void *), int wipe) { unsigned v; if (node == NULL) return; scan_node(node->left, action, wipe); scan_node(node->right, action, wipe); v = *(unsigned *)(node->ident); if ((v & 1U) != 0) { hash_item_header *pnode, *nnode; for (pnode = *(hash_item_header **)(node->ident + PTR_SHIFT); pnode != NULL; pnode = nnode) { char *tmp = pnode->ident; nnode = pnode->left; action(pnode); if (wipe) freemem(tmp); } if (wipe) { freemem(node->ident); freemem(node); } } else { char *tmp = node->ident; action(node); if (wipe) freemem(tmp); } } /* see nhash.h */ void HTT_scan(HTT *htt, void (*action)(void *)) { unsigned u; for (u = 0; u < HTT_NUM_TREES; u ++) { scan_node(htt->tree[u], action, 0); } } /* see nhash.h */ void HTT2_scan(HTT2 *htt, void (*action)(void *)) { scan_node(htt->tree[0], action, 0); scan_node(htt->tree[1], action, 0); } /* see nhash.h */ void HTT_kill(HTT *htt) { unsigned u; for (u = 0; u < HTT_NUM_TREES; u ++) { scan_node(htt->tree[u], htt->deldata, 1); } } /* see nhash.h */ void HTT2_kill(HTT2 *htt) { scan_node(htt->tree[0], htt->deldata, 1); scan_node(htt->tree[1], htt->deldata, 1); } synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/ParserImpl.cc0000664000076400007640000002307411171353360022211 0ustar stefanstefan// // Copyright (C) 2003 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include #include #include #include #include #include #include #include #include #include "comments.hh" using namespace Synopsis; void ucpp(char const *input, char const *output, std::vector const &flags); namespace { PyObject *py_error; int verbose = 0; int debug = 0; int profile = 0; int primary_file_only = 0; bool active = true; char const *language; std::string base_path; // these python objects need to be referenced as pointers // since the python runtime environment has to be initiaized first std::auto_ptr asg_kit; std::auto_ptr sf_kit; std::auto_ptr ir; std::auto_ptr source_file; char const *input = 0; //. creates new SourceFile object and store it into ast SourceFile create_source_file(std::string const &filename, bool primary) { Path path = Path(filename).abs(); path.strip(base_path); std::string name = path.str(); SourceFile sf = sf_kit->create_source_file(name, filename); Python::Dict files = ir->files(); files.set(name, sf); if (primary) sf.set_primary(true); return sf; } //. creates new or returns existing SourceFile object //. with the given filename SourceFile lookup_source_file(std::string const &filename, bool primary) { Python::Dict files = ir->files(); Path path = Path(filename).abs(); path.strip(base_path); SourceFile sf = files.get(path.str()); if (sf && primary) sf.set_primary(true); return sf ? sf : create_source_file(filename, primary); } //. creates new Macro object void create_macro(char const *filename, int line, char const *macro_name, int num_args, char const **args, int vaarg, char const *text) { Python::Tuple name(macro_name); SourceFile sf = lookup_source_file(filename, true); Python::List params; if (args) { for (int i = 0; i < num_args; ++i) params.append(args[i]); if (vaarg) params.append("..."); } ASG::Macro macro = asg_kit->create_macro(sf, line, name, params, text); Python::List comments; for (std::vector::iterator i = comment_cache.begin(); i != comment_cache.end(); ++i) { if (*i->rbegin() == '\n') i->erase(i->size() - 1); comments.append(*i); } clear_comment_cache(); macro.annotations().set("comments", comments); Python::Module qn = Python::Module::import("Synopsis.QualifiedName"); Python::Object qname_ = qn.attr("QualifiedCxxName"); ASG::DeclaredTypeId declared = asg_kit->create_declared_type_id(qname_(Python::Tuple(Python::Object(name))), macro); Python::List declarations = ir->declarations(); declarations.append(macro); Python::Dict types = ir->types(); types.set(qname_(name), declared); } bool extract(PyObject *py_flags, std::vector &out) { Py_INCREF(py_flags); Python::List list = Python::Object(py_flags); for (size_t i = 0; i != list.size(); ++i) { std::string value = Python::Object::narrow(list.get(i)); out.push_back(value); } return true; } PyObject *ucpp_parse(PyObject *self, PyObject *args) { char const *py_base_path; char *output; PyObject *py_system_flags, *py_flags; std::vector flags; PyObject *py_ir; if (!PyArg_ParseTuple(args, "OszzsO!O!iiii", &py_ir, &input, &py_base_path, &output, &language, &PyList_Type, &py_system_flags, &PyList_Type, &py_flags, &primary_file_only, &verbose, &debug, &profile) || !extract(py_flags, flags) || !extract(py_system_flags, flags)) return 0; Py_INCREF(py_error); std::auto_ptr error_type(new Python::Object(py_error)); Py_INCREF(py_ir); // since everything in this file is accessed only during the execution // of ucpp_parse, we can safely manage these objects in this scope yet // reference them globally (for convenience) ir.reset(new IR(py_ir)); asg_kit.reset(new ASG::ASGKit(language)); sf_kit.reset(new SourceFileKit(language)); try { if (py_base_path) { Path path(py_base_path); base_path = path.abs().str(); } source_file.reset(new SourceFile(lookup_source_file(input, true))); // ucpp considers __STDC__ to be predefined, and doesn't allow // us to set it explicitely. flags.erase(std::remove(flags.begin(), flags.end(), std::string("-D__STDC__=1")), flags.end()); if (verbose) { std::cout << "calling ucpp\n"; for (std::vector::iterator i = flags.begin(); i != flags.end(); ++i) std::cout << ' ' << *i; std::cout << std::endl; } ucpp(input, output, flags); Python::Dict files = ir->files(); Path path = Path(input).abs(); path.strip(base_path); files.set(path.str(), *source_file); py_ir = ir->ref(); // add new reference // make sure these objects are deleted before the python runtime source_file.reset(); asg_kit.reset(); sf_kit.reset(); ir.reset(); return py_ir; } catch (std::exception const &e) { Python::Object py_e((*error_type)(Python::Tuple(e.what()))); PyErr_SetObject(py_error, py_e.ref()); source_file.reset(); asg_kit.reset(); sf_kit.reset(); ir.reset(); return 0; } } extern "C" { //. This function is a callback from the ucpp code to report //. a context switch in the parser, i.e. either to enter a //. new (included) file (@new_file == true) or to return control //. to an already open file once parsing an included file is //. terminated (@new_file == false) //. Depending on whether the new filename matches with the base_path, //. the parser is activated or deactivated void synopsis_file_hook(char const *filename, int new_file) { // turn 'filename' into an absolute path so we can match it against // base_path std::string abs_filename = Path(filename).abs().str(); bool activate = false; if ((primary_file_only && strcmp(input, filename)) || (base_path.size() && abs_filename.substr(0, base_path.size()) != base_path)) active = false; else { if (!active) active = activate = true; } if (!active) return; // just for symmetry, don't report if we were just activated if (debug && !activate) if (new_file) std::cout << "entering new file " << abs_filename << std::endl; else std::cout << "returning to file " << abs_filename << std::endl; source_file.reset(new SourceFile(lookup_source_file(abs_filename, true))); } //. This function is a callback from the ucpp code to store macro //. expansions void synopsis_macro_hook(char const *name, int start_line, int start_col, int end_line, int end_col, int e_start_line, int e_start_col, int e_end_line, int e_end_col) { if (!active) return; if (debug) std::cout << "macro : " << name << " (" << start_line << ':' << start_col << ")<->(" << end_line << ':' << end_col << ") expanded to (" << e_start_line << ':' << e_start_col << ")<->(" << e_end_line << ':' << e_end_col << ')' << std::endl; Python::List calls = source_file->macro_calls(); calls.append(sf_kit->create_macro_call(name, start_line, start_col, end_line, end_col, e_start_line, e_start_col, e_end_line, e_end_col)); } //. This function is a callback from the ucpp code to store includes void synopsis_include_hook(char const *source, char const *target, char const *fname, int is_system, int is_macro, int is_next) { if (!active) return; std::string name = fname; if (is_system) name = '"' + name + '"'; else name = '<' + name + '>'; if (debug) // source may be 0 std::cout << "include : " << target << ' ' << name << ' ' << is_macro << ' ' << is_next << std::endl; Path path = Path(target).abs(); // bool main = !base_path || strncmp(path.str().c_str(), base_path, strlen(base_path)); SourceFile target_file = lookup_source_file(path.str(), false); Include include = sf_kit->create_include(target_file, name, is_macro, is_next); Python::List includes = source_file->includes(); includes.append(include); } //. This function is a callback from the ucpp code to store macro //. definitions void synopsis_define_hook(char const *filename, int line, char const *name, int num_args, char const **args, int vaarg, char const *text) { if (!active) return; if (debug) std::cout << "define : " << filename << ' ' << line << ' ' << name << ' ' << num_args << ' ' << text << std::endl; create_macro(filename, line, name, num_args, args, vaarg, text); } }; PyMethodDef methods[] = {{(char*)"parse", ucpp_parse, METH_VARARGS}, {0}}; }; extern "C" void initParserImpl() { Python::Module module = Python::Module::define("ParserImpl", methods); module.set_attr("version", "0.1"); Python::Object processor = Python::Object::import("Synopsis.Processor"); Python::Object error_base = processor.attr("Error"); py_error = PyErr_NewException("ParserImpl.ParseError", error_base.ref(), 0); module.set_attr("ParseError", py_error); } synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/mem.h0000664000076400007640000001105611163213143020543 0ustar stefanstefan/* * (c) Thomas Pornin 1998 - 2002 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. The name of the authors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef UCPP__MEM__ #define UCPP__MEM__ #include void die(void); #if defined AUDIT || defined MEM_CHECK || defined MEM_DEBUG void *getmem(size_t); #else #define getmem malloc #endif #if defined MEM_DEBUG void *getmem_debug(size_t, char *, int); #undef getmem #define getmem(x) getmem_debug(x, __FILE__, __LINE__) #endif #if defined AUDIT || defined MEM_DEBUG void freemem(void *); #else #define freemem free #endif #if defined MEM_DEBUG void freemem_debug(void *, char *, int); #undef freemem #define freemem(x) freemem_debug(x, __FILE__, __LINE__) #endif void *incmem(void *, size_t, size_t); char *sdup(char *); #if defined MEM_DEBUG void *incmem_debug(void *, size_t, size_t, char *, int); #undef incmem #define incmem(x, y, z) incmem_debug(x, y, z, __FILE__, __LINE__) void report_leaks(void); char *sdup_debug(char *, char *, int); #define sdup(x) sdup_debug(x, __FILE__, __LINE__) #endif #ifdef AUDIT void *mmv(void *, void *, size_t); void *mmvwo(void *, void *, size_t); #else #define mmv memcpy #define mmvwo memmove #endif /* * this macro adds the object obj at the end of the array list, handling * memory allocation when needed; ptr contains the number of elements in * the array, and memg is the granularity of memory allocations (a power * of 2 is recommanded, for optimization reasons). * * list and ptr may be updated, and thus need to be lvalues. */ #define aol(list, ptr, obj, memg) do { \ if (((ptr) % (memg)) == 0) { \ if ((ptr) != 0) { \ (list) = incmem((list), (ptr) * sizeof(obj), \ ((ptr) + (memg)) * sizeof(obj)); \ } else { \ (list) = getmem((memg) * sizeof(obj)); \ } \ } \ (list)[(ptr) ++] = (obj); \ } while (0) /* * bol() does the same as aol(), but adds the new item at the beginning * of the list; beware, the computational cost is greater. */ #define bol(list, ptr, obj, memg) do { \ if (((ptr) % (memg)) == 0) { \ if ((ptr) != 0) { \ (list) = incmem((list), (ptr) * sizeof(obj), \ ((ptr) + (memg)) * sizeof(obj)); \ } else { \ (list) = getmem((memg) * sizeof(obj)); \ } \ } \ if ((ptr) != 0) \ mmvwo((list) + 1, (list), (ptr) * sizeof(obj)); \ (ptr) ++; \ (list)[0] = (obj); \ } while (0) /* * mbol() does the same as bol(), but adds the new item at the given * emplacement; bol() is equivalent to mbol with 0 as last argument. */ #define mbol(list, ptr, obj, memg, n) do { \ if (((ptr) % (memg)) == 0) { \ if ((ptr) != 0) { \ (list) = incmem((list), (ptr) * sizeof(obj), \ ((ptr) + (memg)) * sizeof(obj)); \ } else { \ (list) = getmem((memg) * sizeof(obj)); \ } \ } \ if ((ptr) > n) \ mmvwo((list) + n + 1, (list) + n, \ ((ptr) - n) * sizeof(obj)); \ (ptr) ++; \ (list)[n] = (obj); \ } while (0) /* * this macro adds the object obj at the end of the array list, doubling * the size of list when needed; as for aol(), ptr and list must be * lvalues, and so must be llng */ #define wan(list, ptr, obj, llng) do { \ if ((ptr) == (llng)) { \ (llng) += (llng); \ (list) = incmem((list), (ptr) * sizeof(obj), \ (llng) * sizeof(obj)); \ } \ (list)[(ptr) ++] = (obj); \ } while (0) #endif synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/nhash.h0000644000076400007640000001112011163213575021065 0ustar stefanstefan/* * (c) Thomas Pornin 2002 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. The name of the authors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef UCPP__NHASH__ #define UCPP__NHASH__ /* * Each item stored in the hash table should be a structure beginning * with the following header. */ typedef struct hash_item_header_ { char *ident; struct hash_item_header_ *left, *right; } hash_item_header; /* * This macro takes as argument a pointer to a hash table item (a * structure beginning with `hash_item_header') and returns a pointer to * the item name. This name should be considered as read-only. The * retrieved pointer can become invalid whenever a new item is inserted * in or removed from the table. */ #define HASH_ITEM_NAME(s) (((hash_item_header *)(s))->ident + sizeof(unsigned)) /* * Number of lists for the primary hash step. Can be reduced to save more * memory, or increased to speed things up. It should be a power of 2 * greater or equal than 2 and smaller than UINT_MAX. */ #define HTT_NUM_TREES 128 /* * Type for a hash table. */ typedef struct { void (*deldata)(void *); hash_item_header *tree[HTT_NUM_TREES]; } HTT; /* * Type for a reduced version of HTT with only two binary trees. That * version has a lower initialization time and is suitable for situation * where only a limited number of elements will be stored, but new tables * need frequent initializations. */ typedef struct { void (*deldata)(void *); hash_item_header *tree[2]; } HTT2; /* * Initialize a hash table. The `deldata' parameter should point to a * function which will be invoked on any item removed from the table; * that function should take care of the release of memory allocated for * that item (except the hash_item_header contents, which are handled * internally). */ void HTT_init(HTT *htt, void (*deldata)(void *)); /* * Link an item into the hash table under the given name. If another * item of identical name is already present in the table, a pointer to * that item is returned; otherwise, the new item is linked into the * table and NULL is returned. The object pointed to by `item' is * linked from the table, but not the string pointed to by `name'. */ void *HTT_put(HTT *htt, void *item, char *name); /* * Retrieve an item by name from the hash table. NULL is returned if * the object is not found. */ void *HTT_get(HTT *htt, char *name); /* * Remove an item from the hash table. 1 is returned if the item was * removed, 0 if it was not found. */ int HTT_del(HTT *htt, char *name); /* * For all items stored within the hash table, invoke the provided * function with the item as parameter. The function may abort the * scan by performing a longjmp() to a context encapsulating the * call to that function. */ void HTT_scan(HTT *htt, void (*action)(void *)); /* * Release the whole table contents. After a call to this function, * the table is ready to accept new items. */ void HTT_kill(HTT *htt); /* * The following functions are identical to the HTT_*() functions, except * that they operate on the reduced HTT2 tables. */ void HTT2_init(HTT2 *htt, void (*deldata)(void *)); void *HTT2_put(HTT2 *htt, void *item, char *name); void *HTT2_get(HTT2 *htt, char *name); int HTT2_del(HTT2 *htt, char *name); void HTT2_scan(HTT2 *htt, void (*action)(void *)); void HTT2_kill(HTT2 *htt); #endif synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/macro.c0000664000076400007640000014336311171262711021074 0ustar stefanstefan/* * (c) Thomas Pornin 1999 - 2002 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. The name of the authors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #include "tune.h" #include #include #include #include #include "ucppi.h" #include "mem.h" #include "nhash.h" #ifdef SYNOPSIS void synopsis_define_hook(const char* file, int line, const char* name, int num_args, const char** args, int vaarg, const char* text); #endif /* * we store macros in a hash table, and retrieve them using their name * as identifier. */ static HTT macros; static int macros_init_done = 0; static void del_macro(void *m) { struct macro *n = m; size_t i; for (i = 0; (int)i < n->narg; i ++) freemem(n->arg[i]); if (n->narg > 0) freemem(n->arg); #ifdef LOW_MEM if (n->cval.length) freemem(n->cval.t); #else if (n->val.nt) { for (i = 0; i < n->val.nt; i ++) if (S_TOKEN(n->val.t[i].type)) freemem(n->val.t[i].name); freemem(n->val.t); } #endif freemem(n); } static inline struct macro *new_macro(void) { struct macro *m = getmem(sizeof(struct macro)); m->narg = -1; m->nest = 0; #ifdef LOW_MEM m->cval.length = 0; #else m->val.nt = m->val.art = 0; #endif m->vaarg = 0; return m; } /* * for special macros, and the "defined" operator */ enum { MAC_NONE, MAC_DEFINED, MAC_LINE, MAC_FILE, MAC_DATE, MAC_TIME, MAC_STDC, MAC_PRAGMA }; #define MAC_SPECIAL MAC_LINE /* * returns 1 for "defined" * returns x > 1 for a special macro such as __FILE__ * returns 0 otherwise */ static inline int check_special_macro(char *name) { if (!strcmp(name, "defined")) return MAC_DEFINED; if (*name != '_') return MAC_NONE; if (*(name + 1) == 'P') { if (!strcmp(name, "_Pragma")) return MAC_PRAGMA; return MAC_NONE; } else if (*(name + 1) != '_') return MAC_NONE; if (no_special_macros) return MAC_NONE; if (!strcmp(name, "__LINE__")) return MAC_LINE; else if (!strcmp(name, "__FILE__")) return MAC_FILE; else if (!strcmp(name, "__DATE__")) return MAC_DATE; else if (!strcmp(name, "__TIME__")) return MAC_TIME; else if (!strcmp(name, "__STDC__")) return MAC_STDC; return MAC_NONE; } int c99_compliant = 1; int c99_hosted = 1; /* * add the special macros to the macro table */ static void add_special_macros(void) { struct macro *m; HTT_put(¯os, new_macro(), "__LINE__"); HTT_put(¯os, new_macro(), "__FILE__"); HTT_put(¯os, new_macro(), "__DATE__"); HTT_put(¯os, new_macro(), "__TIME__"); HTT_put(¯os, new_macro(), "__STDC__"); m = new_macro(); m->narg = 1; m->arg = getmem(sizeof(char *)); m->arg[0] = sdup("foo"); HTT_put(¯os, m, "_Pragma"); if (c99_compliant) { #ifndef LOW_MEM struct token t; #endif m = new_macro(); #ifdef LOW_MEM m->cval.t = getmem(9); m->cval.t[0] = NUMBER; mmv(m->cval.t + 1, "199901L", 8); m->cval.length = 9; #else t.type = NUMBER; t.line = 0; t.name = sdup("199901L"); aol(m->val.t, m->val.nt, t, TOKEN_LIST_MEMG); #endif HTT_put(¯os, m, "__STDC_VERSION__"); } if (c99_hosted) { #ifndef LOW_MEM struct token t; #endif m = new_macro(); #ifdef LOW_MEM m->cval.t = getmem(3); m->cval.t[0] = NUMBER; mmv(m->cval.t + 1, "1", 2); m->cval.length = 3; #else t.type = NUMBER; t.line = 0; t.name = sdup("1"); aol(m->val.t, m->val.nt, t, TOKEN_LIST_MEMG); #endif HTT_put(¯os, m, "__STDC_HOSTED__"); } } #ifdef LOW_MEM /* * We store macro arguments as a single-byte token MACROARG, followed * by the argument number as a one or two-byte value. If the argument * number is between 0 and 127 (inclusive), it is stored as such in * a single byte. Otherwise, it is supposed to be a 14-bit number, with * the 7 upper bits stored in the first byte (with the high bit set to 1) * and the 7 lower bits in the second byte. */ #endif /* * print the content of a macro, in #define form */ static void print_macro(void *vm) { struct macro *m = vm; char *mname = HASH_ITEM_NAME(m); int x = check_special_macro(mname); size_t i; if (x != MAC_NONE) { fprintf(emit_output, "/* #define %s */ /* special */\n", mname); return; } fprintf(emit_output, "#define %s", mname); if (m->narg >= 0) { fprintf(emit_output, "("); for (i = 0; i < (size_t)(m->narg); i ++) { fprintf(emit_output, i ? ", %s" : "%s", m->arg[i]); } if (m->vaarg) { fputs(m->narg ? ", ..." : "...", emit_output); } fprintf(emit_output, ")"); } #ifdef LOW_MEM if (m->cval.length == 0) { fputc('\n', emit_output); return; } fputc(' ', emit_output); for (i = 0; i < m->cval.length;) { int tt = m->cval.t[i ++]; if (tt == MACROARG) { unsigned anum = m->cval.t[i]; if (anum >= 128) anum = ((anum & 127U) << 8) | m->cval.t[++ i]; if (anum == (unsigned)m->narg) fputs("__VA_ARGS__", emit_output); else fputs(m->arg[anum], emit_output); i ++; } else if (S_TOKEN(tt)) { fputs((char *)(m->cval.t + i), emit_output); i += 1 + strlen((char *)(m->cval.t + i)); } else fputs(operators_name[tt], emit_output); } #else if (m->val.nt == 0) { fputc('\n', emit_output); return; } fputc(' ', emit_output); for (i = 0; i < m->val.nt; i ++) { if (m->val.t[i].type == MACROARG) { if (m->val.t[i].line == m->narg) fputs("__VA_ARGS__", emit_output); else fputs(m->arg[(size_t)(m->val.t[i].line)], emit_output); } else fputs(token_name(m->val.t + i), emit_output); } #endif fputc('\n', emit_output); } /* * Send a token to the output (a token_fifo in lexer mode, the output * buffer in stand alone mode). */ void print_token(struct lexer_state *ls, struct token *t, long uz_line) { char *x = t->name; if (uz_line && t->line < 0) t->line = uz_line; if (ls->flags & LEXER) { struct token at; at = *t; at.pos = ls->ocolumn; if (S_TOKEN(at.type)) { at.name = sdup(at.name); throw_away(ls->gf, at.name); ls->ocolumn += strlen(at.name); } else switch (at.type) { case NEWLINE: ++ls->oline; case CONTEXT: case PRAGMA: ls->ocolumn = 1; break; default: ls->ocolumn += strlen(operators_name[at.type]); } aol(ls->output_fifo->t, ls->output_fifo->nt, at, TOKEN_LIST_MEMG); return; } if (ls->flags & KEEP_OUTPUT) { for (; ls->oline < ls->line;) put_char(ls, '\n'); } if (!S_TOKEN(t->type)) x = operators_name[t->type]; for (; *x; x ++) put_char(ls, *x); } /* * Send a token to the output at a given line (this is for text output * and unreplaced macros due to lack of arguments). */ static void print_token_nailed(struct lexer_state *ls, struct token *t, long nail_line) { char *x = t->name; if (ls->flags & LEXER) { print_token(ls, t, 0); return; } if (ls->flags & KEEP_OUTPUT) { for (; ls->oline < nail_line;) put_char(ls, '\n'); } if (!S_TOKEN(t->type)) x = operators_name[t->type]; for (; *x; x ++) put_char(ls, *x); } /* * send a reduced whitespace token to the output */ #define print_space(ls) do { \ struct token lt; \ lt.type = OPT_NONE; \ lt.line = (ls)->line; \ print_token((ls), <, 0); \ } while (0) /* * We found a #define directive; parse the end of the line, perform * sanity checks, store the new macro into the "macros" hash table. * * In case of a redefinition of a macro: we enforce the rule that a * macro should be redefined identically, including the spelling of * parameters. We emit an error on offending code; dura lex, sed lex. * After all, it is easy to avoid such problems, with a #undef directive. */ int handle_define(struct lexer_state *ls) { struct macro *m = 0, *n; #ifdef LOW_MEM struct token_fifo mv; #endif int ltwws = 1, redef = 0; char *mname = 0; int narg; size_t nt; long l = ls->line; long start_line = ls->line; long end_line = start_line; #ifdef LOW_MEM mv.art = mv.nt = 0; #endif /* find the next non-white token on the line, this should be the macro name */ while (!next_token(ls) && ls->ctok->type != NEWLINE) { if (ttMWS(ls->ctok->type)) continue; if (ls->ctok->type == NAME) mname = sdup(ls->ctok->name); break; } if (mname == 0) { error(l, "missing macro name"); return 1; } if (check_special_macro(mname)) { error(l, "trying to redefine the special macro %s", mname); goto warp_error; } /* * If a macro with this name was already defined: the K&R * states that the new macro should be identical to the old one * (with some arcane rule of equivalence of whitespace); otherwise, * redefining the macro is an error. Most preprocessors would * only emit a warning (or nothing at all) on an unidentical * redefinition. * * Since it is easy to avoid this error (with a #undef directive), * we choose to enforce the rule and emit an error. */ if ((n = HTT_get(¯os, mname)) != 0) { /* redefinition of a macro: we must check that we define it identical */ redef = 1; #ifdef LOW_MEM n->cval.rp = 0; #endif freemem(mname); mname = 0; } if (!redef) { m = new_macro(); m->narg = -1; #ifdef LOW_MEM #define mval mv #else #define mval (m->val) #endif } if (next_token(ls)) goto define_end; /* * Check if the token immediately following the macro name is * a left parenthesis; if so, then this is a macro with arguments. * Collect their names and try to match the next parenthesis. */ if (ls->ctok->type == LPAR) { int i, j; int need_comma = 0, saw_mdots = 0; narg = 0; while (!next_token(ls)) { if (ls->ctok->type == NEWLINE) { error(l, "truncated macro definition"); goto define_error; } if (ls->ctok->type == COMMA) { if (saw_mdots) { error(l, "'...' must end the macro " "argument list"); goto warp_error; } if (!need_comma) { error(l, "void macro argument"); goto warp_error; } need_comma = 0; continue; } else if (ls->ctok->type == NAME) { if (saw_mdots) { error(l, "'...' must end the macro " "argument list"); goto warp_error; } if (need_comma) { error(l, "missing comma in " "macro argument list"); goto warp_error; } if (!redef) { aol(m->arg, narg, sdup(ls->ctok->name), 8); /* we must keep track of m->narg so that cleanup in case of error works. */ m->narg = narg; if (narg == 128 && (ls->flags & WARN_STANDARD)) warning(l, "more arguments to " "macro than the ISO " "limit (127)"); #ifdef LOW_MEM if (narg == 32767) { error(l, "too many arguments " "in macro definition " "(max 32766)"); goto warp_error; } #endif } else { /* this is a redefinition of the macro; check equality between old and new definitions */ if (narg >= n->narg) goto redef_error; if (strcmp(ls->ctok->name, n->arg[narg ++])) goto redef_error; } need_comma = 1; continue; } else if ((ls->flags & MACRO_VAARG) && ls->ctok->type == MDOTS) { if (need_comma) { error(l, "missing comma before '...'"); goto warp_error; } if (redef && !n->vaarg) goto redef_error; if (!redef) m->vaarg = 1; saw_mdots = 1; need_comma = 1; continue; } else if (ls->ctok->type == RPAR) { if (narg > 0 && !need_comma) { error(l, "void macro argument"); goto warp_error; } if (redef && n->vaarg && !saw_mdots) goto redef_error; break; } else if (ttMWS(ls->ctok->type)) { continue; } error(l, "invalid macro argument"); goto warp_error; } if (!redef) { for (i = 1; i < narg; i ++) for (j = 0; j < i; j ++) if (!strcmp(m->arg[i], m->arg[j])) { error(l, "duplicate macro " "argument"); goto warp_error; } } if (!redef) m->narg = narg; } else { if (!ttWHI(ls->ctok->type) && (ls->flags & WARN_STANDARD)) warning(ls->line, "identifier not followed by " "whitespace in #define"); ls->flags |= READ_AGAIN; narg = 0; } if (redef) nt = 0; /* now, we have the arguments. Let's get the macro contents. */ while (!next_token(ls) && ls->ctok->type != NEWLINE) { struct token t; t.type = ls->ctok->type; if (ltwws && ttMWS(t.type)) continue; t.line = 0; if (t.type == NAME) { int i; if ((ls->flags & MACRO_VAARG) && !strcmp(ls->ctok->name, "__VA_ARGS__")) { if (redef) { if (!n->vaarg) goto redef_error; } else if (!m->vaarg) { error(l, "'__VA_ARGS__' is forbidden " "in macros with a fixed " "number of arguments"); goto warp_error; } t.type = MACROARG; t.line = redef ? n->narg : m->narg; } for (i = 0; i < narg; i ++) if (!strcmp(redef ? n->arg[i] : m->arg[i], ls->ctok->name)) { t.type = MACROARG; /* this is a hack: we store the argument number in the line field */ t.line = i; break; } } if (!redef && S_TOKEN(t.type)) t.name = sdup(ls->ctok->name); if (ttMWS(t.type)) { if (ltwws) continue; #ifdef SEMPER_FIDELIS t.type = OPT_NONE; #else t.type = NONE; #endif ltwws = 1; } else ltwws = 0; if (!redef) { /* we ensure that each macro token has a correct line number */ if (t.type != MACROARG) t.line = 1; aol(mval.t, mval.nt, t, TOKEN_LIST_MEMG); } else { #ifdef LOW_MEM int tt; if (n->cval.rp >= n->cval.length) { #ifdef SEMPER_FIDELIS if (t.type != OPT_NONE) goto redef_error; #else if (t.type != NONE) goto redef_error; #endif } else if (t.type != n->cval.t[n->cval.rp]) { goto redef_error; } else if (t.type == MACROARG) { unsigned anum = n->cval.t[n->cval.rp + 1]; if (anum >= 128U) anum = ((anum & 127U) << 8) | m->cval.t[n->cval.rp + 2]; if (anum != (unsigned)t.line) goto redef_error; } else if (S_TOKEN(t.type) && strcmp(ls->ctok->name, (char *)(n->cval.t + n->cval.rp + 1))) { goto redef_error; } tt = n->cval.t[n->cval.rp ++]; if (S_TOKEN(tt)) n->cval.rp += 1 + strlen((char *)(n->cval.t + n->cval.rp)); else if (tt == MACROARG) { if (n->cval.t[++ n->cval.rp] >= 128) n->cval.rp ++; } #else if (nt >= n->val.nt) { #ifdef SEMPER_FIDELIS if (t.type != OPT_NONE) goto redef_error; #else if (t.type != NONE) goto redef_error; #endif } else if (t.type != n->val.t[nt].type || (t.type == MACROARG && t.line != n->val.t[nt].line) || (S_TOKEN(t.type) && strcmp(ls->ctok->name, n->val.t[nt].name))) { goto redef_error; } #endif nt ++; } } if (redef) { #ifdef LOW_MEM if (n->cval.rp < n->cval.length) goto redef_error_2; #else if (nt < n->val.nt) goto redef_error_2; #endif return 0; } /* now we have the complete macro; perform some checks about the operators # and ##, and, if everything is ok, store the macro into the hash table */ define_end: #ifdef SEMPER_FIDELIS if (mval.nt && mval.t[mval.nt - 1].type == OPT_NONE) { #else if (mval.nt && mval.t[mval.nt - 1].type == NONE) { #endif mval.nt --; if (mval.nt == 0) freemem(mval.t); } if (mval.nt != 0) { size_t i; /* some checks about the macro */ if (mval.t[0].type == DSHARP || mval.t[0].type == DIG_DSHARP || mval.t[mval.nt - 1].type == DSHARP || mval.t[mval.nt - 1].type == DIG_DSHARP) { error(l, "operator '##' may neither begin " "nor end a macro"); goto define_error; } if (m->narg >= 0) for (i = 0; i < mval.nt; i ++) if ((mval.t[i].type == SHARP || mval.t[i].type == DIG_SHARP) && (i == (mval.nt - 1) || (ttMWS(mval.t[i + 1].type) && (i == mval.nt - 2 || mval.t[i + 2].type != MACROARG)) || (!ttMWS(mval.t[i + 1].type) && mval.t[i + 1].type != MACROARG))) { error(l, "operator '#' not followed " "by a macro argument"); goto define_error; } } #ifdef LOW_MEM { size_t i, l; for (i = 0, l = 0; i < mval.nt; i ++) { l ++; if (S_TOKEN(mval.t[i].type)) l += 1 + strlen(mval.t[i].name); else if (mval.t[i].type == MACROARG) { l ++; if (mval.t[i].line >= 128) l ++; } } m->cval.length = l; if (l) m->cval.t = getmem(l); for (i = 0, l = 0; i < mval.nt; i ++) { m->cval.t[l ++] = mval.t[i].type; if (S_TOKEN(mval.t[i].type)) { size_t x = 1 + strlen(mval.t[i].name); mmv(m->cval.t + l, mval.t[i].name, x); l += x; freemem(mval.t[i].name); } else if (mval.t[i].type == MACROARG) { unsigned anum = mval.t[i].line; if (anum >= 128) { m->cval.t[l ++] = 128 | (anum >> 8); m->cval.t[l ++] = anum & 0xFF; } else { m->cval.t[l ++] = anum; } } } if (mval.nt) freemem(mval.t); } #endif end_line = ls->ctok->line; if (ls->line > 0) /* Skips the -D defines */ /* replace macro definition by empty lines in output */ while (start_line++ < end_line) { struct token t; t.type = NEWLINE; t.line = start_line - 1; t.name = "\n"; print_token(ls, &t, 0); } #ifdef SYNOPSIS /* Store macro in Synopsis */ if (ls->line > 0) /* Skips the -D defines */ { char *text = NULL; #ifdef LOW_MEM if (m->cval.length > 0) { size_t i, len = 0; /* First determine length */ for (i = 0; i < m->cval.length;) { int tt = m->cval.t[i++]; if (tt == MACROARG) { if (m->cval.t[i] == m->narg) len += 11; /* "__VA_ARGS__" */ else len += strlen(m->arg[(size_t)(m->cval.t[i])]); i++; } else if (S_TOKEN(tt)) { int l = strlen((char *)(m->cval.t + i)); i += 1 + l; len += l; } else len += strlen(operators_name[tt]); } text = malloc(len+1); text[0] = 0; /* Now build string */ for (i = 0; i < m->cval.length;) { int tt = m->cval.t[i++]; if (tt == MACROARG) { if (m->cval.t[i] == m->narg) strcat(text, "__VA_ARGS__"); else strcat(text, m->arg[(size_t)(m->cval.t[i])]); i++; } else if (S_TOKEN(tt)) { strcat(text, (char *)(m->cval.t + i)); i += 1 + strlen((char *)(m->cval.t + i)); } else strcat(text, operators_name[tt]); } #else #error Not Implemented: non-LOW_MEM #endif } else text = sdup(""); char const *cfn = current_long_filename ? current_long_filename : current_filename; synopsis_define_hook(cfn, (int)ls->line, mname, m->narg, (const char**)(m->narg != -1 ? m->arg : NULL), m->vaarg, text); if (text) free(text); } #endif HTT_put(¯os, m, mname); freemem(mname); if (emit_defines) print_macro(m); return 0; redef_error: while (ls->ctok->type != NEWLINE && !next_token(ls)); redef_error_2: #ifndef SYNOPSIS error(l, "macro '%s' redefined unidentically", HASH_ITEM_NAME(n)); return 1; #else return 0; #endif warp_error: while (ls->ctok->type != NEWLINE && !next_token(ls)); define_error: if (m) del_macro(m); if (mname) freemem(mname); #ifdef LOW_MEM if (mv.nt) { size_t i; for (i = 0; i < mv.nt; i ++) if (S_TOKEN(mv.t[i].type)) freemem(mv.t[i].name); freemem(mv.t); } #endif return 1; #undef mval } /* * Get the arguments for a macro. This code is tricky because there can * be multiple sources for these arguments, if we are in the middle of * a macro replacement; arguments are macro-replaced before inclusion * into the macro replacement. * * return value: * 1 no argument (last token read from next_token()) * 2 no argument (last token read from tfi) * 3 no argument (nothing read) * 4 error * * Void arguments are allowed in C99. */ static int collect_arguments(struct lexer_state *ls, struct token_fifo *tfi, int penury, struct token_fifo *atl, int narg, int vaarg, int *wr) { int ltwws = 1, npar = 0, i; struct token *ct = 0; int read_from_fifo = 0; long begin_line = ls->line; #define unravel(ls) (read_from_fifo = 0, !((tfi && tfi->art < tfi->nt \ && (read_from_fifo = 1) != 0 && (ct = tfi->t + (tfi->art ++))) \ || ((!tfi || penury) && !next_token(ls) && (ct = (ls)->ctok)))) /* * collect_arguments() is assumed to setup correctly atl * (this is not elegant, but it works) */ for (i = 0; i < narg; i ++) atl[i].art = atl[i].nt = 0; if (vaarg) atl[narg].art = atl[narg].nt = 0; *wr = 0; while (!unravel(ls)) { if (!read_from_fifo && ct->type == NEWLINE) ls->ltwnl = 1; if (ttWHI(ct->type)) { *wr = 1; continue; } if (ct->type == LPAR) { npar = 1; } break; } if (!npar) { if (ct == ls->ctok) return 1; if (read_from_fifo) return 2; return 3; } if (!read_from_fifo && ct == ls->ctok) ls->ltwnl = 0; i = 0; if ((narg + vaarg) == 0) { while(!unravel(ls)) { if (ttWHI(ct->type)) continue; if (ct->type == RPAR) goto harvested; npar = 1; goto too_many_args; } } while (!unravel(ls)) { struct token t; if (ct->type == LPAR) npar ++; else if (ct->type == RPAR && (-- npar) == 0) { if (atl[i].nt != 0 && ttMWS(atl[i].t[atl[i].nt - 1].type)) atl[i].nt --; i ++; /* * C99 standard states that at least one argument * should be present for the ... part; to relax * this behaviour, change 'narg + vaarg' to 'narg'. */ if (i < (narg + vaarg)) { error(begin_line, "not enough arguments " "to macro"); return 4; } if (i > narg) { if (!(ls->flags & MACRO_VAARG) || !vaarg) goto too_many_args; } goto harvested; } else if (ct->type == COMMA && npar <= 1 && i < narg) { if (atl[i].nt != 0 && ttMWS(atl[i].t[atl[i].nt - 1].type)) atl[i].nt --; if (++ i == narg) { if (!(ls->flags & MACRO_VAARG) || !vaarg) goto too_many_args; } if (i > 30000) goto too_many_args; ltwws = 1; continue; } else if (ltwws && ttWHI(ct->type)) continue; t.type = ct->type; if (!read_from_fifo) t.line = ls->line; else t.line = ct->line; /* * Stringification applies only to macro arguments; * so we handle here OPT_NONE. * OPT_NONE is kept, but does not count as whitespace, * and merges with other whitespace to give a fully * qualified NONE token. Two OPT_NONE tokens merge. * Initial and final OPT_NONE are discarded (initial * is already done, as OPT_NONE is matched by ttWHI). */ if (ttWHI(t.type)) { if (t.type != OPT_NONE) { t.type = NONE; #ifdef SEMPER_FIDELIS t.name = sdup(" "); throw_away(ls->gf, t.name); #endif ltwws = 1; } if (atl[i].nt > 0 && atl[i].t[atl[i].nt - 1].type == OPT_NONE) atl[i].nt --; } else { ltwws = 0; if (S_TOKEN(t.type)) { t.name = ct->name; if (ct == (ls)->ctok) { t.name = sdup(t.name); throw_away(ls->gf, t.name); } } } aol(atl[i].t, atl[i].nt, t, TOKEN_LIST_MEMG); } error(begin_line, "unfinished macro call"); return 4; too_many_args: error(begin_line, "too many arguments to macro"); while (npar && !unravel(ls)) { if (ct->type == LPAR) npar ++; else if (ct->type == RPAR) npar --; } return 4; harvested: if (i > 127 && (ls->flags & WARN_STANDARD)) warning(begin_line, "macro call with %d arguments (ISO " "specifies 127 max)", i); return 0; #undef unravel } /* * concat_token() is called when the ## operator is used. It uses * the struct lexer_state dsharp_lexer to parse the result of the * concatenation. * * Law enforcement: if the whole string does not produce a valid * single token, an error (non-zero result) is returned. */ struct lexer_state dsharp_lexer; static inline int concat_token(struct token *t1, struct token *t2) { char *n1 = token_name(t1), *n2 = token_name(t2); size_t l1 = strlen(n1), l2 = strlen(n2); unsigned char *x = getmem(l1 + l2 + 1); int r; mmv(x, n1, l1); mmv(x + l1, n2, l2); x[l1 + l2] = 0; dsharp_lexer.input = 0; dsharp_lexer.input_string = x; dsharp_lexer.pbuf = 0; dsharp_lexer.ebuf = l1 + l2; dsharp_lexer.discard = 1; dsharp_lexer.flags = DEFAULT_LEXER_FLAGS; dsharp_lexer.pending_token = 0; r = next_token(&dsharp_lexer); freemem(x); return (r == 1 || dsharp_lexer.pbuf < (l1 + l2) || dsharp_lexer.pending_token || (dsharp_lexer.pbuf == (l1 + l2) && !dsharp_lexer.discard)); } #ifdef PRAGMA_TOKENIZE /* * tokenize_string() takes a string as input, and split it into tokens, * reassembling the tokens into a single compressed string generated by * compress_token_list(); this function is used for _Pragma processing. */ struct lexer_state tokenize_lexer; static char *tokenize_string(struct lexer_state *ls, char *buf) { struct token_fifo tf; size_t bl = strlen(buf); int r; tokenize_lexer.input = 0; tokenize_lexer.input_string = (unsigned char *)buf; tokenize_lexer.pbuf = 0; tokenize_lexer.ebuf = bl; tokenize_lexer.discard = 1; tokenize_lexer.flags = ls->flags | LEXER; tokenize_lexer.pending_token = 0; tf.art = tf.nt = 0; while (!(r = next_token(&tokenize_lexer))) { struct token t, *ct = tokenize_lexer.ctok; if (ttWHI(ct->type)) continue; t = *ct; if (S_TOKEN(t.type)) t.name = sdup(t.name); aol(tf.t, tf.nt, t, TOKEN_LIST_MEMG); } if (tokenize_lexer.pbuf < bl) goto tokenize_error; return (char *)((compress_token_list(&tf)).t); tokenize_error: if (tf.nt) { for (tf.art = 0; tf.art < tf.nt; tf.art ++) if (S_TOKEN(tf.t[tf.art].type)) freemem(tf.t[tf.art].name); freemem(tf.t); } return 0; } #endif /* * stringify_string() has a self-explanatory name. It is called when * the # operator is used in a macro and a string constant must be * stringified. */ static inline char *stringify_string(char *x) { size_t l; int i, inside_str = 0, inside_cc = 0, must_quote, has_quoted = 0; char *y, *d; for (i = 0; i < 2; i ++) { if (i) d[0] = '"'; for (l = 1, y = x; *y; y ++, l ++) { must_quote = 0; if (inside_cc) { if (*y == '\\') { must_quote = 1; has_quoted = 1; } else if (!has_quoted && *y == '\'') inside_cc = 0; } else if (inside_str) { if (*y == '"' || *y == '\\') must_quote = 1; if (*y == '\\') has_quoted = 1; else if (!has_quoted && *y == '"') inside_str = 0; } else if (*y == '"') { inside_str = 1; must_quote = 1; } else if (*y == '\'') { inside_cc = 1; } if (must_quote) { if (i) d[l] = '\\'; l ++; } if (i) d[l] = *y; } if (!i) d = getmem(l + 2); if (i) { d[l] = '"'; d[l + 1] = 0; } } return d; } /* * stringify() produces a constant string, result of the # operator * on a list of tokens. */ static char *stringify(struct token_fifo *tf) { size_t tlen; size_t i; char *x, *y; for (tlen = 0, i = 0; i < tf->nt; i ++) if (tf->t[i].type < CPPERR && tf->t[i].type != OPT_NONE) tlen += strlen(token_name(tf->t + i)); if (tlen == 0) return sdup("\"\""); x = getmem(tlen + 1); for (tlen = 0, i = 0; i < tf->nt; i ++) { if (tf->t[i].type >= CPPERR || tf->t[i].type == OPT_NONE) continue; strcpy(x + tlen, token_name(tf->t + i)); tlen += strlen(token_name(tf->t + i)); } /* no need to add a trailing 0: strcpy() did that (and the string is not empty) */ y = stringify_string(x); freemem(x); return y; } /* * Two strings evaluated at initialization time, to handle the __TIME__ * and __DATE__ special macros. * * C99 specifies that these macros should remain constant throughout * the whole preprocessing. */ char compile_time[12], compile_date[24]; /* * substitute_macro() performs the macro substitution. It is called when * an identifier recognized as a macro name has been found; this function * tries to collect the arguments (if needed), applies # and ## operators * and perform recursive and nested macro expansions. * * In the substitution of a macro, we remove all newlines that were in the * arguments. This might confuse error reporting (which could report * erroneous line numbers) or have worse effect is the preprocessor is * used for another language pickier than C. Since the interface between * the preprocessor and the compiler is not fully specified, I believe * that this is no violation of the standard. Comments welcome. * * We take tokens from tfi. If tfi has no more tokens to give: we may * take some tokens from ls to complete a call (fetch arguments) if * and only if penury is non zero. */ int substitute_macro(struct lexer_state *ls, struct macro *m, struct token_fifo *tfi, int penury, int reject_nested, long l) { char *mname = HASH_ITEM_NAME(m); struct token_fifo *atl, etl; struct token t, *ct; int i, save_nest = m->nest; size_t save_art, save_tfi, etl_limit; int ltwds, ntwds, ltwws; int pragma_op = 0; long start_line = ls->line; /* * Reject the replacement, if we are already inside the macro. */ if (m->nest > reject_nested) { t.type = NAME; t.line = ls->line; t.name = mname; print_token(ls, &t, 0); return 0; } /* * put a separation from preceeding tokens */ print_space(ls); /* * Check if the macro is a special one. */ if ((i = check_special_macro(mname)) >= MAC_SPECIAL) { /* we have a special macro */ switch (i) { char buf[30], *bbuf, *cfn; case MAC_LINE: t.type = NUMBER; t.line = l; sprintf(buf, "%ld", l); t.name = buf; print_space(ls); print_token(ls, &t, 0); break; case MAC_FILE: t.type = STRING; t.line = l; cfn = current_long_filename ? current_long_filename : current_filename; bbuf = getmem(2 * strlen(cfn) + 3); { char *c, *d; int lcwb = 0; bbuf[0] = '"'; for (c = cfn, d = bbuf + 1; *c; c ++) { if (*c == '\\') { if (lcwb) continue; *(d ++) = '\\'; lcwb = 1; } else lcwb = 0; *(d ++) = *c; } *(d ++) = '"'; *(d ++) = 0; } t.name = bbuf; print_space(ls); print_token(ls, &t, 0); freemem(bbuf); break; case MAC_DATE: t.type = STRING; t.line = l; t.name = compile_date; print_space(ls); print_token(ls, &t, 0); break; case MAC_TIME: t.type = STRING; t.line = l; t.name = compile_time; print_space(ls); print_token(ls, &t, 0); break; case MAC_STDC: t.type = NUMBER; t.line = l; t.name = "1"; print_space(ls); print_token(ls, &t, 0); break; case MAC_PRAGMA: if (reject_nested > 0) { /* do not replace _Pragma() unless toplevel */ t.type = NAME; t.line = ls->line; t.name = mname; print_token(ls, &t, 0); return 0; } pragma_op = 1; goto collect_args; #ifdef AUDIT default: ouch("unbekanntes fliegendes macro"); #endif } return 0; } /* * If the macro has arguments, collect them. */ collect_args: if (m->narg >= 0) { unsigned long save_flags = ls->flags; int wr = 0; ls->flags |= LEXER; if (m->narg > 0 || m->vaarg) atl = getmem((m->narg + m->vaarg) * sizeof(struct token_fifo)); switch (collect_arguments(ls, tfi, penury, atl, m->narg, m->vaarg, &wr)) { case 1: /* the macro expected arguments, but we did not find any; the last read token should be read again. */ ls->flags = save_flags | READ_AGAIN; goto no_argument_next; case 2: tfi->art --; /* fall through */ case 3: ls->flags = save_flags; no_argument_next: t.type = NAME; t.line = l; t.name = mname; print_token_nailed(ls, &t, l); if (wr) { t.type = NONE; t.line = l; #ifdef SEMPER_FIDELIS t.name = " "; #endif print_token(ls, &t, 0); goto exit_macro_2; } goto exit_macro_1; case 4: ls->flags = save_flags; goto exit_error_1; } ls->flags = save_flags; } /* * If the macro is _Pragma, and we got here, then we have * exactly one argument. We check it, unstringize it, and * emit a PRAGMA token. */ if (pragma_op) { char *pn; if (atl[0].nt != 1 || atl[0].t[0].type != STRING) { error(ls->line, "invalid argument to _Pragma"); if (atl[0].nt) freemem(atl[0].t); freemem(atl); goto exit_error; } pn = atl[0].t[0].name; if ((pn[0] == '"' && pn[1] == '"') || (pn[0] == 'L' && pn[1] == '"' && pn[2] == '"')) { /* void pragma -- just ignore it */ freemem(atl[0].t); freemem(atl); return 0; } if (ls->flags & TEXT_OUTPUT) { #ifdef PRAGMA_DUMP /* * This code works because we actually evaluate arguments in a * lazy way: we scan a macro argument only if it appears in the * output, and exactly as many times as it appears. Therefore, * _Pragma() will get evaluated just like they should. */ char *c = atl[0].t[0].name, *d; for (d = "\n#pragma "; *d; d ++) put_char(ls, *d); d = (*c == 'L') ? c + 2 : c + 1; for (; *d != '"'; d ++) { if (*d == '\\' && (*(d + 1) == '\\' || *(d + 1) == '"')) { d ++; } put_char(ls, *d); } put_char(ls, '\n'); ls->oline = ls->line; enter_file(ls, ls->flags, 0); #else if (ls->flags & WARN_PRAGMA) warning(ls->line, "_Pragma() ignored and not dumped"); #endif } else if (ls->flags & HANDLE_PRAGMA) { char *c = atl[0].t[0].name, *d, *buf; struct token t; /* a wide string is a string */ if (*c == 'L') c ++; c ++; for (buf = d = getmem(strlen(c)); *c != '"'; c ++) { if (*c == '\\' && (*(c + 1) == '\\' || *(c + 1) == '"')) { *(d ++) = *(++ c); } else *(d ++) = *c; } *d = 0; t.type = PRAGMA; t.line = ls->line; #ifdef PRAGMA_TOKENIZE t.name = tokenize_string(ls, buf); freemem(buf); buf = t.name; if (!buf) { freemem(atl[0].t); freemem(atl); goto exit_error; } #else t.name = buf; #endif aol(ls->toplevel_of->t, ls->toplevel_of->nt, t, TOKEN_LIST_MEMG); throw_away(ls->gf, buf); } freemem(atl[0].t); freemem(atl); return 0; } /* * Now we expand and replace the arguments in the macro; we * also handle '#' and '##'. If we find an argument, that has * to be replaced, we expand it in its own token list, then paste * it. Tricky point: when we paste an argument, we must scan * again the resulting list for further replacements. This * implies problems with regards to nesting self-referencing * macros. * * We do then YAUH (yet another ugly hack): if a macro is replaced, * and nested replacement exhibit the same macro, we mark it with * a negative line number. All produced negative line numbers * must be cleaned in the end. */ #define ZAP_LINE(t) do { \ if ((t).type == NAME) { \ struct macro *zlm = HTT_get(¯os, (t).name); \ if (zlm && zlm->nest > reject_nested) \ (t).line = -1 - (t).line; \ } \ } while (0) #ifdef LOW_MEM save_art = m->cval.rp; m->cval.rp = 0; #else save_art = m->val.art; m->val.art = 0; #endif etl.art = etl.nt = 0; m->nest = reject_nested + 1; ltwds = ntwds = 0; #ifdef LOW_MEM while (m->cval.rp < m->cval.length) { #else while (m->val.art < m->val.nt) { #endif size_t next, z; #ifdef LOW_MEM struct token uu; ct = &uu; ct->line = 1; t.type = ct->type = m->cval.t[m->cval.rp ++]; if (ct->type == MACROARG) { unsigned anum = m->cval.t[m->cval.rp ++]; if (anum >= 128U) anum = ((anum & 127U) << 8) | (unsigned)m->cval.t[m->cval.rp ++]; ct->line = anum; } else if (S_TOKEN(ct->type)) { t.name = ct->name = (char *)(m->cval.t + m->cval.rp); m->cval.rp += 1 + strlen(ct->name); } #ifdef SEMPER_FIDELIS else if (ct->type == OPT_NONE) { t.type = ct->type = NONE; t.name = ct->name = " "; } #endif t.line = ls->line; next = m->cval.rp; if ((next < m->cval.length && (m->cval.t[z = next] == DSHARP || m->cval.t[z = next] == DIG_DSHARP)) || ((next + 1) < m->cval.length && ttWHI(m->cval.t[next]) && (m->cval.t[z = next + 1] == DSHARP || m->cval.t[z = next + 1] == DIG_DSHARP))) { ntwds = 1; m->cval.rp = z; } else ntwds = 0; #else ct = m->val.t + (m->val.art ++); next = m->val.art; t.type = ct->type; t.line = ls->line; #ifdef SEMPER_FIDELIS if (t.type == OPT_NONE) { t.type = NONE; t.name = " "; } else #endif t.name = ct->name; if ((next < m->val.nt && (m->val.t[z = next].type == DSHARP || m->val.t[z = next].type == DIG_DSHARP)) || ((next + 1) < m->val.nt && ttWHI(m->val.t[next].type) && (m->val.t[z = next + 1].type == DSHARP || m->val.t[z = next + 1].type == DIG_DSHARP))) { ntwds = 1; m->val.art = z; } else ntwds = 0; #endif if (ct->type == MACROARG) { #ifdef DSHARP_TOKEN_MERGE int need_opt_space = 1; #endif z = ct->line; /* the argument number is there */ if (ltwds && atl[z].nt != 0 && etl.nt) { if (concat_token(etl.t + (-- etl.nt), atl[z].t)) { warning(ls->line, "operator '##' " "produced the invalid token " "'%s%s'", token_name(etl.t + etl.nt), token_name(atl[z].t)); #if 0 /* obsolete */ #ifdef LOW_MEM m->cval.rp = save_art; #else m->val.art = save_art; #endif etl.nt ++; goto exit_error_2; #endif etl.nt ++; atl[z].art = 0; #ifdef DSHARP_TOKEN_MERGE need_opt_space = 0; #endif } else { if (etl.nt == 0) freemem(etl.t); else if (!ttWHI(etl.t[etl.nt - 1] .type)) { t.type = OPT_NONE; t.line = ls->line; aol(etl.t, etl.nt, t, TOKEN_LIST_MEMG); } t.type = dsharp_lexer.ctok->type; t.line = ls->line; if (S_TOKEN(t.type)) { t.name = sdup(dsharp_lexer .ctok->name); throw_away(ls->gf, t.name); } ZAP_LINE(t); aol(etl.t, etl.nt, t, TOKEN_LIST_MEMG); atl[z].art = 1; } } else atl[z].art = 0; if ( #ifdef DSHARP_TOKEN_MERGE need_opt_space && #endif atl[z].art < atl[z].nt && (!etl.nt || !ttWHI(etl.t[etl.nt - 1].type))) { t.type = OPT_NONE; t.line = ls->line; aol(etl.t, etl.nt, t, TOKEN_LIST_MEMG); } if (ltwds || ntwds) { while (atl[z].art < atl[z].nt) { t = atl[z].t[atl[z].art ++]; t.line = ls->line; ZAP_LINE(t); aol(etl.t, etl.nt, t, TOKEN_LIST_MEMG); } } else { struct token_fifo *save_tf; unsigned long save_flags; int ret = 0; atl[z].art = 0; save_tf = ls->output_fifo; ls->output_fifo = &etl; save_flags = ls->flags; ls->flags |= LEXER; while (atl[z].art < atl[z].nt) { struct macro *nm; struct token *cct; cct = atl[z].t + (atl[z].art ++); if (cct->type == NAME && cct->line >= 0 && (nm = HTT_get(¯os, cct->name)) && nm->nest <= (reject_nested + 1)) { ret |= substitute_macro(ls, nm, atl + z, 0, reject_nested + 1, l); continue; } t = *cct; ZAP_LINE(t); aol(etl.t, etl.nt, t, TOKEN_LIST_MEMG); } ls->output_fifo = save_tf; ls->flags = save_flags; if (ret) { #ifdef LOW_MEM m->cval.rp = save_art; #else m->val.art = save_art; #endif goto exit_error_2; } } if (!ntwds && (!etl.nt || !ttWHI(etl.t[etl.nt - 1].type))) { t.type = OPT_NONE; t.line = ls->line; aol(etl.t, etl.nt, t, TOKEN_LIST_MEMG); } ltwds = 0; continue; } /* * This code is definitely cursed. * * For the extremely brave reader who tries to understand * what is happening: ltwds is a flag meaning "last token * was double-sharp" and ntwds means "next token will be * double-sharp". The tokens are from the macro definition, * and scanned from left to right. Arguments that are * not implied into a #/## construction are macro-expanded * seperately, then included into the token stream. */ if (ct->type == DSHARP || ct->type == DIG_DSHARP) { if (ltwds) { error(ls->line, "quad sharp"); #ifdef LOW_MEM m->cval.rp = save_art; #else m->val.art = save_art; #endif goto exit_error_2; } #ifdef LOW_MEM if (m->cval.rp < m->cval.length && ttMWS(m->cval.t[m->cval.rp])) m->cval.rp ++; #else if (m->val.art < m->val.nt && ttMWS(m->val.t[m->val.art].type)) m->val.art ++; #endif ltwds = 1; continue; } else if (ltwds && etl.nt != 0) { if (concat_token(etl.t + (-- etl.nt), ct)) { warning(ls->line, "operator '##' produced " "the invalid token '%s%s'", token_name(etl.t + etl.nt), token_name(ct)); #if 0 /* obsolete */ #ifdef LOW_MEM m->cval.rp = save_art; #else m->val.art = save_art; #endif etl.nt ++; goto exit_error_2; #endif etl.nt ++; } else { if (etl.nt == 0) freemem(etl.t); t.type = dsharp_lexer.ctok->type; t.line = ls->line; if (S_TOKEN(t.type)) { t.name = sdup(dsharp_lexer.ctok->name); throw_away(ls->gf, t.name); } ct = &t; } } ltwds = 0; #ifdef LOW_MEM if ((ct->type == SHARP || ct->type == DIG_SHARP) && next < m->cval.length && (m->cval.t[next] == MACROARG || (ttMWS(m->cval.t[next]) && (next + 1) < m->cval.length && m->cval.t[next + 1] == MACROARG))) { unsigned anum; #else if ((ct->type == SHARP || ct->type == DIG_SHARP) && next < m->val.nt && (m->val.t[next].type == MACROARG || (ttMWS(m->val.t[next].type) && (next + 1) < m->val.nt && m->val.t[next + 1].type == MACROARG))) { #endif /* * We have a # operator followed by (an optional * whitespace and) a macro argument; this means * stringification. So be it. */ #ifdef LOW_MEM if (ttMWS(m->cval.t[next])) m->cval.rp ++; #else if (ttMWS(m->val.t[next].type)) m->val.art ++; #endif t.type = STRING; #ifdef LOW_MEM anum = m->cval.t[++ m->cval.rp]; if (anum >= 128U) anum = ((anum & 127U) << 8) | (unsigned)m->cval.t[++ m->cval.rp]; t.name = stringify(atl + anum); m->cval.rp ++; #else t.name = stringify(atl + (size_t)(m->val.t[m->val.art ++].line)); #endif throw_away(ls->gf, t.name); ct = &t; /* * There is no need for extra spaces here. */ } t = *ct; ZAP_LINE(t); aol(etl.t, etl.nt, t, TOKEN_LIST_MEMG); } #ifdef LOW_MEM m->cval.rp = save_art; #else m->val.art = save_art; #endif /* * Now etl contains the expanded macro, to be parsed again for * further expansions -- much easier, since '#' and '##' have * already been handled. * However, we might need some input from tfi. So, we paste * the contents of tfi after etl, and we put back what was * not used. * * Some adjacent spaces are merged; only unique NONE, or sequences * OPT_NONE NONE are emitted. */ etl_limit = etl.nt; if (tfi) { save_tfi = tfi->art; while (tfi->art < tfi->nt) aol(etl.t, etl.nt, tfi->t[tfi->art ++], TOKEN_LIST_MEMG); } ltwws = 0; while (etl.art < etl_limit) { struct macro *nm; ct = etl.t + (etl.art ++); if (ct->type == NAME && ct->line >= 0 && (nm = HTT_get(¯os, ct->name))) { if (substitute_macro(ls, nm, &etl, penury, reject_nested, l)) { m->nest = save_nest; goto exit_error_2; } ltwws = 0; continue; } if (ttMWS(ct->type)) { if (ltwws == 1) { if (ct->type == OPT_NONE) continue; ltwws = 2; } else if (ltwws == 2) continue; else if (ct->type == OPT_NONE) ltwws = 1; else ltwws = 2; } else ltwws = 0; if (ct->line >= 0) ct->line = l; print_token(ls, ct, reject_nested ? 0 : l); } if (etl.nt) freemem(etl.t); if (tfi) { tfi->art = save_tfi + (etl.art - etl_limit); } exit_macro_1: print_space(ls); exit_macro_2: /* * As a macro call may contain newlines, we need to inject * empty lines here so the following tokens will fall onto the * correct lines.... */ while (start_line++ < ls->line) { t.type = NEWLINE; t.line = start_line; t.name = "\n"; print_token(ls, &t, 0); } /* ...and column. */ while (ls->ocolumn <= ls->column) print_space(ls); for (i = 0; i < (m->narg + m->vaarg); i ++) if (atl[i].nt) freemem(atl[i].t); if (m->narg > 0 || m->vaarg) freemem(atl); m->nest = save_nest; return 0; exit_error_2: if (etl.nt) freemem(etl.t); exit_error_1: for (i = 0; i < (m->narg + m->vaarg); i ++) if (atl[i].nt) freemem(atl[i].t); if (m->narg > 0 || m->vaarg) freemem(atl); m->nest = save_nest; exit_error: return 1; } /* * print already defined macros */ void print_defines(void) { HTT_scan(¯os, print_macro); } /* * define_macro() defines a new macro, whom definition is given in * the command-line syntax: macro=def * The '=def' part is optional. * * It returns non-zero on error. */ int define_macro(struct lexer_state *ls, char *def) { char *c = sdup(def), *d; int with_def = 0; int ret = 0; for (d = c; *d && *d != '='; d ++); if (*d) { *d = ' '; with_def = 1; } if (with_def) { struct lexer_state lls; size_t n = strlen(c) + 1; if (c == d) { error(-1, "void macro name"); ret = 1; } else { *(c + n - 1) = '\n'; init_buf_lexer_state(&lls, 0); lls.flags = ls->flags | LEXER; lls.input = 0; lls.input_string = (unsigned char *)c; lls.pbuf = 0; lls.ebuf = n; lls.line = -1; ret = handle_define(&lls); free_lexer_state(&lls); } } else { struct macro *m; if (!*c) { error(-1, "void macro name"); ret = 1; } else if ((m = HTT_get(¯os, c)) #ifdef LOW_MEM && (m->cval.length != 3 || m->cval.t[0] != NUMBER || strcmp((char *)(m->cval.t + 1), "1"))) { #else && (m->val.nt != 1 || m->val.t[0].type != NUMBER || strcmp(m->val.t[0].name, "1"))) { #endif error(-1, "macro %s already defined", c); ret = 1; } else { #ifndef LOW_MEM struct token t; #endif m = new_macro(); #ifdef LOW_MEM m->cval.length = 3; m->cval.t = getmem(3); m->cval.t[0] = NUMBER; m->cval.t[1] = '1'; m->cval.t[2] = 0; #else t.type = NUMBER; t.name = sdup("1"); aol(m->val.t, m->val.nt, t, TOKEN_LIST_MEMG); #endif HTT_put(¯os, m, c); } } freemem(c); return ret; } /* * undef_macro() undefines the macro whom name is given as "def"; * it is not an error to try to undef a macro that does not exist. * * It returns non-zero on error (undefinition of a special macro, * void macro name). */ int undef_macro(struct lexer_state *ls, char *def) { char *c = def; if (!*c) { error(-1, "void macro name"); return 1; } if (HTT_get(¯os, c)) { if (check_special_macro(c)) { error(-1, "trying to undef special macro %s", c); return 1; } else HTT_del(¯os, c); } return 0; } /* * We saw a #ifdef directive. Parse the line. * return value: 1 if the macro is defined, 0 if it is not, -1 on error */ int handle_ifdef(struct lexer_state *ls) { while (!next_token(ls)) { int tgd = 1; if (ls->ctok->type == NEWLINE) break; if (ttMWS(ls->ctok->type)) continue; if (ls->ctok->type == NAME) { int x = (HTT_get(¯os, ls->ctok->name) != 0); while (!next_token(ls) && ls->ctok->type != NEWLINE) if (tgd && !ttWHI(ls->ctok->type) && (ls->flags & WARN_STANDARD)) { warning(ls->line, "trailing garbage " "in #ifdef"); tgd = 0; } return x; } error(ls->line, "illegal macro name for #ifdef"); while (!next_token(ls) && ls->ctok->type != NEWLINE) if (tgd && !ttWHI(ls->ctok->type) && (ls->flags & WARN_STANDARD)) { warning(ls->line, "trailing garbage in " "#ifdef"); tgd = 0; } return -1; } error(ls->line, "unfinished #ifdef"); return -1; } /* * for #undef * return value: 1 on error, 0 on success. Undefining a macro that was * already not defined is not an error. */ int handle_undef(struct lexer_state *ls) { while (!next_token(ls)) { if (ls->ctok->type == NEWLINE) break; if (ttMWS(ls->ctok->type)) continue; if (ls->ctok->type == NAME) { struct macro *m = HTT_get(¯os, ls->ctok->name); int tgd = 1; if (m != 0) { if (check_special_macro(ls->ctok->name)) { error(ls->line, "trying to undef " "special macro %s", ls->ctok->name); goto undef_error; } if (emit_defines) fprintf(emit_output, "#undef %s\n", ls->ctok->name); HTT_del(¯os, ls->ctok->name); } while (!next_token(ls) && ls->ctok->type != NEWLINE) if (tgd && !ttWHI(ls->ctok->type) && (ls->flags & WARN_STANDARD)) { warning(ls->line, "trailing garbage " "in #undef"); tgd = 0; } return 0; } error(ls->line, "illegal macro name for #undef"); undef_error: while (!next_token(ls) && ls->ctok->type != NEWLINE); return 1; } error(ls->line, "unfinished #undef"); return 1; } /* * for #ifndef * return value: 0 if the macro is defined, 1 if it is not, -1 on error. */ int handle_ifndef(struct lexer_state *ls) { while (!next_token(ls)) { int tgd = 1; if (ls->ctok->type == NEWLINE) break; if (ttMWS(ls->ctok->type)) continue; if (ls->ctok->type == NAME) { int x = (HTT_get(¯os, ls->ctok->name) == 0); while (!next_token(ls) && ls->ctok->type != NEWLINE) if (tgd && !ttWHI(ls->ctok->type) && (ls->flags & WARN_STANDARD)) { warning(ls->line, "trailing garbage " "in #ifndef"); tgd = 0; } if (protect_detect.state == 1) { protect_detect.state = 2; protect_detect.macro = sdup(ls->ctok->name); } return x; } error(ls->line, "illegal macro name for #ifndef"); while (!next_token(ls) && ls->ctok->type != NEWLINE) if (tgd && !ttWHI(ls->ctok->type) && (ls->flags & WARN_STANDARD)) { warning(ls->line, "trailing garbage in " "#ifndef"); tgd = 0; } return -1; } error(ls->line, "unfinished #ifndef"); return -1; } /* * erase the macro table. */ void wipe_macros(void) { if (macros_init_done) HTT_kill(¯os); macros_init_done = 0; } /* * initialize the macro table */ void init_macros(void) { wipe_macros(); HTT_init(¯os, del_macro); macros_init_done = 1; if (!no_special_macros) add_special_macros(); } /* * find a macro from its name */ struct macro *get_macro(char *name) { return HTT_get(¯os, name); } synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/comments.cc0000664000076400007640000000163311171353561021760 0ustar stefanstefan// // Copyright (C) 2009 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include "comments.hh" std::vector comment_cache; namespace { // A value > 1 means the next comment is not to be concatenated to the previous. int newlines = 1; } void add_ccomment(char const *comment) { comment_cache.push_back(comment); newlines = 1; } void add_cxxcomment(char const *comment) { std::string line = comment; if (newlines > 1 || comment_cache.size() == 0) comment_cache.push_back(line); else { std::string &last = comment_cache.back(); last.append(line); } newlines = 0; } void add_newline() { if (++newlines == 1 && comment_cache.size()) { std::string &last = comment_cache.back(); last.append("\n"); } } void clear_comment_cache() { comment_cache.clear(); ++newlines; } synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/synopsis.py.in0000664000076400007640000000125311163206513022463 0ustar stefanstefan#! /usr/bin/env python from Synopsis import config from Synopsis.process import process from Synopsis.Processor import * from Synopsis.Processors import * from Synopsis.Parsers import Cxx from distutils import sysconfig import sys, os.path topdir = '@topdir@' srcdir = '@srcdir@' cppflags = ['-I%s'%(topdir + '/Cxx-API/include'), '-I%s'%(srcdir), '-I%s'%(sysconfig.get_python_inc())] cxx = Cxx.Parser(base_path = topdir + '/', cppflags = cppflags, syntax_prefix = 'links', xref_prefix = 'xref') link = Linker(Comments.Translator(filter = Comments.SSDFilter())) process(cxx = cxx, link = link) synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/lexer.c0000664000076400007640000006206111167366501021114 0ustar stefanstefan/* * (c) Thomas Pornin 1999 - 2002 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. The name of the authors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #include "tune.h" #include #include #include #include #include "ucppi.h" #include "mem.h" #include "assert.h" #ifdef UCPP_MMAP #include #include #include #endif /* * Character classes for description of the automaton. * The characters used for representing classes should not appear * explicitely in an automaton rule. */ #define SPC ' ' /* whitespace characters */ #define ALP 'Z' /* A-Z, a-z, _ */ #define NUM '9' /* 0-9 */ #define ANY 'Y' /* any character */ #define VCH 'F' /* void character (for end of input) */ /* * flags and macros to test those flags * STO: the currently read string is a complete token * PUT: the currently read character must be added to the string * FRZ: the currently read character must be kept and read again */ #define MOD_MK 255 #define noMOD(x) ((x) & 255) #define STO(x) ((x) | 256) #define ttSTO(x) ((x) & 256) #define FRZ(x) ((x) | 512) #define ttFRZ(x) ((x) & 512) #define PUT(x) ((x) | 1024) #define ttPUT(x) ((x) & 1024) /* order is important */ enum { S_START, S_SPACE, S_BANG, S_STRING, S_STRING2, S_COLON, S_SHARP, S_PCT, S_PCT2, S_PCT3, S_AMPER, S_CHAR, S_CHAR2, S_STAR, S_PLUS, S_MINUS, S_DOT, S_DOT2, S_SLASH, S_NUMBER, S_NUMBER2, S_LT, S_LT2, S_EQ, S_GT, S_GT2, S_CIRC, S_PIPE, S_BACKSLASH, S_COMMENT, S_COMMENT2, S_COMMENT3, S_COMMENT4, S_COMMENT5, S_NAME, S_NAME_BS, S_LCHAR, MSTATE, S_ILL, S_DDOT, S_DDSHARP, S_BS, S_ROGUE_BS, S_BEHEAD, S_DECAY, S_TRUNC, S_TRUNCC, S_OUCH }; #define CMT(x) ((x) >= S_COMMENT && (x) <= S_COMMENT5) #define CMCR 2 /* * This is the description of the automaton. It is not used "as is" * but copied at execution time into a table. * * To my utmost displeasure, there are a few hacks in read_token() * (which uses the transformed automaton) about the special handling * of slashes, sharps, and the letter L. */ static struct machine_state { int state; unsigned char input[CMCR]; int new_state; } cppms[] = { /* S_START is the generic beginning state */ { S_START, { ANY }, S_ILL }, #ifdef SEMPER_FIDELIS { S_START, { SPC }, PUT(S_SPACE) }, #else { S_START, { SPC }, S_SPACE }, #endif { S_START, { '\n' }, STO(NEWLINE) }, { S_START, { '!' }, S_BANG }, { S_START, { '"' }, PUT(S_STRING) }, { S_START, { '#' }, S_SHARP }, { S_START, { '%' }, S_PCT }, { S_START, { '&' }, S_AMPER }, { S_START, { '\'' }, PUT(S_CHAR) }, { S_START, { '(' }, STO(LPAR) }, { S_START, { ')' }, STO(RPAR) }, { S_START, { '*' }, S_STAR }, { S_START, { '+' }, S_PLUS }, { S_START, { ',' }, STO(COMMA) }, { S_START, { '-' }, S_MINUS }, { S_START, { '.' }, PUT(S_DOT) }, #ifdef SEMPER_FIDELIS { S_START, { '/' }, PUT(S_SLASH) }, #else { S_START, { '/' }, S_SLASH }, #endif { S_START, { NUM }, PUT(S_NUMBER) }, { S_START, { ':' }, S_COLON }, { S_START, { ';' }, STO(SEMIC) }, { S_START, { '<' }, S_LT }, { S_START, { '=' }, S_EQ }, { S_START, { '>' }, S_GT }, { S_START, { '?' }, STO(QUEST) }, { S_START, { ALP }, PUT(S_NAME) }, { S_START, { 'L' }, PUT(S_LCHAR) }, { S_START, { '[' }, STO(LBRK) }, { S_START, { ']' }, STO(RBRK) }, { S_START, { '^' }, S_CIRC }, { S_START, { '{' }, STO(LBRA) }, { S_START, { '|' }, S_PIPE }, { S_START, { '}' }, STO(RBRA) }, { S_START, { '~' }, STO(NOT) }, { S_START, { '\\' }, S_BACKSLASH }, /* after a space */ { S_SPACE, { ANY }, FRZ(STO(NONE)) }, #ifdef SEMPER_FIDELIS { S_SPACE, { SPC }, PUT(S_SPACE) }, #else { S_SPACE, { SPC }, S_SPACE }, #endif /* after a ! */ { S_BANG, { ANY }, FRZ(STO(LNOT)) }, { S_BANG, { '=' }, STO(NEQ) }, /* after a " */ { S_STRING, { ANY }, PUT(S_STRING) }, { S_STRING, { VCH }, FRZ(S_TRUNC) }, { S_STRING, { '\n' }, FRZ(S_BEHEAD) }, { S_STRING, { '\\' }, PUT(S_STRING2) }, { S_STRING, { '"' }, PUT(STO(STRING)) }, { S_STRING2, { ANY }, PUT(S_STRING) }, { S_STRING2, { VCH }, FRZ(S_TRUNC) }, /* after a # */ { S_SHARP, { ANY }, FRZ(STO(SHARP)) }, { S_SHARP, { '#' }, STO(DSHARP) }, /* after a : */ { S_COLON, { ANY }, FRZ(STO(COLON)) }, { S_COLON, { '>' }, STO(DIG_RBRK) }, /* after a % */ { S_PCT, { ANY }, FRZ(STO(PCT)) }, { S_PCT, { '=' }, STO(ASPCT) }, { S_PCT, { '>' }, STO(DIG_RBRA) }, { S_PCT, { ':' }, S_PCT2 }, /* after a %: */ { S_PCT2, { ANY }, FRZ(STO(DIG_SHARP)) }, { S_PCT2, { '%' }, S_PCT3 }, /* after a %:% */ { S_PCT3, { ANY }, FRZ(S_DDSHARP) }, { S_PCT3, { ':' }, STO(DIG_DSHARP) }, /* after a & */ { S_AMPER, { ANY }, FRZ(STO(AND)) }, { S_AMPER, { '=' }, STO(ASAND) }, { S_AMPER, { '&' }, STO(LAND) }, /* after a ' */ { S_CHAR, { ANY }, PUT(S_CHAR) }, { S_CHAR, { VCH }, FRZ(S_TRUNC) }, { S_CHAR, { '\'' }, PUT(STO(CHAR)) }, { S_CHAR, { '\\' }, PUT(S_CHAR2) }, /* after a \ in a character constant useful only for '\'' */ { S_CHAR2, { ANY }, PUT(S_CHAR) }, { S_CHAR2, { VCH }, FRZ(S_TRUNC) }, /* after a * */ { S_STAR, { ANY }, FRZ(STO(STAR)) }, { S_STAR, { '=' }, STO(ASSTAR) }, /* after a + */ { S_PLUS, { ANY }, FRZ(STO(PLUS)) }, { S_PLUS, { '+' }, STO(PPLUS) }, { S_PLUS, { '=' }, STO(ASPLUS) }, /* after a - */ { S_MINUS, { ANY }, FRZ(STO(MINUS)) }, { S_MINUS, { '-' }, STO(MMINUS) }, { S_MINUS, { '=' }, STO(ASMINUS) }, { S_MINUS, { '>' }, STO(ARROW) }, /* after a . */ { S_DOT, { ANY }, FRZ(STO(DOT)) }, { S_DOT, { NUM }, PUT(S_NUMBER) }, { S_DOT, { '.' }, S_DOT2 }, /* after .. */ { S_DOT2, { ANY }, FRZ(S_DDOT) }, { S_DOT2, { '.' }, STO(MDOTS) }, /* after a / */ { S_SLASH, { ANY }, FRZ(STO(SLASH)) }, { S_SLASH, { '=' }, STO(ASSLASH) }, #ifdef SEMPER_FIDELIS { S_SLASH, { '*' }, PUT(S_COMMENT) }, { S_SLASH, { '/' }, PUT(S_COMMENT5) }, #else { S_SLASH, { '*' }, S_COMMENT }, { S_SLASH, { '/' }, S_COMMENT5 }, #endif /* * There is a little hack in read_token() to disable * this last rule, if C++ (C99) comments are not enabled. */ /* after a number */ { S_NUMBER, { ANY }, FRZ(STO(NUMBER)) }, { S_NUMBER, { ALP, NUM }, PUT(S_NUMBER) }, { S_NUMBER, { '.' }, PUT(S_NUMBER) }, { S_NUMBER, { 'E', 'e' }, PUT(S_NUMBER2) }, { S_NUMBER, { 'P', 'p' }, PUT(S_NUMBER2) }, { S_NUMBER2, { ANY }, FRZ(STO(NUMBER)) }, { S_NUMBER2, { ALP, NUM }, PUT(S_NUMBER) }, { S_NUMBER2, { '+', '-' }, PUT(S_NUMBER) }, /* after a < */ { S_LT, { ANY }, FRZ(STO(LT)) }, { S_LT, { '=' }, STO(LEQ) }, { S_LT, { '<' }, S_LT2 }, { S_LT, { ':' }, STO(DIG_LBRK) }, { S_LT, { '%' }, STO(DIG_LBRA) }, { S_LT2, { ANY }, FRZ(STO(LSH)) }, { S_LT2, { '=' }, STO(ASLSH) }, /* after a > */ { S_GT, { ANY }, FRZ(STO(GT)) }, { S_GT, { '=' }, STO(GEQ) }, { S_GT, { '>' }, S_GT2 }, { S_GT2, { ANY }, FRZ(STO(RSH)) }, { S_GT2, { '=' }, STO(ASRSH) }, /* after a = */ { S_EQ, { ANY }, FRZ(STO(ASGN)) }, { S_EQ, { '=' }, STO(SAME) }, #ifdef CAST_OP { S_EQ, { '>' }, STO(CAST) }, #endif /* after a \ */ { S_BACKSLASH, { ANY }, FRZ(S_BS) }, { S_BACKSLASH, { 'U', 'u' }, FRZ(S_NAME_BS) }, /* after a letter */ { S_NAME, { ANY }, FRZ(STO(NAME)) }, { S_NAME, { ALP, NUM }, PUT(S_NAME) }, { S_NAME, { '\\' }, S_NAME_BS }, /* after a \ in an identifier */ { S_NAME_BS, { ANY }, FRZ(S_ROGUE_BS) }, { S_NAME_BS, { 'u', 'U' }, PUT(S_NAME) }, /* after a L */ { S_LCHAR, { ANY }, FRZ(S_NAME) }, { S_LCHAR, { '"' }, PUT(S_STRING) }, { S_LCHAR, { '\'' }, PUT(S_CHAR) }, /* after a ^ */ { S_CIRC, { ANY }, FRZ(STO(CIRC)) }, { S_CIRC, { '=' }, STO(ASCIRC) }, /* after a | */ { S_PIPE, { ANY }, FRZ(STO(OR)) }, { S_PIPE, { '=' }, STO(ASOR) }, { S_PIPE, { '|' }, STO(LOR) }, /* after a / and * */ #ifdef SEMPER_FIDELIS { S_COMMENT, { ANY }, PUT(S_COMMENT) }, { S_COMMENT, { VCH }, FRZ(S_TRUNCC) }, { S_COMMENT, { '*' }, PUT(S_COMMENT2) }, { S_COMMENT2, { ANY }, FRZ(S_COMMENT) }, { S_COMMENT2, { VCH }, FRZ(S_TRUNCC) }, { S_COMMENT2, { '*' }, PUT(S_COMMENT2) }, { S_COMMENT2, { '/' }, STO(PUT(COMMENT)) }, { S_COMMENT5, { ANY }, PUT(S_COMMENT5) }, { S_COMMENT5, { VCH }, FRZ(S_DECAY) }, { S_COMMENT5, { '\n' }, FRZ(STO(COMMENT)) }, #else { S_COMMENT, { ANY }, S_COMMENT }, { S_COMMENT, { VCH }, FRZ(S_TRUNCC) }, { S_COMMENT, { '*' }, S_COMMENT2 }, { S_COMMENT2, { ANY }, FRZ(S_COMMENT) }, { S_COMMENT2, { VCH }, FRZ(S_TRUNCC) }, { S_COMMENT2, { '*' }, S_COMMENT2 }, { S_COMMENT2, { '/' }, STO(COMMENT) }, { S_COMMENT5, { ANY }, S_COMMENT5 }, { S_COMMENT5, { VCH }, FRZ(S_DECAY) }, { S_COMMENT5, { '\n' }, FRZ(STO(COMMENT)) }, #endif /* dummy end of machine description */ { 0, { 0 }, 0 } }; /* * cppm is the table used to store the automaton: if we are in state s * and we read character c, we apply the action cppm[s][c] (jumping to * another state, or emitting a token). * cppm_vch is the table for the special virtual character "end of input" */ static int cppm[MSTATE][MAX_CHAR_VAL]; static int cppm_vch[MSTATE]; /* * init_cppm() fills cppm[][] with the information stored in cppms[]. * It must be called before beginning the lexing process. */ void init_cppm(void) { int i, j, k, c; static unsigned char upper[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; static unsigned char lower[] = "abcdefghijklmnopqrstuvwxyz"; unsigned char *cp; for (i = 0; i < MSTATE; i ++) { for (j = 0; j < MAX_CHAR_VAL; j ++) cppm[i][j] = S_OUCH; cppm_vch[i] = S_OUCH; } for (i = 0; cppms[i].input[0]; i ++) for (k = 0; k < CMCR; k ++) { int s = cppms[i].state; int ns = cppms[i].new_state; switch (c = cppms[i].input[k]) { case 0: break; case SPC: /* see space_char() also */ cppm[s][' '] = ns; cppm[s]['\t'] = ns; cppm[s]['\v'] = ns; cppm[s]['\f'] = ns; #ifdef UNBREAKABLE_SPACE if (MAX_CHAR_VAL > UNBREAKABLE_SPACE) cppm[s][UNBREAKABLE_SPACE] = ns; #endif break; case ALP: for (cp = upper; *cp; cp ++) cppm[s][(int)*cp] = ns; for (cp = lower; *cp; cp ++) cppm[s][(int)*cp] = ns; cppm[s]['_'] = ns; break; case NUM: for (j = '0'; j <= '9'; j ++) cppm[s][j] = ns; break; case ANY: for (j = 0; j < MAX_CHAR_VAL; j ++) cppm[s][j] = ns; cppm_vch[s] = ns; break; case VCH: cppm_vch[s] = ns; break; default: cppm[s][c] = ns; break; } } } /* * Make some character as equivalent to a letter for identifiers. */ void set_identifier_char(int c) { cppm[S_START][c] = PUT(S_NAME); cppm[S_NAME][c] = PUT(S_NAME); } /* * Remove the "identifier" status from a character. */ void unset_identifier_char(int c) { cppm[S_START][c] = S_ILL; cppm[S_NAME][c] = FRZ(STO(NAME)); } int space_char(int c) { if (c == ' ' || c == '\t' || c == '\v' || c == '\f' #ifdef UNBREAKABLE_SPACE || c == UNBREAKABLE_SPACE #endif ) return 1; return 0; } #ifndef NO_UCPP_BUF /* * our output buffer is full, flush it */ void flush_output(struct lexer_state *ls) { size_t x = ls->sbuf, y = 0, z; if (ls->sbuf == 0) return; do { z = fwrite(ls->output_buf + y, 1, x, ls->output); x -= z; y += z; } while (z && x > 0); if (!y) { error(ls->line, "could not flush output (disk full ?)"); die(); } ls->sbuf = 0; } #endif /* * Output one character; flush the buffer if needed. * This function should not be called, except by put_char(). */ static inline void write_char(struct lexer_state *ls, unsigned char c) { #ifndef NO_UCPP_BUF ls->output_buf[ls->sbuf ++] = c; if (ls->sbuf == OUTPUT_BUF_MEMG) flush_output(ls); #else if (putc((int)c, ls->output) == EOF) { error(ls->line, "output write error (disk full ?)"); die(); } #endif if (c == '\n') { ls->oline ++; #ifdef SYNOPSIS assert(0); ls->ocolumn = 0; } else { ls->ocolumn++; #endif } } /* * schedule a character for output */ void put_char(struct lexer_state *ls, unsigned char c) { if (ls->flags & KEEP_OUTPUT) write_char(ls, c); } /* * get next raw input character */ static inline int read_char(struct lexer_state *ls) { unsigned char c; if (!ls->input) { #ifdef SYNOPSIS int c = ((ls->pbuf ++) < ls->ebuf) ? ls->input_string[ls->pbuf - 1] : -1; if (c == '\n') ls->column = 0; else ls->column++; return c; #else return ((ls->pbuf ++) < ls->ebuf) ? ls->input_string[ls->pbuf - 1] : -1; #endif } while (1) { #ifndef NO_UCPP_BUF if (ls->pbuf == ls->ebuf) { #ifdef UCPP_MMAP if (ls->from_mmap) { munmap((void *)ls->input_buf, ls->ebuf); ls->from_mmap = 0; ls->input_buf = ls->input_buf_sav; } #endif ls->ebuf = fread(ls->input_buf, 1, INPUT_BUF_MEMG, ls->input); ls->pbuf = 0; } if (ls->ebuf == 0) return -1; c = ls->input_buf[ls->pbuf ++]; #else int x = getc(ls->input); if (x == EOF) return -1; c = x; #endif #ifdef SYNOPSIS if (c == '\n') ls->column = 0; else ls->column++; #endif if (ls->flags & COPY_LINE) { if (c == '\n') { ls->copy_line[ls->cli] = 0; ls->cli = 0; } else if (ls->cli < (COPY_LINE_LENGTH - 1)) { ls->copy_line[ls->cli ++] = c; } } if (ls->macfile && c == '\n') { ls->macfile = 0; continue; } ls->macfile = 0; if (c == '\r') { /* * We found a '\r'; we handle it as a newline * and ignore the next newline. This should work * with all combinations of Msdos, MacIntosh and * Unix files on these three platforms. On other * platforms, native file formats are always * supported. */ ls->macfile = 1; c = '\n'; } break; } return c; } /* * next_fifo_char(), char_lka1() and char_lka2() give a two character * look-ahead on the input stream; this is needed for trigraphs */ static inline int next_fifo_char(struct lexer_state *ls) { int c; if (ls->nlka != 0) { c = ls->lka[0]; ls->lka[0] = ls->lka[1]; ls->nlka --; } else c = read_char(ls); return c; } static inline int char_lka1(struct lexer_state *ls) { if (ls->nlka == 0) { ls->lka[0] = read_char(ls); ls->nlka ++; } return ls->lka[0]; } static inline int char_lka2(struct lexer_state *ls) { #ifdef AUDIT if (ls->nlka == 0) ouch("always in motion future is"); #endif if (ls->nlka == 1) { ls->lka[1] = read_char(ls); ls->nlka ++; } return ls->lka[1]; } static struct trigraph { int old, new; } trig[9] = { { '=', '#' }, { '/', '\\' }, { '\'', '^' }, { '(', '[' }, { ')', ']' }, { '!', '|' }, { '<', '{' }, { '>', '}' }, { '-', '~' } }; /* * Returns the next character, after treatment of trigraphs and terminating * backslashes. Return value is -1 if there is no more input. */ static inline int next_char(struct lexer_state *ls) { int c; if (!ls->discard) return ls->last; ls->discard = 0; do { c = next_fifo_char(ls); /* check trigraphs */ if (c == '?' && char_lka1(ls) == '?' && (ls->flags & HANDLE_TRIGRAPHS)) { int i, d; d = char_lka2(ls); for (i = 0; i < 9; i ++) if (d == trig[i].old) { if (ls->flags & WARN_TRIGRAPHS) { ls->count_trigraphs ++; } if (ls->flags & WARN_TRIGRAPHS_MORE) { warning(ls->line, "trigraph ?""?%c " "encountered", d); } next_fifo_char(ls); next_fifo_char(ls); c = trig[i].new; break; } } if (c == '\\' && char_lka1(ls) == '\n') { ls->line ++; next_fifo_char(ls); } else { ls->last = c; return c; } } while (1); } /* * wrapper for next_char(), to be called from outside * (used by #error, #include directives) */ int grap_char(struct lexer_state *ls) { return next_char(ls); } /* * Discard the current character, so that the next call to next_char() * will step into the input stream. */ void discard_char(struct lexer_state *ls) { #ifdef AUDIT if (ls->discard) ouch("overcollecting garbage"); #endif ls->discard = 1; ls->utf8 = 0; if (ls->last == '\n') ls->line ++; } /* * Convert an UTF-8 encoded character to a Universal Character Name * using \u (or \U when appropriate). */ static int utf8_to_string(unsigned char buf[], unsigned long utf8) { unsigned long val = 0; static char hex[16] = "0123456789abcdef"; if (utf8 & 0x80UL) { unsigned long x1, x2, x3, x4; x1 = (utf8 >> 24) & 0x7fUL; x2 = (utf8 >> 16) & 0x7fUL; x3 = (utf8 >> 8) & 0x7fUL; x4 = (utf8) & 0x3fUL; x1 &= 0x07UL; if (x2 & 0x40UL) x2 &= 0x0fUL; if (x3 & 0x40UL) x3 &= 0x1fUL; val = x4 | (x3 << 6) | (x2 << 12) | (x1 << 16); } else val = utf8; if (val < 128) { buf[0] = val; buf[1] = 0; return 1; } else if (val < 0xffffUL) { buf[0] = '\\'; buf[1] = 'u'; buf[2] = hex[(size_t)(val >> 12)]; buf[3] = hex[(size_t)((val >> 8) & 0xfU)]; buf[4] = hex[(size_t)((val >> 4) & 0xfU)]; buf[5] = hex[(size_t)(val & 0xfU)]; buf[6] = 0; return 6; } buf[0] = '\\'; buf[1] = 'U'; buf[2] = '0'; buf[3] = '0'; buf[4] = hex[(size_t)(val >> 20)]; buf[5] = hex[(size_t)((val >> 16) & 0xfU)]; buf[6] = hex[(size_t)((val >> 12) & 0xfU)]; buf[7] = hex[(size_t)((val >> 8) & 0xfU)]; buf[8] = hex[(size_t)((val >> 4) & 0xfU)]; buf[9] = hex[(size_t)(val & 0xfU)]; buf[10] = 0; return 10; } /* * Scan the identifier and put it in canonical form: * -- tranform \U0000xxxx into \uxxxx * -- inside \u and \U, make letters low case * -- report (some) incorrect use of UCN */ static void canonize_id(struct lexer_state *ls, char *id) { char *c, *d; for (c = d = id; *c;) { if (*c == '\\') { int i; if (!*(c + 1)) goto canon_error; if (*(c + 1) == 'U') { for (i = 0; i < 8 && *(c + i + 2); i ++); if (i != 8) goto canon_error; *(d ++) = '\\'; c += 2; for (i = 0; i < 4 && *(c + i) == '0'; i ++); if (i == 4) { *(d ++) = 'u'; c += 4; } else { *(d ++) = 'U'; i = 8; } for (; i > 0; i --) { switch (*c) { case 'A': *(d ++) = 'a'; break; case 'B': *(d ++) = 'b'; break; case 'C': *(d ++) = 'c'; break; case 'D': *(d ++) = 'd'; break; case 'E': *(d ++) = 'e'; break; case 'F': *(d ++) = 'f'; break; default: *(d ++) = *c; break; } c ++; } } else if (*(c + 1) == 'u') { for (i = 0; i < 4 && *(c + i + 2); i ++); if (i != 4) goto canon_error; *(d ++) = '\\'; *(d ++) = 'u'; c += 2; for (; i > 0; i --) { switch (*c) { case 'A': *(d ++) = 'a'; break; case 'B': *(d ++) = 'b'; break; case 'C': *(d ++) = 'c'; break; case 'D': *(d ++) = 'd'; break; case 'E': *(d ++) = 'e'; break; case 'F': *(d ++) = 'f'; break; default: *(d ++) = *c; break; } c ++; } } else goto canon_error; continue; } *(d ++) = *(c ++); } *d = 0; return; canon_error: for (; *c; *(d ++) = *(c ++)); if (ls->flags & WARN_STANDARD) { warning(ls->line, "malformed identifier with UCN: '%s'", id); } *d = 0; } /* * Run the automaton, in order to get the next token. * This function should not be called, except by next_token() * * return value: 1 on error, 2 on end-of-file, 0 otherwise. */ static inline int read_token(struct lexer_state *ls) { int cstat = S_START, nstat; size_t ltok = 0; int c, outc = 0, ucn_in_id = 0; int shift_state; unsigned long utf8; long l = ls->line; #ifdef SYNOPSIS ls->ctok->pos = ls->column + (ls->discard ? 1 : 0); #endif ls->ctok->line = l; if (ls->pending_token) { if ((ls->ctok->type = ls->pending_token) == BUNCH) { ls->ctok->name[0] = '\\'; ls->ctok->name[1] = 0; } ls->pending_token = 0; return 0; } if (ls->flags & UTF8_SOURCE) { utf8 = ls->utf8; shift_state = 0; } if (!(ls->flags & LEXER) && (ls->flags & KEEP_OUTPUT)) for (; ls->line > ls->oline;) put_char(ls, '\n'); do { c = next_char(ls); if (c < 0) { if ((ls->flags & UTF8_SOURCE) && shift_state) { if (ls->flags & WARN_STANDARD) warning(ls->line, "truncated UTF-8 " "character"); shift_state = 0; utf8 = 0; } if (cstat == S_START) return 2; nstat = cppm_vch[cstat]; } else { if (ls->flags & UTF8_SOURCE) { if (shift_state) { if ((c & 0xc0) != 0x80) { if (ls->flags & WARN_STANDARD) warning(ls->line, "truncated " "UTF-8 " "character"); shift_state = 0; utf8 = 0; c = '_'; } else { utf8 = (utf8 << 8) | c; if (-- shift_state) { ls->discard = 1; continue; } c = '_'; } } else if ((c & 0xc0) == 0xc0) { if ((c & 0x30) == 0x30) { shift_state = 3; } else if (c & 0x20) { shift_state = 2; } else { shift_state = 1; } utf8 = c; ls->discard = 1; continue; } else utf8 = 0; } nstat = cppm[cstat][c < MAX_CHAR_VAL ? c : 0]; } #ifdef AUDIT if (nstat == S_OUCH) { ouch("bad move..."); } #endif /* * disable C++-like comments */ if (nstat == S_COMMENT5 && !(ls->flags & CPLUSPLUS_COMMENTS)) nstat = FRZ(STO(SLASH)); if (noMOD(nstat) >= MSTATE && !ttSTO(nstat)) switch (noMOD(nstat)) { case S_ILL: if (ls->flags & CCHARSET) { error(ls->line, "illegal character '%c'", c); return 1; } nstat = PUT(STO(BUNCH)); break; case S_BS: ls->ctok->name[0] = '\\'; ltok ++; nstat = FRZ(STO(BUNCH)); if (!(ls->flags & LEXER)) put_char(ls, '\\'); break; case S_ROGUE_BS: ls->pending_token = BUNCH; nstat = FRZ(STO(NAME)); break; case S_DDOT: ls->pending_token = DOT; nstat = FRZ(STO(DOT)); break; case S_DDSHARP: ls->pending_token = PCT; nstat = FRZ(STO(DIG_SHARP)); break; case S_BEHEAD: error(l, "unfinished string at end of line"); return 1; case S_DECAY: warning(l, "unterminated // comment"); nstat = FRZ(STO(COMMENT)); break; case S_TRUNC: error(l, "truncated token"); return 1; case S_TRUNCC: error(l, "truncated comment"); return 1; #ifdef AUDIT case S_OUCH: ouch("machine went out of control"); break; #endif } if (!ttFRZ(nstat)) { discard_char(ls); if (!(ls->flags & LEXER) && ls->condcomp) { int z = ttSTO(nstat) ? S_ILL : noMOD(nstat); if (cstat == S_NAME || z == S_NAME || ((CMT(cstat) || CMT(z)) && (ls->flags & DISCARD_COMMENTS))) { outc = 0; } else if (z == S_LCHAR || z == S_SLASH || (z == S_SHARP && ls->ltwnl) || (z == S_PCT && ls->ltwnl) || (z == S_BACKSLASH)) { outc = c; } else if (z == S_PCT2 && ls->ltwnl) { outc = -1; } else if (z == S_PCT3 && ls->ltwnl) { /* we have %:% but this still might not be a %:%: */ outc = -2; } else { if (outc < 0) { put_char(ls, '%'); put_char(ls, ':'); if (outc == -2) put_char(ls, '%'); outc = 0; } else if (outc) { put_char(ls, outc); outc = 0; } put_char(ls, c); } } } else if (outc == '/' && !(ls->flags & LEXER) && ls->condcomp) { /* this is a hack: we need to dump a pending slash */ put_char(ls, outc); outc = 0; } if (ttPUT(nstat)) { if (cstat == S_NAME_BS) { ucn_in_id = 1; wan(ls->ctok->name, ltok, '\\', ls->tknl); } if ((ls->flags & UTF8_SOURCE) && utf8) { unsigned char buf[11]; int i, j; for (i = 0, j = utf8_to_string(buf, utf8); i < j; i ++) wan(ls->ctok->name, ltok, buf[i], ls->tknl); /* if (j > 1) ucn_in_id = 1; */ } else wan(ls->ctok->name, ltok, (unsigned char)c, ls->tknl); } if (ttSTO(nstat)) { if (S_TOKEN(noMOD(nstat))) { wan(ls->ctok->name, ltok, (unsigned char)0, ls->tknl); } ls->ctok->type = noMOD(nstat); break; } cstat = noMOD(nstat); } while (1); if (!(ls->flags & LEXER) && (ls->flags & DISCARD_COMMENTS) && ls->ctok->type == COMMENT) put_char(ls, ' '); if (ucn_in_id && ls->ctok->type == NAME) canonize_id(ls, ls->ctok->name); return 0; } /* * fills ls->ctok with the next token */ int next_token(struct lexer_state *ls) { if (ls->flags & READ_AGAIN) { ls->flags &= ~READ_AGAIN; if (!(ls->flags & LEXER)) { char *c = S_TOKEN(ls->ctok->type) ? ls->ctok->name : token_name(ls->ctok); if (ls->ctok->type == OPT_NONE) { ls->ctok->type = NONE; #ifdef SEMPER_FIDELIS ls->ctok->name[0] = ' '; ls->ctok->name[1] = 0; #endif put_char(ls, ' '); } else if (ls->ctok->type != NAME && !(ls->ltwnl && (ls->ctok->type == SHARP || ls->ctok->type == DIG_SHARP))) for (; *c; c ++) put_char(ls, *c); } return 0; } return read_token(ls); } synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/Makefile.in0000664000076400007640000000307311170457310021665 0ustar stefanstefan# # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # SHELL := /bin/sh srcdir := @srcdir@ PYTHON := @PYTHON@ SYNOPSIS:= $(PYTHON) synopsis.py CC := @CC@ CXX := @CXX@ LDSHARED:= @LDSHARED@ MAKEDEP := $(CXX) -M CPPFLAGS:= @CPPFLAGS@ -I $(srcdir) CPPFLAGS+= @SYN_CPP@ -I/usr/local/include -I @PYTHON_INCLUDE@ CFLAGS := @CFLAGS@ CXXFLAGS:= @CXXFLAGS@ LDFLAGS := @LDFLAGS@ LIBS := @SYN_LIBS@ @LIBS@ LIBRARY_EXT := @LIBEXT@ HDR := $(patsubst $(srcdir)/%, %, $(wildcard $(srcdir)/*.h)) SRC := mem.c nhash.c assert.c macro.c eval.c lexer.c cpp.c SRC += comments.cc ucpp.cc ParserImpl.cc OBJ := $(patsubst %, %.o, $(basename $(SRC))) DEP := $(patsubst %.o, %.d, $(OBJ)) TARGET := ParserImpl$(LIBRARY_EXT) vpath %.c $(srcdir) vpath %.h $(srcdir) vpath %.cc $(srcdir) all: $(TARGET) %.d: %.cc @echo generating dependencies for $( $@' %.d: %.c @echo generating dependencies for $( $@' %.o : %.cc @echo compiling $(@F) $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< %.o : %.c @echo compiling $(@F) $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< Makefile: $(srcdir)/Makefile.in ./config.status --file Makefile $(TARGET): $(OBJ) $(LDSHARED) $(LDFLAGS) -o $@ $^ $(LIBS) clean : rm -f *~ *.o $(TARGET) *.d *.pyc *.pyo base_lib ifeq (,$(filter $(MAKECMDGOALS), depend clean distclean)) -include $(DEP) endif synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/configure.ac0000664000076400007640000000172611163206513022110 0ustar stefanstefandnl dnl Copyright (C) 2004 Stefan Seefeld dnl All rights reserved. dnl Licensed to the public under the terms of the GNU LGPL (>= 2), dnl see the file COPYING for details. dnl dnl ------------------------------------------------------------------ dnl Autoconf initialization dnl ------------------------------------------------------------------ AC_PREREQ(2.56) AC_REVISION($Revision: 1.10 $) AC_INIT(ucpp, 1.0, synopsis-devel@fresco.org) AC_ARG_WITH(syn-cxx, [ --with-syn-cxx=PATH specify the Synopsis C++ library prefix], SYN_CXX="$with_syn_cxx", SYN_CXX="/usr/local" ) AC_PROG_CPP AC_PROG_CC AC_PROG_CXX SYN_CPP="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --cflags synopsis-uninstalled`" SYN_LIBS="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --libs synopsis-uninstalled`" AC_SUBST(SYN_CPP) AC_SUBST(SYN_LIBS) AC_PYTHON_EXT topdir=`$PYTHON -c "from os.path import *; print normpath('$srcdir/../../../..')"` AC_SUBST(topdir) AC_CONFIG_FILES([Makefile synopsis.py]) AC_OUTPUT synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/ucpp.cc0000664000076400007640000001041611171347212021075 0ustar stefanstefan// // Copyright (C) 2009 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include "comments.hh" #include #include #include #include #include extern "C" { #include }; void handle_newline(lexer_state &ls) { add_newline(); if (ls.flags & KEEP_OUTPUT) fputs("\n", ls.output); } void handle_pragma(lexer_state &ls) { if (ls.flags & KEEP_OUTPUT) { // If this is a PRAGMA token, the // string content is in fact a compressed token list, // that we uncompress and print. fputs("#pragma ", ls.output); for (char *c = ls.ctok->name; *c; ++c) { if (STRING_TOKEN(*c)) for (++c; *c != PRAGMA_TOKEN_END; ++c) fputc(*c, ls.output); else fputs(operators_name[*c], ls.output); } } } void handle_context(lexer_state &ls) { if (ls.flags & KEEP_OUTPUT) fprintf(ls.output, "#line %ld \"%s\"\n", ls.line, ls.ctok->name);//, enter_leave); // Reset for new file. ls.oline = ls.line; } void handle_token(lexer_state &ls) { if (ls.flags & KEEP_OUTPUT) fputs(STRING_TOKEN(ls.ctok->type) ? ls.ctok->name : operators_name[ls.ctok->type], ls.output); if (ls.ctok->type == COMMENT) { if (ls.ctok->name[0] == '/' && ls.ctok->name[1] == '*') { add_ccomment(ls.ctok->name); // If this is a multi-line comment, account for embedded newlines. char const *c = ls.ctok->name + 2; while (*(++c)) if (*c == '\n') ++ls.oline; } else add_cxxcomment(ls.ctok->name); } else clear_comment_cache(); } void ucpp(char const *input, char const *output, std::vector const &flags) { lexer_state ls; // step 1 init_cpp(); // step 2 no_special_macros = 0; emit_defines = emit_assertions = 0; // step 3 -- with assertions init_tables(1); // step 4 -- no default include path init_include_path(0); // step 5 -- no need to reset the two emit_* variables set in 2 emit_dependencies = 0; // step 6 -- we work with stdin, this is not a real filename set_init_filename(const_cast(input), 0); // step 7 -- we make sure that assertions are on, and pragma are handled init_lexer_state(&ls); init_lexer_mode(&ls); ls.flags |= HANDLE_ASSERTIONS | HANDLE_PRAGMA | LINE_NUM | KEEP_OUTPUT; ls.flags |= MACRO_VAARG | CPLUSPLUS_COMMENTS | HANDLE_TRIGRAPHS; ls.flags &= ~DISCARD_COMMENTS; // step 8 -- prepare I/O ls.input = fopen(input, "r"); if (!ls.input) throw std::runtime_error("unable to open input for reading"); if (output && output[0] == '-' && output[1] == 0) ls.output = stdout; else if (output) { ls.output = fopen(output, "w"); if (!ls.output) { fclose(ls.input); throw std::runtime_error("unable to open output for writing"); } } else { // no output ls.output = 0; ls.flags &= ~KEEP_OUTPUT; } // step 9 -- handle preprocessor flags: -D, -U, and -I for (std::vector::const_iterator i = flags.begin(); i != flags.end(); ++i) { // -D if (*i == "-D") define_macro(&ls, const_cast((++i)->c_str())); else if (i->substr(0, 2) == "-D") define_macro(&ls, const_cast(i->substr(2).c_str())); // -U else if (*i == "-U") undef_macro(&ls, const_cast((++i)->c_str())); else if (i->substr(0, 2) == "-U") undef_macro(&ls, const_cast(i->substr(2).c_str())); // -I else if (*i == "-I") add_incpath(const_cast((++i)->c_str())); else if (i->substr(0, 2) == "-I") add_incpath(const_cast(i->substr(2).c_str())); } // step 10 -- we are a lexer and we want CONTEXT tokens enter_file(&ls, ls.flags, 0); // read tokens until end-of-input is reached -- errors (non-zero // retur nvalues different from CPPERR_EOF) are ignored int r; while ((r = lex(&ls)) < CPPERR_EOF) { if (r) { // error condition -- no token was retrieved continue; } if (ls.ctok->type == PRAGMA) handle_pragma(ls); else if (ls.ctok->type == CONTEXT) handle_context(ls); else if (ls.ctok->type == NEWLINE) handle_newline(ls); else handle_token(ls); } // give back memory and exit wipeout(); if (ls.output && ls.output != stdout) fclose(ls.output); free_lexer_state(&ls); } synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/aclocal.m40000664000076400007640000000120611171624002021447 0ustar stefanstefan# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_include([../../../../config/python_ext.m4]) synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/assert.c0000664000076400007640000002406711163213162021270 0ustar stefanstefan/* * (c) Thomas Pornin 1999 - 2002 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. The name of the authors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #include "tune.h" #include #include #include #include #include #include "ucppi.h" #include "mem.h" #include "nhash.h" /* * Assertion support. Each assertion is indexed by its predicate, and * the list of 'questions' which yield a true answer. */ static HTT assertions; static int assertions_init_done = 0; static struct assert *new_assertion(void) { struct assert *a = getmem(sizeof(struct assert)); a->nbval = 0; return a; } static void del_token_fifo(struct token_fifo *tf) { size_t i; for (i = 0; i < tf->nt; i ++) if (S_TOKEN(tf->t[i].type)) freemem(tf->t[i].name); if (tf->nt) freemem(tf->t); } static void del_assertion(void *va) { struct assert *a = va; size_t i; for (i = 0; i < a->nbval; i ++) del_token_fifo(a->val + i); if (a->nbval) freemem(a->val); freemem(a); } /* * print the contents of a token list */ static void print_token_fifo(struct token_fifo *tf) { size_t i; for (i = 0; i < tf->nt; i ++) if (ttMWS(tf->t[i].type)) fputc(' ', emit_output); else fputs(token_name(tf->t + i), emit_output); } /* * print all assertions related to a given name */ static void print_assert(void *va) { struct assert *a = va; size_t i; for (i = 0; i < a->nbval; i ++) { fprintf(emit_output, "#assert %s(", HASH_ITEM_NAME(a)); print_token_fifo(a->val + i); fprintf(emit_output, ")\n"); } } /* * compare two token_fifo, return 0 if they are identical, 1 otherwise. * All whitespace tokens are considered identical, but sequences of * whitespace are not shrinked. */ int cmp_token_list(struct token_fifo *f1, struct token_fifo *f2) { size_t i; if (f1->nt != f2->nt) return 1; for (i = 0; i < f1->nt; i ++) { if (ttMWS(f1->t[i].type) && ttMWS(f2->t[i].type)) continue; if (f1->t[i].type != f2->t[i].type) return 1; if (f1->t[i].type == MACROARG && f1->t[i].line != f2->t[i].line) return 1; if (S_TOKEN(f1->t[i].type) && strcmp(f1->t[i].name, f2->t[i].name)) return 1; } return 0; } /* * for #assert * Assertions are not part of the ISO-C89 standard, but they are sometimes * encountered, for instance in Solaris standard include files. */ int handle_assert(struct lexer_state *ls) { int ina = 0, ltww; struct token t; struct token_fifo *atl = 0; struct assert *a; char *aname; int ret = -1; long l = ls->line; int nnp; size_t i; while (!next_token(ls)) { if (ls->ctok->type == NEWLINE) break; if (ttMWS(ls->ctok->type)) continue; if (ls->ctok->type == NAME) { if (!(a = HTT_get(&assertions, ls->ctok->name))) { a = new_assertion(); aname = sdup(ls->ctok->name); ina = 1; } goto handle_assert_next; } error(l, "illegal assertion name for #assert"); goto handle_assert_warp_ign; } goto handle_assert_trunc; handle_assert_next: while (!next_token(ls)) { if (ls->ctok->type == NEWLINE) break; if (ttMWS(ls->ctok->type)) continue; if (ls->ctok->type != LPAR) { error(l, "syntax error in #assert"); goto handle_assert_warp_ign; } goto handle_assert_next2; } goto handle_assert_trunc; handle_assert_next2: atl = getmem(sizeof(struct token_fifo)); atl->art = atl->nt = 0; for (nnp = 1, ltww = 1; nnp && !next_token(ls);) { if (ls->ctok->type == NEWLINE) break; if (ltww && ttMWS(ls->ctok->type)) continue; ltww = ttMWS(ls->ctok->type); if (ls->ctok->type == LPAR) nnp ++; else if (ls->ctok->type == RPAR) { if (!(-- nnp)) goto handle_assert_next3; } t.type = ls->ctok->type; if (S_TOKEN(t.type)) t.name = sdup(ls->ctok->name); aol(atl->t, atl->nt, t, TOKEN_LIST_MEMG); } goto handle_assert_trunc; handle_assert_next3: while (!next_token(ls) && ls->ctok->type != NEWLINE) { if (!ttWHI(ls->ctok->type) && (ls->flags & WARN_STANDARD)) { warning(l, "trailing garbage in #assert"); } } if (atl->nt && ttMWS(atl->t[atl->nt - 1].type) && (-- atl->nt) == 0) freemem(atl->t); if (atl->nt == 0) { error(l, "void assertion in #assert"); goto handle_assert_error; } for (i = 0; i < a->nbval && cmp_token_list(atl, a->val + i); i ++); if (i != a->nbval) { /* we already have it */ ret = 0; goto handle_assert_error; } /* This is a new assertion. Let's keep it. */ aol(a->val, a->nbval, *atl, TOKEN_LIST_MEMG); if (ina) { HTT_put(&assertions, a, aname); freemem(aname); } if (emit_assertions) { fprintf(emit_output, "#assert %s(", HASH_ITEM_NAME(a)); print_token_fifo(atl); fputs(")\n", emit_output); } freemem(atl); return 0; handle_assert_trunc: error(l, "unfinished #assert"); handle_assert_error: if (atl) { del_token_fifo(atl); freemem(atl); } if (ina) { freemem(aname); freemem(a); } return ret; handle_assert_warp_ign: while (!next_token(ls) && ls->ctok->type != NEWLINE); if (ina) { freemem(aname); freemem(a); } return ret; } /* * for #unassert */ int handle_unassert(struct lexer_state *ls) { int ltww; struct token t; struct token_fifo atl; struct assert *a; int ret = -1; long l = ls->line; int nnp; size_t i; atl.art = atl.nt = 0; while (!next_token(ls)) { if (ls->ctok->type == NEWLINE) break; if (ttMWS(ls->ctok->type)) continue; if (ls->ctok->type == NAME) { if (!(a = HTT_get(&assertions, ls->ctok->name))) { ret = 0; goto handle_unassert_warp; } goto handle_unassert_next; } error(l, "illegal assertion name for #unassert"); goto handle_unassert_warp; } goto handle_unassert_trunc; handle_unassert_next: while (!next_token(ls)) { if (ls->ctok->type == NEWLINE) break; if (ttMWS(ls->ctok->type)) continue; if (ls->ctok->type != LPAR) { error(l, "syntax error in #unassert"); goto handle_unassert_warp; } goto handle_unassert_next2; } if (emit_assertions) fprintf(emit_output, "#unassert %s\n", HASH_ITEM_NAME(a)); HTT_del(&assertions, HASH_ITEM_NAME(a)); return 0; handle_unassert_next2: for (nnp = 1, ltww = 1; nnp && !next_token(ls);) { if (ls->ctok->type == NEWLINE) break; if (ltww && ttMWS(ls->ctok->type)) continue; ltww = ttMWS(ls->ctok->type); if (ls->ctok->type == LPAR) nnp ++; else if (ls->ctok->type == RPAR) { if (!(-- nnp)) goto handle_unassert_next3; } t.type = ls->ctok->type; if (S_TOKEN(t.type)) t.name = sdup(ls->ctok->name); aol(atl.t, atl.nt, t, TOKEN_LIST_MEMG); } goto handle_unassert_trunc; handle_unassert_next3: while (!next_token(ls) && ls->ctok->type != NEWLINE) { if (!ttWHI(ls->ctok->type) && (ls->flags & WARN_STANDARD)) { warning(l, "trailing garbage in #unassert"); } } if (atl.nt && ttMWS(atl.t[atl.nt - 1].type) && (-- atl.nt) == 0) freemem(atl.t); if (atl.nt == 0) { error(l, "void assertion in #unassert"); return ret; } for (i = 0; i < a->nbval && cmp_token_list(&atl, a->val + i); i ++); if (i != a->nbval) { /* we have it, undefine it */ del_token_fifo(a->val + i); if (i < (a->nbval - 1)) mmvwo(a->val + i, a->val + i + 1, (a->nbval - i - 1) * sizeof(struct token_fifo)); if ((-- a->nbval) == 0) freemem(a->val); if (emit_assertions) { fprintf(emit_output, "#unassert %s(", HASH_ITEM_NAME(a)); print_token_fifo(&atl); fputs(")\n", emit_output); } } ret = 0; goto handle_unassert_finish; handle_unassert_trunc: error(l, "unfinished #unassert"); handle_unassert_finish: if (atl.nt) del_token_fifo(&atl); return ret; handle_unassert_warp: while (!next_token(ls) && ls->ctok->type != NEWLINE); return ret; } /* * Add the given assertion (as string). */ int make_assertion(char *aval) { struct lexer_state lls; size_t n = strlen(aval) + 1; char *c = sdup(aval); int ret; *(c + n - 1) = '\n'; init_buf_lexer_state(&lls, 0); lls.flags = DEFAULT_LEXER_FLAGS; lls.input = 0; lls.input_string = (unsigned char *)c; lls.pbuf = 0; lls.ebuf = n; lls.line = -1; ret = handle_assert(&lls); freemem(c); free_lexer_state(&lls); return ret; } /* * Remove the given assertion (as string). */ int destroy_assertion(char *aval) { struct lexer_state lls; size_t n = strlen(aval) + 1; char *c = sdup(aval); int ret; *(c + n - 1) = '\n'; init_buf_lexer_state(&lls, 0); lls.flags = DEFAULT_LEXER_FLAGS; lls.input = 0; lls.input_string = (unsigned char *)c; lls.pbuf = 0; lls.ebuf = n; lls.line = -1; ret = handle_unassert(&lls); freemem(c); free_lexer_state(&lls); return ret; } /* * erase the assertion table */ void wipe_assertions(void) { if (assertions_init_done) HTT_kill(&assertions); assertions_init_done = 0; } /* * initialize the assertion table */ void init_assertions(void) { wipe_assertions(); HTT_init(&assertions, del_assertion); assertions_init_done = 1; } /* * retrieve an assertion from the hash table */ struct assert *get_assertion(char *name) { return HTT_get(&assertions, name); } /* * print already defined assertions */ void print_assertions(void) { HTT_scan(&assertions, print_assert); } synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/comments.hh0000664000076400007640000000073211171347177021777 0ustar stefanstefan// // Copyright (C) 2009 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef comments_hh_ #define comments_hh_ #include #include // accumulate comments that may be macro docstrings void add_ccomment(char const *); void add_cxxcomment(char const *); void clear_comment_cache(); void add_newline(); extern std::vector comment_cache; #endif synopsis-0.12/Synopsis/Parsers/Cpp/ucpp/arith.h0000644000076400007640000002422311163214654021102 0ustar stefanstefan/* * Integer arithmetic evaluation, header file. * * (c) Thomas Pornin 2002 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. The name of the authors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /* * This arithmetic evaluator uses two files: this header file (arith.h) * and the source file (arith.c). To use this code, the source file should * be included from another .c file which defines some macros (see below). * Then the functions defined in the arith.c file become available to the * including source file. If those functions are defined with external * linkage (that is, `ARITH_FUNCTION_HEADER' does not contain `static'), * it is possible for other source files to use the arithmetic functions * by including the arith.h header only. The source file which includes * arith.c should *not* include arith.h. * * If the #include is for arith.h, the following macros should be * defined: * * -- If the evaluator is supposed to use a native type: * NATIVE_SIGNED the native signed integer type * NATIVE_UNSIGNED the native unsigned integer type * * -- If the evaluator is supposed to use an emulated type: * SIMUL_ARITH_SUBTYPE the native unsigned type used for the simulation * SIMUL_SUBTYPE_BITS the native unsigned type size * SIMUL_NUMBITS the emulated type size * * -- For both cases: * ARITH_TYPENAME the central arithmetic type name * ARITH_FUNCTION_HEADER the qualifiers to add to function definitions * * The presence (respectively absence) of the NATIVE_SIGNED macro triggers * the use of the native type evaluator (respectively simulated type * evaluator). * * If the #include is for arith.c, the macros for arith.h should be defined, * and the following should be defined as well: * * -- If the evaluator is supposed to use a native type: * NATIVE_UNSIGNED_BITS the native unsigned type size * NATIVE_SIGNED_MIN the native signed minimum value * NATIVE_SIGNED_MAX the native signed maximum value * (the last two macros must evaluate to signed constant expressions) * * -- For both cases: * ARITH_WARNING(type) code to perform on warning * ARITH_ERROR(type) code to perform on error * * The macro ARITH_WARNING() and ARITH_ERROR() are invoked with a * numerical argument which is one of the enumeration constants * defined below (ARITH_EXCEP_*) that identifies the specific problem. * * If the #include is for arith.c, the macro ARITHMETIC_CHECKS may be * defined. When this macro is defined, checks are performed so that all * operation which would lead to undefined or implementation-defined * behaviour are first reported through ARITH_WARNING(). Code is smaller * and faster without these checks, of course. Regardless of the status * of that macro, divisions by 0 and overflows on signed division are * reported as errors through ARITH_ERROR(). * */ #ifndef ARITH_H__ #define ARITH_H__ enum { /* Warnings */ ARITH_EXCEP_CONV_O, /* overflow on conversion */ ARITH_EXCEP_NEG_O, /* overflow on unary minus */ ARITH_EXCEP_NOT_T, /* trap representation on bitwise inversion */ ARITH_EXCEP_PLUS_O, /* overflow on addition */ ARITH_EXCEP_PLUS_U, /* underflow on addition */ ARITH_EXCEP_MINUS_O, /* overflow on subtraction */ ARITH_EXCEP_MINUS_U, /* underflow on subtraction */ ARITH_EXCEP_AND_T, /* trap representation on bitwise and */ ARITH_EXCEP_XOR_T, /* trap representation on bitwise xor */ ARITH_EXCEP_OR_T, /* trap representation on bitwise or */ ARITH_EXCEP_LSH_W, /* left shift by type width or more */ ARITH_EXCEP_LSH_C, /* left shift by negative count */ ARITH_EXCEP_LSH_O, /* overflow on left shift */ ARITH_EXCEP_LSH_U, /* underflow on left shift */ ARITH_EXCEP_RSH_W, /* right shift by type width or more */ ARITH_EXCEP_RSH_C, /* right shift by negative count */ ARITH_EXCEP_RSH_N, /* right shift of negative value */ ARITH_EXCEP_STAR_O, /* overflow on multiplication */ ARITH_EXCEP_STAR_U, /* underflow on multiplication */ /* Errors */ ARITH_EXCEP_SLASH_D, /* division by 0 */ ARITH_EXCEP_SLASH_O, /* overflow on division */ ARITH_EXCEP_PCT_D, /* division by 0 on modulus operator */ ARITH_EXCEP_CONST_O /* constant too large */ }; #define arith_strc_(x, y) x ## y #define arith_strc(x, y) arith_strc_(x, y) #define arith_u arith_strc(u_, ARITH_TYPENAME) #define arith_s arith_strc(s_, ARITH_TYPENAME) #define arith_op_u(op) arith_strc(ARITH_TYPENAME, arith_strc(_u_, op)) #define arith_op_s(op) arith_strc(ARITH_TYPENAME, arith_strc(_s_, op)) #define ARITH_DECL_MONO_U_U(op) ARITH_FUNCTION_HEADER arith_u \ arith_op_u(op)(arith_u x) #define ARITH_DECL_MONO_U_S(op) ARITH_FUNCTION_HEADER arith_s \ arith_op_u(op)(arith_u x) #define ARITH_DECL_MONO_U_I(op) ARITH_FUNCTION_HEADER int \ arith_op_u(op)(arith_u x) #define ARITH_DECL_MONO_U_L(op) ARITH_FUNCTION_HEADER unsigned long \ arith_op_u(op)(arith_u x) #define ARITH_DECL_MONO_S_U(op) ARITH_FUNCTION_HEADER arith_u \ arith_op_s(op)(arith_s x) #define ARITH_DECL_MONO_S_S(op) ARITH_FUNCTION_HEADER arith_s \ arith_op_s(op)(arith_s x) #define ARITH_DECL_MONO_S_I(op) ARITH_FUNCTION_HEADER int \ arith_op_s(op)(arith_s x) #define ARITH_DECL_MONO_S_L(op) ARITH_FUNCTION_HEADER long \ arith_op_s(op)(arith_s x) #define ARITH_DECL_MONO_I_U(op) ARITH_FUNCTION_HEADER arith_u \ arith_op_u(op)(int x) #define ARITH_DECL_MONO_L_U(op) ARITH_FUNCTION_HEADER arith_u \ arith_op_u(op)(unsigned long x) #define ARITH_DECL_MONO_I_S(op) ARITH_FUNCTION_HEADER arith_s \ arith_op_s(op)(int x) #define ARITH_DECL_MONO_L_S(op) ARITH_FUNCTION_HEADER arith_s \ arith_op_s(op)(long x) #define ARITH_DECL_MONO_ST_US(op) ARITH_FUNCTION_HEADER char *arith_op_u(op) \ (char *c, arith_u *ru, arith_s *rs, int *sp) #define ARITH_DECL_BI_UU_U(op) ARITH_FUNCTION_HEADER arith_u \ arith_op_u(op)(arith_u x, arith_u y) #define ARITH_DECL_BI_UI_U(op) ARITH_FUNCTION_HEADER arith_u \ arith_op_u(op)(arith_u x, int y) #define ARITH_DECL_BI_UU_I(op) ARITH_FUNCTION_HEADER int \ arith_op_u(op)(arith_u x, arith_u y) #define ARITH_DECL_BI_SS_S(op) ARITH_FUNCTION_HEADER arith_s \ arith_op_s(op)(arith_s x, arith_s y) #define ARITH_DECL_BI_SI_S(op) ARITH_FUNCTION_HEADER arith_s \ arith_op_s(op)(arith_s x, int y) #define ARITH_DECL_BI_SS_I(op) ARITH_FUNCTION_HEADER int \ arith_op_s(op)(arith_s x, arith_s y) #endif #ifdef NATIVE_SIGNED typedef NATIVE_SIGNED arith_s; typedef NATIVE_UNSIGNED arith_u; #else #if SIMUL_NUMBITS > (2 * SIMUL_SUBTYPE_BITS) #error Native subtype too small for arithmetic simulation. #endif #define SIMUL_MSW_WIDTH (SIMUL_NUMBITS / 2) #define SIMUL_LSW_WIDTH ((SIMUL_NUMBITS + 1) / 2) typedef struct { SIMUL_ARITH_SUBTYPE msw, lsw; } arith_u, arith_s; #endif /* functions with the unsigned type */ ARITH_DECL_MONO_S_U(to_u); ARITH_DECL_MONO_I_U(fromint); ARITH_DECL_MONO_L_U(fromulong); ARITH_DECL_MONO_U_I(toint); ARITH_DECL_MONO_U_L(toulong); ARITH_DECL_MONO_U_U(neg); ARITH_DECL_MONO_U_U(not); ARITH_DECL_MONO_U_I(lnot); ARITH_DECL_MONO_U_I(lval); ARITH_DECL_BI_UU_U(plus); ARITH_DECL_BI_UU_U(minus); ARITH_DECL_BI_UI_U(lsh); ARITH_DECL_BI_UI_U(rsh); ARITH_DECL_BI_UU_I(lt); ARITH_DECL_BI_UU_I(leq); ARITH_DECL_BI_UU_I(gt); ARITH_DECL_BI_UU_I(geq); ARITH_DECL_BI_UU_I(same); ARITH_DECL_BI_UU_I(neq); ARITH_DECL_BI_UU_U(and); ARITH_DECL_BI_UU_U(xor); ARITH_DECL_BI_UU_U(or); ARITH_DECL_BI_UU_U(star); ARITH_DECL_BI_UU_U(slash); ARITH_DECL_BI_UU_U(pct); /* functions with the signed type */ ARITH_DECL_MONO_U_S(to_s); ARITH_DECL_MONO_I_S(fromint); ARITH_DECL_MONO_L_S(fromlong); ARITH_DECL_MONO_S_I(toint); ARITH_DECL_MONO_S_L(tolong); ARITH_DECL_MONO_S_S(neg); ARITH_DECL_MONO_S_S(not); ARITH_DECL_MONO_S_I(lnot); ARITH_DECL_MONO_S_I(lval); ARITH_DECL_BI_SS_S(plus); ARITH_DECL_BI_SS_S(minus); ARITH_DECL_BI_SI_S(lsh); ARITH_DECL_BI_SI_S(rsh); ARITH_DECL_BI_SS_I(lt); ARITH_DECL_BI_SS_I(leq); ARITH_DECL_BI_SS_I(gt); ARITH_DECL_BI_SS_I(geq); ARITH_DECL_BI_SS_I(same); ARITH_DECL_BI_SS_I(neq); ARITH_DECL_BI_SS_S(and); ARITH_DECL_BI_SS_S(xor); ARITH_DECL_BI_SS_S(or); ARITH_DECL_BI_SS_S(star); ARITH_DECL_BI_SS_S(slash); ARITH_DECL_BI_SS_S(pct); /* conversions from string */ ARITH_DECL_MONO_ST_US(octconst); ARITH_DECL_MONO_ST_US(hexconst); ARITH_DECL_MONO_ST_US(decconst); synopsis-0.12/Synopsis/Parsers/Cpp/wave/0000775000076400007640000000000011172123232017603 5ustar stefanstefansynopsis-0.12/Synopsis/Parsers/Cpp/wave/IRGenerator-depreciated.hh0000664000076400007640000002734211104703263024567 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef IRGenerator_depreciated_hh_ #define IRGenerator_depreciated_hh_ #include #include #include #include #include #include #include #include #include using namespace Synopsis; namespace wave = boost::wave; namespace bpl = boost::python; class IRGenerator : public wave::context_policies::default_preprocessing_hooks { typedef wave::context_policies::default_preprocessing_hooks base; public: typedef wave::cpplexer::lex_token<> Token; typedef wave::context, wave::iteration_context_policies::load_file_to_string, IRGenerator> Context; typedef std::list > Container; IRGenerator(std::string const &language, std::string const &filename, std::string const &base_path, bool primary_file_only, bpl::object ir, bool v, bool d) : language_(language), qname_module_(bpl::import("Synopsis.QualifiedName")), asg_module_(bpl::import("Synopsis.ASG")), sf_module_(bpl::import("Synopsis.SourceFile")), files_(bpl::extract(ir.attr("files"))()), raw_filename_(filename), base_path_(base_path), primary_file_only_(primary_file_only), mask_counter_(0), macro_level_counter_(0), current_line_(1), current_offset_(0), verbose_(v), debug_(d) { Trace trace("IRGenerator::IRGenerator", Trace::TRANSLATION); file_stack_.push(lookup_source_file(raw_filename_, true)); bpl::object asg = ir.attr("asg"); declarations_ = bpl::extract(asg.attr("declarations"))(); types_ = bpl::extract(asg.attr("types"))(); } void expanding_function_like_macro(Token const ¯odef, std::vector const &formal_args, Container const &definition, Token const ¯ocall, std::vector const &arguments); void expanding_object_like_macro(Token const ¯o, Container const &definition, Token const ¯ocall); void expanded_macro(Container const &result); void rescanned_macro(Container const &result); void found_include_directive(std::string const &filename, bool); void opened_include_file(std::string const &dir, std::string const &filename, std::size_t include_depth, bool is_system_include); void returning_from_include_file(); void defined_macro(Token const &name, bool is_functionlike, std::vector const ¶meters, Container const &definition, bool is_predefined); void undefined_macro(Token const &name); private: typedef std::stack FileStack; //. Look up the given filename in the ast, creating it if necessary. //. Mark the file as 'primary' if so required. bpl::object lookup_source_file(std::string const &filename, bool primary); std::string language_; bpl::object qname_module_; bpl::object asg_module_; bpl::object sf_module_; bpl::list declarations_; bpl::dict types_; bpl::dict files_; bpl::object file_; std::string raw_filename_; std::string base_path_; FileStack file_stack_; std::string include_dir_; bool include_next_dir_; bool primary_file_only_; unsigned int mask_counter_; unsigned int macro_level_counter_; //. The name of the macro currently being expanded. std::string current_macro_name_; Token::position_type current_macro_call_start_; Token::position_type current_macro_call_end_; unsigned int current_line_; //. Offset induced by macro expansion. int current_offset_; bool verbose_; bool debug_; }; inline void IRGenerator::expanding_function_like_macro(Token const ¯odef, std::vector const &formal_args, Container const &definition, Token const ¯ocall, std::vector const &arguments) { Trace trace("IRGenerator::expand_function_like_macro", Trace::TRANSLATION); if (mask_counter_) return; if (!macro_level_counter_) { current_macro_call_start_ = current_macro_call_end_ = macrocall.get_position(); Token::string_type tmp = macrocall.get_value(); current_macro_name_.assign(tmp.begin(), tmp.end()); if (arguments.size()) current_macro_call_end_.set_column(arguments.back().back().get_position().get_column() + // hack to take into account the following closing paren arguments.back().back().get_value().size() + 1); else // HACK: let's assume there is no space. See the newer // (non-depreciated) IRGenerator for a propere implementation. current_macro_call_end_.set_column(current_macro_call_start_.get_column() + current_macro_name_.size() + 2); } ++macro_level_counter_; } inline void IRGenerator::expanding_object_like_macro(Token const ¯o, Container const &definition, Token const ¯ocall) { Trace trace("IRGenerator::expand_object_like_macro", Trace::TRANSLATION); if (mask_counter_) return; if (!macro_level_counter_) { current_macro_call_start_ = current_macro_call_end_ = macrocall.get_position(); Token::string_type tmp = macrocall.get_value(); current_macro_name_.assign(tmp.begin(), tmp.end()); current_macro_call_end_.set_column(current_macro_call_start_.get_column() + current_macro_name_.size()); } ++macro_level_counter_; } inline void IRGenerator::expanded_macro(Container const &result) { Trace trace("IRGenerator::expand_macro", Trace::TRANSLATION); } inline void IRGenerator::rescanned_macro(Container const &result) { Trace trace("IRGenerator::rescanned_macro", Trace::TRANSLATION); if (!mask_counter_ && !--macro_level_counter_) { // All (potentially recursive) scanning is finished at this point, so we // can create the MacroCall object. Token::position_type start = current_macro_call_start_; if (start.get_line() != current_line_) { // This is the first macro expansion in this line. current_line_ = start.get_line(); current_offset_ = 0; } Token::string_type tmp = wave::util::impl::as_string(result); bpl::list calls = bpl::extract(file_stack_.top().attr("macro_calls")); calls.append(sf_module_.attr("MacroCall") (current_macro_name_, bpl::make_tuple(current_macro_call_start_.get_line(), current_macro_call_start_.get_column() - 1), bpl::make_tuple(current_macro_call_end_.get_line(), current_macro_call_end_.get_column() - 1), bpl::make_tuple(start.get_line(), start.get_column() - 1 + current_offset_), bpl::make_tuple(start.get_line(), start.get_column() - 1 + tmp.size() + current_offset_))); current_offset_ += start.get_column() + tmp.size() - 1 - current_macro_call_end_.get_column(); } } inline void IRGenerator::found_include_directive(std::string const &filename, bool next) { Trace trace("IRGenerator::found_include_directive", Trace::TRANSLATION); trace << filename; include_dir_ = filename; include_next_dir_ = next; } inline void IRGenerator::opened_include_file(std::string const &relname, std::string const &absname, std::size_t include_depth, bool is_system_include) { Trace trace("IRGenerator::opened_include_file", Trace::TRANSLATION); trace << absname; if (mask_counter_) { ++mask_counter_; return; } bpl::object source_file = lookup_source_file(relname, false); bpl::object include = sf_module_.attr("Include")(source_file, include_dir_, false, include_next_dir_); bpl::list includes = bpl::extract(file_stack_.top().attr("includes")); includes.append(include); file_stack_.push(source_file); std::string abs_filename = make_full_path(relname); // Only keep the first level of includes starting from the last unmasked file. if (primary_file_only_ || !matches_path(abs_filename, base_path_)) ++mask_counter_; else source_file.attr("annotations")["primary"] = true; } inline void IRGenerator::returning_from_include_file() { Trace trace("IRGenerator::returning_from_include_file", Trace::TRANSLATION); if (mask_counter_ < 2) file_stack_.pop(); // if the file was masked, decrement the counter if (mask_counter_) --mask_counter_; } inline void IRGenerator::defined_macro(Token const &name, bool is_functionlike, std::vector const ¶meters, Container const &definition, bool is_predefined) { Trace trace("IRGenerator::defined_macro", Trace::TRANSLATION); if (mask_counter_ || is_predefined) return; Token::string_type const &m = name.get_value(); std::string macro_name(m.begin(), m.end()); Token::position_type position = name.get_position(); std::string text; { Token::string_type tmp = wave::util::impl::as_string(definition); text = std::string(tmp.begin(), tmp.end()); } bpl::list params; for (std::vector::const_iterator i = parameters.begin(); i != parameters.end(); ++i) { Token::string_type const &tmp = i->get_value(); params.append(std::string(tmp.begin(), tmp.end())); } bpl::object qname = qname_module_.attr("QualifiedCxxName")(bpl::make_tuple(macro_name)); bpl::object macro = asg_module_.attr("Macro")(file_stack_.top(), position.get_line(), "macro", qname, params, text); bpl::object declared = asg_module_.attr("DeclaredTypeId")(language_, qname, macro); declarations_.append(macro); types_[qname] = declared; } inline void IRGenerator::undefined_macro(Token const &name) { Trace trace("IRGenerator::undefined_macro", Trace::TRANSLATION); trace << name; } inline bpl::object IRGenerator::lookup_source_file(std::string const &filename, bool primary) { Trace trace("IRGenerator::lookup_source_file", Trace::TRANSLATION); trace << filename << ' ' << primary; std::string long_name = make_full_path(filename); std::string short_name = make_short_path(filename, base_path_); bpl::object source_file = files_.get(short_name); if (!source_file) { source_file = sf_module_.attr("SourceFile")(short_name, long_name, language_, primary); files_[short_name] = source_file; } else if (primary) { bpl::dict annotations = bpl::extract(source_file.attr("annotations")); annotations["primary"] = true; } return source_file; } #endif synopsis-0.12/Synopsis/Parsers/Cpp/wave/configure0000775000076400007640000047403211171624004021526 0ustar stefanstefan#! /bin/sh # From configure.ac Revision: 1.10 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for Cpp 1.0. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='Cpp' PACKAGE_TARNAME='cpp' PACKAGE_VERSION='1.0' PACKAGE_STRING='Cpp 1.0' PACKAGE_BUGREPORT='synopsis-devel@fresco.org' ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP CXX CXXFLAGS ac_ct_CXX SYN_CPP SYN_LIBS PYTHON PYTHON_INCLUDE LIBEXT LDSHARED BOOST_VERSION BOOST_CPPFLAGS BOOST_LDFLAGS BOOST_LIBS LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP CXX CXXFLAGS CCC' # 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. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_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 ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_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'` 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 ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_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'` 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; }; } 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 directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $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 test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures Cpp 1.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/cpp] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of Cpp 1.0:";; esac cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-syn-cxx=PATH specify the Synopsis C++ library prefix --with-python=PATH specify the Python interpreter --with-boost-prefix=PREFIX specify boost installation prefix --with-boost-version=VERSION specify boost version --with-boost-lib-suffix=list use the given list of suffixes when searching for boost libraries. Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF Cpp configure 1.0 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by Cpp $as_me 1.0, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file 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 $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { 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 # Check whether --with-syn-cxx was given. if test "${with_syn_cxx+set}" = set; then withval=$with_syn_cxx; SYN_CXX="$with_syn_cxx" else SYN_CXX="/usr/local" 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { 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` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then 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 # Check that 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' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 that 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 { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { 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 ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { 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` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { 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 ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { 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 g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { 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 if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { 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 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 SYN_CPP="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --cflags synopsis-uninstalled`" SYN_LIBS="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --libs synopsis-uninstalled`" { echo "$as_me:$LINENO: checking for python extension module build information" >&5 echo $ECHO_N "checking for python extension module build information... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: " >&5 echo "${ECHO_T}" >&6; } # Check whether --with-python was given. if test "${with_python+set}" = set; then withval=$with_python; PYTHON="$with_python" else PYTHON="python" fi if test -n "$PYTHON" -a "$PYTHON" != yes; then # Extract the first word of "$PYTHON", so it can be a program name with args. set dummy $PYTHON; 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_PYTHON+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$PYTHON"; then ac_cv_prog_PYTHON="$PYTHON" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PYTHON="{ { echo "$as_me:$LINENO: error: Cannot find Python interpreter" >&5 echo "$as_me: error: Cannot find Python interpreter" >&2;} { (exit 1); exit 1; }; }" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PYTHON=$ac_cv_prog_PYTHON if test -n "$PYTHON"; then { echo "$as_me:$LINENO: result: $PYTHON" >&5 echo "${ECHO_T}$PYTHON" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi else # Extract the first word of "python2 python", so it can be a program name with args. set dummy python2 python; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_PYTHON+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $PYTHON in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_PYTHON" && ac_cv_path_PYTHON="python" ;; esac fi PYTHON=$ac_cv_path_PYTHON if test -n "$PYTHON"; then { echo "$as_me:$LINENO: result: $PYTHON" >&5 echo "${ECHO_T}$PYTHON" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi PYTHON_PREFIX=`$PYTHON -c "import sys; print(sys.prefix)" | tr -d "\r"` { echo "$as_me:$LINENO: checking for Python development environment" >&5 echo $ECHO_N "checking for Python development environment... $ECHO_C" >&6; } PYTHON_INCLUDE=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_inc())" | tr -d "\r"` PYTHON_H=`$PYTHON -c "from os.path import *; h = join('$PYTHON_INCLUDE', 'Python.h'); print(exists(h) and h or '')"` if test $PYTHON_H then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else { { echo "$as_me:$LINENO: error: Python.h not found." >&5 echo "$as_me: error: Python.h not found." >&2;} { (exit 1); exit 1; }; } fi LIBEXT=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_var('SO'))" | tr -d "\r"` case `uname -s` in CYGWIN*) if test `$PYTHON -c "import os; print(os.name)" | tr -d "\r"` = posix; then PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d'%(sys.version_info[0],sys.version_info[1]))"` PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" PYTHON_DEP_LIBS=`$PYTHON -c "from distutils import sysconfig; import re; print(re.sub(r'\\s*-lutil', '', sysconfig.get_config_var('LIBS') or ''))"` else if test "$CXX" = "g++"; then CPPFLAGS="$CPPFLAGS -D PARSE_MSVC" CFLAGS="-mno-cygwin $CFLAGS" CXXFLAGS="-mno-cygwin $CXXFLAGS" LDFLAGS="-mno-cygwin $LDFLAGS" PYTHON_VERSION=`$PYTHON -c "import sys; print('%d%d'%(sys.version_info[0],sys.version_info[1]))" | tr -d "\r"` PYTHON_LIBS="-L`cygpath -a $PYTHON_PREFIX | tr -d \"\r\"`/Libs -lpython$PYTHON_VERSION" fi PYTHON_INCLUDE=`cygpath -a $PYTHON_INCLUDE | tr -d "\r"` PYTHON_DEP_LIBS=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_var('LIBS') or '')" | tr -d "\r"` fi LDSHARED="$CXX -shared" CXXFLAGS="-D_REENTRANT $CXXFLAGS" LIBS="$LIBS $PYTHON_LIBS $PYTHON_DEP_LIBS" ;; Darwin) PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d'%(sys.version_info[0],sys.version_info[1]))"` PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" CFLAGS="$CFLAGS -fPIC" CXXFLAGS="$CXXFLAGS -fPIC" LDSHARED="$CXX -dynamiclib -Wl,-undefined,dynamic_lookup" ;; *) PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d'%(sys.version_info[0],sys.version_info[1]))"` PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" CFLAGS="$CFLAGS -fPIC" CXXFLAGS="$CXXFLAGS -fPIC" LDSHARED="$CXX -shared" ;; esac CPPFLAGS="$CPPFLAGS -I $PYTHON_INCLUDE" ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # Check whether --with-boost_prefix was given. if test "${with_boost_prefix+set}" = set; then withval=$with_boost_prefix; fi # Check whether --with-boost_version was given. if test "${with_boost_version+set}" = set; then withval=$with_boost_version; boost_version="$withval" else boost_version=1.35 fi boost_version_req=$boost_version boost_version_req_shorten=`expr $boost_version_req : '\([0-9]*\.[0-9]*\)'` boost_version_req_major=`expr $boost_version_req : '\([0-9]*\)'` boost_version_req_minor=`expr $boost_version_req : '[0-9]*\.\([0-9]*\)'` boost_version_req_sub_minor=`expr $boost_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'` if test "x$boost_version_req_sub_minor" = "x" ; then boost_version_req_sub_minor="0" fi REQ_BOOST_VERSION=`expr $boost_version_req_major \* 100000 \+ $boost_version_req_minor \* 100 \+ $boost_version_req_sub_minor` { echo "$as_me:$LINENO: checking for boost >= $boost_version_req" >&5 echo $ECHO_N "checking for boost >= $boost_version_req... $ECHO_C" >&6; } succeeded=no if test "$with_boost_prefix" != ""; then BOOST_LDFLAGS="-L$with_boost_prefix/lib" BOOST_CPPFLAGS="-I$with_boost_prefix/include" else for prefix in /usr /usr/local /opt ; do if test -d "$prefix/include/boost" && test -r "$prefix/include/boost"; then BOOST_LDFLAGS="-L$prefix/lib" BOOST_CPPFLAGS="-I$prefix/include" break; fi done fi CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if BOOST_VERSION >= $REQ_BOOST_VERSION std::ofstream ofs("conftest.out"); ofs << BOOST_VERSION / 100000 << '.' << BOOST_VERSION / 100 % 1000; #else # error Boost version is too old #endif ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then BOOST_VERSION=`cat conftest.out` { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } succeeded=yes found_system=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test "x$succeeded" != "xyes"; then _version=0 if test "$with_boost_prefix" != ""; then BOOST_LDFLAGS="-L$with_boost_prefix/lib" if test -d "$with_boost_prefix" && test -r "$with_boost_prefix"; then for i in `ls -d $with_boost_prefix/include/boost-* 2>/dev/null`; do _version_tmp=`echo $i | sed "s#$with_boost_prefix##" | sed 's/\/include\/boost-//' | sed 's/_/./'` V_CHECK=`expr $_version_tmp \> $_version` if test "$V_CHECK" = "1" ; then _version=$_version_tmp fi VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` BOOST_CPPFLAGS="-I$with_boost_prefix/include/boost-$VERSION_UNDERSCORE" done fi else for prefix in /usr /usr/local /opt ; do if test -d "$prefix" && test -r "$prefix"; then for i in `ls -d $prefix/include/boost-* 2>/dev/null`; do _version_tmp=`echo $i | sed "s#$prefix##" | sed 's/\/include\/boost-//' | sed 's/_/./'` V_CHECK=`expr $_version_tmp \> $_version` if test "$V_CHECK" = "1" ; then _version=$_version_tmp best_path=$prefix fi done fi done VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE" BOOST_LDFLAGS="-L$best_path/lib" if test "x$BOOST_ROOT" != "x"; then if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'` stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'` stage_version_shorten=`expr $stage_version : '\([0-9]*\.[0-9]*\)'` V_CHECK=`expr $stage_version_shorten \>\= $_version` if test "$V_CHECK" = "1" ; then { echo "$as_me:$LINENO: We will use a staged boost library from $BOOST_ROOT" >&5 echo "$as_me: We will use a staged boost library from $BOOST_ROOT" >&6;} BOOST_CPPFLAGS="-I$BOOST_ROOT" BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib" fi fi fi fi CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #if BOOST_VERSION >= $REQ_BOOST_VERSION // Everything is okay #else # error Boost version is too old #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } succeeded=yes found_system=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu BOOST_VERSION="$_version" fi if test "$succeeded" != "yes" ; then if test "$_version" = "0" ; then { { echo "$as_me:$LINENO: error: We could not detect the boost libraries (version $boost_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in . See http://randspringer.de/boost for more documentation." >&5 echo "$as_me: error: We could not detect the boost libraries (version $boost_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in . See http://randspringer.de/boost for more documentation." >&2;} { (exit 1); exit 1; }; } else { { echo "$as_me:$LINENO: error: boost $_version too old; version $boost_version_req or newer required." >&5 echo "$as_me: error: boost $_version too old; version $boost_version_req or newer required." >&2;} { (exit 1); exit 1; }; } fi else cat >>confdefs.h <<\_ACEOF #define HAVE_BOOST _ACEOF fi CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" # Check whether --with-boost-lib-suffix was given. if test "${with_boost_lib_suffix+set}" = set; then withval=$with_boost_lib_suffix; BOOST_LIB_SUFFIX="$withval" else BOOST_LIB_SUFFIX="none -gcc -mipspro -mt -sunpro -sw -mgw -gcc-mt -gcc-mt-s" fi found=no LIBS_SAVED="$LIBS" CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" for s in $BOOST_LIB_SUFFIX do if test "x$s" = xnone; then s='' fi if test "x${BOOST_LIBDIR}" != x; then lib="${BOOST_LIBDIR}/libboost_system${s}.a" else lib="-lboost_system$s" fi LIBS="$lib $BOOST_LIBS $LIBS_SAVED" cv=`echo "ac_cv_boost_lib_system${s}_${BOOST_LIBDIR}" | $as_tr_sh` { echo "$as_me:$LINENO: checking for the boost_system$s library" >&5 echo $ECHO_N "checking for the boost_system$s library... $ECHO_C" >&6; } if { as_var=$cv; eval "test \"\${$as_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. */ #include using namespace boost::system; int main () { error_code c; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval $cv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval $cv=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$cv'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if eval "test \"\${$cv}\" = yes"; then found=yes break fi done CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" LIBS="$LIBS_SAVED" if test $found = yes; then BOOST_LIB_SUFFIX=${s:-none} BOOST_LIBS="$lib $BOOST_LIBS" fi found=no LIBS_SAVED="$LIBS" CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" for s in $BOOST_LIB_SUFFIX do if test "x$s" = xnone; then s='' fi if test "x${BOOST_LIBDIR}" != x; then lib="${BOOST_LIBDIR}/libboost_filesystem${s}.a" else lib="-lboost_filesystem$s" fi LIBS="$lib $BOOST_LIBS $LIBS_SAVED" cv=`echo "ac_cv_boost_lib_filesystem${s}_${BOOST_LIBDIR}" | $as_tr_sh` { echo "$as_me:$LINENO: checking for the boost_filesystem$s library" >&5 echo $ECHO_N "checking for the boost_filesystem$s library... $ECHO_C" >&6; } if { as_var=$cv; eval "test \"\${$as_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. */ #include #include using namespace boost::filesystem; int main () { exists(path("/boot")); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval $cv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval $cv=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$cv'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if eval "test \"\${$cv}\" = yes"; then found=yes break fi done CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" LIBS="$LIBS_SAVED" if test $found = yes; then BOOST_LIB_SUFFIX=${s:-none} BOOST_LIBS="$lib $BOOST_LIBS" else { { echo "$as_me:$LINENO: error: the boost_filesystem library is required See \`config.log' for more details." >&5 echo "$as_me: error: the boost_filesystem library is required See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi found=no LIBS_SAVED="$LIBS" CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" for s in $BOOST_LIB_SUFFIX do if test "x$s" = xnone; then s='' fi if test "x${BOOST_LIBDIR}" != x; then lib="${BOOST_LIBDIR}/libboost_thread${s}.a" else lib="-lboost_thread$s" fi LIBS="$lib $BOOST_LIBS $LIBS_SAVED" cv=`echo "ac_cv_boost_lib_thread${s}_${BOOST_LIBDIR}" | $as_tr_sh` { echo "$as_me:$LINENO: checking for the boost_thread$s library" >&5 echo $ECHO_N "checking for the boost_thread$s library... $ECHO_C" >&6; } if { as_var=$cv; eval "test \"\${$as_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. */ #include using namespace boost; int main () { thread t; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval $cv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval $cv=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$cv'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if eval "test \"\${$cv}\" = yes"; then found=yes break fi done CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" LIBS="$LIBS_SAVED" if test $found = yes; then BOOST_LIB_SUFFIX=${s:-none} BOOST_LIBS="$lib $BOOST_LIBS" fi found=no LIBS_SAVED="$LIBS" CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" for s in $BOOST_LIB_SUFFIX do if test "x$s" = xnone; then s='' fi if test "x${BOOST_LIBDIR}" != x; then lib="${BOOST_LIBDIR}/libboost_wave${s}.a" else lib="-lboost_wave$s" fi LIBS="$lib $BOOST_LIBS $LIBS_SAVED" cv=`echo "ac_cv_boost_lib_wave${s}_${BOOST_LIBDIR}" | $as_tr_sh` { echo "$as_me:$LINENO: checking for the boost_wave$s library" >&5 echo $ECHO_N "checking for the boost_wave$s library... $ECHO_C" >&6; } if { as_var=$cv; eval "test \"\${$as_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. */ #include #include #include using namespace boost::wave; typedef cpplexer::lex_token<> Token; typedef cpplexer::lex_iterator lex_iterator_type; int main () { return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval $cv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval $cv=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$cv'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if eval "test \"\${$cv}\" = yes"; then found=yes break fi done CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" LIBS="$LIBS_SAVED" if test $found = yes; then BOOST_LIB_SUFFIX=${s:-none} BOOST_LIBS="$lib $BOOST_LIBS" else { { echo "$as_me:$LINENO: error: the boost_wave library is required See \`config.log' for more details." >&5 echo "$as_me: error: the boost_wave library is required See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi save_LIBS=$LIBS LIBS="$LIBS $PYTHON_LIBS" found=no LIBS_SAVED="$LIBS" CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" for s in $BOOST_LIB_SUFFIX do if test "x$s" = xnone; then s='' fi if test "x${BOOST_LIBDIR}" != x; then lib="${BOOST_LIBDIR}/libboost_python${s}.a" else lib="-lboost_python$s" fi LIBS="$lib $BOOST_LIBS $LIBS_SAVED" cv=`echo "ac_cv_boost_lib_python${s}_${BOOST_LIBDIR}" | $as_tr_sh` { echo "$as_me:$LINENO: checking for the boost_python$s library" >&5 echo $ECHO_N "checking for the boost_python$s library... $ECHO_C" >&6; } if { as_var=$cv; eval "test \"\${$as_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. */ #include using namespace boost::python; int main () { object("dummy"); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval $cv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval $cv=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$cv'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if eval "test \"\${$cv}\" = yes"; then found=yes break fi done CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" LIBS="$LIBS_SAVED" if test $found = yes; then BOOST_LIB_SUFFIX=${s:-none} BOOST_LIBS="$lib $BOOST_LIBS" else { { echo "$as_me:$LINENO: error: the boost_python library is required See \`config.log' for more details." >&5 echo "$as_me: error: the boost_python library is required See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi LIBS=$save_LIBS ac_config_files="$ac_config_files 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, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${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 more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by Cpp $as_me 1.0, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" _ACEOF 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 and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ Cpp config.status 1.0 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' _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 ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) { { 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 fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for 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 _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim CPP!$CPP$ac_delim CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim ac_ct_CXX!$ac_ct_CXX$ac_delim SYN_CPP!$SYN_CPP$ac_delim SYN_LIBS!$SYN_LIBS$ac_delim PYTHON!$PYTHON$ac_delim PYTHON_INCLUDE!$PYTHON_INCLUDE$ac_delim LIBEXT!$LIBEXT$ac_delim LDSHARED!$LDSHARED$ac_delim BOOST_VERSION!$BOOST_VERSION$ac_delim BOOST_CPPFLAGS!$BOOST_CPPFLAGS$ac_delim BOOST_LDFLAGS!$BOOST_LDFLAGS$ac_delim BOOST_LIBS!$BOOST_LIBS$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 60; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF 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&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; esac done # for ac_tag { (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 synopsis-0.12/Synopsis/Parsers/Cpp/wave/ParserImpl.cc0000664000076400007640000001706211104703263022201 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include #include #if BOOST_VERSION < 103500 || BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0 # include "IRGenerator-depreciated.hh" #else # include "IRGenerator.hh" #endif #include #include using namespace Synopsis; namespace wave = boost::wave; namespace bpl = boost::python; namespace { #ifdef __WIN32__ std::string const trash = "NUL"; #else std::string const trash = "/dev/null"; #endif bpl::object error_type; //. Override unexpected() to print a message before we abort void unexpected() { std::cout << "Error: Aborting due to unexpected exception." << std::endl; throw std::bad_exception(); } bpl::object parse(bpl::object ir, char const *input_file, char const *base_path, char const *output_file, char const *language, bpl::list py_system_flags, bpl::list py_user_flags, bool primary_file_only, bool verbose, bool debug, bool profile) { std::vector system_flags(bpl::len(py_system_flags)); for (unsigned int i = 0; i != bpl::len(py_system_flags); ++i) system_flags[i] = bpl::extract(py_system_flags[i]); std::vector user_flags(bpl::len(py_user_flags)); for (unsigned int i = 0; i != bpl::len(py_user_flags); ++i) user_flags[i] = bpl::extract(py_user_flags[i]); std::set_unexpected(unexpected); ErrorHandler error_handler(); if (debug) Synopsis::Trace::enable(Trace::ALL); if (!input_file || *input_file == '\0') throw std::runtime_error("no input file"); std::ifstream ifs(input_file); if (!ifs) { std::string msg = "unable to read '"; msg += input_file; msg += '\''; throw std::runtime_error(msg); } std::ofstream ofs(output_file ? output_file : trash.c_str()); std::string input(std::istreambuf_iterator(ifs.rdbuf()), std::istreambuf_iterator()); Timer timer; IRGenerator generator(language, input_file, base_path, primary_file_only, ir, verbose, debug); IRGenerator::Context ctx(input.begin(), input.end(), input_file, generator); if (std::string(language) == "C") { ctx.set_language(wave::language_support(wave::support_c99| wave::support_option_convert_trigraphs| wave::support_option_emit_line_directives| wave::support_option_insert_whitespace)); // Remove the '__STDC_HOSTED__' macro as wave predefines it. system_flags.erase(std::remove(system_flags.begin(), system_flags.end(), std::string("-D__STDC_HOSTED__=1")), system_flags.end()); // Remove the '__STDC__' macro as wave predefines it. system_flags.erase(std::remove(system_flags.begin(), system_flags.end(), std::string("-D__STDC__=1")), system_flags.end()); } else if (std::string(language) == "C++") { ctx.set_language(wave::enable_variadics(ctx.get_language())); // FIXME: should only enable in GCC compat mode. ctx.set_language(wave::enable_long_long(ctx.get_language())); // Remove the '__cplusplus' macro as wave predefines it. system_flags.erase(std::remove(system_flags.begin(), system_flags.end(), std::string("-D__cplusplus=1")), system_flags.end()); } else if (std::string(language) == "IDL") { ctx.set_language(wave::language_support(wave::support_c99| wave::support_option_convert_trigraphs| wave::support_option_emit_line_directives| wave::support_option_insert_whitespace)); } ctx.set_language(wave::enable_preserve_comments(ctx.get_language())); if (verbose) { std::cout << "system flags :" << std::endl; for (std::vector::iterator i = system_flags.begin(); i != system_flags.end(); ++i) std::cout << *i << ' '; std::cout << "\nuser flags :" << std::endl; for (std::vector::iterator i = user_flags.begin(); i != user_flags.end(); ++i) std::cout << *i << ' '; std::cout << std::endl; } std::vector includes; // Insert the user_flags for (std::vector::iterator i = user_flags.begin(); i != user_flags.end(); ++i) { if (**i == '-') { if (*(*i + 1) == 'I') ctx.add_sysinclude_path(*i + 2); else if (*(*i + 1) == 'D') ctx.add_macro_definition(*i + 2, /*is_predefined=*/false); else if (*(*i + 1) == 'U') ctx.remove_macro_definition(*i + 2, /*even_predefined=*/false); else if (*(*i + 1) == 'i') includes.push_back(*i + 2); } } // Insert the system_flags from the Emulator. for (std::vector::iterator i = system_flags.begin(); i != system_flags.end(); ++i) { if (**i == '-') { if (*(*i + 1) == 'I') ctx.add_sysinclude_path(*i + 2); else if (*(*i + 1) == 'D') ctx.add_macro_definition(*i + 2, /*is_predefined=*/true); else if (*(*i + 1) == 'U') ctx.remove_macro_definition(*i + 2, /*even_predefined=*/false); else if (*(*i + 1) == 'i') includes.push_back(*i + 2); } } IRGenerator::Context::iterator_type first = ctx.begin(); IRGenerator::Context::iterator_type end = ctx.end(); for (std::vector::const_reverse_iterator i = includes.rbegin(), e = includes.rend(); i != e; /**/) { std::string filename(*i); first.force_include(filename.c_str(), ++i == e); } while (first != end) { ofs << (*first).get_value(); ++first; } if (profile) std::cout << "preprocessor took " << timer.elapsed() << " seconds" << std::endl; return ir; } void cpp_error(wave::cpp_exception const &e) { std::ostringstream oss; oss << e.file_name() << ':' << e.line_no() << " : " << e.description(); std::string what = oss.str(); bpl::object error(error_type(what.c_str())); // error.attr("file_name") = e.file_name(); // error.attr("line_no") = e.line_no(); // error.attr("description") = e.description(); PyErr_SetObject(error_type.ptr(), error.ptr()); } void lexer_error(wave::cpplexer::lexing_exception const &e) { std::ostringstream oss; oss << e.file_name() << ':' << e.line_no() << " : " << e.description(); std::string what = oss.str(); bpl::object error(error_type(what.c_str())); // error.attr("file_name") = e.file_name(); // error.attr("line_no") = e.line_no(); // error.attr("description") = e.description(); PyErr_SetObject(error_type.ptr(), error.ptr()); } } BOOST_PYTHON_MODULE(ParserImpl) { bpl::register_exception_translator(cpp_error); bpl::register_exception_translator(lexer_error); bpl::scope scope; scope.attr("version") = "0.2"; bpl::def("parse", parse); bpl::object processor = bpl::import("Synopsis.Processor"); bpl::object error_base = processor.attr("Error"); error_type = bpl::object(bpl::handle<>(PyErr_NewException("ParserImpl.CppError", error_base.ptr(), 0))); scope.attr("CppError") = error_type; } synopsis-0.12/Synopsis/Parsers/Cpp/wave/IRGenerator.hh0000664000076400007640000003320511104703263022313 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef IRGenerator_hh_ #define IRGenerator_hh_ #include #include #include #include #include #include #include #include #include using namespace Synopsis; namespace wave = boost::wave; namespace bpl = boost::python; class IRGenerator : public wave::context_policies::default_preprocessing_hooks { typedef wave::context_policies::default_preprocessing_hooks base; public: typedef wave::cpplexer::lex_token<> Token; typedef wave::context, wave::iteration_context_policies::load_file_to_string, IRGenerator> Context; // FIXME: We can't use the following two typedefs since this triggers a compile-timer // error due to the circular dependency between Context and IRGenerator (which GCC // considers to be an 'incomplete type' until some later time during the parse). // typedef Context::lexer_type Iterator; // typedef Context::token_sequence_type Container; typedef std::list > Container; IRGenerator(std::string const &language, std::string const &filename, std::string const &base_path, bool primary_file_only, bpl::object ir, bool v, bool d) : language_(language), qname_module_(bpl::import("Synopsis.QualifiedName")), asg_module_(bpl::import("Synopsis.ASG")), sf_module_(bpl::import("Synopsis.SourceFile")), files_(bpl::extract(ir.attr("files"))()), raw_filename_(filename), base_path_(base_path), primary_file_only_(primary_file_only), mask_counter_(0), macro_level_counter_(0), current_line_(1), current_offset_(0), verbose_(v), debug_(d) { Trace trace("IRGenerator::IRGenerator", Trace::TRANSLATION); file_stack_.push(lookup_source_file(raw_filename_, true)); bpl::object asg = ir.attr("asg"); declarations_ = bpl::extract(asg.attr("declarations"))(); types_ = bpl::extract(asg.attr("types"))(); } // bool may_skip_whitespace (Token &, bool &) { return false;} template bool expanding_function_like_macro(Context const &ctx, Token const ¯odef, std::vector const &formal_args, Container const &definition, Token const ¯ocall, std::vector const &arguments, IteratorT const &seqstart, IteratorT const &seqend); bool expanding_object_like_macro(Context const& ctx, Token const ¯odef, Container const &definition, Token const ¯ocall); void expanded_macro(Context const &ctx, Container const &result); void rescanned_macro(Context const &ctx, Container const &result); bool found_include_directive(Context const &ctx, std::string const &filename, bool include_next); void opened_include_file(Context const &ctx, std::string const &relname, std::string const &absname, bool is_system_include); void returning_from_include_file(Context const &ctx); template void throw_exception(Context const &c, ExceptionT const &e); // interpretation of #pragma's of the form // 'wave option[(value)]' bool interpret_pragma(Context const &ctx, Container &pending, Token const &option, Container const &values, Token const &token); void defined_macro(Context const &ctx, Token const &name, bool is_functionlike, std::vector const ¶meters, Container const &definition, bool is_predefined); void undefined_macro(Context const &ctx, Token const &name); private: typedef std::stack FileStack; //. Look up the given filename in the ast, creating it if necessary. //. Mark the file as 'primary' if so required. bpl::object lookup_source_file(std::string const &filename, bool primary); std::string language_; bpl::object qname_module_; bpl::object asg_module_; bpl::object sf_module_; bpl::list declarations_; bpl::dict types_; bpl::dict files_; bpl::object file_; std::string raw_filename_; std::string base_path_; FileStack file_stack_; std::string include_dir_; bool include_next_dir_; bool primary_file_only_; unsigned int mask_counter_; unsigned int macro_level_counter_; //. The name of the macro currently being expanded. std::string current_macro_name_; Token::position_type current_macro_call_start_; Token::position_type current_macro_call_end_; unsigned int current_line_; //. Offset induced by macro expansion. int current_offset_; bool verbose_; bool debug_; }; template inline bool IRGenerator::expanding_function_like_macro(Context const &ctx, Token const ¯odef, std::vector const &formal_args, Container const &definition, Token const ¯ocall, std::vector const &arguments, IteratorT const &seqstart, IteratorT const &seqend) { Trace trace("IRGenerator::expand_function_like_macro", Trace::TRANSLATION); if (mask_counter_) return false; if (!macro_level_counter_) { current_macro_call_start_ = macrocall.get_position(); current_macro_call_end_ = seqend->get_position(); Token::string_type tmp = macrocall.get_value(); current_macro_name_.assign(tmp.begin(), tmp.end()); } ++macro_level_counter_; return false; } inline bool IRGenerator::expanding_object_like_macro(Context const& ctx, Token const ¯odef, Container const &definition, Token const ¯ocall) { Trace trace("IRGenerator::expand_object_like_macro", Trace::TRANSLATION); if (mask_counter_) return false; if (!macro_level_counter_) { current_macro_call_start_ = current_macro_call_end_ = macrocall.get_position(); Token::string_type tmp = macrocall.get_value(); current_macro_name_.assign(tmp.begin(), tmp.end()); current_macro_call_end_.set_column(current_macro_call_start_.get_column() + current_macro_name_.size()); } ++macro_level_counter_; return false; } inline void IRGenerator::expanded_macro(Context const &ctx, Container const &result) { Trace trace("IRGenerator::expand_macro", Trace::TRANSLATION); } inline void IRGenerator::rescanned_macro(Context const &ctx, Container const &result) { Trace trace("IRGenerator::rescanned_macro", Trace::TRANSLATION); if (!mask_counter_ && !--macro_level_counter_) { // All (potentially recursive) scanning is finished at this point, so we // can create the MacroCall object. Token::position_type start = current_macro_call_start_; if (start.get_line() != current_line_) { // This is the first macro expansion in this line. current_line_ = start.get_line(); current_offset_ = 0; } Token::string_type tmp = wave::util::impl::as_string(result); bpl::list calls = bpl::extract(file_stack_.top().attr("macro_calls")); calls.append(sf_module_.attr("MacroCall") (current_macro_name_, bpl::make_tuple(current_macro_call_start_.get_line(), current_macro_call_start_.get_column() - 1), bpl::make_tuple(current_macro_call_end_.get_line(), current_macro_call_end_.get_column() - 1), bpl::make_tuple(start.get_line(), start.get_column() - 1 + current_offset_), bpl::make_tuple(start.get_line(), start.get_column() - 1 + tmp.size() + current_offset_))); current_offset_ += start.get_column() + tmp.size() - 1 - current_macro_call_end_.get_column(); } } inline bool IRGenerator::found_include_directive(Context const &ctx, std::string const &filename, bool next) { Trace trace("IRGenerator::found_include_directive", Trace::TRANSLATION); trace << filename; include_dir_ = filename; include_next_dir_ = next; return false; } inline void IRGenerator::opened_include_file(Context const &ctx, std::string const &relname, std::string const &absname, bool is_system_include) { Trace trace("IRGenerator::opened_include_file", Trace::TRANSLATION); trace << absname; if (mask_counter_) { ++mask_counter_; return; } bpl::object source_file = lookup_source_file(relname, false); bpl::object include = sf_module_.attr("Include")(source_file, include_dir_, false, include_next_dir_); bpl::list includes = bpl::extract(file_stack_.top().attr("includes")); includes.append(include); file_stack_.push(source_file); std::string abs_filename = make_full_path(relname); // Only keep the first level of includes starting from the last unmasked file. if (primary_file_only_ || !matches_path(abs_filename, base_path_)) ++mask_counter_; else source_file.attr("annotations")["primary"] = true; } inline void IRGenerator::returning_from_include_file(Context const &ctx) { Trace trace("IRGenerator::returning_from_include_file", Trace::TRANSLATION); if (mask_counter_ < 2) file_stack_.pop(); // if the file was masked, decrement the counter if (mask_counter_) --mask_counter_; } template inline void IRGenerator::throw_exception(Context const &c, ExceptionT const &e) { // Only throw in case of error. if (e.get_severity() != wave::util::severity_warning) base::throw_exception(c, e); } inline bool IRGenerator::interpret_pragma(Context const &ctx, Container &pending, Token const &option, Container const &values, Token const &pragma_token) { return false;} inline void IRGenerator::defined_macro(Context const &ctx, Token const &name, bool is_functionlike, std::vector const ¶meters, Container const &definition, bool is_predefined) { Trace trace("IRGenerator::defined_macro", Trace::TRANSLATION); if (mask_counter_ || is_predefined) return; Token::string_type const &m = name.get_value(); std::string macro_name(m.begin(), m.end()); Token::position_type position = name.get_position(); std::string text; { Token::string_type tmp = wave::util::impl::as_string(definition); text = std::string(tmp.begin(), tmp.end()); } bpl::list params; for (std::vector::const_iterator i = parameters.begin(); i != parameters.end(); ++i) { Token::string_type const &tmp = i->get_value(); params.append(std::string(tmp.begin(), tmp.end())); } bpl::object qname = qname_module_.attr("QualifiedCxxName")(bpl::make_tuple(macro_name)); bpl::object macro = asg_module_.attr("Macro")(file_stack_.top(), position.get_line(), "macro", qname, params, text); bpl::object declared = asg_module_.attr("DeclaredTypeId")(language_, qname, macro); declarations_.append(macro); types_[qname] = declared; } inline void IRGenerator::undefined_macro(Context const &ctx, Token const &name) { Trace trace("IRGenerator::undefined_macro", Trace::TRANSLATION); trace << name; } inline bpl::object IRGenerator::lookup_source_file(std::string const &filename, bool primary) { Trace trace("IRGenerator::lookup_source_file", Trace::TRANSLATION); trace << filename << ' ' << primary; std::string long_name = make_full_path(filename); std::string short_name = make_short_path(filename, base_path_); bpl::object source_file = files_.get(short_name); if (!source_file) { source_file = sf_module_.attr("SourceFile")(short_name, long_name, language_, primary); files_[short_name] = source_file; } else if (primary) { bpl::dict annotations = bpl::extract(source_file.attr("annotations")); annotations["primary"] = true; } return source_file; } #endif synopsis-0.12/Synopsis/Parsers/Cpp/wave/Makefile.in0000664000076400007640000000232011104703263021650 0ustar stefanstefan# # Copyright (C) 2004 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # SHELL := /bin/sh srcdir := @srcdir@ PYTHON := @PYTHON@ CC := @CC@ CXX := @CXX@ LDSHARED:= @LDSHARED@ MAKEDEP := $(CXX) -M CPPFLAGS:= @CPPFLAGS@ @BOOST_CPPFLAGS@ -I . CPPFLAGS+= -I $(srcdir) CPPFLAGS+= @SYN_CPP@ CFLAGS := @CFLAGS@ CXXFLAGS:= @CXXFLAGS@ LDFLAGS := @LDFLAGS@ @BOOST_LDFLAGS@ LIBS := @BOOST_LIBS@ @SYN_LIBS@ @LIBS@ LIBRARY_EXT := @LIBEXT@ SRC := ParserImpl.cc OBJ := $(patsubst %.cc, %.o, $(SRC)) DEP := $(patsubst %.cc, %.d, $(SRC)) TARGET := ParserImpl$(LIBRARY_EXT) vpath %.hh $(srcdir) vpath %.cc $(srcdir) all: $(TARGET) %.d: %.cc @echo generating dependencies for $( $@' %.o : %.cc @echo compiling $(@F) $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< Makefile: $(srcdir)/Makefile.in $(SHELL) -ec './config.status --file Makefile' $(TARGET): $(OBJ) @echo linking $(@F) $(LDSHARED) $(LDFLAGS) -o $@ $^ $(LIBS) clean : rm -rf *~ $(OBJ) $(DEP) $(TARGET) *.pyc *.pyo ifeq (,$(filter $(MAKECMDGOALS), depend clean distclean)) -include $(DEP) endif synopsis-0.12/Synopsis/Parsers/Cpp/wave/configure.ac0000664000076400007640000000175411122312025022073 0ustar stefanstefandnl dnl Copyright (C) 2004 Stefan Seefeld dnl All rights reserved. dnl Licensed to the public under the terms of the GNU LGPL (>= 2), dnl see the file COPYING for details. dnl dnl ------------------------------------------------------------------ dnl Autoconf initialization dnl ------------------------------------------------------------------ AC_PREREQ(2.56) AC_REVISION($Revision: 1.10 $) AC_INIT(Cpp, 1.0, synopsis-devel@fresco.org) AC_ARG_WITH(syn-cxx, [ --with-syn-cxx=PATH specify the Synopsis C++ library prefix], SYN_CXX="$with_syn_cxx", SYN_CXX="/usr/local" ) AC_PROG_CPP AC_PROG_CC AC_PROG_CXX SYN_CPP="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --cflags synopsis-uninstalled`" SYN_LIBS="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --libs synopsis-uninstalled`" AC_SUBST(SYN_CPP) AC_SUBST(SYN_LIBS) AC_PYTHON_EXT CPPFLAGS="$CPPFLAGS -I $PYTHON_INCLUDE" AC_LANG(C++) AC_BOOST([1.35]) SYN_BOOST_LIB_FILESYSTEM SYN_BOOST_LIB_WAVE SYN_BOOST_LIB_PYTHON AC_CONFIG_FILES([Makefile]) AC_OUTPUT synopsis-0.12/Synopsis/Parsers/Cpp/wave/aclocal.m40000664000076400007640000000126011171624003021443 0ustar stefanstefan# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_include([../../../../config/boost.m4]) m4_include([../../../../config/python_ext.m4]) synopsis-0.12/Synopsis/Parsers/Cpp/Emulator.py0000664000076400007640000003436311172115133021015 0ustar stefanstefan# # Copyright (C) 2005 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # __docformat__ = 'reStructuredText' import sys, os, os.path, re, string, stat, tempfile from Synopsis.config import version class TempFile: # Use tempfile.NamedTemporaryFile once we can rely on Python 2.4 def __init__(self, suffix): self.name = tempfile.mktemp(suffix) self.file = open(self.name, 'w') self.file.close() def __del__(self): os.unlink(self.name) def find_ms_compiler_info(): """ Try to find a (C++) MSVC compiler. Return tuple of include path list and macro dictionary.""" vc6 = ('SOFTWARE\\Microsoft\\DevStudio\\6.0\\Products\\Microsoft Visual C++', 'ProductDir') vc7 = ('SOFTWARE\\Microsoft\\VisualStudio\\7.0', 'InstallDir') vc71 = ('SOFTWARE\\Microsoft\\VisualStudio\\7.1', 'InstallDir') vc8 = ('SOFTWARE\\Microsoft\\VisualStudio\\8.0', 'InstallDir') vc9e = ('SOFTWARE\\Microsoft\\VCExpress\\9.0\\Setup\\VC', 'ProductDir') vc6_macros = [('__uuidof(x)', 'IID()'), ('__int64', 'long long'), ('_MSC_VER', '1200'), ('_MSC_EXTENSIONS', ''), ('_WIN32', ''), ('_M_IX86', ''), ('_WCHAR_T_DEFINED', ''), ('_INTEGRAL_MAX_BITS', '64'), ('PASCAL', ''), ('RPC_ENTRY', ''), ('SHSTDAPI', 'HRESULT'), ('SHSTDAPI_(x)', 'x')] vc6_paths = ['Include'] vc7_macros = [('__forceinline', '__inline'), ('__uuidof(x)', 'IID()'), ('__w64', ''), ('__int64', 'long long'), ('_MSC_VER', '1300'), ('_MSC_EXTENSIONS', ''), ('_WIN32', ''), ('_M_IX86', ''), ('_WCHAR_T_DEFINED', ''), ('_INTEGRAL_MAX_BITS', '64'), ('PASCAL', ''), ('RPC_ENTRY', ''), ('SHSTDAPI', 'HRESULT'), ('SHSTDAPI_(x)', 'x')] vc7_paths = ['..\\..\\Vc7\\Include', '..\\..\\Vc7\\PlatformSDK\\Include'] vc71_macros = [('__forceinline', '__inline'), ('__uuidof(x)', 'IID()'), ('__w64', ''), ('__int64', 'long long'), ('_MSC_VER', '1310'), ('_MSC_EXTENSIONS', ''), ('_WIN32', ''), ('_M_IX86', ''), ('_WCHAR_T_DEFINED', ''), ('_INTEGRAL_MAX_BITS', '64'), ('PASCAL', ''), ('RPC_ENTRY', ''), ('SHSTDAPI', 'HRESULT'), ('SHSTDAPI_(x)', 'x')] vc71_paths = ['..\\..\\Vc7\\Include', '..\\..\\Vc7\\PlatformSDK\\Include'] vc8_macros = [('__cplusplus', '1'), ('__forceinline', '__inline'), ('__uuidof(x)', 'IID()'), ('__w64', ''), ('__int8', 'char'), ('__int16', 'short'), ('__int32', 'int'), ('__int64', 'long long'), ('__ptr64', ''), ('_MSC_VER', '1400'), ('_MSC_EXTENSIONS', ''), ('_WIN32', ''), ('_M_IX86', ''), ('_WCHAR_T_DEFINED', ''), ('_INTEGRAL_MAX_BITS', '64'), ('PASCAL', ''), ('RPC_ENTRY', ''), ('SHSTDAPI', 'HRESULT'), ('SHSTDAPI_(x)', 'x')] vc8_paths = ['..\\..\\Vc\\Include', '..\\..\\Vc\\PlatformSDK\\Include'] vc9e_macros = [('__cplusplus', '1'), ('__forceinline', '__inline'), ('__uuidof(x)', 'IID()'), ('__w64', ''), ('__int8', 'char'), ('__int16', 'short'), ('__int32', 'int'), ('__int64', 'long long'), ('__ptr64', ''), ('_MSC_VER', '1400'), ('_MSC_EXTENSIONS', ''), ('_WIN32', ''), ('_M_IX86', ''), ('_WCHAR_T_DEFINED', ''), ('_INTEGRAL_MAX_BITS', '64'), ('PASCAL', ''), ('RPC_ENTRY', ''), ('SHSTDAPI', 'HRESULT'), ('SHSTDAPI_(x)', 'x')] vc9e_paths = ['..\\..\\Vc\\Include', '..\\..\\Vc\\PlatformSDK\\Include'] compilers = [(vc9e, vc9e_macros, vc9e_paths), (vc8, vc8_macros, vc8_paths), (vc71, vc71_macros, vc71_paths), (vc7, vc7_macros, vc7_paths), (vc6, vc6_macros, vc6_paths)] found, paths, macros = False, [], [] import _winreg for c in compilers: try: key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, c[0][0]) path, type = _winreg.QueryValueEx(key, c[0][1]) found = True paths.extend([os.path.join(str(path), p) for p in c[2]]) macros.extend(c[1]) break except: continue return found, paths, macros def find_gcc_compiler_info(language, compiler, flags): """ Try to find a GCC-based C or C++ compiler. Return tuple of include path list and macro dictionary.""" found, paths, macros = False, [], [] flags = ' '.join(flags) temp = TempFile(language == 'C++' and '.cc' or '.c') # The output below assumes the en_US locale, so make sure we use that. command = 'LANG=en_US %s %s -E -v -dD %s'%(compiler, flags, temp.name) try: import subprocess # available only since Python 2.4 p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) stdout, stderr = p.communicate() out, err = stdout.split('\n'), stderr.split('\n') except: stdin, stdout, stderr = os.popen3(command) # for Python < 2.4 out, err = stdout.readlines(), stderr.readlines() stdin.close() state = 0 for line in err: line = line.rstrip() if state == 0: if line[:11] == 'gcc version': state = 1 elif state == 1: state = 2 elif state == 2: if line == '#include <...> search starts here:': state = 3 elif state == 3: if line == 'End of search list.': state = 4 else: paths.append(line.strip()) # now read built-in macros state = 0 for line in out: line = line.rstrip() if state == 0: if line == '# 1 ""' or line == '# 1 ""': state = 1 elif state == 1: if line.startswith('#define '): tokens = line[8:].split(' ', 1) if len(tokens) == 1: tokens.append('') macros.append(tuple(tokens)) elif line == '# 1 "%s"'%temp: state = 0 # Per-compiler adjustments for name, value in tuple(macros): if name == '__GNUC__' and value == '2': # gcc 2.x needs this or it uses nonstandard syntax in the headers macros.append(('__STRICT_ANSI__', '')) return True, paths, macros def find_compiler_info(language, compiler, flags): found, paths, macros = False, [], [] if compiler == 'cl' and os.name == 'nt': if flags: sys.stderr.write('Warning: ignoring unknown flags for MSVC compiler\n') found, paths, macros = find_ms_compiler_info() else: found, paths, macros = find_gcc_compiler_info(language, compiler, flags) return found, paths, macros def get_compiler_timestamp(compiler): """Returns the timestamp for the given compiler, or 0 if not found""" path = os.getenv('PATH', os.defpath) path = string.split(path, os.pathsep) for directory in path: # Try to stat the compiler in this directory, if it exists filename = os.path.join(directory, compiler) if os.name == 'nt': filename += '.exe' try: stats = os.stat(filename) except OSError: continue return stats[stat.ST_CTIME] # Not found return 0 class CompilerInfo: """Info about one compiler.""" compiler = '' """ The name of the compiler, typically the executable name, which must either be in the path or given as an absolute, pathname.""" flags = [] "Compiler flags that impact its characteristics." language = '' "The programming language the compiler is used for." kind = '' """ A string indicating the type of this info: one of 'system', 'custom', ''. 'custom' compilers will never be automatically updated, and an empty string indicates a failure to look up the given compiler.""" timestamp = '' "The timestamp of the compiler binary." include_paths = [] "A list of strings indicating the include paths." macros = [] """ A list of (name,value) pairs. Values may be empty, or None. The latter ase indicates that the macro is to be undefined.""" def _write(self, os): item = id(self) >= 0 and id(self) or -id(self) os.write('class Item%u:\n'%item) for name, value in CompilerInfo.__dict__.iteritems(): if name[0] != '_': os.write(' %s=%r\n'%(name, getattr(self, name))) os.write('\n') class CompilerList(object): user_emulations_file = '~/.synopsis/parsers/cpp/emulator' "The cache file." def __init__(self, filename = ''): self.compilers = [] self.no_cache = os.environ.has_key('SYNOPSIS_NO_CACHE') self.load(filename) def list(self): return [c.compiler for c in self.compilers] def _query(self, language, compiler, flags): """Construct and return a CompilerInfo object for the given compiler.""" ci = CompilerInfo() ci.compiler = compiler ci.flags = flags ci.language = language try: found, paths, macros = find_compiler_info(language, compiler, flags) if found: ci.kind = 'system' ci.timestamp = get_compiler_timestamp(compiler) ci.include_paths = paths ci.macros = macros except: ci.kind = '' # failure ci.timestamp = 0 ci.include_paths = [] ci.macros = [] return ci def add_default_compilers(self): self.compilers.append(self._query('C++', 'c++', [])) self.compilers.append(self._query('C++', 'g++', [])) self.compilers.append(self._query('C', 'cc', [])) self.compilers.append(self._query('C', 'gcc', [])) def load(self, filename = ''): """Loads the compiler infos from a file.""" if self.no_cache: self.add_default_compilers() return compilers = [] glob = {} glob['version'] = version class Type(type): """Factory for CompilerInfo objects. This is used to read in an emulation file.""" def __init__(cls, name, bases, dict): if glob['version'] != version: print('Warning: reading compiler emulation cache from different Synopsis version\n') compiler = CompilerInfo() for name, value in CompilerInfo.__dict__.items(): if name[0] != '_': setattr(compiler, name, dict.get(name, value)) compilers.append(compiler) if not filename: filename = CompilerList.user_emulations_file filename = os.path.expanduser(filename) glob['__builtins__'] = __builtins__ glob['__name__'] = '__main__' glob['__metaclass__'] = Type try: execfile(filename, glob, glob) except IOError: self.add_default_compilers() self.save() else: self.compilers = compilers def save(self, filename = ''): if self.no_cache: return if not filename: filename = CompilerList.user_emulations_file filename = os.path.expanduser(filename) dirname = os.path.dirname(filename) if not os.path.exists(dirname): os.makedirs(dirname) emu = open(filename, 'wt') emu.write("""# This file was generated by Synopsis.Parsers.Cpp.Emulator. # When making any manual modifications to any of the classes # be sure to set the 'kind' field to 'custom' so it doesn't get # accidentally overwritten !\n""") emu.write('\n') emu.write('version=%r\n'%version) emu.write('\n') for c in self.compilers: c._write(emu) def refresh(self): """Refreshes the compiler list. Regenerate all non-custom compilers without destroying custom compilers.""" compilers = [] for ci in self.compilers: if ci.is_custom: compilers.append(ci) ci = _query(ci.language, ci.compiler, ci.flags) if ci: compilers.append(ci) self.compilers = compilers self.save() def find(self, language, compiler, flags): if not flags: flags = [] for ci in self.compilers: if (not compiler and language == ci.language or (compiler == ci.compiler and flags == ci.flags)): return ci ci = self._query(language, compiler, flags) self.compilers.append(ci) self.save() return ci # Cache that makes multiple calls to 'get_compiler_info' more efficient. compiler_list = None def get_compiler_info(language, compiler = '', flags = None): """ Returns the compiler info for the given compiler. If none is specified (''), return the first available one for the given language. The info is returned as a CompilerInfo object, or None if the compiler isn't found. """ global compiler_list if not compiler_list: compiler_list = CompilerList() ci = compiler_list.find(language, compiler, flags) return ci synopsis-0.12/Synopsis/Parsers/Cxx/0000775000076400007640000000000011172123232016661 5ustar stefanstefansynopsis-0.12/Synopsis/Parsers/Cxx/Translator.hh0000664000076400007640000001041111104703262021332 0ustar stefanstefan// // Copyright (C) 2000 Stefan Seefeld // Copyright (C) 2000 Stephen Davies // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef H_SYNOPSIS_CPP_SYNOPSIS #define H_SYNOPSIS_CPP_SYNOPSIS #include #include #include #include #include #include #include "ASG.hh" #include "Types.hh" class FileFilter; //. The Translator class maps from C++ objects to Python objects class Translator : public ASG::Visitor, public Types::Visitor { public: Translator(FileFilter*, PyObject *ir); ~Translator(); void translate(ASG::Scope* global); void set_builtin_decls(const ASG::Declaration::vector& builtin_decls); // // types from the Synopsis.Type module // PyObject* Base(Types::Base*); PyObject* Unknown(Types::Named*); PyObject* Declared(Types::Declared*); PyObject* Dependent(Types::Dependent*); PyObject* Template(Types::Template*); PyObject* Modifier(Types::Modifier*); PyObject* Array(Types::Array*); PyObject* Parameterized(Types::Parameterized*); PyObject* FuncPtr(Types::FuncPtr*); // // types from the Synopsis.ASG module // PyObject* SourceFile(ASG::SourceFile*); PyObject* Include(ASG::Include*); PyObject* Declaration(ASG::Declaration*); PyObject* Builtin(ASG::Builtin*); PyObject* Macro(ASG::Macro*); PyObject* Forward(ASG::Forward*); PyObject* Scope(ASG::Scope*); PyObject* Namespace(ASG::Namespace*); PyObject* Inheritance(ASG::Inheritance*); PyObject* Class(ASG::Class*); PyObject* ClassTemplate(ASG::ClassTemplate *); PyObject* Typedef(ASG::Typedef*); PyObject* Enumerator(ASG::Enumerator*); PyObject* Enum(ASG::Enum*); PyObject* Variable(ASG::Variable*); PyObject* Const(ASG::Const*); PyObject* Parameter(ASG::Parameter*); PyObject* Function(ASG::Function*); PyObject* Operation(ASG::Operation*); PyObject* UsingDirective(ASG::UsingDirective*); PyObject* UsingDeclaration(ASG::UsingDeclaration*); // // ASG::Visitor methods // void visit_declaration(ASG::Declaration*); void visit_builtin(ASG::Builtin*); void visit_macro(ASG::Macro*); void visit_scope(ASG::Scope*); void visit_namespace(ASG::Namespace*); void visit_class(ASG::Class*); void visit_class_template(ASG::ClassTemplate *); void visit_inheritance(ASG::Inheritance*); void visit_forward(ASG::Forward*); void visit_typedef(ASG::Typedef*); void visit_variable(ASG::Variable*); void visit_const(ASG::Const*); void visit_enum(ASG::Enum*); void visit_enumerator(ASG::Enumerator*); void visit_function(ASG::Function*); void visit_operation(ASG::Operation*); void visit_parameter(ASG::Parameter*); void visit_using_directive(ASG::UsingDirective*); void visit_using_declaration(ASG::UsingDeclaration*); // // Types::Visitor methods // //void visitType(Types::Type*); void visit_unknown(Types::Unknown*); void visit_modifier(Types::Modifier*); void visit_array(Types::Array*); //void visitNamed(Types::Named*); void visit_base(Types::Base*); void visit_dependent(Types::Dependent*); void visit_declared(Types::Declared*); void visit_template_type(Types::Template*); void visit_parameterized(Types::Parameterized*); void visit_func_ptr(Types::FuncPtr*); private: //. Compiler Firewalled private data struct Private; friend struct Private; Private* m; //. //. helper methods //. void addComments(PyObject* pydecl, ASG::Declaration* cdecl); ///////// EVERYTHING BELOW HERE SUBJECT TO REVIEW AND DELETION /* PyObject *lookupType(const std::string &, PyObject *); PyObject *lookupType(const std::string &); PyObject *lookupType(const std::vector& qualified); static void addInheritance(PyObject *, const std::vector &); static PyObject *N2L(const std::string &); static PyObject *V2L(const std::vector &); static PyObject *V2L(const std::vector &); static PyObject *V2L(const std::vector &); void pushClassBases(PyObject* clas); PyObject* resolveDeclared(PyObject*); void addDeclaration(PyObject *); */ private: PyObject* m_asg_module; PyObject* m_sf_module; PyObject *m_ir; PyObject* m_declarations; PyObject* m_dictionary; FileFilter* m_filter; }; #endif synopsis-0.12/Synopsis/Parsers/Cxx/Builder.cc0000664000076400007640000007016011122312026020556 0ustar stefanstefan// // Copyright (C) 2002 Stephen Davies // Copyright (C) 2002 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include #include "Builder.hh" #include "Types.hh" #include "Dictionary.hh" #include "Walker.hh" #include "ScopeInfo.hh" #include "Lookup.hh" #include "TypeInfo.hh" #include "STrace.hh" //. Simplify names. Typically only used for accessing vectors and iterators using namespace Types; using namespace ASG; //. Utility method QName extend(const QName& name, const std::string& str) { QName ret = name; ret.push_back(str); return ret; } namespace { class DeclarationTypeFinder : ASG::Visitor, Types::Visitor { public: enum Type { NONE = 0, FORWARD = 1, CLASS = 2, TEMPLATE = 4}; int resolve(Types::Named *t) { decl_ = 0; cache_ = NONE; t->accept(this); return cache_; } ASG::Declaration *declaration() const { return decl_;} private: virtual void visit_declared(Types::Declared *d) { decl_ = d->declaration(); decl_->accept(this); } virtual void visit_class(Class*) { cache_ = CLASS;} virtual void visit_class_template(ClassTemplate*) { cache_ = TEMPLATE;} virtual void visit_forward(Forward* f) { cache_ = FORWARD; if (f->template_id()) cache_ |= TEMPLATE; } ASG::Declaration *decl_; int cache_; }; } // // Struct Builder::Private // struct Builder::Private { typedef std::map ScopeMap; ScopeMap map; //. A map of name references typedef std::map > RefMap; RefMap refs; //. A list of builtin declarations Declaration::vector builtin_decls; }; // // Class Builder // Builder::Builder(ASG::SourceFile* file) { // m_file was originally initialized to 0. Why ?? m_file = file; m_unique = 1; m = new Private; QName name; m_scope = m_global = new ASG::Namespace(file, 0, "global", name); ScopeInfo* global = find_info(m_global); m_scopes.push_back(global); // Insert the global base types Types::Base* t_bool, *t_null; ASG::Declaration* decl; global->dict->insert(create_base("char")); global->dict->insert(t_bool = create_base("bool")); global->dict->insert(create_base("short")); global->dict->insert(create_base("int")); global->dict->insert(create_base("long")); global->dict->insert(create_base("unsigned")); global->dict->insert(create_base("unsigned long")); global->dict->insert(create_base("float")); global->dict->insert(create_base("double")); global->dict->insert(create_base("void")); global->dict->insert(create_base("...")); global->dict->insert(create_base("long long")); global->dict->insert(create_base("long double")); global->dict->insert(t_null = create_base("__null_t")); // Add a variables for true name.clear(); name.push_back("true"); decl = new ASG::Const(file, -1, "const", name, t_bool, "true"); global->dict->insert(decl); m->builtin_decls.push_back(decl); // Add a variable for false name.clear(); name.push_back("false"); decl = new ASG::Const(file, -1, "const", name, t_bool, "false"); global->dict->insert(decl); m->builtin_decls.push_back(decl); // Add a variable for null pointer types (g++ #defines NULL to __null) name.clear(); name.push_back("__null"); decl = new ASG::Variable(file, -1, "variable", name, t_null, false); global->dict->insert(decl); m->builtin_decls.push_back(decl); // Create the Lookup helper m_lookup = new Lookup(this); } Builder::~Builder() { // TODO Delete all ... delete m_lookup; delete m; } //. Finds or creates a cached Scope ScopeInfo* Builder::find_info(ASG::Scope* decl) { Private::ScopeMap::iterator iter = m->map.find(decl); if (iter == m->map.end()) { ScopeInfo* scope = new ScopeInfo(decl); m->map.insert(Private::ScopeMap::value_type(decl, scope)); return scope; } return iter->second; } void Builder::set_access(ASG::Access axs) { m_scopes.back()->access = axs; } void Builder::set_file(ASG::SourceFile* file) { m_file = file; } const Declaration::vector& Builder::builtin_decls() const { return m->builtin_decls; } // // ASG Methods // void Builder::add(ASG::Declaration* decl, bool is_template) { ScopeInfo *scopeinfo = is_template ? m_scopes[m_scopes.size()-2] : m_scopes.back(); Types::Named *previous = 0; if (scopeinfo->dict->has_key(decl->name().back())) previous = scopeinfo->dict->lookup_multiple(decl->name().back())[0]; // If the given name is already known, and if one of them is a forward-declaration, // we eliminate it. if (previous) { DeclarationTypeFinder finder; int type = finder.resolve(previous); // If the previous is a forward-declaration, replace it. if (type & DeclarationTypeFinder::FORWARD) { // Now remove the old one from the scope, as well as from the symbol-table. scopeinfo->dict->remove(decl->name().back()); } else { // Else if the old one isn't a forward-declaration, but the new-one is, // simply ignore it. DeclarationTypeFinder finder; // int type = finder.resolve(decl); // if (type & DeclarationTypeFinder::FORWARD) // return; // else add the new declaration. } } decl->set_access(scopeinfo->access); scopeinfo->dict->insert(decl); const std::string& scope_type = scopeinfo->scope_decl->type(); if (scope_type != "local" && scope_type != "function") scopeinfo->scope_decl->declarations().push_back(decl); decl->file()->declarations().push_back(decl); } void Builder::add(Types::Named* type) { // Add to name dictionary m_scopes.back()->dict->insert(type); } void Builder::add_macros(const std::vector& macros) { std::vector::const_iterator iter; for (iter = macros.begin(); iter != macros.end(); iter++) m_global->declarations().push_back(*iter); } ASG::Namespace* Builder::start_namespace(const std::string& n, NamespaceType nstype) { std::string name = n, type_str; ASG::Namespace* ns = 0; bool generated = false; // Decide what to do based on the given namespace type switch (nstype) { case NamespaceNamed: type_str = "namespace"; { // Check if namespace already exists Dictionary* dict = scopeinfo()->dict; if (dict->has_key(name)) try { Types::Named::vector types = dict->lookup_multiple(name); ns = Types::declared_cast(*types.begin()); } catch (const Types::wrong_type_cast&) {} } break; case NamespaceAnon: type_str = "module"; { // name is the filename. Wrap it in {}'s. only keep after last / size_t slash_at = name.rfind('/'); if (slash_at != std::string::npos) name.erase(0, slash_at + 1); name = "{" + name + "}"; } break; case NamespaceUnique: type_str = "local"; { // name is empty or the type. Encode it with a unique number if (!name.size()) name = "ns"; int count = m_scopes.back()->getCount(name); std::ostringstream buf; buf << '`' << name; if (count > 1) buf << count; name = buf.str(); } break; case NamespaceTemplate: type_str = "template"; { // name is empty or the type. Encode it with a unique number if (!name.size()) name = "template"; int count = m_scopes.back()->getCount(name); std::ostringstream buf; buf << '`' << name << count; name = buf.str(); } break; } // Create a new namespace object unless we already found one if (ns == 0) { generated = true; // Create the namspace if (nstype == NamespaceTemplate) ns = new ASG::Namespace(m_file, 0, type_str, m_scope->name()); else { // Generate a nested name QName ns_name = extend(m_scope->name(), name); ns = new ASG::Namespace(m_file, 0, type_str, ns_name); add(ns); } } // Create ScopeInfo object. Search is this NS plus enclosing NS's search ScopeInfo* ns_info = find_info(ns); ScopeInfo* current = m_scopes.back(); // For anon namespaces, we insert the anon ns into the parent search if (nstype == NamespaceAnon && generated) current->search.push_back(ns_info); // Initialize search to same as parent scope if we generated a new NS if (generated) std::copy(current->search.begin(), current->search.end(), std::back_inserter(ns_info->search)); // Push stack m_scopes.push_back(ns_info); m_scope = ns; return ns; } void Builder::end_namespace() { // TODO: Check if it is a namespace... m_scopes.pop_back(); m_scope = m_scopes.back()->scope_decl; } // Utility class to recursively add base classes to given search void Builder::add_class_bases(ASG::Class* clas, ScopeSearch& search) { ASG::Inheritance::vector::iterator inh_iter = clas->parents().begin(); while (inh_iter != clas->parents().end()) { ASG::Inheritance* inh = *inh_iter++; Types::Type* type = inh->parent(); try { ASG::Class* base = Types::declared_cast(type); // Found a base class, so look it up ScopeInfo* scope = find_info(base); search.push_back(scope); // Recursively add.. add_class_bases(base, search); } catch (const Types::wrong_type_cast&) { /* TODO: handle typedefs and parameterized types */ } } } void Builder::update_class_base_search() { ScopeInfo* scope = m_scopes.back(); ASG::Class* clas = dynamic_cast(scope->scope_decl); if (!clas) return; ScopeSearch search = scope->search; ScopeSearch::iterator iter = search.begin(); scope->search.clear(); // Add the scope itself scope->search.push_back(*iter++); // Add base classes add_class_bases(clas, scope->search); // Add containing scopes, stored in search while (iter != search.end()) scope->search.push_back(*iter++); } ASG::Class* Builder::start_class(int lineno, const std::string& type, const std::string& name, ASG::Parameter::vector* templ_params, std::string const &primary_name) { // Generate the name ASG::Class* class_ = 0; bool is_template = templ_params && templ_params->size(); bool is_specialization = *name.rbegin() == '>'; if (is_template) { QName class_name = extend(m_scopes[m_scopes.size()-2]->scope_decl->name(), name); ASG::ClassTemplate *ct = new ASG::ClassTemplate(m_file, lineno, type, class_name, is_specialization); Types::Template* templ = new Types::Template(class_name, ct, *templ_params); ct->set_template_id(templ); add(ct, true); class_ = ct; } else { QName class_name = extend(m_scope->name(), name); class_ = new ASG::Class(m_file, lineno, type, class_name, is_specialization); add(class_); } // Push stack. Search is this Class plus base Classes plus enclosing NS's search ScopeInfo* class_info = find_info(class_); class_info->access = (type == "struct" ? ASG::Public : ASG::Private); std::copy(scopeinfo()->search.begin(), scopeinfo()->search.end(), std::back_inserter(class_info->search)); m_scopes.push_back(class_info); m_scope = class_; return class_; } // Declaration of a previously forward declared class (ie: must find and // replace previous forward declaration in the appropriate place) ASG::Class* Builder::start_class(int lineno, const std::string& type, const QName& names) { // Find the forward declaration of this class Types::Named* named = m_lookup->lookupType(names); // Must be either unknown or declared->forward Types::Unknown* unknown = dynamic_cast(named); if (!unknown) { Types::Declared* declared = dynamic_cast(named); if (!declared) { std::cerr << "Fatal: Qualified class name did not reference a declared type." << std::endl; exit(1); } ASG::Forward* forward = dynamic_cast(declared->declaration()); if (!forward) { std::cerr << "Fatal: Qualified class name did not reference a forward declaration." << std::endl; exit(1); } } // Create the Class ASG::Class* ns = new ASG::Class(m_file, lineno, type, named->name(), false); // Add to container scope QName scope_name = names; scope_name.pop_back(); Types::Declared* scope_type = dynamic_cast(m_lookup->lookupType(scope_name)); if (!scope_type) { std::cerr << "Fatal: Qualified class name was not in a declaration." << std::endl; exit(1); } ASG::Scope* scope = dynamic_cast(scope_type->declaration()); if (!scope) { std::cerr << "Fatal: Qualified class name was not in a scope." << std::endl; exit(1); } // Set access //decl->setAccess(m_scopes.back()->access); // Add declaration scope->declarations().push_back(ns); // Add to name dictionary ScopeInfo* scope_info = find_info(scope); scope_info->dict->insert(ns); // Push stack. Search is this Class plus enclosing scopes. bases added later ScopeInfo* ns_info = find_info(ns); ns_info->access = (type == "struct" ? ASG::Public : ASG::Private); std::copy(scope_info->search.begin(), scope_info->search.end(), std::back_inserter(ns_info->search)); m_scopes.push_back(ns_info); m_scope = ns; return ns; } void Builder::end_class() { // Check if it is a class... m_scopes.pop_back(); m_scope = m_scopes.back()->scope_decl; } ASG::Namespace* Builder::start_template() { return start_namespace("", NamespaceTemplate); } void Builder::end_template() { end_namespace(); } //. Start function impl scope void Builder::start_function_impl(const QName& name) { STrace trace("Builder::start_function_impl"); // Create the Namespace ASG::Namespace* ns = new ASG::Namespace(m_file, 0, "function", name); ScopeInfo* ns_info = find_info(ns); // if this is a function template, add the template parameter scope for // dependent types. if (m_scopes.back()->scope_decl->type() == "template") ns_info->search.push_back(m_scopes.back()); ScopeInfo* scope_info; if (name.size() > 1) { // Find container scope std::vector scope_name = name; scope_name.pop_back(); scope_name.insert(scope_name.begin(), ""); // force lookup from global, not current scope, since name is fully qualified Types::Declared* scope_type = dynamic_cast(m_lookup->lookupType(scope_name)); if (!scope_type) { throw ERROR("Warning: Qualified func name was not in a declaration. Parent scope is:" << scope_name); } ASG::Scope* scope = dynamic_cast(scope_type->declaration()); if (!scope) { throw ERROR("Warning: Qualified func name was not in a scope."); } scope_info = find_info(scope); } else { scope_info = find_info(m_global); } // Add to name dictionary TODO: this is for debugging only! scope_info->dict->insert(ns); // Push stack. Search is this Class plus enclosing scopes. bases added later std::copy(scope_info->search.begin(), scope_info->search.end(), std::back_inserter(ns_info->search)); m_scopes.push_back(ns_info); m_scope = ns; } //. End function impl scope void Builder::end_function_impl() { m_scopes.pop_back(); m_scope = m_scopes.back()->scope_decl; } //. Add an function ASG::Function* Builder::add_function(int line, const std::string& name, const std::vector& premod, Types::Type* ret, const std::vector& postmod, const std::string& realname, ASG::Parameter::vector* templ_params) { // Find the parent scope, depending on whether this is a template or not ASG::Scope* parent_scope; if (templ_params) parent_scope = m_scopes[m_scopes.size()-2]->scope_decl; else parent_scope = m_scope; // Determine the new scoped name QName func_name = extend(parent_scope->name(), name); // Decide whether this is a member function (aka operation) or just a // function ASG::Function* func; if (dynamic_cast(parent_scope)) { char const *type = (templ_params && templ_params->size()) ? "member function template" : "member function"; func = new ASG::Operation(m_file, line, type, func_name, premod, ret, postmod, realname); } else { char const *type = (templ_params && templ_params->size()) ? "function template" : "function"; func = new ASG::Function(m_file, line, type, func_name, premod, ret, postmod, realname); } // Create template type if (templ_params) { Types::Template* templ = new Types::Template(func_name, func, *templ_params); func->set_template_id(templ); add(func, true); } else add(func); return func; } //. Add a variable ASG::Variable* Builder::add_variable(int line, const std::string& name, Types::Type* vtype, bool constr, const std::string& type) { // Generate the name QName scope = m_scope->name(); scope.push_back(name); ASG::Variable* var = new ASG::Variable(m_file, line, type, scope, vtype, constr); add(var); return var; } ASG::Const* Builder::add_constant(int line, const std::string& name, Types::Type* cType, const std::string& type, std::string const &value) { // Generate the name QName scope = m_scope->name(); scope.push_back(name); ASG::Const* c = new ASG::Const(m_file, line, type, scope, cType, value); add(c); return c; } void Builder::add_this_variable() { // First find out if we are in a method ASG::Scope* func_ns = m_scope; QName name = func_ns->name(); name.pop_back(); name.insert(name.begin(), std::string()); Types::Named* clas_named = m_lookup->lookupType(name, false); ASG::Class* clas; try { clas = Types::declared_cast(clas_named); } catch (const Types::wrong_type_cast& ) // Not in a method -- so dont add a 'this' { return; } // clas is now the ASG::Class of the enclosing class Types::Type::Mods pre, post; post.push_back("*"); Types::Modifier* t_this = new Types::Modifier(clas->declared(), pre, post); add_variable(-1, "this", t_this, false, "this"); } //. Add a typedef ASG::Typedef* Builder::add_typedef(int line, const std::string& name, Types::Type* alias, bool constr) { // Generate the name QName scoped_name = extend(m_scope->name(), name); // Create the object ASG::Typedef* tdef = new ASG::Typedef(m_file, line, "typedef", scoped_name, alias, constr); add(tdef); return tdef; } //. Add an enumerator ASG::Enumerator* Builder::add_enumerator(int line, const std::string& name, const std::string& value) { QName scoped_name = extend(m_scope->name(), name); ASG::Enumerator* enumor = new ASG::Enumerator(m_file, line, "enumerator", scoped_name, value); add(enumor->declared()); return enumor; } //. Add an enum ASG::Enum* Builder::add_enum(int line, const std::string& name, const std::vector& enumors) { QName scoped_name = extend(m_scope->name(), name); ASG::Enum* theEnum = new ASG::Enum(m_file, line, "enum", scoped_name); theEnum->enumerators() = enumors; add(theEnum); return theEnum; } //. Add tail comment ASG::Builtin *Builder::add_tail_comment(int line) { QName name; name.push_back("EOS"); ASG::Builtin *builtin = new ASG::Builtin(m_file, line, "EOS", name); add(builtin); return builtin; } // A functor that adds only inheritances which are class objects to a given // list class InheritanceAdder { std::list& open_list; public: InheritanceAdder(std::list& l) : open_list(l) {} InheritanceAdder(const InheritanceAdder& i) : open_list(i.open_list) {} void operator() (ASG::Inheritance* i) { try { open_list.push_back(Types::declared_cast(i->parent())); } catch (const Types::wrong_type_cast&) { /* ?? ignore for now */ } } }; //. Maps a scoped name into a vector of scopes and the final type. Returns //. true on success. bool Builder::mapName(const QName& names, std::vector& o_scopes, Types::Named*& o_type) { STrace trace("Builder::mapName"); ASG::Scope* ast_scope = m_global; QName::const_iterator iter = names.begin(); QName::const_iterator last = names.end(); last--; QName scoped_name; // Start scope name at global level scoped_name.push_back(""); // Sanity check if (iter == names.end()) return false; // Loop through all containing scopes while (iter != last) { //const std::string& name = *iter++; scoped_name.push_back(*iter++); Types::Named* type = m_lookup->lookupType(scoped_name); if (!type) { LOG("Warning: failed to lookup " << scoped_name << " in global scope"); return false; } try { ast_scope = Types::declared_cast(type); } catch (const Types::wrong_type_cast&) { LOG("Warning: looked up scope wasnt a scope!" << scoped_name); return false; } o_scopes.push_back(ast_scope); } // iter now == last, which can be any type scoped_name.push_back(*iter); Types::Named* type = m_lookup->lookupType(scoped_name, true); if (!type) { //find_info(ast_scope)->dict->dump(); LOG("\nWarning: final type lookup wasn't found!" << *iter); return false; } o_type = type; return true; } Types::Unknown* Builder::create_unknown(const QName& name) { // Generate the name QName u_name = m_scope->name(); for (QName::const_iterator i = name.begin(); i != name.end(); ++i) u_name.push_back(*i); Types::Unknown* unknown = new Types::Unknown(u_name); return unknown; } Types::Unknown* Builder::add_unknown(const std::string& name) { if (m_scopes.back()->dict->has_key(name) == false) { QName u_name; u_name.push_back(name); add(create_unknown(u_name)); } return 0; } ASG::Forward* Builder::add_forward(int lineno, const std::string& name, const std::string &type, ASG::Parameter::vector* templ_params) { ScopeInfo* parent_scope = templ_params ? // Must find the scope above the template scope m_scopes[m_scopes.size() - 2] : m_scopes[m_scopes.size() - 1]; QName scoped_name = extend(parent_scope->scope_decl->name(), name); // The type is already known. if (parent_scope->dict->has_key(name) == true) return 0; bool is_template = templ_params && templ_params->size(); bool is_specialization = *name.rbegin() == '>'; ASG::Forward* forward = new ASG::Forward(m_file, lineno, type, scoped_name, is_specialization); if (is_template) { Types::Template* templ = new Types::Template(scoped_name, forward, *templ_params); forward->set_template_id(templ); } add(forward, templ_params != 0); return forward; } Types::Base* Builder::create_base(const std::string& name) { return new Types::Base(extend(m_scope->name(), name)); } Types::Dependent* Builder::create_dependent(const std::string& name) { return new Types::Dependent(extend(m_scope->name(), name)); } std::string Builder::dump_search(ScopeInfo* scope) { ScopeSearch& search = scope->search; std::ostringstream buf; buf << "Search for "; if (scope->scope_decl->name().size() == 0) buf << "global"; else buf << m_scope->name(); buf << " is now: "; ScopeSearch::iterator iter = search.begin(); while (iter != search.end()) { buf << (iter==search.begin() ? "" : ", "); const QName& name = (*iter)->scope_decl->name(); if (name.size()) if ( (*iter)->is_using ) buf << "(" << name << ")"; else buf << name; else buf << "global"; ++iter; } //buf << std::ends; return buf.str(); } // A comparator which compares declaration pointers of ScopeInfo objects class Builder::EqualScope { ASG::Scope* target; public: EqualScope(ScopeInfo* t) { target = t->scope_decl; } bool operator()(ScopeInfo* s) { return s->scope_decl == target; } }; void Builder::do_add_using_directive(ScopeInfo* target, ScopeInfo* scope) { STrace trace("Builder::do_add_using_directive"); // Check if 'scope' already has 'target' in its using list ScopeSearch& uses = scope->using_scopes; if (std::find_if(uses.begin(), uses.end(), EqualScope(target)) != uses.end()) // Already using return; // Else add it scope->using_scopes.push_back(target); target->used_by.push_back(scope); QName& target_name = target->scope_decl->name(); // Find where to insert 'scope' into top()'s search list // "closest enclosing namespace that contains both using directive and // target namespace" -- C++ Standard ScopeSearch& search = scope->search; LOG(dump_search(scope)); ScopeSearch::iterator iter = search.end(); // Skip global scope.. cant check something with no name --iter; while (iter != search.begin()) { // Move to next scope to check --iter; QName& search_name = (*iter)->scope_decl->name(); if (target_name.size() < search_name.size()) // Search is more nested than the target break; if (search_name.size() < 1) // Global NS.. continue; if (target_name[search_name.size()-1] != search_name.back()) // Different scope path taken break; } // Move back to last which was common, so we can insert before it if (*iter != search.back() && iter != search.begin()) iter++; // Create a dummy ScopeInfo which is just an alias to the original. This // is needed to cumulate using namespaces in the lookups ScopeInfo* new_scope = new ScopeInfo(target); search.insert(iter, new_scope); LOG(dump_search(scope)); // Add target to all used_by scopes ScopeSearch used_by_copy = scope->used_by; iter = used_by_copy.begin(); while (iter != used_by_copy.end()) do_add_using_directive(target, *iter++); } // Add a namespace using declaration. ASG::UsingDirective *Builder::add_using_directive(int line, Types::Named* type) { STrace trace("Builder::using_directive"); ASG::Scope* ast_scope = Types::declared_cast(type); ScopeInfo* target = find_info(ast_scope); do_add_using_directive(target, m_scopes.back()); ASG::UsingDirective* u = new ASG::UsingDirective(m_file, line, type->name()); add(u); return u; } // Add a namespace alias using declaration. void Builder::add_aliased_using_namespace(Types::Named* type, const std::string& alias) { STrace trace("Builder::usingNamespace"); // Retrieve the 'Namespace' it points to ASG::Namespace* ns = Types::declared_cast(type); // Create a new declared type with a different name QName new_name = extend(m_scope->name(), alias); Types::Declared* declared = new Types::Declared(new_name, ns); // Add to current scope add(declared); } // Add a using declaration. ASG::UsingDeclaration *Builder::add_using_declaration(int line, Types::Named* type) { // Add it to the current scope QName name = extend(m_scope->name(), type->name().back()); ASG::UsingDeclaration* u = new ASG::UsingDeclaration(m_file, line, name, type); add(u); return u; } synopsis-0.12/Synopsis/Parsers/Cxx/SXRGenerator.cc0000664000076400007640000002440611171270660021530 0ustar stefanstefan// // Copyright (C) 2008 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include "Walker.hh" #include "SXRGenerator.hh" #include "SXRBuffer.hh" #include "ASG.hh" #include "Types.hh" #include "TypeIdFormatter.hh" #include "Builder.hh" #include "STrace.hh" #include "Filter.hh" #include #include #include #include #include #include namespace { char const *context_names[] = { "reference", "definition", "SPAN", "IMPL", "UDIR", "UDEC", "call" }; } SXRGenerator::SXRGenerator(FileFilter* filter, Walker *walker) : filter_(filter), buffer_(walker->buffer()), walker_(walker) { // Check size of array here to prevent later segfaults assert(sizeof(context_names)/sizeof(context_names[0]) == NumContext); } SXRGenerator::~SXRGenerator() { for (SXRDict::iterator i = buffers_.begin(); i != buffers_.end(); ++i) { i->second->write(); delete i->second; } } void SXRGenerator::xref_macro_calls() { for (SXRDict::iterator f = buffers_.begin(); f != buffers_.end(); ++f) { ASG::SourceFile *file = f->first; SXRBuffer *sxr = f->second; ASG::SourceFile::Lines &lines = file->macro_calls(); for (ASG::SourceFile::Lines::iterator l = lines.begin(); l != lines.end(); ++l) { long lineno = l->first; ASG::SourceFile::Line &line = l->second; for (ASG::SourceFile::Line::iterator e = line.begin(); e != line.end(); ++e) { ASG::SourceFile::MacroCall const &call = *e; if (!call.continuation) sxr->insert_xref(lineno, call.column, call.name.size(), call.name, "definition", "global scope", "macro call", false); } } } } Walker* SXRGenerator::walker() { return walker_; } int SXRGenerator::map_column(ASG::SourceFile *file, int line, char const *ptr) { char const *line_start = ptr; while (line_start > buffer_->ptr() && *line_start != '\n') --line_start; int col = ptr - (line_start + 1); // Resolve macro maps return file->map_column(line, col); } void SXRGenerator::xref(PTree::Node *node, Context context, QName const &name, std::string const &desc, ASG::Declaration const *decl) { walker_->update_line_number(node); ASG::SourceFile* file = walker_->current_file(); // Dont store records for included files if (!filter_->should_xref(file)) return; // Get info for storing a syntax record int begin_line = walker_->line_of_ptree(node); int begin_col = map_column(file, begin_line, node->begin()); if (begin_col < 0) return; // inside macro std::string filename; unsigned long end_line = buffer_->origin(node->end(), filename); if (begin_line == end_line) { int len = node->end() - node->begin(); store_xref(file, begin_line, begin_col, len, context, name, desc, false); } else { // Generate one xref plus continuations for each additional line. int end_col = map_column(file, end_line, node->end()); for (int line = begin_line; line < end_line; ++line, begin_col = 0) store_xref(file, line, begin_col, -1, context, name, desc, line != begin_line); store_xref(file, end_line, 0, end_col, context, name, desc, true); } } //. A class which acts as a Types Visitor to store the correct link to a given //. type class TypeStorer : public Types::Visitor { // Variables to pass to link() SXRGenerator *sxr_; PTree::Node *node; SXRGenerator::Context context; public: //. Constructor TypeStorer(SXRGenerator* sxr, PTree::Node *n, SXRGenerator::Context c) : sxr_(sxr), node(n), context(c) {} //. Returns a suitable description for the given type std::string describe(Types::Type* type) { std::string desc; try { return Types::declared_cast(type)->type(); } catch (Types::wrong_type_cast const &) { return sxr_->walker()->type_formatter()->format(type); } } // Visitor methods void visit_base(Types::Base* base) { sxr_->span(node, "keyword"); } void visit_dependent(Types::Dependent*) { } void visit_named(Types::Named* named) { // All other nameds get stored sxr_->xref(node, context, named->name(), describe(named)); } void visit_declared(Types::Declared* declared) { // All other nameds get stored sxr_->xref(node, context, declared->name(), describe(declared), declared->declaration()); } void visit_modifier(Types::Modifier* mod) { // We recurse on the mod's alias, but dont link the const bit if (mod->pre().size() && mod->pre().front() == "const") if (!node->is_atom() && PTree::first(node) && *PTree::first(node) == "const") { sxr_->span(PTree::first(node), "keyword"); node = PTree::first(PTree::last(node)); } mod->alias()->accept(this); } void visit_parameterized(Types::Parameterized* param) { // Sometimes there's a typename at the front.. if (PTree::first(node)->is_atom() && PTree::first(node) && *PTree::first(node) == "typename") node = PTree::second(node); // Some modifiers nest the identifier.. while (!PTree::first(node)->is_atom()) node = PTree::first(node); // For qualified template names the ptree is: // [ std :: [ vector [ < ... , ... > ] ] ] // If the name starts with :: (global scope), skip it if (PTree::first(node) && *PTree::first(node) == "::") node = PTree::rest(node); // Skip the qualifieds (and just link the final name) while (PTree::second(node) && *PTree::second(node) == "::") if (PTree::third(node)->is_atom()) node = PTree::rest(PTree::rest(node)); else node = PTree::third(node); // Do template sxr_->xref(PTree::first(node), param->template_id()); // Do params node = PTree::second(node); typedef Types::Type::vector::iterator iterator; iterator iter = param->parameters().begin(); iterator end = param->parameters().end(); // Could be leaf if eg: [SomeId const] node is now "const" while (node && !node->is_atom() && iter != end) { // Skip '<' or ',' if (!(node = PTree::rest(node))) break; if (node->car() && node->car()->car() && !node->car()->car()->is_atom() && node->car()->car()->car()) sxr_->xref(node->car()->car()->car(), *iter); ++iter; node = PTree::rest(node); } } // Other types ignored, for now }; // Store if type is named void SXRGenerator::xref(PTree::Node *node, Types::Type* type, Context context) { ASG::SourceFile* file = walker_->current_file(); if (!type || !filter_->should_xref(file)) return; TypeStorer storer(this, node, context); type->accept(&storer); } void SXRGenerator::xref(PTree::Node *node, ASG::Declaration const *decl) { ASG::SourceFile* file = walker_->current_file(); if (!decl || !filter_->should_xref(file)) return; xref(node, Definition, decl->name(), decl->type(), decl); } void SXRGenerator::store_span(unsigned int line, unsigned int col, int len, char const *type) { // TODO: desc maps to href title... ASG::SourceFile* file = walker_->current_file(); if (!filter_->should_xref(file)) return; SXRBuffer *sxr = get_buffer(file); sxr->insert_span(line, col, len, type); } void SXRGenerator::span(PTree::Node *node, char const *desc) { int line = walker_->line_of_ptree(node); ASG::SourceFile* file = walker_->current_file(); if (!filter_->should_xref(file)) return; int col = map_column(file, line, node->begin()); if (col < 0) return; // inside macro int len = node->end() - node->begin(); store_span(line, col, len, desc); } void SXRGenerator::long_span(PTree::Node *node, char const *desc) { // Find left edge int left_line = walker_->line_of_ptree(node); ASG::SourceFile* file = walker_->current_file(); if (!filter_->should_xref(file)) return; int left_col = map_column(file, left_line, node->begin()); if (left_col < 0) return; // inside macro int len = node->end() - node->begin(); // Find right edge std::string filename; unsigned long right_line = buffer_->origin(node->end(), filename); if (right_line == left_line) // Same line, so normal output store_span(left_line, left_col, len, desc); else { // Must output one for each line int right_col = map_column(file, right_line, node->end()); for (int line = left_line; line < right_line; line++, left_col = 0) store_span(line, left_col, -1, desc); // Lasg line is a bit different store_span(right_line, 0, right_col, desc); } } // Store a link in the Syntax File void SXRGenerator::store_xref(ASG::SourceFile* file, int line, int col, int len, Context context, QName const &qname, std::string const &desc, bool continuation) { SXRBuffer *sxr = get_buffer(file); std::vector scopes; Types::Named* vtype; QName name; if (walker_->builder()->mapName(qname, scopes, vtype)) { for (size_t i = 0; i < scopes.size(); i++) { if (ASG::Namespace* ns = dynamic_cast(scopes[i])) if (ns->type() == "function") { // Restart description at function scope name.clear(); continue; } // Add the name to the short name name.push_back(scopes[i]->name().back()); } // Add the final type name to the short name name.push_back(vtype->name().back()); } else { STrace trace("SXRGenerator::xref"); LOG("WARNING: couldnt map name " << qname); name = qname; } ASG::Scope *scope = walker_->builder()->scope(); std::string from = join(scope->name(), "::"); std::string type = context_names[context]; std::string title = desc + " " + join(name, "::"); sxr->insert_xref(line, col, len, join(qname, "::"), type, from, title, continuation); } SXRBuffer *SXRGenerator::get_buffer(ASG::SourceFile* file) { SXRBuffer *buf = 0; if (buffers_.find(file) == buffers_.end()) { std::string filename = filter_->get_sxr_filename(file); Synopsis::makedirs(Synopsis::Path(filename).dirname()); buf = new SXRBuffer(filename.c_str(), file->abs_name(), file->name()); buffers_.insert(std::make_pair(file, buf)); } else buf = buffers_[file]; return buf; } synopsis-0.12/Synopsis/Parsers/Cxx/TypeInfo.hh0000664000076400007640000000406011104703262020741 0ustar stefanstefan// // Copyright (C) 2002 Stephen Davies // Copyright (C) 2002 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef TypeInfo_hh_ #define TypeInfo_hh_ #include "Types.hh" // The TypeInfo class determines information about a type class TypeInfo : public Types::Visitor { public: Types::Type* type; bool is_const; bool is_volatile; bool is_null; size_t deref; //. Constructor TypeInfo(Types::Type* t) { type = t; is_const = is_volatile = is_null = false; deref = 0; set(t); } //. Set to the given type void set(Types::Type* t) { type = t; t->accept(this); } //. Base -- null is flagged since it is special void visit_base(Types::Base* base) { if (base->name().back() == "__null_t") is_null = true; } //. Modifiers -- recurse on the alias type void visit_modifier(Types::Modifier* mod) { Types::Type::Mods::const_iterator iter; // Check for const for (iter = mod->pre().begin(); iter != mod->pre().end(); iter++) if (*iter == "const") is_const = true; else if (*iter == "volatile") is_volatile = true; // Check for derefs for (iter = mod->post().begin(); iter != mod->post().end(); iter++) if (*iter == "*") deref++; else if (*iter == "[]") deref++; set(mod->alias()); } //. Declared -- check for typedef void visit_declared(Types::Declared* t) { try { ASG::Typedef* tdef = Types::declared_cast(t); // Recurse on typedef alias set(tdef->alias()); } catch (const Types::wrong_type_cast&) { /* Ignore -- just means not a typedef */ } } }; //. Output operator for debugging std::ostream& operator << (std::ostream& o, TypeInfo& i); #endif // vim: set ts=8 sts=4 sw=4 et: synopsis-0.12/Synopsis/Parsers/Cxx/Types.hh0000664000076400007640000002471211122312026020310 0ustar stefanstefan// // Copyright (C) 2002 Stephen Davies // Copyright (C) 2002 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Types_hh_ #define Types_hh_ #include #include #include #include "QName.hh" #include "FakeGC.hh" // Forward declare ASG::Declaration namespace ASG { class Declaration; class Parameter; } //. The Type hierarchy namespace Types { // Forward declaration of the Types::Visitor class defined in this file class Visitor; // Forward decl of Named class Named; //. The base class of the Type hierarchy class Type : public FakeGC::LightObject { public: //. A vector of Type objects typedef std::vector vector; //. Typedef for modifier list typedef std::vector Mods; //. Constructor Type(); //. Destructor. Note that Types::Type becomes abstract, unlike ASG::Declaration virtual ~Type(); //. Accept the given visitor virtual void accept(Visitor*); }; //. Base class of types with Names class Named : public Type { public: //. A vector of Types::Named objects typedef std::vector vector; //. Constructor Named(const QName& name); //. Destructor ~Named(); //. Accept the given visitor virtual void accept(Visitor*); // // Attribute Methods // //. Constant version of name() const QName& name() const { return m_name; } //. Return the QName of this type QName& name() { return m_name; } private: //. The fully qualified name of this type QName m_name; }; //. Base types are the (implicitly declared) builtin types such as 'int', 'bool' etc class Base : public Named { public: //. Constructor Base(const QName& name); //. Accept the given visitor virtual void accept(Visitor*); }; //. Unknown type class Unknown : public Named { public: //. Constructor Unknown(const QName& name); //. Accept the given visitor virtual void accept(Visitor*); }; //. Template parameter dependent types have a possibly scoped name, but no //. known type. Member types of template-parameters will be scoped, eg: //. //. template class A { T::B b; } //. //. Here T::B is a depandant type, and so is T. class Dependent : public Named { public: //. Constructor Dependent(const QName& name); //. Accept the given visitor virtual void accept(Visitor*); }; //. Declared types have a name and a reference to their declaration class Declared : public Named { public: //. Constructor Declared(const QName& name, ASG::Declaration* decl); //. Accept the given visitor virtual void accept(Visitor*); // // Attribute Methods // //. Const version of declaration() const ASG::Declaration* declaration() const { return m_decl; } //. Returns the Declaration referenced by this type ASG::Declaration* declaration() { return m_decl; } private: //. The declaration referenced by this type ASG::Declaration* m_decl; }; //. Template types are declared template types. They have a name, a //. declaration (which is an ASG::Class) and a vector of parameters //. declare this template. Each parameter (using ASG::Parameter) should be //. either the correct type for non-type parameters, or a Dependent for type //. parameters. In either case, there may be default values. class Template : public Declared { public: //. A vector of Types::Template objects typedef std::vector vector; //. A vector of Parameter objects typedef std::vector param_vector; //. Constructor Template(const QName& name , ASG::Declaration* decl, const param_vector& params); //. Accept the given visitor virtual void accept(Visitor*); // // Attribute Methods // //. Constant version of parameters() const param_vector& parameters() const { return m_params; } //. Returns the vector of parameter Types param_vector& parameters() { return m_params; } //. Constant version of specializations() const Template::vector& specializations() const { return m_specs; } //. Returns the vector of specializations for this template. //. If this template is a specialization, the vector must be empty Template::vector& specializations() { return m_specs; } private: //. The parameters param_vector m_params; //. The vector of specializations for this template Template::vector m_specs; }; //. Type Modifier. This type has a nested type, and wraps it with //. modifiers such as const, reference, etc. class Modifier : public Type { public: //. Constructor Modifier(Type* alias, const Mods& pre, const Mods& post); //. Destructor ~Modifier(); //. Accept the given visitor virtual void accept(Visitor*); // // Attribute Methods // //. Returns the alias (modified) Type object Type* alias() { return m_alias; } //. Returns the premodifiers Mods& pre() { return m_pre; } //. Returns the postmodifiers Mods& post() { return m_post; } private: //. The alias type Type* m_alias; //. The pre and post modifiers Mods m_pre, m_post; }; //. Type Array. This type adds array dimensions to a primary type class Array : public Type { public: //. Constructor Array(Type* alias, const Mods& sizes); //. Destructor ~Array(); //. Accept the given visitor virtual void accept(Visitor*); //. Returns the alias (modified) Type object Type* alias() { return m_alias; } //. Returns the sizes Mods& sizes() { return m_sizes; } private: //. The alias type Type* m_alias; //. The sizes Mods m_sizes; }; //. Parameterized type. A parameterized type is an instantiation of a //. Template type with concrete Types as parameters. class Parameterized : public Type { public: //. Constructor Parameterized(Named* templ, const Type::vector& params); //. Destructor ~Parameterized(); //. Accept the given visitor virtual void accept(Visitor*); // // Attribute Methods // //. Returns the Template type this is an instance of Named* template_id() { return m_template; } //. Constant version of parameters() const Type::vector& parameters() const { return m_params; } //. Returns the vector of parameter Types Type::vector& parameters() { return m_params; } private: //. The Template object, either a Template or a Dependent. Named* m_template; //. The vector of parameter Types Type::vector m_params; }; //. Function Pointer type. Function ptr types have a return type and a //. list of parameter types, along with a list of premodifiers. class FuncPtr : public Type { public: //. Constructor FuncPtr(Type* ret, const Mods& premods, const Type::vector& params); //. Destructor ~FuncPtr(); //. Accept the given visitor virtual void accept(Visitor*); // // Attribute Methods // //. Returns the Return Type object Type* return_type() { return m_return; } //. Const version of pre() const Mods& pre() const { return m_premod; } //. Returns the premodifier vector Mods& pre() { return m_premod; } //. Constant version of parameters() const Type::vector& parameters() const { return m_params; } //. Returns the vector of parameter Types Type::vector& parameters() { return m_params; } private: //. The Return Type Type* m_return; //. The premodifiers Mods m_premod; //. The parameters Type::vector m_params; }; //. The Visitor base class class Visitor { public: // Virtual destructor makes abstract virtual ~Visitor() = 0; virtual void visit_type(Type*); virtual void visit_unknown(Unknown*); virtual void visit_modifier(Modifier*); virtual void visit_array(Array*); virtual void visit_named(Named*); virtual void visit_base(Base*); virtual void visit_dependent(Dependent*); virtual void visit_declared(Declared*); virtual void visit_template_type(Template*); virtual void visit_parameterized(Parameterized*); virtual void visit_func_ptr(FuncPtr*); }; //. The exception thrown by the special cast templates class wrong_type_cast : public std::exception { public: //. Constructor wrong_type_cast() throw () {} //. Destructor virtual ~wrong_type_cast() throw () {} //. Returns name of this class virtual const char* what() const throw(); }; //. Casts Types::Type types to derived types safely. The cast is done using //. dynamic_cast, and wrong_type_cast is thrown upon failure. template T* type_cast(Type* type_ptr) throw (wrong_type_cast) { if (T* derived_ptr = dynamic_cast(type_ptr)) return derived_ptr; throw wrong_type_cast(); } //. Casts Types::Named types to derived types safely. The cast is done using //. dynamic_cast, and wrong_type_cast is thrown upon failure. template T* named_cast(Named* named_ptr) throw (wrong_type_cast) { if (T* derived_ptr = dynamic_cast(named_ptr)) return derived_ptr; throw wrong_type_cast(); } //. Safely extracts typed Declarations from Named types. The type is first //. safely cast to Types::Declared, then the declaration() safely cast to //. the template type. template T* declared_cast(Named* named_ptr) throw (wrong_type_cast) { if (Declared* declared_ptr = dynamic_cast(named_ptr)) if (ASG::Declaration* decl = declared_ptr->declaration()) if (T* derived_ptr = dynamic_cast(decl)) return derived_ptr; throw wrong_type_cast(); } //. Safely extracts typed Declarations from Type types. The type is first //. safely cast to Types::Declared, then the declaration() safely cast to //. the template type. template T* declared_cast(Type* type_ptr) throw (wrong_type_cast) { if (Declared* declared_ptr = dynamic_cast(type_ptr)) if (ASG::Declaration* decl = declared_ptr->declaration()) if (T* derived_ptr = dynamic_cast(decl)) return derived_ptr; throw wrong_type_cast(); } } // namespace Type #endif // vim: set ts=8 sts=4 sw=4 et: synopsis-0.12/Synopsis/Parsers/Cxx/Builder.hh0000664000076400007640000002113611122312026020567 0ustar stefanstefan// // Copyright (C) 2002 Stephen Davies // Copyright (C) 2002 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Builder_hh_ #define Builder_hh_ #include #include "ASG.hh" #include "QName.hh" // Forward declare some Types::Types namespace Types { class Type; class Base; class Named; class Unknown; class TemplateType; class FuncPtr; class Dependent; } // Forward declare the Walker class class Walker; // Forward declare the Lookup class class Lookup; class ScopeInfo; typedef std::vector ScopeSearch; // TODO: move to common //. Enumeration of namespace types for use in Builder::start_namespace() enum NamespaceType { NamespaceNamed, //.< Normal, named, namespace. name is its given name NamespaceAnon, //.< An anonymous namespace. name is the filename NamespaceUnique, //.< A unique namespace. name is the type (for, while, etc.) NamespaceTemplate, //.< A template namespace. name is empty }; //. ASG Builder. //. This class manages the building of an ASG, including queries on the //. existing ASG such as name and type lookups. The building functions are //. called by Walker as it walks the parse tree. class Builder { friend class Lookup; public: //. Constructor Builder(ASG::SourceFile* file); //. Destructor. Recursively destroys all ASG objects ~Builder(); //. Sets the swalker void set_walker(Walker* walker) { m_walker = walker; } //. Changes the current accessability for the current scope void set_access(ASG::Access); //. Returns the current file ASG::SourceFile* file() const { return m_file; } //. Changes the current file void set_file(ASG::SourceFile*); //. Returns the list of builtin decls ("__null_t", "true", etc.) const ASG::Declaration::vector& builtin_decls() const; // // State Methods // //. Returns the current scope ASG::Scope* scope() { return m_scope; } //. Returns the current ScopeInfo for the current Scope ScopeInfo* scopeinfo() { return m_scopes.back(); } //. Returns the global scope ASG::Scope* global() { return m_global; } //. Returns the Lookup object for the builder Lookup* lookup() { return m_lookup; } // // ASG Methods // //. Add the given Declaration to the current scope. If is_template is true, //. then it is added to the parent of the current scope, assuming that the //. current scope is the temporary template scope void add(ASG::Declaration* declaration, bool is_template = false); //. Add the given non-declaration type to the current scope void add(Types::Named* named); //. Adds the given Macros to the global scope. This method should only be //. called once, with the macros stored in order from the preprocessing //. stage. void add_macros(const std::vector&); //. Construct and open a new Namespace. The Namespace becomes the //. current scope, and the old one is pushed onto the stack. If name is //. empty then a unique name is generated of the form `ns1 ASG::Namespace* start_namespace(const std::string& name, NamespaceType type); //. End the current namespace and pop the previous Scope off the stack void end_namespace(); //. Starts a new template namespace ASG::Namespace* start_template(); //. End the current template namespace void end_template(); //. Construct and open a new Class. The Class becomes the current scope, //. and the old one is pushed onto the stack. The type argument is the //. type, ie: "class" or "struct". This is tested to determine the default //. accessability. If this is a template class, the templ_params vector must //. be non-null pointer ASG::Class* start_class(int, const std::string& type, const std::string& name, ASG::Parameter::vector* templ_params, std::string const &primary_name); //. Construct and open a new Class with a qualified name ASG::Class* start_class(int, const std::string& type, const QName& names); //. Update the search to include base classes. Call this method after //. startClass(), and after filling in the parents() vector of the returned //. ASG::Class object. After calling this method, name and type lookups //. will correctly search the base classes of this class. void update_class_base_search(); //. End the current class and pop the previous Scope off the stack void end_class(); //. Start function impl scope void start_function_impl(const QName& name); //. End function impl scope void end_function_impl(); //. Add an function ASG::Function* add_function(int, const std::string& name, const std::vector& premod, Types::Type* ret, const std::vector& postmod, const std::string& realname, ASG::Parameter::vector* templ_params); //. Add a variable ASG::Variable* add_variable(int, const std::string& name, Types::Type* vtype, bool constr, const std::string& type); //. Add a const ASG::Const* add_constant(int, const std::string& name, Types::Type* ctype, std::string const &type, std::string const &value = ""); //. Add a variable to represent 'this', iff we are in a method void add_this_variable(); //. Add a typedef ASG::Typedef* add_typedef(int, const std::string& name, Types::Type* alias, bool constr); //. Add an enumerator ASG::Enumerator* add_enumerator(int, const std::string& name, const std::string& value); //. Add an enum ASG::Enum* add_enum(int, const std::string& name, const ASG::Enumerator::vector &); //. Add a tail comment. This will be a builtin with name 'EOS' ASG::Builtin *add_tail_comment(int line); // // Using methods // //. Add a using directive. ASG::UsingDirective *add_using_directive(int, Types::Named* type); //. Add a namespace alias using declaration. void add_aliased_using_namespace(Types::Named* type, const std::string& alias); //. Add a using declaration. ASG::UsingDeclaration *add_using_declaration(int, Types::Named* type); //. Maps a scoped name into a vector of scopes and the final type. Returns //. true on success. bool mapName(const QName& name, std::vector&, Types::Named*&); //. Create a Base type for the given name in the current scope Types::Base* create_base(const std::string& name); //. Create a Dependent type for the given name in the current scope Types::Dependent* create_dependent(const std::string& name); //. Create an Unknown type for the given name in the current scope Types::Unknown* create_unknown(const QName& name); //. Create a Template type for the given name in the current scope Types::Template* create_template(const std::string& name, const std::vector&); //. Add an Unknown decl for given name if it doesnt already exist Types::Unknown* add_unknown(const std::string& name); //. Add an Templated Forward decl for given name if it doesnt already exist ASG::Forward* add_forward(int lineno, const std::string& name, const std::string &type, ASG::Parameter::vector* templ_params); private: //. Current file ASG::SourceFile* m_file; //. The global scope object ASG::Scope* m_global; //. Current scope object ASG::Scope* m_scope; //. A counter used to generate unique namespace names int m_unique; //. The stack of Builder::Scopes std::vector m_scopes; //. Private data which uses map struct Private; //. Private data which uses map instance Private* m; //. Return a ScopeInfo* for the given Declaration. This method first looks for //. an existing Scope* in the Private map. ScopeInfo* find_info(ASG::Scope*); //. Utility method to recursively add base classes to given search void add_class_bases(ASG::Class* clas, ScopeSearch& search); //. Formats the search of the given Scope for logging std::string dump_search(ScopeInfo* scope); //. Recursively adds 'target' as using in 'scope' void do_add_using_directive(ScopeInfo* target, ScopeInfo* scope); //. A class that compares Scopes class EqualScope; //. A pointer to the Walker. This is set explicitly by the Walker during //. its constructor (which takes a Builder). Walker* m_walker; //. A pointer to the Lookup Lookup* m_lookup; }; #endif synopsis-0.12/Synopsis/Parsers/Cxx/ASG.cc0000664000076400007640000002101411171267677017625 0ustar stefanstefan// // Copyright (C) 2002 Stephen Davies // Copyright (C) 2002 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include "STrace.hh" #include "ASG.hh" #include "Types.hh" using namespace ASG; void SourceFile::add_macro_call(char const *name, long l, long col, long sl, long sc, long el, long ec, long o, bool c) { Line &line = macro_calls_[l]; line.insert(MacroCall(name, col, sl, sc, el, ec, o, c)); } int SourceFile::map_column(int l, int col) { Lines::iterator i = macro_calls_.find(l); if (i == macro_calls_.end()) return col; Line &line = i->second; int offset = 0; for (Line::iterator j = line.begin(), end = line.end(); j != end && j->start_column <= col; ++j) { if (j->end_column == -1 || col <= j->end_column) return -1; offset = j->offset; } return col - offset; } // // ASG::Include // Include::Include(SourceFile* target, bool is_macro, bool is_next) : m_target(target), m_is_macro(is_macro), m_is_next(is_next) { } // // ASG::Declaration // Declaration::Declaration(SourceFile* file, int line, const std::string& type, const QName& name) : m_file(file), m_line(line), m_type(type), m_name(name), m_access(Default), m_declared(0) {} Declaration::~Declaration() { } void Declaration::accept(Visitor* visitor) { visitor->visit_declaration(this); } const Types::Declared* Declaration::declared() const { if (!m_declared) // Constness of 'this' is preserved through const return type m_declared = new Types::Declared(m_name, const_cast(this)); return m_declared; } Types::Declared* Declaration::declared() { if (!m_declared) m_declared = new Types::Declared(m_name, this); return m_declared; } // // ASG::Builtin // Builtin::Builtin(SourceFile* file, int line, const std::string &type, const QName& name) : Declaration(file, line, type, name) { } Builtin::~Builtin() { } void Builtin::accept(Visitor* visitor) { visitor->visit_builtin(this); } // // ASG::Macro // Macro::Macro(SourceFile* file, int line, const QName& name, Parameters* params, const std::string& text) : Declaration(file, line, "macro", name), m_parameters(params), m_text(text) { } Macro::~Macro() { } void Macro::accept(Visitor* visitor) { visitor->visit_macro(this); } // // ASG::Scope // Scope::Scope(SourceFile* file, int line, const std::string& type, const QName& name) : Declaration(file, line, type, name) { } Scope::~Scope() {} void Scope::accept(Visitor* visitor) { visitor->visit_scope(this); } // // ASG::Namespace // Namespace::Namespace(SourceFile* file, int line, const std::string& type, const QName& name) : Scope(file, line, type, name) {} Namespace::~Namespace() {} void Namespace::accept(Visitor* visitor) { visitor->visit_namespace(this); } // // ASG::Class // Class::Class(SourceFile* file, int line, const std::string& type, const QName& name, bool is_template_specialization) : Scope(file, line, type, name), is_template_specialization_(is_template_specialization) {} Class::~Class() {} void Class::accept(Visitor* visitor) { visitor->visit_class(this);} // // ASG::ClassTemplate // ClassTemplate::ClassTemplate(SourceFile* file, int line, const std::string& type, const QName& name, bool is_specialization) : Class(file, line, type, name, is_specialization), template_(0) {} ClassTemplate::~ClassTemplate() {} void ClassTemplate::accept(Visitor* visitor) { visitor->visit_class_template(this);} // // ASG::Inheritance // Inheritance::Inheritance(Types::Type* type, const Attributes& attrs) : m_parent(type), m_attrs(attrs) { } void Inheritance::accept(Visitor* visitor) { visitor->visit_inheritance(this); } // // ASG::Forward // Forward::Forward(SourceFile* file, int line, const std::string& type, const QName& name, bool is_template_specialization) : Declaration(file, line, type, name), template_(0), is_template_specialization_(is_template_specialization) {} void Forward::accept(Visitor* visitor) { visitor->visit_forward(this); } // // ASG::Typedef // Typedef::Typedef(SourceFile* file, int line, const std::string& type, const QName& name, Types::Type* alias, bool constr) : Declaration(file, line, type, name), m_alias(alias), m_constr(constr) { } Typedef::~Typedef() {} void Typedef::accept(Visitor* visitor) { visitor->visit_typedef(this); } // // ASG::Variable // Variable::Variable(SourceFile* file, int line, const std::string& type, const QName& name, Types::Type* vtype, bool constr) : Declaration(file, line, type, name), m_vtype(vtype), m_constr(constr) { } Variable::~Variable() {} void Variable::accept(Visitor* visitor) { visitor->visit_variable(this); } // // ASG::Const // Const::Const(SourceFile* file, int line, const std::string& type, const QName& name, Types::Type* t, const std::string& v) : Declaration(file, line, type, name), m_ctype(t), m_value(v) { } void Const::accept(Visitor* visitor) { visitor->visit_const(this); } // // ASG::Enum // Enum::Enum(SourceFile* file, int line, const std::string& type, const QName& name) : Declaration(file, line, type, name) { } Enum::~Enum() {} void Enum::accept(Visitor* visitor) { visitor->visit_enum(this); } // // ASG::Enumerator // Enumerator::Enumerator(SourceFile* file, int line, const std::string& type, const QName& name, const std::string& value) : Declaration(file, line, type, name), m_value(value) { } void Enumerator::accept(Visitor* visitor) { visitor->visit_enumerator(this); } // // ASG::Function // Function::Function( SourceFile* file, int line, const std::string& type, const QName& name, const Mods& premod, Types::Type* ret, const Mods& postmod, const std::string& realname ) : Declaration(file, line, type, name), m_pre(premod), m_ret(ret), m_post(postmod), m_realname(realname), m_template(0) {} Function::~Function() {} void Function::accept(Visitor* visitor) { visitor->visit_function(this); } // // ASG::Operation // Operation::Operation( SourceFile* file, int line, const std::string& type, const QName& name, const Mods& premod, Types::Type* ret, const Mods& postmod, const std::string& realname ) : Function(file, line, type, name, premod, ret, postmod, realname) { } void Operation::accept(Visitor* visitor) { visitor->visit_operation(this); } // // ASG::Parameter // Parameter::Parameter(const Mods& pre, Types::Type* t, const Mods& post, const std::string& name, const std::string& value) : m_pre(pre), m_post(post), m_type(t), m_name(name), m_value(value) { } Parameter::~Parameter() {} void Parameter::accept(Visitor* visitor) { visitor->visit_parameter(this); } void UsingDirective::accept(Visitor* visitor) { visitor->visit_using_directive(this); } UsingDeclaration::UsingDeclaration(SourceFile* file, int line, QName const& name, Types::Named *d) : Declaration(file, line, "using", name), m_target(d) {} void UsingDeclaration::accept(Visitor* visitor) { visitor->visit_using_declaration(this); } Comment::Comment(SourceFile* file, int line, const std::string& text, bool suspect) : m_file(file), m_line(line), m_text(text), m_suspect(suspect) { } // // AST::Visitor // Visitor::~Visitor() {} void Visitor::visit_declaration(Declaration*) {} void Visitor::visit_builtin(Builtin*) {} void Visitor::visit_macro(Macro* d) { visit_declaration(d); } void Visitor::visit_scope(Scope* d) { visit_declaration(d); } void Visitor::visit_namespace(Namespace* d) { visit_scope(d); } void Visitor::visit_class(Class* d) { visit_scope(d); } void Visitor::visit_class_template(ClassTemplate* d) { visit_class(d); } void Visitor::visit_inheritance(Inheritance* d) {} void Visitor::visit_forward(Forward* d) { visit_declaration(d); } void Visitor::visit_typedef(Typedef* d) { visit_declaration(d); } void Visitor::visit_variable(Variable* d) { visit_declaration(d); } void Visitor::visit_const(Const* d) { visit_declaration(d); } void Visitor::visit_enum(Enum* d) { visit_declaration(d); } void Visitor::visit_enumerator(Enumerator* d) { visit_declaration(d); } void Visitor::visit_function(Function* d) { visit_declaration(d); } void Visitor::visit_operation(Operation* d) { visit_function(d); } void Visitor::visit_parameter(Parameter* d) { } void Visitor::visit_using_directive(UsingDirective* u) { } void Visitor::visit_using_declaration(UsingDeclaration* u) { } // vim: set ts=8 sts=4 sw=4 et: synopsis-0.12/Synopsis/Parsers/Cxx/__init__.py0000664000076400007640000000540311171367565021016 0ustar stefanstefan# # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # """Parser for C++ using OpenC++ for low-level parsing. This parser is written entirely in C++, and compiled into shared libraries for use by python. @see C++/Synopsis @see C++/SWalker """ from Synopsis.Processor import * import ParserImpl import os, os.path, tempfile class Parser(Processor): preprocess = Parameter(True, 'whether or not to preprocess the input') emulate_compiler = Parameter('', 'a compiler to emulate') compiler_flags = Parameter([], 'list of flags for the emulated compiler') cppflags = Parameter([], 'list of preprocessor flags such as -I or -D') primary_file_only = Parameter(True, 'should only primary file be processed') base_path = Parameter('', 'path prefix to strip off of the file names') sxr_prefix = Parameter(None, 'path prefix (directory) to contain sxr info') def process(self, ir, **kwds): self.set_parameters(kwds) if not self.input: raise MissingArgument('input') self.ir = ir if self.preprocess: from Synopsis.Parsers import Cpp cpp = Cpp.Parser(base_path = self.base_path, language = 'C++', flags = self.cppflags, emulate_compiler = self.emulate_compiler, compiler_flags = self.compiler_flags) for file in self.input: ii_file = file if self.preprocess: if self.output: ii_file = os.path.splitext(self.output)[0] + '.ii' else: ii_file = os.path.join(tempfile.gettempdir(), 'synopsis-%s.ii'%os.getpid()) self.ir = cpp.process(self.ir, cpp_output = ii_file, input = [file], primary_file_only = self.primary_file_only, verbose = self.verbose, debug = self.debug) try: self.ir = ParserImpl.parse(self.ir, ii_file, os.path.abspath(file), self.primary_file_only, os.path.abspath(self.base_path) + os.sep, self.sxr_prefix, self.verbose, self.debug) finally: if self.preprocess: os.remove(ii_file) return self.output_and_return_ir() synopsis-0.12/Synopsis/Parsers/Cxx/configure0000775000076400007640000042114711171624013020603 0ustar stefanstefan#! /bin/sh # From configure.ac Revision: 1.9 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for occ 0.8. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='occ' PACKAGE_TARNAME='occ' PACKAGE_VERSION='0.8' PACKAGE_STRING='occ 0.8' PACKAGE_BUGREPORT='synopsis-devel@fresco.org' ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP CXX CXXFLAGS ac_ct_CXX SYN_CPP SYN_LIBS PYTHON PYTHON_INCLUDE LIBEXT LDSHARED topdir LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP CXX CXXFLAGS CCC' # 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. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_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 ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_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'` 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 ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_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'` 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; }; } 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 directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $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 test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures occ 0.8 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/occ] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of occ 0.8:";; esac cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-syn-cxx=PATH specify the Synopsis C++ library prefix --with-python=PATH specify the Python interpreter Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF occ configure 0.8 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by occ $as_me 0.8, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file 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 $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { 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 # Check whether --with-syn-cxx was given. if test "${with_syn_cxx+set}" = set; then withval=$with_syn_cxx; SYN_CXX="$with_syn_cxx" else SYN_CXX="/usr/local" 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { 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` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then 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 # Check that 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' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 that 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 { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { 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 ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { 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` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { 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 ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { 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 g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { 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 if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { 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 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 SYN_CPP="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --cflags synopsis-uninstalled`" SYN_LIBS="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --libs synopsis-uninstalled`" { echo "$as_me:$LINENO: checking for python extension module build information" >&5 echo $ECHO_N "checking for python extension module build information... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: " >&5 echo "${ECHO_T}" >&6; } # Check whether --with-python was given. if test "${with_python+set}" = set; then withval=$with_python; PYTHON="$with_python" else PYTHON="python" fi if test -n "$PYTHON" -a "$PYTHON" != yes; then # Extract the first word of "$PYTHON", so it can be a program name with args. set dummy $PYTHON; 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_PYTHON+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$PYTHON"; then ac_cv_prog_PYTHON="$PYTHON" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PYTHON="{ { echo "$as_me:$LINENO: error: Cannot find Python interpreter" >&5 echo "$as_me: error: Cannot find Python interpreter" >&2;} { (exit 1); exit 1; }; }" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PYTHON=$ac_cv_prog_PYTHON if test -n "$PYTHON"; then { echo "$as_me:$LINENO: result: $PYTHON" >&5 echo "${ECHO_T}$PYTHON" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi else # Extract the first word of "python2 python", so it can be a program name with args. set dummy python2 python; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_PYTHON+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $PYTHON in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_PYTHON" && ac_cv_path_PYTHON="python" ;; esac fi PYTHON=$ac_cv_path_PYTHON if test -n "$PYTHON"; then { echo "$as_me:$LINENO: result: $PYTHON" >&5 echo "${ECHO_T}$PYTHON" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi PYTHON_PREFIX=`$PYTHON -c "import sys; print(sys.prefix)" | tr -d "\r"` { echo "$as_me:$LINENO: checking for Python development environment" >&5 echo $ECHO_N "checking for Python development environment... $ECHO_C" >&6; } PYTHON_INCLUDE=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_inc())" | tr -d "\r"` PYTHON_H=`$PYTHON -c "from os.path import *; h = join('$PYTHON_INCLUDE', 'Python.h'); print(exists(h) and h or '')"` if test $PYTHON_H then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else { { echo "$as_me:$LINENO: error: Python.h not found." >&5 echo "$as_me: error: Python.h not found." >&2;} { (exit 1); exit 1; }; } fi LIBEXT=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_var('SO'))" | tr -d "\r"` case `uname -s` in CYGWIN*) if test `$PYTHON -c "import os; print(os.name)" | tr -d "\r"` = posix; then PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d'%(sys.version_info[0],sys.version_info[1]))"` PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" PYTHON_DEP_LIBS=`$PYTHON -c "from distutils import sysconfig; import re; print(re.sub(r'\\s*-lutil', '', sysconfig.get_config_var('LIBS') or ''))"` else if test "$CXX" = "g++"; then CPPFLAGS="$CPPFLAGS -D PARSE_MSVC" CFLAGS="-mno-cygwin $CFLAGS" CXXFLAGS="-mno-cygwin $CXXFLAGS" LDFLAGS="-mno-cygwin $LDFLAGS" PYTHON_VERSION=`$PYTHON -c "import sys; print('%d%d'%(sys.version_info[0],sys.version_info[1]))" | tr -d "\r"` PYTHON_LIBS="-L`cygpath -a $PYTHON_PREFIX | tr -d \"\r\"`/Libs -lpython$PYTHON_VERSION" fi PYTHON_INCLUDE=`cygpath -a $PYTHON_INCLUDE | tr -d "\r"` PYTHON_DEP_LIBS=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_var('LIBS') or '')" | tr -d "\r"` fi LDSHARED="$CXX -shared" CXXFLAGS="-D_REENTRANT $CXXFLAGS" LIBS="$LIBS $PYTHON_LIBS $PYTHON_DEP_LIBS" ;; Darwin) PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d'%(sys.version_info[0],sys.version_info[1]))"` PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" CFLAGS="$CFLAGS -fPIC" CXXFLAGS="$CXXFLAGS -fPIC" LDSHARED="$CXX -dynamiclib -Wl,-undefined,dynamic_lookup" ;; *) PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d'%(sys.version_info[0],sys.version_info[1]))"` PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" CFLAGS="$CFLAGS -fPIC" CXXFLAGS="$CXXFLAGS -fPIC" LDSHARED="$CXX -shared" ;; esac topdir=`$PYTHON -c "from os.path import *; print normpath('$srcdir/../../..')"` ac_config_files="$ac_config_files Makefile synopsis.py" mkdir -p occ mkdir -p syn cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${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 more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by occ $as_me 0.8, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" _ACEOF 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 and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ occ config.status 0.8 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' _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 ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "synopsis.py") CONFIG_FILES="$CONFIG_FILES synopsis.py" ;; *) { { 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 fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for 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 _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim CPP!$CPP$ac_delim CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim ac_ct_CXX!$ac_ct_CXX$ac_delim SYN_CPP!$SYN_CPP$ac_delim SYN_LIBS!$SYN_LIBS$ac_delim PYTHON!$PYTHON$ac_delim PYTHON_INCLUDE!$PYTHON_INCLUDE$ac_delim LIBEXT!$LIBEXT$ac_delim LDSHARED!$LDSHARED$ac_delim topdir!$topdir$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 57; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF 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&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; esac done # for ac_tag { (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 synopsis-0.12/Synopsis/Parsers/Cxx/QName.hh0000664000076400007640000000201211171617373020213 0ustar stefanstefan// // Copyright (C) 2002 Stephen Davies // Copyright (C) 2002 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef QName_hh_ #define QName_hh_ #include #include #include //. A qualified name, containing zero or more elements. This typedef makes it //. easier to use qualified name types, and also makes it clearer than using the //. raw vector in your code. typedef std::vector QName; //. Joins the elements of the qualified name using the separator string inline std::string join(QName const & strs, std::string const & sep = " ") { QName::const_iterator i = strs.begin(); if (i == strs.end()) return ""; std::string str = *i++; while (i != strs.end()) str += sep + *i++; return str; } //. Formats a QName to the output, joining the strings with ::'s. inline std::ostream& operator <<(std::ostream& out, QName const &name) { return out << join(name, "::"); } #endif synopsis-0.12/Synopsis/Parsers/Cxx/FakeGC.hh0000664000076400007640000000140411122312026020255 0ustar stefanstefan// // Copyright (C) 2001 Stephen Davies // Copyright (C) 2001 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef FakeGC_hh_ #define FakeGC_hh_ //. The fake Garbage Collector namespace namespace FakeGC { // Provide a very simple garbage collection mechanism: // All objects of this type are assumed to be heap-allocated. // During construction they build up a single-linked list, and once // the program is finished, the whole list is taken down by deleting // the first node. struct LightObject { LightObject() : next(head) { LightObject::head = this;} virtual ~LightObject() {} LightObject *next; static LightObject *head; }; } // namespace FakeGC #endif synopsis-0.12/Synopsis/Parsers/Cxx/ParserImpl.cc0000664000076400007640000001406511171162471021263 0ustar stefanstefan// // Copyright (C) 2000 Stefan Seefeld // Copyright (C) 2000 Stephen Davies // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include "Translator.hh" #include "SXRGenerator.hh" #include "Walker.hh" #include "Builder.hh" #include "Filter.hh" #include "FakeGC.hh" #include "exception.hh" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Synopsis; // // for now occ remains the 'C++ parser backend' for synopsis, // and GCC extension and MSVC tokens are activated in compatibility // mode. // Later this may become an option for the python frontend, too. // #if defined(__GNUG__) || defined(_GNUG_SYNTAX) # if defined(PARSE_MSVC) const int tokenset = Lexer::CXX | Lexer::GCC | Lexer::MSVC; const int ruleset = Parser::CXX | Parser::GCC | Parser::MSVC; # else const int tokenset = Lexer::CXX | Lexer::GCC; const int ruleset = Parser::CXX | Parser::GCC; # endif #else # if defined(PARSE_MSVC) const int tokenset = Lexer::CXX | Lexer::MSVC; const int ruleset = Parser::CXX | Parser::MSVC; # else const int tokenset = Lexer::CXX; const int ruleset = Parser::CXX; # endif #endif FakeGC::LightObject *FakeGC::LightObject::head = 0; bool verbose; // If true then everything but what's in the primary file will be stripped bool syn_primary_only; bool syn_fake_std; bool syn_multi_files; // If set then this is stripped from the start of all filenames const char* syn_base_path = ""; // If set then this is the prefix for the filename to store links to const char* syn_sxr_prefix = 0; PyObject *py_error; namespace { //. Override unexpected() to print a message before we abort void unexpected() { std::cout << "Warning: Aborting due to unexpected exception." << std::endl; throw std::bad_exception(); } const char *strip_prefix(const char *filename, const char *prefix) { if (!prefix) return filename; size_t length = strlen(prefix); if (strncmp(filename, prefix, length) == 0) return filename + length; return filename; } void error() { Walker *instance = Walker::instance(); std::cerr << "processing " << instance->current_file()->name() << " at line " << instance->current_lineno() << std::endl; } PyObject *parse(PyObject * /* self */, PyObject *args) { PTree::Encoding::do_init_static(); PyObject *ir; const char *src, *cppfile; int primary_file_only, verbose, debug; if (!PyArg_ParseTuple(args, "Ossizzii", &ir, &cppfile, &src, &primary_file_only, &syn_base_path, &syn_sxr_prefix, &verbose, &debug)) return 0; Py_INCREF(py_error); std::auto_ptr error_type(new Python::Object(py_error)); Py_INCREF(ir); if (verbose) ::verbose = true; if (debug) Trace::enable(Trace::ALL); if (primary_file_only) syn_primary_only = true; if (!src || *src == '\0') { PyErr_SetString(PyExc_RuntimeError, "no input file"); return 0; } std::ifstream ifs(cppfile); if(!ifs) { PyErr_SetString(PyExc_RuntimeError, "unable to open output file"); return 0; } std::set_unexpected(unexpected); ErrorHandler error_handler(error); // Setup the filter FileFilter filter(ir, src, syn_base_path, syn_primary_only); if (syn_sxr_prefix) filter.set_sxr_prefix(syn_sxr_prefix); ASG::SourceFile *source_file = filter.get_sourcefile(src); // Run OCC to generate the IR try { Buffer buffer(ifs.rdbuf(), source_file->abs_name()); Lexer lexer(&buffer, tokenset); SymbolFactory symbols(SymbolFactory::NONE); Parser parser(lexer, symbols, ruleset); PTree::Node *ptree = parser.parse(); Parser::ErrorList const &errors = parser.errors(); if (!errors.empty()) { for (Parser::ErrorList::const_iterator i = errors.begin(); i != errors.end(); ++i) (*i)->write(std::cerr); throw std::runtime_error("The input contains errors."); } else if (ptree) { FileFilter* filter = FileFilter::instance(); Builder builder(source_file); Walker walker(filter, &builder, &buffer); SXRGenerator *sxr_generator = 0; if (filter->should_xref(source_file)) { sxr_generator = new SXRGenerator(filter, &walker); walker.set_store_links(sxr_generator); } walker.translate(ptree); Translator translator(filter, ir); translator.set_builtin_decls(builder.builtin_decls()); translator.translate(builder.scope()); if (sxr_generator) sxr_generator->xref_macro_calls(); delete sxr_generator; } } catch (const std::exception &e) { Python::Object py_e((*error_type)(Python::Tuple(e.what()))); PyErr_SetObject(py_error, py_e.ref()); return 0; } catch (py_error_already_set const &) { return 0; } catch (...) { Python::Object py_e((*error_type)(Python::Tuple("internal error"))); PyErr_SetObject(py_error, py_e.ref()); return 0; } PTree::cleanup_gc(); while (FakeGC::LightObject::head) { FakeGC::LightObject *tmp = FakeGC::LightObject::head->next; delete FakeGC::LightObject::head; FakeGC::LightObject::head = tmp; } return ir; } PyMethodDef methods[] = {{(char*)"parse", parse, METH_VARARGS}, {0}}; } extern "C" void initParserImpl() { Python::Module module = Python::Module::define("ParserImpl", methods); module.set_attr("version", "0.10"); Python::Object processor = Python::Object::import("Synopsis.Processor"); Python::Object error_base = processor.attr("Error"); py_error = PyErr_NewException("ParserImpl.ParseError", error_base.ref(), 0); module.set_attr("ParseError", py_error); } synopsis-0.12/Synopsis/Parsers/Cxx/STrace.hh0000664000076400007640000001253411122312026020364 0ustar stefanstefan// // Copyright (C) 2000 Stephen Davies // Copyright (C) 2000 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef strace_hh_ #define strace_hh_ #include #include #include #include #include #include #include namespace Synopsis { namespace PTree { class Node;} } #ifndef DEBUG # define DEBUG 0 #endif #if DEBUG #define DO_TRACE //. A tracer class that can be used as a Guard around sections of code. The //. instances are kept in a class-static stack, and enter/leave messages are //. only printed when output is made at a given level. To work this, two //. indices to the stack level are used: slevel and dlevel. The Stack Level //. indicates the current depth of the stack, including non-displayed levels. //. The Display Level indicates the level up to which enter statements have //. been printed. Leave statements are only printed if slevel falls below //. dlevel. class STrace { //. A convenient typedef typedef std::list string_list; public: //. Constructor STrace(const std::string &s) : m_scope(s) { m_list.push_back(indent() + "entering " + m_scope); ++slevel; } //. Destructor, called when leaving a scope. Only print out leaving messages //. if the enter was displayed. ~STrace() { if (dlevel > --slevel) { // 'enter' message was displayed, so display leave message too std::cout << indent() << "leaving " << m_scope << std::endl; --dlevel; } else // 'enter' message wasn't displayed, so remove it from list m_list.pop_back(); } //. Insertion operator, used to start logging a line std::ostream& operator <<(const std::string& s) { // Catch up on skipped enter messages while (dlevel < slevel) { std::cout << m_list.front() << "\n"; m_list.pop_front(); ++dlevel; } // Start current log message at correct indent std::cout << indent() << s; return std::cout; } //. Insertion operator. Logs a Ptree std::ostream& operator<<(Synopsis::PTree::Node *p); // defined in swalker.cc //. Creates a new stringstream for use in buffering output std::ostringstream& new_stream() { if (stream) delete stream; stream = new std::ostringstream; *stream << m_scope << ": "; return *stream; } //. Returns a string derived from the buffer for output std::string get_stream_str() { if (stream) return stream->str(); return ""; } private: //. Returns a string representing the indent std::string indent() { return std::string(slevel, ' '); } //. The scope of this STrace object std::string m_scope; //. The Stack-Level and Display-Level indices static int slevel, dlevel; //. A StringStream used for buffering output static std::ostringstream* stream; //. The FIFO queue of skipped enter-messages static string_list m_list; }; //. An exception object indicating errors in translating the Ptree to an ASG. //. Upon invocation, will grab the error message stored by the ERROR macros in //. the STrace object class TranslateError : public std::exception { public: //. The message std::string message; //. The node that was being translated mutable Synopsis::PTree::Node *node; //. Constructor. Extracts the error message from the STracer (set by ERROR macros) TranslateError(STrace& trace, Synopsis::PTree::Node *p = 0) : node(p) { message = trace.get_stream_str(); trace << "Error: " << message << std::endl; } //. Copy constructor TranslateError(const TranslateError& e) : message(e.message), node(e.node) { } //. Destructor ~TranslateError() throw() {} //. overridden std::exception method (not that the original works too well) virtual const char* what() const throw () { return "TranslateError"; } //. Returns the error message std::string str() const { return message; } //. Sets a node for the error, if not already set. void set_node(Synopsis::PTree::Node *p) const { if (!node) node = p; } }; #define ERROR(message) (trace.new_stream() << message, TranslateError(trace)) #define nodeERROR(node, message) (trace.new_stream() << message, TranslateError(trace, node)) #define LOG(message) trace << message << std::endl #define nodeLOG(message) trace << message; #else // DEBUG //. Dummy STrace guard for release code - should be optimized away class STrace { public: STrace(const std::string &) { } ~STrace() { } }; //. Exception thrown by errors when translating the Ptree into an ASG class TranslateError : public std::exception { public: char const * str() { return ""; } virtual const char* what() const throw () { return "TranslateError"; } void set_node(Synopsis::PTree::Node *) const { } }; #define ERROR(message) TranslateError() #define nodeERROR(node, message) TranslateError() #define LOG(trash) #define nodeLOG(trash) #endif #endif // vim: set ts=8 sts=4 sw=4 et: synopsis-0.12/Synopsis/Parsers/Cxx/ScopeInfo.hh0000664000076400007640000000536111122312026021070 0ustar stefanstefan// // Copyright (C) 2001 Stephen Davies // Copyright (C) 2001 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef ScopeInfo_hh_ #define ScopeInfo_hh_ #include #include #include #include "QName.hh" #include "FakeGC.hh" class Dictionary; //. Forward declare ScopeInfo, used later in this file class ScopeInfo; //. Typedef for a Scope Search typedef std::vector ScopeSearch; //. This class encapsulates information about a Scope and its dictionary of names. //. Since the ASG::Scope is meant purely for documentation purposes, this //. class provides the extra information needed for operations such as name //. lookup (a dictionary of types, and links to using scopes). //. //. The using directives work as follows: Using directives effectively add all //. contained declarations to the namespace containing the directive, but they //. still need to be processed separately. To handle this each ScopeInfo //. remembers which other namespaces it is using {@see using_scopes}. //. //. One quirk is that all used namespaces are considered as a whole for //. overload resolution, *not* one at a time. To facilitate this 'dummy' //. scopeinfos are inserted into the ScopeSearch of a containing namespace, //. which the algorithms recognize. (TODO: consider a wrapper(?) a.la //. ASG::Inheritance) struct ScopeInfo : public FakeGC::LightObject { //. Constructor ScopeInfo(ASG::Scope* s); //. Constructor that creates a Dummy 'using' scope referencing 's' ScopeInfo(ScopeInfo* s); //. Destructor ~ScopeInfo(); //. Dictionary for this scope Dictionary* dict; //class Dictionary* dict; <-- used to be this, but it confuses parser //--->MAKE INTO TESTCASE!!! //. The declaration for this scope ASG::Scope* scope_decl; //. The list of scopes to search for this scope, including this ScopeSearch search; //. The list of scopes in the search because they are 'using'd ScopeSearch using_scopes; //. The list of scopes 'using' this one ScopeSearch used_by; //. True only if this is a dummy Scope representing the use of //. another. If this is the case, then only 'dict' is set bool is_using; //. Current accessability ASG::Access access; //. Counts of named sub-namespaces. The names are things like "if", "while" //. etc. This is for the purely aesthetic purpose of being able to name //. anonymous namespaces like "`if `while `if2 `do" instead of "`if1 `while2 //. `if3 `do4" or even "`0001 `0002 `0003 `0004" as OpenC++ does. std::map nscounts; int getCount(const std::string& name); }; #endif // vim: set ts=8 sts=4 sw=4 et: synopsis-0.12/Synopsis/Parsers/Cxx/Walker.cc0000664000076400007640000022224211123007403020416 0ustar stefanstefan// // Copyright (C) 2000 Stefan Seefeld // Copyright (C) 2000 Stephen Davies // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include #include #include #include #include #include #include #include "Walker.hh" #include "STrace.hh" #include "Types.hh" #include "ASG.hh" #include "Builder.hh" #include "Decoder.hh" #include "TypeIdFormatter.hh" #include "SXRGenerator.hh" #include "Lookup.hh" #include "Filter.hh" #include "Dictionary.hh" using namespace ASG; using Synopsis::Token; using Synopsis::Buffer; #ifdef DO_TRACE int STrace::slevel = 0, STrace::dlevel = 0; std::ostringstream* STrace::stream = 0; STrace::string_list STrace::m_list; std::ostream& STrace::operator <<(PTree::Node *p) { std::ostream& out = operator <<("-"); PTree::display(p, out, true); return out; } #endif namespace { //. Helper function to recursively find the first left-most leaf node PTree::Node *find_left_leaf(PTree::Node *node, PTree::Node *& parent) { if (!node || node->is_atom()) return node; // Non-leaf node. So find first leafy child PTree::Node *leaf; while (node) { if (node->car()) { // There is a child here.. if (node->car()->is_atom()) { // And this child is a leaf! return it and set parent parent = node; return node->car(); } if ((leaf = find_left_leaf(node->car(), parent))) // Not a leaf so try recursing on it return leaf; } // No leaves from car of this node, so try next cdr node = node->cdr(); } return 0; } PTree::Node *strip_cv_from_integral_type(PTree::Node *integral) { if(integral == 0) return 0; if(!integral->is_atom()) if(PTree::is_a(integral->car(), Token::CONST, Token::VOLATILE)) return PTree::second(integral); else if(PTree::is_a(PTree::second(integral), Token::CONST, Token::VOLATILE)) return integral->car(); return integral; } PTree::Node *get_class_or_enum_spec(PTree::Node *typespec) { PTree::Node *spec = strip_cv_from_integral_type(typespec); if(PTree::is_a(spec, Token::ntClassSpec, Token::ntEnumSpec)) return spec; return 0; } PTree::ClassSpec *get_class_template_spec(PTree::Node *body) { if(*PTree::third(body) == ';') { PTree::Node *spec = strip_cv_from_integral_type(PTree::second(body)); return static_cast(spec); } return 0; } } Walker *Walker::g_walker = 0; Walker::Walker(FileFilter* filter, Builder* builder, Buffer* buffer) : //Walker(buffer), my_builder(builder), my_filter(filter), my_buffer(buffer), my_decoder(new Decoder(my_builder)), my_declaration(0), my_in_typedef(false), my_defines_class_or_enum(false), my_template(0), my_lineno(0), my_file(0), sxr_(0), my_store_decl(false), my_type_formatter(new TypeIdFormatter()), my_function(0), my_type(0), my_scope(0), my_postfix_flag(Postfix_Var), my_in_template_decl(false) { g_walker = this; // FIXME: is this needed? my_builder->set_walker(this); my_lookup = my_builder->lookup(); } // Destructor Walker::~Walker() { delete my_decoder; delete my_type_formatter; } // The name returned is just the node's text if the node is a leaf. Otherwise, // the ToString method of Ptree is used, which is rather expensive since it // creates a temporary write buffer and reifies the node tree into it. std::string Walker::parse_name(PTree::Node *node) const { return PTree::reify(node); } void Walker::set_store_links(SXRGenerator* sxr) { sxr_ = sxr; } int Walker::line_of_ptree(PTree::Node *node) { update_line_number(node); return my_lineno; } // Updates the line number stored in this Walker instance, and the filename // stored in the Builder instance at my_builder. The filename is only set if // the actual char* changed (which only happens when the preprocessor places // another #line directive) void Walker::update_line_number(PTree::Node *ptree) { // Ask the Parser for the linenumber of the ptree. This used to be // expensive until I hacked buffer.cc to cache the last line number found. // Now it's okay as long as you are looking for lines sequentially. std::string filename; my_lineno = my_buffer->origin(ptree->begin(), filename); if (filename != my_filename) { my_filename = filename; my_file = my_filter->get_sourcefile(my_filename.c_str()); my_builder->set_file(my_file); } } ASG::Comment * make_Comment(SourceFile* file, int line, PTree::Node *first, bool suspect=false) { return new ASG::Comment(file, line, PTree::reify(first), suspect); } PTree::Atom *make_Leaf(const char *pos, size_t len) { return new PTree::Atom(pos, len); } // Adds the given comments to the given declaration. void Walker::add_comments(ASG::Declaration* decl, PTree::Node *node) { if (!node) return; std::vector comments; // First, make sure that node is a list of comments if (PTree::type_of(node) == Token::ntDeclaration) node = static_cast(node)->get_comments(); // Loop over all comments in the list bool suspect = false; for (PTree::Node *next = PTree::rest(node); node && !node->is_atom(); next = PTree::rest(node)) { PTree::Node *first = PTree::first(node); if (!first || !first->is_atom()) { node = next; continue; } // Check if comment is continued, eg: consecutive C++ comments while (next && PTree::first(next) && PTree::first(next)->is_atom()) { if (!strncmp(first->position() + first->length() - 2, "*/", 2)) break; if (strncmp(PTree::first(next)->position(), "//", 2)) break; const char *next_pos = PTree::first(next)->position(); const char *start_pos = PTree::first(node)->position(); const char *curr_pos = start_pos + PTree::first(node)->length(); // Must only be whitespace between current comment and next // and only one newline int newlines = 0; while (curr_pos < next_pos && strchr(" \t\r\n", *curr_pos)) if (*curr_pos == '\n' && newlines > 0) break; else if (*curr_pos++ == '\n') ++newlines; if (curr_pos < next_pos) break; // Current comment stretches to end of next int len = int(next_pos - start_pos + PTree::first(next)->length()); //node->SetCar(first = new Leaf(start_pos, len)); node->set_car(first = make_Leaf(start_pos, len)); // Skip the combined comment next = PTree::rest(next); } // all comments that are not immediately (i.e. separated // by a single new line) followed by a declaration are // marked as 'suspect' suspect = false; const char *pos = first->position() + first->length(); while (*pos && strchr(" \t\r", *pos)) ++pos; if (*pos == '\n') { ++pos; // Found only allowed \n while (*pos && strchr(" \t\r", *pos)) ++pos; if (*pos == '\n' || !strncmp(pos, "/*", 2)) suspect = true; } if (decl) comments.push_back(PTree::reify(first)); if (sxr_) sxr_->long_span(first, "comment"); // Set first to 0 so we dont accidentally do them twice (eg: // when parsing expressions) node->set_car(0); node = next; } if (suspect) comments.push_back(""); // Now add the comments, if applicable if (decl) decl->comments() = comments; } // -- These methods implement add_comments for various node types that store // comment pointers void Walker::add_comments(ASG::Declaration* decl, PTree::CommentedAtom *node) { if (node) add_comments(decl, node->get_comments()); } void Walker::add_comments(ASG::Declaration* decl, PTree::Declaration* node) { if (node) add_comments(decl, node->get_comments()); } void Walker::add_comments(ASG::Declaration* decl, PTree::Declarator* node) { if (node) add_comments(decl, node->get_comments()); } void Walker::add_comments(ASG::Declaration* decl, PTree::NamespaceSpec* node) { if (node) add_comments(decl, node->get_comments()); } void Walker::find_comments(PTree::Node *node) { PTree::Node *parent; PTree::Node *leaf = find_left_leaf(node, parent); if (leaf) add_comments(0, dynamic_cast(leaf)); } PTree::Node *Walker::translate_arg_decl_list(bool, PTree::Node *, PTree::Node *) { STrace trace("Walker::translate_arg_decl_list NYI"); return 0; } PTree::Node *Walker::translate_initialize_args(PTree::Declarator*, PTree::Node *) { STrace trace("Walker::translate_initialize_args NYI"); return 0; } PTree::Node *Walker::translate_assign_initializer(PTree::Declarator*, PTree::Node *) { STrace trace("Walker::translate_assign_initializer NYI"); return 0; } // Format the given parameters. my_type_formatter is used to format the given // list of parameters into a string, suitable for use as the name of a // Function object. std::string Walker::format_parameters(ASG::Parameter::vector& params) { // TODO: Tell formatter to expand typedefs! Eg: this function uses a typedef // in implementation, but not for declaration in the class!!!!!! ASG::Parameter::vector::iterator iter = params.begin(), end = params.end(); if (iter == end) return "()"; // Set scope for formatter ASG::Scope* scope = my_builder->scope(); if (scope) my_type_formatter->push_scope(scope->name()); else my_type_formatter->push_scope(QName()); // Format the parameters one at a time std::ostringstream buf; buf << "(" << my_type_formatter->format((*iter++)->type()); while (iter != end) buf << "," << my_type_formatter->format((*iter++)->type()); buf << ")"; my_type_formatter->pop_scope(); return buf.str(); } void Walker::translate(PTree::Node *node) { STrace trace("Walker::translate"); try { if (node) node->accept(this); } catch (Dictionary::KeyError const &e) { std::cerr << "Unknown type '" << e.name << "'\n"; std::string filename; unsigned long line = my_buffer->origin(node->begin(), filename); std::cerr << " (" << filename << ":" << line << ")" << std::endl; throw; } catch (Dictionary::MultipleError const &e) { std::cerr << "Multiple definitions found for type '" << e.name << "'\n"; for (Dictionary::Type_vector::const_iterator i = e.types.begin(); i != e.types.end(); ++i) std::cerr << (*i)->name() << std::endl; throw; } // Debug and non-debug modes handle these very differently #if DEBUG catch (const TranslateError& e) { if (e.node) node = e.node; std::string filename; unsigned long line = my_buffer->origin(node->begin(), filename); LOG("Warning: An exception occurred:" << " (" << filename << ":" << line << ")"); LOG("- " << e.str()); } catch (const std::exception& e) { LOG("Warning: An exception occurred: " << e.what()); nodeLOG(node); } catch (...) { LOG("Warning: An exception occurred (unknown) at:"); nodeLOG(node); } #else catch (const TranslateError& e) { // This error usually means that the syntax highlighting failed, and // can be safely ignored } catch (const std::exception& e) { std::cerr << "Warning: An exception occurred: " << e.what() << std::endl; std::cerr << "At: "; std::string filename; unsigned long line = my_buffer->origin(node->begin(), filename); std::cerr << " (" << filename << ":" << line << ")" << std::endl; throw; } catch (...) { std::cerr << "Warning: An unknown exception occurred: " << std::endl; std::cerr << "At: "; std::string filename; unsigned long line = my_buffer->origin(node->begin(), filename); std::cerr << " (" << filename << ":" << line << ")" << std::endl; throw; } #endif } // Default translate, usually means a literal void Walker::visit(PTree::Atom *node) { STrace trace("Walker::visit(PTree::Atom *)"); // Determine type of node std::string s = PTree::reify(node); const char *str = s.c_str(); if ((*str >= '0' && *str <= '9') || *str == '.') { // Assume whole node is a number if (sxr_) sxr_->span(node, "literal"); // TODO: decide if Long, Float, Double, etc const char* num_type = (*str == '.' ? "double" : "int"); while (*++str) { if (*str >= '0' && *str <= '9') {} else if (*str == 'e' || *str == 'E') { // Might be followed by + or - ++str; if (*str == '+' || *str == '-') ++str; } else if (*str == '.') num_type = "double"; else if (*str == 'f' || *str == 'F') { num_type = "float"; break; } else if (*str == 'l' || *str == 'L') { if (strcmp(num_type, "int") == 0) num_type = "long"; else if (strcmp(num_type, "long") == 0) num_type = "long long"; else if (strcmp(num_type, "unsigned") == 0) num_type = "unsigned long"; else if (strcmp(num_type, "float") == 0) num_type = "long double"; else if (strcmp(num_type, "double") == 0) num_type = "long double"; else std::cerr << "Unknown num type: " << num_type << std::endl; } else if (*str == 'u' || *str == 'U') { if (strcmp(num_type, "int") == 0) num_type = "unsigned"; else if (strcmp(num_type, "long") == 0) num_type = "unsigned long"; else std::cerr << "Unknown num type: " << num_type << std::endl; } else break;// End of numeric constant } my_type = my_lookup->lookupType(num_type); } else if (*str == '\'') { // Whole node is a char literal if (sxr_) sxr_->span(node, "string"); my_type = my_lookup->lookupType("char"); } else if (*str == '"') { // Assume whole node is a string if (sxr_) sxr_->span(node, "string"); my_type = my_lookup->lookupType("char"); Types::Type::Mods pre, post; pre.push_back("const"); post.push_back("*"); my_type = new Types::Modifier(my_type, pre, post); } else if (*str == '/' && !node->is_atom()) { // Assume comment. Must be a list of comments! ASG::Declaration* decl; update_line_number(node); decl = my_builder->add_tail_comment(my_lineno); add_comments(decl, static_cast(node)); } else { #ifdef DEBUG STrace trace("Walker::TranslatePtree"); LOG("Warning: Unknown Ptree "<cdr()) if (i->car()) try { i->car()->accept(this);} catch (const TranslateError &) {} } void Walker::visit(PTree::CommentedAtom *node) { // The only purpose of this method is to filter // out those atoms that are used as end markers. // They can be recognized by having length() == 0. if (node->length() == 0) { // The begin of the node coincides with the start of the comment. update_line_number(node); ASG::Builtin *builtin = my_builder->add_tail_comment(my_lineno); add_comments(builtin, node); } else visit(static_cast(node)); } //. NamespaceSpec void Walker::visit(PTree::NamespaceSpec *node) { STrace trace("Walker::visit(PTree::NamespaceSpec *)"); update_line_number(node); PTree::Node *key = PTree::first(node); PTree::Node *id = PTree::second(node); PTree::Node *body = PTree::third(node); if (sxr_) sxr_->span(key, "keyword"); // Start the namespace ASG::Namespace* ns; if (id) { ns = my_builder->start_namespace(parse_name(id), NamespaceNamed); ns->set_file(my_file); } else ns = my_builder->start_namespace(my_file->name(), NamespaceAnon); add_comments(ns, static_cast(node)); if (sxr_ && PTree::first(id)) sxr_->xref(id, ns); // Translate the body translate(body); // End the namespace my_builder->end_namespace(); } //. [ : (public|private|protected|0) {, ...} ] std::vector Walker::translate_inheritance_spec(PTree::Node *node) { STrace trace("Walker::translate_inheritance_spec"); std::vector ispec; Types::Type *type; while (node) { node = node->cdr(); // skip : or , // the attributes std::vector attributes(PTree::length(node->car()) - 1); for (int i = 0; i != PTree::length(node->car()) - 1; ++i) { attributes[i] = parse_name(PTree::nth(node->car(), i)); if (sxr_) sxr_->span(PTree::nth(node->car(), i), "keyword"); } // look up the parent type PTree::Node *name = PTree::last(node->car())->car(); if (name->is_atom()) { try { type = my_lookup->lookupType(parse_name(name)); } catch (const TranslateError) { // Ignore error, and put an Unknown in, instead QName uname; uname.push_back(parse_name(name)); type = new Types::Unknown(uname); } } else { my_decoder->init(name->encoded_name()); type = my_decoder->decodeType(); } if (sxr_) sxr_->xref(name, type); node = node->cdr(); // add it to the list ispec.push_back(new ASG::Inheritance(type, attributes)); } return ispec; } void Walker::visit(PTree::ClassSpec *node) { STrace trace("Walker::visit(PTree::ClassSpec*)"); #if DEBUG trace << node; #endif ASG::Parameter::vector* is_template = my_template; my_template = 0; int size = PTree::length(node); PTree::Node *pClass = PTree::first(node); PTree::Node *pName = 0, *pInheritance = 0; PTree::ClassBody *pBody = 0; if (size == 2) { // Forward declaration // [ class|struct ] pName = PTree::nth(node, 1); std::string name = parse_name(pName); if (is_template) LOG("Templated class forward declaration " << name); ASG::Forward *class_ = my_builder->add_forward(my_lineno, name, parse_name(pClass), is_template); add_comments(class_, node->get_comments()); return; } else if (size == 4) { // [ class|struct [{ body }] ] pName = PTree::nth(node, 1); pInheritance = PTree::nth(node, 2); pBody = static_cast(PTree::nth(node, 3)); } else if (size == 3) // An anonymous struct. OpenC++ encodes us a unique // (may be qualified if nested) name // [ struct [nil nil] [{ ... }] ] pBody = static_cast(PTree::nth(node, 2)); else throw nodeERROR(node, "Class node has bad length: " << size); if (sxr_) sxr_->span(pClass, "keyword"); else update_line_number(node); // Create ASG.Class object ASG::Class *clas; std::string type = parse_name(pClass); PTree::Encoding enc = node->encoded_name(); my_decoder->init(enc); if (enc.at(0) == 'T') { Types::Parameterized* param = my_decoder->decodeTemplate(); // If a non-type param was found, its name will be '*' for (size_t i = 0; i < param->parameters().size(); i++) if (Types::Dependent* dep = dynamic_cast(param->parameters()[i])) { if (dep->name().size() == 1 && dep->name()[0] == "*") { // Find the value of this parameter std::string name = parse_name(PTree::nth(PTree::second(PTree::second(pName)), i*2)); dep->name()[0] = name; } } my_type_formatter->push_scope(my_builder->scope()->name()); std::string name = my_type_formatter->format(param); my_type_formatter->pop_scope(); std::string primary_name; if (pName) primary_name = parse_name(pName->is_atom() ? pName : PTree::first(pName)); clas = my_builder->start_class(my_lineno, type, name, is_template, primary_name); // TODO: figure out spec stuff, like what to do with vars, link to // original template, etc. } else if (enc.at(0) == 'Q') { QName names; my_decoder->decodeQualName(names); clas = my_builder->start_class(my_lineno, type, names); } else { std::string name = my_decoder->decodeName(); std::string primary_name; if (pName) primary_name = parse_name(pName->is_atom() ? pName : PTree::first(pName)); if (pName && !pName->is_atom()) primary_name = parse_name(PTree::first(pName)); clas = my_builder->start_class(my_lineno, type, name, is_template, primary_name); } if (sxr_ && pName) sxr_->xref(pName, clas); LOG("Translating class '" << clas->name() << "'"); // Translate the inheritance spec, if present if (pInheritance) { clas->parents() = translate_inheritance_spec(pInheritance); my_builder->update_class_base_search(); } add_comments(clas, node->get_comments()); // Push the impl stack for a cache of func impls my_func_impl_stack.push_back(FuncImplVec()); my_defines_class_or_enum = false; // Translate the body of the class bool in_template_decl = my_in_template_decl; my_in_template_decl = false; translate(pBody); // Translate any func impls inlined in the class FuncImplVec& vec = my_func_impl_stack.back(); FuncImplVec::iterator iter = vec.begin(); while (iter != vec.end()) translate_func_impl_cache(*iter++); my_func_impl_stack.pop_back(); my_builder->end_class(); my_in_template_decl = in_template_decl; my_defines_class_or_enum = true; } PTree::TemplateDecl * Walker::translate_class_template(PTree::TemplateDecl *def, PTree::ClassSpec *node) { STrace trace("Walker::translate_class_template"); ASG::Parameter::vector* old_params = my_template; update_line_number(def); my_builder->start_template(); try { translate_template_params(PTree::third(def)); visit(node); } catch (...) { my_builder->end_template(); my_template = old_params; throw; } my_builder->end_template(); my_template = old_params; return def; } void Walker::translate_template_params(PTree::Node *params) { STrace trace("Walker::translate_template_params"); my_template = new ASG::Parameter::vector; ASG::Parameter::vector& templ_params = *my_template; // Declare some default parameter values - these should not be modified! std::string name, value; ASG::Parameter::Mods pre_mods, post_mods; while (params) { PTree::Node *param = PTree::first(params); if (PTree::is_a(param, Token::ntParameterDecl)) param = PTree::rest(param); else if (PTree::is_a(PTree::first(param), Token::ntTemplateDecl)) param = PTree::first(param); nodeLOG(param); if (*PTree::first(param) == "class" || *PTree::first(param) == "typename") { Types::Dependent* dep = 0; // Ensure that there is an identifier (it is optional!) if (param->cdr() && PTree::second(param)) { dep = my_builder->create_dependent(parse_name(PTree::second(param))); my_builder->add(dep); } ASG::Parameter::Mods paramtype; paramtype.push_back(parse_name(PTree::first(param))); templ_params.push_back(new ASG::Parameter(paramtype, dep, post_mods, name, value)); } else if (*PTree::first(param) == "template") { // A template template parameter. Types::Dependent* dep = 0; if(PTree::nth(param, 5)) { dep = my_builder->create_dependent(parse_name(PTree::nth(param, 5))); my_builder->add(dep); } ASG::Parameter::Mods paramtype; std::string type = "template <" + parse_name(PTree::nth(param, 2)) + "> " + parse_name(PTree::nth(param, 4)); paramtype.push_back(type); templ_params.push_back(new ASG::Parameter(paramtype, dep, post_mods, name, value)); nodeLOG(param); } else { // This parameter specifies a value or something // FIXME can do a lot more here.. LOG("non-type template parameter! approximating.."); nodeLOG(param); PTree::Node *p = PTree::second(param); while (p && p->car() && p->car()->is_atom() && (*p->car() == '*' || *p->car() == '&')) p = PTree::rest(p); std::string name = parse_name(p); // FIXME: At this point name will contain the initializer, if it // was present. Search for '=' and assign everything after // that to the value. std::string::size_type v = name.find('='); if (v != std::string::npos) { value = name.substr(v + 1); while (value[0] == ' ') value.erase(value.begin()); name = name.substr(0, v - 1); } Types::Dependent* dep = my_builder->create_dependent(name); my_builder->add(dep); // Figure out the type of the param my_decoder->init(PTree::second(param)->encoded_type()); Types::Type* param_type = my_decoder->decodeType(); templ_params.push_back(new ASG::Parameter(pre_mods, param_type, post_mods, name, value)); } // Skip comma params = PTree::rest(PTree::rest(params)); } /* Types::Template* templ = new Types::Template(decl->name(), decl, templ_params); if (ASG::Class* clas = dynamic_cast(decl)) clas->set_template_type(templ); else if (ASG::Function* func = dynamic_cast(decl)) func->set_template_type(templ); std::ostrstream buf; buf << "template " << decl->type() << std::ends; decl->set_type(buf.str()); */ } PTree::TemplateDecl * Walker::translate_function_template(PTree::TemplateDecl *def, PTree::Node *node) { STrace trace("Walker::translate_function_template"); nodeLOG(def); nodeLOG(node); PTree::Declaration *decl = dynamic_cast(node); if (!decl) { LOG("Warning: Unknown node type in template"); nodeLOG(def); return 0; } LOG("Encoded name is: " << node->encoded_name()); ASG::Parameter::vector* old_params = my_template; update_line_number(def); my_builder->start_template(); try { translate_template_params(PTree::third(def)); visit(decl); } catch (...) { my_builder->end_template(); my_template = old_params; throw; } my_builder->end_template(); my_template = old_params; return 0; } //. Linkage Spec void Walker::visit(PTree::LinkageSpec *node) { STrace trace("Walker::visit(LinkageSpec*)"); translate(PTree::third(node)); } //. Block void Walker::visit(PTree::Block *node) { STrace trace("Walker::visit(PTree::Block *"); PTree::Node *rest = PTree::second(node); while (rest) { translate(rest->car()); rest = rest->cdr(); } PTree::Node *close = PTree::third(node); ASG::Declaration *decl; decl = my_builder->add_tail_comment(my_lineno); add_comments(decl, dynamic_cast(close)); } //. Brace void Walker::visit(PTree::Brace *node) { STrace trace("Walker::visit(PTree::Brace *)"); PTree::Node *rest = PTree::second(node); while (rest) { translate(rest->car()); rest = rest->cdr(); } PTree::Node *close = PTree::third(node); ASG::Declaration *decl; decl = my_builder->add_tail_comment(my_lineno); add_comments(decl, dynamic_cast(close)); } //. TemplateDecl void Walker::visit(PTree::TemplateDecl *node) { STrace trace("Walker::visit(PTree::TemplateDecl*)"); my_in_template_decl = true; PTree::Node *body = PTree::nth(node, 4); PTree::ClassSpec *class_spec = get_class_template_spec(body); // FIXME: We skip the template handling if the template argument list is empty. // For classes we can discover it being a specialization since the class name // reveals it (a template-id). // Not so for functions. Thus, we need to find a way to remember that a given // function is a specialization. if (PTree::third(node)) { if (class_spec) translate_class_template(node, class_spec); else translate_function_template(node, body); } else // explicit specialization { if (class_spec) visit(class_spec); else visit(static_cast(body)); } my_in_template_decl = false; } //. A typeof(expr) expression evaluates to the type of 'expr'. This is a GNU //. GCC extension! //. Since the OCC parser can't resolve the type properly, we try to do it here //. and modify the type of the declarations to set it PTree::Node *Walker::translate_typeof(PTree::Node *spec, PTree::Node *declarations) { STrace trace("Walker::translate_typeof"); return 0; nodeLOG(spec); PTree::Encoding enc = PTree::third(spec)->encoded_name(); LOG("The name is: " << enc); LOG("The type is: " << PTree::third(spec)->encoded_type()); // Find the type referred to by the expression if (!my_decoder->isName(enc)) { LOG("typeof is not a simple name: "); nodeLOG(spec); return 0; } std::string name = my_decoder->decodeName(enc); LOG("name is " << name); Types::Type* type = my_lookup->lookupType(name, true); // Find the declaration it refers to Types::Declared* declared = dynamic_cast(type); if (!declared) return 0; LOG("Looked up " << declared->name()); ASG::Declaration* decl = declared->declaration(); if (!decl) return 0; LOG("Declaration is " << decl->name()); // TODO: make this a visitor and support different things if (/*ASG::Function* func =*/ dynamic_cast(decl)) { LOG("decl is a function."); while (declarations) { PTree::Node *declarator = PTree::first(declarations); declarations = PTree::rest(declarations); if (PTree::type_of(declarator) == Token::ntDeclarator) ((PTree::Declarator*)declarator)->set_encoded_type("PFv_v"); else LOG("declarator is " << PTree::type_of(declarator)); } } else { LOG("unknown decl type"); } nodeLOG(declarations); return 0; } void Walker::visit(PTree::Declaration *node) { STrace trace("Walker::visit(PTree::Declaration *)"); #if DEBUG trace << node; #endif update_line_number(node); // Link any comments added because we are inside a function body if (sxr_) find_comments(node); my_declaration = node; bool in_typedef = my_in_typedef; my_in_typedef = false; my_store_decl = true; PTree::Node *decls = PTree::third(node); // Typespecifier may be a class {} etc. translate_type_specifier(PTree::second(node)); // Or it might be a typeof() if (PTree::second(node) && PTree::type_of(PTree::second(node)) == Token::ntTypeofExpr) translate_typeof(PTree::second(node), decls); if (PTree::is_a(decls, Token::ntDeclarator)) { // A single declarator is probably a function impl, but could also be // the declarator in an if or switch condition PTree::Encoding enc = decls->encoded_type(); if (!enc.empty()) { // A function may be const, skip the C PTree::Encoding::iterator i = enc.begin(); while (*i == 'C') ++i; if (*i != 'F') { // Not a function translate_declarator(decls); my_declaration = 0; return; } } translate_function_implementation(node); } else // if it is a function prototype or a variable declaration. if (!decls->is_atom()) // if it is not ";" translate_declarators(decls); my_in_typedef = in_typedef; my_declaration = 0; } PTree::Node * Walker::translate_declarators(PTree::Node *decls) { STrace trace("Walker::translate_declarators"); PTree::Node *rest = decls, *p; while (rest != 0) { p = rest->car(); if (PTree::is_a(p, Token::ntDeclarator)) { translate_declarator(p); my_store_decl = false; } // if. There is no else..? rest = rest->cdr(); // Skip comma if (rest != 0) rest = rest->cdr(); } return 0; } //. translate_declarator //. Function proto: //. [ { * | & }* name ( [params] ) ] //. param: //. [ [types] { [ { * | & }* name ] { = value } } ] PTree::Node * Walker::translate_declarator(PTree::Node *decl) { // REVISIT: Figure out why this method is so HUGE! STrace trace("Walker::translate_declarator"); // Insert code from occ.cc here PTree::Encoding encname = decl->encoded_name(); PTree::Encoding enctype = decl->encoded_type(); if (encname.empty() || enctype.empty()) { std::cerr << "encname or enctype empty !" << std::endl; return 0; } try { // Decide if this is a function or variable my_decoder->init(enctype); code_iter& iter = my_decoder->iter(); bool is_const = false; while (*iter == 'C') { ++iter; is_const = true; } if (*iter == 'F') return translate_function_declarator(decl, is_const); else return translate_variable_declarator(decl, is_const); } catch (const TranslateError& e) { e.set_node(decl); throw; } return 0; } PTree::Node * Walker::translate_function_declarator(PTree::Node *decl, bool is_const) { STrace trace("Walker::translate_function_declarator"); ASG::Parameter::vector* is_template = my_template; my_template = 0; code_iter& iter = my_decoder->iter(); PTree::Encoding encname = decl->encoded_name(); // This is a function. Skip the 'F' ++iter; // Create parameter objects PTree::Node *p_params = PTree::rest(decl); while (p_params && p_params->car() && *p_params->car() != '(') p_params = PTree::rest(p_params); if (!p_params) { std::string filename; unsigned long lineno = my_buffer->origin(decl->begin(), filename); std::cerr << "Warning: error finding params for '" << PTree::reify(decl) << "\' (at " << filename << ':' << lineno << ')' << std::endl; return 0; } std::vector params; translate_parameters(PTree::second(p_params), params); my_param_cache = params; // Figure out the return type: while (*iter++ != '_') {} // in case of decoding error this is needed Types::Type* returnType = my_decoder->decodeType(); // Figure out premodifiers std::vector premod; PTree::Node *p = PTree::first(my_declaration); while (p) { premod.push_back(PTree::reify(p->car())); p = PTree::rest(p); } ASG::Function* func = 0; // Find name: if (encname.at(0) == 'Q') { // The name is qualified, which introduces a bit of difficulty std::vector names; my_decoder->init(encname); my_decoder->decodeQualName(names); names.back() += format_parameters(params); // A qual name must already be declared, so find it: try { Types::Named* named_type = my_lookup->lookupType(names, true); func = Types::declared_cast(named_type); } catch (const Types::wrong_type_cast &) { throw ERROR("Qualified function name wasn't a function:" << names); } // expand param info, since we now have names for them std::vector::iterator piter = func->parameters().begin(); std::vector::iterator pend = func->parameters().end(); std::vector::iterator new_piter = params.begin(); while (piter != pend) { ASG::Parameter* param = *piter++, *new_param = *new_piter++; if (!param->name().size() && new_param->name().size()) param->set_name(new_param->name()); } } else { // Decode the function name std::string realname; translate_function_name(encname, realname, returnType); // Name is same as realname, but with parameters added std::string name = realname + format_parameters(params); // Append const after params if this is a const function // Figure out postmodifiers std::vector postmod; if (is_const) { name += "const"; postmod.push_back("const"); } // Create ASG::Function object func = my_builder->add_function(my_lineno, name, premod, returnType, postmod, realname, is_template); func->parameters() = params; } add_comments(func, my_declaration); add_comments(func, dynamic_cast(decl)); // if storing links, find name if (sxr_) { // Store for use by TranslateFunctionImplementation my_function = func; // Do decl type first if (my_store_decl && PTree::second(my_declaration)) sxr_->xref(PTree::second(my_declaration), returnType); p = decl; while (p && p->car()->is_atom() && (*p->car() == '*' || *p->car() == '&')) p = PTree::rest(p); if (p) // p should now be at the name sxr_->xref(p->car(), func); } return 0; } PTree::Node* Walker::translate_variable_declarator(PTree::Node *decl, bool is_const) { STrace trace("translate_variable_declarator"); // Variable declaration. Restart decoding PTree::Encoding encname = decl->encoded_name(); PTree::Encoding enctype = decl->encoded_type(); my_decoder->init(enctype); // Get type Types::Type* type = my_decoder->decodeType(); std::string name; if (my_decoder->isName(encname)) name = my_decoder->decodeName(encname); else if (encname.at(0) == 'Q') { LOG("Scoped name in variable decl!"); nodeLOG(decl); return 0; } else { LOG("Unknown name in variable decl!"); nodeLOG(decl); return 0; } // TODO: implement sizes support std::vector sizes; std::string var_type = my_builder->scope()->type(); if (var_type == "class" || var_type == "struct" || var_type == "union") var_type = "data member"; else { if (var_type == "function") var_type = "local"; var_type += is_const ? " constant" : " variable"; } ASG::Declaration* var; if (is_const) { std::string value; if (PTree::length(decl) == 3) value = PTree::reify(PTree::nth(decl, 2)); var = my_builder->add_constant(my_lineno, name, type, var_type, value); } else var = my_builder->add_variable(my_lineno, name, type, false, var_type); add_comments(var, my_declaration); add_comments(var, dynamic_cast(decl)); // if storing links, find name if (sxr_) { // Do decl type first if (my_store_decl && PTree::second(my_declaration)) sxr_->xref(PTree::second(my_declaration), type); PTree::Node *p = decl; while (p && p->car()->is_atom() && (*p->car() == '*' || *p->car() == '&' || *p->car() == "const")) { // Link the const keyword if (*p->car() == "const") sxr_->span(p->car(), "keyword"); p = PTree::rest(p); } if (p) { // p should now be at the name sxr_->xref(p->car(), var); // Next might be '=' then expr p = PTree::rest(p); if (p && p->car() && *p->car() == '=') { p = PTree::rest(p); if (p && p->car()) translate(p->car()); } } } return 0; } // Fills the vector of Parameter types by parsing p_params. void Walker::translate_parameters(PTree::Node *p_params, std::vector& params) { STrace trace("Walker::translate_parameters"); if (PTree::length(p_params) == 1 && *p_params->car() == "void") return; while (p_params) { // A parameter has a type, possibly a name and possibly a value std::string name, value; ASG::Parameter::Mods premods, postmods; if (*p_params->car() == ',') p_params = p_params->cdr(); PTree::Node *param = PTree::first(p_params); // The type is stored in the encoded type string already Types::Type* type = my_decoder->decodeType(); if (!type) { std::cerr << "Premature end of decoding!" << std::endl; break; // 0 means end of encoding } if (PTree::length(param) == 3) { PTree::Declarator *decl = static_cast(PTree::nth(param, 2)); name = parse_name(decl->name()); value = parse_name(decl->initializer()); // Link type if (sxr_ && PTree::nth(param, 1)) sxr_->xref(PTree::nth(param, 1), type); // Skip keywords (eg: register) which are Leaves PTree::Node *atom = PTree::nth(param, 0); if (atom) premods.push_back(parse_name(atom)); } // Add the ASG.Parameter type to the list params.push_back(new ASG::Parameter(premods, type, postmods, name, value)); p_params = PTree::rest(p_params); } } void Walker::translate_function_name(const PTree::Encoding &encname, std::string& realname, Types::Type*& returnType) { STrace trace("Walker::translate_function_name"); if (my_decoder->isName(encname)) { if (encname.at(1) == '@') { // conversion operator my_decoder->init(encname); my_decoder->iter() += 2; returnType = my_decoder->decodeType(); realname = "("+my_type_formatter->format(returnType)+")"; } else { // simple name realname = my_decoder->decodeName(encname); // operator names are missing the 'operator', add it back char c = realname[0]; if (c == '+' || c == '-' || c == '*' || c == '/' || c == '%' || c == '^' || c == '&' || c == '!' || c == '=' || c == '<' || c == '>' || c == ',' || c == '(' || c == '[' || (c == '~' && realname[1] == 0)) realname = "operator"+realname; } } else if (encname.at(0) == 'Q') { // If a function declaration has a scoped name, then it is not // declaring a new function in that scope and can be ignored in // the context of synopsis. // TODO: maybe needed for syntax stuff? return; } else if (encname.at(0) == 'T') { // Template specialisation. // blah is T4blah2ii ---> realname = foo my_decoder->init(encname); code_iter& iter = ++my_decoder->iter(); realname = my_decoder->decodeName()+"<"; code_iter tend = iter + (*iter - 0x80u); iter++; // For some reason, putting this in prev line causes error with 3.2 bool first = true; // Append type names to realname while (iter <= tend) { /*Types::Type* type = */my_decoder->decodeType(); if (!first) realname+=","; else first=false; realname += "type"; //type->ToString(); } realname += ">"; } else std::cerr << "Warning: Unknown function name: " << encname << std::endl; } //. Class or Enum PTree::Node* Walker::translate_type_specifier(PTree::Node *tspec) { STrace trace("Walker::translate_type_specifier"); PTree::Node *class_spec = get_class_or_enum_spec(tspec); if (class_spec) translate(class_spec); return 0; } void Walker::visit(PTree::Typedef *node) { STrace trace("Walker::visit(Typedef*)"); my_defines_class_or_enum = false; bool in_typedef_back = my_in_typedef; my_in_typedef = true; if (sxr_) sxr_->span(PTree::first(node), "keyword"); /* PTree::Node *tspec = */ translate_type_specifier(PTree::second(node)); my_declaration = node; my_store_decl = true; for (PTree::Node *declarator = PTree::third(node); declarator; declarator = PTree::tail(declarator, 2)) translate_typedef_declarator(declarator->car()); my_in_typedef = in_typedef_back; my_defines_class_or_enum = false; } void Walker::translate_typedef_declarator(PTree::Node *node) { STrace trace("Walker::translate_typedef_declarator"); if (PTree::type_of(node) != Token::ntDeclarator) return; PTree::Encoding encname = node->encoded_name(); PTree::Encoding enctype = node->encoded_type(); if (encname.empty() || enctype.empty()) return; update_line_number(node); // Get type of declarator my_decoder->init(enctype); Types::Type* type = my_decoder->decodeType(); // Get name of typedef std::string name = my_decoder->decodeName(encname); // Create typedef object ASG::Typedef* tdef = my_builder->add_typedef(my_lineno, name, type, my_defines_class_or_enum); add_comments(tdef, dynamic_cast(node)); // if storing links, find name if (sxr_) { if (my_store_decl && PTree::second(my_declaration)) sxr_->xref(PTree::second(my_declaration), type); PTree::Node *p = node; // function pointer: [( [* f] )] if (p && !p->car()->is_atom() && *p->car()->car() == '(') p = PTree::rest(p->car())->car(); while (p && p->car()->is_atom() && (*p->car() == '*' || *p->car() == '&')) p = PTree::rest(p); if (p) // p should now be at the name sxr_->xref(p->car(), tdef); } } PTree::Node* Walker::translate_function_implementation(PTree::Node *node) { STrace trace("Walker::translate_function_implementation"); my_function = 0; my_params.clear(); translate_declarator(PTree::third(node)); if (!my_filter->should_visit_function_impl(my_file)) return 0; if (!my_function) { std::cerr << "Warning: function was null!" << std::endl; return 0; } FuncImplCache cache; cache.func = my_function; cache.params = my_param_cache; cache.body = PTree::nth(node, 3); if (dynamic_cast(my_builder->scope())) my_func_impl_stack.back().push_back(cache); else { bool in_template_decl = my_in_template_decl; my_in_template_decl = false; translate_func_impl_cache(cache); my_in_template_decl = in_template_decl; } return 0; } void Walker::translate_func_impl_cache(const FuncImplCache &cache) { STrace trace("Walker::translate_func_impl_cache"); #if DEBUG trace << cache.body; #endif // We create a dummy namespace with the name of the function. Any // declarations in the function are added to this dummy namespace. Once we // are done, we remove it from the parent scope (its not much use in the // documents) std::vector name = cache.func->name(); name.back() = "`"+name.back(); my_builder->start_function_impl(name); try { // Add parameters std::vector::const_iterator iter, end; iter = cache.params.begin(); end = cache.params.end(); while (iter != end) { ASG::Parameter* param = *iter++; // Make sure the parameter is named if (param->name().size()) my_builder->add_variable(my_lineno, param->name(), param->type(), false, "parameter"); } // Add 'this' if method my_builder->add_this_variable(); // Translate the function body const_cast(cache.body)->accept(this); } catch (...) { LOG("Cleaning up func impl cache"); my_builder->end_function_impl(); throw; } my_builder->end_function_impl(); } void Walker::visit(PTree::AccessSpec *node) { STrace trace("Walker::visit(PTree::AccessSpec*)"); ASG::Access axs = ASG::Default; switch (PTree::type_of(PTree::first(node))) { case Token::PUBLIC: axs = ASG::Public; break; case Token::PROTECTED: axs = ASG::Protected; break; case Token::PRIVATE: axs = ASG::Private; break; } update_line_number(node); if (PTree::Node *comments = node->get_comments()) { ASG::Builtin *builtin = my_builder->add_tail_comment(my_lineno); add_comments(builtin, comments); } my_builder->set_access(axs); if (sxr_) sxr_->span(PTree::first(node), "keyword"); } /* Enum Spec * */ void Walker::visit(PTree::EnumSpec *node) { STrace trace("Walker::visit(PTree::EnumSpec*)"); //update_line_number(spec); my_defines_class_or_enum = true; if (sxr_) sxr_->span(PTree::first(node), "keyword"); std::string name; if (PTree::second(node)) name = PTree::reify(PTree::second(node)); else { my_decoder->init(node->encoded_name()); name = my_decoder->decodeName(); } update_line_number(node); int enum_lineno = my_lineno; // Parse enumerators std::vector enumerators; PTree::Node *penum = PTree::second(PTree::third(node)); ASG::Enumerator *enumor; while (penum) { update_line_number(penum); PTree::Node *penumor = PTree::first(penum); if (penumor->is_atom()) { // Just a name enumor = my_builder->add_enumerator(my_lineno, PTree::reify(penumor), ""); add_comments(enumor, static_cast(penumor)->get_comments()); if (sxr_) sxr_->xref(penumor, enumor); } else { // Name = Value std::string name = PTree::reify(PTree::first(penumor)); std::string value; if (PTree::length(penumor) == 3) value = PTree::reify(PTree::third(penumor)); enumor = my_builder->add_enumerator(my_lineno, name, value); add_comments(enumor, dynamic_cast(PTree::first(penumor))); if (sxr_) sxr_->xref(PTree::first(penumor), enumor); } enumerators.push_back(enumor); penum = PTree::rest(penum); // Skip comma if (penum && penum->car() && *penum->car() == ',') penum = PTree::rest(penum); } PTree::Node *close = PTree::third(PTree::third(node)); enumor = new ASG::Enumerator(my_file, my_lineno, "dummy", my_dummyname, ""); add_comments(enumor, static_cast(close)); enumerators.push_back(enumor); // Create ASG.Enum object ASG::Enum* theEnum = my_builder->add_enum(enum_lineno,name,enumerators); add_comments(theEnum, my_declaration); if (my_declaration) { // Enum declared inside declaration. Comments for the declaration // belong to the enum. This is policy. #TODO review policy //my_declaration->SetComments(0); ?? typedef doesn't have comments? } if (sxr_ && PTree::second(node)) sxr_->xref(PTree::second(node), theEnum); my_defines_class_or_enum = true; } void Walker::visit(PTree::UsingDirective *node) { STrace trace("Walker::visit(PTree::UsingDirective*)"); update_line_number(node); if (sxr_) sxr_->span(PTree::first(node), "keyword"); PTree::Node *p = PTree::rest(node); if (sxr_) sxr_->span(PTree::first(p), "keyword"); // Find namespace to alias p = PTree::rest(p); // Find name that we are looking up, and make a new ptree list for linking it p = p->car(); // p now points to the 'PTree::Name' child of 'PTree::Using' PTree::Node *p_name = PTree::snoc(0, p->car()); QName name; if (*PTree::first(p) == "::") // Eg; "using ::memcpy;" Indicate global scope with empty first name.push_back(""); else { name.push_back(parse_name(PTree::first(p))); p = PTree::rest(p); } while (p && *PTree::first(p) == "::") { p_name = PTree::snoc(p_name, p->car()); // Add '::' to p_name p = PTree::rest(p); name.push_back(parse_name(PTree::first(p))); p_name = PTree::snoc(p_name, p->car()); // Add identifier to p_name p = PTree::rest(p); } // Resolve and link name try { Types::Named* type = my_lookup->lookupType(name); if (sxr_) sxr_->xref(p_name, type); // Check for '=' alias // Huh ? '=' isn't valid within a 'using' directive or declaration if (p && *PTree::first(p) == "=") { p = PTree::rest(p); std::string alias = parse_name(PTree::first(p)); my_builder->add_aliased_using_namespace(type, alias); } else my_builder->add_using_directive(my_lineno, type); } catch (const TranslateError& e) { LOG("Oops!"); e.set_node(node); throw; } } void Walker::visit(PTree::UsingDeclaration *node) { STrace trace("Walker::visit(PTree::UsingDeclaration*)"); if (sxr_) sxr_->span(PTree::first(node), "keyword"); PTree::Node *p = PTree::rest(node); // Find name that we are looking up, and make a new ptree list for linking it PTree::Node *p_name = PTree::snoc(0, p->car()); QName name; if (*PTree::first(p) == "::") // Eg; "using ::memcpy;" Indicate global scope with empty first name.push_back(""); else { name.push_back(parse_name(PTree::first(p))); p = PTree::rest(p); } while (p && *PTree::first(p) == "::") { p_name = PTree::snoc(p_name, p->car()); // Add '::' to p_name p = PTree::rest(p); name.push_back(parse_name(PTree::first(p))); p_name = PTree::snoc(p_name, p->car()); // Add identifier to p_name p = PTree::rest(p); } // Resolve and link name try { Types::Named* type = my_lookup->lookupType(name); if (sxr_) sxr_->xref(p_name, type); // Let builder do all the work my_builder->add_using_declaration(my_lineno, type); } catch (const TranslateError& e) { LOG("Oops!"); e.set_node(node); throw; } } void Walker::visit(PTree::ReturnStatement *node) { STrace trace("Walker::visit(PTree::ReturnStatement*)"); if (!sxr_) return; // Link 'return' keyword sxr_->span(PTree::first(node), "keyword"); // Translate the body of the return, if present if (PTree::length(node) == 3) translate(PTree::second(node)); } void Walker::visit(PTree::InfixExpr *node) { STrace trace("Walker::visit(PTree::Infix*)"); translate(PTree::first(node)); Types::Type* left_type = my_type; translate(PTree::third(node)); Types::Type* right_type = my_type; std::string oper = parse_name(PTree::second(node)); TypeIdFormatter tf; LOG("BINARY-OPER: " << tf.format(left_type) << " " << oper << " " << tf.format(right_type)); nodeLOG(node); if (!left_type || !right_type) { my_type = 0; return; } // Lookup an appropriate operator ASG::Function* func = my_lookup->lookupOperator(oper, left_type, right_type); if (func) { my_type = func->return_type(); if (sxr_) sxr_->xref(PTree::second(node), func->declared()); } return; } void Walker::translate_variable(PTree::Node *spec) { // REVISIT: Figure out why this is so long!!! STrace trace("Walker::TranslateVariable"); if (sxr_) find_comments(spec); try { PTree::Node *name_spec = spec; Types::Named* type; QName scoped_name; if (!spec->is_atom()) { // Must be a scoped name.. iterate through the scopes // stop when spec is at the last name //nodeLOG(spec); // If first node is '::' then reset my_scope to the global scope if (*PTree::first(spec) == "::") { scoped_name.push_back(""); spec = PTree::rest(spec); } while (PTree::length(spec) > 2) { scoped_name.push_back(parse_name(PTree::first(spec))); /* if (!type) { throw nodeERROR(spec, "scope '" << parse_name(spec->First()) << "' not found!"); } try { my_scope = Types::declared_cast(type); } catch (const Types::wrong_type_cast&) { throw nodeERROR(spec, "scope '"<First())<<"' found but not a scope!"); } // Link the scope name if (sxr_) sxr_->xref(spec->First(), my_scope->declared()); */ spec = PTree::rest(PTree::rest(spec)); } spec = PTree::first(spec); // Check for 'operator >>' type syntax: if (!spec->is_atom() && PTree::length(spec) == 2 && *PTree::first(spec) == "operator") { // Name lookup is done based on only the operator type, so // skip the 'operator' node spec = PTree::second(spec); } scoped_name.push_back(parse_name(spec)); } std::string name = parse_name(spec); if (my_postfix_flag == Postfix_Var) { // Variable lookup. my_type will be the vtype /*cout << "my_scope is " << (my_scope ? my_type_formatter->format(my_scope->declared()) : "global") << endl;*/ if (!scoped_name.empty()) type = my_lookup->lookupType(scoped_name, true, my_scope); else if (my_scope) type = my_lookup->lookupType(name, my_scope); else type = my_lookup->lookupType(name); if (!type) { throw nodeERROR(spec, "variable '" << name << "' not found!"); } // Now find vtype (throw wrong_type_cast if not a variable) try { Types::Declared& declared = dynamic_cast(*type); // The variable could be a Variable or Enumerator ASG::Variable* var; ASG::Enumerator* enumor; if ((var = dynamic_cast(declared.declaration())) != 0) { // It is a variable my_type = var->vtype(); // Store a link to the variable itself (not its type) if (sxr_) sxr_->xref(name_spec, type); /*cout << "var type name is " << my_type_formatter->format(my_type) << endl;*/ } else if ((enumor = dynamic_cast(declared.declaration())) != 0) { // It is an enumerator my_type = 0; // we have no use for enums in type code // But still a link is needed if (sxr_) sxr_->xref(name_spec, type); /*cout << "enum type name is " << my_type_formatter->format(type) << endl;*/ } else { throw nodeERROR(name_spec, "var was not a Variable nor Enumerator!"); } } catch (const std::bad_cast &) { if (dynamic_cast(type)) throw nodeERROR(spec, "variable '" << name << "' was an Unknown type!"); if (dynamic_cast(type)) throw nodeERROR(spec, "variable '" << name << "' was a Base type!"); throw nodeERROR(spec, "variable '" << name << "' wasn't a declared type!"); } } else { // Function lookup. my_type will be returnType. params are in my_params ASG::Scope* scope = my_scope ; if (!scope) scope = my_builder->scope(); // if (!scoped_name.empty()) func = my_lookup->lookupFunc(scoped_name, scope, my_params); ASG::Function* func = my_lookup->lookupFunc(name, scope, my_params); if (!func) { throw nodeERROR(name_spec, "Warning: function '" << name << "' not found!"); } // Store a link to the function name if (sxr_) sxr_->xref(name_spec, func->declared(), SXRGenerator::FunctionCall); // Now find returnType my_type = func->return_type(); } } catch(const TranslateError& e) { my_scope = 0; my_type = 0; e.set_node(spec); throw; } catch(const Types::wrong_type_cast &) { throw nodeERROR(spec, "wrong type error in TranslateVariable!"); } catch(...) { throw nodeERROR(spec, "unknown error in TranslateVariable!"); } my_scope = 0; } void Walker::translate_function_args(PTree::Node *args) { // args: [ arg (, arg)* ] while (PTree::length(args)) { PTree::Node *arg = PTree::first(args); // Translate this arg, TODO: my_params would be better as a vector my_type = 0; translate(arg); my_params.push_back(my_type); // Skip over arg and comma args = PTree::rest(PTree::rest(args)); } } void Walker::visit(PTree::FuncallExpr *node) // and fstyle cast { STrace trace("Walker::visit(PTree::FuncallExpr*)"); // TODO: figure out how to deal with fstyle casts.. does it only apply to // base types? eg: int(4.0) ? // This is similar to TranslateVariable, except we have to check params.. // doh! That means more my_type nastiness // LOG(node); // In translating the postfix the last var should be looked up as a // function. This means we have to find the args first, and store them in // my_params as a hint Types::Type::vector save_params = my_params; my_params.clear(); try { translate_function_args(PTree::third(node)); } catch (...) { // Restore params before rethrowing exception my_params = save_params; throw; } Postfix_Flag save_flag = my_postfix_flag; try { my_postfix_flag = Postfix_Func; translate(PTree::first(node)); } catch (...) { // Restore params and flag before rethrowing exception my_params = save_params; my_postfix_flag = save_flag; throw; } // Restore my_params since we're done with it now my_params = save_params; my_postfix_flag = save_flag; } void Walker::visit(PTree::ExprStatement *node) { STrace trace("Walker::visit(ExprStatement*)"); translate(PTree::first(node)); } void Walker::visit(PTree::UnaryExpr *node) { STrace trace("Walker::visit(UnaryExpr*)"); if (sxr_) find_comments(node); // TODO: lookup unary operator translate(PTree::second(node)); } void Walker::visit(PTree::AssignExpr *node) { STrace trace("Walker::visit(AssignExpr*)"); // TODO: lookup = operator my_type = 0; translate(PTree::first(node)); Types::Type* ret_type = my_type; translate(PTree::third(node)); my_type = ret_type; } //. Resolves the final type of any given Type. For example, it traverses //. typedefs and parameterized types, and resolves unknowns by looking them up. class TypeResolver : public Types::Visitor { // TODO: Move to separate file??? public: //. Constructor - needs a Builder to resolve unknowns with TypeResolver(Builder* b) { my_builder = b;} //. Resolves the given type object Types::Type* resolve(Types::Type* t) { my_type = t; t->accept(this); return my_type; } //. Tries to resolve the given type object to a Scope ASG::Scope* scope(Types::Type* t) throw (Types::wrong_type_cast, TranslateError) { return Types::declared_cast(resolve(t)); } //. Looks up the unknown type for a fresh definition void visit_unknown(Types::Unknown* t) { my_type = my_builder->lookup()->resolveType(t); if (!dynamic_cast(my_type)) my_type->accept(this); } //. Recursively processes the aliased type void visit_modifier(Types::Modifier* t) { t->alias()->accept(this);} //. Checks for typedefs and recursively processes them void visit_declared(Types::Declared* t) { ASG::Typedef* tdef = dynamic_cast(t->declaration()); if (tdef) tdef->alias()->accept(this); else my_type = t; } //. Processes the template type void visit_parameterized(Types::Parameterized* t) { if (t->template_id()) t->template_id()->accept(this); } protected: Builder* my_builder; //.< A reference to the builder object Types::Type* my_type; //.< The type to return }; void Walker::visit(PTree::ArrowMemberExpr *node) { STrace trace("Walker::visit(ArrowMember*)"); my_type = 0; my_scope = 0; Postfix_Flag save_flag = my_postfix_flag; my_postfix_flag = Postfix_Var; translate(PTree::first(node)); my_postfix_flag = save_flag; // my_type should be a modifier to a declared to a class. Throw bad_cast if not if (!my_type) { throw nodeERROR(node, "Unable to resolve type of LHS of ->"); } try { my_scope = TypeResolver(my_builder).scope(my_type); } catch (const Types::wrong_type_cast&) { throw nodeERROR(node, "LHS of -> was not a scope!"); } // Find member, my_type becomes the var type or func returnType translate(PTree::third(node)); my_scope = 0; } void Walker::visit(PTree::DotMemberExpr *node) { STrace trace("Walker::visit(DotMember*)"); my_type = 0; my_scope = 0; Postfix_Flag save_flag = my_postfix_flag; my_postfix_flag = Postfix_Var; translate(PTree::first(node)); my_postfix_flag = save_flag; LOG(parse_name(PTree::first(node)) << " resolved to " << my_type_formatter->format(my_type)); // my_type should be a declared to a class if (!my_type) { throw nodeERROR(node, "Unable to resolve type of LHS of ."); } LOG("resolving type to scope"); // Check for reference type try { my_scope = TypeResolver(my_builder).scope(my_type); } catch (const Types::wrong_type_cast &) { throw nodeERROR(node, "Warning: LHS of . was not a scope: " << my_type_formatter->format(my_type)); } // Find member, my_type becomes the var type or func returnType LOG("translating third"); translate(PTree::third(node)); my_scope = 0; } void Walker::visit(PTree::IfStatement *node) { STrace trace("Walker::visit(IfStatement*)"); if (sxr_) find_comments(node); if (sxr_) sxr_->span(PTree::first(node), "keyword"); // Start a temporary namespace, in case expr is a declaration my_builder->start_namespace("if", NamespaceUnique); // Parse expression translate(PTree::third(node)); // Store a copy of any declarations for use in the else block std::vector decls = my_builder->scope()->declarations(); // Translate then-statement. If a block then we avoid starting a new ns PTree::Node *stmt = PTree::nth(node, 4); if (stmt && PTree::first(stmt) && *PTree::first(stmt) == '{') visit((PTree::Brace *)stmt); else translate(stmt); // End the block and check for else my_builder->end_namespace(); if (PTree::length(node) == 7) { if (sxr_) sxr_->span(PTree::nth(node, 5), "keyword"); ASG::Namespace* ns = my_builder->start_namespace("else", NamespaceUnique); ns->declarations().insert(ns->declarations().begin(), decls.begin(), decls.end()); // Translate else statement, same deal as above stmt = PTree::nth(node, 6); if (stmt && PTree::first(stmt) && *PTree::first(stmt) == '{') visit((PTree::Brace*)stmt); else translate(stmt); my_builder->end_namespace(); } } void Walker::visit(PTree::SwitchStatement *node) { STrace trace("Walker::visit(SwitchStatement*)"); if (sxr_) find_comments(node); if (sxr_) sxr_->span(PTree::first(node), "keyword"); my_builder->start_namespace("switch", NamespaceUnique); // Parse expression translate(PTree::third(node)); // Translate statement. If a block then we avoid starting a new ns PTree::Node *stmt = PTree::nth(node, 4); if (stmt && PTree::first(stmt) && *PTree::first(stmt) == '{') visit((PTree::Brace *)stmt); else translate(stmt); // End the block and check for else my_builder->end_namespace(); } void Walker::visit(PTree::CaseStatement *node) { STrace trace("Walker::visit(Case*)"); if (sxr_) find_comments(node); if (sxr_) sxr_->span(PTree::first(node), "keyword"); translate(PTree::second(node)); translate(PTree::nth(node, 3)); } void Walker::visit(PTree::DefaultStatement *node) { STrace trace("Walker::visit(DefaultStatement*)"); if (sxr_) find_comments(node); if (sxr_) sxr_->span(PTree::first(node), "keyword"); translate(PTree::third(node)); } void Walker::visit(PTree::BreakStatement *node) { STrace trace("Walker::visit(Break*)"); if (sxr_) find_comments(node); if (sxr_) sxr_->span(PTree::first(node), "keyword"); } void Walker::visit(PTree::ForStatement *node) { STrace trace("Walker::visit(For*)"); if (sxr_) find_comments(node); if (sxr_) sxr_->span(PTree::first(node), "keyword"); my_builder->start_namespace("for", NamespaceUnique); // Parse expressions translate(PTree::third(node)); translate(PTree::nth(node, 3)); translate(PTree::nth(node, 5)); // Translate statement. If a block then we avoid starting a new ns PTree::Node *stmt = PTree::nth(node, 7); if (stmt && PTree::first(stmt) && *PTree::first(stmt) == '{') visit((PTree::Brace *)stmt); else translate(stmt); // End the block my_builder->end_namespace(); } void Walker::visit(PTree::WhileStatement *node) { STrace trace("Walker::visit(While*)"); if (sxr_) find_comments(node); if (sxr_) sxr_->span(PTree::first(node), "keyword"); my_builder->start_namespace("while", NamespaceUnique); // Parse expression translate(PTree::third(node)); // Translate statement. If a block then we avoid starting a new ns PTree::Node *stmt = PTree::nth(node, 4); if (stmt && PTree::first(stmt) && *PTree::first(stmt) == '{') visit((PTree::Brace *)stmt); else translate(stmt); // End the block and check for else my_builder->end_namespace(); } void Walker::visit(PTree::PostfixExpr *node) { STrace trace("Walker::visit(Postfix*)"); translate(PTree::first(node)); } void Walker::visit(PTree::ParenExpr *node) { STrace trace("Walker::visit(Paren*)"); if (sxr_) find_comments(node); translate(PTree::second(node)); } void Walker::visit(PTree::CastExpr *node) { STrace trace("Walker::visit(Cast*)"); if (sxr_) find_comments(node); PTree::Node *type_expr = PTree::second(node); //Translate(type_expr->First()); PTree::Encoding enc = PTree::second(type_expr)->encoded_type(); if (!enc.empty()) { my_decoder->init(enc); my_type = my_decoder->decodeType(); my_type = TypeResolver(my_builder).resolve(my_type); if (my_type && sxr_) sxr_->xref(PTree::first(type_expr), my_type); } else my_type = 0; translate(PTree::nth(node, 3)); } void Walker::visit(PTree::TryStatement *node) { STrace trace("Walker::visit(Try*)"); if (sxr_) find_comments(node); if (sxr_) sxr_->span(PTree::first(node), "keyword"); my_builder->start_namespace("try", NamespaceUnique); translate(PTree::second(node)); my_builder->end_namespace(); for (int n = 2; n < PTree::length(node); n++) { // [ catch ( arg ) [{}] ] PTree::Node *catch_node = PTree::nth(node, n); if (sxr_) sxr_->span(PTree::first(catch_node), "keyword"); my_builder->start_namespace("catch", NamespaceUnique); PTree::Node *arg = PTree::third(catch_node); if (PTree::length(arg) == 2) { // Get the arg type my_decoder->init(PTree::second(arg)->encoded_type()); Types::Type* arg_type = my_decoder->decodeType(); // Link the type Types::Type* arg_link = TypeResolver(my_builder).resolve(arg_type); if (sxr_) sxr_->xref(PTree::first(arg), arg_link); // Create a declaration for the argument if (PTree::second(arg)) { PTree::Encoding enc = PTree::second(arg)->encoded_name(); if (!enc.empty()) { std::string name = my_decoder->decodeName(enc); my_builder->add_variable(my_lineno, name, arg_type, false, "exception"); } } } // Translate contents of 'catch' block translate(PTree::nth(catch_node, 4)); my_builder->end_namespace(); } } void Walker::visit(PTree::ArrayExpr *node) { STrace trace("Walker::visit(ArrayExpr*)"); translate(PTree::first(node)); Types::Type* object = my_type; translate(PTree::third(node)); Types::Type* arg = my_type; if (!object || !arg) { my_type = 0; return; } // Resolve final type try { TypeIdFormatter tf; LOG("ARRAY-OPER: " << tf.format(object) << " [] " << tf.format(arg)); ASG::Function* func; my_type = my_lookup->arrayOperator(object, arg, func); if (func && sxr_) { // Link the [ and ] to the function operator used sxr_->xref(PTree::nth(node, 1), func->declared()); sxr_->xref(PTree::nth(node, 3), func->declared()); } } catch (const TranslateError& e) { e.set_node(node); throw; } } void Walker::visit(PTree::CondExpr *node) { STrace trace("Walker::visit(Cond*)"); translate(PTree::nth(node, 0)); translate(PTree::nth(node, 2)); translate(PTree::nth(node, 4)); } void Walker::visit(PTree::Kwd::This *node) { STrace trace("Walker::visit(This*)"); if (sxr_) find_comments(node); if (sxr_) sxr_->span(node, "keyword"); // Set my_type to type of 'this', stored in the name lookup for this func my_type = my_lookup->lookupType("this"); } void Walker::visit(PTree::TemplateInstantiation *) { STrace trace("Walker::visit(TemplateInstantiation*) NYI"); } void Walker::visit(PTree::ExternTemplate *) { STrace trace("Walker::visit(ExternTemplate*) NYI"); } void Walker::visit(PTree::MetaclassDecl *) { STrace trace("Walker::visit(MetaclassDecl*) NYI"); } PTree::Node *Walker::translate_storage_specifiers(PTree::Node *) { STrace trace("Walker::translate_storage_specifiers NYI"); return 0; } PTree::Node *Walker::translate_function_body(PTree::Node *) { STrace trace("Walker::translate_function_body NYI"); return 0; } void Walker::visit(PTree::AccessDecl *node) { STrace trace("Walker::visit(AccessDecl*) NYI"); #if DEBUG trace << node; #endif if (sxr_) find_comments(node); } void Walker::visit(PTree::UserAccessSpec *node) { STrace trace("Walker::visist(UserAccessSpec*) NYI"); #if DEBUG trace << node; #endif if (sxr_) find_comments(node); } void Walker::visit(PTree::DoStatement *node) { STrace trace("Walker::visit(Do*) NYI"); if (sxr_) { find_comments(node); sxr_->span(PTree::first(node), "keyword"); sxr_->span(PTree::third(node), "keyword"); } // Translate block my_builder->start_namespace("do", NamespaceUnique); // Translate statement. If a block then we avoid starting a new ns PTree::Node *stmt = PTree::second(node); if (stmt && PTree::first(stmt) && *PTree::first(stmt) == '{') visit((PTree::Brace*)stmt); else translate(stmt); // End the block and check for else my_builder->end_namespace(); // Translate the while condition translate(PTree::nth(node, 4)); } void Walker::visit(PTree::ContinueStatement *node) { STrace trace("Walker::visit(Continue*) NYI"); if (sxr_) find_comments(node); if (sxr_) sxr_->span(PTree::first(node), "keyword"); } void Walker::visit(PTree::GotoStatement *node) { STrace trace("Walker::visist(Goto*) NYI"); #if DEBUG trace << node; #endif if (sxr_) find_comments(node); } void Walker::visit(PTree::LabelStatement *node) { STrace trace("Walker::visit(Label*) NYI"); #if DEBUG trace << node; #endif if (sxr_) find_comments(node); } void Walker::visit(PTree::Expression *node) { STrace trace("Walker::visit(Expression*)"); #if DEBUG trace << node; #endif PTree::Node *node2 = node; while (node2) { translate(PTree::first(node2)); node2 = PTree::rest(node2); if (node2) node2 = PTree::rest(node2); } } void Walker::visit(PTree::PmExpr *node) { STrace trace("Walker::visit(Pm*) NYI"); } void Walker::visit(PTree::ThrowExpr *node) { STrace trace("Walker::visit(Throw*)"); #if DEBUG trace << node; #endif if (sxr_) find_comments(node); if (sxr_) sxr_->span(PTree::first(node), "keyword"); translate(PTree::second(node)); } void Walker::visit(PTree::SizeofExpr *node) { STrace trace("Walker::visit(Sizeof*)"); #if DEBUG trace << node; #endif if (sxr_) find_comments(node); if (sxr_) sxr_->span(PTree::first(node), "keyword"); // TODO: find the type for highlighting, and figure out what the ??? is my_type = my_lookup->lookupType("int"); } void Walker::visit(PTree::NewExpr *node) { STrace trace("Walker::visit(New*) NYI"); #if DEBUG trace << node; #endif if (sxr_) find_comments(node); } PTree::Node *Walker::translate_new3(PTree::Node *node) { STrace trace("Walker::translate_new3 NYI"); #if DEBUG trace << node; #endif if (sxr_) find_comments(node); return 0; } void Walker::visit(PTree::DeleteExpr *node) { STrace trace("Walker::visit(DeleteExpr*)"); #if DEBUG trace << node; #endif if (sxr_) find_comments(node); if (sxr_) sxr_->span(PTree::first(node), "keyword"); translate(PTree::second(node)); } void Walker::visit(PTree::FstyleCastExpr *node) { STrace trace("Walker::visit(FstyleCast*) NYI"); #if DEBUG trace << node; #endif if (sxr_) find_comments(node); my_type = 0; //Translate(node->Third()); <-- unknown ptree???? FIXME my_decoder->init(node->encoded_type()); my_type = my_decoder->decodeType(); // TODO: Figure out if should have called a function for this } void Walker::visit(PTree::UserStatementExpr *node) { STrace trace("Walker::visit(UserStatement*) NYI"); } void Walker::visit(PTree::StaticUserStatementExpr *node) { STrace trace("Walker::visit(StaticUserStatement*) NYI"); } synopsis-0.12/Synopsis/Parsers/Cxx/Dictionary.hh0000664000076400007640000000574211122312026021313 0ustar stefanstefan// // Copyright (C) 2001 Stephen Davies // Copyright (C) 2001 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Dictionary_hh_ #define Dictionary_hh_ #include #include #include #include #include "QName.hh" #include "FakeGC.hh" // Forward declaration of Type::Named namespace Types { class Named; } // Forward declaration of ASG::Declaration namespace ASG { class Declaration; } //. Dictionary of named declarations with lookup. //. This class maintains a dictionary of names, which index types, //. supposedly declared in the scope that has this dictionary. There may be //. only one declaration per name, except in the case of function names. class Dictionary : public FakeGC::LightObject { public: //. The type of multiple entries. We don't want to include type.hh just for //. this, so this is a workaround typedef std::vector Type_vector; //. Exception thrown when multiple declarations are found when one is //. expected. The list of declarations is stored in the exception. struct MultipleError { MultipleError(const std::string& n) : name(n) {} // The vector of types that *were* found. This is returned so that whoever // catches the error can proceed straight away std::string name; Type_vector types; }; //. Exception thrown when a name is not found in lookup*() struct KeyError { //. Constructor KeyError(const std::string& n) : name(n) { } //. The name which was not found std::string name; }; //. Returns true if name is in dict bool has_key(const std::string& name) const { return map_.find(name) != map_.end();} //. Lookup a name in the dictionary. If more than one declaration has this //. name then an exception is thrown. Types::Named* lookup(const std::string& name);// throw (MultipleError, KeyError); //. Lookup a name in the dictionary expecting multiple decls. Use this //. method if you expect to find more than one declaration, eg importing //. names via a using statement. Type_vector lookup_multiple(const std::string& name) throw (KeyError); //. Add a declaration to the dictionary. The name() is extracted from the //. declaration and its last string used as the key. The declaration is //. stored as a Type::Declared which is created inside this method. void insert(ASG::Declaration* decl); void remove(std::string const &name); //. Add a named type to the dictionary. The name() is extracted from the //. type and its last string used as they key. void insert(Types::Named* named); //. Dump the contents for debugging void dump(); private: typedef std::multimap NameMap; typedef NameMap::iterator iterator; typedef NameMap::value_type value_type; NameMap map_; }; #endif // header guard synopsis-0.12/Synopsis/Parsers/Cxx/TypeIdFormatter.hh0000664000076400007640000000330011122312026022254 0ustar stefanstefan// // Copyright (C) 2008 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef TypeIdFormatter_hh_ #define TypeIdFormatter_hh_ #include "ASG.hh" #include "Types.hh" #include #include class TypeIdFormatter : public Types::Visitor { public: TypeIdFormatter(); //. Sets the current scope, pushing the previous onto a stack void push_scope(const QName& scope); //. Pops the previous scope from the stack void pop_scope(); // // Type Visitor // //. Returns a formatter string for given type. //. The option string pointer refers to the parameter name (where //. applicable) so that it can be put in the right place for function pointer //. types. The pointed to pointer will be set to 0 if the identifier is //. used std::string format(const Types::Type*, const std::string** id = 0); virtual void visit_type(Types::Type*); virtual void visit_unknown(Types::Unknown*); virtual void visit_modifier(Types::Modifier*); virtual void visit_named(Types::Named*); virtual void visit_base(Types::Base*); virtual void visit_declared(Types::Declared*); virtual void visit_template_type(Types::Template*); virtual void visit_parameterized(Types::Parameterized*); virtual void visit_func_ptr(Types::FuncPtr*); private: //. The Type String std::string type_; //. The current scope name QName scope_; //. Returns the given Name relative to the current scope std::string colonate(const QName& name); //. A stack of previous scopes std::vector scope_stack_; //. A pointer to the identifier for function pointers const std::string** fptr_id_; }; #endif synopsis-0.12/Synopsis/Parsers/Cxx/TypeIdFormatter.cc0000664000076400007640000000655611122312026022262 0ustar stefanstefan// // Copyright (C) 2008 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include "TypeIdFormatter.hh" TypeIdFormatter::TypeIdFormatter () : fptr_id_(0) { scope_stack_.push_back(QName()); } void TypeIdFormatter::push_scope(const QName& scope) { scope_stack_.push_back(scope_); scope_ = scope; } void TypeIdFormatter::pop_scope() { scope_ = scope_stack_.back(); scope_stack_.pop_back(); } std::string TypeIdFormatter::colonate(const QName& name) { std::string str; QName::const_iterator n = name.begin(); QName::const_iterator s = scope_.begin(); // Skip identical scopes while (n != name.end() && s != scope_.end() && *n == *s) ++n, ++s; // If name == scope, just return last eg: struct S { S* ptr; }; if (n == name.end()) return name.back(); // Join the rest in name with colons str = *n++; while (n != name.end()) str += "::" + *n++; return str; } std::string TypeIdFormatter::format(const Types::Type* type, const std::string** id) { if (!type) return "(unknown)"; const std::string** save = 0; if (id) { save = fptr_id_; fptr_id_ = id; } const_cast(type)->accept(this); if (id) fptr_id_ = save; return type_; } void TypeIdFormatter::visit_type(Types::Type* type) { type_ = "(unknown)"; } void TypeIdFormatter::visit_unknown(Types::Unknown* type) { type_ = colonate(type->name()); } void TypeIdFormatter::visit_modifier(Types::Modifier* type) { // Premods std::string pre = ""; Types::Type::Mods::iterator iter = type->pre().begin(); while (iter != type->pre().end()) if (*iter == "*" || *iter == "&") pre += *iter++; else pre += *iter++ + " "; // Alias type_ = pre + format(type->alias()); // Postmods iter = type->post().begin(); while (iter != type->post().end()) if (*iter == "*" || *iter == "&") type_ += *iter++; else type_ += " " + *iter++; } void TypeIdFormatter::visit_named(Types::Named* type) { type_ = colonate(type->name()); } void TypeIdFormatter::visit_base(Types::Base* type) { type_ = colonate(type->name()); } void TypeIdFormatter::visit_declared(Types::Declared* type) { type_ = colonate(type->name()); } void TypeIdFormatter::visit_template_type(Types::Template* type) { type_ = colonate(type->name()); } void TypeIdFormatter::visit_parameterized(Types::Parameterized* type) { std::string str; if (type->template_id()) str = colonate(type->template_id()->name()) + "<"; else str = "(unknown)<"; if (type->parameters().size()) { str += format(type->parameters().front()); Types::Type::vector::iterator iter = type->parameters().begin(); while (++iter != type->parameters().end()) str += "," + format(*iter); } type_ = str + ">"; } void TypeIdFormatter::visit_func_ptr(Types::FuncPtr* type) { std::string str = format(type->return_type()) + "("; Types::Type::Mods::iterator i_pre = type->pre().begin(); while (i_pre != type->pre().end()) str += *i_pre++; if (fptr_id_) { str += **fptr_id_; *fptr_id_ = 0; } str += ")("; if (type->parameters().size()) { str += format(type->parameters().front()); Types::Type::vector::iterator iter = type->parameters().begin(); while (++iter != type->parameters().end()) str += "," + format(*iter); } type_ = str + ")"; } synopsis-0.12/Synopsis/Parsers/Cxx/Decoder.cc0000664000076400007640000002307711122312026020542 0ustar stefanstefan// // Copyright (C) 2002 Stephen Davies // Copyright (C) 2002 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include "Decoder.hh" #include "Types.hh" #include "Builder.hh" #include "STrace.hh" #include "TypeIdFormatter.hh" #include "Lookup.hh" #include #include using namespace Synopsis; Decoder::Decoder(Builder* builder) : m_builder(builder) { m_lookup = m_builder->lookup(); } std::string Decoder::decodeName() { size_t length = *m_iter++ - 0x80; std::string name(length, '\0'); std::copy(m_iter, m_iter + length, name.begin()); m_iter += length; return name; } std::string Decoder::decodeName(code_iter iter) { size_t length = *iter++ - 0x80; std::string name(length, '\0'); std::copy(iter, iter + length, name.begin()); iter += length; return name; } std::string Decoder::decodeName(const PTree::Encoding &e) { PTree::Encoding::iterator i = e.begin(); size_t length = (const unsigned char)(*i++) - 0x80; std::string name(reinterpret_cast(&*i), length); return name; } void Decoder::decodeQualName(std::vector& names) { STrace trace("Decoder::decodeQualName"); if (*m_iter++ != 'Q') return; int scopes = *m_iter++ - 0x80; while (scopes--) { // Only handle names here if (*m_iter >= 0x80) { // Name names.push_back(decodeName()); } else if (*m_iter == 'T') { // Template :( ++m_iter; TypeIdFormatter f; std::ostringstream name; name << decodeName(); char sep = '<'; code_iter tend = m_iter; tend += *m_iter++ - 0x80; while (m_iter <= tend) name << sep << f.format(decodeType()); name << '>'; names.push_back(name.str()); } else { LOG("Warning: Unknown type inside Q name: " << *m_iter); LOG(" String was: " << m_string); // FIXME: provide << operator for m_string ! // std::cerr << " Decoding " << m_string << std::endl; throw ERROR("Unknown type inside Q name"); } } } void Decoder::init(const PTree::Encoding &e) { m_string = code(e.begin(), e.end()); m_iter = m_string.begin(); } Types::Type* Decoder::decodeType() { STrace trace("Decoder::decodeType()"); code_iter end = m_string.end(); std::vector premod, postmod; std::string name; Types::Type *baseType = 0; // Loop forever until broken while (m_iter != end && !name.length() && !baseType) { int c = *m_iter++; switch (c) { case 'P': postmod.insert(postmod.begin(), "*"); break; case 'R': postmod.insert(postmod.begin(), "&"); break; case 'S': premod.push_back("signed"); break; case 'U': premod.push_back("unsigned"); break; case 'C': premod.push_back("const"); break; case 'V': premod.push_back("volatile"); break; case 'A': { std::string array("["); while (*m_iter != '_') array.push_back(*m_iter++); array.push_back(']'); ++m_iter; premod.push_back(array); break; } case '*': { QName n; n.push_back("*"); baseType = new Types::Dependent(n); break; } case 'i': name = "int"; break; case 'v': name = "void"; break; case 'b': name = "bool"; break; case 's': name = "short"; break; case 'c': name = "char"; break; case 'w': name = "wchar_t"; break; case 'l': name = "long"; break; case 'j': name = "long long"; break; case 'f': name = "float"; break; case 'd': name = "double"; break; case 'r': name = "long double"; break; case 'e': name = "..."; break; case '?': return 0; case 'Q': baseType = decodeQualType(); break; case '_': --m_iter; return 0; // end of func params case 'F': baseType = decodeFuncPtr(postmod); break; case 'T': baseType = decodeTemplate(); break; case 'M': // Pointer to member. Format is same as for named types name = decodeName() + "::*"; break; default: if (c > 0x80) { --m_iter; name = decodeName(); break; } // FIXME // std::cerr << "\nUnknown char decoding '"<lookupType(name); if (premod.empty() && postmod.empty()) return baseType; Types::Type* ret = new Types::Modifier(baseType, premod, postmod); return ret; } Types::Type* Decoder::decodeQualType() { STrace trace("Decoder::decodeQualType()"); // Qualified type: first is num of scopes, each a name. int scopes = *m_iter++ - 0x80; std::vector names; std::vector types; // if parameterized while (scopes--) { // Only handle two things here: names and templates if (*m_iter >= 0x80) { // Name names.push_back(decodeName()); } else if (*m_iter == 'T') { // Template :( ++m_iter; std::string tname = decodeName(); code_iter tend = m_iter; tend += *m_iter++ - 0x80; while (m_iter <= tend) types.push_back(decodeType()); names.push_back(tname); } else { //std::cerr << "Warning: Unknown type inside Q: " << *m_iter << std::endl; // FIXME //std::cerr << " Decoding " << m_string << std::endl; } } // Ask for qualified lookup Types::Type* baseType; try { baseType = m_lookup->lookupType(names); } catch (...) { // Ignore error, and return an Unknown instead return new Types::Unknown(names); } // If the type is a template, then parameterize it with the params found // in the T decoding if (types.size()) { Types::Declared* declared = dynamic_cast(baseType); ASG::ClassTemplate* tempclas = declared ? dynamic_cast(declared->declaration()) : 0; Types::Template* templType = tempclas ? tempclas->template_id() : 0; if (templType && types.size()) { return new Types::Parameterized(templType, types); } } return baseType; } Types::Type* Decoder::decodeFuncPtr(std::vector& postmod) { // Function ptr. Encoded same as function Types::Type::Mods premod; // Move * from postmod to funcptr's premod. This makes the output be // "void (*convert)()" instead of "void (convert)()*" if (postmod.size() > 0 && postmod[0] == "*") { premod.push_back(postmod.front()); postmod.erase(postmod.begin()); } Types::Type::vector params; while (1) { Types::Type* type = decodeType(); if (type) params.push_back(type); else break; } ++m_iter; // skip over '_' Types::Type* returnType = decodeType(); Types::Type* ret = new Types::FuncPtr(returnType, premod, params); return ret; } Types::Parameterized* Decoder::decodeTemplate() { STrace trace("Decoder::decodeTemplate()"); // Template type: Name first, then size of arg field, then arg // types eg: T6vector54cell <-- 5 is len of 4cell if (*m_iter == 'T') ++m_iter; std::string name = decodeName(); code_iter tend = m_iter; tend += *m_iter++ - 0x80; std::vector types; while (m_iter <= tend) types.push_back(decodeType()); Types::Type* type = m_lookup->lookupType(name); // if type is declared and declaration is class and class is template.. Types::Declared* declared = dynamic_cast(type); Types::Named* templ = 0; if (declared) { if (ASG::ClassTemplate* t_class = dynamic_cast(declared->declaration())) templ = t_class->template_id(); else if (ASG::Forward* t_forward = dynamic_cast (declared->declaration())) templ = t_forward->template_id(); } else if (Types::Dependent* d = dynamic_cast(type)) templ = d; // if (templ) // std::cout << "creating Parameterized for " << name << ' ' << templ->name() << std::endl; // else // std::cout << "no template found for " << name << ' ' << typeid(type).name() << std::endl; return new Types::Parameterized(templ, types); } // vim: set ts=8 sts=4 sw=4 et: synopsis-0.12/Synopsis/Parsers/Cxx/Lookup.cc0000664000076400007640000007472111122312026020450 0ustar stefanstefan// // Copyright (C) 2001 Stephen Davies // Copyright (C) 2001 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include #include "Lookup.hh" #include "Builder.hh" #include "Types.hh" #include "Dictionary.hh" #include "Walker.hh" #include "ScopeInfo.hh" #include "TypeInfo.hh" #include "TypeIdFormatter.hh" #include "STrace.hh" //. Simplify names. Typically only used for accessing vectors and iterators using namespace Types; using namespace ASG; // // Class ScopeInfo // ScopeInfo::ScopeInfo(ASG::Scope* s) : is_using(false) { scope_decl = s; search.push_back(this); dict = new Dictionary(); access = ASG::Default; } // FIXME: why is there a using scope? ScopeInfo::ScopeInfo(ScopeInfo* s) : is_using(true) { scope_decl = s->scope_decl; dict = s->dict; } ScopeInfo::~ScopeInfo() { //if (is_using == false) // delete dict; } int ScopeInfo::getCount(const std::string& name) { return ++nscounts[name]; } /////// FIXME: wtf is this doing here?? namespace { //. This class is very similar to ostream_iterator, except that it works on //. pointers to types template class ostream_ptr_iterator { std::ostream* out; const char* sep; public: ostream_ptr_iterator(std::ostream& o, const char* s) : out(&o), sep(s) {} ostream_ptr_iterator& operator =(const T* value) { *out << *value; if (sep) *out << sep; return *this; } ostream_ptr_iterator& operator *() { return *this; } ostream_ptr_iterator& operator ++() { return *this; } ostream_ptr_iterator& operator ++(int) { return *this; } }; } //. Output operator for debugging std::ostream& operator << (std::ostream& o, TypeInfo& i) { TypeIdFormatter tf; o << "[" << tf.format(i.type); if (i.is_const) o << " (const)"; if (i.is_volatile) o << " (volatile)"; if (i.deref) o << " " << i.deref << "*"; o << "]"; return o; } // // Class Lookup // Lookup::Lookup(Builder* builder) { m_builder = builder; } Lookup::~Lookup() { // TODO Delete all ... //delete m; } //. Finds or creates a cached Scope ScopeInfo* Lookup::find_info(ASG::Scope* decl) { return m_builder->find_info(decl); } ASG::Scope* Lookup::global() { return m_builder->global(); } ASG::Scope* Lookup::scope() { return m_builder->scope(); } // // Type Methods // //. Predicate class that is true if the object passed to the constructor is a //. type, as opposed to a modifier or a parametrized, etc class isType : public Types::Visitor { bool m_value; public: //. constructor. Visits the given type thereby setting the value isType(Types::Named* type) : m_value(false) { type->accept(this); } //. bool operator, returns the value determined by visitation during //. construction operator bool() { return m_value; } //. Okay void visit_base(Types::Base*) { m_value = true; } //. Okay void visit_unknown(Types::Unknown*) { m_value = true; } //. Okay if not a function declaration void visit_declared(Types::Declared* type) { // Depends on what was declared: Everything but function is okay if (dynamic_cast(type->declaration())) m_value = false; else m_value = true; } //. Okay if a template dependent arg void visit_dependent(Types::Dependent*) { m_value = true; } //. Fallback: Not okay void visit_type(Types::Type*) { m_value = false; } }; // Public method to lookup a type Types::Named* Lookup::lookupType(const std::string& name, bool func_okay) { STrace trace("Lookup::lookupType(name, func_okay)"); Types::Named* type = lookup(name, func_okay); if (type) return type; // Not found, declare it unknown //cout << "Warning: Name "<create_unknown(u_name); } // Private method to lookup a type in the current scope Types::Named* Lookup::lookup(const std::string& name, bool func_okay) { STrace trace("Lookup::lookup(name, func_okay)"); const ScopeSearch& search = m_builder->scopeinfo()->search; return lookup(name, search, func_okay); } //. Looks up the name in the scope of the given scope Types::Named* Lookup::lookupType(const std::string& name, ASG::Scope* decl) { STrace trace("Lookup::lookupType(name,scope)"); ScopeInfo* scope = find_info(decl); return lookup(name, scope->search); } class FunctionHeuristic { typedef std::vector v_Type; typedef v_Type::iterator vi_Type; typedef std::vector v_Param; typedef v_Param::iterator vi_Param; v_Type m_args; int cost; #ifdef DEBUG STrace trace; public: //. Constructor - takes arguments to match functions against FunctionHeuristic(const v_Type& v) : m_args(v), trace("FunctionHeuristic") { TypeIdFormatter tf; std::ostringstream buf; for (size_t index = 0; index < v.size(); index++) { if (index) buf << ", "; buf << tf.format(v[index]); } //buf << std::ends; LOG("Function arguments: " << buf.str()); } #else public: //. Constructor - takes arguments to match functions against FunctionHeuristic(const v_Type& v) : m_args(v) { } #endif //. Heuristic operator, returns 'cost' of given function - higher is //. worse, 1000 means no match int operator ()(ASG::Function* func) { cost = 0; int num_args = m_args.size(); v_Param* params =& func->parameters(); bool func_ellipsis = hasEllipsis(params); int num_params = params->size() - func_ellipsis; int num_default = countDefault(params); // Check number of params first if (!func_ellipsis && num_args > num_params) cost = 1000; if (num_args < num_params - num_default) cost = 1000; if (cost < 1000) { // Now calc cost of each argument in turn int max_arg = num_args > num_params ? num_params : num_args; for (int index = 0; index < max_arg; index++) calcCost(m_args[index], (*params)[index]->type()); } #ifdef DEBUG LOG("Function: " << func->name() << " -- Cost is " << cost); #endif return cost; } private: //. Find an ellipsis as the lasg arg bool hasEllipsis(v_Param* params) { if (params->size() == 0) return false; Types::Type* back = params->back()->type(); if (Types::Base* base = dynamic_cast(back)) if (base->name().size() == 1 && base->name().front() == "...") return true; return false; } //. Returns the number of parameters with default values. Counts from the //. back and stops when it finds one without a default. int countDefault(v_Param* params) { v_Param::reverse_iterator iter = params->rbegin(), end = params->rend(); int count = 0; while (iter != end) { ASG::Parameter* param = *iter++; if (!param->value().size()) break; count++; } return count; } //. Calculate the cost of converting 'arg' into 'param'. The cost is //. accumulated on the 'cost' member variable. void calcCost(Types::Type* arg_t, Types::Type* param_t) { TypeIdFormatter tf; if (!arg_t) return; TypeInfo arg(arg_t), param(param_t); #ifdef DEBUG // std::cout << arg << param << std::endl; // // std::cout << tf.format(type) <<","< 0) return; // Different types is bad if (arg.type != param.type) cost += 10; // Different * levels is also bad if (arg.deref != param.deref) cost += 10; // Worse constness is bad if (arg.is_const > param.is_const) cost += 5; } }; //. Looks up the function in the given scope with the given args. ASG::Function* Lookup::lookupFunc(const std::string& name, ASG::Scope* decl, const std::vector& args) { STrace trace("Lookup::lookupFunc"); TypeIdFormatter tf; // Now loop over the search scopes const ScopeSearch& search = find_info(decl)->search; ScopeSearch::const_iterator s_iter = search.begin(); typedef std::vector v_Function; v_Function functions; // Loop over precalculated search list while (s_iter != search.end()) { ScopeInfo* scope = *s_iter++; // Check if dict has it if (scope->dict->has_key(name)) { findFunctions(name, scope, functions); } // If not a dummy scope, resolve the set if (scope->is_using == false && !functions.empty()) { // Return best function (or throw error) int cost; ASG::Function* func = bestFunction(functions, args, cost); if (cost < 1000) return func; throw ERROR("No appropriate function found."); } } throw ERROR("No matching functions found."); } // Operator lookup ASG::Function* Lookup::lookupOperator(const std::string& oper, Types::Type* left_type, Types::Type* right_type) { STrace trace("Lookup::lookupOperator("+oper+",left,right)"); // Find some info about the two types TypeInfo left(left_type), right(right_type); bool left_user = !!dynamic_cast(left_type) && !left.deref; bool right_user = !!dynamic_cast(right_type) && !right.deref; // First check if the types are user-def or enum if (!left_user && !right_user) return 0; std::vector functions; std::vector args; ASG::Function* best_method = 0, *best_func = 0; int best_method_cost, best_func_cost; // Member methods of left_type try { ASG::Class* clas = Types::declared_cast(left.type); // Construct the argument list args.push_back(right_type); try { findFunctions(oper, find_info(clas), functions); best_method = bestFunction(functions, args, best_method_cost); } catch (const Dictionary::KeyError&) { best_method = 0; } // Clear functions and args for use below functions.clear(); args.clear(); } catch (const Types::wrong_type_cast&) { /* ignore: not a class */ } // Non-member functions // Loop over the search scopes const ScopeSearch& search = m_builder->scopeinfo()->search; ScopeSearch::const_iterator s_iter = search.begin(); while (s_iter != search.end()) { ScopeInfo* scope = *s_iter++; // Check if dict has any names that match if (!scope->dict->has_key(oper)) continue; // Get the matching functions from the dictionary findFunctions(oper, scope, functions); // Scope rules say once you find any results: stop break; } // Koenig Rule: add operators from namespaces of arguments // void findKoenigFunctions(oper, functions, args); if (left_user) try { QName enclosing_name = Types::type_cast(left.type)->name(); enclosing_name.pop_back(); if (enclosing_name.size()) { ScopeInfo* scope = find_info( Types::declared_cast(lookupType(enclosing_name, false, global())) ); findFunctions(oper, scope, functions); } } catch (const Types::wrong_type_cast& e) {} if (right_user) try { QName enclosing_name = Types::type_cast(right.type)->name(); enclosing_name.pop_back(); if (enclosing_name.size()) { ScopeInfo* scope = find_info( Types::declared_cast(lookupType(enclosing_name, false, global())) ); findFunctions(oper, scope, functions); } } catch (const Types::wrong_type_cast& e) {} // Add builtin operators to aide in best-function resolution // NYI // Puts left and right types into args args.push_back(left_type); args.push_back(right_type); // Find best non-method function best_func = bestFunction(functions, args, best_func_cost); // Return best method or function if (best_method) { if (best_func) { if (best_func_cost < best_method_cost) return best_func; else return best_method; } else { return best_method; } } else { if (best_func) return best_func; else return 0; } } void Lookup::findFunctions(const std::string& name, ScopeInfo* scope, ASG::Function::vector& functions) { STrace trace("Lookup::findFunctions"); // Get the matching names from the dictionary try { Named::vector types = scope->dict->lookup_multiple(name); // Put only the ASG::Functions into 'functions' for (Named::vector::iterator iter = types.begin(); iter != types.end();) try { functions.push_back( Types::declared_cast(*iter++) ); } catch (const Types::wrong_type_cast& ) { throw ERROR("looked up func '"<dict->has_key(name)) { if (results.empty()) results = scope->dict->lookup_multiple(name); else { Named::vector temp_result = scope->dict->lookup_multiple(name); std::copy(temp_result.begin(), temp_result.end(), std::back_inserter(results)); } } // If not a dummy scope, resolve the set if (scope->is_using == false && !results.empty()) { #ifdef DEBUG Named::vector save_results = results; #endif // Remove the unknowns Types::Unknown* unknown = 0; Named::vector::iterator r_iter = results.begin(); while (r_iter != results.end()) if ((unknown = dynamic_cast(*r_iter)) != 0) r_iter = results.erase(r_iter); else if (!func_okay && !isType(*r_iter)) r_iter = results.erase(r_iter); else ++r_iter; // Should be either 1 non-unknowns left or nothing but with // 'unknown' set if (results.size() == 0 && unknown != 0) return unknown; if (results.size() == 0) // This means there was only functions in the list, which we are // ignoring continue; if (results.size() == 1) { // Exactly one match! return it Types::Named* type = results[0]; Types::Declared* d = dynamic_cast(type); if (d) { ASG::UsingDeclaration *u = dynamic_cast(d->declaration()); if (u) type = u->target(); } return type; } // Store in class var? LOG("Multiple candidates!"); #ifdef DEBUG for (r_iter = save_results.begin(); r_iter != save_results.end(); ++r_iter) LOG(" - '" << (*r_iter)->name() << "' - " << typeid(**r_iter).name()); #endif Types::Named* type = results[0]; // If we are looking at a 'declared' UsingDeclaration, return the referenced target. Types::Declared* d = dynamic_cast(type); if (d) { ASG::UsingDeclaration *u = dynamic_cast(d->declaration()); if (u) type = u->target(); } return type; } } return 0; } class InheritanceAdder { std::list& open_list; public: InheritanceAdder(std::list& l) : open_list(l) {} InheritanceAdder(const InheritanceAdder& i) : open_list(i.open_list) {} void operator() (ASG::Inheritance* i) { try { ASG::Class* parent = Types::declared_cast(i->parent()); open_list.push_back(parent); } catch (const Types::wrong_type_cast&) { // ?? ignore for now } } }; //. Private Qualified type lookup Types::Named* Lookup::lookupQual(const std::string& name, const ScopeInfo* scope, bool func_okay) { STrace trace("Lookup::lookupQual"); //LOG("name: " << name << " in: " << scope->scope_decl->name()); // First determine: class or namespace if (ASG::Class* the_class = dynamic_cast(scope->scope_decl)) { // A class: search recursively, in order, through base classes // FIXME: read up about overriding, hiding, virtual bases and funcs, // etc std::list open_list; open_list.push_back(the_class); while (!open_list.empty()) { ASG::Class* clas = open_list.front(); open_list.pop_front(); ScopeInfo* scope = find_info(clas); if (scope->dict->has_key(name)) { try { Types::Named* named = scope->dict->lookup(name); if (func_okay || isType(named)) { return named; } // Else it's a function and a type was wanted: keep looking } catch (const Dictionary::MultipleError& e) { // We may get a MultipleError only if we found functions. } catch (const Dictionary::KeyError& e) { std::cerr << "Warning: Key error when has_key said yes" << std::endl; } } // Add base classes to open list std::for_each(clas->parents().begin(), clas->parents().end(), InheritanceAdder(open_list)); } } else if (dynamic_cast(scope->scope_decl)) { // A namespace: search recursively through using declarations // constructing a conflict set - dont traverse using declarations of // any namespace which has an entry for 'name'. Each NS only once std::list open, closed; open.push_back(scope); std::vector results; while (!open.empty()) { const ScopeInfo* ns = open.front(); open.pop_front(); // Check if 'ns' is on closed list if (std::find(closed.begin(), closed.end(), ns) != closed.end()) continue; // Add to closed list closed.push_back(ns); // Check if 'ns' has 'name' if (ns->dict->has_key(name)) { // Add all results to results list if (results.empty()) results = ns->dict->lookup_multiple(name); else { std::vector temp = ns->dict->lookup_multiple(name); std::copy(temp.begin(), temp.end(), back_inserter(results)); } } else { // Add 'using' Scopes to open list std::copy(ns->using_scopes.begin(), ns->using_scopes.end(), back_inserter(open)); } } // Now we have a set of results if (!results.size()) { LOG("No results! Looking up '" << name << "'"); return 0; } // FIXME: figure out what to do about multiple Types::Named* best = 0; int best_score = -1; for (std::vector::iterator iter = results.begin(); iter != results.end(); iter++) { // Fixme.. create a Score visitor int score = 0; Types::Named* type = *iter; if (Types::Declared* declared = dynamic_cast(type)) { score++; if (ASG::Declaration* decl = declared->declaration()) { score++; if (dynamic_cast(decl)) score--; } } if (score > best_score) { best_score = score; best = type; } } return best; } // Not class or NS - which is illegal for a qualified (but coulda been // template etc?:) LOG("Not class or namespace: " << typeid(*scope->scope_decl).name()); return 0; } //. Public Qualified Type Lookup Types::Named* Lookup::lookupType(const std::vector& names, bool func_okay, ASG::Scope* start_scope) { STrace trace("Lookup::lookupType(vector names,search,func_okay)"); //LOG("looking up '" << names << "' in " << (start_scope?start_scope->name() : m_scope->name())); Types::Named* type = 0; ScopeInfo* scope = 0; std::vector::const_iterator n_iter = names.begin(); // Setup the initial scope std::string name = *n_iter; if (!name.size()) { // Qualified name starts with :: so always start at global scope type = global()->declared(); } else { // Lookup first name as usual if (start_scope) type = lookupType(name, start_scope); else type = lookupType(name); } ++n_iter; // Look over every identifier in the qualified name while (n_iter != names.end()) { name = *n_iter++; try { // FIXME: this should use some sort of visitor ASG::Declaration* decl = Types::declared_cast(type); if (ASG::Typedef* tdef = dynamic_cast(decl)) { type = Types::type_cast(tdef->alias()); } // FIXME: type can be a Types::Dependent (i.e. a template parameter) // in which case this will throw a wrong_type_cast !!! // Find cached scope from 'type' scope = find_info( Types::declared_cast(type) ); } catch (const Types::wrong_type_cast& ) { // Abort lookup throw ERROR("qualified lookup found a type (" << type->name() << ") that wasn't a scope finding: " << names); } // Find the named type in the current scope type = lookupQual(name, scope, func_okay && n_iter == names.end()); if (!type) // Abort lookup break; } if (!type) { LOG("Not found -> creating Unknown"); // Not found! Add Type.Unknown of scoped name return m_builder->create_unknown(names); } return type; } //. Maps a scoped name into a vector of scopes and the final type. Returns //. true on success. bool Lookup::mapName(const QName& names, std::vector& o_scopes, Types::Named*& o_type) { STrace trace("Lookup::mapName"); ASG::Scope* asg_scope = global(); QName::const_iterator iter = names.begin(); QName::const_iterator lasg = names.end(); lasg--; QName scoped_name; // Start scope name at global level scoped_name.push_back(""); // Sanity check if (iter == names.end()) return false; // Loop through all containing scopes while (iter != lasg) { //const std::string& name = *iter++; scoped_name.push_back(*iter++); Types::Named* type = lookupType(scoped_name); if (!type) { LOG("Warning: failed to lookup " << scoped_name << " in global scope"); return false; } try { asg_scope = Types::declared_cast(type); } catch (const Types::wrong_type_cast&) { LOG("Warning: looked up scope wasnt a scope!" << scoped_name); return false; } o_scopes.push_back(asg_scope); } // iter now == lasg, which can be any type scoped_name.push_back(*iter); Types::Named* type = lookupType(scoped_name, true); if (!type) { //find_info(asg_scope)->dict->dump(); LOG("\nWarning: final type lookup wasn't found!" << *iter); return false; } o_type = type; return true; } Types::Type* Lookup::arrayOperator(Types::Type* object, Types::Type* arg, ASG::Function*& func_oper) { STrace trace("Lookup::arrayOperator"); func_oper = 0; // First decide if should use derefence or methods TypeInfo info(object); if (info.deref) { // object is of pointer type, so just deref it // Check for typedef try { object = Types::declared_cast(object)->alias(); } catch (const Types::wrong_type_cast&) { /* ignore -- not a typedef */ } // Check for modifier if (Types::Modifier* mod = dynamic_cast(object)) { typedef Types::Type::Mods Mods; Types::Modifier* newmod = new Types::Modifier(mod->alias(), mod->pre(), mod->post()); for (Mods::iterator iter = newmod->post().begin(); iter != newmod->post().end(); iter++) { if (*iter == "*" || *iter == "[]") { newmod->post().erase(iter); return newmod; } } //delete newmod; throw ERROR("Unable to dereference type for array operator!"); } throw ERROR("Unknown type for array operator!"); } // Hmm object type -- try for [] method ASG::Class* clas; try { clas = Types::declared_cast(info.type); } catch (const Types::wrong_type_cast&) { TypeIdFormatter tf; throw ERROR("Not deref and not class type for array operator! " << tf.format(info.type) << " <-- " << tf.format(object)); } Function::vector functions; try { findFunctions("[]", find_info(clas), functions); } catch (const Dictionary::KeyError&) { throw ERROR("No array operator for class " << clas->name()); } // Make args list std::vector args; args.push_back(arg); // Find best function int cost; ASG::Function* func = bestFunction(functions, args, cost); if (!func || cost >= 1000) throw ERROR("No best function found for array operator."); func_oper = func; return func->return_type(); } Types::Named* Lookup::resolveType(Types::Named* type) { STrace trace("Lookup::resolveType(named)"); try { QName& name = type->name(); LOG("Resolving '" << name << "'"); QName::iterator iter = name.begin(), end = name.end() - 1; ASG::Scope* scope = global(); while (iter != end) { // Find *iter in scope Types::Named* scope_type = find_info(scope)->dict->lookup(*iter++); scope = Types::declared_cast(scope_type); } LOG("Looking up '"<<(*iter)<<"' in '"<< ((scope==global())?"global":scope->name().back()) << "'"); // Scope is now the containing scope of the type we are checking return find_info(scope)->dict->lookup(*iter); } catch (const Types::wrong_type_cast& ) { LOG("resolveType failed! bad cast."); } catch (Dictionary::KeyError e) { LOG("resolveType failed! key error: '"<::iterator iter = e.types.begin(); while (iter != e.types.end()) { LOG(" +" << (*iter)->name()); iter++; } } catch (...) { // There shouldn't be any errors, but just in case... throw ERROR("resolveType failed with unknown error!"); } return type; } std::string Lookup::dumpSearch(ScopeInfo* scope) { ScopeSearch& search = scope->search; std::ostringstream buf; buf << "Search for "; if (scope->scope_decl->name().size() == 0) buf << "global"; else buf << this->scope()->name(); buf << " is now: "; ScopeSearch::iterator iter = search.begin(); while (iter != search.end()) { buf << (iter==search.begin() ? "" : ", "); const QName& name = (*iter)->scope_decl->name(); if (name.size()) if ( (*iter)->is_using ) buf << "(" << name << ")"; else buf << name; else buf << "global"; ++iter; } //buf << std::ends; return buf.str(); } // vim: set ts=8 sts=4 sw=4 et: synopsis-0.12/Synopsis/Parsers/Cxx/Lookup.hh0000664000076400007640000001156111122312026020453 0ustar stefanstefan// // Copyright (C) 2001 Stephen Davies // Copyright (C) 2001 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Lookup_hh_ #define Lookup_hh_ #include "ASG.hh" // Forward declare some Types::Type's namespace Types { class Type; class Base; class Named; class Unknown; class TemplateType; class FuncPtr; } // Forward declare the Builder class class Builder; class ScopeInfo; typedef std::vector ScopeSearch; // TODO: move to common //. ASG Builder. //. This class manages the building of an ASG, including queries on the //. existing ASG such as name and type lookups. The building operations are //. called by SWalker as it walks the parse tree. class Lookup { public: //. Constructor Lookup(Builder*); //. Destructor. Recursively destroys all ASG objects ~Lookup(); //. Changes the current accessability for the current scope void set_access(ASG::Access); // // ASG Methods // //. Returns the current scope ASG::Scope* scope(); //. Returns the global scope ASG::Scope* global(); // // Type Methods // //. Looks up the name in the current scope. This method always succeeds -- //. if the name is not found it forward declares it. Types::Named* lookupType(const std::string& name, bool func_okay = false); //. Looks up the qualified name in the current scope. This method always //. succeeds -- if the name is not found it forwards declares it. //. @param names The list of identifiers given //. @param fuc_okay If true, multiple declarations will not cause an error (needs fixing) //. @param scope If set determines the scope to start lookup from, else the //. current scope is used Types::Named* lookupType(const QName& names, bool func_okay=false, ASG::Scope* scope=0); //. Looks up the name in the scope of the given scope. This method may //. return a 0 ptr if the lookup failed. Types::Named* lookupType(const std::string& name, ASG::Scope* scope); //. Looks up the function in the given scope with the given args. ASG::Function* lookupFunc(const std::string& , ASG::Scope*, const std::vector&); //. Looks up the function operator in the current scope with the given //. types. May return 0 if builtin operator or no operator is found. ASG::Function* lookupOperator(const std::string& oper, Types::Type* left_type, Types::Type* right_type); //. Maps a scoped name into a vector of scopes and the final type. Returns //. true on success. bool mapName(const QName& name, std::vector&, Types::Named*&); //. Returns the types for an array operator on the given type with an //. argument of the given type. If a function is used then it is stored in //. the function ptr ref given, else the ptr is set to 0. Types::Type* arrayOperator(Types::Type* object, Types::Type* arg, ASG::Function*&); //. Resolves the final type of the given type. If the given type is an //. Unknown, it checks to see if the type has been defined yet and returns //. that instead. Types::Named* resolveType(Types::Named* maybe_unknown); private: //. Looks up the name in the current scope. This method may fail and //. return a 0 ptr. Types::Named* lookup(const std::string& name, bool func_okay = false); //. Searches for name in the list of Scopes. This method may return 0 //. if the name is not found. Types::Named* lookup(const std::string& name, const ScopeSearch&, bool func_okay = false) throw (); //. Searches for name in the given qualified scope. This method may return //. 0 if the name is not found. Lookup proceeds according to the spec: //. if 'scope' is a Class scope, then scope and all base classes are //. searched, else if it's a 'namespace' scope then all usings are checked. Types::Named* lookupQual(const std::string& name, const ScopeInfo*, bool func_okay = false); //. Return a ScopeInfo* for the given Declaration. This method first looks for //. an existing Scope* in the Private map. ScopeInfo* find_info(ASG::Scope*); //. Utility class to add all functions with the given name in the given //. Scope's dictionary to the given vector. May throw an error if the //. types looked up are not functions. void findFunctions(const std::string&, ScopeInfo*, std::vector&); //. Determines the best function from the given list for the given //. arguments using heuristics. Returns the function and stores the cost ASG::Function* bestFunction(const std::vector&, const std::vector&, int& cost); //. Formats the search of the given Scope for logging std::string dumpSearch(ScopeInfo* scope); //. A pointer to the Builder. Builder* m_builder; }; #endif // vim: set ts=8 sts=4 sw=4 et: synopsis-0.12/Synopsis/Parsers/Cxx/SXRBuffer.hh0000664000076400007640000001342611171143456021027 0ustar stefanstefan// // Copyright (C) 2008 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef SXRBuffer_hh_ #define SXRBuffer_hh_ #include #include #include // An SXRBuffer generates a xml-ified version of the source file, with // identifiers suitably annotated to allow linking. // Since the processing of the parse tree is not monotonic (for example, // member functions are parsed only after the full class body has been seen), // the entries aren't generated in-order. We collect them here, then write out // the whole file once the translation has finished. class SXRBuffer { public: struct Entry { enum Kind { SPAN, XREF}; //. Less-than functor to order entries within lines by column. struct less { bool operator() (Entry const &a, Entry const &b) const { return a.column < b.column;} }; Entry(unsigned int c, int l, Kind k, std::string const &n, std::string const &t, std::string const &f, std::string const &d, bool a) : column(c), length(l), kind(k), name(n), type(t), from(f), description(d), continuation(a) {} unsigned int column; int length; Kind kind; std::string name; std::string type; std::string from; std::string description; bool continuation; }; SXRBuffer(std::string const &out, std::string const &in, std::string const &name) // line numbers are reported starting from 1 : line_(1), column_(0), new_line_(true) { outbuf_.open(out.c_str(), std::ios_base::out); inbuf_.open(in.c_str(), std::ios_base::in); outbuf_.sputn("\n", 3); } ~SXRBuffer() { outbuf_.sputn("", 6); inbuf_.close(); outbuf_.close(); } void insert_span(unsigned int line, unsigned int column, int length, std::string const &type) { Line &l = lines_[line]; l.insert(Entry(column, length, Entry::SPAN, "", type, "", "", false)); } void insert_xref(unsigned int line, unsigned int column, unsigned int length, std::string const &name, std::string const &type, std::string const &from, std::string const &description, bool continuation) { Line &l = lines_[line]; l.insert(Entry(column, length, Entry::XREF, encode(name), type, encode(from), encode(description), continuation)); } void write() { unsigned int line = 0; while (advance(line, 0)) { Line &l = lines_[line]; Line::iterator i = l.begin(); while (i != l.end()) { Entry const &entry = *i; advance(line, entry.column); switch (entry.kind) { case Entry::SPAN: insert("", 2); if (entry.length == -1) finish_line(); else advance(line, entry.column + entry.length); insert("", 7); break; case Entry::XREF: insert("", 2); if (entry.length == -1) finish_line(); else advance(line, entry.column + entry.length); insert("", 4); break; } ++i; } ++line; } } private: std::string encode(std::string const &n) { std::string retn; for (std::string::const_iterator i = n.begin(); i != n.end(); ++i) switch (*i) { case '<': retn += "<"; break; case '>': retn += ">"; break; case '&': retn += "&"; break; case '"': retn += """; break; default: retn += *i; } return retn; } void insert(char const *s, unsigned int l) { if (new_line_) { outbuf_.sputn("", 6); new_line_ = false; } outbuf_.sputn(s, l); } void put(char c) { if (new_line_) { outbuf_.sputn("", 6); new_line_ = false; } switch (c) { case '\n': outbuf_.sputn("\n", 8); ++line_; column_ = 0; new_line_ = true; break; case '&': outbuf_.sputn("&", 5); ++column_; break; case '<': outbuf_.sputn("<", 4); ++column_; break; case '>': outbuf_.sputn(">", 4); ++column_; break; default: outbuf_.sputc(c); ++column_; break; } } bool finish_line() { std::istreambuf_iterator in(&inbuf_); std::istreambuf_iterator end; while (in != end && *in != '\n') put(*in++); return in == end; } // Advance till the given input source file position. bool advance(unsigned int line, unsigned int column) { std::istreambuf_iterator in(&inbuf_); std::istreambuf_iterator end; while ((line_ < line || column_ < column) && in != end) put(*in++); return in != end; } typedef std::set Line; typedef std::map Map; Map lines_; std::filebuf inbuf_; std::filebuf outbuf_; unsigned int line_; unsigned int column_; bool new_line_; }; #endif synopsis-0.12/Synopsis/Parsers/Cxx/exception.hh0000664000076400007640000000047211104703262021205 0ustar stefanstefan// // Copyright (C) 2008 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef exception_hh_ #define exception_hh_ #include #include class py_error_already_set : std::exception {}; #endif synopsis-0.12/Synopsis/Parsers/Cxx/Dictionary.cc0000664000076400007640000000517111122312026021275 0ustar stefanstefan// // Copyright (C) 2001 Stephen Davies // Copyright (C) 2001 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include "Dictionary.hh" #include "ASG.hh" #include "Types.hh" #include #include //. Lookup single //. TODO: the forward filtering could probably be done much simpler! //. TODO: The exception throwing is heavy too, besides all the vector copying! Types::Named* Dictionary::lookup(const std::string& name) { iterator i = map_.lower_bound(name); iterator end = map_.upper_bound(name); // Check for not found if (i == end) throw KeyError(name); Types::Named* type = i->second; if (++i == end) return type; // Check for Unknown types if (dynamic_cast(type)) { // Skip further unknown types while (i != end && dynamic_cast(i->second)) ++i; if (i == end) // No choice but to return the Unknown return type; type = (i++)->second; // Any other types that aren't unknown cause error while (i != end && dynamic_cast(i->second)) ++i; if (i == end) // No more non-Unknown types, so return the one we found return type; } // Create exception object MultipleError exc(name); exc.types.push_back(type); do exc.types.push_back(i->second); while (++i != end); throw exc; } //. Lookup multiple std::vector Dictionary::lookup_multiple(const std::string& name) throw (KeyError) { iterator i = map_.lower_bound(name); iterator end = map_.upper_bound(name); // Check for not found if (i == end) throw KeyError(name); // Store type pointers in a vector std::vector types; do types.push_back(i->second); while (++i != end); return types; } void Dictionary::insert(Types::Named* type) { std::string key = type->name().back(); map_.insert(value_type(key, type)); } void Dictionary::insert(ASG::Declaration* decl) { Types::Declared* declared = new Types::Declared(decl->name(), decl); insert(declared); if (ASG::Function* func = dynamic_cast(decl)) // Also insert real (unmangled) name of functions map_.insert(value_type(func->realname(), declared)); } void Dictionary::remove(std::string const &name) { map_.erase(name); } void Dictionary::dump() { iterator i = map_.begin(), end = map_.end(); std::cout << "Dumping dictionary: " << map_.size() << " items.\n"; while (i != end) { value_type p = *i++; std::cout << " " << p.first << "\t-> " << p.second->name() << "\n"; } std::cout.flush(); } synopsis-0.12/Synopsis/Parsers/Cxx/synopsis.py.in0000664000076400007640000000150711104703262021534 0ustar stefanstefan#! /usr/bin/env python from Synopsis import config from Synopsis.process import process from Synopsis.Processor import * from Synopsis.Processors import * from Synopsis.Parsers import Cxx from distutils import sysconfig import sys, os, os.path topdir = '@topdir@' srcdir = '@srcdir@' cppflags = ['-I%s/Cxx-API/include'%(topdir), '-I../../../src', '-I%s/src'%(topdir), '-I%s/src/Synopsis/gc/include'%(topdir), '-I%s'%(srcdir), '-I%s'%(srcdir) + '/occ', '-I%s'%(sysconfig.get_python_inc())] cxx = Cxx.Parser(base_path = topdir + os.sep, cppflags = cppflags, syntax_prefix = 'links', xref_prefix = 'xref') link = Linker(Comments.Translator(filter = Comments.SSDFilter())) process(cxx = cxx, link = link) synopsis-0.12/Synopsis/Parsers/Cxx/Types.cc0000664000076400007640000000654311122312026020300 0ustar stefanstefan// // Copyright (C) 2002 Stephen Davies // Copyright (C) 2002 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include "Types.hh" using namespace Types; // // Class Types::Type // Type::Type() {} Type::~Type() {} void Type::accept(Visitor* visitor) { visitor->visit_type(this); } // // Class Types::Named // Named::Named(const QName& n) : m_name(n) {} Named::~Named() {} void Named::accept(Visitor* visitor) { visitor->visit_named(this); } // // Class Types::Base // Base::Base(const QName& n) : Named(n) {} void Base::accept(Visitor* visitor) { visitor->visit_base(this); } // // Class Types::Unknown // Unknown::Unknown(const QName& n) : Named(n) {} void Unknown::accept(Visitor* visitor) { visitor->visit_unknown(this); } // // Class Types::Dependent // Dependent::Dependent(const QName& n) : Named(n) {} void Dependent::accept(Visitor* visitor) { visitor->visit_dependent(this); } // // Class Types::Declared // Declared::Declared(const QName& n, ASG::Declaration* decl) : Named(n), m_decl(decl) {} void Declared::accept(Visitor* visitor) { visitor->visit_declared(this); } // // Class Types::Template // Template::Template(const QName& n, ASG::Declaration* decl, const param_vector& params) : Declared(n, decl), m_params(params) {} void Template::accept(Visitor* visitor) { visitor->visit_template_type(this); } // // Class Types::Modifier // Modifier::Modifier(Type* alias, const Mods& pre, const Mods& post) : m_alias(alias), m_pre(pre), m_post(post) {} Modifier::~Modifier() {} void Modifier::accept(Visitor* visitor) { visitor->visit_modifier(this); } // // Class Types::Array // Array::Array(Type* alias, const Mods& sizes) : m_alias(alias), m_sizes(sizes) {} Array::~Array() {} void Array::accept(Visitor* visitor) { visitor->visit_array(this); } // // Class Types::Parameterized // Parameterized::Parameterized(Named* t, const Type::vector& params) : m_template(t), m_params(params) {} Parameterized::~Parameterized() {} void Parameterized::accept(Visitor* visitor) { visitor->visit_parameterized(this); } // // Class Types::FuncPtr // FuncPtr::FuncPtr(Type::Type* ret, const Mods& premods, const Type::vector& params) : m_return(ret), m_premod(premods), m_params(params) {} FuncPtr::~FuncPtr() {} void FuncPtr::accept(Visitor* visitor) { visitor->visit_func_ptr(this); } // // Type::Visitor // Visitor::~Visitor() {} void Visitor::visit_type(Type*) {} void Visitor::visit_unknown(Unknown* t) { visit_type(t); } void Visitor::visit_base(Base* t) { visit_named(t); } void Visitor::visit_dependent(Dependent* t) { visit_named(t); } void Visitor::visit_declared(Declared* t) { visit_named(t); } void Visitor::visit_modifier(Modifier* t) { visit_type(t); } void Visitor::visit_array(Array* t) { visit_type(t); } void Visitor::visit_named(Named* t) { visit_type(t); } void Visitor::visit_template_type(Template* t) { visit_declared(t); } void Visitor::visit_parameterized(Parameterized* t) { visit_type(t); } void Visitor::visit_func_ptr(FuncPtr* t) { visit_type(t); } // exception wrong_type_cast const char* wrong_type_cast::what() const throw() { return "Type::wrong_type_cast"; } // vim: set ts=8 sts=4 sw=4 et: synopsis-0.12/Synopsis/Parsers/Cxx/Decoder.hh0000664000076400007640000000570111122762605020562 0ustar stefanstefan// // Copyright (C) 2002 Stephen Davies // Copyright (C) 2002 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Decoder_hh_ #define Decoder_hh_ #include #include "QName.hh" #include #include // Forward decl of Types::Type namespace Types { class Type; class Parameterized; } // Forward decl of Builder class Builder; class Lookup; //. A string type for the encoded names and types typedef Synopsis::PTree::Encoding::Code code; //. A string iterator type for the encoded names and types typedef code::iterator code_iter; //. Decoder for OCC encodings. This class can be used to decode the names and //. types encoded by OCC for function and variable types and names. class Decoder { public: //. Constructor Decoder(Builder*); //. Initialise the type decoder void init(const Synopsis::PTree::Encoding &); //. Returns the iterator used in decoding code_iter& iter() { return m_iter; } //. Return a Type object from the encoded type. //. @preconditions You must call init() first. Types::Type* decodeType(); //. Decodes a Qualified type. iter must be just after the Q Types::Type* decodeQualType(); //. Decodes a Template type. iter must be just after the T Types::Parameterized* decodeTemplate(); //. Decodes a FuncPtr type. iter must be just after the F. The vector is //. the postmod - if it contains a * then it will be removed and given to //. the funcptr instead Types::Type* decodeFuncPtr(std::vector&); //. Decode a name std::string decodeName(); //. Decode a qualified name QName decodeQualified(); //. Decode a name starting from the given iterator. //. Note the iterator passed need not be from the currently decoding //. string since this is a simple method. std::string decodeName(code_iter); //. Decode a name starting from the given char* std::string decodeName(const Synopsis::PTree::Encoding &); //. Decode a qualified name with only names in it void decodeQualName(QName& names); //. Returns true if the char* is pointing to a name (that starts with a //. length). This is needed since char can be signed or unsigned, and //. explicitly casting to one or the other is ugly bool isName(const Synopsis::PTree::Encoding &); friend std::ostream &operator<< (std::ostream &os, Decoder const &d) { return os << code((code::const_iterator)d.m_iter, d.m_string.end());} private: //. The encoded type string currently being decoded code m_string; //. The current position in m_enc_iter code_iter m_iter; //. The builder Builder* m_builder; //. The lookup Lookup* m_lookup; }; inline bool Decoder::isName(const Synopsis::PTree::Encoding &e) { return !e.empty() && e.at(0) > 0x80; } #endif // header guard // vim: set ts=8 sts=4 sw=4 et: synopsis-0.12/Synopsis/Parsers/Cxx/Makefile.in0000664000076400007640000000263311104703262020734 0ustar stefanstefan# # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # SHELL := /bin/sh srcdir := @srcdir@ builddir:= @builddir@ PYTHON := @PYTHON@ SYNOPSIS:= $(PYTHON) synopsis.py CXX := @CXX@ LDSHARED:= @LDSHARED@ MAKEDEP := $(CXX) -M CPPFLAGS:= @CPPFLAGS@ -I $(srcdir) CPPFLAGS+= @SYN_CPP@ -I @PYTHON_INCLUDE@ CXXFLAGS:= @CXXFLAGS@ LDFLAGS := @LDFLAGS@ LIBS := @SYN_LIBS@ @LIBS@ LIBRARY_EXT := @LIBEXT@ TARGET := ParserImpl$(LIBRARY_EXT) SRC := ASG.cc Types.cc Walker.cc Builder.cc Dictionary.cc TypeIdFormatter.cc \ Decoder.cc Lookup.cc Filter.cc Translator.cc SXRGenerator.cc ParserImpl.cc HDR := $(patsubst $(srcdir)/%, %, $(wildcard $(srcdir)/*.hh)) OBJ := $(patsubst %.cc, %.o, $(SRC)) DEP := $(patsubst %.cc, %.d, $(SRC)) vpath %.cc $(srcdir) vpath %.c $(srcdir) vpath %.h $(srcdir) vpath %.hh $(srcdir) all: $(TARGET) doc: %.d: %.cc @echo generating dependencies for $( $@' %.o: %.cc @echo compiling $(@F) $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< Makefile: $(srcdir)/Makefile.in ./config.status --file Makefile $(TARGET): $(OBJ) $(LDSHARED) $(LDFLAGS) -o $@ $^ $(LIBS) clean : rm -f *~ *.o *.d *.dll *.so *core *.pyc *.pyo base_lib ifeq (,$(filter $(MAKECMDGOALS), depend clean distclean)) -include $(DEP) endif synopsis-0.12/Synopsis/Parsers/Cxx/configure.ac0000664000076400007640000000177611104703262021164 0ustar stefanstefandnl dnl Copyright (C) 2003 Stefan Seefeld dnl All rights reserved. dnl Licensed to the public under the terms of the GNU LGPL (>= 2), dnl see the file COPYING for details. dnl dnl ------------------------------------------------------------------ dnl Autoconf initialization dnl ------------------------------------------------------------------ AC_PREREQ(2.56) AC_REVISION($Revision: 1.9 $) AC_INIT(occ, 0.8, synopsis-devel@fresco.org) AC_ARG_WITH(syn-cxx, [ --with-syn-cxx=PATH specify the Synopsis C++ library prefix], SYN_CXX="$with_syn_cxx", SYN_CXX="/usr/local" ) AC_PROG_CPP AC_PROG_CC AC_PROG_CXX SYN_CPP="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --cflags synopsis-uninstalled`" SYN_LIBS="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --libs synopsis-uninstalled`" AC_SUBST(SYN_CPP) AC_SUBST(SYN_LIBS) AC_PYTHON_EXT topdir=`$PYTHON -c "from os.path import *; print normpath('$srcdir/../../..')"` AC_SUBST(topdir) AC_CONFIG_FILES([Makefile synopsis.py]) mkdir -p occ mkdir -p syn AC_OUTPUT synopsis-0.12/Synopsis/Parsers/Cxx/Translator.cc0000664000076400007640000011143611122312026021323 0ustar stefanstefan// // Copyright (C) 2000 Stefan Seefeld // Copyright (C) 2000 Stephen Davies // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include "Translator.hh" #include "Filter.hh" #include "exception.hh" #include #include #include using namespace Synopsis; // The compiler firewalled private stuff struct Translator::Private { //. Constructor Private(Translator* s) : m_syn(s) { PyObject *qname_module = PyImport_ImportModule("Synopsis.QualifiedName"); if (!qname_module) throw py_error_already_set(); m_qname_factory = PyObject_GetAttrString(qname_module, "QualifiedCxxName"); if (!m_qname_factory) throw py_error_already_set(); Py_DECREF(qname_module); m_cxx = PyString_InternFromString("C++"); Py_INCREF(Py_None); add((ASG::Declaration*)0, Py_None); Py_INCREF(Py_None); add((Types::Type*)0, Py_None); } ~Private() { Py_DECREF(m_qname_factory); } //. Reference to parent synopsis object Translator* m_syn; PyObject* m_qname_factory; //. Interned string for "C++" PyObject* m_cxx; //. Returns the string for "C++" as a borrowed reference PyObject* cxx() { return m_cxx; } // Sugar typedef std::map ObjMap; // Maps from C++ objects to PyObjects ObjMap obj_map; // A set of builtin declarations to not to store in global namespace std::set builtin_decl_set; // Note that these methods always succeed //. Return the PyObject for the given ASG::SourceFile PyObject* py(ASG::SourceFile*); //. Return the PyObject for the given ASG::Include PyObject* py(ASG::Include*); //. Return the PyObject for the given ASG::Declaration PyObject* py(ASG::Declaration*); //. Return the PyObject for the given ASG::Inheritance PyObject* py(ASG::Inheritance*); //. Return the PyObject for the given ASG::Parameter PyObject* py(ASG::Parameter*); //. Return the PyObject for the given Types::Type PyObject* py(Types::Type*); //. Return the PyObject for the given string PyObject* py(const std::string &); //. Add the given pair void add(void* cobj, PyObject* pyobj) { if (!pyobj) throw py_error_already_set(); obj_map.insert(ObjMap::value_type(cobj, pyobj)); } // Convert a vector to a List template PyObject* List(const std::vector& vec) { PyObject* list = PyList_New(vec.size()); int index = 0; typename std::vector::const_iterator iter = vec.begin(); while (iter != vec.end()) PyList_SET_ITEM(list, index++, py(*iter++)); return list; } // Convert a vector to a Tuple template PyObject* Tuple(const std::vector& vec) { PyObject* tuple = PyTuple_New(vec.size()); int index = 0; typename std::vector::const_iterator iter = vec.begin(); while (iter != vec.end()) PyTuple_SET_ITEM(tuple, index++, py(*iter++)); return tuple; } PyObject* QualifiedName(const QName& name) { PyObject* tuple = PyTuple_New(name.size()); int index = 0; QName::const_iterator iter = name.begin(); while (iter != name.end()) PyTuple_SET_ITEM(tuple, index++, py(*iter++)); PyObject *qname = PyObject_CallFunctionObjArgs(m_qname_factory, tuple, NULL); Py_DECREF(tuple); return qname; } // Convert a string vector to a List PyObject* List(const std::vector &vec) { PyObject* list = PyList_New(vec.size()); int index = 0; std::vector::const_iterator iter = vec.begin(); while (iter != vec.end()) PyList_SET_ITEM(list, index++, py(*iter++)); return list; } // Convert a string vector to a Tuple PyObject* Tuple(const std::vector &vec) { PyObject* tuple = PyTuple_New(vec.size()); int index = 0; std::vector::const_iterator iter = vec.begin(); while (iter != vec.end()) PyTuple_SET_ITEM(tuple, index++, py(*iter++)); return tuple; } }; // Convert a Declaration vector to a List. Declarations can return 0 // from py(), if they are not in the main file. template <> PyObject* Translator::Private::List(const std::vector& vec) { std::vector objects; std::vector::const_iterator iter = vec.begin(); while (iter != vec.end()) { PyObject* obj = py(*iter++); if (obj != 0) objects.push_back(obj); } PyObject* list = PyList_New(objects.size()); int index = 0; std::vector::const_iterator piter = objects.begin(); while (piter != objects.end()) PyList_SET_ITEM(list, index++, *piter++); return list; } PyObject* Translator::Private::py(ASG::SourceFile* file) { ObjMap::iterator iter = obj_map.find(file); if (iter == obj_map.end()) { // Need to convert object first add(file, m_syn->SourceFile(file)); iter = obj_map.find(file); if (iter == obj_map.end()) { std::cout << "Fatal: Still not PyObject after converting." << std::endl; throw "Translator::Private::py(ASG::SourceFile*)"; } } PyObject* obj = iter->second; Py_INCREF(obj); return obj; } PyObject* Translator::Private::py(ASG::Include* incl) { ObjMap::iterator iter = obj_map.find(incl); if (iter == obj_map.end()) { // Need to convert object first add(incl, m_syn->Include(incl)); iter = obj_map.find(incl); if (iter == obj_map.end()) { std::cout << "Fatal: Still not PyObject after converting." << std::endl; throw "Translator::Private::py(ASG::Include*)"; } } PyObject* obj = iter->second; Py_INCREF(obj); return obj; } PyObject* Translator::Private::py(ASG::Declaration* decl) { ObjMap::iterator iter = obj_map.find(decl); if (iter == obj_map.end()) { // Need to convert object first decl->accept(m_syn); iter = obj_map.find(decl); if (iter == obj_map.end()) { // Probably means it's not in the main file return 0; /* std::cout << "Fatal: Still not PyObject after converting." << std::endl; throw "Translator::Private::py(ASG::Declaration*)"; */ } // Force addition of type to dictionary PyObject* declared = py(decl->declared()); Py_DECREF(declared); } PyObject* obj = iter->second; Py_INCREF(obj); return obj; } PyObject* Translator::Private::py(ASG::Inheritance* decl) { ObjMap::iterator iter = obj_map.find(decl); if (iter == obj_map.end()) { // Need to convert object first decl->accept(m_syn); iter = obj_map.find(decl); if (iter == obj_map.end()) { std::cout << "Fatal: Still not PyObject after converting." << std::endl; throw "Translator::Private::py(ASG::Inheritance*)"; } } PyObject* obj = iter->second; Py_INCREF(obj); return obj; } PyObject* Translator::Private::py(ASG::Parameter* decl) { ObjMap::iterator iter = obj_map.find(decl); if (iter == obj_map.end()) { // Need to convert object first decl->accept(m_syn); iter = obj_map.find(decl); if (iter == obj_map.end()) { std::cout << "Fatal: Still not PyObject after converting." << std::endl; throw "Translator::Private::py(ASG::Parameter*)"; } } PyObject* obj = iter->second; Py_INCREF(obj); return obj; } PyObject* Translator::Private::py(Types::Type* type) { ObjMap::iterator iter = obj_map.find(type); if (iter == obj_map.end()) { // Need to convert object first type->accept(m_syn); iter = obj_map.find(type); if (iter == obj_map.end()) { std::cout << "Fatal: Still not PyObject after converting." << std::endl; throw "Translator::Private::py(Types::Type*)"; } } PyObject* obj = iter->second; Py_INCREF(obj); return obj; } PyObject* Translator::Private::py(const std::string &str) { PyObject* pystr = PyString_FromStringAndSize(str.data(), str.size()); //PyString_InternInPlace(&pystr); return pystr; } Translator::Translator(FileFilter* filter, PyObject *ir) : m_ir(ir), m_filter(filter) { Trace trace("Translator::Translator", Trace::TRANSLATION); m_asg_module = PyImport_ImportModule("Synopsis.ASG"); if (!m_asg_module) throw py_error_already_set(); m_sf_module = PyImport_ImportModule("Synopsis.SourceFile"); if (!m_sf_module) throw py_error_already_set(); PyObject *asg = PyObject_GetAttrString(m_ir, "asg"); m_declarations = PyObject_GetAttrString(asg, "declarations"); if (!m_declarations) throw py_error_already_set(); m_dictionary = PyObject_GetAttrString(asg, "types"); if (!m_dictionary) throw py_error_already_set(); Py_DECREF(asg); m = new Private(this); } Translator::~Translator() { Trace trace("Translator::~Translator", Trace::TRANSLATION); /* PyObject *file = PyObject_CallMethod(scopes.back(), "declarations", 0); size_t size = PyList_Size(file); for (size_t i = 0; i != size; i++) PyObject_CallMethod(declarations, "append", "O", PyList_GetItem(file, i)); */ Py_DECREF(m_declarations); Py_DECREF(m_dictionary); Py_DECREF(m_asg_module); Py_DECREF(m_sf_module); // Deref the objects we created Private::ObjMap::iterator iter = m->obj_map.begin(); Private::ObjMap::iterator end = m->obj_map.end(); while (iter != end) { PyObject* obj = iter->second; PyObject* repr = PyObject_Repr(obj); //std::cout << (obj->ob_refcnt-1) << " " << PyString_AsString(repr) << std::endl; Py_DECREF(repr); Py_DECREF(obj); iter->second = 0; ++iter; } //std::cout << "Total: " << m->obj_map.size()<<" objects." << std::endl; delete m; } void Translator::translate(ASG::Scope* scope)//, PyObject* asg) { ASG::Declaration::vector globals, &decls = scope->declarations(); ASG::Declaration::vector::iterator it = decls.begin(); // List all declarations not in the builtin_decl_set for (; it != decls.end(); ++it) if (m->builtin_decl_set.find(*it) == m->builtin_decl_set.end()) globals.push_back(*it); // Translate those declarations PyObject* list; PyObject_CallMethod(m_declarations, "extend", "O", list = m->List(globals)); Py_DECREF(list); // Translate the sourcefiles, making sure the declarations list is done // for each PyObject* pyfiles = PyObject_GetAttrString(m_ir, "files"); if (!pyfiles) throw py_error_already_set(); assert(PyDict_Check(pyfiles)); ASG::SourceFile::vector files; m_filter->get_all_sourcefiles(files); for (ASG::SourceFile::vector::iterator i = files.begin(); i != files.end(); ++i) { ASG::SourceFile* file = *i; PyObject* decls, *new_decls, *incls, *new_incls; PyObject* pyfile = m->py(file); // Add the declarations if it's a main file if (file->is_primary()) { decls = PyObject_GetAttrString(pyfile, "declarations"); if (!decls) throw py_error_already_set(); PyObject_CallMethod(decls, "extend", "O", new_decls = m->List(file->declarations())); // TODO: add the includes Py_DECREF(new_decls); Py_DECREF(decls); } // Add the includes incls = PyObject_GetAttrString(pyfile, "includes"); if (!incls) throw py_error_already_set(); PyObject_CallMethod(incls, "extend", "O", new_incls = m->List(file->includes())); Py_DECREF(new_incls); Py_DECREF(incls); // Add to the ASG PyObject* pyfilename = PyObject_GetAttrString(pyfile, "name"); PyDict_SetItem(pyfiles, pyfilename, pyfile); Py_DECREF(pyfilename); Py_DECREF(pyfile); } Py_DECREF(pyfiles); } void Translator::set_builtin_decls(const ASG::Declaration::vector& builtin_decls) { // Insert Base*'s into a set for fasger lookup ASG::Declaration::vector::const_iterator it = builtin_decls.begin(); while (it != builtin_decls.end()) m->builtin_decl_set.insert(*it++); } PyObject *Translator::Base(Types::Base* type) { Trace trace("Translator::Base", Trace::TRANSLATION); PyObject *name, *base; base = PyObject_CallMethod(m_asg_module, "BuiltinTypeId", "OO", m->cxx(), name = m->QualifiedName(type->name())); PyObject_SetItem(m_dictionary, name, base); Py_DECREF(name); return base; } PyObject *Translator::Dependent(Types::Dependent* type) { Trace trace("Translator::Dependent", Trace::TRANSLATION); PyObject *name, *base; base = PyObject_CallMethod(m_asg_module, "DependentTypeId", "OO", m->cxx(), name = m->QualifiedName(type->name())); PyObject_SetItem(m_dictionary, name, base); Py_DECREF(name); return base; } PyObject *Translator::Unknown(Types::Named* type) { Trace trace("Translator::Unknown", Trace::TRANSLATION); PyObject *name, *unknown; unknown = PyObject_CallMethod(m_asg_module, "UnknownTypeId", "OO", m->cxx(), name = m->QualifiedName(type->name())); PyObject_SetItem(m_dictionary, name, unknown); Py_DECREF(name); return unknown; } PyObject *Translator::Declared(Types::Declared* type) { Trace trace("Translator::Declared", Trace::TRANSLATION); PyObject *name, *declared, *decl; declared = PyObject_CallMethod(m_asg_module, "DeclaredTypeId", "OOO", m->cxx(), name = m->QualifiedName(type->name()), decl = m->py(type->declaration())); // Skip zero-length names (eg: dummy declarators/enumerators) if (type->name().size()) PyObject_SetItem(m_dictionary, name, declared); Py_DECREF(name); Py_DECREF(decl); return declared; } PyObject *Translator::Template(Types::Template* type) { Trace trace("Translator::Template", Trace::TRANSLATION); PyObject *name, *templ, *decl, *params; templ = PyObject_CallMethod(m_asg_module, "TemplateId", "OOOO", m->cxx(), name = m->QualifiedName(type->name()), decl = m->py(type->declaration()), params = m->List(type->parameters())); PyObject_SetItem(m_dictionary, name, templ); Py_DECREF(name); Py_DECREF(decl); Py_DECREF(params); return templ; } PyObject *Translator::Modifier(Types::Modifier* type) { Trace trace("Translator::Modifier", Trace::TRANSLATION); PyObject *modifier, *alias, *pre, *post; modifier = PyObject_CallMethod(m_asg_module, "ModifierTypeId", "OOOO", m->cxx(), alias = m->py(type->alias()), pre = m->List(type->pre()), post = m->List(type->post())); Py_DECREF(alias); Py_DECREF(pre); Py_DECREF(post); return modifier; } PyObject *Translator::Array(Types::Array *type) { Trace trace("Translator::Array", Trace::TRANSLATION); PyObject *array, *alias, *sizes; array = PyObject_CallMethod(m_asg_module, "ArrayTypeId", "OOO", m->cxx(), alias = m->py(type->alias()), sizes = m->List(type->sizes())); Py_DECREF(alias); Py_DECREF(sizes); return array; } PyObject *Translator::Parameterized(Types::Parameterized* type) { Trace trace("Translator::Parametrized", Trace::TRANSLATION); PyObject *parametrized, *templ, *params; parametrized = PyObject_CallMethod(m_asg_module, "ParametrizedTypeId", "OOO", m->cxx(), templ = m->py(type->template_id()), params = m->List(type->parameters())); Py_DECREF(templ); Py_DECREF(params); return parametrized; } PyObject *Translator::FuncPtr(Types::FuncPtr* type) { Trace trace("Translator::FuncType", Trace::TRANSLATION); PyObject *func, *ret, *pre, *params; func = PyObject_CallMethod(m_asg_module, "FunctionTypeId", "OOOO", m->cxx(), ret = m->py(type->return_type()), pre = m->List(type->pre()), params = m->List(type->parameters())); Py_DECREF(ret); Py_DECREF(pre); Py_DECREF(params); return func; } void Translator::addComments(PyObject* pydecl, ASG::Declaration* cdecl) { Trace trace("Translator::addComments", Trace::TRANSLATION); PyObject *annotations = PyObject_GetAttrString(pydecl, "annotations"); PyObject *comments = m->List(cdecl->comments()); int size = PyList_GET_SIZE(comments); if (size) { PyObject *lasg = PyList_GetItem(comments, size -1); if (!PyString_Size(lasg)) PyList_SetItem(comments, size -1, Py_None); } PyDict_SetItemString(annotations, "comments", comments); // Also set the accessability.. PyObject_SetAttrString(pydecl, "accessibility", PyInt_FromLong(int(cdecl->access()))); Py_DECREF(annotations); Py_DECREF(comments); } //. merge the file with an existing (python) object if it exists PyObject *Translator::SourceFile(ASG::SourceFile* file) { // don't construct, but instead find existing python object ! Trace trace("Translator::SourceFile", Trace::TRANSLATION); PyObject *files = PyObject_GetAttrString(m_ir, "files"); if (!files) throw py_error_already_set(); PyObject *pyfile = PyDict_GetItemString(files, const_cast(file->name().c_str())); if (!pyfile) // the file wasn't found, create it now { PyObject *name, *abs_name; pyfile = PyObject_CallMethod(m_sf_module, "SourceFile", "OOO", name = m->py(file->name()), abs_name = m->py(file->abs_name()), m->cxx()); if (!pyfile) throw py_error_already_set(); Py_DECREF(name); Py_DECREF(abs_name); } else Py_INCREF(pyfile); // FIXME: why is this here ? Why can't we assume the preprocessor got it // right ?? // // update the 'main' attribute to reflect the right value (this may // // differ from the original one if the preprocessor sees a different // // 'extra include' list from the one passed to the cxx parser // PyObject_CallMethod(pyfile, "set_is_main", "i", (int)file->is_main()); Py_DECREF(files); return pyfile; } PyObject *Translator::Include(ASG::Include* include) { Trace trace("Translator::Include", Trace::TRANSLATION); PyObject *pyinclude, *target; pyinclude = PyObject_CallMethod(m_sf_module, "Include", "Oii", target = m->py(include->target()), include->is_macro() ? 1 : 0, include->is_next() ? 1 : 0); if (!pyinclude) throw py_error_already_set(); Py_DECREF(target); return pyinclude; } PyObject *Translator::Declaration(ASG::Declaration* decl) { Trace trace("Translator::Declaration", Trace::TRANSLATION); PyObject *pydecl, *file, *type, *name; pydecl = PyObject_CallMethod(m_asg_module, "Declaration", "OiOO", file = m->py(decl->file()), decl->line(), type = m->py(decl->type()), name = m->QualifiedName(decl->name())); if (!pydecl) throw py_error_already_set(); addComments(pydecl, decl); Py_DECREF(file); Py_DECREF(type); Py_DECREF(name); return pydecl; } PyObject *Translator::Builtin(ASG::Builtin* decl) { Trace trace("Translator::Builtin", Trace::TRANSLATION); PyObject *pybuiltin, *file, *type, *name; pybuiltin = PyObject_CallMethod(m_asg_module, "Builtin", "OiOO", file = m->py(decl->file()), decl->line(), type = m->py(decl->type()), name = m->QualifiedName(decl->name())); if (!pybuiltin) throw py_error_already_set(); addComments(pybuiltin, decl); Py_DECREF(file); Py_DECREF(type); Py_DECREF(name); return pybuiltin; } PyObject *Translator::Macro(ASG::Macro* decl) { Trace trace("Translator::Macro", Trace::TRANSLATION); PyObject *pymacro, *file, *type, *name, *params, *text; if (decl->parameters()) params = m->List(*decl->parameters()); else { params = Py_None; Py_INCREF(Py_None); } pymacro = PyObject_CallMethod(m_asg_module, "Macro", "OiOOOO", file = m->py(decl->file()), decl->line(), type = m->py(decl->type()), name = m->QualifiedName(decl->name()), params, text = m->py(decl->text())); if (!pymacro) throw py_error_already_set(); addComments(pymacro, decl); Py_DECREF(file); Py_DECREF(type); Py_DECREF(name); Py_DECREF(params); Py_DECREF(text); return pymacro; } PyObject *Translator::Forward(ASG::Forward* decl) { Trace trace("Translator::Forward", Trace::TRANSLATION); PyObject *forward, *file, *type, *name; forward = PyObject_CallMethod(m_asg_module, "Forward", "OiOO", file = m->py(decl->file()), decl->line(), type = m->py(decl->type()), name = m->QualifiedName(decl->name())); // This is necessary to prevent inf. loops in several places m->add(decl, forward); if (decl->template_id()) { PyObject* ttype = m->py(decl->template_id()); PyObject_SetAttrString(forward, "template", ttype); Py_DECREF(ttype); } if (decl->is_template_specialization()) { PyObject_SetAttrString(forward, "is_template_specialization", Py_True); } addComments(forward, decl); Py_DECREF(file); Py_DECREF(type); Py_DECREF(name); return forward; } PyObject *Translator::Scope(ASG::Scope* decl) { Trace trace("Translator::Scope", Trace::TRANSLATION); PyObject *scope, *file, *type, *name; scope = PyObject_CallMethod(m_asg_module, "Scope", "OiOO", file = m->py(decl->file()), decl->line(), type = m->py(decl->type()), name = m->QualifiedName(decl->name())); PyObject *decls = PyObject_GetAttrString(scope, "declarations"); PyObject_CallMethod(decls, "extend", "O", m->List(decl->declarations())); addComments(scope, decl); Py_DECREF(file); Py_DECREF(type); Py_DECREF(name); Py_DECREF(decls); return scope; } PyObject *Translator::Namespace(ASG::Namespace* decl) { Trace trace("Translator::Namespace", Trace::TRANSLATION); PyObject *module, *file, *type, *name; module = PyObject_CallMethod(m_asg_module, "Module", "OiOO", file = m->py(decl->file()), decl->line(), type = m->py(decl->type()), name = m->QualifiedName(decl->name())); PyObject *decls = PyObject_GetAttrString(module, "declarations"); PyObject *new_decls = m->List(decl->declarations()); PyObject_CallMethod(decls, "extend", "O", new_decls); addComments(module, decl); Py_DECREF(file); Py_DECREF(type); Py_DECREF(name); Py_DECREF(decls); Py_DECREF(new_decls); return module; } PyObject *Translator::Inheritance(ASG::Inheritance* decl) { Trace trace("Translator::Inheritance", Trace::TRANSLATION); PyObject *inheritance, *parent, *attrs; inheritance = PyObject_CallMethod(m_asg_module, "Inheritance", "sOO", "inherits", parent = m->py(decl->parent()), attrs = m->List(decl->attributes())); Py_DECREF(parent); Py_DECREF(attrs); return inheritance; } PyObject *Translator::Class(ASG::Class* decl) { Trace trace("Translator::Class", Trace::TRANSLATION); PyObject *clas, *file, *type, *name; clas = PyObject_CallMethod(m_asg_module, "Class", "OiOO", file = m->py(decl->file()), decl->line(), type = m->py(decl->type()), name = m->QualifiedName(decl->name())); // This is necessary to prevent inf. loops in several places m->add(decl, clas); PyObject *new_decls, *new_parents; PyObject *decls = PyObject_GetAttrString(clas, "declarations"); PyObject_CallMethod(decls, "extend", "O", new_decls = m->List(decl->declarations())); PyObject *parents = PyObject_GetAttrString(clas, "parents"); PyObject_CallMethod(parents, "extend", "O", new_parents = m->List(decl->parents())); if (decl->is_template_specialization()) { PyObject_SetAttrString(clas, "is_template_specialization", Py_True); } addComments(clas, decl); Py_DECREF(file); Py_DECREF(type); Py_DECREF(name); Py_DECREF(decls); Py_DECREF(parents); Py_DECREF(new_decls); Py_DECREF(new_parents); return clas; } PyObject *Translator::ClassTemplate(ASG::ClassTemplate *decl) { Trace trace("Translator::ClassTemplate", Trace::TRANSLATION); PyObject *clas, *file, *type, *name; clas = PyObject_CallMethod(m_asg_module, "ClassTemplate", "OiOO", file = m->py(decl->file()), decl->line(), type = m->py(decl->type()), name = m->QualifiedName(decl->name())); // This is necessary to prevent inf. loops in several places m->add(decl, clas); PyObject *new_decls, *new_parents; PyObject *decls = PyObject_GetAttrString(clas, "declarations"); PyObject_CallMethod(decls, "extend", "O", new_decls = m->List(decl->declarations())); PyObject* ttype = m->py(decl->template_id()); PyObject_SetAttrString(clas, "template", ttype); Py_DECREF(ttype); PyObject *parents = PyObject_GetAttrString(clas, "parents"); PyObject_CallMethod(parents, "extend", "O", new_parents = m->List(decl->parents())); if (decl->is_template_specialization()) { PyObject_SetAttrString(clas, "is_template_specialization", Py_True); } addComments(clas, decl); Py_DECREF(file); Py_DECREF(type); Py_DECREF(name); Py_DECREF(decls); Py_DECREF(parents); Py_DECREF(new_decls); Py_DECREF(new_parents); return clas; } PyObject *Translator::Typedef(ASG::Typedef* decl) { Trace trace("Translator::Typedef", Trace::TRANSLATION); // FIXME: what to do about the declarator? PyObject *tdef, *file, *type, *name, *alias; tdef = PyObject_CallMethod(m_asg_module, "Typedef", "OiOOOi", file = m->py(decl->file()), decl->line(), type = m->py(decl->type()), name = m->QualifiedName(decl->name()), alias = m->py(decl->alias()), decl->constructed()); addComments(tdef, decl); Py_DECREF(file); Py_DECREF(type); Py_DECREF(name); Py_DECREF(alias); return tdef; } PyObject *Translator::Enumerator(ASG::Enumerator* decl) { Trace trace("Translator::Enumerator", Trace::TRANSLATION); PyObject *enumor, *file, *name, *type; if (decl->type() == "dummy") // work around a hack with another hack ;-) { std::vector eos; eos.push_back("EOS"); enumor = PyObject_CallMethod(m_asg_module, "Builtin", "OiOO", file = m->py(decl->file()), decl->line(), type = m->py("EOS"), name = m->QualifiedName(eos)); } else enumor = PyObject_CallMethod(m_asg_module, "Enumerator", "OiOs", file = m->py(decl->file()), decl->line(), name = m->QualifiedName(decl->name()), decl->value().c_str()); addComments(enumor, decl); Py_DECREF(file); Py_DECREF(name); return enumor; } PyObject *Translator::Enum(ASG::Enum* decl) { Trace trace("Translator::Enum", Trace::TRANSLATION); PyObject *enumor, *file, *enums, *name; enumor = PyObject_CallMethod(m_asg_module, "Enum", "OiOO", file = m->py(decl->file()), decl->line(), name = m->QualifiedName(decl->name()), enums = m->List(decl->enumerators())); addComments(enumor, decl); Py_DECREF(file); Py_DECREF(enums); Py_DECREF(name); return enumor; } PyObject *Translator::Variable(ASG::Variable* decl) { Trace trace("Translator::Variable", Trace::TRANSLATION); PyObject *var, *file, *type, *name, *vtype; var = PyObject_CallMethod(m_asg_module, "Variable", "OiOOOi", file = m->py(decl->file()), decl->line(), type = m->py(decl->type()), name = m->QualifiedName(decl->name()), vtype = m->py(decl->vtype()), decl->constructed()); addComments(var, decl); Py_DECREF(file); Py_DECREF(type); Py_DECREF(vtype); Py_DECREF(name); return var; } PyObject *Translator::Const(ASG::Const* decl) { Trace trace("Translator::Const", Trace::TRANSLATION); PyObject *cons, *file, *type, *name, *ctype; cons = PyObject_CallMethod(m_asg_module, "Const", "OiOOOs", file = m->py(decl->file()), decl->line(), type = m->py(decl->type()), ctype = m->py(decl->ctype()), name = m->QualifiedName(decl->name()), decl->value().c_str()); if (PyErr_Occurred()) PyErr_Print(); addComments(cons, decl); Py_DECREF(file); Py_DECREF(type); Py_DECREF(ctype); Py_DECREF(name); return cons; } PyObject *Translator::Parameter(ASG::Parameter* decl) { Trace trace("Translator::Parameter", Trace::TRANSLATION); PyObject *param, *pre, *post, *type, *value, *name; param = PyObject_CallMethod(m_asg_module, "Parameter", "OOOOO", pre = m->List(decl->premodifier()), type = m->py(decl->type()), post = m->List(decl->postmodifier()), name = m->py(decl->name()), value = m->py(decl->value())); Py_DECREF(pre); Py_DECREF(post); Py_DECREF(type); Py_DECREF(value); Py_DECREF(name); return param; } PyObject *Translator::Function(ASG::Function* decl) { Trace trace("Translator::Function", Trace::TRANSLATION); PyObject *func, *file, *type, *name, *pre, *ret, *post, *realname; char const *class_ = decl->template_id() ? "FunctionTemplate" : "Function"; func = PyObject_CallMethod(m_asg_module, const_cast(class_), "OiOOOOOO", file = m->py(decl->file()), decl->line(), type = m->py(decl->type()), pre = m->List(decl->premodifier()), ret = m->py(decl->return_type()), post = m->List(decl->postmodifier()), name = m->QualifiedName(decl->name()), realname = m->py(decl->realname())); // This is necessary to prevent inf. loops in several places m->add(decl, func); if (decl->template_id()) { PyObject* ttype = m->py(decl->template_id()); PyObject_SetAttrString(func, "template", ttype); Py_DECREF(ttype); } PyObject* new_params; PyObject* params = PyObject_GetAttrString(func, "parameters"); PyObject_CallMethod(params, "extend", "O", new_params = m->List(decl->parameters())); addComments(func, decl); Py_DECREF(file); Py_DECREF(type); Py_DECREF(name); Py_DECREF(pre); Py_DECREF(ret); Py_DECREF(post); Py_DECREF(realname); Py_DECREF(params); Py_DECREF(new_params); return func; } PyObject *Translator::Operation(ASG::Operation* decl) { Trace trace("Translator::Operation", Trace::TRANSLATION); PyObject *oper, *file, *type, *name, *pre, *ret, *post, *realname; char const *class_ = decl->template_id() ? "OperationTemplate" : "Operation"; oper = PyObject_CallMethod(m_asg_module, const_cast(class_), "OiOOOOOO", file = m->py(decl->file()), decl->line(), type = m->py(decl->type()), pre = m->List(decl->premodifier()), ret = m->py(decl->return_type()), post = m->List(decl->postmodifier()), name = m->QualifiedName(decl->name()), realname = m->py(decl->realname())); // This is necessary to prevent inf. loops in several places m->add(decl, oper); if (decl->template_id()) { PyObject* ttype = m->py(decl->template_id()); PyObject_SetAttrString(oper, "template", ttype); Py_DECREF(ttype); } PyObject* new_params; PyObject* params = PyObject_GetAttrString(oper, "parameters"); PyObject_CallMethod(params, "extend", "O", new_params = m->List(decl->parameters())); addComments(oper, decl); Py_DECREF(file); Py_DECREF(type); Py_DECREF(name); Py_DECREF(pre); Py_DECREF(ret); Py_DECREF(post); Py_DECREF(realname); Py_DECREF(params); Py_DECREF(new_params); return oper; } PyObject *Translator::UsingDirective(ASG::UsingDirective* u) { Trace trace("Translator::UsingDirective", Trace::TRANSLATION); PyObject *dir, *file, *type, *name; dir = PyObject_CallMethod(m_asg_module, "UsingDirective", "OiOO", file = m->py(u->file()), u->line(), type = m->py(u->type()), name = m->QualifiedName(u->name())); Py_DECREF(file); Py_DECREF(type); Py_DECREF(name); return dir; } PyObject *Translator::UsingDeclaration(ASG::UsingDeclaration* u) { Trace trace("Translator::UsingDeclaration", Trace::TRANSLATION); PyObject *decl, *file, *type, *name, *alias; decl = PyObject_CallMethod(m_asg_module, "UsingDeclaration", "OiOOO", file = m->py(u->file()), u->line(), type = m->py(u->type()), name = m->QualifiedName(u->name()), alias = m->QualifiedName(u->target()->name())); Py_DECREF(alias); Py_DECREF(file); Py_DECREF(type); Py_DECREF(name); return decl; } void Translator::visit_declaration(ASG::Declaration* decl) { // Assume this is a dummy declaration if (m_filter->should_store(decl)) m->add(decl, Declaration(decl)); } void Translator::visit_builtin(ASG::Builtin* decl) { if (m_filter->should_store(decl)) m->add(decl, Builtin(decl)); } void Translator::visit_macro(ASG::Macro* decl) { if (m_filter->should_store(decl)) m->add(decl, Macro(decl)); } void Translator::visit_scope(ASG::Scope* decl) { if (m_filter->should_store(decl)) m->add(decl, Scope(decl)); //else // m->add(decl, Forward(new ASG::Forward(decl))); } void Translator::visit_namespace(ASG::Namespace* decl) { // Namespaces are always included, because the Linker knows to combine // them always. The exception are "local namespaces", those created to // handle scopes created by braces in code. if (decl->type() != "local") m->add(decl, Namespace(decl)); } void Translator::visit_class(ASG::Class* decl) { // Add if the class is in the main file, *or* if it has any members // declared in the main file (eg: forward declared nested classes which // are fully defined in this main file) if (m_filter->should_store(decl)) m->add(decl, Class(decl)); //else // m->add(decl, Forward(new ASG::Forward(decl))); } void Translator::visit_class_template(ASG::ClassTemplate* decl) { // Add if the class is in the main file, *or* if it has any members // declared in the main file (eg: forward declared nested classes which // are fully defined in this main file) if (m_filter->should_store(decl)) m->add(decl, ClassTemplate(decl)); } void Translator::visit_forward(ASG::Forward* decl) { if (m_filter->should_store(decl)) m->add(decl, Forward(decl)); //else // m->add(decl, Forward(new ASG::Forward(decl))); } void Translator::visit_typedef(ASG::Typedef* decl) { if (m_filter->should_store(decl)) m->add(decl, Typedef(decl)); //else // m->add(decl, Forward(new ASG::Forward(decl))); } void Translator::visit_variable(ASG::Variable* decl) { if (m_filter->should_store(decl)) m->add(decl, Variable(decl)); //else // m->add(decl, Forward(new ASG::Forward(decl))); } void Translator::visit_const(ASG::Const* decl) { if (m_filter->should_store(decl)) m->add(decl, Const(decl)); //else // m->add(decl, Forward(new ASG::Forward(decl))); } void Translator::visit_enum(ASG::Enum* decl) { if (m_filter->should_store(decl)) m->add(decl, Enum(decl)); //else // m->add(decl, Forward(new ASG::Forward(decl))); } void Translator::visit_enumerator(ASG::Enumerator* decl) { m->add(decl, Enumerator(decl)); } void Translator::visit_function(ASG::Function* decl) { if (m_filter->should_store(decl)) m->add(decl, Function(decl)); //else // m->add(decl, Forward(new ASG::Forward(decl))); } void Translator::visit_operation(ASG::Operation* decl) { if (m_filter->should_store(decl)) m->add(decl, Operation(decl)); //else // m->add(decl, Forward(new ASG::Forward(decl))); } void Translator::visit_inheritance(ASG::Inheritance* decl) { m->add(decl, Inheritance(decl)); } void Translator::visit_parameter(ASG::Parameter* decl) { m->add(decl, Parameter(decl)); } void Translator::visit_using_directive(ASG::UsingDirective* u) { m->add(u, UsingDirective(u)); } void Translator::visit_using_declaration(ASG::UsingDeclaration* u) { m->add(u, UsingDeclaration(u)); } // // Types::Visitor methods // /*void Translator::visitType(Types::Type* type) { m->add(type, this->Type(type)); }*/ void Translator::visit_unknown(Types::Unknown* type) { m->add(type, Unknown(type)); } void Translator::visit_dependent(Types::Dependent* type) { m->add(type, Dependent(type)); } void Translator::visit_modifier(Types::Modifier* type) { m->add(type, Modifier(type)); } void Translator::visit_array(Types::Array *type) { m->add(type, Array(type)); } /*void Translator::visitNamed(Types::Named* type) { m->add(type, Named(type)); }*/ void Translator::visit_base(Types::Base* type) { m->add(type, Base(type)); } void Translator::visit_declared(Types::Declared* type) { if (!m_filter->should_store(type->declaration())) m->add(type, Unknown(type)); else m->add(type, Declared(type)); } void Translator::visit_template_type(Types::Template* type) { if (!m_filter->should_store(type->declaration())) m->add(type, Unknown(type)); else m->add(type, Template(type)); } void Translator::visit_parameterized(Types::Parameterized* type) { m->add(type, Parameterized(type)); } void Translator::visit_func_ptr(Types::FuncPtr* type) { m->add(type, FuncPtr(type)); } synopsis-0.12/Synopsis/Parsers/Cxx/SXRGenerator.hh0000664000076400007640000000705711171162437021547 0ustar stefanstefan// // Copyright (C) 2008 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef SXRGenerator_hh_ #define SXRGenerator_hh_ #include "ASG.hh" #include #include "SXRBuffer.hh" #include namespace Synopsis { class Buffer; class Parser; namespace PTree { class Node;} } class Walker; class FileFilter; //. Stores link information about the file. Link info is stored in two files //. with two purposes. //. //. The first file stores all links and non-link spans, in a //. simple text file with one record per line and with spaces as field //. separators. The fields themselves are encoded using URL-style %FF encoding //. of non alpha-numeric characters (including spaces, brackers, commas etc). //. The purpose of this file is for syntax-hightlighting of source files. //. //. The second file stores only cross-reference information, which is a subset //. of the first file. class SXRGenerator { public: //. Enumeration of record types enum Context { Reference, //.< General name reference Definition, //.< Definition of the declaration Span, //.< Non-declarative span of text Implementation, //.< Implementation of a declaration UsingDirective, //.< Referenced in a using directive UsingDeclaration, //.< Referenced in a using declaration FunctionCall, //.< Called as a function NumContext //.< Marker used to check size of array }; //. Constructor. //. @param filter the filter to use to decide whether to output syntax and //. xref records //. @param swalker the Walker object we are linking for SXRGenerator(FileFilter* filter, Walker* walker); //. Destructor. Closes all opened file streams ~SXRGenerator(); //. Store links for all macro calls back to their definitions. void xref_macro_calls(); //. Store a link for the given Ptree node. If a decl is given, store an //. xref too void xref(Synopsis::PTree::Node *node, Context, QName const &name, std::string const &desc, ASG::Declaration const *decl = 0); //. Store a Definition link for the given Ptree node using the ASG node void xref(Synopsis::PTree::Node *node, ASG::Declaration const *decl); //. Store a link for the given node using the given Context, which defaults //. to a Reference void xref(Synopsis::PTree::Node *node, Types::Type*, Context = Reference); //. Store a span for the given Ptree node void span(Synopsis::PTree::Node *node, char const *desc); //. Store a long (possibly multi-line) span void long_span(Synopsis::PTree::Node *node, char const *desc); //. Returns the Walker Walker* walker(); private: //. The type of a map of streams typedef std::map SXRDict; void store_span(unsigned int line, unsigned int col, int len, char const *type); void store_xref(ASG::SourceFile*, int line, int col, int len, Context context, QName const &name, std::string const &desc, bool continuation); SXRBuffer *get_buffer(ASG::SourceFile*); //. Computes ptr's column in the original source. This requires looking for //. macro call expansion that may have displaced ptr in the preprocessed file. int map_column(ASG::SourceFile *file, int line, char const *ptr); //. The filter FileFilter* filter_; //. The Buffer object Synopsis::Buffer *buffer_; //. The Walker object Walker* walker_; //. A map of streams for each file SXRDict buffers_; }; #endif synopsis-0.12/Synopsis/Parsers/Cxx/Walker.hh0000664000076400007640000002476011104703262020442 0ustar stefanstefan// // Copyright (C) 2000 Stefan Seefeld // Copyright (C) 2000 Stephen Davies // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef Walker_hh_ #define Walker_hh_ #include // Stupid occ #undef Scope #include #include // Forward declarations class Builder; namespace Synopsis {class Buffer;} class Decoder; class TypeIdFormatter; class SXRGenerator; class Lookup; class FileFilter; using namespace Synopsis; namespace ASG { class SourceFile; class Parameter; class Inheritance; class Declaration; class Function; class Scope; } namespace Types { class Type; } //. A walker that creates an ASG. All Translate* methods have been overridden //. to remove the translation code. class Walker : public PTree::Visitor { public: //. Constructor Walker(FileFilter*, Builder*, Synopsis::Buffer*); virtual ~Walker(); //. Sets store links to true. //. This will cause the whole ptree to be traversed, and any linkable //. identifiers found will be stored void set_store_links(SXRGenerator*); //. Get a name from the ptree std::string parse_name(PTree::Node *) const; //. Get the Buffer object Synopsis::Buffer* buffer() { return my_buffer;} //. Get the Builder object Builder* builder() { return my_builder;} //. Get the TypeFormatter object TypeIdFormatter* type_formatter(){ return my_type_formatter;} #if 0 //. Returns true if the current filename from the last getLine or //. updateLineNumber call is equal to the main source filename bool is_main_file() { return (my_filename == my_source);} #endif //. Get the line number of the given Ptree node int line_of_ptree(PTree::Node *); //. Update the line number void update_line_number(PTree::Node *); void add_comments(ASG::Declaration* decl, PTree::Node *comments); void add_comments(ASG::Declaration* decl, PTree::CommentedAtom *node); void add_comments(ASG::Declaration* decl, PTree::Declarator *node); void add_comments(ASG::Declaration* decl, PTree::Declaration *node); void add_comments(ASG::Declaration* decl, PTree::NamespaceSpec *node); //. Traverses left side of tree till it finds a leaf, and if that is a //. CommentedAtom then it adds those comments as spans void find_comments(PTree::Node * node); // Takes the (maybe 0) args list and puts them in my_params void translate_function_args(PTree::Node * args); void translate_parameters(PTree::Node * p_params, std::vector& params); void translate_function_name(const PTree::Encoding &encname, std::string& realname, Types::Type*& returnType); PTree::Node *translate_declarator(PTree::Node *); PTree::Node *translate_function_declarator(PTree::Node *, bool is_const); PTree::Node *translate_variable_declarator(PTree::Node *, bool is_const); void translate_typedef_declarator(PTree::Node *node); std::vector translate_inheritance_spec(PTree::Node *node); //. Returns a formatter string of the parameters. The idea is that this //. string will be appended to the function name to form the 'name' of the //. function. std::string format_parameters(std::vector& params); //. Translates the template parameters and creates the template type. void translate_template_params(PTree::Node *params); //. Overridden to catch exceptions void translate(PTree::Node *); void visit(PTree::Atom *); void visit(PTree::List *); void visit(PTree::Typedef *); void visit(PTree::TemplateDecl *); void visit(PTree::TemplateInstantiation *); //virtual PTree::Node * TranslateTemplateInstantiation(PTree::Node *, PTree::Node *, PTree::Node *, Class*); void visit(PTree::ExternTemplate *); void visit(PTree::CommentedAtom *); void visit(PTree::Identifier *node) { translate_variable(node);} void visit(PTree::Brace *); void visit(PTree::Block *); void visit(PTree::ClassBody *node) { visit(static_cast(node));} void visit(PTree::ClassSpec *); void visit(PTree::EnumSpec *); void visit(PTree::MetaclassDecl *); void visit(PTree::LinkageSpec *); void visit(PTree::NamespaceSpec *); void visit(PTree::UsingDirective *); void visit(PTree::Declaration *); void visit(PTree::UsingDeclaration *); void visit(PTree::Name *node) { translate_variable(node);} void visit(PTree::AccessSpec *); void visit(PTree::AccessDecl *); void visit(PTree::UserAccessSpec *); void visit(PTree::IfStatement *); void visit(PTree::SwitchStatement *); void visit(PTree::WhileStatement *); void visit(PTree::DoStatement *); void visit(PTree::ForStatement *); void visit(PTree::TryStatement *); void visit(PTree::BreakStatement *); void visit(PTree::ContinueStatement *); void visit(PTree::ReturnStatement *); void visit(PTree::GotoStatement *); void visit(PTree::CaseStatement *); void visit(PTree::DefaultStatement *); void visit(PTree::LabelStatement *); void visit(PTree::ExprStatement *); void visit(PTree::Expression *); void visit(PTree::AssignExpr *); void visit(PTree::CondExpr *); void visit(PTree::InfixExpr *); void visit(PTree::PmExpr *); void visit(PTree::CastExpr *); void visit(PTree::UnaryExpr *); void visit(PTree::ThrowExpr *); void visit(PTree::SizeofExpr *); void visit(PTree::NewExpr *); void visit(PTree::DeleteExpr *); void visit(PTree::Kwd::This *); void visit(PTree::FstyleCastExpr *); void visit(PTree::ArrayExpr *); void visit(PTree::FuncallExpr *); // and fstyle cast void visit(PTree::PostfixExpr *); void visit(PTree::UserStatementExpr *); void visit(PTree::DotMemberExpr *); void visit(PTree::ArrowMemberExpr *); void visit(PTree::ParenExpr *); void visit(PTree::StaticUserStatementExpr *); PTree::TemplateDecl *translate_class_template(PTree::TemplateDecl *, PTree::ClassSpec *); PTree::TemplateDecl *translate_function_template(PTree::TemplateDecl *, PTree::Node *); PTree::Node *translate_storage_specifiers(PTree::Node *); PTree::Node *translate_declarators(PTree::Node *); PTree::Node *translate_arg_decl_list(bool, PTree::Node *, PTree::Node *); PTree::Node *translate_initialize_args(PTree::Declarator *, PTree::Node *); PTree::Node *translate_assign_initializer(PTree::Declarator *, PTree::Node *); PTree::Node *translate_function_implementation(PTree::Node *); PTree::Node *translate_function_body(PTree::Node *); //virtual PTree::Node * TranslateClassBody(PTree::Node *, PTree::Node *, Class*); //virtual Class* MakeClassMetaobject(PTree::Node *, PTree::Node *, PTree::Node *); //virtual PTree::Node * TranslateClassSpec(PTree::Node *, PTree::Node *, PTree::Node *, Class*); virtual PTree::Node *translate_type_specifier(PTree::Node *); virtual PTree::Node *translate_typeof(PTree::Node *, PTree::Node * declarations); virtual PTree::Node *translate_new3(PTree::Node *type); void translate_variable(PTree::Node *); ASG::SourceFile* current_file() const { return my_file;} int current_lineno() const { return my_lineno;} static Walker *instance() { return g_walker;} private: // the 'current' walker is a debugging aid. static Walker* g_walker; Builder* my_builder; FileFilter* my_filter; Synopsis::Buffer* my_buffer; Decoder* my_decoder; Lookup* my_lookup; //. A pointer to the currect declaration ptree, if any, used to get the //. return type and modifiers, etc. PTree::Node * my_declaration; bool my_in_typedef; //. True if we have just seen a class-specifier or enum-specifier //. inside a decl-specifier-seq. bool my_defines_class_or_enum; //. A pointer to the current template parameters, if any, used to get the //. template parameters and set in the declaration. Should be 0 if not //. in a template. std::vector* my_template; //. this reflects the filename containing the currently processed node. std::string my_filename; int my_lineno; //. The current file, set by update_line_number ASG::SourceFile* my_file; //. True if should try and extract tail comments before }'s bool my_extract_tails; //. Storage for links. This is only set if we should be storing links, so //. it must be checked before every use SXRGenerator *sxr_; //. True if this TranslateDeclarator should try to store the decl type bool my_store_decl; //. A dummy name used for tail comments std::vector my_dummyname; //. An instance of TypeFormatter for formatting types TypeIdFormatter* my_type_formatter; //. The current function, if in a function block ASG::Function* my_function; //. The params found before a function block. These may be different from //. the ones that are in the original declaration(s), but it is these names //. we need for referencing names inside the block, so a reference is stored //. here. std::vector my_param_cache; //. The types accumulated for function parameters in function calls std::vector my_params; //. The type returned from the expression-type translators Types::Type* my_type; //. The Scope to use for name lookups, or 0 to use enclosing default //. scope rules. This is for when we are at a Variable, and already know it //. must be part of a given class (eg, foo->bar .. bar must be in foo's //. class) ASG::Scope* my_scope; //. The state of postfix translation. This is needed for constructs like //. foo->var versus var or foo->var(). The function call resolution needs //. to be done in the final TranslateVariable, since that's where the last //. name (which is to be linked) is handled. enum Postfix_Flag { Postfix_Var, //.< Lookup as a variable Postfix_Func, //.< Lookup as a function, using my_params for parameters } my_postfix_flag; //. Info about one stored function impl. Function impls must be stored //. till the end of a class. struct FuncImplCache { ASG::Function* func; std::vector params; PTree::Node * body; }; //. A vector of function impls typedef std::vector FuncImplVec; //. A stack of function impl vectors typedef std::vector FuncImplStack; //. The stack of function impl vectors FuncImplStack my_func_impl_stack; void translate_func_impl_cache(const FuncImplCache &cache); //. Finds the column given the start ptr and the current position. The //. derived column number is processed with the macro call dictionary //. from the current file before returning, //. so -1 may be returned to indicate "inside macro". int find_col(const char* start, const char* find); bool my_in_template_decl; }; #endif // header guard synopsis-0.12/Synopsis/Parsers/Cxx/Filter.hh0000664000076400007640000000544711104703262020443 0ustar stefanstefan// // Copyright (C) 2002 Stephen Davies // Copyright (C) 2002 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef filter_hh_ #define filter_hh_ #include #include #include #include "ASG.hh" class FileFilter { public: //. Constructor FileFilter(PyObject *, const std::string &, const std::string &, bool); //. Destructor ~FileFilter(); std::string get_main_file(); //. Sets the prefix for syntax output filenames. //. The syntax filename will be the source filename prepended with the //. prefix, so you probably want the prefix to be a directory. void set_sxr_prefix(const char* filename); //. Returns the ASG::SourceFile for the given filename. If length is //. given, then the filename is assumed to be that length. This is useful //. since OCC returns filenames as a reference to the #line directive in //. the preprocessor output and is not null-terminated. ASG::SourceFile* get_sourcefile(const char* filename, size_t length = 0); //. Returns whether a function implementation in the given file should //. have it's Ptree walked. This will be true only if the given file is //. one of the files to be stored. bool should_visit_function_impl(ASG::SourceFile* file); //. Returns true if links should be generated for the given sourcefile bool should_xref(ASG::SourceFile* file); //. Returns true if the given declaration should be stored in the final //. ASG. Note that a Declaration is taken instead of a SourceFile because //. Namespaces may be declared (and contain declarations) in multiple //. files, and Classes may have nested classes defined in other files. bool should_store(ASG::Declaration* decl); //. Strips a filename of the basename if present std::string strip_base_path(const std::string& filename); //. Returns the filename to use for storing sxr info std::string get_sxr_filename(ASG::SourceFile* file); //. Returns a list of all the sourcefiles void get_all_sourcefiles(ASG::SourceFile::vector&); //. Returns a pointer to the Filter instance. Note that Filter is *not* a //. regular singleton: instance() will return 0 if the Filter doesn't //. exist, and the constructor/destructor control this. The reason for //. this method is so the C function synopsis_include_hook can use the //. Filter object without having a reference to it. static FileFilter* instance(); private: struct Private; //. Compiler firewalled private data Private* m; //. Returns true if the given SourceFile is one of the main files //. (including extra files) bool is_main(std::string filename); }; #endif // vim: set ts=8 sts=4 sw=4 et: synopsis-0.12/Synopsis/Parsers/Cxx/aclocal.m40000664000076400007640000000120311171624012020516 0ustar stefanstefan# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_include([../../../config/python_ext.m4]) synopsis-0.12/Synopsis/Parsers/Cxx/ASG.hh0000664000076400007640000006367311171267145017646 0ustar stefanstefan// // Copyright (C) 2002 Stephen Davies // Copyright (C) 2002 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef ASG_hh_ #define ASG_hh_ #include #include #include #include "QName.hh" #include "FakeGC.hh" // Forward declare Dictionary class Dictionary; // Forward declare Types::Type, Declared and Template namespace Types { class Type; class Named; class Declared; class Template; } //. A namespace for the ASG hierarchy namespace ASG { // Forward declaration of ASG::Visitor defined in this file class Visitor; // Forward declaration of ASG::SourceFile defined in this file class SourceFile; //. An enumeration of accessability specifiers enum Access { Default = 0, Public, Protected, Private }; //FIXME: move to somewhere else //. A struct to hold cross-reference info struct Reference { std::string file; int line; QName scope; std::string context; // Foundation Reference() : line(-1) { } Reference(const std::string& _file, int _line, const QName& _scope, const std::string& _context) : file(_file), line(_line), scope(_scope), context(_context) { } Reference(const Reference& other) : file(other.file), line(other.line), scope(other.scope), context(other.context) { } Reference& operator=(const Reference& other) { file = other.file; line = other.line; scope = other.scope; context = other.context; return *this; } }; //. Encapsulation of one Comment, which may span multiple lines. //. Each comment encapsulates one /* */ block or a block of // comments on //. adjacent lines. If extract_tails is set, then comments will be added //. even when they are not adjacent to a declaration - these comments will be //. marked as "suspect". Most of these will be discarded by the Linker, unless //. they have appropriate markings such as "//.< comment for previous decl" class Comment : public FakeGC::LightObject { public: //. A vector of Comments typedef std::vector vector; //. Constructor Comment(SourceFile* file, int line, const std::string& text, bool suspect=false); // // Attributes // //. Returns the filename of this comment SourceFile* file() const { return m_file; } //. Returns the line number of the start of this comment int line() const { return m_line; } //. Returns the text of this comment const std::string& text() const { return m_text; } //. Sets whether this comment is suspicious void set_suspect(bool suspect) { m_suspect = suspect; } //. Returns whether this comment is suspicious bool is_suspect() const { return m_suspect; } private: //. The file SourceFile* m_file; //. The first line number int m_line; //. The text std::string m_text; //. True if this comment is probably not needed. The exception is comments //. which will be used as "tails", eg: //.< comment for previous decl bool m_suspect; }; //. The base class of the Declaration hierarchy. //. All declarations have a scoped Name, comments, etc. The filename and //. type name are constant strings. This is enforced so that the strings //. will reference the same data, saving both memory and cpu time. For this //. to work however, you must be careful to use the same strings for //. constructing the names from, for example from a dictionary. class Declaration : public FakeGC::LightObject { public: //. A vector of Declaration objects typedef std::vector vector; //. Constructor Declaration(SourceFile* file, int line, const std::string& type, const QName& name); //. Destructor. Recursively deletes the comments for this declaration virtual ~Declaration(); //. Accept the given ASG::Visitor virtual void accept(Visitor*); // // Attribute Methods // //. Returns the scoped name of this declaration QName& name() { return m_name; } //. Constant version of name() const QName& name() const { return m_name; } //. Returns the filename of this declaration SourceFile* file() const { return m_file; } //. Changes the filename of this declaration void set_file(SourceFile* file) { m_file = file; } //. Returns the line number of this declaration int line() const { return m_line; } //. Returns the name of the type (not class) of this declaration const std::string& type() const { return m_type; } //. Change the type name. Currently only used to indicate template //. types void set_type(const std::string& type) { m_type = type; } //. Returns the accessability of this declaration Access access() const { return m_access; } //. Sets the accessability of this declaration void set_access(Access axs) { m_access = axs; } //. Constant version of comments() const Comment::vector& comments() const { return m_comments; } //. Returns the vector of comments. The vector returned is the private //. member vector of this Declaration, so modifications will affect the //. Declaration. Comment::vector& comments() { return m_comments; } //. Return a cached Types::Declared for this Declaration. It is created //. on demand and returned every time you call the method on this //. object. Types::Declared* declared(); //. Return a cached Types::Declared for this Declaration. It is created //. on demand and returned every time you call the method on this //. object. This is the const version. const Types::Declared* declared() const; private: //. The filename SourceFile* m_file; //. The first line number int m_line; //. The string type name std::string m_type; //. The scoped name QName m_name; //. The vector of Comment objects Comment::vector m_comments; //. The accessability spec Access m_access; //. The Types::Declared cache mutable Types::Declared* m_declared; }; //. Information about an #include or #include_next directive. //. This object is a thin wrapper around the target SourceFile, with some //. attributes to indicate whether the directive included a macro expansion, //. and whether it was an #include_next or not. //. //. A macro expansion is flagged because often you don't want to include those //. in an include graph. For example, some headers in the Boost PP library //. will include other files multiple times, where the file included is given //. by a macro. It is rare that you actually want to show this macro-dependent //. include in the documentation or in a graph. class Include : public FakeGC::LightObject { public: //. A vector of Includes typedef std::vector vector; //. Constructor Include(SourceFile* target, bool is_macro, bool is_next); //. Returns the target of this include SourceFile* target() const { return m_target; } //. Returns whether the include filename was a macro expansion bool is_macro() const { return m_is_macro; } //. Returns whether the include was an #include_next directive bool is_next() const { return m_is_next; } private: //. The target file of the include or include_next SourceFile* m_target; //. Whether the include filename was a macro expansion bool m_is_macro; //. Whether the include was an #include_next directive bool m_is_next; }; //. Information about a source file used to generate the ASG. //. //. Generally an ASG will include SourceFile objects for *all* files, //. including headers, that were used. The difference is that the main files //. (those named to the parser) are flagged as "main", and others will not //. have lists of declarations. class SourceFile : public FakeGC::LightObject { public: struct MacroCall { MacroCall(char const *n, long col, long sl, long sc, long el, long ec, long o, bool c = false) : name(n), column(col), start_line(sl), start_column(sc), end_line(el), end_column(ec), offset(o), continuation(c) {} std::string name; // start column of the macro call long column; // start position of the expanded macro long start_line, start_column; // end position of the expanded macro long end_line, end_column; // offset of all subsequent tokens in the stream, caused by this expansion. long offset; // true if this is the continuation from a call in a previous line. bool continuation; bool operator <(const MacroCall &o) const { return start_column < o.start_column;} }; typedef std::set Line; typedef std::map Lines; //. A vector of SourceFiles typedef std::vector vector; //. Constructor SourceFile(std::string const &name, std::string const &abs_name, bool is_primary) : name_(name), abs_name_(abs_name), is_primary_(is_primary) {} std::string const &name() const { return name_;} const std::string& abs_name() const { return abs_name_;} bool is_primary() const { return is_primary_;} Declaration::vector& declarations() { return declarations_;} const Declaration::vector& declarations() const { return declarations_;} Include::vector& includes() { return includes_;} const Include::vector& includes() const { return includes_;} //. Right now we record the start position (line, column) of the call, //. the start and end positions of the expansion, as well as the offset //. of subsequent tokens due to expansion. void add_macro_call(char const *name, long start_line, long start_col, long e_start_line, long e_start_col, long e_end_line, long e_end_col, long offset, bool); Lines ¯o_calls() { return macro_calls_;} //. Map a position in the preprocessed file to a position in the original file. //. If the position happens to fall right into an expanded macro, -1 is returned. int map_column(int line, int col); private: std::string name_; std::string abs_name_; bool is_primary_; Declaration::vector declarations_; Include::vector includes_; Lines macro_calls_; }; //. A Builtin is a node to be used internally. //. Right now it's being used to capture comments //. at the end of a scope. class Builtin : public Declaration { public: Builtin(SourceFile* file, int line, const std::string &type, const QName& name); //. Destructor virtual ~Builtin(); //. Accepts the given visitor virtual void accept(Visitor*); }; //. Encapsulates a preprocessor macro. Macros are stored in the ASG, but since //. they are not regular C++ syntax they are treated specially: They will be //. in order compared to other macros, but not to the rest of the ASG since //. the preprocessing stage occurs first. They will always be in the global //. scope. Note that the parameters is a pointer to a vector - if the pointer //. is null, then the macro is not function-like. If the pointer is non-null //. then it points to a vector of parameter names. If the macro is //. function-like but with no parameters, it is a pointer to an empty vector. class Macro : public Declaration { public: //. The type of the parameters typedef std::vector Parameters; //. Constructor. Assumes ownership of the Parameters vector if it is not a //. null pointer. Macro(SourceFile* file, int line, const QName& name, Parameters* params, const std::string& text); //. Destructor virtual ~Macro(); //. The parameters of the macro. May be a null pointer if the macro is not //. function-like const Parameters* parameters() const { return m_parameters; } //. The expansion text of the macro. const std::string& text() const { return m_text; } //. Accepts the given visitor virtual void accept(Visitor*); private: //. The parameters Parameters* m_parameters; //. The expansion text std::string m_text; }; //. Base class for scopes with contained declarations. Each scope has its //. own Dictionary of names so far accumulated for this scope. Each scope //. also as a complete vector of scopes where name lookup is to proceed if //. unsuccessful in this scope. Name lookup is not recursive. class Scope : public Declaration { public: //. Constructor Scope(SourceFile* file, int line, const std::string& type, const QName& name); //. Destructor. //. Recursively destroys contained declarations virtual ~Scope(); //. Accepts the given visitor virtual void accept(Visitor*); // // Attribute Methods // //. Constant version of declarations() const Declaration::vector& declarations() const { return m_declarations; } //. Returns the vector of declarations. The vector returned is the //. private member vector of this Scope, so modifications will affect //. the Scope. Declaration::vector& declarations() { return m_declarations; } private: //. The vector of contained declarations Declaration::vector m_declarations; }; //. Namespace class class Namespace : public Scope { public: //. Constructor Namespace(SourceFile* file, int line, const std::string& type, const QName& name); //. Destructor virtual ~Namespace(); //. Accepts the given ASG::Visitor virtual void accept(Visitor*); } ; // class Namespace //. Inheritance class. This class encapsulates the information about an //. inheritance, namely its accessability. Note that classes inherit from //. types, not class declarations. As such it's possible to inherit from a //. parameterized type, or a declared typedef or class/struct. class Inheritance { public: //. A vector of Inheritance objects typedef std::vector vector; //. A typedef of the Attributes type typedef std::vector Attributes; //. Constructor Inheritance(Types::Type* parent, const Attributes& attributes); //. Accepts the given ASG::Visitor void accept(Visitor*); // // Attribute Methods // //. Returns the Class object this inheritance refers to. The method //. returns a Type since typedefs to classes are preserved to //. enhance readability of the generated docs. Note that the parent //. may also be a non-declaration type, such as vector Types::Type* parent() { return m_parent; } //. Returns the attributes of this inheritance const Attributes& attributes() const { return m_attrs; } private: //. The parent class or typedef to class Types::Type* m_parent; //. The attributes Attributes m_attrs; }; //. Forward declaration. Currently this has no extra attributes. class Forward : public Declaration { public: //. Constructor Forward(SourceFile* file, int line, const std::string& type, const QName& name, bool is_template_specialization); //. Accepts the given ASG::Visitor virtual void accept(Visitor*); Types::Template* template_id() { return template_;} void set_template_id(Types::Template* id) { template_ = id;} bool is_template_specialization() const { return is_template_specialization_;} private: //. The Template Type for this forward if it's a template Types::Template* template_; bool is_template_specialization_; }; class ClassTemplate; //. Class class class Class : public Scope { public: Class(SourceFile* file, int line, const std::string& type, const QName& name, bool is_specialization); virtual ~Class(); virtual void accept(Visitor*); //. Returns the vector of parent Inheritance objects. The vector //. returned is the private member vector of this Class, so //. modifications will affect the Class. const Inheritance::vector& parents() const { return parents_;} Inheritance::vector& parents() { return parents_;} bool is_template_specialization() const { return is_template_specialization_;} private: //. The vector of parent Inheritance objects Inheritance::vector parents_; bool is_template_specialization_; }; //. Class class class ClassTemplate : public Class { public: ClassTemplate(SourceFile* file, int line, const std::string& type, const QName& name, bool is_specialization); virtual ~ClassTemplate(); virtual void accept(Visitor*); Types::Template* template_id() { return template_;} void set_template_id(Types::Template* type) { template_ = type;} private: Types::Template* template_; }; //. Typedef declaration class Typedef : public Declaration { public: //. Constructor Typedef(SourceFile* file, int line, const std::string& type, const QName& name, Types::Type* alias, bool constr); //. Destructor ~Typedef(); //. Accepts the given ASG::Visitor virtual void accept(Visitor*); // // Attribute Methods // //. Returns the Type object this typedef aliases Types::Type* alias() { return m_alias; } //. Returns true if the Type object was constructed inside the typedef bool constructed() { return m_constr; } private: //. The alias Type Types::Type* m_alias; //. True if constructed bool m_constr; }; //. Variable declaration class Variable : public Declaration { public: //. The type of the vector of sizes typedef std::vector Sizes; //. Constructor Variable(SourceFile* file, int line, const std::string& type, const QName& name, Types::Type* vtype, bool constr); //. Destructor ~Variable(); //. Accepts the given ASG::Visitor virtual void accept(Visitor*); // // Attribute Methods // //. Returns the Type object of this variable Types::Type* vtype() const { return m_vtype; } //. Returns true if the Type object was constructed inside the variable bool constructed() const { return m_constr; } //. Returns the array sizes vector Sizes& sizes() { return m_sizes; } private: //. The variable Type Types::Type* m_vtype; //. True if constructed bool m_constr; //. Vector of array sizes. zero length indicates not an array. Sizes m_sizes; }; //. Enumerator declaration. This is a name with a value in the containing //. scope. Enumerators only appear inside Enums via their enumerators() //. attribute. class Enumerator : public Declaration { public: //. Type of a vector of Enumerator objects typedef std::vector vector; //. Constructor Enumerator(SourceFile* file, int line, const std::string& type, const QName& name, const std::string& value); //. Accept the given ASG::Visitor virtual void accept(Visitor*); // // Attribute Methods // //. Returns the value of this enumerator const std::string& value() const { return m_value; } private: //. The value of this enumerator std::string m_value; }; //. Enum declaration. An enum contains multiple enumerators. class Enum : public Declaration { public: //. Constructor Enum(SourceFile* file, int line, const std::string& type, const QName& name); //. Destructor. Recursively destroys Enumerators ~Enum(); //. Accepts the given ASG::Visitor virtual void accept(Visitor*); // // Attribute Methods // //. Returns the vector of Enumerators Enumerator::vector& enumerators() { return m_enums; } private: //. The vector of Enumerators Enumerator::vector m_enums; }; //. A const is a name with a value and declared type. class Const : public Declaration { public: //. Constructor Const(SourceFile* file, int line, const std::string& type, const QName& name, Types::Type* ctype, const std::string& value); //. Accept the given ASG::Visitor virtual void accept(Visitor*); // // Attribute Methods // //. Returns the Type object of this const Types::Type* ctype() { return m_ctype; } //. Returns the value of this enumerator const std::string& value() const { return m_value; } private: //. The const Type Types::Type* m_ctype; //. The value of this enumerator std::string m_value; }; //. Parameter encapsulates one parameter to a function class Parameter : public FakeGC::LightObject { public: //. The type of modifiers such as 'in', 'out' typedef std::vector Mods; //. A vector of Parameter objects typedef std::vector vector; //. Constructor Parameter(const Mods& pre, Types::Type* type, const Mods& post, const std::string& name, const std::string& value); //. Destructor ~Parameter(); //. Accept the given ASG::Visitor. Note this is not derived from //. Declaration so it is not a virtual method. void accept(Visitor*); // // Attribute Methods // //. Returns the premodifier Mods& premodifier() { return m_pre; } //. Returns the postmodifier Mods& postmodifier() { return m_post; } //. Returns the type of the parameter Types::Type* type() { return m_type; } //. Const version of type() const Types::Type* type() const { return m_type; } //. Returns the name of the parameter const std::string& name() const { return m_name; } //. Returns the value of the parameter const std::string& value() const { return m_value; } //. Sets the name of the parameter void set_name(const std::string& name) { m_name = name; } private: Mods m_pre, m_post; Types::Type* m_type; std::string m_name, m_value; }; //. Function encapsulates a function declaration. Note that names may be //. stored in mangled form, and formatters should use realname() to get //. the unmangled version. If this is a function template, use the //. template_type() method to get at the template type class Function : public Declaration { public: //. The type of premodifiers typedef std::vector Mods; //. A vector of Function objects typedef std::vector vector; //. Constructor Function( SourceFile* file, int line, const std::string& type, const QName& name, const Mods& premod, Types::Type* ret, const Mods& postmod, const std::string& realname ); //. Destructor. Recursively destroys parameters ~Function(); //. Accept the given visitor virtual void accept(Visitor*); // // Attribute Methods // //. Returns the premodifier vector Mods& premodifier() { return m_pre; } //. Returns the postmodifier vector Mods& postmodifier() { return m_post; } //. Returns the return Type Types::Type* return_type() { return m_ret; } //. Returns the real name of this function const std::string& realname() const { return m_realname; } //. Returns the vector of parameters Parameter::vector& parameters() { return m_params; } //. Returns the Template object if this is a template Types::Template* template_id() { return m_template; } //. Sets the Template object for this class. 0 means not a template void set_template_id(Types::Template* type) { m_template = type; } private: //. The premodifier vector Mods m_pre; //. The return type Types::Type* m_ret; //. The postmodifier vector Mods m_post; //. The real (unmangled) name std::string m_realname; //. The vector of parameters Parameter::vector m_params; //. The Template Type for this class if it's a template Types::Template* m_template; }; //. Operations are similar to functions but Not Quite Right class Operation : public Function { public: //. Constructor Operation(SourceFile* file, int line, const std::string& type, const QName& name, const Mods& premod, Types::Type* ret, const Mods& postmod, const std::string& realname); //. Accept the given visitor virtual void accept(Visitor*); }; class UsingDirective : public Declaration { public: UsingDirective(SourceFile* file, int line, const QName& name) : Declaration(file, line, "using namespace", name) {} virtual void accept(Visitor*); }; class UsingDeclaration : public Declaration { public: UsingDeclaration(SourceFile* file, int line, QName const& name, Types::Named *d); Types::Named* target() { return m_target;} virtual void accept(Visitor*); private: Types::Named* m_target; }; //. The Visitor for the ASG hierarchy. This class is just an interface //. really. It is abstract, and you must reimplement any methods you want. //. The default implementations of the methods call the visit methods for //. the subclasses of the visited type, eg visit_namespace calls visit_scope //. which calls visit_declaration. class Visitor { public: // Abstract destructor makes the class abstract virtual ~Visitor() = 0; virtual void visit_declaration(Declaration*); virtual void visit_builtin(Builtin*); virtual void visit_macro(Macro*); virtual void visit_scope(Scope*); virtual void visit_namespace(Namespace*); virtual void visit_class(Class*); virtual void visit_class_template(ClassTemplate*); virtual void visit_inheritance(Inheritance*); virtual void visit_forward(Forward*); virtual void visit_typedef(Typedef*); virtual void visit_variable(Variable*); virtual void visit_const(Const*); virtual void visit_enum(Enum*); virtual void visit_enumerator(Enumerator*); virtual void visit_function(Function*); virtual void visit_operation(Operation*); virtual void visit_parameter(Parameter*); virtual void visit_using_directive(UsingDirective*); virtual void visit_using_declaration(UsingDeclaration*); }; } // namespace ASG #endif // header guard synopsis-0.12/Synopsis/Parsers/Cxx/Filter.cc0000664000076400007640000002012211171266424020424 0ustar stefanstefan// // Copyright (C) 2002 Stephen Davies // Copyright (C) 2002 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include "Filter.hh" #include #include #include using namespace Synopsis; struct FileFilter::Private { //. used during SourceFile imports PyObject *asg; //. Whether only main declarations should be stored bool only_main; //. The main filename std::string main_filename; //. The basename std::string base_path; //. A vector of strings typedef std::vector string_vector; //. The sxr filename prefix std::string sxr_prefix; //. Type of the map from filename to SourceFile typedef std::map file_map_t; //. A map from filename to SourceFile file_map_t file_map; }; namespace { //. The FileFilter instance FileFilter* filter_instance = 0; //. restore the relevant parts from the python asg //. The returned SourceFile object is a slice of the original python object //. and should be merged back at the end of the parsing such that the other //. parts not mirrored here are preserved. ASG::SourceFile *import_source_file(PyObject *ir, const std::string &name, const std::string &abs_name, bool primary) { ASG::SourceFile *sourcefile = new ASG::SourceFile(name, abs_name, primary); PyObject *files = PyObject_GetAttrString(ir, "files"); assert(files); PyObject *py_source_file = PyDict_GetItemString(files, const_cast(name.c_str())); Py_DECREF(files); if (!py_source_file) return sourcefile; // the given file wasn't preprocessed into the ASG PyObject *macro_calls = PyObject_GetAttrString(py_source_file, "macro_calls"); long size = PyObject_Length(macro_calls); for (long i = 0; i != size; ++i) { PyObject *call = PyList_GetItem(macro_calls, i); PyObject *call_name = PyObject_GetAttrString(call, "name"); PyObject *start = PyObject_GetAttrString(call, "start"); PyObject *end = PyObject_GetAttrString(call, "end"); PyObject *expanded_start = PyObject_GetAttrString(call, "expanded_start"); PyObject *expanded_end = PyObject_GetAttrString(call, "expanded_end"); char const *macro_name = PyString_AsString(call_name); long start_line = PyInt_AsLong(PyTuple_GetItem(start, 0)); long start_col = PyInt_AsLong(PyTuple_GetItem(start, 1)); long end_col = PyInt_AsLong(PyTuple_GetItem(end, 1)); long e_start_line = PyInt_AsLong(PyTuple_GetItem(expanded_start, 0)); long e_start_col = PyInt_AsLong(PyTuple_GetItem(expanded_start, 1)); long e_end_line = PyInt_AsLong(PyTuple_GetItem(expanded_end, 0)); long e_end_col = PyInt_AsLong(PyTuple_GetItem(expanded_end, 1)); if (e_start_line == e_end_line) sourcefile->add_macro_call(macro_name, start_line, start_col, e_start_line, e_start_col, e_end_line, e_end_col, e_end_col - end_col, false); else { // first line sourcefile->add_macro_call(macro_name, start_line, start_col, e_start_line, e_start_col, -1, -1, 0, false); for (int line = e_start_line + 1; line != e_end_line; ++line) sourcefile->add_macro_call(macro_name, start_line, start_col, line, 0, -1, -1, 0, true); // last line sourcefile->add_macro_call(macro_name, start_line, start_col, e_end_line, 0, e_end_line, e_end_col, e_end_col - end_col, true); } Py_DECREF(expanded_end); Py_DECREF(expanded_start); Py_DECREF(end); Py_DECREF(call_name); } Py_DECREF(macro_calls); return sourcefile; } } // Constructor FileFilter::FileFilter(PyObject *asg, const std::string &filename, const std::string &base_path, bool main) { m = new Private; m->asg = asg; m->main_filename = filename; m->base_path = base_path; m->only_main = main; filter_instance = this; } // Destructor FileFilter::~FileFilter() { delete m; filter_instance = 0; } // Return instance pointer FileFilter* FileFilter::instance() { return filter_instance; } // Sets the prefix for sxr output filenames. void FileFilter::set_sxr_prefix(const char* filename) { m->sxr_prefix = filename; if (m->sxr_prefix.size() > 0 && m->sxr_prefix[m->sxr_prefix.size()-1] != '/') m->sxr_prefix.append("/"); } // Returns the ASG::SourceFile for the given filename. ASG::SourceFile* FileFilter::get_sourcefile(const char* filename_ptr, size_t length) { std::string filename; if (length != 0) filename.assign(filename_ptr, length); else filename.assign(filename_ptr); Path path = Path(filename).abs(); std::string abs_filename = path.str(); path.strip(m->base_path); filename = path.str(); // Look in map Private::file_map_t::iterator iter = m->file_map.find(abs_filename); if (iter != m->file_map.end()) // Found return iter->second; // Not found, create a new SourceFile. Note filename in the object is // stripped of the basename ASG::SourceFile* file = import_source_file(m->asg, filename, abs_filename, is_main(abs_filename)); // Add to the map m->file_map[abs_filename] = file; return file; } bool FileFilter::is_main(std::string filename) { if (filename == m->main_filename) return true; else if (m->only_main) return false; if (m->base_path.size() == 0) return true; size_t length = m->base_path.size(); if (length > filename.size()) return false; return strncmp(filename.data(), m->base_path.data(), length) == 0; } // Returns whether a function implementation in the given file should // have it's Ptree walked. This will be true only if the given file is // one of the files to be stored. bool FileFilter::should_visit_function_impl(ASG::SourceFile* file) { // First check if not linking or xreffing if (m->sxr_prefix.empty()) return false; return file->is_primary(); } // Returns true if links should be generated for the given sourcefile bool FileFilter::should_xref(ASG::SourceFile* file) { return !m->sxr_prefix.empty() && file->is_primary(); } // Returns true if the given declaration should be stored in the final // ASG. bool FileFilter::should_store(ASG::Declaration* decl) { // Sanity check (this can happen) if (!decl) return false; // Check the decl itself first, although for namespaces the SourceFile // referenced by file() can be any of the files that opened it if (decl->file()->is_primary()) return true; if (ASG::Scope* scope = dynamic_cast(decl)) { // Check all members of the namespace or class ASG::Declaration::vector::iterator iter; ASG::Declaration::vector& declarations = scope->declarations(); for (iter = declarations.begin(); iter != declarations.end(); iter++) if (should_store(*iter)) // Only takes one to store the decl. Each contained declaration // will then be evaluated separately return true; } return false; } // Strip base path from filename std::string FileFilter::strip_base_path(const std::string& filename) { if (m->base_path.size() == 0) return filename; size_t length = m->base_path.size(); if (length > filename.size()) return filename; if (strncmp(filename.data(), m->base_path.data(), length) == 0) return filename.substr(length); return filename; } // Return syntax filename std::string FileFilter::get_sxr_filename(ASG::SourceFile* file) { return m->sxr_prefix + file->name() + ".sxr"; } // Returns all sourcefiles void FileFilter::get_all_sourcefiles(ASG::SourceFile::vector& all) { Private::file_map_t::iterator iter; for (iter = m->file_map.begin(); iter != m->file_map.end(); iter++) all.push_back(iter->second); } std::string FileFilter::get_main_file() { return m->main_filename; } synopsis-0.12/Synopsis/Parsers/Python/0000775000076400007640000000000011172123232017400 5ustar stefanstefansynopsis-0.12/Synopsis/Parsers/Python/__init__.py0000664000076400007640000001651511104703263021524 0ustar stefanstefan# # Copyright (C) 2006 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import * from Synopsis import ASG from Synopsis.QualifiedName import QualifiedPythonName as QName from Synopsis.SourceFile import SourceFile from Synopsis.DocString import DocString from ASGTranslator import ASGTranslator from SXRGenerator import SXRGenerator import os __all__ = ['Parser'] def expand_package(root, verbose = False): """Find all modules in a given package.""" modules = [] if not os.path.isdir(root) or not os.path.isfile(os.path.join(root, '__init__.py')): return modules if verbose: print 'expanding %s'%root files = os.listdir(root) modules += [os.path.join(root, file) for file in files if os.path.splitext(file)[1] == '.py'] for d in [dir for dir in files if os.path.isdir(os.path.join(root, dir))]: modules.extend(expand_package(os.path.join(root, d), verbose)) return modules def find_imported(target, base_path, origin, verbose = False): """ Lookup imported files, based on current file's location. target: (module, name) pair. base_path: root directory to which to confine the lookup. origin: file name of the module issuing the import.""" module, name = target[0].replace('.', os.sep), target[1] origin = os.path.dirname(origin) if base_path: locations = [base_path + origin.rsplit(os.sep, i)[0] for i in range(origin.count(os.sep) + 1)] + [base_path] else: locations = [origin] # '*' is only valid in a module scope if name and name != '*': # name may be a module or a module's attribute. # Only find the module. files = ['%s/%s.py'%(module, name), '%s.py'%module] else: files = ['%s.py'%module] files.append(os.path.join(module, '__init__.py')) for l in locations: for f in files: target = os.path.join(l, f) if verbose: print 'trying %s'%target if os.path.exists(target): return target, target[len(base_path):] return None, None class Parser(Processor): """ Python Parser. See http://www.python.org/dev/peps/pep-0258 for additional info.""" primary_file_only = Parameter(True, 'should only primary file be processed') base_path = Parameter(None, 'Path prefix to strip off of input file names.') sxr_prefix = Parameter(None, 'Path prefix (directory) to contain sxr info.') default_docformat = Parameter('', 'default documentation format') def process(self, ir, **kwds): self.set_parameters(kwds) if not self.input: raise MissingArgument('input') self.ir = ir self.scopes = [] # Create return type for Python functions: self.return_type = ASG.BuiltinTypeId('Python',('',)) # Validate base_path. if self.base_path: if not os.path.isdir(self.base_path): raise InvalidArgument('base_path: "%s" not a directory.' %self.base_path) if self.base_path[-1] != os.sep: self.base_path += os.sep # all_files is a list of (filename, base_path) pairs. # we have to record the base_path per file, since it defaults to the # filename itself, for files coming directly from user input. # For files that are the result of expanded packages it defaults to the # package directory itself. self.all_files = [] for i in self.input: base_path = self.base_path or os.path.dirname(i) if base_path and base_path[-1] != os.sep: base_path += os.sep # expand packages into modules if os.path.isdir(i): if os.path.exists(os.path.join(i, '__init__.py')): self.all_files.extend([(p,base_path) for p in expand_package(i, self.verbose)]) else: raise InvalidArgument('"%s" is not a Python package'%i) else: self.all_files.append((i,base_path)) # process modules while len(self.all_files): file, base_path = self.all_files.pop() self.process_file(file, base_path) return self.output_and_return_ir() def process_file(self, filename, base_path): """Parse an individual python file.""" long_filename = filename if filename[:len(base_path)] != base_path: raise InvalidArgument('invalid input filename:\n' '"%s" does not match base_path "%s"' %(filename, base_path)) if self.verbose: print 'parsing %s'%filename short_filename = filename[len(base_path):] sourcefile = SourceFile(short_filename, long_filename, 'Python', True) self.ir.files[short_filename] = sourcefile package = None package_name = [] package_path = base_path # Only attempt to set up enclosing packages if a base_path was given. if package_path != filename: components = short_filename.split(os.sep) if components[0] == '': package_path += os.sep components = components[1:] for c in components[:-1]: package_name.append(c) package_path = os.path.join(package_path, c) qname = QName(package_name) if not os.path.isfile(os.path.join(package_path, '__init__.py')): raise InvalidArgument('"%s" is not a package'%qname) # Try to locate the package type_id = self.ir.asg.types.get(qname) if (type_id): module = type_id.declaration else: module = ASG.Module(sourcefile, -1, 'package', qname) self.ir.asg.types[qname] = ASG.DeclaredTypeId('Python', qname, module) if package: package.declarations.append(module) else: self.ir.asg.declarations.append(module) package = module translator = ASGTranslator(package, self.ir.asg.types, self.default_docformat) translator.process_file(sourcefile) # At this point, sourcefile contains a single declaration: the module. if package: package.declarations.extend(sourcefile.declarations) else: self.ir.asg.declarations.extend(sourcefile.declarations) if not self.primary_file_only: for i in translator.imports: target = find_imported(i, self.base_path, sourcefile.name, self.verbose) if target[0] and target[1] not in self.ir.files: # Only process if we have not visited it yet. self.all_files.append((target[0], base_path)) if self.sxr_prefix: sxr = os.path.join(self.sxr_prefix, short_filename + '.sxr') dirname = os.path.dirname(sxr) if not os.path.exists(dirname): os.makedirs(dirname, 0755) sxr_generator = SXRGenerator() module = sourcefile.declarations[0] sxr_generator.process_file(module.name, sourcefile, sxr) synopsis-0.12/Synopsis/Parsers/Python/SXRGenerator.py0000664000076400007640000002701611135623150022306 0ustar stefanstefan# # Copyright (C) 2008 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # import parser import token import tokenize import symbol import keyword HAVE_ENCODING_DECL = hasattr(symbol, "encoding_decl") # python 2.3 HAVE_IMPORT_NAME = hasattr(symbol, "import_name") # python 2.4 HAVE_DECORATOR = hasattr(symbol,"decorator") # python 2.4 def num_tokens(ptree): """Count the number of leaf tokens in the given ptree.""" if type(ptree) == str: return 1 else: return sum([num_tokens(n) for n in ptree[1:]]) class LexerDebugger: def __init__(self, lexer): self.lexer = lexer def next(self): n = self.lexer.next() print 'next is "%s" (%s)'%(n[1], n[0]) return n header=""" """ trailer=""" """ def escape(text): for p in [('&', '&'), ('"', '"'), ('<', '<'), ('>', '>'),]: text = text.replace(*p) return text class SXRGenerator: """""" def __init__(self): """""" self.handlers = {} self.handlers[token.ENDMARKER] = self.handle_end_marker self.handlers[token.NEWLINE] = self.handle_newline self.handlers[token.INDENT] = self.handle_indent self.handlers[token.DEDENT] = self.handle_dedent self.handlers[token.STRING] = self.handle_string self.handlers[symbol.funcdef]= self.handle_function self.handlers[symbol.parameters] = self.handle_parameters self.handlers[symbol.classdef] = self.handle_class self.handlers[token.NAME] = self.handle_name self.handlers[symbol.expr_stmt] = self.handle_expr_stmt #self.handlers[token.OP] = self.handle_op self.handlers[symbol.power] = self.handle_power if HAVE_ENCODING_DECL: self.handlers[symbol.encoding_decl] = self.handle_encoding_decl if HAVE_IMPORT_NAME: self.handlers[symbol.import_as_names] = self.handle_import_as_names self.handlers[symbol.dotted_as_names] = self.handle_dotted_as_names self.handlers[symbol.import_from] = self.handle_import_from self.handlers[symbol.import_name] = self.handle_import_name else: self.handlers[symbol.import_stmt] = self.handle_import if HAVE_DECORATOR: self.handlers[symbol.decorator] = self.handle_decorator self.col = 0 self.lineno = 1 self.parameters = [] self.scopes = [] def process_file(self, scope, sourcefile, sxr): self.scopes = list(scope) input = open(sourcefile.abs_name, 'r+') src = input.readlines() self.lines = len(`len(src) + 1`) ptree = parser.ast2tuple(parser.suite(''.join(src))) input.seek(0) self.lexer = tokenize.generate_tokens(input.readline) #self.lexer = LexerDebugger(tokenize.generate_tokens(input.readline)) self.sxr = open(sxr, 'w+') lineno_template = '%%%ds' % self.lines lineno = lineno_template % self.lineno self.sxr.write(header % {'filename': sourcefile.name}) try: self.handle(ptree) except StopIteration: raise self.sxr.write(trailer) self.sxr.close() self.scopes.pop() def handle(self, ptree): if type(ptree) == tuple: kind = ptree[0] value = ptree[1:] handler = self.handlers.get(kind, self.default_handler) handler(value) else: raise Exception("Process error: Type is not a tuple %s" % str(ptree)) def default_handler(self, ptree): for node in ptree: if type(node) == tuple: self.handle(node) elif type(node) == str: self.handle_token(node) else: raise Exception("Invalid ptree node") def next_token(self): """Return the next visible token. Process tokens that are not part of the parse tree silently.""" t = self.lexer.next() while t[0] in [tokenize.NL, tokenize.COMMENT]: if t[0] is tokenize.NL: self.print_newline() elif t[0] is tokenize.COMMENT: self.print_token(t) if t[1][-1] == '\n': self.print_newline() t = self.lexer.next() return t def handle_token(self, item = None): t = self.next_token() if item is not None and t[1] != item: raise 'Internal error in line %d: expected "%s", got "%s" (%d)'%(self.lineno, item, t[1], t[0]) else: self.print_token(t) def handle_name_as_xref(self, xref, name, from_ = None, type = None): kind, value, (srow, scol), (erow, ecol), line = self.next_token() if (kind, value) != (token.NAME, name): raise 'Internal error in line %d: expected name "%s", got "%s" (%d)'%(name, self.lineno, item, t[1], t[0]) if self.col != scol: self.sxr.write(' ' * (scol - self.col)) attrs = [] if from_: attrs.append('from="%s"'%from_) if type: attrs.append('type="%s"'%type) a = '%s'%('.'.join(xref), ' '.join(attrs), value) self.sxr.write(a) self.col = ecol def handle_tokens(self, ptree): tokens = num_tokens(ptree) for i in xrange(tokens): self.handle_token() def handle_end_marker(self, nodes): pass def handle_newline(self, nodes): self.handle_token() def handle_indent(self, indent): self.handle_token() def handle_dedent(self, dedent): self.handle_token() def handle_string(self, content): self.handle_token() def handle_function(self, nodes): if HAVE_DECORATOR: if nodes[0][0] == symbol.decorators: offset = 1 # FIXME self.handle(nodes[0]) else: offset = 0 else: offset = 0 def_token = nodes[0 + offset] self.handle_token(def_token[1]) name = nodes[1 + offset][1] qname = tuple(self.scopes + [name]) self.handle_name_as_xref(qname, name, from_='.'.join(self.scopes), type='definition') # Handle the parameters. self.handle(nodes[2 + offset]) colon_token = nodes[3 + offset] self.handle_token(colon_token[1]) body = nodes[4 + offset] # Theoretically, we'd have to push the function scope here. # Practically, however, we don't inject xrefs (yet) into function bodies. self.handle_tokens(body) # Don't traverse the function body, since the ASG doesn't handle # local declarations anyways. def handle_parameters(self, nodes): self.handle_token(nodes[0][1]) if nodes[1][0] == symbol.varargslist: args = list(nodes[1][1:]) while args: if args[0][0] == token.COMMA: self.handle_token(args[0][1]) pass elif args[0][0] == symbol.fpdef: self.handle_tokens(args[0]) elif args[0][0] == token.EQUAL: self.handle_token(args[0][1]) del args[0] self.handle_tokens(args[0]) elif args[0][0] == token.DOUBLESTAR: self.handle_token(args[0][1]) del args[0] self.handle_token(args[0][1]) elif args[0][0] == token.STAR: self.handle_token(args[0][1]) del args[0] self.handle_token(args[0][1]) else: print "Unknown symbol:",args[0] del args[0] self.handle_token(nodes[-1][1]) def handle_class(self, nodes): class_token = nodes[0] self.handle_token(class_token[1]) name = nodes[1][1] qname = tuple(self.scopes + [name]) self.handle_name_as_xref(qname, name, from_='.'.join(self.scopes), type='definition') base_clause = nodes[2][0] == token.LPAR and nodes[3] or None self.handle_tokens(nodes[2]) bases = [] if base_clause: self.handle_tokens(base_clause) self.handle_token(')') self.handle_token(':') body = nodes[6] else: body = nodes[3] self.scopes.append(name) self.handle(body) self.scopes.pop() def handle_name(self, content): self.handle_token(content[0]) def handle_expr_stmt(self, nodes): for n in nodes: self.handle_tokens(n) def handle_dotted_name(self, dname, rest): self.handle_token(dname[0]) for name in dname[1:]: self.handle_token('.') self.handle_token(name) map(self.handle, rest) def handle_op(self, nodes): pass def handle_power(self, content): def get_dotted_name(content): if content[0][0] != symbol.atom or content[0][1][0] != token.NAME: return None dotted_name = [content[0][1][1]] i = 1 for param in content[1:]: if param[0] != symbol.trailer: break if param[1][0] != token.DOT: break if param[2][0] != token.NAME: break dotted_name.append(param[2][1]) i += 1 if i < len(content): return dotted_name, content[i:] else: return dotted_name, [] name = get_dotted_name(content) if name: self.handle_dotted_name(*name) else: map(self.handle, content) def handle_encoding_decl(self, nodes): # For some reason the encoding is the last tuple item for n in nodes[:-1]: self.handle(n) def handle_import_as_names(self, nodes): for n in nodes: self.handle(n) def handle_dotted_as_names(self, nodes): for n in nodes: self.handle(n) def handle_import_from(self, nodes): self.handle_token('from') self.handle(nodes[1]) self.handle_token('import') self.handle(nodes[3]) def handle_import_name(self, nodes): self.handle_token('import') self.handle_dotted_as_names(nodes[1][1:]) def handle_import(self, nodes): #self.handle_token('import') for n in nodes: self.handle(n) def handle_decorator(self, nodes): pass def print_token(self, t): kind, value, (srow, scol), (erow, ecol), line = t if kind == token.NEWLINE: self.print_newline() else: if self.col != scol: self.sxr.write(' ' * (scol - self.col)) if keyword.iskeyword(value): format = '%s' elif kind == token.STRING: format = '%s' chunks = value.split('\n') for c in chunks[:-1]: self.sxr.write(format % escape(c)) self.print_newline() value = chunks[-1] elif kind == tokenize.COMMENT: format = '%s' if value[-1] == '\n': value = value[:-1] else: format = '%s' self.sxr.write(format % escape(value)) self.col = ecol def print_newline(self): self.col = 0 self.lineno += 1 self.sxr.write('\n') self.sxr.write('') synopsis-0.12/Synopsis/Parsers/Python/ASGTranslator.py0000664000076400007640000003720311133537337022457 0ustar stefanstefan# # Copyright (C) 2008 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import ASG from Synopsis.QualifiedName import QualifiedPythonName as QName from Synopsis.SourceFile import * from Synopsis.DocString import DocString import sys, os.path import compiler, tokenize, token from compiler.consts import OP_ASSIGN from compiler.visitor import ASTVisitor class TokenParser: def __init__(self, text): self.text = text + '\n\n' self.lines = self.text.splitlines(1) self.generator = tokenize.generate_tokens(iter(self.lines).next) self.next() def __iter__(self): return self def next(self): self.token = self.generator.next() self.type, self.string, self.start, self.end, self.line = self.token return self.token def goto_line(self, lineno): while self.start[0] < lineno: self.next() return token def rhs(self, lineno): """ Return a whitespace-normalized expression string from the right-hand side of an assignment at line `lineno`. """ self.goto_line(lineno) while self.string != '=': self.next() self.stack = None while self.type != token.NEWLINE and self.string != ';': if self.string == '=' and not self.stack: self.tokens = [] self.stack = [] self._type = None self._string = None self._backquote = 0 else: self.note_token() self.next() self.next() text = ''.join(self.tokens) return text.strip() closers = {')': '(', ']': '[', '}': '{'} openers = {'(': 1, '[': 1, '{': 1} del_ws_prefix = {'.': 1, '=': 1, ')': 1, ']': 1, '}': 1, ':': 1, ',': 1} no_ws_suffix = {'.': 1, '=': 1, '(': 1, '[': 1, '{': 1} def note_token(self): if self.type == tokenize.NL: return del_ws = self.del_ws_prefix.has_key(self.string) append_ws = not self.no_ws_suffix.has_key(self.string) if self.openers.has_key(self.string): self.stack.append(self.string) if (self._type == token.NAME or self.closers.has_key(self._string)): del_ws = 1 elif self.closers.has_key(self.string): assert self.stack[-1] == self.closers[self.string] self.stack.pop() elif self.string == '`': if self._backquote: del_ws = 1 assert self.stack[-1] == '`' self.stack.pop() else: append_ws = 0 self.stack.append('`') self._backquote = not self._backquote if del_ws and self.tokens and self.tokens[-1] == ' ': del self.tokens[-1] self.tokens.append(self.string) self._type = self.type self._string = self.string if append_ws: self.tokens.append(' ') def function_parameters(self, lineno): """ Return a dictionary mapping parameters to defaults (whitespace-normalized strings). """ self.goto_line(lineno) while self.string != 'def': self.next() while self.string != '(': self.next() name = None default = False parameter_tuple = False self.tokens = [] parameters = {} self.stack = [self.string] self.next() while 1: if len(self.stack) == 1: if parameter_tuple: name = ''.join(self.tokens).strip() self.tokens = [] parameter_tuple = False if self.string in (')', ','): if name: if self.tokens: default_text = ''.join(self.tokens).strip() else: default_text = '' parameters[name] = default_text self.tokens = [] name = None default = False if self.string == ')': break elif self.type == token.NAME: if name and default: self.note_token() else: assert name is None, ( 'token=%r name=%r parameters=%r stack=%r' % (self.token, name, parameters, self.stack)) name = self.string elif self.string == '=': assert name is not None, 'token=%r' % (self.token,) assert default is False, 'token=%r' % (self.token,) assert self.tokens == [], 'token=%r' % (self.token,) default = True self._type = None self._string = None self._backquote = 0 elif name: self.note_token() elif self.string == '(': parameter_tuple = True self._type = None self._string = None self._backquote = 0 self.note_token() else: # ignore these tokens: assert (self.string in ('*', '**', '\n') or self.type == tokenize.COMMENT), ( 'token=%r' % (self.token,)) else: self.note_token() self.next() return parameters class ASGTranslator(ASTVisitor): """Translate the Python AST into a Synopsis ASG.""" def __init__(self, package, types, docformat): """Create an ASGTranslator. package: enclosing package the generated modules are to be part of.""" ASTVisitor.__init__(self) self.scope = package and [package] or [] self.file = None self.types = types self.attributes = [] self.any_type = ASG.BuiltinTypeId('Python',QName('',)) self.docformat = docformat self.documentable = None self.name = QName() self.imports = [] "Tuple with (module, names) pairs." def process_file(self, file): self.file = file source = open(self.file.abs_name).read() self.token_parser = TokenParser(source) ast = compiler.parse(source) compiler.walk(ast, self, walker=self) def scope_name(self): return len(self.scope) and self.scope[-1].name or () def default(self, node, *args): self.documentable = None def default_visit(self, node, *args): ASTVisitor.default(self, node, *args) def visitDiscard(self, node): if self.documentable: self.visit(node.expr) def visitConst(self, node): if self.documentable: if type(node.value) in (str, unicode): self.documentable.annotations['doc'] = DocString(node.value, self.docformat) else: self.documentable = None def visitStmt(self, node): self.default_visit(node) def visitAssign(self, node): save_attributes = self.attributes self.attributes = [] self.in_ass_tuple = False for child in node.nodes: self.dispatch(child) if self.attributes: if type(self.scope[-1]) == ASG.Operation: # Inject the attributes into the class. self.scope[-2].declarations.extend(self.attributes) else: self.scope[-1].declarations.extend(self.attributes) if len(self.attributes) == 1: self.documentable = self.attributes[0] else: self.documentable = None self.attributes = save_attributes def visitModule(self, node): name = os.path.basename(os.path.splitext(self.file.name)[0]) if name == '__init__': name = os.path.basename(os.path.dirname(self.file.name)) qname = QName(self.scope_name() + (name,)) module = ASG.Module(self.file, node.lineno, 'package', qname) else: qname = QName(self.scope_name() + (name,)) module = ASG.Module(self.file, node.lineno, 'module', qname) self.types[qname] = ASG.DeclaredTypeId('Python', qname, module) self.scope.append(module) self.documentable = module self.visit(node.node) self.scope.pop() self.file.declarations.append(module) def visitImport(self, node): self.imports.extend([(n[0], None) for n in node.names]) self.documentable = None def visitFrom(self, node): self.imports.extend([(node.modname, n[0]) for n in node.names]) self.documentable = None def visitAssName(self, node): if not self.in_ass_tuple: meta_tags = ['__docformat__'] if len(self.scope) == 1 and node.name in meta_tags: expression_text = eval(self.token_parser.rhs(node.lineno)) self.file.annotations[node.name] = expression_text self.docformat = expression_text qname = QName(self.scope_name() + (node.name,)) if type(self.scope[-1]) in (ASG.Function, ASG.Operation): return elif type(self.scope[-1]) == ASG.Class: attribute = ASG.Variable(self.file, node.lineno, 'class attribute', qname, self.any_type, False) else: attribute = ASG.Variable(self.file, node.lineno, 'attribute', qname, self.any_type, False) if node.name.startswith('__'): attribute.accessibility = ASG.PRIVATE elif node.name.startswith('_'): attribute.accessibility = ASG.PROTECTED self.attributes.append(attribute) self.types[qname] = ASG.DeclaredTypeId('Python', attribute.name, attribute) def visitAssTuple(self, node): self.in_ass_tuple = True for a in node.nodes: self.visit(a) self.in_ass_tuple = False def visitAssAttr(self, node): self.default_visit(node, node.attrname) if type(self.scope[-1]) == ASG.Operation: # We only parse constructors, so look out for # self attributes defined here. # FIXME: There is no reason the 'self' argument actually has to be spelled 'self'. if self.name[0] == 'self': # FIXME: qualifying variables is ambiguous, since we don't distinguish # class attributes and object attributes. qname = self.scope[-2].name + self.name[1:] self.attributes.append(ASG.Variable(self.file, node.lineno, 'attribute', qname, self.any_type, False)) def visitGetattr(self, node, suffix): self.default_visit(node, node.attrname + '.' + suffix) def visitName(self, node, suffix=None): if suffix: self.name = QName((node.name,) + (suffix,)) else: self.name = QName((node.name,)) def visitFunction(self, node): if isinstance(self.scope[-1], ASG.Function): # Skip local functions. return qname = QName(self.scope_name() + (node.name,)) if type(self.scope[-1]) == ASG.Class: function = ASG.Operation(self.file, node.lineno, 'method', [], self.any_type, [], qname, node.name) else: function = ASG.Function(self.file, node.lineno, 'function', [], self.any_type, [], qname, node.name) # The following attributes are special in that even though they are private they # match publicly accessible operations, so we exclude them from being # marked as private. special_attributes = ('__init__', '__str__', '__repr__', '__iter__', '__getitem__') if node.name.startswith('__'): if node.name not in special_attributes: function.accessibility = ASG.PRIVATE elif node.name.startswith('_'): function.accessibility = ASG.PROTECTED function.annotations['doc'] = DocString(node.doc or '', self.docformat) # Given that functions in Python are first-class citizens, should they be # treated like (named) types ? self.types[qname] = ASG.DeclaredTypeId('Python', function.name, function) self.scope.append(function) self.documentable = function function.parameters = self.parse_parameter_list(node) if node.name == '__init__': # Only parse constructors, to find member variables self.visit(node.code) self.scope.pop() self.scope[-1].declarations.append(function) def parse_parameter_list(self, node): parameters = [] special = [] argnames = list(node.argnames) if node.kwargs: special.append(ASG.Parameter('**', self.any_type, '', argnames[-1])) argnames.pop() if node.varargs: special.append(ASG.Parameter('*', self.any_type, '', argnames[-1])) argnames.pop() defaults = list(node.defaults) defaults = [None] * (len(argnames) - len(defaults)) + defaults values = self.token_parser.function_parameters(node.lineno) for argname, default in zip(node.argnames, defaults): if type(argname) is tuple: for a in argname: # FIXME: It is generally impossible to match tuple parameters # to defaults individually, we ignore default values for now. # (We may try to match them, and only leave out those resulting # from tuple-returning call expressions. But that's for another day.) parameters.append(ASG.Parameter('', self.any_type, '', a)) else: parameters.append(ASG.Parameter('', self.any_type, '', argname, values[argname])) if parameters or special: special.reverse() parameters.extend(special) return parameters def visitClass(self, node): if isinstance(self.scope[-1], ASG.Function): # Skip local classes. return bases = [] for base in node.bases: self.visit(base) # FIXME: This logic is broken ! # It assumes that names are either local or fully qualified. if len(self.name) == 1 and self.scope: # Name is unqualified. Qualify it. base = QName(list(self.scope[-1].name) + list(self.name)) else: base = self.name if self.types.has_key(base): base = self.types[base] else: base = ASG.UnknownTypeId('Python', base) bases.append(base) qname = QName(self.scope_name() + (node.name,)) class_ = ASG.Class(self.file, node.lineno, 'class', qname) class_.parents = [ASG.Inheritance('', b, '') for b in bases] class_.annotations['doc'] = DocString(node.doc or '', self.docformat) self.types[qname] = ASG.DeclaredTypeId('Python', class_.name, class_) self.scope.append(class_) self.documentable = class_ self.visit(node.code) self.scope.pop() self.scope[-1].declarations.append(class_) def visitGetattr(self, node, suffix=None): if suffix: name = node.attrname + '.' + suffix else: name = node.attrname self.default_visit(node, name) synopsis-0.12/Synopsis/Parsers/IDL/0000775000076400007640000000000011172123232016527 5ustar stefanstefansynopsis-0.12/Synopsis/Parsers/IDL/idlutil.py0000664000076400007640000001505511104703261020556 0ustar stefanstefan# -*- python -*- # Package : omniidl # idlutil.py Created on: 1999/10/27 # Author : Duncan Grisby (dpg1) # # Copyright (C) 1999 AT&T Laboratories Cambridge # # This file is part of omniidl. # # omniidl is free software; you can redistribute 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. # # Description: # # Utility functions # $Id: idlutil.py,v 1.9.2.4 2006/01/10 12:24:03 dgrisby Exp $ # $Log: idlutil.py,v $ # Revision 1.9.2.4 2006/01/10 12:24:03 dgrisby # Merge from omni4_0_develop pre 4.0.7 release. # # Revision 1.9.2.3 2005/07/21 09:54:59 dgrisby # Typo in docstring. # # Revision 1.9.2.2 2005/04/08 00:35:45 dgrisby # Merging again. # # Revision 1.9.2.1 2003/03/23 21:01:38 dgrisby # Start of omniORB 4.1.x development branch. # # Revision 1.5.2.6 2001/08/29 11:54:22 dpg1 # Clean up const handling in IDL compiler. # # Revision 1.5.2.5 2001/08/15 10:31:23 dpg1 # Minor tweaks and fixes. # # Revision 1.5.2.4 2001/06/13 11:28:22 dpg1 # Proper omniidl support for wchar/wstring constants. # # Revision 1.5.2.3 2001/03/13 10:34:01 dpg1 # Minor Python clean-ups # # Revision 1.5.2.2 2000/10/10 10:18:54 dpg1 # Update omniidl front-end from omni3_develop. # # Revision 1.3.2.1 2000/08/29 15:20:29 dpg1 # New relativeScope() function. New -i flag to enter interactive loop # after parsing # # Revision 1.3 1999/11/15 15:49:23 dpg1 # Documentation strings. # # Revision 1.2 1999/11/01 20:18:30 dpg1 # Added string escaping # # Revision 1.1 1999/10/29 15:47:07 dpg1 # First revision. # """Utility functions for IDL compilers escapifyString() -- return a string with non-printing characters escaped. escapifyWString() -- return a wstring with non-printing characters escaped. reprFloat() -- return a string represenation of an IDL float type. slashName() -- format a scoped name with '/' separating components. dotName() -- format a scoped name with '.' separating components. ccolonName() -- format a scoped name with '::' separating components. pruneScope() -- remove common prefix from a scoped name. relativeScope() -- give a minimal name for one scope relative to another.""" import string def slashName(scopedName, our_scope=[]): """slashName(list, [list]) -> string Return a scoped name given as a list of strings as a single string with the components separated by '/' characters. If a second list is given, remove a common prefix using pruneScope().""" pscope = pruneScope(scopedName, our_scope) return string.join(pscope, "/") def dotName(scopedName, our_scope=[]): """dotName(list, [list]) -> string Return a scoped name given as a list of strings as a single string with the components separated by '.' characters. If a second list is given, remove a common prefix using pruneScope().""" pscope = pruneScope(scopedName, our_scope) return string.join(pscope, ".") def ccolonName(scopedName, our_scope=[]): """ccolonName(list, [list]) -> string Return a scoped name given as a list of strings as a single string with the components separated by '::' strings. If a second list is given, remove a common prefix using pruneScope().""" pscope = pruneScope(scopedName, our_scope) return string.join(pscope, "::") def pruneScope(target_scope, our_scope): """pruneScope(list A, list B) -> list Given two lists of strings (scoped names), return a copy of list A with any prefix it shares with B removed. e.g. pruneScope(['A', 'B', 'C', 'D'], ['A', 'B', 'D']) -> ['C', 'D']""" tscope = target_scope[:] i = 0 while len(tscope) > 0 and \ i < len(our_scope) and \ tscope[0] == our_scope[i]: del tscope[0] i = i + 1 return tscope _valid_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" \ " 0123456789_!$%^&*()-=+[]{};#:@~,./<>?|`" _valid_unichars = map(ord, list(_valid_chars)) def escapifyString(s): """escapifyString(string) -> string Return the given string with any non-printing characters escaped.""" global _valid_chars l = list(s) for i in range(len(l)): if l[i] not in _valid_chars: l[i] = "\\%03o" % ord(l[i]) return string.join(l, "") def escapifyWString(l, escchar="u"): """escapifyWString(int list) -> string Take a list of integers representing Unicode characters and return an ASCII string with all characters outside that range replaced with \\u escapes.""" global _valid_unichars m = [None] * len(l) for i in range(len(l)): assert(l[i] <= 0xffff) if l[i] in _valid_unichars: m[i] = chr(l[i]) else: m[i] = "\\%s%04x" % (escchar, l[i]) return string.join(m, "") def reprFloat(f): """reprFloat(float) -> string Return the string representation of an IDL float type (float, double, long double), with enough precision to completely reconstruct the bit pattern.""" # *** Deal with long double s = "%.17g" % f if string.find(s, ".") == -1: s = s + ".0" return s def relativeScope(fromScope, destScope): """relativeScope(fromScope, destScope) -> list Given two globally-scoped names, return a minimal scoped name list which identifies the destination scope, without clashing with another identifier. For example, given IDL: module M { typedef short A; typedef long B; module N { typedef string B; interface I { void op(in ::M::A x, in ::M::B y); }; }; }; relativeScope(["M", "N", "I"], ["M", "A"]) -> ["A"] relativeScope(["M", "N", "I"], ["M", "B"]) -> ["M", "B"] If the only valid result is a globally-scoped name, the result list is prefixed with None: module O { typedef short C; }; module P { module O { interface J { void op(in ::O::C z); }; }; }; relativeScope(["P", "O", "J"], ["O", "C"]) -> [None, "O", "C"] If either scoped name does not exist, returns None.""" import _omniidl return _omniidl.relativeScopedName(fromScope, destScope) synopsis-0.12/Synopsis/Parsers/IDL/idltype.cc0000664000076400007640000001706411104703261020521 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idltype.cc Created on: 1999/10/21 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Type objects // $Id: idltype.cc,v 1.10.2.1 2003/03/23 21:01:44 dgrisby Exp $ // $Log: idltype.cc,v $ // Revision 1.10.2.1 2003/03/23 21:01:44 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.7.2.4 2001/10/17 16:48:34 dpg1 // Minor error message tweaks // // Revision 1.7.2.3 2000/11/01 12:45:57 dpg1 // Update to CORBA 2.4 specification. // // Revision 1.7.2.2 2000/10/27 16:31:10 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.7.2.1 2000/07/17 10:36:05 sll // Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0. // // Revision 1.8 2000/07/13 15:25:52 dpg1 // Merge from omni3_develop for 3.0 release. // // Revision 1.5.2.1 2000/03/06 10:40:29 dpg1 // Typo in string constant. // // Revision 1.5 1999/11/17 17:16:59 dpg1 // Changes to remove static initialisation of objects. // // Revision 1.4 1999/11/04 17:16:54 dpg1 // Changes for NT. // // Revision 1.3 1999/11/02 17:07:24 dpg1 // Changes to compile on Solaris. // // Revision 1.2 1999/10/29 15:44:14 dpg1 // DeclaredType() now takes extra DeclRepoId* argument. // // Revision 1.1 1999/10/27 14:05:54 dpg1 // *** empty log message *** // #include #include #include const char* IdlType:: kindAsString() const { switch(kind_) { case tk_null: return "null"; case tk_void: return "void"; case tk_short: return "short"; case tk_long: return "long"; case tk_ushort: return "unsigned short"; case tk_ulong: return "unsigned long"; case tk_float: return "float"; case tk_double: return "double"; case tk_boolean: return "boolean"; case tk_char: return "char"; case tk_octet: return "octet"; case tk_any: return "any"; case tk_TypeCode: return "CORBA::TypeCode"; case tk_Principal: return "CORBA::Principal"; case tk_objref: return "interface"; case tk_struct: return "struct"; case tk_union: return "union"; case tk_enum: return "enum"; case tk_string: return "string"; case tk_sequence: return "sequence"; case tk_array: return "array"; case tk_alias: return "typedef"; case tk_except: return "exception"; case tk_longlong: return "long long"; case tk_ulonglong: return "unsigned long long"; case tk_longdouble: return "long double"; case tk_wchar: return "wchar"; case tk_wstring: return "wstring"; case tk_fixed: return "fixed"; case tk_value: return "value"; case tk_value_box: return "value box"; case tk_native: return "native"; case tk_abstract_interface: return "abstract interface"; case tk_local_interface: return "local interface"; case ot_structforward: return "forward struct"; case ot_unionforward: return "forward union"; } assert(0); return ""; // To keep MSVC happy } IdlType* IdlType:: unalias() { IdlType* t = this; while (t && t->kind() == tk_alias) { if (((Declarator*)((DeclaredType*)t)->decl())->sizes()) break; t = ((Declarator*)((DeclaredType*)t)->decl())->alias()->aliasType(); } return t; } IdlType* IdlType:: scopedNameToType(const char* file, int line, const ScopedName* sn) { const Scope::Entry* se = Scope::current()->findForUse(sn, file, line); if (se) { if (se->kind() == Scope::Entry::E_DECL) { IdlType *t = se->idltype(); if (t) return t; } char* ssn = sn->toString(); IdlError(file, line, "'%s' is not a type", ssn); IdlErrorCont(se->file(), se->line(), "('%s' declared here)", ssn); delete [] ssn; } return 0; } // Static type object pointers IDL_Boolean IdlType::initialised_ = 0; BaseType* BaseType::nullType = 0; BaseType* BaseType::voidType = 0; BaseType* BaseType::shortType = 0; BaseType* BaseType::longType = 0; BaseType* BaseType::ushortType = 0; BaseType* BaseType::ulongType = 0; BaseType* BaseType::floatType = 0; BaseType* BaseType::doubleType = 0; BaseType* BaseType::booleanType = 0; BaseType* BaseType::charType = 0; BaseType* BaseType::octetType = 0; BaseType* BaseType::anyType = 0; BaseType* BaseType::TypeCodeType = 0; BaseType* BaseType::PrincipalType = 0; BaseType* BaseType::longlongType = 0; BaseType* BaseType::ulonglongType = 0; BaseType* BaseType::longdoubleType = 0; BaseType* BaseType::wcharType = 0; StringType* StringType::unboundedStringType = 0; WStringType* WStringType::unboundedWStringType = 0; DeclaredType* DeclaredType::corbaObjectType = 0; void IdlType:: init() { if (!initialised_) { BaseType::nullType = new BaseType(IdlType::tk_null); BaseType::voidType = new BaseType(IdlType::tk_void); BaseType::shortType = new BaseType(IdlType::tk_short); BaseType::longType = new BaseType(IdlType::tk_long); BaseType::ushortType = new BaseType(IdlType::tk_ushort); BaseType::ulongType = new BaseType(IdlType::tk_ulong); BaseType::floatType = new BaseType(IdlType::tk_float); BaseType::doubleType = new BaseType(IdlType::tk_double); BaseType::booleanType = new BaseType(IdlType::tk_boolean); BaseType::charType = new BaseType(IdlType::tk_char); BaseType::octetType = new BaseType(IdlType::tk_octet); BaseType::anyType = new BaseType(IdlType::tk_any); BaseType::TypeCodeType = new BaseType(IdlType::tk_TypeCode); BaseType::PrincipalType = new BaseType(IdlType::tk_Principal); BaseType::longlongType = new BaseType(IdlType::tk_longlong); BaseType::ulonglongType = new BaseType(IdlType::tk_ulonglong); BaseType::longdoubleType = new BaseType(IdlType::tk_longdouble); BaseType::wcharType = new BaseType(IdlType::tk_wchar); StringType::unboundedStringType = new StringType(0); WStringType::unboundedWStringType = new WStringType(0); DeclaredType::corbaObjectType = new DeclaredType(IdlType::tk_objref, 0, 0); initialised_ = 1; } } synopsis-0.12/Synopsis/Parsers/IDL/idlrepoId.h0000664000076400007640000000526711104703261020626 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlrepoId.h Created on: 1999/10/11 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Definitions for repoId management // $Id: idlrepoId.h,v 1.7.2.2 2005/05/10 22:07:31 dgrisby Exp $ // $Log: idlrepoId.h,v $ // Revision 1.7.2.2 2005/05/10 22:07:31 dgrisby // Merge again. // // Revision 1.7.2.1 2003/03/23 21:01:45 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.4.2.2 2000/10/27 16:31:09 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.4.2.1 2000/07/17 10:36:04 sll // Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0. // // Revision 1.5 2000/07/13 15:25:53 dpg1 // Merge from omni3_develop for 3.0 release. // // Revision 1.2 1999/11/02 17:07:25 dpg1 // Changes to compile on Solaris. // // Revision 1.1 1999/10/27 14:05:55 dpg1 // *** empty log message *** // #ifndef _idlrepoId_h #define _idlrepoId_h #include class Prefix { public: // Static prefix manipulation functions // Return the current prefix string static const char* current(); // Make prefix for a new scope or file static void newScope(const char* name); static void newFile(); // Set prefix for current scope static void setPrefix(const char* prefix); // Finish with a scope or file, reverting to the previous prefix static void endScope(); static void endFile(); static void endOuterFile(); protected: Prefix(char* str, IDL_Boolean isfile); ~Prefix(); // Get/set operations on this prefix node const char* get(); void set(const char* setTo); IDL_Boolean isfile(); private: char* str_; // Prefix string Prefix* parent_; // Previous prefix IDL_Boolean isfile_; // True if prefix is at file scope static Prefix* current_; }; #endif // _idlrepoId_h synopsis-0.12/Synopsis/Parsers/IDL/idlrepoId.cc0000664000076400007640000002627311104703262020765 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlrepoId.cc Created on: 1999/10/11 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Implementation of repoId management // $Id: idlrepoId.cc,v 1.9.2.4 2005/07/22 17:18:36 dgrisby Exp $ // $Log: idlrepoId.cc,v $ // Revision 1.9.2.4 2005/07/22 17:18:36 dgrisby // Another merge from omni4_0_develop. // // Revision 1.9.2.3 2005/05/10 22:07:31 dgrisby // Merge again. // // Revision 1.9.2.2 2005/01/06 23:11:14 dgrisby // Big merge from omni4_0_develop. // // Revision 1.9.2.1 2003/03/23 21:01:45 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.5.2.6 2001/11/13 14:11:46 dpg1 // Tweaks for CORBA 2.5 compliance. // // Revision 1.5.2.5 2001/10/17 16:48:33 dpg1 // Minor error message tweaks // // Revision 1.5.2.4 2000/11/03 12:20:58 dpg1 // #pragma ID can now be declared more than once for a type, as long as // the id is the same. // // Revision 1.5.2.3 2000/10/27 16:31:09 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.5.2.2 2000/10/10 10:18:51 dpg1 // Update omniidl front-end from omni3_develop. // // Revision 1.3.2.1 2000/08/29 10:20:27 dpg1 // Operations and attributes now have repository ids. // // Revision 1.3 1999/11/08 10:50:47 dpg1 // Change to behaviour when files end inside a scope. // // Revision 1.2 1999/11/02 17:07:25 dpg1 // Changes to compile on Solaris. // // Revision 1.1 1999/10/27 14:05:56 dpg1 // *** empty log message *** // #include #include #include #include #include #include #include #include // Globals from lexer/parser extern int yylineno; extern char* currentFile; Prefix* Prefix::current_ = 0; Prefix:: Prefix(char* str, IDL_Boolean isfile) : str_(str), parent_(current_), isfile_(isfile) { current_ = this; } Prefix:: ~Prefix() { current_ = parent_; delete [] str_; } const char* Prefix:: current() { return current_->get(); } void Prefix:: newScope(const char* name) { if (name[0] == '_') ++name; int len = strlen(current()) + strlen(name) + 2; char* str = new char[len]; strcpy(str, current()); if (str[0] != '\0') strcat(str, "/"); strcat(str, name); new Prefix(str, 0); } void Prefix:: newFile() { char* str = new char[1]; str[0] = '\0'; new Prefix(str, 1); } void Prefix:: setPrefix(const char* prefix) { current_->set(prefix); } void Prefix:: endScope() { if (current_->parent_) delete current_; else IdlWarning(currentFile, yylineno, "Confused by pre-processor line directives"); } void Prefix:: endFile() { if (!current_->isfile()) { IdlWarning(currentFile, yylineno, "File ended inside a declaration. " "Repository identifiers may be incorrect"); } if (current_->parent_) delete current_; else IdlWarning(currentFile, yylineno, "Confused by pre-processor line directives"); } void Prefix:: endOuterFile() { if (current_->parent_) IdlWarning(currentFile, yylineno, "Confused by pre-processor line directives"); else delete current_; } const char* Prefix:: get() { return str_; } void Prefix:: set(const char* setTo) { char* str; delete [] str_; if (setTo[0] == '\0') { str = new char[1]; str[0] = '\0'; } else str = idl_strdup(setTo); str_ = str; } IDL_Boolean Prefix:: isfile() { return isfile_; } // Implementation of DeclRepoId DeclRepoId:: DeclRepoId(const char* identifier) : eidentifier_(idl_strdup(identifier)), prefix_(idl_strdup(Prefix::current())), set_(0), maj_(1), min_(0) { if (identifier[0] == '_') identifier_ = idl_strdup(++identifier); else identifier_ = eidentifier_; const ScopedName* psn = Scope::current()->scopedName(); if (psn) { scopedName_ = new ScopedName(psn); scopedName_->append(identifier); } else scopedName_ = new ScopedName(identifier, 1); genRepoId(); } DeclRepoId:: ~DeclRepoId() { if (identifier_ != eidentifier_) delete [] identifier_; delete [] eidentifier_; delete [] repoId_; delete [] prefix_; if (set_) delete [] rifile_; } void DeclRepoId:: setRepoId(const char* repoId, const char* file, int line) { if (set_) { if (strcmp(repoId, repoId_)) { IdlError(file, line, "Cannot set repository id of '%s' to '%s'", identifier_, repoId); IdlErrorCont(rifile_, riline_, "Repository id previously set to '%s' here", repoId_); } } else { delete [] repoId_; repoId_ = idl_strdup(repoId); set_ = 1; rifile_ = idl_strdup(file); riline_ = line; for (; *repoId && *repoId != ':'; ++repoId); if (*repoId == '\0') goto invalid; // If the repoId set is in OMG IDL format, we must figure out the // version number, so a future #pragma version can succeed if the // same version is given. Evil spec. if (!strncmp(repoId_, "IDL:", 4)) { const char* c; for (c=repoId_ + 4; *c && *c != ':'; ++c); if (*c++ == '\0') goto invalid; // c should now point to a string of the form maj.min if (sscanf(c, "%hd.%hd", &maj_, &min_) != 2) goto invalid; // Check there's no trailing garbage for (; *c && isdigit(*c); ++c); if (*c++ != '.') goto invalid; for (; *c && isdigit(*c); ++c); if (*c != '\0') goto invalid; } else { maj_ = -1; // Make sure a future #pragma version complains } } return; invalid: IdlWarning(file, line, "Repository id of '%s' set to invalid string '%s'", identifier_, repoId_); maj_ = -1; } void DeclRepoId:: setVersion(IDL_Short maj, IDL_Short min, const char* file, int line) { if (set_) { if (maj_ != maj || min_ != min) { IdlError(file, line, "Cannot set version of '%s' to '%d.%d'", identifier_, maj, min); IdlErrorCont(rifile_, riline_, "Repository id previously set to '%s' here", repoId_); } } else { delete [] repoId_; maj_ = maj; min_ = min; set_ = 1; rifile_ = idl_strdup(file); riline_ = line; genRepoId(); } } void DeclRepoId:: genRepoId() { char* id; int len; // RepoId length = IDL: + prefix + "/" + identifier + : + maj + . + min + \0 len = 4 + strlen(prefix_) + 1 + strlen(identifier_) + 1 + 5 + 1 + 5 + 1; char* repoId = new char[len]; sprintf(repoId, "IDL:%s%s%s:%hd.%hd", prefix_, prefix_[0] == '\0' ? "" : "/", identifier_, maj_, min_); repoId_ = repoId; } // Static set functions class SetRepoIdVisitor : public AstVisitor { public: SetRepoIdVisitor(const char* repoId, const char* file, int line) : r_(repoId), f_(file), l_(line) {} virtual ~SetRepoIdVisitor() {} void visitModule (Module* d) { d->setRepoId(r_, f_, l_); } void visitInterface (Interface* d) { d->setRepoId(r_, f_, l_); } void visitForward (Forward* d) { d->setRepoId(r_, f_, l_); } void visitConst (Const* d) { d->setRepoId(r_, f_, l_); } void visitDeclarator (Declarator* d) { d->setRepoId(r_, f_, l_); } void visitStruct (Struct* d) { d->setRepoId(r_, f_, l_); } void visitException (Exception* d) { d->setRepoId(r_, f_, l_); } void visitUnion (Union* d) { d->setRepoId(r_, f_, l_); } void visitEnum (Enum* d) { d->setRepoId(r_, f_, l_); } void visitNative (Native* d) { d->setRepoId(r_, f_, l_); } void visitValueForward (ValueForward* d) { d->setRepoId(r_, f_, l_); } void visitValueBox (ValueBox* d) { d->setRepoId(r_, f_, l_); } void visitValueAbs (ValueAbs* d) { d->setRepoId(r_, f_, l_); } void visitValue (Value* d) { d->setRepoId(r_, f_, l_); } void visitMember (Member* d) { error(d); } void visitUnionCase (UnionCase* d) { error(d); } void visitEnumerator (Enumerator* d) { error(d); } void visitAttribute (Attribute* d) { error(d); } void visitOperation (Operation* d) { d->setRepoId(r_, f_, l_); } void visitStateMember (StateMember* d) { error(d); } void visitFactory (Factory* d) { error(d); } private: const char* r_; const char* f_; int l_; void error(Decl* d) { IdlError(f_, l_, "Cannot set repository id of %s", d->kindAsString()); } }; void DeclRepoId:: setRepoId(Decl* d, const char* repoId, const char* file, int line) { SetRepoIdVisitor v(repoId, file, line); d->accept(v); } class SetVersionVisitor : public AstVisitor { public: SetVersionVisitor(IDL_Short maj, IDL_Short min, const char* file, int line) : a_(maj), i_(min), f_(file), l_(line) {} virtual ~SetVersionVisitor() {} void visitModule (Module* d) { d->setVersion(a_, i_, f_, l_); } void visitInterface (Interface* d) { d->setVersion(a_, i_, f_, l_); } void visitForward (Forward* d) { d->setVersion(a_, i_, f_, l_); } void visitConst (Const* d) { d->setVersion(a_, i_, f_, l_); } void visitDeclarator (Declarator* d) { d->setVersion(a_, i_, f_, l_); } void visitStruct (Struct* d) { d->setVersion(a_, i_, f_, l_); } void visitException (Exception* d) { d->setVersion(a_, i_, f_, l_); } void visitUnion (Union* d) { d->setVersion(a_, i_, f_, l_); } void visitEnum (Enum* d) { d->setVersion(a_, i_, f_, l_); } void visitNative (Native* d) { d->setVersion(a_, i_, f_, l_); } void visitValueForward (ValueForward* d) { d->setVersion(a_, i_, f_, l_); } void visitValueBox (ValueBox* d) { d->setVersion(a_, i_, f_, l_); } void visitValueAbs (ValueAbs* d) { d->setVersion(a_, i_, f_, l_); } void visitValue (Value* d) { d->setVersion(a_, i_, f_, l_); } void visitMember (Member* d) { error(d); } void visitUnionCase (UnionCase* d) { error(d); } void visitEnumerator (Enumerator* d) { error(d); } void visitAttribute (Attribute* d) { error(d); } void visitOperation (Operation* d) { d->setVersion(a_, i_, f_, l_); } void visitStateMember (StateMember* d) { error(d); } void visitFactory (Factory* d) { error(d); } private: IDL_Short a_; IDL_Short i_; const char* f_; int l_; void error(Decl* d) { IdlError(f_, l_, "Cannot set version of %s", d->kindAsString()); } }; void DeclRepoId:: setVersion(Decl* d, IDL_Short maj, IDL_Short min, const char* file, int line) { SetVersionVisitor v(maj, min, file, line); d->accept(v); } synopsis-0.12/Synopsis/Parsers/IDL/idlutil.h0000664000076400007640000000536311104703261020356 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlutil.h Created on: 1999/10/11 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Utility functions // $Id: idlutil.h,v 1.9.2.1 2003/03/23 21:01:43 dgrisby Exp $ // $Log: idlutil.h,v $ // Revision 1.9.2.1 2003/03/23 21:01:43 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.5.2.4 2002/01/15 16:38:15 dpg1 // On the road to autoconf. Dependencies refactored, configure.ac // written. No makefiles yet. // // Revision 1.5.2.3 2000/10/27 16:31:11 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.5.2.2 2000/10/10 10:18:51 dpg1 // Update omniidl front-end from omni3_develop. // // Revision 1.3.2.1 2000/08/07 15:34:37 dpg1 // Partial back-port of long long from omni3_1_develop. // // Revision 1.3 1999/11/09 12:41:40 dpg1 // strcasecmp changes for NT, AIX. // // Revision 1.2 1999/11/04 17:16:54 dpg1 // Changes for NT. // // Revision 1.1 1999/10/27 14:05:53 dpg1 // *** empty log message *** // #ifndef _idlutil_h_ #define _idlutil_h_ #include #include #ifdef HAS_LongLong typedef IDL_ULongLong IdlIntLiteral; #else typedef IDL_ULong IdlIntLiteral; #endif #ifdef HAS_LongDouble typedef IDL_LongDouble IdlFloatLiteral; #else typedef IDL_Double IdlFloatLiteral; #endif // Version of strdup which uses new char* idl_strdup(const char* s); IDL_WChar* idl_wstrdup(const IDL_WChar* s); // strlen, strcpy and strcat for wstring int idl_wstrlen(const IDL_WChar* s); IDL_WChar* idl_wstrcpy(IDL_WChar* a, const IDL_WChar* b); IDL_WChar* idl_wstrcat(IDL_WChar* a, const IDL_WChar* b); #ifndef HAVE_STRCASECMP int strcasecmp(const char* s1, const char* s2); #endif // Versions of strtoul and strtod which work with the type sizes in use IdlIntLiteral idl_strtoul(const char* text, int base); IdlFloatLiteral idl_strtod (const char* text); #endif // _idlutil_h_ synopsis-0.12/Synopsis/Parsers/IDL/idlast.py0000664000076400007640000012077211104703261020373 0ustar stefanstefan# -*- python -*- # Package : omniidl # idlast.py Created on: 1999/10/27 # Author : Duncan Grisby (dpg1) # # Copyright (C) 1999 AT&T Laboratories Cambridge # # This file is part of omniidl. # # omniidl is free software; you can redistribute 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. # # Description: # # Python definitions for abstract syntax tree classes # $Id: idlast.py,v 1.20.2.7 2006/01/18 19:23:17 dgrisby Exp $ # $Log: idlast.py,v $ # Revision 1.20.2.7 2006/01/18 19:23:17 dgrisby # Code generation problems with valuetype inheritance / typedefs. # # Revision 1.20.2.6 2004/10/13 17:58:26 dgrisby # Abstract interfaces support; values support interfaces; value bug fixes. # # Revision 1.20.2.5 2003/11/06 11:56:57 dgrisby # Yet more valuetype. Plain valuetype and abstract valuetype are now working. # # Revision 1.20.2.4 2003/09/04 14:00:35 dgrisby # ValueType IDL updates. # # Revision 1.20.2.3 2003/07/10 21:54:47 dgrisby # Missed methods in ValueAbs. # # Revision 1.20.2.2 2003/05/20 16:53:17 dgrisby # Valuetype marshalling support. # # Revision 1.20.2.1 2003/03/23 21:01:39 dgrisby # Start of omniORB 4.1.x development branch. # # Revision 1.15.2.7 2002/09/21 21:07:51 dgrisby # Support ValueBase in omniidl. (No use to omniORB yet...) # # Revision 1.15.2.6 2001/08/29 11:55:23 dpg1 # Enumerator nodes record their value. # # Revision 1.15.2.5 2001/06/08 17:12:25 dpg1 # Merge all the bug fixes from omni3_develop. # # Revision 1.15.2.4 2000/11/01 15:57:03 dpg1 # More updates for 2.4. # # Revision 1.15.2.3 2000/11/01 12:45:59 dpg1 # Update to CORBA 2.4 specification. # # Revision 1.15.2.2 2000/10/10 10:18:54 dpg1 # Update omniidl front-end from omni3_develop. # # Revision 1.13.2.4 2000/08/29 10:20:29 dpg1 # Operations and attributes now have repository ids. # # Revision 1.13.2.3 2000/06/29 14:08:11 dpg1 # Incorrect visitor method called for Value nodes. # # Revision 1.13.2.2 2000/06/08 14:36:21 dpg1 # Comments and pragmas are now objects rather than plain strings, so # they can have file,line associated with them. # # Revision 1.13.2.1 2000/03/06 15:03:45 dpg1 # Minor bug fixes to omniidl. New -nf and -k flags. # # Revision 1.13 1999/11/29 16:43:51 dpg1 # Forgot a case in registerDecl(). # # Revision 1.12 1999/11/29 15:04:47 dpg1 # Fixed bug in clear(). # # Revision 1.11 1999/11/25 11:20:33 dpg1 # Tidy documentation changes. # # Revision 1.10 1999/11/23 09:52:11 dpg1 # Dumb bug where maps weren't cleared between runs. # # Revision 1.9 1999/11/15 15:49:23 dpg1 # Documentation strings. # # Revision 1.8 1999/11/11 15:55:30 dpg1 # Python back-end interface now supports valuetype declarations. # Back-ends still don't support them, though. # # Revision 1.7 1999/11/02 17:07:24 dpg1 # Changes to compile on Solaris. # # Revision 1.6 1999/11/02 10:01:46 dpg1 # Minor fixes. # # Revision 1.5 1999/11/01 20:19:55 dpg1 # Support for union switch types declared inside the switch statement. # # Revision 1.4 1999/11/01 16:39:01 dpg1 # Small fixes and cosmetic changes. # # Revision 1.3 1999/11/01 10:05:01 dpg1 # New file attribute to AST. # # Revision 1.2 1999/10/29 18:19:39 dpg1 # Clean up # # Revision 1.1 1999/10/29 15:47:08 dpg1 # First revision. # """Classes and functions for handling the IDL Abstract Syntax Tree Function: findDecl(scopedName) -- find a Decl object given a fully-scoped name, represented as a list of strings. eg. ::foo::bar::baz is represented as ['foo', 'bar', 'baz']. Classes: AST -- top level of Abstract Syntax Tree. Decl -- base of all declarations. DeclRepoId -- mixin class for Decls with repository ids. Pragma -- record of an unknown pragma Comment -- record of a comment Module -- module declaration. Interface -- interface declaration. Forward -- forward-declared interface. Const -- constant declaration. Declarator -- declarator used in typedef, struct members, etc. Typedef -- typedef. Member -- member of a struct or exception. Struct -- struct declaration. Exception -- exception declaration. CaseLabel -- case label within a union. UnionCase -- one case within a union. Union -- union declaration. Enumerator -- enumerator of an enum. Enum -- enum declaration. Attribute -- attribute declaration. Parameter -- parameter of an operation of factory. Operation -- operation declaration. Native -- native declaration. StateMember -- state member of a valuetype. Factory -- factory method of a valuetype. ValueForward -- forward-declared valuetype. ValueBox -- boxed value declaration. ValueAbs -- abstract valuetype declaration. Value -- valuetype declaration.""" import idlutil import idlvisitor class AST: """Class for top-level Abstract Syntax Tree. Functions: file() -- the file name of the main IDL file. declarations() -- list of Decl objects corresponding to declarations at file scope. pragmas() -- list of Pragma objects containing #pragmas which occurred before any declarations. Later #pragmas are attached to Decl objects. comments() -- list of Comment objects containing comments which occurred before any declarations. accept(visitor) -- visitor pattern accept. See idlvisitor.py.""" def __init__(self, file, declarations, pragmas, comments): self.__file = file self.__declarations = declarations self.__pragmas = pragmas self.__comments = comments def file(self): return self.__file def declarations(self): return self.__declarations def pragmas(self): return self.__pragmas def comments(self): return self.__comments def accept(self, visitor): visitor.visitAST(self) class Decl: """Base class for all declarations. Functions: file() -- the IDL file this declaration came from. line() -- the line number within the file. mainFile() -- boolean: true if the file was the main IDL file; false if it was an included file. pragmas() -- list of Pragma objects containing #pragmas which immediately followed this declaration. comments() -- list of Comment objects containing comments which immediately followed this declaration. fullDecl() -- the 'full' Decl for typedefs, forwards, etc. accept(visitor) -- visitor pattern accept. See idlvisitor.py.""" def __init__(self, file, line, mainFile, pragmas, comments): self.__file = file self.__line = line self.__mainFile = mainFile self.__builtIn = 0 self.__pragmas = pragmas self.__comments = comments def accept(self, visitor): pass def file(self): return self.__file def line(self): return self.__line def mainFile(self): return self.__mainFile def builtIn(self): return self.__builtIn def pragmas(self): return self.__pragmas def comments(self): return self.__comments def fullDecl(self): return self class DeclRepoId : """Mixin class for Decls which have a Repository Id Functions: identifier() -- name of the declaration as a string scopedName() -- list of strings forming the fully-scoped name of the declaration. e.g. ::foo::bar::baz is represented as ['foo', 'bar', 'baz']. repoId() -- repository identifier for this declaration.""" def __init__(self, identifier, scopedName, repoId): self.__identifier = identifier self.__scopedName = scopedName self.__repoId = repoId def identifier(self): return self.__identifier def scopedName(self): return self.__scopedName def repoId(self): return self.__repoId # Pragmas and comments class Pragma : """Class containing information about an unknown pragma Functions: text() -- text of the pragma __str__() -- same as text() file() -- file containing the pragma line() -- line number in file""" def __init__(self, text, file, line): self.__text = text self.__file = file self.__line = line def text(self) : return self.__text def __str__(self) : return self.__text def file(self) : return self.__file def line(self) : return self.__line class Comment : """Class containing information about a comment Functions: text() -- text of the comment __str__() -- same as text() file() -- file containing the comment line() -- line number in file""" def __init__(self, text, file, line): self.__text = text self.__file = file self.__line = line def text(self) : return self.__text def __str__(self) : return self.__text def file(self) : return self.__file def line(self) : return self.__line # Concrete declaration objects class Module (Decl, DeclRepoId): """Module declaration (Decl, DeclRepoId) Functions: definitions() -- list of Decl objects declared within this module. continuations() -- list containing continuations of this module. When modules are re-opened, multiple Module objects with the same name appear in the enclosing Module or AST object. In case it's useful, the first Module object for a particular module has a list containing continuations of that module. You will probably not have any use for this.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId, definitions): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__definitions = definitions self._continuations = [] def accept(self, visitor): visitor.visitModule(self) def definitions(self): return self.__definitions def continuations(self): return self._continuations class Interface (Decl, DeclRepoId): """Interface declaration (Decl, DeclRepoId) Functions: abstract() -- boolean: true if the interface is declared abstract. local() -- boolean: true if the interface is declared local. inherits() -- list of Interface objects from which this one inherits. contents() -- list of Decl objects for all items declared within this interface. declarations() -- subset of contents() containing types, constants and exceptions. callables() -- subset of contents() containing Operations and Attributes. all_callables()-- callables of this and inherited interfaces.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId, abstract, local, inherits): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__abstract = abstract self.__local = local self.__inherits = inherits self.__contents = [] self.__declarations = [] self.__callables = [] def _setContents(self, contents): self.__contents = contents self.__declarations = filter(lambda c: not (isinstance(c, Attribute) or isinstance(c, Operation)), contents) self.__callables = filter(lambda c: (isinstance(c, Attribute) or isinstance(c, Operation)), contents) def accept(self, visitor): visitor.visitInterface(self) def abstract(self): return self.__abstract def local(self): return self.__local def inherits(self): return self.__inherits def contents(self): return self.__contents def declarations(self): return self.__declarations def callables(self): return self.__callables def all_callables(self): r = [] # This loop is very inefficient, but the lists should be quite # short. for b in self.__inherits: for c in b.all_callables(): if c not in r: r.append(c) r.extend(self.__callables) return r class Forward (Decl, DeclRepoId): """Forward-declared interface (Decl, DeclRepoId) Functions: abstract() -- boolean: true if the interface is declared abstract. local() -- boolean: true if the interface is declared local. fullDecl() -- Interface object corresponding to full interface declaration or None if there is no full declaration.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId, abstract, local): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__abstract = abstract self.__local = local self._fullDecl = None self._more = [] def accept(self, visitor): visitor.visitForward(self) def abstract(self): return self.__abstract def local(self): return self.__abstract def fullDecl(self): return self._fullDecl class Const (Decl, DeclRepoId): """Constant declaration (Decl, DeclRepoId) Functions: constType() -- IdlType.Type object of this constant. Aliases not stripped. constKind() -- TypeCode kind of constant with aliases stripped. value() -- value of the constant. Either an integer or an Enumerator object.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId, constType, constKind, value): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__constType = constType self.__constKind = constKind self.__value = value #print line, "Const init:", constType, identifier, value def accept(self, visitor): visitor.visitConst(self) def constType(self): return self.__constType def constKind(self): return self.__constKind def value(self): return self.__value class Declarator (Decl, DeclRepoId): """Declarator used in typedefs, struct members, etc. (Decl, DeclRepoId) Functions: sizes() -- list of array sizes, or None if this is a simple declarator. alias() -- Typedef object for this declarator if this is a typedef declarator. None otherwise.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId, sizes): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__sizes = sizes self.__alias = None def _setAlias(self, alias): self.__alias = alias def accept(self, visitor): visitor.visitDeclarator(self) def sizes(self): return self.__sizes def alias(self): return self.__alias def fullDecl(self): if self.__alias is not None: try: return self.__alias.aliasType().decl() except AttributeError: pass return self class Typedef (Decl): """Typedef (Decl) Functions: aliasType() -- IdlType.Type object that this is an alias to. constrType() -- boolean: true if the alias type was constructed within this typedef declaration. declarators() -- list of Declarator objects.""" def __init__(self, file, line, mainFile, pragmas, comments, aliasType, constrType, declarators): Decl.__init__(self, file, line, mainFile, pragmas, comments) self.__aliasType = aliasType self.__constrType = constrType self.__declarators = declarators def accept(self, visitor): visitor.visitTypedef(self) def aliasType(self): return self.__aliasType def constrType(self): return self.__constrType def declarators(self): return self.__declarators class Member (Decl): """Member of a struct or exception (Decl) Functions: memberType() -- IdlType.Type object for the type of this member. constrType() -- boolean: true if the member type was constructed within the member declaration. declarators() -- list of Declarator objects.""" def __init__(self, file, line, mainFile, pragmas, comments, memberType, constrType, declarators): Decl.__init__(self, file, line, mainFile, pragmas, comments) self.__memberType = memberType self.__constrType = constrType self.__declarators = declarators def accept(self, visitor): visitor.visitMember(self) def memberType(self): return self.__memberType def constrType(self): return self.__constrType def declarators(self): return self.__declarators class Struct (Decl, DeclRepoId): """Struct declaration (Decl, DeclRepoId) Functions: members() -- list of Member objects for the struct contents. recursive() -- boolean: true if the struct is recursive.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId, recursive): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__recursive = recursive def _setMembers(self, members): self.__members = members def accept(self, visitor): visitor.visitStruct(self) def members(self): return self.__members def recursive(self): return self.__recursive class StructForward (Decl, DeclRepoId): """Struct forward declaration (Decl, DeclRepoId) Functions: fullDecl() -- full definition of the struct.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self._fullDecl = None self._more = [] def accept(self, visitor): visitor.visitStructForward(self) def fullDecl(self): return self._fullDecl class Exception (Decl, DeclRepoId): """Exception declaration (Decl, DeclRepoId) Function: members() -- list of Member objects for the exception contents.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId, members): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__members = members #print line, "Exception init:", identifier, members def accept(self, visitor): visitor.visitException(self) def members(self): return self.__members class CaseLabel (Decl): """Case label within a union (Decl) Functions: default() -- boolean: true if this is the default label. value() -- label value. Either an integer or an Enumerator object. If default() is true, returns a value used by none of the other union labels. labelKind() -- TypeCode kind of label.""" def __init__(self, file, line, mainFile, pragmas, comments, default, value, labelKind): Decl.__init__(self, file, line, mainFile, pragmas, comments) self.__default = default self.__value = value self.__labelKind = labelKind def accept(self, visitor): visitor.visitCaseLabel(self) def default(self): return self.__default def value(self): return self.__value def labelKind(self): return self.__labelKind class UnionCase (Decl): """One case within a union (Decl) Functions: labels() -- list of CaseLabel objects. caseType() -- IdlType.Type object for the case type. constrType() -- boolean: true if the case type was constructed within the case. declarator() -- Declarator object""" def __init__(self, file, line, mainFile, pragmas, comments, labels, caseType, constrType, declarator): Decl.__init__(self, file, line, mainFile, pragmas, comments) self.__labels = labels self.__caseType = caseType self.__constrType = constrType self.__declarator = declarator def accept(self, visitor): visitor.visitUnionCase(self) def labels(self): return self.__labels def caseType(self): return self.__caseType def constrType(self): return self.__constrType def declarator(self): return self.__declarator class Union (Decl, DeclRepoId): """Union declaration (Decl, DeclRepoId) Functions: switchType() -- IdlType.Type object corresponding to the switch type. constrType() -- boolean: true if the switch type was declared within the switch statement. Only possible for Enums. cases() -- list of UnionCase objects. recursive() -- boolean: true if the union is recursive.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId, switchType, constrType, recursive): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__switchType = switchType self.__constrType = constrType self.__recursive = recursive def _setCases(self, cases): self.__cases = cases def accept(self, visitor): visitor.visitUnion(self) def switchType(self): return self.__switchType def constrType(self): return self.__constrType def cases(self): return self.__cases def recursive(self): return self.__recursive class UnionForward (Decl, DeclRepoId): """Union forward declaration (Decl, DeclRepoId) Functions: fullDecl() -- full definition of the union.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self._fullDecl = None self._more = [] def accept(self, visitor): visitor.visitUnionForward(self) def fullDecl(self): return self._fullDecl class Enumerator (Decl, DeclRepoId): """Enumerator of an Enum (Decl, DeclRepoId) Function: value() -- integer value of enumerator, as marshalled.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId, value): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__value = value def accept(self, visitor): visitor.visitEnumerator(self) def value(self): return self.__value class Enum (Decl, DeclRepoId): """Enum declaration (Decl, DeclRepoId) Function: enumerators() -- list of Enumerator objects.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId, enumerators): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__enumerators = enumerators def accept(self, visitor): visitor.visitEnum(self) def enumerators(self): return self.__enumerators class Attribute (Decl): """Attribute declaration (Decl) Functions: readonly() -- boolean: true if the attribute is read only. attrType() -- IdlType.Type object for the attribute's type. declarators() -- list of the attribute's declarators. identifiers() -- list of strings containing the attribute identifiers (equivalent to the identifiers inside the declarators).""" def __init__(self, file, line, mainFile, pragmas, comments, readonly, attrType, declarators): Decl.__init__(self, file, line, mainFile, pragmas, comments) self.__readonly = readonly self.__attrType = attrType self.__declarators = declarators self.__identifiers = map(lambda d: d.identifier(), declarators) #print line, "Attribute init:", readonly, identifiers def accept(self, visitor): visitor.visitAttribute(self) def readonly(self): return self.__readonly def attrType(self): return self.__attrType def declarators(self): return self.__declarators def identifiers(self): return self.__identifiers class Parameter (Decl): """A Parameter of an operation or factory specifier (Decl) Functions: direction() -- integer: 0 == in, 1 == out, 2 == inout. is_in() -- boolean: true if in or inout. is_out() -- boolean: true if out or inout. paramType() -- IdlType.Type object for the parameter type. identifier() -- string of parameter identifier.""" def __init__(self, file, line, mainFile, pragmas, comments, direction, paramType, identifier): Decl.__init__(self, file, line, mainFile, pragmas, comments) self.__direction = direction self.__is_in = (direction == 0 or direction == 2) self.__is_out = (direction == 1 or direction == 2) self.__paramType = paramType self.__identifier = identifier #print line, "Parameter init:", identifier def accept(self, visitor): visitor.visitParameter(self) def direction(self): return self.__direction def is_in(self): return self.__is_in def is_out(self): return self.__is_out def paramType(self): return self.__paramType def identifier(self): return self.__identifier class Operation (Decl, DeclRepoId): """Operation declaration (Decl, DeclRepoId) Functions: oneway() -- boolean: true if operation is one way. returnType() -- IdlType.Type object for return type. parameters() -- list of Parameter objects. raises() -- list of Exception objects. contexts() -- list of strings for context expressions.""" def __init__(self, file, line, mainFile, pragmas, comments, oneway, returnType, identifier, scopedName, repoId, parameters, raises, contexts): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__oneway = oneway self.__returnType = returnType self.__parameters = parameters self.__raises = raises self.__contexts = contexts #print line, "Operation init:", identifier, raises, contexts def accept(self, visitor): visitor.visitOperation(self) def oneway(self): return self.__oneway def returnType(self): return self.__returnType def parameters(self): return self.__parameters def raises(self): return self.__raises def contexts(self): return self.__contexts class Native (Decl, DeclRepoId): """Native declaration (Decl, DeclRepoId) Native should not be used in normal IDL. No non-inherited functions.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) def accept(self, visitor): visitor.visitNative(self) class StateMember (Decl): """State member of a valuetype (Decl) Functions: memberAccess() -- integer: 0 == public, 1 == private. memberType() -- IdlType.Type object for member type. constrType() -- boolean: true if member type is declared within the StateMember. declarators() -- list of Declarator objects.""" def __init__(self, file, line, mainFile, pragmas, comments, memberAccess, memberType, constrType, declarators): Decl.__init__(self, file, line, mainFile, pragmas, comments) self.__memberAccess = memberAccess self.__memberType = memberType self.__constrType = constrType self.__declarators = declarators def accept(self, visitor): visitor.visitStateMember(self) # Access specifier: 0 for public, 1 for private def memberAccess(self): return self.__memberAccess def memberType(self): return self.__memberType def constrType(self): return self.__constrType def declarators(self): return self.__declarators class Factory (Decl): """Factory method of valuetype (Decl) Functions: identifier() -- string. parameters() -- list of Parameter objects. raises() -- list of Exception objects.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, parameters, raises): Decl.__init__(self, file, line, mainFile, pragmas, comments) self.__identifier = identifier self.__parameters = parameters self.__raises = raises def accept(self, visitor): visitor.visitFactory(self) def identifier(self): return self.__identifier def parameters(self): return self.__parameters def raises(self): return self.__raises class ValueForward (Decl, DeclRepoId): """Forward declared valuetype (Decl, DeclRepoId) Function: abstract() -- boolean: true if declared abstract. fullDecl() -- Value or ValueAbs object corresponding to the full valuetype declaration or None if there is no full declaration.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId, abstract): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__abstract = abstract self._fullDecl = None self._more = [] def accept(self, visitor): visitor.visitValueForward(self) def abstract(self): return self.__abstract def fullDecl(self): return self._fullDecl class ValueBox (Decl, DeclRepoId): """ValueBox declaration (Decl, DeclRepoId) Functions: boxedType() -- IdlType.Type object for boxed type. constrType() -- boolean: true if boxed type is declared inside the ValueBox declaration.""" def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId, boxedType, constrType): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__boxedType = boxedType self.__constrType = constrType def accept(self, visitor): visitor.visitValueBox(self) def boxedType(self): return self.__boxedType def constrType(self): return self.__constrType class ValueAbs (Decl, DeclRepoId): """Abstract valuetype declaration (Decl, DeclRepoId) Functions: inherits() -- list of ValueAbs objects from which this inherits. supports() -- list of Interface objects which this supports. contents() -- list of Decl objects for declarations within this valuetype. declarations() -- subset of contents() containing types, constants and exceptions. callables() -- subset of contents() containing Operations and Attributes. statemembers() -- subset of contents() containing StateMembers. factories() -- subset of contents() containing Factory instances. """ def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId, inherits, supports): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__inherits = inherits self.__supports = supports self.__contents = [] self.__declarations = [] self.__callables = [] self.__statemembers = [] self.__factories = [] def _setContents(self, contents): self.__contents = contents self.__declarations = filter(lambda c: not \ (isinstance(c, Attribute) or isinstance(c, Operation) or isinstance(c, StateMember) or isinstance(c, Factory)), contents) self.__callables = filter(lambda c: \ (isinstance(c, Attribute) or isinstance(c, Operation)), contents) self.__statemembers = filter(lambda c: \ (isinstance(c, StateMember)), contents) self.__factories = filter(lambda c: \ (isinstance(c, Factory)), contents) def accept(self, visitor): visitor.visitValueAbs(self) def inherits(self): return self.__inherits def supports(self): return self.__supports def contents(self): return self.__contents def declarations(self): return self.__declarations def callables(self): return self.__callables def statemembers(self): return self.__statemembers def factories(self): return self.__factories class Value (Decl, DeclRepoId): """valuetype declaration (Decl, DeclRepoId) Functions: custom() -- boolean: true if declared custom. inherits() -- list of valuetypes from which this inherits. The first may be a Value object or a ValueAbs object; any others will be ValueAbs objects. truncatable() -- boolean: true if the inherited Value is declared truncatable. supports() -- list of Interface objects which this supports. contents() -- list of Decl objects for all items declared within this valuetype. declarations() -- subset of contents() containing types, constants and exceptions. callables() -- subset of contents() containing Operations and Attributes. statemembers() -- subset of contents() containing StateMembers. factories() -- subset of contents() containing Factory instances. """ def __init__(self, file, line, mainFile, pragmas, comments, identifier, scopedName, repoId, custom, inherits, truncatable, supports): Decl.__init__(self, file, line, mainFile, pragmas, comments) DeclRepoId.__init__(self, identifier, scopedName, repoId) self.__custom = custom self.__inherits = inherits self.__truncatable = truncatable self.__supports = supports self.__contents = [] self.__declarations = [] self.__callables = [] self.__statemembers = [] self.__factories = [] def _setContents(self, contents): self.__contents = contents self.__declarations = filter(lambda c: not \ (isinstance(c, Attribute) or isinstance(c, Operation) or isinstance(c, StateMember) or isinstance(c, Factory)), contents) self.__callables = filter(lambda c: \ (isinstance(c, Attribute) or isinstance(c, Operation)), contents) self.__statemembers = filter(lambda c: \ (isinstance(c, StateMember)), contents) self.__factories = filter(lambda c: \ (isinstance(c, Factory)), contents) def accept(self, visitor): visitor.visitValue(self) def custom(self): return self.__custom def inherits(self): return self.__inherits def truncatable(self): return self.__truncatable def supports(self): return self.__supports def contents(self): return self.__contents def declarations(self): return self.__declarations def callables(self): return self.__callables def statemembers(self): return self.__statemembers def factories(self): return self.__factories # Map of Decl objects, indexed by stringified scoped name, and # functions to access it declMap = {} def registerDecl(scopedName, decl): """Private function""" sname = idlutil.slashName(scopedName) if declMap.has_key(sname): rdecl = declMap[sname] isi = isinstance if (isi(decl, Interface) and isi(rdecl, Forward)) or \ (isi(decl, ValueAbs) and isi(rdecl, ValueForward)) or \ (isi(decl, Value) and isi(rdecl, ValueForward)) or \ (isi(decl, Struct) and isi(rdecl, StructForward)) or \ (isi(decl, Union) and isi(rdecl, UnionForward)): # resolving a forward declaration rdecl._fullDecl = decl for f in rdecl._more: f._fullDecl = decl declMap[sname] = decl elif (isi(decl, Forward) and isi(rdecl, Forward)) or \ (isi(decl, ValueForward) and isi(rdecl, ValueForward)) or \ (isi(decl, StructForward) and isi(rdecl, StructForward)) or \ (isi(decl, UnionForward) and isi(rdecl, UnionForward)): # repeat forward declaration rdecl._more.append(decl) elif (isi(decl, Forward) and isi(rdecl, Interface)) or \ (isi(decl, ValueForward) and isi(rdecl, ValueAbs)) or \ (isi(decl, ValueForward) and isi(rdecl, Value)) or \ (isi(decl, StructForward) and isi(rdecl, Struct)) or \ (isi(decl, UnionForward) and isi(rdecl, Union)): # forward declaration of full declaration decl._fullDecl = rdecl elif (isi(decl, Module) and isi(rdecl, Module)): # continued module rdecl._continuations.append(decl) else: print "***Warning: attempt to re-register", sname return declMap[sname] = decl class DeclNotFound: """Exception to indicate that findDecl() could not find the requested Decl object.""" def __init__(self, scopedName): self.__scopedName = scopedName def scopedName(self): return self.__scopedName def findDecl(scopedName): """findDecl(scopedName) -> Decl Find a Decl object given a fully scoped name represented as a list of strings. Raises DeclNotFound if the name is not recognised.""" sname = idlutil.slashName(scopedName) if not declMap.has_key(sname): raise DeclNotFound(scopedName) return declMap[sname] # Declarations of non-basic `built-in' types CORBAObject = Interface("", 0, 0, [], [], "Object", ["CORBA", "Object"], "IDL:omg.org/CORBA/Object:1.0", 0, 0, []) CORBAObject._Decl__builtIn = 1 registerDecl(["CORBA", "Object"], CORBAObject) CORBAValueBase = Value("", 0, 0, [], [], "ValueBase", ["CORBA", "ValueBase"], "IDL:omg.org/CORBA/ValueBase:1.0", 0, [], 0, []) CORBAValueBase._Decl__builtIn = 1 registerDecl(["CORBA", "ValueBase"], CORBAValueBase) CORBAModule = Module("", 0, 0, [], [], "CORBA", ["CORBA"], "IDL:omg.org/CORBA:1.0", [CORBAObject, CORBAValueBase]) registerDecl(["CORBA"], CORBAModule) def clear(): """Clear back-end structures ready for another run""" declMap.clear() registerDecl(["CORBA", "Object"], CORBAObject) registerDecl(["CORBA", "ValueBase"], CORBAValueBase) registerDecl(["CORBA"], CORBAModule) synopsis-0.12/Synopsis/Parsers/IDL/idldump.cc0000664000076400007640000005011311104703261020475 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idldump.cc Created on: 1999/10/26 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Visitor object to dump the tree // $Id: idldump.cc,v 1.16.2.3 2005/06/08 09:40:38 dgrisby Exp $ // $Log: idldump.cc,v $ // Revision 1.16.2.3 2005/06/08 09:40:38 dgrisby // Update example code, IDL dumping. // // Revision 1.16.2.2 2003/09/04 14:00:28 dgrisby // ValueType IDL updates. // // Revision 1.16.2.1 2003/03/23 21:01:46 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.11.2.10 2002/02/25 15:02:18 dpg1 // Dump wstring constants properly. // // Revision 1.11.2.9 2002/02/18 11:59:22 dpg1 // Full autoconf support. // // Revision 1.11.2.8 2001/11/14 17:13:43 dpg1 // Long double support. // // Revision 1.11.2.7 2001/08/29 11:54:20 dpg1 // Clean up const handling in IDL compiler. // // Revision 1.11.2.6 2001/06/12 11:35:25 dpg1 // Minor omniidl tweaks for valuetype. // // Revision 1.11.2.5 2001/03/13 10:32:11 dpg1 // Fixed point support. // // Revision 1.11.2.4 2000/11/01 15:57:03 dpg1 // More updates for 2.4. // // Revision 1.11.2.3 2000/11/01 12:45:56 dpg1 // Update to CORBA 2.4 specification. // // Revision 1.11.2.2 2000/10/10 10:18:50 dpg1 // Update omniidl front-end from omni3_develop. // // Revision 1.9.2.2 2000/08/29 10:20:26 dpg1 // Operations and attributes now have repository ids. // // Revision 1.9.2.1 2000/08/14 14:35:13 dpg1 // IDL dumping now properly escapes string and char constants // // Revision 1.9 2000/02/03 14:50:08 dpg1 // Native declarations can now be used as types. // // Revision 1.8 1999/11/17 18:07:23 dpg1 // Tiny change to enum printing. // // Revision 1.7 1999/11/17 18:05:16 dpg1 // Tiny change to enum printing. // // Revision 1.6 1999/11/17 17:50:42 dpg1 // Unions with nested declarations now output properly. // // Revision 1.5 1999/11/02 17:07:27 dpg1 // Changes to compile on Solaris. // // Revision 1.4 1999/11/01 20:19:56 dpg1 // Support for union switch types declared inside the switch statement. // // Revision 1.3 1999/10/29 15:43:15 dpg1 // Code to detect recursive structs and unions. // // Revision 1.2 1999/10/29 10:01:12 dpg1 // Small fixes. // // Revision 1.1 1999/10/27 14:05:58 dpg1 // *** empty log message *** // #include #include #include #include #include #include DumpVisitor:: DumpVisitor() : indent_(0) { } DumpVisitor:: ~DumpVisitor() { } void DumpVisitor:: printIndent() { for (int i=0; itoString(); printf("%s", ssn); delete [] ssn; } void DumpVisitor:: printString(const char* str) { const char* c; for (c=str; *c; c++) { if (*c == '\\') printf("\\\\"); else if (isprint(*c)) putchar(*c); else printf("\\%03o", (int)(unsigned char)*c); } } void DumpVisitor:: printChar(const char c) { if (c == '\\') printf("\\\\"); else if (isprint(c)) putchar(c); else printf("\\%03o", (int)(unsigned char)c); } void DumpVisitor:: visitAST(AST* a) { printf("\n"); for (Decl* d = a->declarations(); d; d = d->next()) { d->accept(*this); printf(";\n\n"); } } void DumpVisitor:: visitModule(Module* m) { printf("module %s { // RepoId = %s, file = %s, line = %d, %s\n", m->identifier(), m->repoId(), m->file(), m->line(), m->mainFile() ? "in main file" : "not in main file"); ++indent_; for (Decl* d = m->definitions(); d; d = d->next()) { printIndent(); d->accept(*this); printf(";\n"); } --indent_; printIndent(); printf("}"); } void DumpVisitor:: visitInterface(Interface* i) { if (i->abstract()) printf("abstract "); if (i->local()) printf("local "); printf("interface %s ", i->identifier()); if (i->inherits()) { printf(": "); char* ssn; for (InheritSpec* is = i->inherits(); is; is = is->next()) { ssn = is->interface()->scopedName()->toString(); printf("%s%s ", ssn, is->next() ? "," : ""); delete [] ssn; } } printf("{ // RepoId = %s\n", i->repoId()); ++indent_; for (Decl* d = i->contents(); d; d = d->next()) { printIndent(); d->accept(*this); printf(";\n"); } --indent_; printIndent(); printf("}"); } void DumpVisitor:: visitForward(Forward* f) { if (f->abstract()) printf("abstract "); if (f->local()) printf("local "); printf("interface %s; // RepoId = %s", f->identifier(), f->repoId()); } static void printdouble(IDL_Double d) { // .17g guarantees an IEEE 754 double can be exactly reconstructed, // but it prints integers without a trailing .0, so we must put it // back on in that case. char buffer[1024]; sprintf(buffer, "%.17g", d); char* c = buffer; if (*c == '-') ++c; for (; *c; c++) { if (!isdigit(*c)) break; } if (*c == '\0') { *c++ = '.'; *c++ = '0'; *c++ = '\0'; } printf("%s", buffer); } #ifdef HAS_LongDouble static void printlongdouble(IDL_LongDouble d) { // Can't find a reference for how many digits it enough for long // double. 40 is probably enough. char buffer[1024]; sprintf(buffer, "%.40Lg", d); char* c = buffer; if (*c == '-') ++c; for (; *c; c++) { if (!isdigit(*c)) break; } if (*c == '\0') { *c++ = '.'; *c++ = '0'; *c++ = '\0'; } printf("%s", buffer); } #endif static void printwchar(IDL_WChar wc) { if (wc == '\\') printf("L'\\\\'"); else if (wc < 0xff && isprint(wc)) printf("L'%c'", (char)wc); else printf("L'\\u%04x", (int)wc); } static void printwstring(const IDL_WChar* ws) { printf("L\""); int i, wc; for (i=0; ws[i]; ++i) { wc = ws[i]; if (wc == '\\') printf("\\\\"); else if (wc < 0xff && isprint(wc)) putchar(wc); else printf("\\u%04x", (int)wc); } putchar('"'); } void DumpVisitor:: visitConst(Const* c) { printf("const "); c->constType()->accept(*this); printf(" %s = ", c->identifier()); switch(c->constKind()) { case IdlType::tk_short: printf("%hd", c->constAsShort()); break; case IdlType::tk_long: printf("%ld", (long)c->constAsLong()); break; case IdlType::tk_ushort: printf("%hu", c->constAsUShort()); break; case IdlType::tk_ulong: printf("%lu", (unsigned long)c->constAsULong()); break; case IdlType::tk_float: printdouble(c->constAsFloat()); break; case IdlType::tk_double: printdouble(c->constAsDouble()); break; case IdlType::tk_boolean: printf("%s", c->constAsBoolean() ? "TRUE" : "FALSE"); break; case IdlType::tk_char: printf("'"); printChar(c->constAsChar()); printf("'"); break; case IdlType::tk_octet: printf("%d", (int)c->constAsOctet()); break; case IdlType::tk_string: printf("\""); printString(c->constAsString()); printf("\""); break; #ifdef HAS_LongLong case IdlType::tk_longlong: printf("%Ld", c->constAsLongLong()); break; case IdlType::tk_ulonglong: printf("%Lu", c->constAsULongLong()); break; #endif #ifdef HAS_LongDouble case IdlType::tk_longdouble:printlongdouble(c->constAsLongDouble()); break; #endif case IdlType::tk_wchar: printwchar(c->constAsWChar()); break; case IdlType::tk_wstring: printwstring(c->constAsWString()); break; case IdlType::tk_fixed: { char* fs = c->constAsFixed()->asString(); printf("%sd", fs); delete [] fs; } break; case IdlType::tk_enum: c->constAsEnumerator()->accept(*this); break; default: assert(0); } } void DumpVisitor:: visitDeclarator(Declarator* d) { printf("%s", d->identifier()); for (ArraySize* s = d->sizes(); s; s = s->next()) printf("[%d]", s->size()); } void DumpVisitor:: visitTypedef(Typedef* t) { printf("typedef "); if (t->constrType()) { assert(t->aliasType()->kind() == IdlType::tk_struct || t->aliasType()->kind() == IdlType::tk_union || t->aliasType()->kind() == IdlType::tk_enum); ((DeclaredType*)t->aliasType())->decl()->accept(*this); } else t->aliasType()->accept(*this); printf(" "); for (Declarator* d = t->declarators(); d; d = (Declarator*)d->next()) { d->accept(*this); if (d->next()) printf(", "); } } void DumpVisitor:: visitMember(Member* m) { if (m->constrType()) { assert(m->memberType()->kind() == IdlType::tk_struct || m->memberType()->kind() == IdlType::tk_union || m->memberType()->kind() == IdlType::tk_enum); ((DeclaredType*)m->memberType())->decl()->accept(*this); } else m->memberType()->accept(*this); printf(" "); for (Declarator* d = m->declarators(); d; d = (Declarator*)d->next()) { d->accept(*this); if (d->next()) printf(", "); } } void DumpVisitor:: visitStruct(Struct* s) { printf("struct %s { // RepoId = %s%s\n", s->identifier(), s->repoId(), s->recursive() ? " recursive" : ""); ++indent_; for (Member* m = s->members(); m; m = (Member*)m->next()) { printIndent(); m->accept(*this); printf(";\n"); } --indent_; printIndent(); printf("}"); } void DumpVisitor:: visitStructForward(StructForward* s) { printf("struct %s", s->identifier()); } void DumpVisitor:: visitException(Exception* e) { printf("exception %s {\n", e->identifier()); ++indent_; for (Member* m = e->members(); m; m = (Member*)m->next()) { printIndent(); m->accept(*this); printf(";\n"); } --indent_; printIndent(); printf("}"); } void DumpVisitor:: visitCaseLabel(CaseLabel* l) { if (l->isDefault()) printf("default /* "); else printf("case "); switch(l->labelKind()) { case IdlType::tk_short: printf("%hd", l->labelAsShort()); break; case IdlType::tk_long: printf("%ld", (long)l->labelAsLong()); break; case IdlType::tk_ushort: printf("%hu", l->labelAsUShort()); break; case IdlType::tk_ulong: printf("%lu", (unsigned long)l->labelAsULong()); break; case IdlType::tk_boolean: printf("%s", l->labelAsBoolean() ? "TRUE" : "FALSE"); break; case IdlType::tk_char: printf("'"); printChar(l->labelAsChar()); printf("'"); break; #ifdef HAS_LongLong case IdlType::tk_longlong: printf("%Ld", l->labelAsLongLong()); break; case IdlType::tk_ulonglong: printf("%Lu", l->labelAsULongLong()); break; #endif case IdlType::tk_wchar: printf("'\\u%hx", l->labelAsWChar()); break; case IdlType::tk_enum: l->labelAsEnumerator()->accept(*this); break; default: assert(0); } if (l->isDefault()) printf(" */:"); else printf(":"); } void DumpVisitor:: visitUnionCase(UnionCase* c) { for (CaseLabel* l = c->labels(); l; l = (CaseLabel*)l->next()) { l->accept(*this); if (l->next()) printf(" "); } printf("\n"); ++indent_; printIndent(); if (c->constrType()) { assert(c->caseType()->kind() == IdlType::tk_struct || c->caseType()->kind() == IdlType::tk_union || c->caseType()->kind() == IdlType::tk_enum); ((DeclaredType*)c->caseType())->decl()->accept(*this); } else c->caseType()->accept(*this); printf(" %s", c->declarator()->identifier()); --indent_; } void DumpVisitor:: visitUnion(Union* u) { printf("union %s switch (", u->identifier()); if (u->constrType()) ((DeclaredType*)u->switchType())->decl()->accept(*this); else u->switchType()->accept(*this); printf(") { // RepoId = %s%s\n", u->repoId(), u->recursive() ? " recursive" : ""); ++indent_; for (UnionCase* c = u->cases(); c; c = (UnionCase*)c->next()) { printIndent(); c->accept(*this); printf(";\n"); } --indent_; printIndent(); printf("}"); } void DumpVisitor:: visitUnionForward(UnionForward* u) { printf("union %s", u->identifier()); } void DumpVisitor:: visitEnumerator(Enumerator* e) { char* ssn = e->scopedName()->toString(); printf("%s", ssn); delete [] ssn; } void DumpVisitor:: visitEnum(Enum* e) { printf("enum %s { // RepoId = %s\n", e->identifier(), e->repoId()); ++indent_; for (Enumerator* n = e->enumerators(); n; n = (Enumerator*)n->next()) { printIndent(); printf("%s%s\n", n->identifier(), n->next() ? "," : ""); } --indent_; printIndent(); printf("}"); } void DumpVisitor:: visitAttribute(Attribute* a) { if (a->readonly()) printf("readonly "); printf("attribute "); a->attrType()->accept(*this); printf(" "); for (Declarator* d = a->declarators(); d; d = (Declarator*)d->next()) { d->accept(*this); if (d->next()) printf(", "); } } void DumpVisitor:: visitParameter(Parameter* p) { switch (p->direction()) { case 0: printf("in "); break; case 1: printf("out "); break; case 2: printf("inout "); break; } p->paramType()->accept(*this); printf(" %s", p->identifier()); } void DumpVisitor:: visitOperation(Operation* o) { if (o->oneway()) printf("oneway "); o->returnType()->accept(*this); printf(" %s(", o->identifier()); for (Parameter* p = o->parameters(); p; p = (Parameter*)p->next()) { p->accept(*this); if (p->next()) printf(", "); } printf(")"); if (o->raises()) { printf(" raises ("); char* ssn; for (RaisesSpec* r = o->raises(); r; r = r->next()) { ssn = r->exception()->scopedName()->toString(); printf("%s", ssn); delete [] ssn; if (r->next()) printf(", "); } printf(")"); } if (o->contexts()) { printf(" context ("); for (ContextSpec* c = o->contexts(); c; c = c->next()) { printf("\"%s\"", c->context()); if (c->next()) printf(", "); } printf(")"); } } void DumpVisitor:: visitNative(Native* n) { printf("native %s", n->identifier()); } void DumpVisitor:: visitStateMember(StateMember* s) { switch(s->memberAccess()) { case 0: printf("public "); break; case 1: printf("private "); break; } if (s->constrType()) { assert(s->memberType()->kind() == IdlType::tk_struct || s->memberType()->kind() == IdlType::tk_union || s->memberType()->kind() == IdlType::tk_enum); ((DeclaredType*)s->memberType())->decl()->accept(*this); } else s->memberType()->accept(*this); printf(" "); for (Declarator* d = s->declarators(); d; d = (Declarator*)d->next()) { d->accept(*this); if (d->next()) printf(", "); } } void DumpVisitor:: visitFactory(Factory* f) { printf("factory %s(", f->identifier()); for (Parameter* p = f->parameters(); p; p = (Parameter*)p->next()) { p->accept(*this); if (p->next()) printf(", "); } printf(")"); if (f->raises()) { printf(" raises ("); char* ssn; for (RaisesSpec* r = f->raises(); r; r = r->next()) { ssn = r->exception()->scopedName()->toString(); printf("%s", ssn); delete [] ssn; if (r->next()) printf(", "); } printf(")"); } } void DumpVisitor:: visitValueForward(ValueForward* f) { if (f->abstract()) printf("abstract "); printf("valuetype %s", f->identifier()); } void DumpVisitor:: visitValueBox(ValueBox* b) { printf("valuetype %s ", b->identifier()); if (b->constrType()) { assert(b->boxedType()->kind() == IdlType::tk_struct || b->boxedType()->kind() == IdlType::tk_union || b->boxedType()->kind() == IdlType::tk_enum); ((DeclaredType*)b->boxedType())->decl()->accept(*this); } else b->boxedType()->accept(*this); } void DumpVisitor:: visitValueAbs(ValueAbs* v) { printf("abstract valuetype %s ", v->identifier()); if (v->inherits()) { printf(": "); char* ssn; for (ValueInheritSpec* vis = v->inherits(); vis; vis = vis->next()) { ssn = vis->value()->scopedName()->toString(); printf("%s%s%s ", vis->truncatable() ? "truncatable " : "", ssn, vis->next() ? "," : ""); delete [] ssn; } } if (v->supports()) { printf("supports "); char* ssn; for (InheritSpec* is = v->supports(); is; is = is->next()) { ssn = is->interface()->scopedName()->toString(); printf("%s%s ", ssn, is->next() ? "," : ""); delete [] ssn; } } printf("{\n"); ++indent_; for (Decl* d = v->contents(); d; d = d->next()) { printIndent(); d->accept(*this); printf(";\n"); } --indent_; printIndent(); printf("}"); } void DumpVisitor:: visitValue(Value* v) { if (v->custom()) printf("custom "); printf("valuetype %s ", v->identifier()); if (v->inherits()) { printf(": "); char* ssn; for (ValueInheritSpec* vis = v->inherits(); vis; vis = vis->next()) { ssn = vis->value()->scopedName()->toString(); printf("%s%s%s ", vis->truncatable() ? "truncatable " : "", ssn, vis->next() ? "," : ""); delete [] ssn; } } if (v->supports()) { printf("supports "); char* ssn; for (InheritSpec* is = v->supports(); is; is = is->next()) { ssn = is->interface()->scopedName()->toString(); printf("%s%s ", ssn, is->next() ? "," : ""); delete [] ssn; } } printf("{\n"); ++indent_; for (Decl* d = v->contents(); d; d = d->next()) { printIndent(); d->accept(*this); printf(";\n"); } --indent_; printIndent(); printf("}"); } // Types void DumpVisitor:: visitBaseType(BaseType* t) { printf("%s", t->kindAsString()); } void DumpVisitor:: visitStringType(StringType* t) { if (t->bound()) printf("string<%ld>", (long)t->bound()); else printf("string"); } void DumpVisitor:: visitWStringType(WStringType* t) { if (t->bound()) printf("wstring<%ld>", (long)t->bound()); else printf("wstring"); } void DumpVisitor:: visitSequenceType(SequenceType* t) { printf("sequence<"); t->seqType()->accept(*this); if (t->bound()) printf(", %ld>", (long)t->bound()); else printf(">"); } void DumpVisitor:: visitFixedType(FixedType* t) { if (t->digits() > 0) printf("fixed<%hu,%hd>", t->digits(), t->scale()); else printf("fixed"); } #define DTCASE(tk, dt, dk) \ case IdlType::tk: \ { \ dt* d = (dt*)t->decl(); \ assert(d->kind() == Decl::dk); \ printScopedName(d->scopedName()); \ break; \ } void DumpVisitor:: visitDeclaredType(DeclaredType* t) { switch(t->kind()) { case IdlType::tk_objref: case IdlType::tk_abstract_interface: case IdlType::tk_local_interface: { if (t->decl()) { if (t->decl()->kind() == Decl::D_INTERFACE) { Interface* i = (Interface*)t->decl(); printScopedName(i->scopedName()); } else { assert(t->decl()->kind() == Decl::D_FORWARD); Forward* f = (Forward*)t->decl(); printScopedName(f->scopedName()); } } else printf("Object"); break; } case IdlType::tk_value: { if (t->decl()) { if (t->decl()->kind() == Decl::D_VALUE) { Value* v = (Value*)t->decl(); printScopedName(v->scopedName()); } else { assert(t->decl()->kind() == Decl::D_VALUEFORWARD); ValueForward* f = (ValueForward*)t->decl(); printScopedName(f->scopedName()); } } else printf("Object"); break; } DTCASE(tk_struct, Struct, D_STRUCT) DTCASE(ot_structforward, StructForward, D_STRUCTFORWARD) DTCASE(tk_union, Union, D_UNION) DTCASE(ot_unionforward, UnionForward, D_UNIONFORWARD) DTCASE(tk_enum, Enum, D_ENUM) DTCASE(tk_alias, Declarator, D_DECLARATOR) DTCASE(tk_native, Native, D_NATIVE) DTCASE(tk_value_box, ValueBox, D_VALUEBOX) default: printf("%s", t->kindAsString()); } } synopsis-0.12/Synopsis/Parsers/IDL/idlmath.h0000664000076400007640000000561311104703261020330 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlmath.cc Created on: 1999/10/19 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Floating point maths functions // $Id: idlmath.h,v 1.7.2.1 2003/03/23 21:01:45 dgrisby Exp $ // $Log: idlmath.h,v $ // Revision 1.7.2.1 2003/03/23 21:01:45 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.4.2.3 2002/01/15 16:38:14 dpg1 // On the road to autoconf. Dependencies refactored, configure.ac // written. No makefiles yet. // // Revision 1.4.2.2 2000/10/27 16:31:09 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.4.2.1 2000/07/17 10:36:04 sll // Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0. // // Revision 1.5 2000/07/13 15:25:53 dpg1 // Merge from omni3_develop for 3.0 release. // // Revision 1.2 1999/11/02 17:07:26 dpg1 // Changes to compile on Solaris. // // Revision 1.1 1999/10/27 14:05:56 dpg1 // *** empty log message *** // #ifndef _idlmath_h_ #define _idlmath_h_ #include #include #ifdef HAVE_NAN_H # include #endif #if defined(HAVE_ISINF) && defined(HAVE_ISINFF) && (defined(HAVE_ISINFL) || !defined(HAS_LongDouble)) inline IDL_Boolean IdlFPOverflow(IDL_Double f) { return isinf(f) || isnan(f); } inline IDL_Boolean IdlFPOverflow(IDL_Float f) { return isinff(f) || isnanf(f); } # ifdef HAS_LongDouble inline IDL_Boolean IdlFPOverflow(IDL_LongDouble f) { return isinfl(f) || isnanl(f); } # endif #elif defined(HAVE_ISNANORINF) inline IDL_Boolean IdlFPOverflow(IDL_Float f) { double d = f; return IsNANorINF(d); } inline IDL_Boolean IdlFPOverflow(IDL_Double f) { return IsNANorINF(f); } #ifdef HAS_LongDouble inline IDL_Boolean IdlFPOverflow(IDL_LongDouble f) { return 0; } #endif #else // No FP overflow detection inline IDL_Boolean IdlFPOverflow(IDL_Float f) { return 0; } inline IDL_Boolean IdlFPOverflow(IDL_Double f) { return 0; } #ifdef HAS_LongDouble inline IDL_Boolean IdlFPOverflow(IDL_LongDouble f) { return 0; } #endif #endif #endif // _idlmath_h_ synopsis-0.12/Synopsis/Parsers/IDL/idldump.h0000664000076400007640000000643511104703261020347 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idldump.h Created on: 1999/10/26 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Visitor object to dump the tree // $Id: idldump.h,v 1.7.2.1 2003/03/23 21:01:46 dgrisby Exp $ // $Log: idldump.h,v $ // Revision 1.7.2.1 2003/03/23 21:01:46 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.3.2.3 2000/11/01 12:45:56 dpg1 // Update to CORBA 2.4 specification. // // Revision 1.3.2.2 2000/10/10 10:18:50 dpg1 // Update omniidl front-end from omni3_develop. // // Revision 1.1.2.1 2000/08/14 14:35:14 dpg1 // IDL dumping now properly escapes string and char constants // // Revision 1.1 1999/10/27 14:05:58 dpg1 // *** empty log message *** // #ifndef _idldump_h_ #define _idldump_h_ #include #include class DumpVisitor : public AstVisitor, public TypeVisitor { public: DumpVisitor(); virtual ~DumpVisitor(); void visitAST (AST*); void visitModule (Module*); void visitInterface (Interface*); void visitForward (Forward*); void visitConst (Const*); void visitDeclarator (Declarator*); void visitTypedef (Typedef*); void visitMember (Member*); void visitStruct (Struct*); void visitStructForward (StructForward*); void visitException (Exception*); void visitCaseLabel (CaseLabel*); void visitUnionCase (UnionCase*); void visitUnion (Union*); void visitUnionForward (UnionForward*); void visitEnumerator (Enumerator*); void visitEnum (Enum*); void visitAttribute (Attribute*); void visitParameter (Parameter*); void visitOperation (Operation*); void visitNative (Native*); void visitStateMember (StateMember*); void visitFactory (Factory*); void visitValueForward (ValueForward*); void visitValueBox (ValueBox*); void visitValueAbs (ValueAbs*); void visitValue (Value*); void visitBaseType (BaseType*); void visitStringType (StringType*); void visitWStringType (WStringType*); void visitSequenceType(SequenceType*); void visitFixedType (FixedType*); void visitDeclaredType(DeclaredType*); private: int indent_; void printIndent(); void printScopedName(const ScopedName* sn); void printString(const char* str); void printChar(const char c); }; #endif // _idldump_h_ synopsis-0.12/Synopsis/Parsers/IDL/__init__.py0000664000076400007640000000424511104703261020646 0ustar stefanstefan# # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # """Parser for IDL using omniidl for low-level parsing.""" from Synopsis.Processor import * import omni import os, os.path, tempfile class Parser(Processor): preprocess = Parameter(True, 'whether or not to preprocess the input') cppflags = Parameter([], 'list of preprocessor flags such as -I or -D') primary_file_only = Parameter(True, 'should only primary file be processed') base_path = Parameter('', 'path prefix to strip off of the file names') def process(self, ir, **kwds): self.set_parameters(kwds) if not self.input: raise MissingArgument('input') self.ir = ir if self.preprocess: from Synopsis.Parsers import Cpp cpp = Cpp.Parser(base_path = self.base_path, language = 'IDL', flags = self.cppflags, emulate_compiler = None) for file in self.input: i_file = file if self.preprocess: if self.output: i_file = os.path.splitext(self.output)[0] + '.i' else: i_file = os.path.join(tempfile.gettempdir(), 'synopsis-%s.i'%os.getpid()) self.ir = cpp.process(self.ir, cpp_output = i_file, input = [file], primary_file_only = self.primary_file_only, verbose = self.verbose, debug = self.debug) self.ir = omni.parse(self.ir, i_file, os.path.abspath(file), self.primary_file_only, os.path.abspath(self.base_path) + os.sep, self.verbose, self.debug) if self.preprocess: os.remove(i_file) return self.output_and_return_ir() synopsis-0.12/Synopsis/Parsers/IDL/configure0000775000076400007640000107606711171624007020464 0ustar stefanstefan#! /bin/sh # From configure.ac Revision: 1.4 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for Synopsis 1.0. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='Synopsis' PACKAGE_TARNAME='synopsis' PACKAGE_VERSION='1.0' PACKAGE_STRING='Synopsis 1.0' PACKAGE_BUGREPORT='synopsis-devel@fresco.org' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP CXX CXXFLAGS ac_ct_CXX LEX LEX_OUTPUT_ROOT LEXLIB YACC YFLAGS GREP EGREP PYTHON PYTHON_INCLUDE LIBEXT LDSHARED LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP CXX CXXFLAGS CCC YACC YFLAGS' # 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. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_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 ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_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'` 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 ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_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'` 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; }; } 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 directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $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 test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures Synopsis 1.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/synopsis] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of Synopsis 1.0:";; esac cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-syn-cxx=PATH specify the Synopsis C++ library prefix --with-python=PATH specify the Python interpreter Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags YACC The `Yet Another C Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. YFLAGS The list of arguments that will be passed by default to $YACC. This script will default YFLAGS to the empty string to avoid a default value of `-d' given by some make applications. Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF Synopsis configure 1.0 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by Synopsis $as_me 1.0, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file 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 $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { 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_config_headers="$ac_config_headers acconfig.h" # Check whether --with-syn-cxx was given. if test "${with_syn_cxx+set}" = set; then withval=$with_syn_cxx; SYN_CXX="$with_syn_cxx" else SYN_CXX="/usr/local" 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { 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` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then 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 # Check that 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' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 that 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 { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { 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 ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { 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` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { 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 ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { 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 g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { 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 if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { 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 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 for ac_prog in flex lex do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_LEX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LEX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LEX=$ac_cv_prog_LEX if test -n "$LEX"; then { echo "$as_me:$LINENO: result: $LEX" >&5 echo "${ECHO_T}$LEX" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$LEX" && break done test -n "$LEX" || LEX=":" if test "x$LEX" != "x:"; then cat >conftest.l <<_ACEOF %% a { ECHO; } b { REJECT; } c { yymore (); } d { yyless (1); } e { yyless (input () != 0); } f { unput (yytext[0]); } . { BEGIN INITIAL; } %% #ifdef YYTEXT_POINTER extern char *yytext; #endif int main (void) { return ! yylex () + ! yywrap (); } _ACEOF { (ac_try="$LEX conftest.l" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$LEX conftest.l") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { echo "$as_me:$LINENO: checking lex output file root" >&5 echo $ECHO_N "checking lex output file root... $ECHO_C" >&6; } if test "${ac_cv_prog_lex_root+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -f lex.yy.c; then ac_cv_prog_lex_root=lex.yy elif test -f lexyy.c; then ac_cv_prog_lex_root=lexyy else { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5 echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5 echo "${ECHO_T}$ac_cv_prog_lex_root" >&6; } LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root if test -z "${LEXLIB+set}"; then { echo "$as_me:$LINENO: checking lex library" >&5 echo $ECHO_N "checking lex library... $ECHO_C" >&6; } if test "${ac_cv_lib_lex+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_LIBS=$LIBS ac_cv_lib_lex='none needed' for ac_lib in '' -lfl -ll; do LIBS="$ac_lib $ac_save_LIBS" cat >conftest.$ac_ext <<_ACEOF `cat $LEX_OUTPUT_ROOT.c` _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_lex=$ac_lib else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext test "$ac_cv_lib_lex" != 'none needed' && break done LIBS=$ac_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_lex" >&5 echo "${ECHO_T}$ac_cv_lib_lex" >&6; } test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex fi { echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5 echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6; } if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. ac_cv_prog_lex_yytext_pointer=no ac_save_LIBS=$LIBS LIBS="$LEXLIB $ac_save_LIBS" cat >conftest.$ac_ext <<_ACEOF #define YYTEXT_POINTER 1 `cat $LEX_OUTPUT_ROOT.c` _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_prog_lex_yytext_pointer=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5 echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6; } if test $ac_cv_prog_lex_yytext_pointer = yes; then cat >>confdefs.h <<\_ACEOF #define YYTEXT_POINTER 1 _ACEOF fi rm -f conftest.l $LEX_OUTPUT_ROOT.c fi if test $LEX != flex then { { echo "$as_me:$LINENO: error: This package needs flex to build." >&5 echo "$as_me: error: This package needs flex to build." >&2;} { (exit 1); exit 1; }; } fi for ac_prog in 'bison -y' byacc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_YACC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_YACC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then { echo "$as_me:$LINENO: result: $YACC" >&5 echo "${ECHO_T}$YACC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" # Unfortunately, AC_PROG_YACC sets $YACC to 'yacc' if it couldn't # find anything (yacc itself doesn't appear to be checked for.) # Thus we take this as an indication that the test failed. if test "$YACC" = yacc then { { echo "$as_me:$LINENO: error: This package needs bison to build." >&5 echo "$as_me: error: This package needs bison to build." >&2;} { (exit 1); exit 1; }; } fi { echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Extract the first word of "grep ggrep" to use in msg output if test -z "$GREP"; then set dummy grep ggrep; ac_prog_name=$2 if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS fi GREP="$ac_cv_path_GREP" if test -z "$GREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 echo "${ECHO_T}$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } if test "${ac_cv_path_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_path_EGREP="$GREP -E" else # Extract the first word of "egrep" to use in msg output if test -z "$EGREP"; then set dummy egrep; ac_prog_name=$2 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS fi EGREP="$ac_cv_path_EGREP" if test -z "$EGREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* 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 { as_var=$as_ac_Header; eval "test \"\${$as_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. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&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 { 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 ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_bigendian=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_bigendian=no fi rm -f core 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 int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then 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 core conftest.err conftest.$ac_objext conftest.$ac_ext else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f core 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 { echo "$as_me:$LINENO: checking for char" >&5 echo $ECHO_N "checking for char... $ECHO_C" >&6; } if test "${ac_cv_type_char+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 typedef char ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_char=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_char=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_char" >&5 echo "${ECHO_T}$ac_cv_type_char" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of char" >&5 echo $ECHO_N "checking size of char... $ECHO_C" >&6; } if test "${ac_cv_sizeof_char+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef char ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef char ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef char ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef char ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef char ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_char=$ac_lo;; '') if test "$ac_cv_type_char" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (char) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (char) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_char=0 fi ;; esac 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 typedef char ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_char=`cat conftest.val` 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 ) if test "$ac_cv_type_char" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (char) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (char) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_char=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_char" >&5 echo "${ECHO_T}$ac_cv_sizeof_char" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_CHAR $ac_cv_sizeof_char _ACEOF { echo "$as_me:$LINENO: checking for unsigned char" >&5 echo $ECHO_N "checking for unsigned char... $ECHO_C" >&6; } if test "${ac_cv_type_unsigned_char+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 typedef unsigned char ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_unsigned_char=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_unsigned_char=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_char" >&5 echo "${ECHO_T}$ac_cv_type_unsigned_char" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of unsigned char" >&5 echo $ECHO_N "checking size of unsigned char... $ECHO_C" >&6; } if test "${ac_cv_sizeof_unsigned_char+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef unsigned char ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef unsigned char ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef unsigned char ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef unsigned char ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef unsigned char ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_unsigned_char=$ac_lo;; '') if test "$ac_cv_type_unsigned_char" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned char) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (unsigned char) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_unsigned_char=0 fi ;; esac 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 typedef unsigned char ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_unsigned_char=`cat conftest.val` 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 ) if test "$ac_cv_type_unsigned_char" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned char) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (unsigned char) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_unsigned_char=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_char" >&5 echo "${ECHO_T}$ac_cv_sizeof_unsigned_char" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_UNSIGNED_CHAR $ac_cv_sizeof_unsigned_char _ACEOF { 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 typedef bool ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_bool=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_bool=no fi rm -f core 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; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of bool" >&5 echo $ECHO_N "checking size of bool... $ECHO_C" >&6; } if test "${ac_cv_sizeof_bool+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef bool ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef bool ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef bool ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef bool ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef bool ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_bool=$ac_lo;; '') if test "$ac_cv_type_bool" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (bool) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (bool) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_bool=0 fi ;; esac 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 typedef bool ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_bool=`cat conftest.val` 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 ) if test "$ac_cv_type_bool" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (bool) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (bool) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_bool=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_bool" >&5 echo "${ECHO_T}$ac_cv_sizeof_bool" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_BOOL $ac_cv_sizeof_bool _ACEOF { echo "$as_me:$LINENO: checking for short" >&5 echo $ECHO_N "checking for short... $ECHO_C" >&6; } if test "${ac_cv_type_short+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 typedef short ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_short=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_short=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5 echo "${ECHO_T}$ac_cv_type_short" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of short" >&5 echo $ECHO_N "checking size of short... $ECHO_C" >&6; } if test "${ac_cv_sizeof_short+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef short ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef short ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef short ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef short ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef short ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_short=$ac_lo;; '') if test "$ac_cv_type_short" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (short) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (short) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_short=0 fi ;; esac 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 typedef short ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_short=`cat conftest.val` 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 ) if test "$ac_cv_type_short" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (short) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (short) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_short=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5 echo "${ECHO_T}$ac_cv_sizeof_short" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_SHORT $ac_cv_sizeof_short _ACEOF { echo "$as_me:$LINENO: checking for int" >&5 echo $ECHO_N "checking for int... $ECHO_C" >&6; } if test "${ac_cv_type_int+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 typedef int ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_int=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_int=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 echo "${ECHO_T}$ac_cv_type_int" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of int" >&5 echo $ECHO_N "checking size of int... $ECHO_C" >&6; } if test "${ac_cv_sizeof_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_int=$ac_lo;; '') if test "$ac_cv_type_int" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (int) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (int) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_int=0 fi ;; esac 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 typedef int ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_int=`cat conftest.val` 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 ) if test "$ac_cv_type_int" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (int) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (int) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_int=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 echo "${ECHO_T}$ac_cv_sizeof_int" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int _ACEOF { echo "$as_me:$LINENO: checking for long" >&5 echo $ECHO_N "checking for long... $ECHO_C" >&6; } if test "${ac_cv_type_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_long=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 echo "${ECHO_T}$ac_cv_type_long" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of long" >&5 echo $ECHO_N "checking size of long... $ECHO_C" >&6; } if test "${ac_cv_sizeof_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long=$ac_lo;; '') if test "$ac_cv_type_long" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (long) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_long=0 fi ;; esac 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 typedef long ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long=`cat conftest.val` 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 ) if test "$ac_cv_type_long" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (long) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_long=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 echo "${ECHO_T}$ac_cv_sizeof_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF { echo "$as_me:$LINENO: checking for long long" >&5 echo $ECHO_N "checking for long long... $ECHO_C" >&6; } if test "${ac_cv_type_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long long ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_long_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_long_long=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 echo "${ECHO_T}$ac_cv_type_long_long" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of long long" >&5 echo $ECHO_N "checking size of long long... $ECHO_C" >&6; } if test "${ac_cv_sizeof_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long_long=$ac_lo;; '') if test "$ac_cv_type_long_long" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_long_long=0 fi ;; esac 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 typedef long long ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long_long=`cat conftest.val` 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 ) if test "$ac_cv_type_long_long" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_long_long=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5 echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long _ACEOF { echo "$as_me:$LINENO: checking for float" >&5 echo $ECHO_N "checking for float... $ECHO_C" >&6; } if test "${ac_cv_type_float+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 typedef float ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_float=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_float=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_float" >&5 echo "${ECHO_T}$ac_cv_type_float" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of float" >&5 echo $ECHO_N "checking size of float... $ECHO_C" >&6; } if test "${ac_cv_sizeof_float+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef float ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef float ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef float ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef float ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef float ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_float=$ac_lo;; '') if test "$ac_cv_type_float" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (float) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (float) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_float=0 fi ;; esac 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 typedef float ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_float=`cat conftest.val` 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 ) if test "$ac_cv_type_float" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (float) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (float) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_float=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_float" >&5 echo "${ECHO_T}$ac_cv_sizeof_float" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_FLOAT $ac_cv_sizeof_float _ACEOF { echo "$as_me:$LINENO: checking for double" >&5 echo $ECHO_N "checking for double... $ECHO_C" >&6; } if test "${ac_cv_type_double+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 typedef double ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_double=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_double=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_double" >&5 echo "${ECHO_T}$ac_cv_type_double" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of double" >&5 echo $ECHO_N "checking size of double... $ECHO_C" >&6; } if test "${ac_cv_sizeof_double+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef double ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef double ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef double ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef double ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef double ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_double=$ac_lo;; '') if test "$ac_cv_type_double" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (double) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (double) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_double=0 fi ;; esac 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 typedef double ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_double=`cat conftest.val` 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 ) if test "$ac_cv_type_double" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (double) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (double) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_double=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_double" >&5 echo "${ECHO_T}$ac_cv_sizeof_double" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_DOUBLE $ac_cv_sizeof_double _ACEOF { echo "$as_me:$LINENO: checking for long double" >&5 echo $ECHO_N "checking for long double... $ECHO_C" >&6; } if test "${ac_cv_type_long_double+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 typedef long double ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_long_double=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_long_double=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_long_double" >&5 echo "${ECHO_T}$ac_cv_type_long_double" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of long double" >&5 echo $ECHO_N "checking size of long double... $ECHO_C" >&6; } if test "${ac_cv_sizeof_long_double+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long double ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long double ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long double ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long double ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long double ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long_double=$ac_lo;; '') if test "$ac_cv_type_long_double" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (long double) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long double) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_long_double=0 fi ;; esac 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 typedef long double ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long_double=`cat conftest.val` 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 ) if test "$ac_cv_type_long_double" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (long double) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long double) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_long_double=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_double" >&5 echo "${ECHO_T}$ac_cv_sizeof_long_double" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_DOUBLE $ac_cv_sizeof_long_double _ACEOF { echo "$as_me:$LINENO: checking for wchar_t" >&5 echo $ECHO_N "checking for wchar_t... $ECHO_C" >&6; } if test "${ac_cv_type_wchar_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 typedef wchar_t ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_wchar_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_wchar_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_wchar_t" >&5 echo "${ECHO_T}$ac_cv_type_wchar_t" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of wchar_t" >&5 echo $ECHO_N "checking size of wchar_t... $ECHO_C" >&6; } if test "${ac_cv_sizeof_wchar_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef wchar_t ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef wchar_t ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef wchar_t ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef wchar_t ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef wchar_t ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_wchar_t=$ac_lo;; '') if test "$ac_cv_type_wchar_t" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (wchar_t) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (wchar_t) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_wchar_t=0 fi ;; esac 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 typedef wchar_t ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_wchar_t=`cat conftest.val` 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 ) if test "$ac_cv_type_wchar_t" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (wchar_t) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (wchar_t) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_wchar_t=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_wchar_t" >&5 echo "${ECHO_T}$ac_cv_sizeof_wchar_t" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_WCHAR_T $ac_cv_sizeof_wchar_t _ACEOF { echo "$as_me:$LINENO: checking for void*" >&5 echo $ECHO_N "checking for void*... $ECHO_C" >&6; } if test "${ac_cv_type_voidp+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 typedef void* ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_voidp=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_voidp=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_voidp" >&5 echo "${ECHO_T}$ac_cv_type_voidp" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of void*" >&5 echo $ECHO_N "checking size of void*... $ECHO_C" >&6; } if test "${ac_cv_sizeof_voidp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef void* ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef void* ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef void* ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef void* ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef void* ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_voidp=$ac_lo;; '') if test "$ac_cv_type_voidp" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (void*) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (void*) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_voidp=0 fi ;; esac 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 typedef void* ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_voidp=`cat conftest.val` 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 ) if test "$ac_cv_type_voidp" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (void*) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (void*) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_voidp=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_voidp" >&5 echo "${ECHO_T}$ac_cv_sizeof_voidp" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_VOIDP $ac_cv_sizeof_voidp _ACEOF for ac_func in strcasecmp 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 { as_var=$as_ac_var; eval "test \"\${$as_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 GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { echo "$as_me:$LINENO: checking for python extension module build information" >&5 echo $ECHO_N "checking for python extension module build information... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: " >&5 echo "${ECHO_T}" >&6; } # Check whether --with-python was given. if test "${with_python+set}" = set; then withval=$with_python; PYTHON="$with_python" else PYTHON="python" fi if test -n "$PYTHON" -a "$PYTHON" != yes; then # Extract the first word of "$PYTHON", so it can be a program name with args. set dummy $PYTHON; 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_PYTHON+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$PYTHON"; then ac_cv_prog_PYTHON="$PYTHON" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PYTHON="{ { echo "$as_me:$LINENO: error: Cannot find Python interpreter" >&5 echo "$as_me: error: Cannot find Python interpreter" >&2;} { (exit 1); exit 1; }; }" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PYTHON=$ac_cv_prog_PYTHON if test -n "$PYTHON"; then { echo "$as_me:$LINENO: result: $PYTHON" >&5 echo "${ECHO_T}$PYTHON" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi else # Extract the first word of "python2 python", so it can be a program name with args. set dummy python2 python; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_PYTHON+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $PYTHON in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_PYTHON" && ac_cv_path_PYTHON="python" ;; esac fi PYTHON=$ac_cv_path_PYTHON if test -n "$PYTHON"; then { echo "$as_me:$LINENO: result: $PYTHON" >&5 echo "${ECHO_T}$PYTHON" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi PYTHON_PREFIX=`$PYTHON -c "import sys; print(sys.prefix)" | tr -d "\r"` { echo "$as_me:$LINENO: checking for Python development environment" >&5 echo $ECHO_N "checking for Python development environment... $ECHO_C" >&6; } PYTHON_INCLUDE=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_inc())" | tr -d "\r"` PYTHON_H=`$PYTHON -c "from os.path import *; h = join('$PYTHON_INCLUDE', 'Python.h'); print(exists(h) and h or '')"` if test $PYTHON_H then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else { { echo "$as_me:$LINENO: error: Python.h not found." >&5 echo "$as_me: error: Python.h not found." >&2;} { (exit 1); exit 1; }; } fi LIBEXT=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_var('SO'))" | tr -d "\r"` case `uname -s` in CYGWIN*) if test `$PYTHON -c "import os; print(os.name)" | tr -d "\r"` = posix; then PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d'%(sys.version_info[0],sys.version_info[1]))"` PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" PYTHON_DEP_LIBS=`$PYTHON -c "from distutils import sysconfig; import re; print(re.sub(r'\\s*-lutil', '', sysconfig.get_config_var('LIBS') or ''))"` else if test "$CXX" = "g++"; then CPPFLAGS="$CPPFLAGS -D PARSE_MSVC" CFLAGS="-mno-cygwin $CFLAGS" CXXFLAGS="-mno-cygwin $CXXFLAGS" LDFLAGS="-mno-cygwin $LDFLAGS" PYTHON_VERSION=`$PYTHON -c "import sys; print('%d%d'%(sys.version_info[0],sys.version_info[1]))" | tr -d "\r"` PYTHON_LIBS="-L`cygpath -a $PYTHON_PREFIX | tr -d \"\r\"`/Libs -lpython$PYTHON_VERSION" fi PYTHON_INCLUDE=`cygpath -a $PYTHON_INCLUDE | tr -d "\r"` PYTHON_DEP_LIBS=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_var('LIBS') or '')" | tr -d "\r"` fi LDSHARED="$CXX -shared" CXXFLAGS="-D_REENTRANT $CXXFLAGS" LIBS="$LIBS $PYTHON_LIBS $PYTHON_DEP_LIBS" ;; Darwin) PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d'%(sys.version_info[0],sys.version_info[1]))"` PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" CFLAGS="$CFLAGS -fPIC" CXXFLAGS="$CXXFLAGS -fPIC" LDSHARED="$CXX -dynamiclib -Wl,-undefined,dynamic_lookup" ;; *) PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d'%(sys.version_info[0],sys.version_info[1]))"` PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" CFLAGS="$CFLAGS -fPIC" CXXFLAGS="$CXXFLAGS -fPIC" LDSHARED="$CXX -shared" ;; esac ac_config_files="$ac_config_files 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, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${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 more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by Synopsis $as_me 1.0, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF 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 and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ Synopsis config.status 1.0 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' _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 ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --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;; --he | --h) # Conflict between --help and --header { 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 ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "acconfig.h") CONFIG_HEADERS="$CONFIG_HEADERS acconfig.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) { { 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 fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for 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 _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim CPP!$CPP$ac_delim CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim ac_ct_CXX!$ac_ct_CXX$ac_delim LEX!$LEX$ac_delim LEX_OUTPUT_ROOT!$LEX_OUTPUT_ROOT$ac_delim LEXLIB!$LEXLIB$ac_delim YACC!$YACC$ac_delim YFLAGS!$YFLAGS$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim PYTHON!$PYTHON$ac_delim PYTHON_INCLUDE!$PYTHON_INCLUDE$ac_delim LIBEXT!$LIBEXT$ac_delim LDSHARED!$LDSHARED$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 61; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF 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&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; :H) # # CONFIG_HEADER # _ACEOF # Transform confdefs.h into a sed script `conftest.defines', that # substitutes the proper values into config.h.in to produce config.h. rm -f conftest.defines conftest.tail # First, append a space to every undef/define line, to ease matching. echo 's/$/ /' >conftest.defines # Then, protect against being on the right side of a sed subst, or in # an unquoted here document, in config.status. If some macros were # called several times there might be several #defines for the same # symbol, which is useless. But do not sort them, since the last # AC_DEFINE must be honored. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* # These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where # NAME is the cpp macro being defined, VALUE is the value it is being given. # PARAMS is the parameter list in the macro definition--in most cases, it's # just an empty string. ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' ac_dB='\\)[ (].*,\\1define\\2' ac_dC=' ' ac_dD=' ,' uniq confdefs.h | sed -n ' t rset :rset s/^[ ]*#[ ]*define[ ][ ]*// t ok d :ok s/[\\&,]/\\&/g s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p ' >>conftest.defines # Remove the space that was appended to ease matching. # Then replace #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. # (The regexp can be short, since the line contains either #define or #undef.) echo 's/ $// s,^[ #]*u.*,/* & */,' >>conftest.defines # Break up conftest.defines: ac_max_sed_lines=50 # First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" # Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" # Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" # et cetera. ac_in='$ac_file_inputs' ac_out='"$tmp/out1"' ac_nxt='"$tmp/out2"' while : do # Write a here document: cat >>$CONFIG_STATUS <<_ACEOF # First, check the format of the line: cat >"\$tmp/defines.sed" <<\\CEOF /^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def /^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def b :def _ACEOF sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail grep . conftest.tail >/dev/null || break rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines conftest.tail echo "ac_result=$ac_in" >>$CONFIG_STATUS cat >>$CONFIG_STATUS <<\_ACEOF if test x"$ac_file" != x-; then echo "/* $configure_input */" >"$tmp/config.h" cat "$ac_result" >>"$tmp/config.h" 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 rm -f $ac_file mv "$tmp/config.h" $ac_file fi else echo "/* $configure_input */" cat "$ac_result" fi rm -f "$tmp/out12" ;; esac done # for ac_tag { (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 synopsis-0.12/Synopsis/Parsers/IDL/idlutil.cc0000664000076400007640000001145611104703261020514 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlutil.cc Created on: 1999/10/11 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Utility functions // $Id: idlutil.cc,v 1.11.2.1 2003/03/23 21:01:43 dgrisby Exp $ // $Log: idlutil.cc,v $ // Revision 1.11.2.1 2003/03/23 21:01:43 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.5.2.7 2003/01/16 11:08:27 dgrisby // Patches to support Digital Mars C++. Thanks Christof Meerwald. // // Revision 1.5.2.6 2002/01/15 16:38:14 dpg1 // On the road to autoconf. Dependencies refactored, configure.ac // written. No makefiles yet. // // Revision 1.5.2.5 2001/06/21 11:17:15 sll // Added darwin port. // // Revision 1.5.2.4 2001/06/08 17:12:24 dpg1 // Merge all the bug fixes from omni3_develop. // // Revision 1.5.2.3 2000/10/27 16:31:10 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.5.2.2 2000/10/10 10:18:51 dpg1 // Update omniidl front-end from omni3_develop. // // Revision 1.3.2.2 2000/09/22 10:50:21 dpg1 // Digital Unix uses strtoul, not strtoull // // Revision 1.3.2.1 2000/08/07 15:34:36 dpg1 // Partial back-port of long long from omni3_1_develop. // // Revision 1.3 1999/11/04 17:16:54 dpg1 // Changes for NT. // // Revision 1.2 1999/11/02 17:07:24 dpg1 // Changes to compile on Solaris. // // Revision 1.1 1999/10/27 14:05:54 dpg1 // *** empty log message *** // #include #include #include #include char* idl_strdup(const char* s) { if (s) { char* ret = new char[strlen(s)+1]; strcpy(ret, s); return ret; } else return 0; } IDL_WChar* idl_wstrdup(const IDL_WChar* s) { if (s) { int i, len; for (len=0; s[len]; len++); IDL_WChar* ret = new IDL_WChar[len+1]; for (i=0; i int strcasecmp(const char* s1, const char* s2) { for (; *s1 && *s2; ++s1, ++s2) if (toupper(*s1) != toupper(*s2)) break; if (!*s1 && !*s2) return 0; else if (toupper(*s1) < toupper(*s2)) return -1; else return 1; } #endif #ifdef HAS_LongLong # if defined(_MSC_VER) IdlIntLiteral idl_strtoul(const char* text, int base) { IdlIntLiteral ull; switch (base) { case 8: sscanf(text, "%I64o", &ull); break; case 10: sscanf(text, "%I64d", &ull); break; case 16: sscanf(text, "%I64x", &ull); break; default: abort(); } return ull; } # elif defined(__hpux__) IdlIntLiteral idl_strtoul(const char* text, int base) { IdlIntLiteral ull; switch (base) { case 8: sscanf(text, "%llo", &ull); break; case 10: sscanf(text, "%lld", &ull); break; case 16: sscanf(text, "%llx", &ull); break; default: abort(); } return ull; } # elif defined(HAVE_STRTOUL) && SIZEOF_LONG == 8 IdlIntLiteral idl_strtoul(const char* text, int base) { return strtoul(text, 0, base); } # elif defined(HAVE_STRTOUQ) IdlIntLiteral idl_strtoul(const char* text, int base) { return strtouq(text, 0, base); } # elif defined(HAVE_STRTOULL) IdlIntLiteral idl_strtoul(const char* text, int base) { return strtoull(text, 0, base); } # else IdlIntLiteral idl_strtoul(const char* text, int base) { return strtoul(text, 0, base); } # endif #else // No long long support IdlIntLiteral idl_strtoul(const char* text, int base) { return strtoul(text, 0, base); } #endif IdlFloatLiteral idl_strtod(const char* text) { // *** Should cope with long double return strtod(text,0); } synopsis-0.12/Synopsis/Parsers/IDL/idlast.h0000664000076400007640000010432611104703261020167 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlast.h Created on: 1999/10/07 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Definitions for abstract syntax tree classes // $Id: idlast.h,v 1.15.2.3 2004/02/16 10:10:33 dgrisby Exp $ // $Log: idlast.h,v $ // Revision 1.15.2.3 2004/02/16 10:10:33 dgrisby // More valuetype, including value boxes. C++ mapping updates. // // Revision 1.15.2.2 2003/09/04 14:00:24 dgrisby // ValueType IDL updates. // // Revision 1.15.2.1 2003/03/23 21:01:47 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.10.2.6 2001/08/29 11:55:23 dpg1 // Enumerator nodes record their value. // // Revision 1.10.2.5 2001/03/13 10:32:11 dpg1 // Fixed point support. // // Revision 1.10.2.4 2000/11/01 12:45:56 dpg1 // Update to CORBA 2.4 specification. // // Revision 1.10.2.3 2000/10/27 16:31:08 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.10.2.2 2000/10/10 10:18:50 dpg1 // Update omniidl front-end from omni3_develop. // // Revision 1.8.2.6 2000/08/29 10:20:26 dpg1 // Operations and attributes now have repository ids. // // Revision 1.8.2.5 2000/08/04 11:39:03 dpg1 // Updates for AIX with xlC // // Revision 1.8.2.4 2000/06/08 14:36:19 dpg1 // Comments and pragmas are now objects rather than plain strings, so // they can have file,line associated with them. // // Revision 1.8.2.3 2000/06/05 18:13:27 dpg1 // Comments can be attached to subsequent declarations (with -K). Better // idea of most recent decl in operation declarations // // Revision 1.8.2.2 2000/03/07 10:36:38 dpg1 // More sensible idea of the "most recent" declaration. // // Revision 1.8.2.1 2000/03/06 15:03:48 dpg1 // Minor bug fixes to omniidl. New -nf and -k flags. // // Revision 1.8 2000/02/04 12:17:09 dpg1 // Support for VMS. // // Revision 1.7 1999/11/17 17:17:00 dpg1 // Changes to remove static initialisation of objects. // // Revision 1.6 1999/11/02 17:07:27 dpg1 // Changes to compile on Solaris. // // Revision 1.5 1999/11/01 20:19:56 dpg1 // Support for union switch types declared inside the switch statement. // // Revision 1.4 1999/11/01 10:05:01 dpg1 // New file attribute to AST. // // Revision 1.3 1999/10/29 15:43:02 dpg1 // Code to detect recursive structs and unions. // // Revision 1.2 1999/10/29 10:00:43 dpg1 // Added code to find a value for the default case in a union. // // Revision 1.1 1999/10/27 14:05:59 dpg1 // *** empty log message *** // #ifndef _idlast_h_ #define _idlast_h_ #include #include #include #include #include #include int yyparse(); class Decl; // Pragma class stores a list of pragmas: class Pragma { public: Pragma(const char* pragmaText, const char* file, int line) : pragmaText_(idl_strdup(pragmaText)), file_(idl_strdup(file)), line_(line), next_(0) {} ~Pragma() { delete [] pragmaText_; delete [] file_; if (next_) delete next_; } const char* pragmaText() const { return pragmaText_; } const char* file() const { return file_; } int line() const { return line_; } Pragma* next() const { return next_; } static void add(const char* pragmaText, const char* file, int line); private: char* pragmaText_; char* file_; int line_; Pragma* next_; friend class AST; friend class Decl; }; // Comment class stores a list of comment strings: class Comment { public: Comment(const char* commentText, const char* file, int line) : commentText_(idl_strdup(commentText)), file_(idl_strdup(file)), line_(line), next_(0) { mostRecent_ = this; } ~Comment() { delete [] commentText_; delete [] file_; if (next_) delete next_; } const char* commentText() const { return commentText_; } const char* file() const { return file_; } int line() const { return line_; } Comment* next() const { return next_; } static void add (const char* commentText, const char* file, int line); static void append(const char* commentText); static void clear() { mostRecent_ = 0; } static Comment* grabSaved(); // Return any saved comments, and clear the saved comment list private: char* commentText_; char* file_; int line_; Comment* next_; static Comment* mostRecent_; static Comment* saved_; friend class AST; friend class Decl; }; // AST class represents the whole IDL definition class AST { public: AST(); ~AST(); static AST* tree(); static IDL_Boolean process(FILE* f, const char* name); static void clear(); Decl* declarations() { return declarations_; } const char* file() { return file_; } Pragma* pragmas() { return pragmas_; } Comment* comments() { return comments_; } void accept(AstVisitor& visitor) { visitor.visitAST(this); } void setFile(const char* f); void addPragma(const char* pragmaText, const char* file, int line); void addComment(const char* commentText, const char* file, int line); private: void setDeclarations(Decl* d); Decl* declarations_; char* file_; static AST* tree_; Pragma* pragmas_; Pragma* lastPragma_; Comment* comments_; Comment* lastComment_; friend int yyparse(); }; // Base declaration abstract class class Decl { public: // Declaration kinds enum Kind { D_MODULE, D_INTERFACE, D_FORWARD, D_CONST, D_DECLARATOR, D_TYPEDEF, D_MEMBER, D_STRUCT, D_STRUCTFORWARD, D_EXCEPTION, D_CASELABEL, D_UNIONCASE, D_UNION, D_UNIONFORWARD, D_ENUMERATOR, D_ENUM, D_ATTRIBUTE, D_PARAMETER, D_OPERATION, D_NATIVE, D_STATEMEMBER, D_FACTORY, D_VALUEFORWARD, D_VALUEBOX, D_VALUEABS, D_VALUE }; Decl(Kind kind, const char* file, int line, IDL_Boolean mainFile); virtual ~Decl(); // Declaration kind Kind kind() const { return kind_; } virtual const char* kindAsString() const = 0; // Query interface const char* file() const { return file_; } int line() const { return line_; } IDL_Boolean mainFile() const { return mainFile_; } const Scope* inScope() const { return inScope_; } const Pragma* pragmas() const { return pragmas_; } const Comment* comments() const { return comments_; } // Linked list Decl* next() { return next_; } void append(Decl* d) { if (d) { last_->next_ = d; last_ = d; } } // Find a decl given a name. Does not mark the name used. static Decl* scopedNameToDecl(const char* file, int line, const ScopedName* sn); static Decl* mostRecent() { return mostRecent_; } static void clear() { mostRecent_ = 0; } // Visitor pattern accept(). The visitor is responsible for // recursively visiting children if it needs to virtual void accept(AstVisitor& visitor) = 0; void addPragma(const char* pragmaText, const char* file, int line); void addComment(const char* commentText, const char* file, int line); private: Kind kind_; char* file_; int line_; IDL_Boolean mainFile_; const Scope* inScope_; Pragma* pragmas_; Pragma* lastPragma_; Comment* comments_; Comment* lastComment_; protected: static Decl* mostRecent_; Decl* next_; Decl* last_; }; // Mixin class for Decls with a RepoId class DeclRepoId { public: DeclRepoId(const char* identifier); ~DeclRepoId(); // eidentifier() returns the identifier with _ escapes intact const char* identifier() const { return identifier_; } const char* eidentifier() const { return eidentifier_; } const ScopedName* scopedName() const { return scopedName_; } const char* repoId() const { return repoId_; } const char* prefix() const { return prefix_; } void setRepoId(const char* repoId, const char* file, int line); void setVersion(IDL_Short maj, IDL_Short min, const char* file, int line); // Static set functions taking a Decl as an argument static void setRepoId(Decl* d, const char* repoId, const char* file, int line); static void setVersion(Decl* d, IDL_Short maj, IDL_Short min, const char* file, int line); IDL_Boolean repoIdSet() const { return set_; } const char* rifile() const { return rifile_; } int riline() const { return riline_; } IDL_Short rimaj() const { return maj_; } IDL_Short rimin() const { return min_; } private: void genRepoId(); char* identifier_; char* eidentifier_; ScopedName* scopedName_; char* repoId_; char* prefix_; // Prefix in force at time of declaration IDL_Boolean set_; // True if repoId or version has been manually set char* rifile_; // File where repoId or version was set int riline_; // Line where repoId or version was set IDL_Short maj_; IDL_Short min_; }; // Module class Module : public Decl, public DeclRepoId { public: Module(const char* file, int line, IDL_Boolean mainFile, const char* identifier); virtual ~Module(); const char* kindAsString() const { return "module"; } // Query interface Decl* definitions() const { return definitions_; } void accept(AstVisitor& visitor) { visitor.visitModule(this); } void finishConstruction(Decl* defs); private: Decl* definitions_; }; // List of inherited interfaces class InheritSpec { public: InheritSpec(const ScopedName* sn, const char* file, int line); ~InheritSpec() { if (next_) delete next_; } // The ScopedName used in an inheritance specification may be a // typedef. In that case, decl() returns the Typedef declarator // object and interface() returns the actual Interface object. // Otherwise, both functions return the same Interface pointer. Interface* interface() const { return interface_; } Decl* decl() const { return decl_; } const Scope* scope() const { return scope_; } InheritSpec* next() const { return next_; } void append(InheritSpec* is, const char* file, int line); private: Interface* interface_; Decl* decl_; const Scope* scope_; protected: InheritSpec* next_; }; // Interface class Interface : public Decl, public DeclRepoId { public: Interface(const char* file, int line, IDL_Boolean mainFile, const char* identifier, IDL_Boolean abstract, IDL_Boolean local, InheritSpec* inherits); virtual ~Interface(); const char* kindAsString() const { return "interface"; } // Queries IDL_Boolean abstract() const { return abstract_; } IDL_Boolean local() const { return local_; } InheritSpec* inherits() const { return inherits_; } Decl* contents() const { return contents_; } Scope* scope() const { return scope_; } IdlType* thisType() const { return thisType_; } IDL_Boolean isDerived(const Interface* base) const; void accept(AstVisitor& visitor) { visitor.visitInterface(this); } void finishConstruction(Decl* decls); private: IDL_Boolean abstract_; IDL_Boolean local_; InheritSpec* inherits_; Decl* contents_; Scope* scope_; IdlType* thisType_; }; // Forward-declared interface class Forward : public Decl, public DeclRepoId { public: Forward(const char* file, int line, IDL_Boolean mainFile, const char* identifier, IDL_Boolean abstract, IDL_Boolean local); virtual ~Forward(); const char* kindAsString() const { return "forward interface"; } // Query interface IDL_Boolean abstract() const { return abstract_; } IDL_Boolean local() const { return local_; } Interface* definition() const; IDL_Boolean isFirst() const { return !firstForward_; } IdlType* thisType() const { return thisType_; } void accept(AstVisitor& visitor) { visitor.visitForward(this); } void setDefinition(Interface* defn); private: IDL_Boolean abstract_; IDL_Boolean local_; Interface* definition_; Forward* firstForward_; IdlType* thisType_; }; // Constant class Const : public Decl, public DeclRepoId { public: Const(const char* file, int line, IDL_Boolean mainFile, IdlType* constType, const char* identifier, IdlExpr* expr); virtual ~Const(); const char* kindAsString() const { return "constant"; } // Queries IdlType* constType() const { return constType_; } IdlType::Kind constKind() const { return constKind_; } IDL_Short constAsShort() const; IDL_Long constAsLong() const; IDL_UShort constAsUShort() const; IDL_ULong constAsULong() const; IDL_Float constAsFloat() const; IDL_Double constAsDouble() const; IDL_Boolean constAsBoolean() const; IDL_Char constAsChar() const; IDL_Octet constAsOctet() const; const char* constAsString() const; #ifdef HAS_LongLong IDL_LongLong constAsLongLong() const; IDL_ULongLong constAsULongLong() const; #endif #ifdef HAS_LongDouble IDL_LongDouble constAsLongDouble() const; #endif IDL_WChar constAsWChar() const; const IDL_WChar* constAsWString() const; IDL_Fixed* constAsFixed() const; Enumerator* constAsEnumerator() const; void accept(AstVisitor& visitor) { visitor.visitConst(this); } private: IdlType* constType_; IDL_Boolean delType_; IdlType::Kind constKind_; union { IDL_Short short_; IDL_Long long_; IDL_UShort ushort_; IDL_ULong ulong_; #ifndef __VMS IDL_Float float_; IDL_Double double_; #else float float_; double double_; #endif IDL_Boolean boolean_; IDL_Char char_; IDL_Octet octet_; char* string_; #ifdef HAS_LongLong IDL_LongLong longlong_; IDL_ULongLong ulonglong_; #endif #ifdef HAS_LongDouble IDL_LongDouble longdouble_; #endif IDL_WChar wchar_; IDL_WChar* wstring_; IDL_Fixed* fixed_; Enumerator* enumerator_; } v_; }; // Typedef class ArraySize { public: ArraySize(int size) : size_(size), next_(0), last_(0) {} ~ArraySize() { if (next_) delete next_; } int size() const { return size_; } ArraySize* next() const { return next_; } void append(ArraySize* as) { if (last_) last_->next_ = as; else next_ = as; last_ = as; } private: int size_; protected: ArraySize* next_; ArraySize* last_; }; class Typedef; class Attribute; class Declarator : public Decl, public DeclRepoId { public: Declarator(const char* file, int line, IDL_Boolean mainFile, const char* identifier, ArraySize* sizes); virtual ~Declarator(); const char* kindAsString() const; // Queries ArraySize* sizes() const { return sizes_; } // Null if a simple declarator // Only for typedef declarators IdlType* thisType() const { return thisType_; } Typedef* alias() const { return alias_; } Attribute* attribute() const { return attribute_; } void accept(AstVisitor& visitor) { visitor.visitDeclarator(this); } void setAlias (Typedef* td); void setAttribute(Attribute* at); private: ArraySize* sizes_; IdlType* thisType_; Typedef* alias_; Attribute* attribute_; }; class Typedef : public Decl { public: Typedef(const char* file, int line, IDL_Boolean mainFile, IdlType* aliasType, IDL_Boolean constrType, Declarator* declarators); virtual ~Typedef(); const char* kindAsString() const { return "typedef"; } // Queries IdlType* aliasType() const { return aliasType_; } IDL_Boolean constrType() const { return constrType_; } Declarator* declarators() const { return declarators_; } void accept(AstVisitor& visitor) { visitor.visitTypedef(this); } private: IdlType* aliasType_; IDL_Boolean delType_; IDL_Boolean constrType_; Declarator* declarators_; }; // Struct member class Member : public Decl { public: Member(const char* file, int line, IDL_Boolean mainFile, IdlType* memberType, IDL_Boolean constrType, Declarator* declarators); virtual ~Member(); const char* kindAsString() const { return "member"; } // Queries IdlType* memberType() const { return memberType_; } IDL_Boolean constrType() const { return constrType_; } Declarator* declarators() const { return declarators_; } void accept(AstVisitor& visitor) { visitor.visitMember(this); } private: IdlType* memberType_; IDL_Boolean delType_; IDL_Boolean constrType_; Declarator* declarators_; }; // Struct class Struct : public Decl, public DeclRepoId { public: Struct(const char* file, int line, IDL_Boolean mainFile, const char* identifier); virtual ~Struct(); const char* kindAsString() const { return "struct"; } // Queries Member* members() const { return members_; } IdlType* thisType() const { return thisType_; } IDL_Boolean recursive() const { return recursive_; } IDL_Boolean finished() const { return finished_; } void accept(AstVisitor& visitor) { visitor.visitStruct(this); } void finishConstruction(Member* members); void setRecursive() { recursive_ = 1; } private: Member* members_; IdlType* thisType_; IDL_Boolean recursive_; IDL_Boolean finished_; }; // Forward-declared struct class StructForward : public Decl, public DeclRepoId { public: StructForward(const char* file, int line, IDL_Boolean mainFile, const char* identifier); virtual ~StructForward(); const char* kindAsString() const { return "forward struct"; } // Queries Struct* definition() const; IDL_Boolean isFirst() const { return !firstForward_; } IdlType* thisType() const { return thisType_; } void accept(AstVisitor& visitor) { visitor.visitStructForward(this); } void setDefinition(Struct* defn); private: Struct* definition_; StructForward* firstForward_; IdlType* thisType_; }; // Exception class Exception : public Decl, public DeclRepoId { public: Exception(const char* file, int line, IDL_Boolean mainFile, const char* identifier); virtual ~Exception(); const char* kindAsString() const { return "exception"; } // Queries Member* members() const { return members_; } IDL_Boolean local() const { return local_; } void accept(AstVisitor& visitor) { visitor.visitException(this); } void finishConstruction(Member* members); private: Member* members_; IDL_Boolean local_; }; // Union case label class CaseLabel : public Decl { public: CaseLabel(const char* file, int line, IDL_Boolean mainFile, IdlExpr* value); virtual ~CaseLabel(); const char* kindAsString() const { return "case label"; } IDL_Short labelAsShort() const; IDL_Long labelAsLong() const; IDL_UShort labelAsUShort() const; IDL_ULong labelAsULong() const; IDL_Boolean labelAsBoolean() const; IDL_Char labelAsChar() const; #ifdef HAS_LongLong IDL_LongLong labelAsLongLong() const; IDL_ULongLong labelAsULongLong() const; #endif IDL_WChar labelAsWChar() const; Enumerator* labelAsEnumerator() const; inline IDL_Boolean isDefault() const { return isDefault_; } IdlType::Kind labelKind() const { return labelKind_; } void accept(AstVisitor& visitor) { visitor.visitCaseLabel(this); } void setType(IdlType* type); void setDefaultShort (IDL_Short v) { v_.short_ = v; } void setDefaultLong (IDL_Long v) { v_.long_ = v; } void setDefaultUShort (IDL_UShort v) { v_.ushort_ = v; } void setDefaultULong (IDL_ULong v) { v_.ulong_ = v; } void setDefaultBoolean (IDL_Boolean v) { v_.boolean_ = v; } void setDefaultChar (IDL_Char v) { v_.char_ = v; } #ifdef HAS_LongLong void setDefaultLongLong (IDL_LongLong v) { v_.longlong_ = v; } void setDefaultULongLong (IDL_ULongLong v) { v_.ulonglong_ = v; } #endif void setDefaultWChar (IDL_WChar v) { v_.wchar_ = v; } void setDefaultEnumerator(Enumerator* v) { v_.enumerator_ = v; } private: IdlExpr* value_; IDL_Boolean isDefault_; IdlType::Kind labelKind_; union { IDL_Short short_; IDL_Long long_; IDL_UShort ushort_; IDL_ULong ulong_; IDL_Boolean boolean_; IDL_Char char_; #ifdef HAS_LongLong IDL_LongLong longlong_; IDL_ULongLong ulonglong_; #endif IDL_WChar wchar_; Enumerator* enumerator_; } v_; }; // Union case class UnionCase : public Decl { public: UnionCase(const char* file, int line, IDL_Boolean mainFile, IdlType* caseType, IDL_Boolean constrType, Declarator* declarator); virtual ~UnionCase(); const char* kindAsString() const { return "case"; } // Queries CaseLabel* labels() const { return labels_; } IdlType* caseType() const { return caseType_; } IDL_Boolean constrType() const { return constrType_; } Declarator* declarator() const { return declarator_; } void accept(AstVisitor& visitor) { visitor.visitUnionCase(this); } void finishConstruction(CaseLabel* labels); private: CaseLabel* labels_; IdlType* caseType_; IDL_Boolean delType_; IDL_Boolean constrType_; Declarator* declarator_; }; // Union class Union : public Decl, public DeclRepoId { public: Union(const char* file, int line, IDL_Boolean mainFile, const char* identifier); virtual ~Union(); const char* kindAsString() const { return "union"; } // Queries IdlType* switchType() const { return switchType_; } IDL_Boolean constrType() const { return constrType_; } UnionCase* cases() const { return cases_; } IdlType* thisType() const { return thisType_; } IDL_Boolean recursive() const { return recursive_; } IDL_Boolean finished() const { return finished_; } void accept(AstVisitor& visitor) { visitor.visitUnion(this); } void finishConstruction(IdlType* switchType, IDL_Boolean constrType, UnionCase* cases); void setRecursive() { recursive_ = 1; } private: IdlType* switchType_; IDL_Boolean constrType_; UnionCase* cases_; IdlType* thisType_; IDL_Boolean recursive_; IDL_Boolean finished_; }; class UnionForward : public Decl, public DeclRepoId { public: UnionForward(const char* file, int line, IDL_Boolean mainFile, const char* identifier); virtual ~UnionForward(); const char* kindAsString() const { return "forward union"; } // Queries Union* definition() const; IDL_Boolean isFirst() const { return !firstForward_; } IdlType* thisType() const { return thisType_; } void accept(AstVisitor& visitor) { visitor.visitUnionForward(this); } void setDefinition(Union* defn); private: Union* definition_; UnionForward* firstForward_; IdlType* thisType_; }; // Enumerator class Enum; class Enumerator : public Decl, public DeclRepoId { public: Enumerator(const char* file, int line, IDL_Boolean mainFile, const char* identifier); virtual ~Enumerator(); const char* kindAsString() const { return "enumerator"; } // Queries Enum* container() const { return container_; } IDL_ULong value() const { return value_; } void accept(AstVisitor& visitor) { visitor.visitEnumerator(this); } void finishConstruction(Enum* container, IDL_ULong value); private: const char* identifier_; Enum* container_; IDL_ULong value_; }; // Enum class Enum : public Decl, public DeclRepoId { public: Enum(const char* file, int line, IDL_Boolean mainFile, const char* identifier); virtual ~Enum(); const char* kindAsString() const { return "enum"; } // Queries Enumerator* enumerators() const { return enumerators_; } IdlType* thisType() const { return thisType_; } void accept(AstVisitor& visitor) { visitor.visitEnum(this); } void finishConstruction(Enumerator* enumerators); private: Enumerator* enumerators_; IdlType* thisType_; }; // Attribute class Attribute : public Decl { public: Attribute(const char* file, int line, IDL_Boolean mainFile, IDL_Boolean readonly, IdlType* attrType, Declarator* declarators); virtual ~Attribute(); const char* kindAsString() const { return "attribute"; } // Queries IDL_Boolean readonly() const { return readonly_; } IdlType* attrType() const { return attrType_; } Declarator* declarators() const { return declarators_; } void accept(AstVisitor& visitor) { visitor.visitAttribute(this); } private: IDL_Boolean readonly_; IdlType* attrType_; IDL_Boolean delType_; Declarator* declarators_; }; // Parameter class Parameter : public Decl { public: Parameter(const char* file, int line, IDL_Boolean mainFile, int direction, IdlType* paramType, const char* identifier); virtual ~Parameter(); const char* kindAsString() const { return "parameter"; } // Queries int direction() const { return direction_; } // 0: in, 1: out, 2: inout IdlType* paramType() const { return paramType_; } const char* identifier() const { return identifier_; } void accept(AstVisitor& visitor) { visitor.visitParameter(this); } private: int direction_; IdlType* paramType_; IDL_Boolean delType_; char* identifier_; }; // List of exceptions class RaisesSpec { public: RaisesSpec(const ScopedName* sn, const char* file, int line); ~RaisesSpec(); Exception* exception() const { return exception_; } RaisesSpec* next() const { return next_; } void append(RaisesSpec* rs) { if (rs) { last_->next_ = rs; last_ = rs; } } private: Exception* exception_; protected: RaisesSpec* next_; RaisesSpec* last_; }; // List of contexts class ContextSpec { public: ContextSpec(const char* c, const char* file, int line); ~ContextSpec(); const char* context() const { return context_; } ContextSpec* next() const { return next_; } void append(ContextSpec* rs) { last_->next_ = rs; last_ = rs; } private: char* context_; protected: ContextSpec* next_; ContextSpec* last_; }; // Operation class Operation : public Decl, public DeclRepoId { public: Operation(const char* file, int line, IDL_Boolean mainFile, IDL_Boolean oneway, IdlType* return_type, const char* identifier); virtual ~Operation(); const char* kindAsString() const { return "operation"; } // Queries IDL_Boolean oneway() const { return oneway_; } IdlType* returnType() const { return returnType_; } Parameter* parameters() const { return parameters_; } RaisesSpec* raises() const { return raises_; } ContextSpec* contexts() const { return contexts_; } void accept(AstVisitor& visitor) { visitor.visitOperation(this); } void closeParens(); void finishConstruction(Parameter* parameters, RaisesSpec* raises, ContextSpec* contexts); private: IDL_Boolean oneway_; IdlType* returnType_; IDL_Boolean delType_; Parameter* parameters_; RaisesSpec* raises_; ContextSpec* contexts_; }; // Native class Native : public Decl, public DeclRepoId { public: Native(const char* file, int line, IDL_Boolean mainFile, const char* identifier); virtual ~Native(); const char* kindAsString() const { return "native"; } void accept(AstVisitor& visitor) { visitor.visitNative(this); } }; // Things for valuetype class StateMember : public Decl { public: StateMember(const char* file, int line, IDL_Boolean mainFile, int memberAccess, IdlType* memberType, IDL_Boolean constrType, Declarator* declarators); virtual ~StateMember(); const char* kindAsString() const { return "state member"; } // Queries int memberAccess() const { return memberAccess_; } // 0: public, 1: private IdlType* memberType() const { return memberType_; } IDL_Boolean constrType() const { return constrType_; } Declarator* declarators() const { return declarators_; } void accept(AstVisitor& visitor) { visitor.visitStateMember(this); } private: int memberAccess_; IdlType* memberType_; IDL_Boolean delType_; IDL_Boolean constrType_; Declarator* declarators_; }; class Factory : public Decl { public: Factory(const char* file, int line, IDL_Boolean mainFile, const char* identifier); ~Factory(); const char* kindAsString() const { return "initializer"; } // Queries const char* identifier() const { return identifier_; } Parameter* parameters() const { return parameters_; } RaisesSpec* raises() const { return raises_; } void accept(AstVisitor& visitor) { visitor.visitFactory(this); } void closeParens(); void finishConstruction(Parameter* parameters, RaisesSpec* raises); private: char* identifier_; Parameter* parameters_; RaisesSpec* raises_; }; // Base class for all the multifarious value types class ValueBase : public Decl, public DeclRepoId { public: ValueBase(Decl::Kind k, const char* file, int line, IDL_Boolean mainFile, const char* identifier); virtual ~ValueBase(); }; // Forward declared value class ValueForward : public ValueBase { public: ValueForward(const char* file, int line, IDL_Boolean mainFile, IDL_Boolean abstract, const char* identifier); virtual ~ValueForward(); const char* kindAsString() const { return "forward value"; } // Queries IDL_Boolean abstract() const { return abstract_; } ValueBase* definition() const; IDL_Boolean isFirst() const { return !firstForward_; } IdlType* thisType() const { return thisType_; } void accept(AstVisitor& visitor) { visitor.visitValueForward(this); } void setDefinition(ValueBase* defn); private: IDL_Boolean abstract_; ValueBase* definition_; ValueForward* firstForward_; IdlType* thisType_; }; class ValueBox : public ValueBase { public: ValueBox(const char* file, int line, IDL_Boolean mainFile, const char* identifier, IdlType* boxedType, IDL_Boolean constrType); virtual ~ValueBox(); const char* kindAsString() const { return "value box"; } // Queries IdlType* boxedType() const { return boxedType_; } IDL_Boolean constrType() const { return constrType_; } IdlType* thisType() const { return thisType_; } void accept(AstVisitor& visitor) { visitor.visitValueBox(this); } private: IdlType* boxedType_; IDL_Boolean constrType_; IDL_Boolean delType_; IdlType* thisType_; }; class ValueInheritSpec { public: ValueInheritSpec(ScopedName* sn, const char* file, int line); virtual ~ValueInheritSpec() { if (next_) delete next_; } ValueBase* value() const { return value_; } Decl* decl() const { return decl_; } const Scope* scope() const { return scope_; } ValueInheritSpec* next() const { return next_; } IDL_Boolean truncatable() const { return truncatable_; } void append(ValueInheritSpec* is, const char* file, int line); void setTruncatable() { truncatable_ = 1; } private: ValueBase* value_; Decl* decl_; const Scope* scope_; protected: ValueInheritSpec* next_; IDL_Boolean truncatable_; }; class ValueInheritSupportSpec { public: ValueInheritSupportSpec(ValueInheritSpec* inherits, InheritSpec* supports) : inherits_(inherits), supports_(supports) {} ~ValueInheritSupportSpec() {} ValueInheritSpec* inherits() const { return inherits_; } InheritSpec* supports() const { return supports_; } private: ValueInheritSpec* inherits_; InheritSpec* supports_; }; class ValueAbs : public ValueBase { public: ValueAbs(const char* file, int line, IDL_Boolean mainFile, const char* identifier, ValueInheritSpec* inherits, InheritSpec* supports); virtual ~ValueAbs(); const char* kindAsString() const { return "abstract valuetype"; } // Queries ValueInheritSpec* inherits() const { return inherits_; } InheritSpec* supports() const { return supports_; } Decl* contents() const { return contents_; } Scope* scope() const { return scope_; } IdlType* thisType() const { return thisType_; } void accept(AstVisitor& visitor) { visitor.visitValueAbs(this); } void finishConstruction(Decl* contents); private: ValueInheritSpec* inherits_; InheritSpec* supports_; Decl* contents_; Scope* scope_; IdlType* thisType_; }; class Value : public ValueBase { public: Value(const char* file, int line, IDL_Boolean mainFile, IDL_Boolean custom, const char* identifier, ValueInheritSpec* inherits, InheritSpec* supports); virtual ~Value(); const char* kindAsString() const { return "valuetype"; } // Queries IDL_Boolean custom() const { return custom_; } ValueInheritSpec* inherits() const { return inherits_; } InheritSpec* supports() const { return supports_; } Decl* contents() const { return contents_; } Scope* scope() const { return scope_; } IdlType* thisType() const { return thisType_; } void accept(AstVisitor& visitor) { visitor.visitValue(this); } void finishConstruction(Decl* contents); private: IDL_Boolean custom_; ValueInheritSpec* inherits_; InheritSpec* supports_; Decl* contents_; Scope* scope_; IdlType* thisType_; }; #endif // _idlast_h_ synopsis-0.12/Synopsis/Parsers/IDL/idlexpr.cc0000664000076400007640000007741511104703261020524 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlexpr.cc Created on: 1999/10/18 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Expression evaluation functions // $Id: idlexpr.cc,v 1.10.2.1 2003/03/23 21:01:45 dgrisby Exp $ // $Log: idlexpr.cc,v $ // Revision 1.10.2.1 2003/03/23 21:01:45 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.6.2.6 2001/10/17 16:48:33 dpg1 // Minor error message tweaks // // Revision 1.6.2.5 2001/08/29 11:54:20 dpg1 // Clean up const handling in IDL compiler. // // Revision 1.6.2.4 2001/03/13 10:32:11 dpg1 // Fixed point support. // // Revision 1.6.2.3 2000/10/27 16:31:09 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.6.2.2 2000/10/10 10:18:50 dpg1 // Update omniidl front-end from omni3_develop. // // Revision 1.4.2.2 2000/08/07 15:34:36 dpg1 // Partial back-port of long long from omni3_1_develop. // // Revision 1.4.2.1 2000/06/27 16:00:17 sll // Fixes to WIN 32 related build and compiler issues. // // Revision 1.4 2000/02/04 12:17:09 dpg1 // Support for VMS. // // Revision 1.3 1999/11/02 17:07:26 dpg1 // Changes to compile on Solaris. // // Revision 1.2 1999/10/29 10:01:31 dpg1 // Nicer error reporting. // // Revision 1.1 1999/10/27 14:05:57 dpg1 // *** empty log message *** // #include #include #include #include const IDL_WChar EMPTY_WSTRING[] = {'!', 0}; #define EXPR_ERR(rt, fn, str, rv) \ rt IdlExpr::fn() { \ IdlError(file(), line(), "Cannot interpret %s as " str, errText()); \ return rv; \ } // Error functions EXPR_ERR(IdlLongVal, evalAsLongV, "an integer", IdlLongVal((IDL_ULong)1)) #ifdef HAS_LongLong EXPR_ERR(IdlLongLongVal, evalAsLongLongV, "an integer", IdlLongLongVal((IDL_ULongLong)1)) #endif EXPR_ERR(IDL_Float, evalAsFloat, "a float", 1.0) EXPR_ERR(IDL_Double, evalAsDouble, "a double", 1.0) EXPR_ERR(IDL_Boolean, evalAsBoolean, "a boolean", 0) EXPR_ERR(IDL_Char, evalAsChar, "a character", '!') EXPR_ERR(const char*, evalAsString, "a string", "!") #ifdef HAS_LongDouble EXPR_ERR(IDL_LongDouble, evalAsLongDouble, "a long double", 1.0) #endif EXPR_ERR(IDL_WChar, evalAsWChar, "a wide character", '!') EXPR_ERR(const IDL_WChar*, evalAsWString, "a wide string", EMPTY_WSTRING) EXPR_ERR(IDL_Fixed*, evalAsFixed, "fixed point", new IDL_Fixed("1")) Enumerator* IdlExpr:: evalAsEnumerator(const Enum* target) { IdlError(file(), line(), "Cannot interpret %s as enumerator", errText()); return 0; } // // Conversions to IDL integer types IDL_Short IdlExpr::evalAsShort() { IdlLongVal v = evalAsLongV(); if (v.negative) { if (v.s < -0x8000) IdlError(file(), line(), "Value too small for short"); return v.s; } else { if (v.u > 0x7fff) IdlError(file(), line(), "Value too large for short"); return v.u; } } IDL_Long IdlExpr::evalAsLong() { IdlLongVal v = evalAsLongV(); if (v.negative) { return v.s; } else { if (v.u > 0x7fffffff) IdlError(file(), line(), "Value too large for long"); return v.u; } } IDL_UShort IdlExpr::evalAsUShort() { IdlLongVal v = evalAsLongV(); if (v.negative) { IdlError(file(), line(), "Value too small for unsigned short"); } else if (v.u > 0xffff) { IdlError(file(), line(), "Value too large for unsigned short"); } return v.u; } IDL_ULong IdlExpr::evalAsULong() { IdlLongVal v = evalAsLongV(); if (v.negative) { IdlError(file(), line(), "Value too small for unsigned long"); } return v.u; } IDL_Octet IdlExpr::evalAsOctet() { IdlLongVal v = evalAsLongV(); if (v.negative) { IdlError(file(), line(), "Value too small for octet"); } else if (v.u > 0xff) { IdlError(file(), line(), "Value too large for octet"); } return v.u; } #ifdef HAS_LongLong IDL_LongLong IdlExpr::evalAsLongLong() { IdlLongLongVal v = evalAsLongLongV(); if (v.negative) { return v.s; } else { if (v.u > _CORBA_LONGLONG_CONST(0x7fffffffffffffff)) IdlError(file(), line(), "Value too large for long long"); return v.u; } } IDL_ULongLong IdlExpr::evalAsULongLong() { IdlLongLongVal v = evalAsLongLongV(); if (v.negative) { IdlError(file(), line(), "Value too small for unsigned long long"); } return v.u; } #endif // ScopedName handling IdlExpr* IdlExpr:: scopedNameToExpr(const char* file, int line, ScopedName* sn) { const Scope::Entry* se = Scope::current()->findForUse(sn, file, line); if (se) { if (se->kind() == Scope::Entry::E_DECL && se->decl()->kind() == Decl::D_ENUMERATOR) { return new EnumExpr(file, line, (Enumerator*)se->decl(), sn); } else if (se->kind() == Scope::Entry::E_DECL && se->decl()->kind() == Decl::D_CONST) { return new ConstExpr(file, line, (Const*)se->decl(), sn); } else { char* ssn = sn->toString(); IdlError(file, line, "'%s' is not valid in an expression", ssn); IdlErrorCont(se->file(), se->line(), "('%s' declared here)", ssn); delete [] ssn; } } // If entry was not found, findScopedName() will have reported the error return new DummyExpr(file, line); } const IDL_WChar* DummyExpr::evalAsWString() { return EMPTY_WSTRING; } // Literals IdlLongVal IntegerExpr::evalAsLongV() { #ifdef HAS_LongLong if (value_ > 0xffffffff) { IdlError(file(), line(), "Integer literal is too large for unsigned long"); return IdlLongVal((IDL_ULong)1); } #endif return IdlLongVal((IDL_ULong)value_); } #ifdef HAS_LongLong IdlLongLongVal IntegerExpr::evalAsLongLongV() { return IdlLongLongVal((IDL_ULongLong)value_); } #endif const char* StringExpr::evalAsString() { return value_; } const IDL_WChar* WStringExpr::evalAsWString() { return value_; } IDL_Char CharExpr::evalAsChar() { return value_; } IDL_WChar WCharExpr::evalAsWChar() { return value_; } IDL_Fixed* FixedExpr::evalAsFixed() { return value_; } // Float IDL_Float FloatExpr::evalAsFloat() { #ifndef _MSC_VER // Use direct initialisation except for MS Visual C++, which allegedly // does not work properly with types involving built-in types. To // play it safe, use copy initialisation instead. IDL_Float f(value_); IdlFloatLiteral g(f); #else IDL_Float f = value_; IdlFloatLiteral g = f; #endif if (f != g) IdlWarning(file(), line(), "Loss of precision converting literal " "floating point value to float"); return f; } IDL_Double FloatExpr::evalAsDouble() { IDL_Double f = value_; #ifdef HAS_LongDouble IdlFloatLiteral g = f; if (f != g) IdlWarning(file(), line(), "Loss of precision converting literal " "floating point value to double"); #endif return f; } #ifdef HAS_LongDouble IDL_LongDouble FloatExpr::evalAsLongDouble() { return value_; } #endif // Boolean IDL_Boolean BooleanExpr::evalAsBoolean() { return value_; } // Enumerator Enumerator* EnumExpr::evalAsEnumerator(const Enum* target) { if (value_->container() != target) { char* vssn = value_->scopedName()->toString(); char* essn = target->scopedName()->toString(); IdlError(file(), line(), "Enumerator '%s' does not belong to enum '%s'", vssn, essn); delete [] essn; essn = value_->container()->scopedName()->toString(); IdlErrorCont(value_->file(), value_->line(), "(Enumerator '%s' declared in '%s' here)", vssn, essn); delete [] essn; delete [] vssn; } return value_; } // Constant IdlLongVal ConstExpr::evalAsLongV() { switch (c_->constKind()) { case IdlType::tk_short: return IdlLongVal(IDL_Long (c_->constAsShort())); case IdlType::tk_long: return IdlLongVal(IDL_Long (c_->constAsLong())); case IdlType::tk_ushort: return IdlLongVal(IDL_ULong(c_->constAsUShort())); case IdlType::tk_ulong: return IdlLongVal(IDL_ULong(c_->constAsULong())); case IdlType::tk_octet: return IdlLongVal(IDL_ULong(c_->constAsOctet())); #ifdef HAS_LongLong case IdlType::tk_longlong: { IDL_LongLong v = c_->constAsLongLong(); if (v < -0x80000000 || v > 0xffffffff) goto precision_error; if (v >= 0) return IdlLongVal(IDL_ULong(v)); else return IdlLongVal(IDL_Long(v)); } case IdlType::tk_ulonglong: { IDL_ULongLong v = c_->constAsULongLong(); if (v > 0xffffffff) goto precision_error; return IdlLongVal(IDL_ULong(v)); } #endif default: { char* ssn = scopedName_->toString(); IdlError(file(), line(), "Cannot interpret constant '%s' as an integer", ssn); IdlErrorCont(c_->file(), c_->line(), "(%s declared here)", ssn); delete [] ssn; return IdlLongVal((IDL_ULong)1); } } precision_error: char* ssn = scopedName_->toString(); IdlError(file(), line(), "Value of constant '%s' exceeds precision of target", ssn); IdlErrorCont(c_->file(), c_->line(), "(%s declared here)", ssn); delete [] ssn; return IdlLongVal(IDL_ULong(1)); } #ifdef HAS_LongLong IdlLongLongVal ConstExpr::evalAsLongLongV() { switch (c_->constKind()) { case IdlType::tk_short: return IdlLongLongVal(IDL_LongLong(c_->constAsShort())); case IdlType::tk_long: return IdlLongLongVal(IDL_LongLong(c_->constAsLong())); case IdlType::tk_ushort: return IdlLongLongVal(IDL_ULongLong(c_->constAsUShort())); case IdlType::tk_ulong: return IdlLongLongVal(IDL_ULongLong(c_->constAsULong())); case IdlType::tk_octet: return IdlLongLongVal(IDL_ULongLong(c_->constAsOctet())); case IdlType::tk_longlong: return IdlLongLongVal(c_->constAsLongLong()); case IdlType::tk_ulonglong: return IdlLongLongVal(c_->constAsULongLong()); default: { char* ssn = scopedName_->toString(); IdlError(file(), line(), "Cannot interpret constant '%s' as an integer", ssn); IdlErrorCont(c_->file(), c_->line(), "(%s declared here)", ssn); delete [] ssn; return IdlLongLongVal((IDL_ULongLong)1); } } } #endif // HAS_LongLong IDL_Float ConstExpr::evalAsFloat() { IDL_Float r; switch (c_->constKind()) { case IdlType::tk_float: r = c_->constAsFloat(); break; #ifndef __VMS case IdlType::tk_double: r = c_->constAsDouble(); break; #else case IdlType::tk_double: r = (float)(double)c_->constAsDouble(); break; #endif #ifdef HAS_LongDouble case IdlType::tk_longdouble: r = c_->constAsLongDouble(); break; #endif default: r = 1.0; char* ssn = scopedName_->toString(); IdlError(file(), line(), "Cannot interpret constant '%s' as float", ssn); IdlErrorCont(c_->file(), c_->line(), "(%s declared here)", ssn); delete [] ssn; } if (IdlFPOverflow(r)) { char* ssn = scopedName_->toString(); IdlError(file(), line(), "Value of constant '%s' overflows float", ssn); IdlErrorCont(c_->file(), c_->line(), "(%s declared here)", ssn); delete [] ssn; } return r; } IDL_Double ConstExpr::evalAsDouble() { IDL_Double r; switch (c_->constKind()) { #ifndef __VMS case IdlType::tk_float: r = c_->constAsFloat(); break; #else case IdlType::tk_float: r = (double)(float)c_->constAsFloat(); break; #endif case IdlType::tk_double: r = c_->constAsDouble(); break; #ifdef HAS_LongDouble case IdlType::tk_longdouble: r = c_->constAsLongDouble(); break; #endif default: r = 1.0; char* ssn = scopedName_->toString(); IdlError(file(), line(), "Cannot interpret constant '%s' as double", ssn); IdlErrorCont(c_->file(), c_->line(), "(%s declared here)", ssn); delete [] ssn; } if (IdlFPOverflow(r)) { char* ssn = scopedName_->toString(); IdlError(file(), line(), "Value of constant '%s' overflows double", ssn); IdlErrorCont(c_->file(), c_->line(), "(%s declared here)", ssn); delete [] ssn; } return r; } #ifdef HAS_LongDouble IDL_LongDouble ConstExpr::evalAsLongDouble() { IDL_LongDouble r; switch (c_->constKind()) { case IdlType::tk_float: r = c_->constAsFloat(); break; case IdlType::tk_double: r = c_->constAsDouble(); break; case IdlType::tk_longdouble: r = c_->constAsLongDouble(); break; default: r = 1.0; char* ssn = scopedName_->toString(); IdlError(file(), line(), "Cannot interpret constant '%s' as long double", ssn); IdlErrorCont(c_->file(), c_->line(), "(%s declared here)", ssn); delete [] ssn; } if (IdlFPOverflow(r)) { // Don't see how this could happen... char* ssn = scopedName_->toString(); IdlError(file(), line(), "Value of constant '%s' overflows long double", ssn); IdlErrorCont(c_->file(), c_->line(), "(%s declared here)", ssn); delete [] ssn; } return r; } #endif // HAS_LongDouble #define CONST_EXPR_EVAL(rt, eop, tk, cop, str, rv) \ rt ConstExpr::eop() { \ if (c_->constKind() == IdlType::tk) \ return c_->cop(); \ else { \ char* ssn = scopedName_->toString(); \ IdlError(file(), line(), \ "Cannot interpret constant '%s' as " str, ssn); \ IdlErrorCont(c_->file(), c_->line(), "(%s declared here)", ssn); \ delete [] ssn; \ } \ return rv; \ } CONST_EXPR_EVAL(IDL_Boolean, evalAsBoolean, tk_boolean, constAsBoolean, "boolean", 0) CONST_EXPR_EVAL(IDL_Char, evalAsChar, tk_char, constAsChar, "character", '!') CONST_EXPR_EVAL(const char*, evalAsString, tk_string, constAsString, "string", "!") CONST_EXPR_EVAL(IDL_WChar, evalAsWChar, tk_wchar, constAsWChar, "wide character", '!') CONST_EXPR_EVAL(const IDL_WChar*, evalAsWString, tk_wstring, constAsWString, "wide string", EMPTY_WSTRING) CONST_EXPR_EVAL(IDL_Fixed*, evalAsFixed, tk_fixed, constAsFixed, "fixed", new IDL_Fixed("1")) Enumerator* ConstExpr::evalAsEnumerator(const Enum* target) { if (c_->constKind() == IdlType::tk_enum) { Enumerator* e = c_->constAsEnumerator(); if (e->container() != target) { char* ssn = target->scopedName()->toString(); IdlError(file(), line(), "Enumerator '%s' does not belong to enum '%s'", e->identifier(), ssn); delete [] ssn; ssn = e->container()->scopedName()->toString(); IdlErrorCont(e->file(), e->line(), "(Enumerator '%s' declared in '%s' here)", e->identifier(), ssn); delete [] ssn; } return c_->constAsEnumerator(); } else { char* ssn = scopedName_->toString(); IdlError(file(), line(), "Cannot interpret constant '%s' as enumerator", ssn); IdlErrorCont(c_->file(), c_->line(), "(%s declared here)", ssn); delete [] ssn; } return 0; } // Binary expressions // Or IdlLongVal OrExpr::evalAsLongV() { IdlLongVal a = a_->evalAsLongV(); IdlLongVal b = b_->evalAsLongV(); if (a.negative) return IdlLongVal(IDL_Long(a.s | b.s)); else return IdlLongVal(IDL_ULong(a.u | b.u)); } #ifdef HAS_LongLong IdlLongLongVal OrExpr::evalAsLongLongV() { IdlLongLongVal a = a_->evalAsLongLongV(); IdlLongLongVal b = b_->evalAsLongLongV(); if (a.negative) return IdlLongLongVal(IDL_LongLong(a.s | b.s)); else return IdlLongLongVal(IDL_ULongLong(a.u | b.u)); } #endif // Xor IdlLongVal XorExpr::evalAsLongV() { IdlLongVal a = a_->evalAsLongV(); IdlLongVal b = b_->evalAsLongV(); if (a.negative) return IdlLongVal(IDL_Long(a.s ^ b.s)); else return IdlLongVal(IDL_ULong(a.u ^ b.u)); } #ifdef HAS_LongLong IdlLongLongVal XorExpr::evalAsLongLongV() { IdlLongLongVal a = a_->evalAsLongLongV(); IdlLongLongVal b = b_->evalAsLongLongV(); if (a.negative) return IdlLongLongVal(IDL_LongLong(a.s ^ b.s)); else return IdlLongLongVal(IDL_ULongLong(a.u ^ b.u)); } #endif // And IdlLongVal AndExpr::evalAsLongV() { IdlLongVal a = a_->evalAsLongV(); IdlLongVal b = b_->evalAsLongV(); if (a.negative) return IdlLongVal(IDL_Long(a.s & b.s)); else return IdlLongVal(IDL_ULong(a.u & b.u)); } #ifdef HAS_LongLong IdlLongLongVal AndExpr::evalAsLongLongV() { IdlLongLongVal a = a_->evalAsLongLongV(); IdlLongLongVal b = b_->evalAsLongLongV(); if (a.negative) return IdlLongLongVal(IDL_LongLong(a.s & b.s)); else return IdlLongLongVal(IDL_ULongLong(a.u & b.u)); } #endif // Right shift IdlLongVal RShiftExpr::evalAsLongV() { IdlLongVal a = a_->evalAsLongV(); IdlLongVal b = b_->evalAsLongV(); // Assume two's complement, and treat b as unsigned. If it's // actually signed and negative, its unsigned value will be much > // 64. if (b.u >= 64) { IdlError(file(), line(), "Right operand of shift operation must be >= 0 and < 64"); return a; } if (a.negative) return IdlLongVal(IDL_Long(a.s >> b.u)); else return IdlLongVal(IDL_ULong(a.u >> b.u)); } #ifdef HAS_LongLong IdlLongLongVal RShiftExpr::evalAsLongLongV() { IdlLongLongVal a = a_->evalAsLongLongV(); IdlLongLongVal b = b_->evalAsLongLongV(); if (b.u >= 64) { IdlError(file(), line(), "Right operand of shift operation must be >= 0 and < 64"); return a; } if (a.negative) return IdlLongLongVal(IDL_LongLong(a.s >> b.u)); else return IdlLongLongVal(IDL_ULongLong(a.u >> b.u)); } #endif // Left shift IdlLongVal LShiftExpr::evalAsLongV() { IdlLongVal a = a_->evalAsLongV(); IdlLongVal b = b_->evalAsLongV(); if (b.u >= 64) { IdlError(file(), line(), "Right operand of shift operation must be >= 0 and < 64"); return a; } if (a.negative) return IdlLongVal(IDL_Long(a.s << b.u)); else return IdlLongVal(IDL_ULong(a.u << b.u)); } #ifdef HAS_LongLong IdlLongLongVal LShiftExpr::evalAsLongLongV() { IdlLongLongVal a = a_->evalAsLongLongV(); IdlLongLongVal b = b_->evalAsLongLongV(); if (b.u >= 64) { IdlError(file(), line(), "Right operand of shift operation must be >= 0 and < 64"); return a; } if (a.negative) return IdlLongLongVal(IDL_LongLong(a.s << b.u)); else return IdlLongLongVal(IDL_ULongLong(a.u << b.u)); } #endif // % IdlLongVal ModExpr::evalAsLongV() { IdlLongVal a = a_->evalAsLongV(); IdlLongVal b = b_->evalAsLongV(); if (b.u == 0) { IdlError(file(), line(), "Remainder of division by 0 is undefined"); return a; } if (a.negative || b.negative) IdlWarning(file(), line(), "Result of %% operator involving negative " "operands is implementation dependent"); switch ((a.negative ? 1:0) + (b.negative ? 2:0)) { case 0: return IdlLongVal(IDL_ULong(a.u % b.u)); case 1: return IdlLongVal(-IDL_Long((-a.s) % b.u)); case 2: return IdlLongVal(IDL_ULong(a.u % IDL_ULong(-b.s))); case 3: return IdlLongVal(-IDL_Long((-a.s) % (-b.s))); } return IdlLongVal(IDL_ULong(0)); // Never reach here } #ifdef HAS_LongLong IdlLongLongVal ModExpr::evalAsLongLongV() { IdlLongLongVal a = a_->evalAsLongLongV(); IdlLongLongVal b = b_->evalAsLongLongV(); if (b.u == 0) { IdlError(file(), line(), "Remainder of division by 0 is undefined"); return a; } if (a.negative || b.negative) IdlWarning(file(), line(), "Result of %% operator involving negative " "operands is platform dependent"); switch ((a.negative ? 1:0) + (b.negative ? 2:0)) { case 0: return IdlLongLongVal(IDL_ULongLong(a.u % b.u)); case 1: return IdlLongLongVal(IDL_LongLong (a.s % b.u)); case 2: return IdlLongLongVal(IDL_LongLong (a.u % b.s)); case 3: return IdlLongLongVal(IDL_LongLong (a.s % b.s)); } return IdlLongLongVal(IDL_ULongLong(0)); // Never reach here } #endif // Add IdlLongVal AddExpr::evalAsLongV() { IdlLongVal a = a_->evalAsLongV(); IdlLongVal b = b_->evalAsLongV(); switch ((a.negative ? 1:0) + (b.negative ? 2:0)) { case 0: { IDL_ULong r = a.u + b.u; if (r < a.u) goto overflow; return IdlLongVal(r); } case 1: { if (IDL_ULong(-a.s) < b.u) return IdlLongVal(b.u - IDL_ULong(-a.s)); else return IdlLongVal(a.s + IDL_Long(b.u)); } case 2: { if (IDL_ULong(-b.s) < a.u) return IdlLongVal(a.u - IDL_ULong(-b.s)); else return IdlLongVal(IDL_Long(a.u) + b.s); } case 3: { IDL_Long r = a.s + b.s; if (r > a.s) goto overflow; return IdlLongVal(r); } } overflow: IdlError(file(), line(), "Result of addition overflows"); return a; } #ifdef HAS_LongLong IdlLongLongVal AddExpr::evalAsLongLongV() { IdlLongLongVal a = a_->evalAsLongLongV(); IdlLongLongVal b = b_->evalAsLongLongV(); switch ((a.negative ? 1:0) + (b.negative ? 2:0)) { case 0: { IDL_ULongLong r = a.u + b.u; if (r < a.u) goto overflow; return IdlLongLongVal(r); } case 1: { if (IDL_ULongLong(-a.s) < b.u) return IdlLongLongVal(b.u - IDL_ULongLong(-a.s)); else return IdlLongLongVal(a.s + IDL_LongLong(b.u)); } case 2: { if (IDL_ULongLong(-b.s) < a.u) return IdlLongLongVal(a.u - IDL_ULongLong(-b.s)); else return IdlLongLongVal(IDL_LongLong(a.u) + b.s); } case 3: { IDL_LongLong r = a.s + b.s; if (r > a.s) goto overflow; return IdlLongLongVal(r); } } overflow: IdlError(file(), line(), "Result of addition overflows"); return a; } #endif #define ADD_EXPR_EVAL_F(ret, op, str) \ ret AddExpr::op() { \ ret a, b, r; \ a = a_->op(); b = b_->op(); \ r = a+b; \ if (IdlFPOverflow(r)) { \ IdlError(file(), line(), "Result of addition overflows " str); \ r = 1.0; \ } \ return r; \ } ADD_EXPR_EVAL_F(IDL_Float, evalAsFloat, "float") ADD_EXPR_EVAL_F(IDL_Double, evalAsDouble, "double") #ifdef HAS_LongDouble ADD_EXPR_EVAL_F(IDL_LongDouble, evalAsLongDouble, "long double") #endif IDL_Fixed* AddExpr::evalAsFixed() { IDL_Fixed *a, *b, *r; a = a_->evalAsFixed(); b = b_->evalAsFixed(); try { r = new IDL_Fixed(*a + *b); } catch (IDL_Fixed::Overflow&) { IdlError(file(), line(), "Result of addition overflows fixed digits"); r = new IDL_Fixed("1"); } delete a; delete b; return r; } // Sub IdlLongVal SubExpr::evalAsLongV() { IdlLongVal a = a_->evalAsLongV(); IdlLongVal b = b_->evalAsLongV(); switch ((a.negative ? 1:0) + (b.negative ? 2:0)) { case 0: { if (a.u >= b.u) return IdlLongVal(a.u - b.u); IDL_ULong mr = b.u - a.u; if (mr > 0x80000000) goto overflow; return IdlLongVal(IDL_Long(-mr)); } case 1: { IDL_ULong mr = IDL_ULong(-a.s) + b.s; if (mr > 0x80000000) goto overflow; return IdlLongVal(IDL_Long(-mr)); } case 2: { IDL_ULong r = a.u + IDL_ULong(-b.s); if (r < a.u) goto overflow; return IdlLongVal(r); } case 3: { IDL_Long r = a.s - b.s; if (r > a.s) goto overflow; return IdlLongVal(r); } } overflow: IdlError(file(), line(), "Result of subtraction overflows"); return a; } #ifdef HAS_LongLong IdlLongLongVal SubExpr::evalAsLongLongV() { IdlLongLongVal a = a_->evalAsLongLongV(); IdlLongLongVal b = b_->evalAsLongLongV(); switch ((a.negative ? 1:0) + (b.negative ? 2:0)) { case 0: { if (a.u >= b.u) return IdlLongLongVal(a.u - b.u); IDL_ULongLong mr = b.u - a.u; if (mr > _CORBA_LONGLONG_CONST(0x8000000000000000)) goto overflow; return IdlLongLongVal(IDL_LongLong(-mr)); } case 1: { IDL_ULongLong mr = IDL_ULongLong(-a.s) + b.s; if (mr > _CORBA_LONGLONG_CONST(0x8000000000000000)) goto overflow; return IdlLongLongVal(IDL_LongLong(-mr)); } case 2: { IDL_ULongLong r = a.u + IDL_ULongLong(-b.s); if (r < a.u) goto overflow; return IdlLongLongVal(r); } case 3: { IDL_LongLong r = a.s - b.s; if (r > a.s) goto overflow; return IdlLongLongVal(r); } } overflow: IdlError(file(), line(), "Result of subtraction overflows"); return a; } #endif #define SUB_EXPR_EVAL_F(ret, op, str) \ ret SubExpr::op() { \ ret a, b, r; \ a = a_->op(); b = b_->op(); \ r = a-b; \ if (IdlFPOverflow(r)) { \ IdlError(file(), line(), "Sub-expression overflows " str); \ r = 1.0; \ } \ return r; \ } SUB_EXPR_EVAL_F(IDL_Float, evalAsFloat, "float") SUB_EXPR_EVAL_F(IDL_Double, evalAsDouble, "double") #ifdef HAS_LongDouble SUB_EXPR_EVAL_F(IDL_LongDouble, evalAsLongDouble, "long double") #endif IDL_Fixed* SubExpr::evalAsFixed() { IDL_Fixed *a, *b, *r; a = a_->evalAsFixed(); b = b_->evalAsFixed(); try { r = new IDL_Fixed(*a - *b); } catch (IDL_Fixed::Overflow&) { IdlError(file(), line(), "Sub-expression overflows fixed digits"); r = new IDL_Fixed("1"); } delete a; delete b; return r; } // Mult IdlLongVal MultExpr::evalAsLongV() { IdlLongVal a = a_->evalAsLongV(); IdlLongVal b = b_->evalAsLongV(); switch ((a.negative ? 1:0) + (b.negative ? 2:0)) { case 0: { IDL_ULong r = a.u * b.u; if (b.u != 0 && (r / b.u) != a.u) goto overflow; return IdlLongVal(r); } case 1: { IDL_Long r = a.s * IDL_Long(b.u); if (b.u != 0 && (r / IDL_Long(b.u)) != a.s) goto overflow; return IdlLongVal(r); } case 2: { IDL_Long r = IDL_Long(a.u) * b.s; if (b.s != 0 && (r / b.s) != IDL_Long(a.u)) goto overflow; return IdlLongVal(r); } case 3: { IDL_ULong r = IDL_ULong(-a.s) * IDL_ULong(-b.s); if (b.s != 0 && (r / IDL_ULong(-b.s)) != IDL_ULong(-a.s)) goto overflow; return IdlLongVal(r); } } overflow: IdlError(file(), line(), "Result of multiplication overflows"); return a; } #ifdef HAS_LongLong IdlLongLongVal MultExpr::evalAsLongLongV() { IdlLongLongVal a = a_->evalAsLongLongV(); IdlLongLongVal b = b_->evalAsLongLongV(); switch ((a.negative ? 1:0) + (b.negative ? 2:0)) { case 0: { IDL_ULongLong r = a.u * b.u; if (b.u != 0 && (r / b.u) != a.u) goto overflow; return IdlLongLongVal(r); } case 1: { IDL_LongLong r = a.s * IDL_LongLong(b.u); if (b.u != 0 && (r / IDL_LongLong(b.u)) != a.s) goto overflow; return IdlLongLongVal(r); } case 2: { IDL_LongLong r = IDL_LongLong(a.u) * b.s; if (b.s != 0 && (r / b.s) != IDL_LongLong(a.u)) goto overflow; return IdlLongLongVal(r); } case 3: { IDL_ULongLong r = IDL_ULongLong(-a.s) * IDL_ULongLong(-b.s); if (b.s != 0 && (r / IDL_ULongLong(-b.s)) != IDL_ULongLong(-a.s)) goto overflow; return IdlLongLongVal(r); } } overflow: IdlError(file(), line(), "Result of multiplication overflows"); return a; } #endif #define MULT_EXPR_EVAL_F(ret, op, str) \ ret MultExpr::op() { \ ret a, b, r; \ a = a_->op(); b = b_->op(); \ r = a*b; \ if (IdlFPOverflow(r)) { \ IdlError(file(), line(), "Sub-expression overflows " str); \ r = 1.0; \ } \ return r; \ } MULT_EXPR_EVAL_F(IDL_Float, evalAsFloat, "float") MULT_EXPR_EVAL_F(IDL_Double, evalAsDouble, "double") #ifdef HAS_LongDouble MULT_EXPR_EVAL_F(IDL_LongDouble, evalAsLongDouble, "long double") #endif IDL_Fixed* MultExpr::evalAsFixed() { IDL_Fixed *a, *b, *r; a = a_->evalAsFixed(); b = b_->evalAsFixed(); try { r = new IDL_Fixed(*a * *b); } catch (IDL_Fixed::Overflow&) { IdlError(file(), line(), "Sub-expression overflows fixed digits"); r = new IDL_Fixed("1"); } delete a; delete b; return r; } // Div IdlLongVal DivExpr::evalAsLongV() { IdlLongVal a = a_->evalAsLongV(); IdlLongVal b = b_->evalAsLongV(); if (b.u == 0) { IdlError(file(), line(), "Divide by zero"); return a; } switch ((a.negative ? 1:0) + (b.negative ? 2:0)) { case 0: { return IdlLongVal(a.u / b.u); } case 1: { IDL_ULong mr = IDL_ULong(-a.s) / b.u; return IdlLongVal(IDL_Long(-mr)); } case 2: { IDL_ULong mr = a.u / IDL_ULong(-b.s); if (mr > 0x80000000) goto overflow; return IdlLongVal(IDL_Long(-mr)); } case 3: { IDL_ULong r = IDL_ULong(-a.s) / IDL_ULong(-b.s); return IdlLongVal(r); } } overflow: IdlError(file(), line(), "Result of division overflows"); return a; } #ifdef HAS_LongLong IdlLongLongVal DivExpr::evalAsLongLongV() { IdlLongLongVal a = a_->evalAsLongLongV(); IdlLongLongVal b = b_->evalAsLongLongV(); if (b.u == 0) { IdlError(file(), line(), "Divide by zero"); return a; } switch ((a.negative ? 1:0) + (b.negative ? 2:0)) { case 0: { return IdlLongLongVal(a.u / b.u); } case 1: { IDL_ULongLong mr = IDL_ULongLong(-a.s) / b.u; return IdlLongLongVal(IDL_LongLong(-mr)); } case 2: { IDL_ULongLong mr = a.u / IDL_ULongLong(-b.s); if (mr > _CORBA_LONGLONG_CONST(0x8000000000000000)) goto overflow; return IdlLongLongVal(IDL_LongLong(-mr)); } case 3: { IDL_ULongLong r = IDL_ULongLong(-a.s) / IDL_ULongLong(-b.s); return IdlLongLongVal(r); } } overflow: IdlError(file(), line(), "Result of division overflows"); return a; } #endif #define DIV_EXPR_EVAL_F(ret, op, str) \ ret DivExpr::op() { \ ret a, b, r; \ a = a_->op(); b = b_->op(); \ if (b == 0.0) { \ IdlError(file(), line(), "Divide by zero"); \ b = 1.0; \ } \ r = a/b; \ if (IdlFPOverflow(r)) { \ IdlError(file(), line(), "Sub-expression overflows " str); \ r = 1.0; \ } \ return r; \ } DIV_EXPR_EVAL_F(IDL_Float, evalAsFloat, "float") DIV_EXPR_EVAL_F(IDL_Double, evalAsDouble, "double") #ifdef HAS_LongDouble DIV_EXPR_EVAL_F(IDL_LongDouble, evalAsLongDouble, "long double") #endif IDL_Fixed* DivExpr::evalAsFixed() { IDL_Fixed *a, *b, *r; a = a_->evalAsFixed(); b = b_->evalAsFixed(); try { r = new IDL_Fixed(*a / *b); } catch (IDL_Fixed::Overflow&) { IdlError(file(), line(), "Sub-expression overflows fixed digits"); r = new IDL_Fixed("1"); } catch (IDL_Fixed::DivideByZero&) { IdlError(file(), line(), "Divide by zero"); r = new IDL_Fixed("1"); } delete a; delete b; return r; } // Invert IdlLongVal InvertExpr::evalAsLongV() { IdlLongVal e = e_->evalAsLongV(); return IdlLongVal(~e.u); } #ifdef HAS_LongLong IdlLongLongVal InvertExpr::evalAsLongLongV() { IdlLongLongVal e = e_->evalAsLongLongV(); return IdlLongLongVal(~e.u); } #endif // Minus IdlLongVal MinusExpr::evalAsLongV() { IdlLongVal e = e_->evalAsLongV(); if (e.negative) return IdlLongVal(IDL_ULong(-e.s)); else { if (e.u > 0x80000000) IdlError(file(), line(), "Result of unary minus overflows"); return IdlLongVal(IDL_Long(-e.u)); } } #ifdef HAS_LongLong IdlLongLongVal MinusExpr::evalAsLongLongV() { IdlLongLongVal e = e_->evalAsLongLongV(); if (e.negative) return IdlLongLongVal(IDL_ULongLong(-e.s)); else { if (e.u > _CORBA_LONGLONG_CONST(0x8000000000000000)) IdlError(file(), line(), "Result of unary minus overflows"); return IdlLongLongVal(IDL_LongLong(-e.u)); } } #endif #define MINUS_EXPR_EVAL(ret, op) \ ret MinusExpr::op() { \ return -(e_->op()); \ } MINUS_EXPR_EVAL(IDL_Float, evalAsFloat) MINUS_EXPR_EVAL(IDL_Double, evalAsDouble) #ifdef HAS_LongDouble MINUS_EXPR_EVAL(IDL_LongDouble, evalAsLongDouble) #endif IDL_Fixed* MinusExpr::evalAsFixed() { IDL_Fixed* r = new IDL_Fixed(- *(e_->evalAsFixed())); delete e_->evalAsFixed(); return r; } // Plus #define PLUS_EXPR_EVAL(ret, op) \ ret PlusExpr::op() { \ return e_->op(); \ } PLUS_EXPR_EVAL(IdlLongVal, evalAsLongV) #ifdef HAS_LongLong PLUS_EXPR_EVAL(IdlLongLongVal, evalAsLongLongV) #endif PLUS_EXPR_EVAL(IDL_Float, evalAsFloat) PLUS_EXPR_EVAL(IDL_Double, evalAsDouble) #ifdef HAS_LongDouble PLUS_EXPR_EVAL(IDL_LongDouble, evalAsLongDouble) #endif PLUS_EXPR_EVAL(IDL_Fixed*, evalAsFixed) synopsis-0.12/Synopsis/Parsers/IDL/idlsysdep.h0000664000076400007640000001057011104703261020704 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlsysdep.h Created on: 1999/11/04 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // System dependencies // $Id: idlsysdep.h,v 1.8.2.2 2005/01/06 23:11:14 dgrisby Exp $ // $Log: idlsysdep.h,v $ // Revision 1.8.2.2 2005/01/06 23:11:14 dgrisby // Big merge from omni4_0_develop. // // Revision 1.8.2.1 2003/03/23 21:01:44 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.4.2.5 2002/02/01 11:22:06 dpg1 // strcasecmp/stricmp redefinition on Windows. // // Revision 1.4.2.4 2002/01/15 16:38:14 dpg1 // On the road to autoconf. Dependencies refactored, configure.ac // written. No makefiles yet. // // Revision 1.4.2.3 2001/06/08 17:12:24 dpg1 // Merge all the bug fixes from omni3_develop. // // Revision 1.4.2.2 2000/10/27 16:31:10 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.4.2.1 2000/07/17 10:36:05 sll // Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0. // // Revision 1.5 2000/07/13 15:25:52 dpg1 // Merge from omni3_develop for 3.0 release. // // Revision 1.2 1999/11/09 12:41:40 dpg1 // strcasecmp changes for NT, AIX. // // Revision 1.1 1999/11/05 09:43:01 dpg1 // Changes for NT. // #ifndef _idlsysdep_h_ #define _idlsysdep_h_ // #define USE_omniORB_logStream // #include #include // As usual, Windows manages to be different... #ifdef __WIN32__ // declspec is a define in windef.h under MINGW #ifdef __MINGW32__ # define DLL_EXPORT __attribute__((dllexport)) #else # define DLL_EXPORT _declspec(dllexport) #endif #else # define DLL_EXPORT # include #endif #ifdef HAS_Cplusplus_Bool typedef bool IDL_Boolean; #else typedef unsigned char IDL_Boolean; #endif typedef unsigned char IDL_Char; typedef unsigned char IDL_Octet; typedef short IDL_Short; typedef unsigned short IDL_UShort; typedef unsigned short IDL_WChar; #if SIZEOF_LONG == 4 typedef long IDL_Long; typedef unsigned long IDL_ULong; #elif SIZEOF_INT == 4 typedef int IDL_Long; typedef unsigned int IDL_ULong; #else # error "Can't map Long (32 bits) to a native type." #endif #ifdef HAS_LongLong typedef _CORBA_LONGLONG_DECL IDL_LongLong; typedef _CORBA_ULONGLONG_DECL IDL_ULongLong; #endif #ifndef NO_FLOAT #ifndef __VAX // This platform uses IEEE float typedef float IDL_Float; typedef double IDL_Double; #ifdef HAS_LongDouble typedef _CORBA_LONGDOUBLE_DECL IDL_LongDouble; #endif #else // VAX float test // VAX uses proxies for float. #define USING_PROXY_FLOAT class IDL_Float { IDL_Long pd_f; void cvt_(float f); float cvt_() const; public: // using compiler generated copy constructor and copy assignment inline IDL_Float() {cvt_(0.0f);} inline IDL_Float(float f) {cvt_(f);} inline operator float() const {return cvt_();} }; class IDL_Double { IDL_Long pd_d[2]; void cvt_(double d); double cvt_() const; public: // using compiler generated copy constructor and copy assignment inline IDL_Double() {cvt_(0.0);} inline IDL_Double(double d) {cvt_(d);} inline operator double() const {return cvt_();} }; #undef cvt_ // Assume long double type is compatible with the CORBA standard. #ifdef HAS_LongDouble typedef _CORBA_LONGDOUBLE_DECL IDL_LongDouble; #endif #endif // VAX float test #endif // !defined(NO_FLOAT) #endif // _idlsysdep_h_ synopsis-0.12/Synopsis/Parsers/IDL/idlerr.cc0000664000076400007640000001037711104703261020330 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlerr.cc Created on: 1999/10/11 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // IDL compiler error handling // $Id: idlerr.cc,v 1.8.2.1 2003/03/23 21:01:46 dgrisby Exp $ // $Log: idlerr.cc,v $ // Revision 1.8.2.1 2003/03/23 21:01:46 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.5.2.2 2000/10/27 16:31:08 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.5.2.1 2000/07/17 10:36:03 sll // Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0. // // Revision 1.6 2000/07/13 15:25:53 dpg1 // Merge from omni3_develop for 3.0 release. // // Revision 1.3.2.1 2000/03/06 15:03:48 dpg1 // Minor bug fixes to omniidl. New -nf and -k flags. // // Revision 1.3 1999/11/02 17:07:27 dpg1 // Changes to compile on Solaris. // // Revision 1.2 1999/10/29 15:43:44 dpg1 // Error counts now reset when Report...() is called. // // Revision 1.1 1999/10/27 14:05:58 dpg1 // *** empty log message *** // #include #include #include #include #include #include #include int errorCount = 0; int warningCount = 0; void IdlError(const char* file, int line, const char* fmt ...) { errorCount++; if (!Config::quiet) { fprintf(stderr, "%s:%d: ", file, line); va_list args; va_start(args, fmt); vfprintf(stderr, fmt, args); va_end(args); fprintf(stderr, "\n"); } } void IdlErrorCont(const char* file, int line, const char* fmt ...) { if (!Config::quiet) { fprintf(stderr, "%s:%d: ", file, line); va_list args; va_start(args, fmt); vfprintf(stderr, fmt, args); va_end(args); fprintf(stderr, "\n"); } } void IdlSyntaxError(const char* file, int line, const char* mesg) { static char* lastFile = idl_strdup(""); static int lastLine = 0; static char* lastMesg = idl_strdup(""); if (line != lastLine || strcmp(file, lastFile) || strcmp(mesg, lastMesg)) { lastLine = line; if (strcmp(file, lastFile)) { delete [] lastFile; lastFile = idl_strdup(file); } if (strcmp(mesg, lastMesg)) { delete [] lastMesg; lastMesg = idl_strdup(mesg); } IdlError(file, line, mesg); } } void IdlWarning(const char* file, int line, const char* fmt ...) { warningCount++; if (!Config::quiet) { fprintf(stderr, "%s:%d: Warning: ", file, line); va_list args; va_start(args, fmt); vfprintf(stderr, fmt, args); va_end(args); fprintf(stderr, "\n"); } } void IdlWarningCont(const char* file, int line, const char* fmt ...) { if (!Config::quiet) { fprintf(stderr, "%s:%d: Warning: ", file, line); va_list args; va_start(args, fmt); vfprintf(stderr, fmt, args); va_end(args); fprintf(stderr, "\n"); } } IDL_Boolean IdlReportErrors() { if (!Config::quiet) { if (errorCount > 0 || warningCount > 0) fprintf(stderr, "omniidl: "); if (errorCount > 0) fprintf(stderr, "%d error%s", errorCount, errorCount == 1 ? "" : "s"); if (errorCount > 0 && warningCount > 0) fprintf(stderr, " and "); if (warningCount > 0) fprintf(stderr, "%d warning%s", warningCount, warningCount == 1 ? "" : "s"); if (errorCount > 0 || warningCount > 0) fprintf(stderr, ".\n"); } IDL_Boolean ret = (errorCount == 0); errorCount = 0; warningCount = 0; return ret; } synopsis-0.12/Synopsis/Parsers/IDL/idlast.cc0000664000076400007640000023012611104703261020323 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlast.cc Created on: 1999/10/20 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Abstract Syntax Tree objects and support functions // $Id: idlast.cc,v 1.22.2.4 2005/05/10 22:07:31 dgrisby Exp $ // $Log: idlast.cc,v $ // Revision 1.22.2.4 2005/05/10 22:07:31 dgrisby // Merge again. // // Revision 1.22.2.3 2004/02/16 10:10:33 dgrisby // More valuetype, including value boxes. C++ mapping updates. // // Revision 1.22.2.2 2003/09/04 14:00:24 dgrisby // ValueType IDL updates. // // Revision 1.22.2.1 2003/03/23 21:01:48 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.16.2.12 2002/04/30 14:59:37 dgrisby // omniidl segfault when checking a non-existent identifier is not a forward. // // Revision 1.16.2.11 2001/11/08 16:31:20 dpg1 // Minor tweaks. // // Revision 1.16.2.10 2001/10/29 17:42:42 dpg1 // Support forward-declared structs/unions, ORB::create_recursive_tc(). // // Revision 1.16.2.9 2001/10/17 16:48:32 dpg1 // Minor error message tweaks // // Revision 1.16.2.8 2001/08/29 11:55:22 dpg1 // Enumerator nodes record their value. // // Revision 1.16.2.7 2001/06/12 11:35:25 dpg1 // Minor omniidl tweaks for valuetype. // // Revision 1.16.2.6 2001/06/08 17:12:22 dpg1 // Merge all the bug fixes from omni3_develop. // // Revision 1.16.2.5 2001/03/13 10:32:11 dpg1 // Fixed point support. // // Revision 1.16.2.4 2000/11/01 12:45:56 dpg1 // Update to CORBA 2.4 specification. // // Revision 1.16.2.3 2000/10/27 16:31:08 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.16.2.2 2000/10/10 10:18:50 dpg1 // Update omniidl front-end from omni3_develop. // // Revision 1.14.2.9 2000/08/29 10:20:26 dpg1 // Operations and attributes now have repository ids. // // Revision 1.14.2.8 2000/08/25 13:33:02 dpg1 // Multiple comments preceding a declaration are now properly attached on // all platforms // // Revision 1.14.2.7 2000/08/07 15:34:36 dpg1 // Partial back-port of long long from omni3_1_develop. // // Revision 1.14.2.6 2000/07/26 10:59:14 dpg1 // Incorrect error report when inheriting typedef to forward declared // interface // // Revision 1.14.2.5 2000/06/08 14:36:19 dpg1 // Comments and pragmas are now objects rather than plain strings, so // they can have file,line associated with them. // // Revision 1.14.2.4 2000/06/05 18:13:26 dpg1 // Comments can be attached to subsequent declarations (with -K). Better // idea of most recent decl in operation declarations // // Revision 1.14.2.3 2000/03/16 17:35:21 dpg1 // Bug with comments in input when keepComments is false. // // Revision 1.14.2.2 2000/03/07 10:31:26 dpg1 // More sensible idea of the "most recent" declaration. // // Revision 1.14.2.1 2000/03/06 15:03:49 dpg1 // Minor bug fixes to omniidl. New -nf and -k flags. // // Revision 1.14 2000/02/03 14:50:07 dpg1 // Native declarations can now be used as types. // // Revision 1.13 2000/01/05 11:21:08 dpg1 // Removed warning about signed/unsigned comparison. // * can only be the last character of a context key. // // Revision 1.12 1999/12/28 18:15:45 dpg1 // Bounds of string constants now checked. // // Revision 1.11 1999/11/30 18:06:19 dpg1 // Alias dereferencing bugs. // // Revision 1.10 1999/11/22 11:07:46 dpg1 // Correctly report error with interface which tries to inherit from // CORBA::Object. // // Revision 1.9 1999/11/17 17:17:00 dpg1 // Changes to remove static initialisation of objects. // // Revision 1.8 1999/11/04 17:15:52 dpg1 // Typo. // // Revision 1.7 1999/11/02 17:07:27 dpg1 // Changes to compile on Solaris. // // Revision 1.6 1999/11/01 20:19:57 dpg1 // Support for union switch types declared inside the switch statement. // // Revision 1.5 1999/11/01 16:38:40 dpg1 // Missed an update when adding recursive union detection. // // Revision 1.4 1999/11/01 10:05:00 dpg1 // New file attribute to AST. // // Revision 1.3 1999/10/29 15:42:43 dpg1 // DeclaredType() now takes extra DeclRepoId* argument. // Code to detect recursive structs and unions. // // Revision 1.2 1999/10/29 10:00:43 dpg1 // Added code to find a value for the default case in a union. // // Revision 1.1 1999/10/27 14:05:59 dpg1 // *** empty log message *** // #include #include #include #include #include #include #include // Globals from lexer extern FILE* yyin; extern char* currentFile; extern int yylineno; AST* AST::tree_ = 0; Decl* Decl::mostRecent_ = 0; Comment* Comment::mostRecent_ = 0; Comment* Comment::saved_ = 0; // Static error message functions static void checkNotForward(const char* file, int line, IdlType* t) { if (!t) return; if (t->kind() == IdlType::ot_structforward) { StructForward* f = (StructForward*)((DeclaredType*)t)->decl(); if (!f->definition()) { char* ssn = f->scopedName()->toString(); IdlError(file, line, "Cannot use forward-declared struct '%s' before it is " "fully defined", ssn); IdlErrorCont(f->file(), f->line(), "('%s' forward-declared here)", f->identifier()); delete [] ssn; } } else if (t->kind() == IdlType::ot_unionforward) { UnionForward* f = (UnionForward*)((DeclaredType*)t)->decl(); if (!f->definition()) { char* ssn = f->scopedName()->toString(); IdlError(file, line, "Cannot use forward-declared union '%s' before it is " "fully defined", ssn); IdlErrorCont(f->file(), f->line(), "('%s' forward-declared here)", f->identifier()); delete [] ssn; } } } static void checkValidType(const char* file, int line, IdlType* t) { t = t->unalias(); if (!t) return; // Ignore if earlier errors. checkNotForward(file, line, t); if (t && t->kind() == IdlType::tk_sequence) { while (t && t->kind() == IdlType::tk_sequence) t = ((SequenceType*)t)->seqType()->unalias(); checkNotForward(file, line, t); } } // Pragma void Pragma:: add(const char* pragmaText, const char* file, int line) { if (Decl::mostRecent()) Decl::mostRecent()->addPragma(pragmaText, file, line); else AST::tree()->addPragma(pragmaText, file, line); } // Comment void Comment:: add(const char* commentText, const char* file, int line) { if (Config::keepComments) { if (Config::commentsFirst) { if (saved_) { // C++ says that the order of value evaluation is undefined. // Comment's constructor sets mostRecent_, so the innocent- // looking mostRecent_->next_ = new Comment... does the wrong // thing with some compilers :-( Comment* mr = mostRecent_; mr->next_ = new Comment(commentText, file, line); } else saved_ = new Comment(commentText, file, line); } else { if (Decl::mostRecent()) Decl::mostRecent()->addComment(commentText, file, line); else AST::tree()->addComment(commentText, file, line); } } } void Comment:: append(const char* commentText) { if (Config::keepComments) { assert(mostRecent_ != 0); char* newText = new char[(strlen(mostRecent_->commentText_) + strlen(commentText) + 1)]; strcpy(newText, mostRecent_->commentText_); strcat(newText, commentText); delete [] mostRecent_->commentText_; mostRecent_->commentText_ = newText; } } Comment* Comment:: grabSaved() { Comment* ret = saved_; saved_ = 0; return ret; } // AST AST::AST() : declarations_(0), file_(0), pragmas_(0), lastPragma_(0), comments_(0), lastComment_(0) {} AST::~AST() { if (declarations_) delete declarations_; if (file_) delete [] file_; if (pragmas_) delete pragmas_; if (comments_) delete comments_; } void AST:: addPragma(const char* pragmaText, const char* file, int line) { Pragma* p = new Pragma(pragmaText, file, line); if (pragmas_) lastPragma_->next_ = p; else pragmas_ = p; lastPragma_ = p; } void AST:: addComment(const char* commentText, const char* file, int line) { Comment* p = new Comment(commentText, file, line); if (comments_) lastComment_->next_ = p; else comments_ = p; lastComment_ = p; } AST* AST:: tree() { if (!tree_) tree_ = new AST(); assert(tree_ != 0); return tree_; } IDL_Boolean AST:: process(FILE* f, const char* name) { IdlType::init(); Scope::init(); yyin = f; currentFile = idl_strdup(name); Prefix::newFile(); tree()->setFile(name); int yr = yyparse(); if (yr) IdlError(currentFile, yylineno, "Syntax error"); if (Config::keepComments && Config::commentsFirst) tree()->comments_ = Comment::grabSaved(); Prefix::endOuterFile(); return IdlReportErrors(); } void AST:: clear() { if (tree_) { delete tree_; tree_ = 0; } Scope::clear(); Decl::clear(); Comment::clear(); } void AST:: setFile(const char* file) { if (file_) { if (!strcmp(file_, file)) return; delete [] file_; } file_ = idl_strdup(file); } void AST:: setDeclarations(Decl* d) { assert(declarations_ == 0); declarations_ = d; // Validate the declarations AstValidateVisitor v; accept(v); } // Base Decl Decl:: Decl(Kind kind, const char* file, int line, IDL_Boolean mainFile) : kind_(kind), file_(idl_strdup(file)), line_(line), mainFile_(mainFile), inScope_(Scope::current()), pragmas_(0), lastPragma_(0), comments_(0), lastComment_(0), next_(0) { last_ = this; mostRecent_ = this; if (Config::keepComments && Config::commentsFirst) comments_ = Comment::grabSaved(); } Decl:: ~Decl() { if (file_) delete [] file_; if (pragmas_) delete pragmas_; if (comments_) delete comments_; if (next_) delete next_; } Decl* Decl:: scopedNameToDecl(const char* file, int line, const ScopedName* sn) { const Scope::Entry* se = Scope::current()->findScopedName(sn, file, line); if (se) { switch (se->kind()) { case Scope::Entry::E_MODULE: case Scope::Entry::E_DECL: case Scope::Entry::E_CALLABLE: case Scope::Entry::E_INHERITED: return se->decl(); default: { char* ssn = sn->toString(); IdlError(file, line, "'%s' is not a declaration", ssn); IdlErrorCont(se->file(), se->line(), "('%s' created here)", ssn); delete [] ssn; } } } return 0; } void Decl:: addPragma(const char* pragmaText, const char* file, int line) { Pragma* p = new Pragma(pragmaText, file, line); if (pragmas_) lastPragma_->next_ = p; else pragmas_ = p; lastPragma_ = p; } void Decl:: addComment(const char* commentText, const char* file, int line) { Comment* p = new Comment(commentText, file, line); if (comments_) lastComment_->next_ = p; else comments_ = p; lastComment_ = p; } // Module Module:: Module(const char* file, int line, IDL_Boolean mainFile, const char* identifier) : Decl(D_MODULE, file, line, mainFile), DeclRepoId(identifier), definitions_(0) { Scope* s = Scope::current()->newModuleScope(identifier, file, line); Scope::current()->addModule(identifier, s, this, file, line); Scope::startScope(s); Prefix::newScope(identifier); } Module:: ~Module() { if (definitions_) delete definitions_; } void Module:: finishConstruction(Decl* defs) { definitions_ = defs; Prefix::endScope(); Scope::endScope(); mostRecent_ = this; } // Interface InheritSpec:: InheritSpec(const ScopedName* sn, const char* file, int line) : interface_(0), decl_(0), scope_(0), next_(0) { const Scope::Entry* se = Scope::current()->findScopedName(sn, file, line); if (se) { if (se->kind() == Scope::Entry::E_DECL) { decl_ = se->decl(); IdlType* t = se->idltype()->unalias(); if (!t) return; if (t->kind() == IdlType::tk_objref || t->kind() == IdlType::tk_abstract_interface || t->kind() == IdlType::tk_local_interface) { Decl* d = ((DeclaredType*)t)->decl(); if (!d) { char* ssn = sn->toString(); IdlError(file, line, "Cannot inherit from CORBA::Object"); IdlErrorCont(se->file(), se->line(), "(accessed through typedef '%s')", ssn); delete [] ssn; return; } else if (d->kind() == Decl::D_INTERFACE) { interface_ = (Interface*)d; scope_ = interface_->scope(); return; } else if (d->kind() == Decl::D_FORWARD) { Interface* def = ((Forward*)d)->definition(); if (def) { interface_ = def; scope_ = interface_->scope(); return; } else { char* ssn = ((Forward*)d)->scopedName()->toString(); IdlError(file, line, "Inherited interface '%s' must be fully defined", ssn); if (decl_ != d) { char* tssn = sn->toString(); IdlErrorCont(se->file(), se->line(), "('%s' reached through typedef '%s')", ssn, tssn); delete [] tssn; } IdlErrorCont(d->file(), d->line(), "('%s' forward declared here)", ssn); delete [] ssn; return; } } } } char* ssn = sn->toString(); IdlError(file, line, "'%s' used in inheritance specification is not an interface", ssn); IdlErrorCont(se->file(), se->line(), "('%s' declared here)", ssn); delete [] ssn; } } void InheritSpec:: append(InheritSpec* is, const char* file, int line) { InheritSpec *i, *last; if (is->interface()) { for (i=this; i; i = i->next_) { last = i; if (is->interface() == i->interface()) { char* ssn = is->interface()->scopedName()->toString(); IdlError(file, line, "Cannot specify '%s' as a direct base interface " "more than once", ssn); delete [] ssn; delete is; return; } } last->next_ = is; } } Interface:: Interface(const char* file, int line, IDL_Boolean mainFile, const char* identifier, IDL_Boolean abstract, IDL_Boolean local, InheritSpec* inherits) : Decl(D_INTERFACE, file, line, mainFile), DeclRepoId(identifier), abstract_(abstract), local_(local), inherits_(inherits), contents_(0) { // Look for forward interface Scope::Entry* se = Scope::current()->find(identifier); if (se && se->kind() == Scope::Entry::E_DECL && se->decl() && se->decl()->kind() == Decl::D_FORWARD) { Forward* f = (Forward*)se->decl(); if (strcmp(f->prefix(), prefix())) { IdlError(file, line, "In declaration of interface '%s', repository id " "prefix '%s' differs from that of forward declaration", identifier, prefix()); IdlErrorCont(f->file(), f->line(), "('%s' forward declared here with prefix '%s')", f->identifier(), f->prefix()); } if (abstract && !f->abstract()) { IdlError(file, line, "Declaration of abstract interface '%s' conflicts with " "forward declaration as non-abstract", identifier); IdlErrorCont(f->file(), f->line(), "('%s' forward declared as non-abstract here)"); } else if (!abstract && f->abstract()) { IdlError(file, line, "Declaration of non-abstract interface '%s' conflicts with " "forward declaration as abstract", identifier); IdlErrorCont(f->file(), f->line(), "('%s' forward declared as abstract here)"); } if (local && !f->local()) { IdlError(file, line, "Declaration of local interface '%s' conflicts with " "forward declaration as unconstrained", identifier); IdlErrorCont(f->file(), f->line(), "('%s' forward declared as unconstrained here)"); } else if (!local && f->local()) { IdlError(file, line, "Declaration of unconstrained interface '%s' conflicts with " "forward declaration as local", identifier); IdlErrorCont(f->file(), f->line(), "('%s' forward declared as local here)"); } if (f->repoIdSet()) setRepoId(f->repoId(), f->rifile(), f->riline()); f->setDefinition(this); Scope::current()->remEntry(se); } scope_ = Scope::current()->newInterfaceScope(identifier, file, line); if (abstract_) { thisType_ = new DeclaredType(IdlType::tk_abstract_interface, this, this); // Check that all inherited interfaces are abstract for (InheritSpec* inh = inherits; inh; inh = inh->next()) { if (!inh->interface()->abstract()) { char* ssn = inh->scope()->scopedName()->toString(); IdlError(file, line, "In declaration of abstract interface '%s', inherited " "interface '%s' is not abstract", identifier, ssn); IdlErrorCont(inh->interface()->file(), inh->interface()->line(), "(%s declared here)", ssn); delete [] ssn; } } } else if (local_) { thisType_ = new DeclaredType(IdlType::tk_local_interface, this, this); thisType_->setLocal(); } else { thisType_ = new DeclaredType(IdlType::tk_objref, this, this); // Check that all inherited interfaces are unconstrained for (InheritSpec* inh = inherits; inh; inh = inh->next()) { if (inh->interface() && inh->interface()->local()) { char* ssn = inh->scope()->scopedName()->toString(); IdlError(file, line, "In declaration of unconstrained interface '%s', inherited " "interface '%s' is local", identifier, ssn); IdlErrorCont(inh->interface()->file(), inh->interface()->line(), "(%s declared here)", ssn); delete [] ssn; } } } scope_->setInherited(inherits, file, line); Scope::current()->addDecl(identifier, scope_, this, thisType_, file, line); Scope::startScope(scope_); Prefix::newScope(identifier); } Interface:: ~Interface() { if (inherits_) delete inherits_; if (contents_) delete contents_; delete thisType_; } IDL_Boolean Interface::isDerived(const Interface* base) const { if (base == this) return 1; for (InheritSpec* is = inherits_; is; is = is->next()) { if (is->interface() == base || is->interface()->isDerived(base)) return 1; } return 0; } void Interface:: finishConstruction(Decl* decls) { contents_ = decls; Prefix::endScope(); Scope::endScope(); mostRecent_ = this; if (!local_) { for (Decl* d = decls; d; d = d->next()) { if (d->kind() == D_ATTRIBUTE) { Attribute* a = (Attribute*)d; if (a->attrType() && a->attrType()->local()) { DeclaredType* dt = (DeclaredType*)a->attrType(); assert(dt->declRepoId()); char* ssn = dt->declRepoId()->scopedName()->toString(); IdlError(a->file(), a->line(), "In unconstrained interface '%s', attribute '%s' has " "local type '%s'", identifier(), a->declarators()->identifier(), ssn); IdlErrorCont(dt->decl()->file(), dt->decl()->line(), "(%s declared here)", ssn); delete [] ssn; } } else if (d->kind() == D_OPERATION) { Operation* o = (Operation*)d; if (o->returnType() && o->returnType()->local()) { DeclaredType* dt = (DeclaredType*)o->returnType(); assert(dt->declRepoId()); char* ssn = dt->declRepoId()->scopedName()->toString(); IdlError(o->file(), o->line(), "In unconstrained interface '%s', operation '%s' has " "local return type '%s'", identifier(), o->identifier(), ssn); IdlErrorCont(dt->decl()->file(), dt->decl()->line(), "(%s declared here)", ssn); delete [] ssn; } for (Parameter* p = o->parameters(); p; p = (Parameter*)p->next()) { if (p->paramType() && p->paramType()->local()) { DeclaredType* dt = (DeclaredType*)p->paramType(); assert(dt->declRepoId()); char* ssn = dt->declRepoId()->scopedName()->toString(); IdlError(p->file(), p->line(), "In unconstrained interface '%s', operation '%s' has " "parameter '%s' with local type '%s'", identifier(), o->identifier(), p->identifier(), ssn); IdlErrorCont(dt->decl()->file(), dt->decl()->line(), "(%s declared here)", ssn); delete [] ssn; } } for (RaisesSpec* r = o->raises(); r; r = r->next()) { if (r->exception() && r->exception()->local()) { char* ssn = r->exception()->scopedName()->toString(); IdlError(o->file(), o->line(), "In unconstrained interface '%s', operation '%s' raises " "local exception '%s'", identifier(), o->identifier(), ssn); IdlErrorCont(r->exception()->file(), r->exception()->line(), "(%s declared here)", ssn); delete [] ssn; } } } } } } // Forward Forward:: Forward(const char* file, int line, IDL_Boolean mainFile, const char* identifier, IDL_Boolean abstract, IDL_Boolean local) : Decl(D_FORWARD, file, line, mainFile), DeclRepoId(identifier), abstract_(abstract), local_(local), definition_(0), firstForward_(0), thisType_(0) { Scope::Entry* se = Scope::current()->find(identifier); IDL_Boolean reg = 1; if (se && se->kind() == Scope::Entry::E_DECL) { if (se->decl()->kind() == D_INTERFACE) { Interface* i = (Interface*)se->decl(); definition_ = i; if (strcmp(i->prefix(), prefix())) { IdlError(file, line, "In forward declaration of interface '%s', repository " "id prefix '%s' differs from that of earlier declaration", identifier, prefix()); IdlErrorCont(i->file(), i->line(), "('%s' fully declared here with prefix '%s')", i->identifier(), i->prefix()); } if (abstract && !i->abstract()) { IdlError(file, line, "Forward declaration of abstract interface '%s' conflicts " "with earlier full declaration as non-abstract", identifier); IdlErrorCont(i->file(), i->line(), "('%s' declared as non-abstract here)"); } else if (!abstract && i->abstract()) { IdlError(file, line, "Forward declaration of non-abstract interface '%s' " "conflicts with earlier full declaration as abstract", identifier); IdlErrorCont(i->file(), i->line(), "('%s' declared as abstract here)"); } if (local && !i->local()) { IdlError(file, line, "Forward declaration of local interface '%s' conflicts " "with earlier full declaration as unconstrained", identifier); IdlErrorCont(i->file(), i->line(), "('%s' declared as unconstrained here)"); } else if (!local && i->local()) { IdlError(file, line, "Forward declaration of unconstrained interface '%s' " "conflicts with earlier full declaration as local", identifier); IdlErrorCont(i->file(), i->line(), "('%s' declared as abstract here)"); } reg = 0; } else if (se->decl()->kind() == D_FORWARD) { Forward* f = (Forward*)se->decl(); firstForward_ = f; if (strcmp(f->prefix(), prefix())) { IdlError(file, line, "In forward declaration of interface '%s', repository " "id prefix '%s' differs from that of earlier declaration", identifier, prefix()); IdlErrorCont(f->file(), f->line(), "('%s' forward declared here with prefix '%s')", f->identifier(), f->prefix()); } if (abstract && !f->abstract()) { IdlError(file, line, "Forward declaration of abstract interface '%s' conflicts " "with earlier forward declaration as non-abstract", identifier); IdlErrorCont(f->file(), f->line(), "('%s' forward declared as non-abstract here)"); } else if (!abstract && f->abstract()) { IdlError(file, line, "Forward declaration of non-abstract interface '%s' " "conflicts with earlier forward declaration as abstract", identifier); IdlErrorCont(f->file(), f->line(), "('%s' forward declared as abstract here)"); } if (local && !f->local()) { IdlError(file, line, "Forward declaration of local interface '%s' conflicts " "with earlier forward declaration as unconstrained", identifier); IdlErrorCont(f->file(), f->line(), "('%s' forward declared as unconstrained here)"); } else if (!local && f->local()) { IdlError(file, line, "Forward declaration of unconstrained interface '%s' " "conflicts with earlier forward declaration as local", identifier); IdlErrorCont(f->file(), f->line(), "('%s' forward declared as local here)"); } //***? if (f->repoIdSet()) setRepoId(f->repoId(), f->rifile(), f->riline()); reg = 0; } } if (reg) { if (abstract) { thisType_ = new DeclaredType(IdlType::tk_abstract_interface, this, this); } else if (local) { thisType_ = new DeclaredType(IdlType::tk_local_interface, this, this); thisType_->setLocal(); } else { thisType_ = new DeclaredType(IdlType::tk_objref, this, this); } Scope::current()->addDecl(identifier, 0, this, thisType_, file, line); } } Forward:: ~Forward() { delete thisType_; } Interface* Forward:: definition() const { if (firstForward_) return firstForward_->definition(); else return definition_; } void Forward:: setDefinition(Interface* defn) { definition_ = defn; } // Const Const:: Const(const char* file, int line, IDL_Boolean mainFile, IdlType* constType, const char* identifier, IdlExpr* expr) : Decl(D_CONST, file, line, mainFile), DeclRepoId(identifier), constType_(constType) { if (constType) delType_ = constType->shouldDelete(); else delType_ = 0; if (!constType || !expr) return; // Ignore nulls due to earlier errors IdlType* t = constType->unalias(); if (!t) { // Broken alias due to earlier error constKind_ = IdlType::tk_null; delete expr; return; } constKind_ = t->kind(); switch (constKind_) { case IdlType::tk_short: v_.short_ = expr->evalAsShort(); break; case IdlType::tk_long: v_.long_ = expr->evalAsLong(); break; case IdlType::tk_ushort: v_.ushort_ = expr->evalAsUShort(); break; case IdlType::tk_ulong: v_.ulong_ = expr->evalAsULong(); break; case IdlType::tk_float: v_.float_ = expr->evalAsFloat(); break; case IdlType::tk_double: v_.double_ = expr->evalAsDouble(); break; case IdlType::tk_boolean: v_.boolean_ = expr->evalAsBoolean(); break; case IdlType::tk_char: v_.char_ = expr->evalAsChar(); break; case IdlType::tk_octet: v_.octet_ = expr->evalAsOctet(); break; case IdlType::tk_string: { v_.string_ = idl_strdup(expr->evalAsString()); IDL_ULong bound = ((StringType*)t)->bound(); if (bound && strlen(v_.string_) > bound) { IdlError(file, line, "Length of bounded string constant exceeds bound"); } break; } #ifdef HAS_LongLong case IdlType::tk_longlong: v_.longlong_ = expr->evalAsLongLong(); break; case IdlType::tk_ulonglong: v_.ulonglong_ = expr->evalAsULongLong(); break; #endif #ifdef HAS_LongDouble case IdlType::tk_longdouble: v_.longdouble_ = expr->evalAsLongDouble();break; #endif case IdlType::tk_wchar: v_.wchar_ = expr->evalAsWChar(); break; case IdlType::tk_wstring: { v_.wstring_ = idl_wstrdup(expr->evalAsWString()); IDL_ULong bound = ((WStringType*)t)->bound(); if (bound && (unsigned)idl_wstrlen(v_.wstring_) > bound) { IdlError(file, line, "Length of bounded wide string constant exceeds bound"); } break; } case IdlType::tk_fixed: { IDL_Fixed* f = expr->evalAsFixed(); FixedType* ft = (FixedType*)t; if (ft->digits()) { // Check constant fits in the target type IDL_Fixed* g = new IDL_Fixed(f->truncate(ft->scale())); if (g->fixed_digits() > ft->digits()) { IdlError(file, line, "Fixed point constant has too many digits to " "fit fixed<%u,%u>", ft->digits(), ft->scale()); } else if (f->fixed_scale() > g->fixed_scale()) { IdlWarning(file, line, "Fixed point constant truncated to fit fixed<%u,%u>", ft->digits(), ft->scale()); } delete f; f = g; } v_.fixed_ = f; break; } case IdlType::tk_enum: v_.enumerator_ = expr->evalAsEnumerator((Enum*)((DeclaredType*)t)->decl()); break; default: IdlError(file, line, "Invalid type for constant: %s", t->kindAsString()); break; } delete expr; Scope::current()->addDecl(identifier, 0, this, constType, file, line); } Const:: ~Const() { if (constKind_ == IdlType::tk_string) delete [] v_.string_; if (constKind_ == IdlType::tk_wstring) delete [] v_.wstring_; if (constKind_ == IdlType::tk_fixed) delete v_.fixed_; if (delType_) delete constType_; } #define CONST_AS(rt, op, tk, un) \ rt Const::op() const { \ assert(constKind_ == IdlType::tk); \ return v_.un; \ } CONST_AS(IDL_Short, constAsShort, tk_short, short_) CONST_AS(IDL_Long, constAsLong, tk_long, long_) CONST_AS(IDL_UShort, constAsUShort, tk_ushort, ushort_) CONST_AS(IDL_ULong, constAsULong, tk_ulong, ulong_) CONST_AS(IDL_Float, constAsFloat, tk_float, float_) CONST_AS(IDL_Double, constAsDouble, tk_double, double_) CONST_AS(IDL_Boolean, constAsBoolean, tk_boolean, boolean_) CONST_AS(IDL_Char, constAsChar, tk_char, char_) CONST_AS(IDL_Octet, constAsOctet, tk_octet, octet_) CONST_AS(const char*, constAsString, tk_string, string_) #ifdef HAS_LongLong CONST_AS(IDL_LongLong, constAsLongLong, tk_longlong, longlong_) CONST_AS(IDL_ULongLong, constAsULongLong, tk_ulonglong, ulonglong_) #endif #ifdef HAS_LongDouble CONST_AS(IDL_LongDouble, constAsLongDouble, tk_longdouble, longdouble_) #endif CONST_AS(IDL_WChar, constAsWChar, tk_wchar, wchar_) CONST_AS(const IDL_WChar*, constAsWString, tk_wstring, wstring_) CONST_AS(Enumerator*, constAsEnumerator, tk_enum, enumerator_) IDL_Fixed* Const::constAsFixed() const { assert(constKind_ == IdlType::tk_fixed); // Have to copy the fixed object to get the memory management right return new IDL_Fixed(*v_.fixed_); } // Declarator Declarator:: Declarator(const char* file, int line, IDL_Boolean mainFile, const char* identifier, ArraySize* sizes) : Decl(D_DECLARATOR, file, line, mainFile), DeclRepoId(identifier), sizes_(sizes), thisType_(0), alias_(0), attribute_(0) { } Declarator:: ~Declarator() { if (sizes_) delete sizes_; if (thisType_) delete thisType_; } const char* Declarator:: kindAsString() const { if (alias_) return "typedef declarator"; if (attribute_) return "attribute declarator"; return "declarator"; } void Declarator:: setAlias(Typedef* td) { alias_ = td; thisType_ = new DeclaredType(IdlType::tk_alias, this, this); if (td->aliasType() && td->aliasType()->local()) thisType_->setLocal(); if (sizes_) checkValidType(file(), line(), td->aliasType()); } void Declarator:: setAttribute(Attribute* at) { attribute_ = at; } // Typedef Typedef:: Typedef(const char* file, int line, IDL_Boolean mainFile, IdlType* aliasType, IDL_Boolean constrType, Declarator* declarators) : Decl(D_TYPEDEF, file, line, mainFile), aliasType_(aliasType), constrType_(constrType), declarators_(declarators) { if (aliasType) delType_ = aliasType->shouldDelete(); else delType_ = 0; if (aliasType) checkNotForward(file, line, aliasType); for (Declarator* d = declarators; d; d = (Declarator*)d->next()) { d->setAlias(this); Scope::current()->addDecl(d->eidentifier(), 0, d, d->thisType(), d->file(), d->line()); } } Typedef:: ~Typedef() { if (delType_) delete aliasType_; if (declarators_) delete declarators_; } // Member Member:: Member(const char* file, int line, IDL_Boolean mainFile, IdlType* memberType, IDL_Boolean constrType, Declarator* declarators) : Decl(D_MEMBER, file, line, mainFile), memberType_(memberType), constrType_(constrType), declarators_(declarators) { if (memberType) delType_ = memberType->shouldDelete(); else { delType_ = 0; return; } checkNotForward(file, line, memberType); IdlType* bareType = memberType->unalias(); if (bareType->kind() == IdlType::tk_struct) { Struct* s = (Struct*)((DeclaredType*)bareType)->decl(); if (!s->finished()) { IdlError(file, line, "Cannot create an instance of struct '%s' inside " "its own definition", s->identifier()); } } else if (bareType->kind() == IdlType::tk_union) { Union* u = (Union*)((DeclaredType*)bareType)->decl(); if (!u->finished()) { IdlError(file, line, "Cannot create an instance of union '%s' inside " "its own definition", u->identifier()); } } else if (bareType->kind() == IdlType::tk_sequence) { // Look for recursive sequence IdlType* t = bareType; while (t && t->kind() == IdlType::tk_sequence) t = ((SequenceType*)t)->seqType()->unalias(); if (!t) return; // Sequence of undeclared type if (t->kind() == IdlType::tk_struct) { Struct* s = (Struct*)((DeclaredType*)t)->decl(); if (!s->finished()) { s->setRecursive(); IdlWarning(file, line, "Anonymous sequences for recursive structures " "are deprecated. Use a forward declaration instead."); } } else if (t->kind() == IdlType::tk_union) { Union* u = (Union*)((DeclaredType*)t)->decl(); if (!u->finished()) { u->setRecursive(); IdlWarning(file, line, "Anonymous sequences for recursive unions " "are deprecated. Use a forward declaration instead."); } } else if (t->kind() == IdlType::ot_structforward) { StructForward* f = (StructForward*)((DeclaredType*)t)->decl(); Struct* s = f->definition(); if (s) { if (!s->finished()) s->setRecursive(); } else { char* ssn = f->scopedName()->toString(); IdlError(file, line, "Cannot use sequence of forward-declared struct '%s' " "before it is fully defined", ssn); IdlErrorCont(f->file(), f->line(), "('%s' forward-declared here)", f->identifier()); delete [] ssn; } } else if (t->kind() == IdlType::ot_unionforward) { UnionForward* f = (UnionForward*)((DeclaredType*)t)->decl(); Union* u = f->definition(); if (u) { if (!u->finished()) u->setRecursive(); } else { char* ssn = f->scopedName()->toString(); IdlError(file, line, "Cannot use sequence of forward-declared union '%s' " "before it is fully defined", ssn); IdlErrorCont(f->file(), f->line(), "('%s' forward-declared here)", f->identifier()); delete [] ssn; } } } for (Declarator* d = declarators; d; d = (Declarator*)d->next()) { Scope::current()->addInstance(d->eidentifier(), d, memberType, d->file(), d->line()); } } Member:: ~Member() { if (declarators_) delete declarators_; if (delType_) delete memberType_; } // Struct Struct:: Struct(const char* file, int line, IDL_Boolean mainFile, const char* identifier) : Decl(D_STRUCT, file, line, mainFile), DeclRepoId(identifier), members_(0), recursive_(0), finished_(0) { // Look for forward struct Scope::Entry* se = Scope::current()->find(identifier); if (se && se->kind() == Scope::Entry::E_DECL && se->decl()->kind() == Decl::D_STRUCTFORWARD) { StructForward* f = (StructForward*)se->decl(); if (strcmp(f->file(), file)) { IdlError(file, line, "Struct '%s' defined in different source file to " "its forward declaration", identifier); IdlErrorCont(f->file(), f->line(), "('%s' forward declared here)", identifier); } if (strcmp(f->prefix(), prefix())) { IdlError(file, line, "In declaration of struct '%s', repository id " "prefix '%s' differs from that of forward declaration", identifier, prefix()); IdlErrorCont(f->file(), f->line(), "('%s' forward declared here with prefix '%s')", f->identifier(), f->prefix()); } if (f->repoIdSet()) setRepoId(f->repoId(), f->rifile(), f->riline()); f->setDefinition(this); Scope::current()->remEntry(se); } Scope* s = Scope::current()->newStructScope(identifier, file, line); thisType_ = new DeclaredType(IdlType::tk_struct, this, this); Scope::current()->addDecl(identifier, s, this, thisType_, file, line); Scope::startScope(s); Prefix::newScope(identifier); } Struct:: ~Struct() { if (members_) delete members_; delete thisType_; } void Struct:: finishConstruction(Member* members) { // Is this a local type? for (Member* m = members; m; m = (Member*)m->next()) { if (m->memberType() && m->memberType()->local()) { thisType()->setLocal(); break; } } members_ = members; Prefix::endScope(); Scope::endScope(); finished_ = 1; mostRecent_ = this; } // StructForward StructForward:: StructForward(const char* file, int line, IDL_Boolean mainFile, const char* identifier) : Decl(D_STRUCTFORWARD, file, line, mainFile), DeclRepoId(identifier), definition_(0), firstForward_(0), thisType_(0) { Scope::Entry* se = Scope::current()->find(identifier); IDL_Boolean reg = 1; if (se && se->kind() == Scope::Entry::E_DECL) { if (se->decl()->kind() == D_STRUCT) { Struct* s = (Struct*)se->decl(); definition_ = s; if (strcmp(s->file(), file)) { IdlError(file, line, "Struct '%s' forward declared in different source file to " "its definition", identifier); IdlErrorCont(s->file(), s->line(), "('%s' defined here)", identifier); } if (strcmp(s->prefix(), prefix())) { IdlError(file, line, "In forward declaration of struct '%s', repository " "id prefix '%s' differs from that of earlier declaration", identifier, prefix()); IdlErrorCont(s->file(), s->line(), "('%s' fully declared here with prefix '%s')", s->identifier(), s->prefix()); } reg = 0; } else if (se->decl()->kind() == D_STRUCTFORWARD) { StructForward* s = (StructForward*)se->decl(); firstForward_ = s; if (strcmp(s->file(), file)) { IdlError(file, line, "Struct '%s' forward declared in more than one " "source file", identifier); IdlErrorCont(s->file(), s->line(), "('%s' also forward declared here)", identifier); } if (strcmp(s->prefix(), prefix())) { IdlError(file, line, "In forward declaration of struct '%s', repository " "id prefix '%s' differs from that of earlier declaration", identifier, prefix()); IdlErrorCont(s->file(), s->line(), "('%s' forward declared here with prefix '%s')", s->identifier(), s->prefix()); } reg = 0; } } if (reg) { thisType_ = new DeclaredType(IdlType::ot_structforward, this, this); Scope::current()->addDecl(identifier, 0, this, thisType_, file, line); } } StructForward:: ~StructForward() { delete thisType_; } Struct* StructForward:: definition() const { if (firstForward_) return firstForward_->definition(); else return definition_; } void StructForward:: setDefinition(Struct* defn) { definition_ = defn; } // Exception Exception:: Exception(const char* file, int line, IDL_Boolean mainFile, const char* identifier) : Decl(D_EXCEPTION, file, line, mainFile), DeclRepoId(identifier), members_(0), local_(0) { Scope* s = Scope::current()->newExceptionScope(identifier, file, line); Scope::current()->addDecl(identifier, s, this, 0, file, line); Scope::startScope(s); Prefix::newScope(identifier); } Exception:: ~Exception() { if (members_) delete members_; } void Exception:: finishConstruction(Member* members) { // Is this a local exception? for (Member* m = members; m; m = (Member*)m->next()) { if (m->memberType() && m->memberType()->local()) { local_ = 1; break; } } members_ = members; Prefix::endScope(); Scope::endScope(); mostRecent_ = this; } // Case label CaseLabel:: CaseLabel(const char* file, int line, IDL_Boolean mainFile, IdlExpr* value) : Decl(D_CASELABEL, file, line, mainFile), value_(value), labelKind_(IdlType::tk_null) { isDefault_ = (value_ == 0); } CaseLabel:: ~CaseLabel() { if (value_) delete value_; } void CaseLabel:: setType(IdlType* type) { labelKind_ = type->kind(); if (!value_) return; switch (labelKind_) { case IdlType::tk_short: v_.short_ = value_->evalAsShort(); break; case IdlType::tk_long: v_.long_ = value_->evalAsLong(); break; case IdlType::tk_ushort: v_.ushort_ = value_->evalAsUShort(); break; case IdlType::tk_ulong: v_.ulong_ = value_->evalAsULong(); break; case IdlType::tk_boolean: v_.boolean_ = value_->evalAsBoolean(); break; case IdlType::tk_char: v_.char_ = value_->evalAsChar(); break; #ifdef HAS_LongLong case IdlType::tk_longlong: v_.longlong_ = value_->evalAsLongLong(); break; case IdlType::tk_ulonglong: v_.ulonglong_ = value_->evalAsULongLong(); break; #endif case IdlType::tk_wchar: v_.wchar_ = value_->evalAsWChar(); break; case IdlType::tk_enum: v_.enumerator_ = value_->evalAsEnumerator((Enum*)((DeclaredType*)type)->decl()); break; default: assert(0); } delete value_; value_ = 0; } #define LABEL_AS(rt, op, tk, un) \ rt CaseLabel::op() const { \ assert(labelKind_ == IdlType::tk); \ return v_.un; \ } LABEL_AS(IDL_Short, labelAsShort, tk_short, short_) LABEL_AS(IDL_Long, labelAsLong, tk_long, long_) LABEL_AS(IDL_UShort, labelAsUShort, tk_ushort, ushort_) LABEL_AS(IDL_ULong, labelAsULong, tk_ulong, ulong_) LABEL_AS(IDL_Boolean, labelAsBoolean, tk_boolean, boolean_) LABEL_AS(IDL_Char, labelAsChar, tk_char, char_) #ifdef HAS_LongLong LABEL_AS(IDL_LongLong, labelAsLongLong, tk_longlong, longlong_) LABEL_AS(IDL_ULongLong, labelAsULongLong, tk_ulonglong, ulonglong_) #endif LABEL_AS(IDL_WChar, labelAsWChar, tk_wchar, wchar_) LABEL_AS(Enumerator*, labelAsEnumerator, tk_enum, enumerator_) // UnionCase UnionCase:: UnionCase(const char* file, int line, IDL_Boolean mainFile, IdlType* caseType, IDL_Boolean constrType, Declarator* declarator) : Decl(D_UNIONCASE, file, line, mainFile), labels_(0), caseType_(caseType), constrType_(constrType), declarator_(declarator) { if (caseType) delType_ = caseType->shouldDelete(); else { delType_ = 0; return; } checkNotForward(file, line, caseType); IdlType* bareType = caseType->unalias(); if (bareType->kind() == IdlType::tk_struct) { Struct* s = (Struct*)((DeclaredType*)bareType)->decl(); if (!s->finished()) { IdlError(file, line, "Cannot create an instance of struct '%s' inside " "its own definition", s->identifier()); } } else if (bareType->kind() == IdlType::tk_union) { Union* u = (Union*)((DeclaredType*)bareType)->decl(); if (!u->finished()) { IdlError(file, line, "Cannot create an instance of union '%s' inside " "its own definition", u->identifier()); } } else if (bareType->kind() == IdlType::tk_sequence) { // Look for recursive sequence IdlType* t = bareType; while (t && t->kind() == IdlType::tk_sequence) t = ((SequenceType*)t)->seqType()->unalias(); if (!t) return; // Sequence of undeclared type if (t->kind() == IdlType::tk_struct) { Struct* s = (Struct*)((DeclaredType*)t)->decl(); if (!s->finished()) { s->setRecursive(); IdlWarning(file, line, "Anonymous sequences for recursive structures " "are deprecated. Use a forward declaration instead."); } } else if (t->kind() == IdlType::tk_union) { Union* u = (Union*)((DeclaredType*)t)->decl(); if (!u->finished()) { u->setRecursive(); IdlWarning(file, line, "Anonymous sequences for recursive unions " "are deprecated. Use a forward declaration instead."); } } else if (t->kind() == IdlType::ot_structforward) { StructForward* f = (StructForward*)((DeclaredType*)t)->decl(); Struct* s = f->definition(); if (s) { if (!s->finished()) s->setRecursive(); } else { char* ssn = f->scopedName()->toString(); IdlError(file, line, "Cannot use sequence of forward-declared struct '%s' " "before it is fully defined", ssn); IdlErrorCont(f->file(), f->line(), "('%s' forward-declared here)", f->identifier()); delete [] ssn; } } else if (t->kind() == IdlType::ot_unionforward) { UnionForward* f = (UnionForward*)((DeclaredType*)t)->decl(); Union* u = f->definition(); if (u) { if (!u->finished()) u->setRecursive(); } else { char* ssn = f->scopedName()->toString(); IdlError(file, line, "Cannot use sequence of forward-declared union '%s' " "before it is fully defined", ssn); IdlErrorCont(f->file(), f->line(), "('%s' forward-declared here)", f->identifier()); delete [] ssn; } } } Scope::current()->addInstance(declarator->identifier(), declarator, caseType, declarator->file(), declarator->line()); } UnionCase:: ~UnionCase() { if (labels_) delete labels_; if (declarator_) delete declarator_; if (delType_ ) delete caseType_; } void UnionCase:: finishConstruction(CaseLabel* labels) { labels_ = labels; mostRecent_ = this; } // Union Union:: Union(const char* file, int line, IDL_Boolean mainFile, const char* identifier) : Decl(D_UNION, file, line, mainFile), DeclRepoId(identifier), switchType_(0), constrType_(0), cases_(0), recursive_(0), finished_(0) { // Look for forward union Scope::Entry* se = Scope::current()->find(identifier); if (se && se->kind() == Scope::Entry::E_DECL && se->decl()->kind() == Decl::D_UNIONFORWARD) { UnionForward* f = (UnionForward*)se->decl(); if (strcmp(f->file(), file)) { IdlError(file, line, "Union '%s' defined in different source file to " "its forward declaration", identifier); IdlErrorCont(f->file(), f->line(), "('%s' forward declared here)", identifier); } if (strcmp(f->prefix(), prefix())) { IdlError(file, line, "In declaration of union '%s', repository id " "prefix '%s' differs from that of forward declaration", identifier, prefix()); IdlErrorCont(f->file(), f->line(), "('%s' forward declared here with prefix '%s')", f->identifier(), f->prefix()); } if (f->repoIdSet()) setRepoId(f->repoId(), f->rifile(), f->riline()); f->setDefinition(this); Scope::current()->remEntry(se); } Scope* s = Scope::current()->newUnionScope(identifier, file, line); thisType_ = new DeclaredType(IdlType::tk_union, this, this); Scope::current()->addDecl(identifier, s, this, thisType_, file, line); Scope::startScope(s); Prefix::newScope(identifier); } Union:: ~Union() { if (cases_) delete cases_; delete thisType_; } // Ugly code to set case label types, check for label clashes, and // come up with a default label value. Loops are O(n^2), but n will // usually be quite small. *** #define UNION_SWITCH(lt, op, defstart, islastdef, nextdef) { \ lt label; \ for (c = cases; c; c = (UnionCase*)c->next()) { \ for (l = c->labels(); l; l = (CaseLabel*)l->next()) { \ l->setType(t); \ if (!l->isDefault()) \ label = l->labelAs ## op(); \ else \ defLabel = l; \ for (d = cases; d != c->next(); d = (UnionCase*)d->next()) { \ for (m = d->labels(); m && m != l; m = (CaseLabel*)m->next()) { \ if (l->isDefault() || m->isDefault()) { \ if (l->isDefault() && m->isDefault()) \ ++clash; \ } \ else if (m->labelAs ## op() == label) ++clash; \ } \ } \ } \ } \ if (defLabel) { \ lt defVal = defstart; \ again ## op: \ for (c = cases; c; c = (UnionCase*)c->next()) { \ for (l = c->labels(); l; l = (CaseLabel*)l->next()) { \ if (!l->isDefault() && l->labelAs ## op() == defVal) { \ if (islastdef) goto nomore ## op; \ nextdef; \ goto again ## op; \ } \ } \ } \ foundDef = 1; \ nomore ## op: \ defLabel->setDefault ## op(defVal); \ } \ break; \ } void Union:: finishConstruction(IdlType* switchType, IDL_Boolean constrType, UnionCase* cases) { if (!switchType) return; switchType_ = switchType; constrType_ = constrType; cases_ = cases; finished_ = 1; // Local type? UnionCase* c; for (c = cases; c; c = (UnionCase*)c->next()) { if (c->caseType() && c->caseType()->local()) { thisType_->setLocal(); break; } } IdlType* t = switchType->unalias(); if (!t) { // Broken alias due to earlier error Prefix::endScope(); Scope::endScope(); return; } UnionCase *d; CaseLabel *l, *m, *defLabel = 0; IdlType::Kind k = t->kind(); int clash = 0; IDL_Boolean foundDef = 0; switch (k) { case IdlType::tk_short: UNION_SWITCH(IDL_Short, Short, -0x8000, defVal==0x7fff, ++defVal) case IdlType::tk_long: UNION_SWITCH(IDL_Long, Long, -0x80000000, defVal==0x7fffffff, ++defVal) case IdlType::tk_ushort: UNION_SWITCH(IDL_UShort, UShort, 0xffff, defVal==0, --defVal) case IdlType::tk_ulong: UNION_SWITCH(IDL_ULong, ULong, 0xffffffff, defVal==0, --defVal) case IdlType::tk_boolean: UNION_SWITCH(IDL_Boolean, Boolean, 0, defVal==1, defVal=1) case IdlType::tk_char: UNION_SWITCH(IDL_Char, Char, 0xff, defVal==0, --defVal) #ifdef HAS_LongLong case IdlType::tk_longlong: UNION_SWITCH(IDL_LongLong, LongLong, _CORBA_LONGLONG_CONST(-0x8000000000000000), defVal==_CORBA_LONGLONG_CONST(0x7fffffffffffffff), ++defVal) case IdlType::tk_ulonglong: UNION_SWITCH(IDL_ULongLong, ULongLong, _CORBA_LONGLONG_CONST(0xffffffffffffffff), defVal==_CORBA_LONGLONG_CONST(0), --defVal) #endif case IdlType::tk_wchar: UNION_SWITCH(IDL_WChar, WChar, 0xffff, defVal==0, --defVal) case IdlType::tk_enum: { Enum *e = (Enum*)((DeclaredType*)t)->decl(); UNION_SWITCH(Enumerator*, Enumerator, e->enumerators(), !defVal->next(), defVal=(Enumerator*)defVal->next()) } default: IdlError(file(), line(), "Invalid type for union switch: %s", t->kindAsString()); } if (clash) IdlError(file(), line(), "Error in union '%s': %d repeated union label%s", identifier(), clash, clash == 1 ? "" : "s"); if (defLabel && !foundDef) IdlError(defLabel->file(), defLabel->line(), "Error in union '%s': cannot declare default case since " "all cases are explicitly listed", identifier()); Prefix::endScope(); Scope::endScope(); mostRecent_ = this; } // UnionForward UnionForward:: UnionForward(const char* file, int line, IDL_Boolean mainFile, const char* identifier) : Decl(D_UNIONFORWARD, file, line, mainFile), DeclRepoId(identifier), definition_(0), firstForward_(0), thisType_(0) { Scope::Entry* se = Scope::current()->find(identifier); IDL_Boolean reg = 1; if (se && se->kind() == Scope::Entry::E_DECL) { if (se->decl()->kind() == D_UNION) { Union* u = (Union*)se->decl(); definition_ = u; if (strcmp(u->file(), file)) { IdlError(file, line, "Union '%s' forward declared in different source file to " "its definition", identifier); IdlErrorCont(u->file(), u->line(), "('%s' defined here)", identifier); } if (strcmp(u->prefix(), prefix())) { IdlError(file, line, "In forward declaration of union '%s', repository " "id prefix '%s' differs from that of earlier declaration", identifier, prefix()); IdlErrorCont(u->file(), u->line(), "('%s' fully declared here with prefix '%s')", u->identifier(), u->prefix()); } reg = 0; } else if (se->decl()->kind() == D_UNIONFORWARD) { UnionForward* u = (UnionForward*)se->decl(); firstForward_ = u; if (strcmp(u->file(), file)) { IdlError(file, line, "Union '%s' forward declared in more than one " "source file", identifier); IdlErrorCont(u->file(), u->line(), "('%s' also forward declared here)", identifier); } if (strcmp(u->prefix(), prefix())) { IdlError(file, line, "In forward declaration of union '%s', repository " "id prefix '%s' differs from that of earlier declaration", identifier, prefix()); IdlErrorCont(u->file(), u->line(), "('%s' forward declared here with prefix '%s')", u->identifier(), u->prefix()); } reg = 0; } } if (reg) { thisType_ = new DeclaredType(IdlType::ot_unionforward, this, this); Scope::current()->addDecl(identifier, 0, this, thisType_, file, line); } } UnionForward:: ~UnionForward() { delete thisType_; } Union* UnionForward:: definition() const { if (firstForward_) return firstForward_->definition(); else return definition_; } void UnionForward:: setDefinition(Union* defn) { definition_ = defn; } // Enum Enumerator:: Enumerator(const char* file, int line, IDL_Boolean mainFile, const char* identifier) : Decl(D_ENUMERATOR, file, line, mainFile), DeclRepoId(identifier), container_(0) { Scope::current()->addDecl(identifier, 0, this, 0, file, line); } Enumerator:: ~Enumerator() { } void Enumerator:: finishConstruction(Enum* container, IDL_ULong value) { container_ = container; value_ = value; } Enum:: Enum(const char* file, int line, IDL_Boolean mainFile, const char* identifier) : Decl(D_ENUM, file, line, mainFile), DeclRepoId(identifier), enumerators_(0) { thisType_ = new DeclaredType(IdlType::tk_enum, this, this); Scope::current()->addDecl(identifier, 0, this, thisType_, file, line); } Enum:: ~Enum() { if (enumerators_) delete enumerators_; delete thisType_; } void Enum:: finishConstruction(Enumerator* enumerators) { enumerators_ = enumerators; IDL_ULong count = 0; for (Enumerator* e = enumerators; e; e = (Enumerator*)e->next(), ++count) e->finishConstruction(this, count); mostRecent_ = this; } // Attribute Attribute:: Attribute(const char* file, int line, IDL_Boolean mainFile, IDL_Boolean readonly, IdlType* attrType, Declarator* declarators) : Decl(D_ATTRIBUTE, file, line, mainFile), readonly_(readonly), attrType_(attrType), declarators_(declarators) { if (attrType) { delType_ = attrType->shouldDelete(); checkValidType(file, line, attrType); } else delType_ = 0; for (Declarator* d = declarators; d; d = (Declarator*)d->next()) { assert(d->sizes() == 0); // Enforced by grammar d->setAttribute(this); Scope::current()->addCallable(d->eidentifier(), 0, d, file, line); } } Attribute:: ~Attribute() { delete declarators_; if (delType_) delete attrType_; } // Operation Parameter:: Parameter(const char* file, int line, IDL_Boolean mainFile, int direction, IdlType* paramType, const char* identifier) : Decl(D_PARAMETER, file, line, mainFile), direction_(direction), paramType_(paramType) { if (paramType) { delType_ = paramType->shouldDelete(); checkValidType(file, line, paramType); } else delType_ = 0; if (identifier[0] == '_') identifier_ = idl_strdup(identifier+1); else identifier_ = idl_strdup(identifier); Scope::current()->addDecl(identifier, 0, this, paramType, file, line); } Parameter:: ~Parameter() { delete [] identifier_; if (delType_) delete paramType_; } RaisesSpec:: RaisesSpec(const ScopedName* sn, const char* file, int line) : exception_(0), next_(0) { last_ = this; const Scope::Entry* se = Scope::current()->findScopedName(sn, file, line); if (se) { if (se->kind() == Scope::Entry::E_DECL && se->decl()->kind() == Decl::D_EXCEPTION) { exception_ = (Exception*)se->decl(); } else { char* ssn = sn->toString(); IdlError(file, line, "'%s' used in raises expression is not an exception", ssn); IdlErrorCont(se->file(), se->line(), "('%s' declared here)", ssn); delete [] ssn; } } } RaisesSpec:: ~RaisesSpec() { if (next_) delete next_; } ContextSpec:: ContextSpec(const char* c, const char* file, int line) : context_(idl_strdup(c)), next_(0) { last_ = this; IDL_Boolean bad = 0; if (!isalpha(*c++)) bad = 1; else { for (; *c; c++) { if (!isalnum(*c) && *c != '.' && *c != '_') { if (!(*c == '*' && *(c+1) == '\0')) bad = 1; break; } } } if (bad) IdlError(file, line, "Invalid context name \"%s\"", context_); } ContextSpec:: ~ContextSpec() { delete [] context_; if (next_) delete next_; } Operation:: Operation(const char* file, int line, IDL_Boolean mainFile, IDL_Boolean oneway, IdlType* returnType, const char* identifier) : Decl(D_OPERATION, file, line, mainFile), DeclRepoId(identifier), oneway_(oneway), returnType_(returnType), parameters_(0), raises_(0), contexts_(0) { if (returnType) { delType_ = returnType->shouldDelete(); checkValidType(file, line, returnType); } else delType_ = 0; Scope* s = Scope::current()->newOperationScope(file, line); Scope::current()->addCallable(identifier, s, this, file, line); Scope::startScope(s); } Operation:: ~Operation() { if (parameters_) delete parameters_; if (raises_) delete raises_; if (contexts_) delete contexts_; if (delType_) delete returnType_; } void Operation:: closeParens() { mostRecent_ = this; } void Operation:: finishConstruction(Parameter* parameters, RaisesSpec* raises, ContextSpec* contexts) { parameters_ = parameters; raises_ = raises; contexts_ = contexts; if (oneway_) { if (returnType_ && returnType_->kind() != IdlType::tk_void) { IdlError(file(), line(), "Oneway operation '%s' does not return void", identifier()); } for (Parameter* p = parameters; p; p = (Parameter*)p->next()) { if (p->direction() == 1) { IdlError(p->file(), p->line(), "In oneway operation '%s': out parameter '%s' " "is not permitted", identifier(), p->identifier()); } else if (p->direction() == 2) { IdlError(p->file(), p->line(), "In oneway operation '%s': inout parameter '%s' " "is not permitted", identifier(), p->identifier()); } } if (raises_) { IdlError(file(), line(), "Oneway operation '%s' is not permitted to have " "a raises expression", identifier()); } } Scope::endScope(); } // Native Native:: Native(const char* file, int line, IDL_Boolean mainFile, const char* identifier) : Decl(D_NATIVE, file, line, mainFile), DeclRepoId(identifier) { DeclaredType* type = new DeclaredType(IdlType::tk_native, this, this); Scope::current()->addDecl(identifier, 0, this, type, file, line); } Native:: ~Native() { } // ValueType StateMember:: StateMember(const char* file, int line, IDL_Boolean mainFile, int memberAccess, IdlType* memberType, IDL_Boolean constrType, Declarator* declarators) : Decl(D_STATEMEMBER, file, line, mainFile), memberAccess_(memberAccess), memberType_(memberType), constrType_(constrType), declarators_(declarators) { if (memberType) { delType_ = memberType->shouldDelete(); checkValidType(file, line, memberType); if (memberType->local()) { if (memberType->kind() != IdlType::tk_sequence) { DeclaredType* dt = (DeclaredType*)memberType; assert(dt->declRepoId()); char* ssn = dt->declRepoId()->scopedName()->toString(); IdlError(file, line, "State member '%s' has local type '%s'", declarators->identifier(), ssn); IdlErrorCont(dt->decl()->file(), dt->decl()->line(), "(%s declared here)", ssn); delete [] ssn; } else { IdlError(file, line, "State member '%s' has local type", declarators->identifier()); } } } else { delType_ = 0; } // *** Is this right? Should StateMembers be Callables? for (Declarator* d = declarators; d; d = (Declarator*)d->next()) Scope::current()->addCallable(d->eidentifier(), 0, this, file, line); } StateMember:: ~StateMember() { if (delType_) delete memberType_; if (declarators_) delete declarators_; } Factory:: Factory(const char* file, int line, IDL_Boolean mainFile, const char* identifier) : Decl(D_FACTORY, file, line, mainFile), parameters_(0) { if (identifier[0] == '_') identifier_ = idl_strdup(identifier+1); else identifier_ = idl_strdup(identifier); Scope* s = Scope::current()->newOperationScope(file, line); Scope::current()->addDecl(identifier, s, this, 0, file, line); Scope::startScope(s); } Factory:: ~Factory() { delete [] identifier_; if (parameters_) delete parameters_; } void Factory:: closeParens() { mostRecent_ = this; } void Factory:: finishConstruction(Parameter* parameters, RaisesSpec* raises) { parameters_ = parameters; raises_ = raises; Scope::endScope(); } ValueBase:: ValueBase(Decl::Kind k, const char* file, int line, IDL_Boolean mainFile, const char* identifier) : Decl(k, file, line, mainFile), DeclRepoId(identifier) { } ValueBase:: ~ValueBase() { } ValueForward:: ValueForward(const char* file, int line, IDL_Boolean mainFile, IDL_Boolean abstract, const char* identifier) : ValueBase(D_VALUEFORWARD, file, line, mainFile, identifier), abstract_(abstract), definition_(0), firstForward_(0) { Scope::Entry* se = Scope::current()->find(identifier); IDL_Boolean reg = 1; if (se && se->kind() == Scope::Entry::E_DECL) { if (se->decl()->kind() == D_VALUEABS) { ValueAbs* v = (ValueAbs*)se->decl(); definition_ = v; if (strcmp(v->prefix(), prefix())) { IdlError(file, line, "In forward declaration of valuetype '%s', repository " "id prefix '%s' differs from that of earlier declaration", identifier, prefix()); IdlErrorCont(v->file(), v->line(), "('%s' fully declared here with prefix '%s')", v->identifier(), v->prefix()); reg = 0; } if (!abstract) { IdlError(file, line, "Forward declaration of non-abstract valuetype '%s' " "conflicts with earlier full declaration as abstract", identifier); IdlErrorCont(v->file(), v->line(), "('%s' declared as abstract here)"); } } else if (se->decl()->kind() == D_VALUE) { Value* v = (Value*)se->decl(); definition_ = v; if (strcmp(v->prefix(), prefix())) { IdlError(file, line, "In forward declaration of valuetype '%s', repository " "id prefix '%s' differs from that of earlier declaration", identifier, prefix()); IdlErrorCont(v->file(), v->line(), "('%s' fully declared here with prefix '%s')", v->identifier(), v->prefix()); reg = 0; } if (abstract) { IdlError(file, line, "Forward declaration of abstract valuetype '%s' " "conflicts with earlier full declaration as non-abstract", identifier); IdlErrorCont(v->file(), v->line(), "('%s' declared as non-abstract here)"); } } else if (se->decl()->kind() == D_VALUEFORWARD) { ValueForward* v = (ValueForward*)se->decl(); firstForward_ = v; if (strcmp(v->prefix(), prefix())) { IdlError(file, line, "In forward declaration of interface '%s', repository " "id prefix '%s' differs from that of earlier declaration", identifier, prefix()); IdlErrorCont(v->file(), v->line(), "('%s' forward declared here with prefix '%s')", v->identifier(), v->prefix()); } if (abstract && !v->abstract()) { IdlError(file, line, "Forward declaration of abstract valuetype '%s' conflicts " "with earlier forward declaration as non-abstract", identifier); IdlErrorCont(v->file(), v->line(), "('%s' forward declared as non-abstract here)"); } else if (!abstract && v->abstract()) { IdlError(file, line, "Forward declaration of non-abstract valuetype '%s' " "conflicts with earlier forward declaration as abstract", identifier); IdlErrorCont(v->file(), v->line(), "('%s' forward declared as abstract here)"); } if (v->repoIdSet()) setRepoId(v->repoId(), v->rifile(), v->riline()); } reg = 0; } if (reg) { thisType_ = new DeclaredType(IdlType::tk_value, this, this); Scope::current()->addDecl(identifier, 0, this, thisType_, file, line); } } ValueForward:: ~ValueForward() { delete thisType_; } ValueBase* ValueForward:: definition() const { if (firstForward_) return firstForward_->definition(); else return definition_; } void ValueForward:: setDefinition(ValueBase* defn) { definition_ = defn; } ValueBox:: ValueBox(const char* file, int line, IDL_Boolean mainFile, const char* identifier, IdlType* boxedType, IDL_Boolean constrType) : ValueBase(D_VALUEBOX, file, line, mainFile, identifier), boxedType_(boxedType), constrType_(constrType) { if (boxedType) { checkValidType(file, line, boxedType); IdlType* ubt = boxedType->unalias(); if (ubt->kind() == IdlType::tk_value || ubt->kind() == IdlType::tk_value_box) { IdlError(file, line, "Value types cannot be boxed"); } delType_ = boxedType->shouldDelete(); } else delType_ = 0; thisType_ = new DeclaredType(IdlType::tk_value_box, this, this); Scope::current()->addDecl(identifier, 0, this, thisType_, file, line); } ValueBox:: ~ValueBox() { delete thisType_; if (delType_) delete boxedType_; } ValueInheritSpec:: ValueInheritSpec(ScopedName* sn, const char* file, int line) : value_(0), decl_(0), scope_(0), next_(0), truncatable_(0) { const Scope::Entry* se = Scope::current()->findScopedName(sn, file, line); if (se) { if (se->kind() == Scope::Entry::E_DECL) { decl_ = se->decl(); IdlType* t = se->idltype()->unalias(); if (!t) return; if (t->kind() == IdlType::tk_value) { Decl* d = ((DeclaredType*)t)->decl(); if (d->kind() == Decl::D_VALUE) { value_ = (Value*)d; scope_ = ((Value*)d)->scope(); return; } else if (d->kind() == Decl::D_VALUEABS) { value_ = (ValueAbs*)d; scope_ = ((ValueAbs*)d)->scope(); return; } else if (d->kind() == Decl::D_VALUEFORWARD) { ValueBase* def = ((ValueForward*)d)->definition(); if (def) { if (def->kind() == Decl::D_VALUE) { value_ = (Value*)def; scope_ = ((Value*)def)->scope(); return; } else if (def->kind() == Decl::D_VALUEABS) { value_ = (ValueAbs*)def; scope_ = ((ValueAbs*)def)->scope(); return; } } else { char* ssn = ((ValueForward*)d)->scopedName()->toString(); IdlError(file, line, "Inherited valuetype '%s' must be fully defined", ssn); if (decl_ != d) { char* tssn = sn->toString(); IdlErrorCont(se->file(), se->line(), "('%s' reached through typedef '%s')", ssn, tssn); delete [] tssn; } IdlErrorCont(d->file(), d->line(), "('%s' forward declared here)", ssn); delete [] ssn; return; } } } } char* ssn = sn->toString(); IdlError(file, line, "'%s' used in inheritance specification is not a valuetype", ssn); IdlErrorCont(se->file(), se->line(), "('%s' declared here)", ssn); delete [] ssn; } } void ValueInheritSpec:: append(ValueInheritSpec* is, const char* file, int line) { ValueInheritSpec *i, *last; for (i=this; i; i = i->next_) { last = i; if (is->value() == i->value()) { char* ssn = is->value()->scopedName()->toString(); IdlError(file, line, "Cannot specify '%s' as a direct base valuetype " "more than once", ssn); delete [] ssn; delete is; return; } } last->next_ = is; } ValueAbs:: ValueAbs(const char* file, int line, IDL_Boolean mainFile, const char* identifier, ValueInheritSpec* inherits, InheritSpec* supports) : ValueBase(D_VALUEABS, file, line, mainFile, identifier), inherits_(inherits), supports_(supports), contents_(0) { // Look for forward valuetype Scope::Entry* se = Scope::current()->find(identifier); if (se && se->kind() == Scope::Entry::E_DECL && se->decl()->kind() == Decl::D_VALUEFORWARD) { ValueForward* f = (ValueForward*)se->decl(); if (strcmp(f->prefix(), prefix())) { IdlError(file, line, "In declaration of valuetype '%s', repository id " "prefix '%s' differs from that of forward declaration", identifier, prefix()); IdlErrorCont(f->file(), f->line(), "('%s' forward declared here with prefix '%s')", f->identifier(), f->prefix()); } if (!f->abstract()) { IdlError(file, line, "Declaration of abstract valuetype '%s' conflicts with " "forward declaration as non-abstract", identifier); IdlErrorCont(f->file(), f->line(), "('%s' forward declared as non-abstract here)"); } if (f->repoIdSet()) setRepoId(f->repoId(), f->rifile(), f->riline()); f->setDefinition(this); Scope::current()->remEntry(se); } scope_ = Scope::current()->newValueScope(identifier, file, line); thisType_ = new DeclaredType(IdlType::tk_value, this, this); // Check that all inherited valuetypes are abstract if (inherits) { for (ValueInheritSpec* vinh = inherits; vinh; vinh = vinh->next()) { if (vinh->value()->kind() == D_VALUE) { char* ssn = vinh->scope()->scopedName()->toString(); IdlError(file, line, "In declaration of abstract valuetype '%s', inherited " "valuetype '%s' is not abstract", identifier, ssn); IdlErrorCont(vinh->value()->file(), vinh->value()->line(), "(%s declared here)", ssn); delete [] ssn; } } scope_->setInherited(inherits, file, line); } // Supports rules if (supports) { for (InheritSpec* inh = supports->next(); inh; inh = inh->next()) { if (!inh->interface()->abstract()) { char* ssn = inh->scope()->scopedName()->toString(); IdlError(file, line, "In declaration of abstract valuetype '%s', supported " "interface '%s' is non-abstract but is not specified first", identifier, ssn); IdlErrorCont(inh->interface()->file(), inh->interface()->line(), "(%s declared here)", ssn); delete [] ssn; } } scope_->setInherited(supports, file, line); } Scope::current()->addDecl(identifier, scope_, this, thisType_, file, line); Scope::startScope(scope_); Prefix::newScope(identifier); } ValueAbs:: ~ValueAbs() { if (inherits_) delete inherits_; if (contents_) delete contents_; delete thisType_; } void ValueAbs:: finishConstruction(Decl* contents) { contents_ = contents; Prefix::endScope(); Scope::endScope(); mostRecent_ = this; } Value:: Value(const char* file, int line, IDL_Boolean mainFile, IDL_Boolean custom, const char* identifier, ValueInheritSpec* inherits, InheritSpec* supports) : ValueBase(D_VALUE, file, line, mainFile, identifier), custom_(custom), inherits_(inherits), supports_(supports), contents_(0) { // Look for forward valuetype Scope::Entry* se = Scope::current()->find(identifier); if (se && se->kind() == Scope::Entry::E_DECL && se->decl()->kind() == Decl::D_VALUEFORWARD) { ValueForward* f = (ValueForward*)se->decl(); if (strcmp(f->prefix(), prefix())) { IdlError(file, line, "In declaration of valuetype '%s', repository id " "prefix '%s' differs from that of forward declaration", identifier, prefix()); IdlErrorCont(f->file(), f->line(), "('%s' forward declared here with prefix '%s')", f->identifier(), f->prefix()); } if (f->abstract()) { IdlError(file, line, "Declaration of non-abstract valuetype '%s' conflicts with " "forward declaration as abstract", identifier); IdlErrorCont(f->file(), f->line(), "('%s' forward declared as abstract here)"); } if (f->repoIdSet()) setRepoId(f->repoId(), f->rifile(), f->riline()); f->setDefinition(this); Scope::current()->remEntry(se); } scope_ = Scope::current()->newValueScope(identifier, file, line); thisType_ = new DeclaredType(IdlType::tk_value, this, this); // Check all the various inheritance rules if (inherits) { if (custom) { if (inherits->truncatable()) { IdlError(file, line, "'truncatable' may not be specified for a custom valuetype"); } } else { if (inherits->value()->kind() == D_VALUE) { if (((Value*)inherits->value())->custom()) { char* ssn = inherits->scope()->scopedName()->toString(); IdlError(file, line, "In declaration of non-custom valuetype '%s', inherited " "valuetype '%s' is custom", identifier, ssn); IdlErrorCont(inherits->value()->file(), inherits->value()->line(), "(%s declared here)", ssn); delete [] ssn; } } } for (ValueInheritSpec* vinh = inherits->next(); vinh; vinh = vinh->next()) { if (vinh->value()->kind() == D_VALUE) { char* ssn = vinh->scope()->scopedName()->toString(); IdlError(file, line, "In declaration of valuetype '%s', inherited valuetype " "'%s' is non-abstract but is not specified first", identifier, ssn); IdlErrorCont(vinh->value()->file(), vinh->value()->line(), "(%s declared here)", ssn); delete [] ssn; } } scope_->setInherited(inherits, file, line); } // Supports rules if (supports) { for (InheritSpec* inh = supports->next(); inh; inh = inh->next()) { if (!inh->interface()->abstract()) { char* ssn = inh->scope()->scopedName()->toString(); IdlError(file, line, "In declaration of valuetype '%s', supported interface " "'%s' is non-abstract but is not specified first", identifier, ssn); IdlErrorCont(inh->interface()->file(), inh->interface()->line(), "(%s declared here)", ssn); delete [] ssn; } } if (!supports->interface()->abstract() && inherits) { // Check that supported interface does not conflict with any // inherited supported interfaces. Interface* thisi = (Interface*)supports->interface(); InheritSpec* baseis; ValueBase* iv; for (ValueInheritSpec* vinh = inherits; vinh; vinh = vinh->next()) { iv = vinh->value(); do { ValueInheritSpec* parent; if (iv->kind() == D_VALUE) { baseis = ((Value*)iv)->supports(); parent = ((Value*)iv)->inherits(); } else { baseis = ((ValueAbs*)iv)->supports(); parent = ((ValueAbs*)iv)->inherits(); } if (!baseis || baseis->interface()->abstract()) { if (parent) iv = parent->value(); else break; } } while (!baseis && iv); if (baseis && ! baseis->interface()->abstract() && ! thisi->isDerived(baseis->interface())) { char* tsssn = supports->scope()->scopedName()->toString(); char* isssn = baseis->scope()->scopedName()->toString(); char* ivssn = vinh->scope()->scopedName()->toString(); const char* indirectly; if (iv == vinh->value()) indirectly = ""; else indirectly = "indirectly "; IdlError(file, line, "In declaration of valuetype '%s', supported " "interface '%s' is not derived from interface '%s' %s" "supported by inherited valuetype '%s'", identifier, tsssn, isssn, indirectly, ivssn); IdlErrorCont(vinh->value()->file(), vinh->value()->line(), "(%s declared here)", ivssn); delete [] tsssn; delete [] isssn; delete [] ivssn; } } } scope_->setInherited(supports, file, line); } else { // Check that inherited values do not have conflicting supports InheritSpec* baseis; ValueBase* iv; Interface* ii = 0; for (ValueInheritSpec* vinh = inherits; vinh; vinh = vinh->next()) { iv = vinh->value(); do { ValueInheritSpec* parent; if (iv->kind() == D_VALUE) { baseis = ((Value*)iv)->supports(); parent = ((Value*)iv)->inherits(); } else { baseis = ((ValueAbs*)iv)->supports(); parent = ((ValueAbs*)iv)->inherits(); } if (!baseis || baseis->interface()->abstract()) { if (parent) iv = parent->value(); else break; } } while (!baseis && iv); if (baseis && ! baseis->interface()->abstract()) { if (ii) { if (baseis->interface() != ii) { char* ssn1 = ii->scope()->scopedName()->toString(); char* ssn2 = baseis->scope()->scopedName()->toString(); IdlError(file, line, "In declaration of valuetype '%s', supported " "interfaces '%s' and '%s' clash", identifier, ssn1, ssn2); delete [] ssn1; delete [] ssn2; } } else { ii = baseis->interface(); } } } } Scope::current()->addDecl(identifier, scope_, this, thisType_, file, line); Scope::startScope(scope_); Prefix::newScope(identifier); } Value:: ~Value() { if (inherits_) delete inherits_; if (supports_) delete supports_; if (contents_) delete contents_; delete thisType_; } void Value:: finishConstruction(Decl* contents) { contents_ = contents; Prefix::endScope(); Scope::endScope(); mostRecent_ = this; } synopsis-0.12/Synopsis/Parsers/IDL/idlfixed.cc0000664000076400007640000003456311104703261020642 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlfixed.h Created on: 2001/01/31 // Author : Duncan Grisby (dpg1) // // Copyright (C) 2001 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Implementation of fixed point type /* $Log: idlfixed.cc,v $ Revision 1.1.4.2 2005/03/30 23:35:57 dgrisby Another merge from omni4_0_develop. Revision 1.1.4.1 2003/03/23 21:01:45 dgrisby Start of omniORB 4.1.x development branch. Revision 1.1.2.1 2001/03/13 10:32:12 dpg1 Fixed point support. */ #include #include #include #include IDL_Fixed::IDL_Fixed() : digits_(0), scale_(0), negative_(0) { memset(val_, 0, OMNI_FIXED_DIGITS); } IDL_Fixed::IDL_Fixed(const IDL_Fixed& f) : digits_(f.digits_), scale_(f.scale_), negative_(f.negative_) { memcpy(val_, f.val_, OMNI_FIXED_DIGITS); } IDL_Fixed::IDL_Fixed(const char* s, const char* file, int line) { // Sign (Actually redundant for omniidl. Here for completeness.) if (s[0] == '-') { negative_ = 1; ++s; } else if (s[0] == '+') { negative_ = 0; ++s; } else negative_ = 0; // Check there are some digits assert(*s != '\0' && *s != 'd' && *s != 'D'); // Skip leading zeros: while (*s == '0') ++s; int i, j, unscale = -1; // Count digits for (i=0, digits_=0; (s[i] >= '0' && s[i] <= '9') || s[i] == '.'; ++i) { if (s[i] == '.') { assert(unscale == -1); unscale = digits_; } else ++digits_; } if (unscale == -1) unscale = digits_; scale_ = digits_ - unscale; // Check there is no trailing garbage if (s[i] == 'd' || s[i] == 'D') assert(s[i+1] == '\0'); else assert(s[i] == '\0'); --i; // i is now the index of the last digit // Truncate if too many digits while (digits_ > OMNI_FIXED_DIGITS && scale_ > 0) { --i; --digits_; --scale_; } // Back-up over trailing zeros if (scale_ > 0) { while (s[i] == '0') { --i; --digits_; --scale_; } } if (digits_ > OMNI_FIXED_DIGITS) { if (file) { IdlError(file, line, "Fixed point constant has too many digits"); } *this = IDL_Fixed("1"); return; } for (j=0; j < digits_; ++j, --i) { if (s[i] == '.') --i; val_[j] = s[i] - '0'; } for (; j < OMNI_FIXED_DIGITS; ++j) val_[j] = 0; if (digits_ == 0) negative_ = 0; } IDL_Fixed::IDL_Fixed(const IDL_Octet* val, IDL_UShort digits, IDL_UShort scale, IDL_Boolean negative) : digits_(digits), scale_(scale), negative_(negative) { assert(digits <= OMNI_FIXED_DIGITS); assert(scale <= digits); while (digits_ > 0 && scale_ > 0 && val[0] == 0) { digits_--; scale_--; val++; } if (digits_ == 0) negative_ = 0; memcpy(val_, val, digits_); memset(val_ + digits_, 0, OMNI_FIXED_DIGITS - digits_); } IDL_Fixed::~IDL_Fixed() { } IDL_Fixed IDL_Fixed::truncate(IDL_UShort scale) { if (scale >= scale_) return *this; int cut = scale_ - scale; int newscale = scale; while (val_[cut] == 0 && newscale > 0) { ++cut; --newscale; } return IDL_Fixed(val_ + cut, digits_ - cut, newscale, negative_); } IDL_Fixed& IDL_Fixed::operator=(const IDL_Fixed& f) { digits_ = f.digits_; scale_ = f.scale_; negative_ = f.negative_; memcpy(val_, f.val_, OMNI_FIXED_DIGITS); return *this; } IDL_Fixed IDL_Fixed::operator-() const { if (digits_ == 0) return *this; IDL_Fixed r(*this); r.negative_ = !r.negative_; return r; } char* IDL_Fixed::asString() const { int len = digits_ + 1; if (negative_) ++len; // for '-' if (digits_ == scale_) ++len; // for '0' if (scale_ > 0) ++len; // for '.' char* r = new char[len]; int i = 0, j; if (negative_) r[i++] = '-'; if (digits_ == scale_) r[i++] = '0'; for (j=digits_; j; ) { if (j-- == scale_) r[i++] = '.'; r[i++] = val_[j] + '0'; } r[i] = '\0'; return r; } // Functions which do the real arithmetic static int absCmp(const IDL_Fixed& a, const IDL_Fixed& b) { int c; c = (a.fixed_digits()-a.fixed_scale()) - (b.fixed_digits()-b.fixed_scale()); if (c) return c; int ai, bi; ai = a.fixed_digits() - 1; bi = b.fixed_digits() - 1; while (ai >= 0 && bi >= 0) { c = a.val()[ai] - b.val()[bi]; if (c) return c; --ai; --bi; } if (ai >= 0) return 1; if (bi >= 0) return -1; return 0; } static IDL_Fixed realAdd(const IDL_Fixed& a, const IDL_Fixed& b, IDL_Boolean negative) { int scale, v, carry = 0, ai = 0, bi = 0, wi = 0; IDL_Octet work[OMNI_FIXED_DIGITS * 2]; if (a.fixed_scale() > b.fixed_scale()) { scale = a.fixed_scale(); while (ai < a.fixed_scale() - b.fixed_scale()) work[wi++] = a.val()[ai++]; } else if (b.fixed_scale() > a.fixed_scale()) { scale = b.fixed_scale(); while (bi < b.fixed_scale() - a.fixed_scale()) work[wi++] = b.val()[bi++]; } else scale = a.fixed_scale(); while (ai < a.fixed_digits() && bi < b.fixed_digits()) { v = a.val()[ai++] + b.val()[bi++] + carry; if (v > 9) { carry = 1; v -= 10; } else carry = 0; work[wi++] = v; } while (ai < a.fixed_digits()) { v = a.val()[ai++] + carry; if (v > 9) { carry = 1; v -= 10; } else carry = 0; work[wi++] = v; } while (bi < b.fixed_digits()) { v = b.val()[bi++] + carry; if (v > 9) { carry = 1; v -= 10; } else carry = 0; work[wi++] = v; } if (carry) { work[wi++] = carry; } IDL_Octet* wp = work; int digits = wi; // Truncate or complain if too many digits if (digits > OMNI_FIXED_DIGITS) { if (digits - scale <= OMNI_FIXED_DIGITS) { int chop = digits - OMNI_FIXED_DIGITS; wp += chop; scale -= chop; digits = OMNI_FIXED_DIGITS; } else throw IDL_Fixed::Overflow(); } // Strip trailing zeros while (scale > 0 && *wp == 0) { ++wp; --scale; --digits; } return IDL_Fixed(wp, digits, scale, negative); } static IDL_Fixed realSub(const IDL_Fixed& a, const IDL_Fixed& b, IDL_Boolean negative) { int scale, v, carry = 0, ai = 0, bi = 0, wi = 0; IDL_Octet work[OMNI_FIXED_DIGITS * 2]; if (a.fixed_scale() > b.fixed_scale()) { scale = a.fixed_scale(); while (ai < a.fixed_scale() - b.fixed_scale()) work[wi++] = a.val()[ai++]; } else if (b.fixed_scale() > a.fixed_scale()) { scale = b.fixed_scale(); while (bi < b.fixed_scale() - a.fixed_scale()) { work[wi++] = 10 - b.val()[bi++] + carry; carry = -1; } } else scale = a.fixed_scale(); while (ai < a.fixed_digits() && bi < b.fixed_digits()) { v = a.val()[ai++] - b.val()[bi++] + carry; if (v < 0) { carry = -1; v += 10; } else carry = 0; work[wi++] = v; } while (ai < a.fixed_digits()) { v = a.val()[ai++] + carry; if (v < 0) { carry = -1; v += 10; } else carry = 0; work[wi++] = v; } assert(bi == b.fixed_digits()); assert(carry == 0); int digits = wi; IDL_Octet* wp = work; // Strip leading zeros while (work[digits-1] == 0 && digits > scale) --digits; // Truncate or complain if too many digits if (digits > OMNI_FIXED_DIGITS) { assert(digits - scale <= OMNI_FIXED_DIGITS); int chop = digits - OMNI_FIXED_DIGITS; wp += chop; scale -= chop; digits = OMNI_FIXED_DIGITS; } // Strip trailing zeros while (scale > 0 && *wp == 0) { ++wp; --scale; --digits; } return IDL_Fixed(wp, digits, scale, negative); } static IDL_Fixed realMul(const IDL_Fixed& a, const IDL_Fixed& b, IDL_Boolean negative) { int ai, bi, wi, digits, scale, v, ad, bd, carry = 0; IDL_Octet work[OMNI_FIXED_DIGITS * 2]; memset(work, 0, OMNI_FIXED_DIGITS * 2); scale = a.fixed_scale() + b.fixed_scale(); for (ai=0, wi=0; ai < a.fixed_digits(); ++ai) { ad = a.val()[ai]; if (ad == 0) continue; for (bi=0; bi < b.fixed_digits(); ++bi) { bd = b.val()[bi]; if (bd == 0 && carry == 0) continue; wi = ai + bi; v = work[wi] + ad * bd + carry; carry = v / 10; work[wi] = v % 10; } while (carry) { ++wi; v = work[wi] + carry; carry = v / 10; work[wi] = v % 10; } } digits = wi+1; if (scale > digits) digits = scale; // Truncate or complain if too many digits IDL_Octet* wp = work; if (digits > OMNI_FIXED_DIGITS) { if (digits - scale <= OMNI_FIXED_DIGITS) { int chop = digits - OMNI_FIXED_DIGITS; wp += chop; scale -= chop; digits = OMNI_FIXED_DIGITS; } else throw IDL_Fixed::Overflow(); } // Strip trailing zeros while (scale > 0 && *wp == 0) { ++wp; --scale; --digits; } return IDL_Fixed(wp, digits, scale, negative); } static int divCmp(const IDL_Octet* av, int ad, const IDL_Octet* bv, int bd, int pos) { int c, ai, bi; for (ai = ad-1; ai > pos; --ai) { if (av[ai]) return 1; } ai = pos; bi = bd - 1; assert(ai >= bi); while (bi >= 0) { c = av[ai] - bv[bi]; if (c) return c; --ai; --bi; } return 0; } static int divDigit(IDL_Octet* av, int ad, const IDL_Octet* bv, int bd, int pos) { int ai, bi, carry, v, count = 0; while (divCmp(av, ad, bv, bd, pos) >= 0) { ++count; carry = 0; ai = pos - bd + 1; bi = 0; while (bi < bd) { v = av[ai] - bv[bi] + carry; if (v < 0) { carry = -1; v += 10; } else carry = 0; av[ai] = v; ++ai; ++bi; } while (ai < ad) { v = av[ai] + carry; if (v < 0) { carry = -1; v += 10; } else carry = 0; av[ai] = v; ++ai; } } assert(count < 10); return count; } static IDL_Fixed realDiv(const IDL_Fixed& a, const IDL_Fixed& b, IDL_Boolean negative) { int i, ai, bi, wi, ri, digits, scale, unscale, v, ad, bd, carry = 0; // This division algorithm basically does classic long division. The // numerator, a, is loaded into the top digits of "running". The // divisor, b, is then repeatedly subtracted from the top digits of // "running" until it can no longer be subtracted without becoming // negative. The count of subtractions forms the top digit of the // result. Then the next digit is found by shifting the divisor down // one digit, and repeating, and so on. // // The ugliness all comes because we need to figure out where to put // the decimal point. It would be easy if it wasn't for the fact // that values with scale > digits are not permitted. This means // that if the result is going to be of that form, some initial zero // digits have to be included. IDL_Octet work [OMNI_FIXED_DIGITS * 2]; IDL_Octet running[OMNI_FIXED_DIGITS * 2]; memset(work, 0, OMNI_FIXED_DIGITS * 2); memset(running, 0, OMNI_FIXED_DIGITS * 2); // Skip all leading zeros in a ad = a.fixed_digits(); while (a.val()[ad - 1] == 0) --ad; // Set most siginificant digits of running to a's digits ri = OMNI_FIXED_DIGITS * 2 - 1; ai = ad - 1; while (ai >= 0) { running[ri] = a.val()[ai]; --ri; --ai; } // Skip all leading zeros in b bd = b.fixed_digits(); while (b.val()[bd - 1] == 0) --bd; // unscale = number of digits to left of decimal point in answer unscale = (ad - a.fixed_scale()) - (bd - b.fixed_scale()) + 1; digits = 0; // Set some initial zero digits to prevent scale > digits if (unscale < 0) digits = -unscale; ri = OMNI_FIXED_DIGITS * 2 - 1; wi = ri - digits; // Iterate to work out the result digits while (digits < OMNI_FIXED_DIGITS) { // Finish if running is zero for (i=0; i < OMNI_FIXED_DIGITS*2 && running[i] == 0; ++i); if (i == OMNI_FIXED_DIGITS * 2) break; work[wi] = divDigit(running, OMNI_FIXED_DIGITS * 2, b.val(), bd, ri); if (digits || work[wi]) ++digits; --wi; --ri; } wi = OMNI_FIXED_DIGITS * 2 - 1; // Skip an initial zero if we weren't expecting one if (unscale >= 0) { while (work[wi] == 0 && unscale > 0) { --wi; --unscale; } } else unscale = 0; // Complain if too many digits before decimal point if (unscale > OMNI_FIXED_DIGITS) throw IDL_Fixed::Overflow(); // Deal with numbers with trailing zeros before the decimal point if (digits < unscale) digits = unscale; IDL_Octet* wp = &work[wi - digits + 1]; // Figure out scale scale = digits - unscale; if (digits < scale) digits = scale; // Strip trailing zeros while (scale > 0 && *wp == 0) { ++wp; --scale; --digits; } return IDL_Fixed(wp, digits, scale, negative); } // // Operators // IDL_Fixed operator+(const IDL_Fixed& a, const IDL_Fixed& b) { if (a.negative() == b.negative()) return realAdd(a, b, a.negative()); int cmp = absCmp(a, b); if (cmp == 0) // a == b return IDL_Fixed(); else if (cmp > 0) // a > b return realSub(a, b, a.negative()); else return realSub(b, a, b.negative()); } IDL_Fixed operator-(const IDL_Fixed& a, const IDL_Fixed& b) { if (a.negative() != b.negative()) return realAdd(a, b, a.negative()); int cmp = absCmp(a, b); if (cmp == 0) // a == b return IDL_Fixed(); else if (cmp > 0) // a > b return realSub(a, b, a.negative()); else return realSub(b, a, !a.negative()); } IDL_Fixed operator*(const IDL_Fixed& a, const IDL_Fixed& b) { if (a.fixed_digits() == 0 || b.fixed_digits() == 0) return IDL_Fixed(); if (a.negative() == b.negative()) return realMul(a, b, 0); else return realMul(a, b, 1); } IDL_Fixed operator/(const IDL_Fixed& a, const IDL_Fixed& b) { if (b.fixed_digits() == 0) throw IDL_Fixed::DivideByZero(); if (a.fixed_digits() == 0) return IDL_Fixed(); if (a.negative() == b.negative()) return realDiv(a, b, 0); else return realDiv(a, b, 1); } synopsis-0.12/Synopsis/Parsers/IDL/idlvisitor.py0000664000076400007640000001067711104703261021305 0ustar stefanstefan# -*- python -*- # Package : omniidl # idlvisitor.py Created on: 1999/10/27 # Author : Duncan Grisby (dpg1) # # Copyright (C) 1999 AT&T Laboratories Cambridge # # This file is part of omniidl. # # omniidl is free software; you can redistribute 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. # # Description: # # Base classes for Visitors # $Id: idlvisitor.py,v 1.8.2.1 2003/03/23 21:01:38 dgrisby Exp $ # $Log: idlvisitor.py,v $ # Revision 1.8.2.1 2003/03/23 21:01:38 dgrisby # Start of omniORB 4.1.x development branch. # # Revision 1.5.2.2 2000/11/01 12:46:00 dpg1 # Update to CORBA 2.4 specification. # # Revision 1.5.2.1 2000/07/17 10:36:07 sll # Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0. # # Revision 1.6 2000/07/13 15:25:51 dpg1 # Merge from omni3_develop for 3.0 release. # # Revision 1.3 1999/11/15 15:49:23 dpg1 # Documentation strings. # # Revision 1.2 1999/10/29 18:20:01 dpg1 # Clean up # # Revision 1.1 1999/10/29 15:47:07 dpg1 # First revision. # """Visitor pattern visitors for AST nodes and types This module declares abstract visitor classes for visiting AST nodes and type objects. Python's type system means that you do not actually need to derive from these classes to implement visitors. This module only really exists to show what functions should exist in visitors. Classes: AstVisitor -- visitor for classes in idlast.py TypeVisitor -- visitor for classes in idltype.py""" class AstVisitor : """Visitor for AST nodes Functions: visitAST(node) visitModule(node) visitInterface(node) visitForward(node) visitConst(node) visitDeclarator(node) visitTypedef(node) visitMember(node) visitStruct(node) visitStructForward(node) visitException(node) visitCaseLabel(node) visitUnionCase(node) visitUnion(node) visitUnionForward(node) visitEnumerator(node) visitEnum(node) visitAttribute(node) visitParameter(node) visitOperation(node) visitNative(node) visitStateMember(node) visitFactory(node) visitValueForward(node) visitValueBox(node) visitValueAbs(node) visitValue(node)""" def visitAST(self, node): return def visitModule(self, node): return def visitInterface(self, node): return def visitForward(self, node): return def visitConst(self, node): return def visitDeclarator(self, node): return def visitTypedef(self, node): return def visitMember(self, node): return def visitStruct(self, node): return def visitStructForward(self, node): return def visitException(self, node): return def visitCaseLabel(self, node): return def visitUnionCase(self, node): return def visitUnion(self, node): return def visitUnionForward(self, node): return def visitEnumerator(self, node): return def visitEnum(self, node): return def visitAttribute(self, node): return def visitParameter(self, node): return def visitOperation(self, node): return def visitNative(self, node): return def visitStateMember(self, node): return def visitFactory(self, node): return def visitValueForward(self, node): return def visitValueBox(self, node): return def visitValueAbs(self, node): return def visitValue(self, node): return class TypeVisitor: """Visitor for Type objects Functions: visitBaseType(type) visitStringType(type) visitWStringType(type) visitSequenceType(type) visitFixedType(type) visitDeclaredType(type)""" def visitBaseType(self, type): return def visitStringType(self, type): return def visitWStringType(self, type): return def visitSequenceType(self, type): return def visitFixedType(self, type): return def visitDeclaredType(self, type): return synopsis-0.12/Synopsis/Parsers/IDL/idlscope.h0000664000076400007640000002645011104703261020512 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlscope.h Created on: 1999/10/11 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Definitions for scope manipulation // $Id: idlscope.h,v 1.9.2.1 2003/03/23 21:01:44 dgrisby Exp $ // $Log: idlscope.h,v $ // Revision 1.9.2.1 2003/03/23 21:01:44 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.5.2.4 2001/10/29 17:42:43 dpg1 // Support forward-declared structs/unions, ORB::create_recursive_tc(). // // Revision 1.5.2.3 2000/10/27 16:31:10 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.5.2.2 2000/10/10 10:18:51 dpg1 // Update omniidl front-end from omni3_develop. // // Revision 1.3.2.2 2000/09/19 09:14:26 dpg1 // Scope::Entry::Kind renamed to Scope::Entry::EntryKind to avoid // problems with over-keen compilers // // Revision 1.3.2.1 2000/08/29 15:20:29 dpg1 // New relativeScope() function. New -i flag to enter interactive loop // after parsing // // Revision 1.3 1999/11/02 17:07:25 dpg1 // Changes to compile on Solaris. // // Revision 1.2 1999/10/29 10:01:50 dpg1 // Global scope initialisation changed. // // Revision 1.1 1999/10/27 14:05:55 dpg1 // *** empty log message *** // #ifndef _idlscope_h_ #define _idlscope_h_ #include // Class to represent an absolute or relative scoped name as a list. class ScopedName { public: class Fragment { public: // Constructor copies identifier Fragment(const char* identifier) : next_(0), identifier_(idl_strdup(identifier)) {} ~Fragment() { delete [] identifier_; } inline const char* identifier() const { return identifier_; } inline Fragment* next() const { return next_; }; protected: Fragment* next_; private: char* identifier_; friend class ScopedName; }; ScopedName(const char* identifier, IDL_Boolean absolute); // Copy constructors ScopedName(const ScopedName* sn); ScopedName(const Fragment* frags, IDL_Boolean absolute); ~ScopedName(); // Return the scope list Fragment* scopeList() const { return scopeList_; } // Is the name absolute (i.e. ::A::... rather than A::...) IDL_Boolean absolute() const { return absolute_; } // toString() returns a new string containing the stringified // name. The caller is responsible for deleting it. If qualify is // true, and the name is absolute, prefix with ::, otherwise do not. char* toString(IDL_Boolean qualify=0) const; IDL_Boolean equal(const ScopedName* sn) const; // Append a new fragment void append(const char* identifier); private: Fragment* scopeList_; Fragment* last_; IDL_Boolean absolute_; }; // Class to represent a scope class Decl; class IdlType; class InheritSpec; class ValueInheritSpec; class Scope { public: class Entry; // Entry in a scope class EntryList; // Linked list of entries enum Kind { S_GLOBAL, S_MODULE, S_INTERFACE, S_STRUCT, S_EXCEPTION, S_UNION, S_OPERATION, S_VALUE }; // Static functions to return the current and global scopes static Scope* global() { return global_; } static Scope* current() { return current_; } // Static functions to initialise and clear the global and CORBA:: scopes static void init(); static void clear(); // Functions to create new sub-scopes of the current scope. If // newModuleScope() is asked to create a module scope which already // exists, it re-opens the existing scope. Scope* newModuleScope (const char* identifier, const char* file, int line); Scope* newInterfaceScope(const char* identifier, const char* file, int line); Scope* newStructScope (const char* identifier, const char* file, int line); Scope* newExceptionScope(const char* identifier, const char* file, int line); Scope* newUnionScope (const char* identifier, const char* file, int line); Scope* newOperationScope(const char* file, int line); Scope* newValueScope (const char* identifier, const char* file, int line); // Change the current scope static void startScope(Scope* s); static void endScope(); // Create an unnamed or named scope. If the nestedUse flag is true, // use of identifiers in child scopes are considered uses within // this scope. This is true for scopes created by interfaces and // valuetypes, but not those created by modules. If the parent scope // has nestedUse true, this scope sets it too. Scope(Scope* parent, Kind k, IDL_Boolean nestedUse, const char* file, int line); Scope(Scope* parent, const char* identifier, Kind k, IDL_Boolean nestedUse, const char* file, int line); ~Scope(); // For interfaces, set a list of inherited Scopes. Checks that // inheritance has not added any clashing operation or attribute // names. void setInherited(InheritSpec* inherited, const char* file, int line); void setInherited(ValueInheritSpec* inherited, const char* file, int line); // Query interface Scope* parent() const { return parent_; } Kind kind() const { return kind_; } const char* identifier() const { return identifier_; } const ScopedName* scopedName() const { return scopedName_; } IDL_Boolean nestedUse() const { return nestedUse_; } Entry* entries() const { return entries_; } // Functions to lookup and add entries to the scope, reporting any // violations of the IDL scope rules as errors. // Find an entry in this scope. Entry* find(const char* identifier) const; // Find an entry in this scope, ignoring case Entry* iFind(const char* identifier) const; // Find entries in this scope or inherited scopes. Does not return // USE or PARENT entries. EntryList* findWithInheritance(const char* identifier) const; EntryList* iFindWithInheritance(const char* identifier) const; // Find an entry based on a ScopedName. File and line requesting the // find are given so errors can be reported nicely. If file and line // are zero, do not report errors. const Entry* findScopedName(const ScopedName* sn, const char* file = 0, int line = 0) const; // Find an entry based on a ScopedName, and mark it as used in this // scope (and any parent scopes with nestedUse true). const Entry* findForUse(const ScopedName* sn, const char* file, int line); void addUse(const ScopedName* sn, const char* file, int line); // Given source and destination ScopedNames, construct a relative or // absolute ScopedName which uniquely identifies the destination // from within the scope of the source. Returns 0 if either scoped // name does not exist, or is not absolute. static ScopedName* relativeScopedName(const ScopedName* from, const ScopedName* to); // The following add functions take identifiers with _ escape // characters intact, so they can properly detect clashes with // keywords. // Add a module, or do nothing if the module was already added void addModule(const char* identifier, Scope* scope, Decl* decl, const char* file, int line); // Add a declaration void addDecl(const char* identifier, Scope* scope, // Scope formed by this declaration, if any Decl* decl, // Decl object for this declaration IdlType* idltype, // IdlType for this declaration const char* file, int line); // Add an operation or attribute void addCallable(const char* identifier, Scope* scope, Decl* decl, const char* file, int line); // Add an inherited operation or attribute void addInherited(const char* identifier, Scope* scope, Decl* decl, Entry* inh_from, const char* file, int line); // Add an instance void addInstance(const char* identifier, Decl* decl, // Declaration of the instance IdlType* idltype, // Type of the instance const char* file, int line); // Remove an entry. Only used to remove a forward declared interface // when the full definition comes along. void remEntry(Entry* e); class Entry { public: enum EntryKind { E_MODULE, // Module E_DECL, // Declaration E_CALLABLE, // Operation or attribute E_INHERITED, // Inherited callable E_INSTANCE, // Instance of a type E_USE, // Identifier introduced through use E_PARENT // Name of enclosing scope }; Entry(const Scope* container, EntryKind kind, const char* identifier, Scope* scope, Decl* decl, IdlType* idltype, Entry* inh_from, const char* file, int line); ~Entry(); const Scope* container() const { return container_; } EntryKind kind() const { return kind_; } const char* identifier() const { return identifier_; } const ScopedName* scopedName() const { return scopedName_; } const char* file() const { return file_; } int line() const { return line_; } // Scope, Decl, IdlType, and Entry inherited from, if appropriate, // null if not Scope* scope() const { return scope_; } Decl* decl() const { return decl_; } IdlType* idltype() const { return idltype_; } Entry* inh_from() const { return inh_from_; } // Linked list inside Scope Entry* next() const { return next_; } private: const Scope* container_; EntryKind kind_; char* identifier_; ScopedName* scopedName_; Scope* scope_; Decl* decl_; IdlType* idltype_; Entry* inh_from_; char* file_; int line_; Entry* next_; friend class Scope; }; class EntryList { public: EntryList(const Entry* e) : head_(e), next_(0) { last_ = this; } ~EntryList() { if (next_) delete next_; } const Entry* head() const { return head_; } EntryList* tail() const { return next_; } void append(EntryList* el) { last_->next_ = el; last_ = el->last_; } void merge(EntryList* ml); private: const Entry* head_; protected: EntryList* next_; EntryList* last_; }; private: Scope* parent_; Kind kind_; char* identifier_; ScopedName* scopedName_; IDL_Boolean nestedUse_; Entry* entries_; Entry* last_; InheritSpec* inherited_; ValueInheritSpec* valueInherited_; static Scope* global_; static Scope* current_; void appendEntry(Entry* e); IDL_Boolean keywordClash(const char* identifier, const char* file, int line); }; #endif // _idlscope_h_ synopsis-0.12/Synopsis/Parsers/IDL/idl.ll0000664000076400007640000003756711104703262017654 0ustar stefanstefan%{ // -*- c++ -*- // Package : omniidl // idl.ll Created on: 1999/10/05 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Flex lexical analyser // $Id: idl.ll,v 1.13.2.2 2005/01/06 23:11:14 dgrisby Exp $ // $Log: idl.ll,v $ // Revision 1.13.2.2 2005/01/06 23:11:14 dgrisby // Big merge from omni4_0_develop. // // Revision 1.13.2.1 2003/03/23 21:01:48 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.9.2.8 2001/10/22 10:48:22 dpg1 // Cope with DOS line endings in all IDL situations. // // Revision 1.9.2.7 2001/10/17 16:48:32 dpg1 // Minor error message tweaks // // Revision 1.9.2.6 2001/06/13 11:28:20 dpg1 // Proper omniidl support for wchar/wstring constants. // // Revision 1.9.2.5 2001/03/13 10:32:10 dpg1 // Fixed point support. // // Revision 1.9.2.4 2000/11/01 12:45:55 dpg1 // Update to CORBA 2.4 specification. // // Revision 1.9.2.3 2000/10/27 16:31:07 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.9.2.2 2000/10/10 10:18:50 dpg1 // Update omniidl front-end from omni3_develop. // // Revision 1.7.2.8 2000/08/07 15:34:35 dpg1 // Partial back-port of long long from omni3_1_develop. // // Revision 1.7.2.7 2000/06/09 11:20:47 dpg1 // Last fix put __omni_pragma line numbers off by one... // // Revision 1.7.2.6 2000/06/08 14:58:19 dpg1 // Line numbers for #pragmas and // comments were off by one // // Revision 1.7.2.5 2000/06/08 14:36:19 dpg1 // Comments and pragmas are now objects rather than plain strings, so // they can have file,line associated with them. // // Revision 1.7.2.4 2000/06/05 18:12:25 dpg1 // Support for __omni_pragma // // Revision 1.7.2.3 2000/04/26 09:55:48 dpg1 // cccp escapes characters like \ in line directives, so // parseLineDirective() needs to use escapedStringToString(). // // Revision 1.7.2.2 2000/03/06 15:03:49 dpg1 // Minor bug fixes to omniidl. New -nf and -k flags. // // Revision 1.7.2.1 2000/02/16 16:30:54 dpg1 // #pragma ID was misspelled #pragma id. Oops. // // Revision 1.7 2000/02/04 12:17:10 dpg1 // Support for VMS. // // Revision 1.6 1999/12/28 17:44:01 dpg1 // Stupid string allocation bug. // // Revision 1.5 1999/11/19 16:03:40 dpg1 // Flex scanner now accepts \r as whitespace. // // Revision 1.4 1999/11/05 10:36:42 dpg1 // Sorted out isatty() problems. // // Revision 1.3 1999/11/02 17:07:28 dpg1 // Changes to compile on Solaris. // // Revision 1.2 1999/11/01 10:05:00 dpg1 // New file attribute to AST. // // Revision 1.1 1999/10/27 14:06:00 dpg1 // *** empty log message *** // #define YY_NEVER_INTERACTIVE 1 #include #include #include #include #include #include #include #include #include #include #include char* currentFile; IDL_Boolean mainFile = 1; // Are we processing the main file int nestDepth = 0; // #include nesting depth char octalToChar(char* s); char hexToChar(char* s); char escapeToChar(char* s); IDL_UShort octalToWChar(char* s); IDL_UShort hexToWChar(char* s); IDL_UShort escapeToWChar(char* s); char* escapedStringToString(char* s); IDL_UShort* escapedStringToWString(char* s); void parseLineDirective(char* s); %} %option noyywrap %option yylineno %x comment %s known_pragma %x unknown_pragma %x omni_pragma WS [ \t\v\n\f\r] SPACE [ \t] ASCIILETTER [a-zA-Z] IDCHAR [a-zA-Z0-9_] IDENT ({ASCIILETTER}{IDCHAR}*) DECDIGIT [0-9] DECSTART [1-9] OCTSTART 0 OCTDIGIT [0-7] HEXSTART (0[xX]) HEXDIGIT [0-9a-fA-F] EXPONENT ([Ee][+-]?{DECDIGIT}+) STR (\"([^\"]|\\\")*\") %% abstract return ABSTRACT; any return ANY; attribute return ATTRIBUTE; boolean return BOOLEAN; case return CASE; char return CHAR; const return CONST; context return CONTEXT; custom return CUSTOM; default return DEFAULT; double return DOUBLE; enum return ENUM; exception return EXCEPTION; factory return FACTORY; FALSE return FALSE_; fixed return FIXED; float return FLOAT; in return IN; inout return INOUT; interface return INTERFACE; local return LOCAL; long return LONG; module return MODULE; native return NATIVE; Object return OBJECT; octet return OCTET; oneway return ONEWAY; out return OUT; private return PRIVATE; public return PUBLIC; raises return RAISES; readonly return READONLY; sequence return SEQUENCE; short return SHORT; string return STRING; struct return STRUCT; supports return SUPPORTS; switch return SWITCH; TRUE return TRUE_; truncatable return TRUNCATABLE; typedef return TYPEDEF; union return UNION; unsigned return UNSIGNED; ValueBase return VALUEBASE; valuetype return VALUETYPE; void return VOID; wchar return WCHAR; wstring return WSTRING; "<<" return LEFT_SHIFT; ">>" return RIGHT_SHIFT; "::" return SCOPE_DELIM; {IDENT} { yylval.id_val = idl_strdup(yytext); return IDENTIFIER; } _{IDENT} { yylval.id_val = idl_strdup(yytext); return IDENTIFIER; } {DECSTART}{DECDIGIT}* { errno = 0; yylval.int_literal_val = idl_strtoul(yytext, 10); if (errno == ERANGE) { IdlError(currentFile, yylineno, "Integer literal '%s' is too big", yytext); } return INTEGER_LITERAL; } {OCTSTART}{OCTDIGIT}+ { errno = 0; yylval.int_literal_val = idl_strtoul(yytext, 8); if (errno == ERANGE) { IdlError(currentFile, yylineno, "Integer literal '%s' is too big", yytext); } return INTEGER_LITERAL; } {HEXSTART}{HEXDIGIT}+ { errno = 0; yylval.int_literal_val = idl_strtoul(yytext, 16); if (errno == ERANGE) { IdlError(currentFile, yylineno, "Integer literal '%s' is too big", yytext); } return INTEGER_LITERAL; } "0" { yylval.int_literal_val = 0; return INTEGER_LITERAL; } "'"."'" { yylval.char_val = yytext[1]; return CHARACTER_LITERAL; } "'"\\([0-7]{1,3})"'" { yytext[yyleng-1] = '\0'; yylval.char_val = octalToChar(yytext + 1); return CHARACTER_LITERAL; } "'"\\x({HEXDIGIT}{1,2})"'" { yytext[yyleng-1] = '\0'; yylval.char_val = hexToChar(yytext + 1); return CHARACTER_LITERAL; } "'"\\u({HEXDIGIT}{1,4})"'" { IdlError(currentFile, yylineno, "\\u may only be used in wide characters and strings"); yylval.char_val = 0; return CHARACTER_LITERAL; } "'"\\."'" { yytext[yyleng-1] = '\0'; yylval.char_val = escapeToChar(yytext + 1); return CHARACTER_LITERAL; } L"'"."'" { yylval.wchar_val = yytext[2]; return WIDE_CHARACTER_LITERAL; } L"'"\\([0-7]{1,3})"'" { yytext[yyleng-1] = '\0'; yylval.wchar_val = octalToWChar(yytext + 2); return WIDE_CHARACTER_LITERAL; } L"'"\\x({HEXDIGIT}{1,2})"'" { yytext[yyleng-1] = '\0'; yylval.wchar_val = hexToWChar(yytext + 2); return WIDE_CHARACTER_LITERAL; } L"'"\\u({HEXDIGIT}{1,4})"'" { yytext[yyleng-1] = '\0'; yylval.wchar_val = hexToWChar(yytext + 2); return WIDE_CHARACTER_LITERAL; } L"'"\\."'" { yytext[yyleng-1] = '\0'; yylval.wchar_val = escapeToWChar(yytext + 2); return WIDE_CHARACTER_LITERAL; } {DECDIGIT}+{EXPONENT} { // Only deal with floats in INITIAL state, so version pragmas don't // get interpreted as floats. yylval.float_literal_val = idl_strtod(yytext); return FLOATING_PT_LITERAL; } {DECDIGIT}*"."{DECDIGIT}+{EXPONENT}? { yylval.float_literal_val = idl_strtod(yytext); return FLOATING_PT_LITERAL; } {DECDIGIT}+"."{DECDIGIT}*{EXPONENT}? { yylval.float_literal_val = idl_strtod(yytext); return FLOATING_PT_LITERAL; } {STR} { yytext[yyleng-1] = '\0'; yylval.string_val = escapedStringToString(yytext + 1); return STRING_LITERAL; } L{STR} { yytext[yyleng-1] = '\0'; yylval.wstring_val = escapedStringToWString(yytext + 2); return WIDE_STRING_LITERAL; } {DECDIGIT}+"."{DECDIGIT}*[dD] { yylval.fixed_val = new IDL_Fixed(yytext, currentFile, yylineno); return FIXED_PT_LITERAL; } {DECDIGIT}*"."{DECDIGIT}+[dD] { yylval.fixed_val = new IDL_Fixed(yytext, currentFile, yylineno); return FIXED_PT_LITERAL; } {DECDIGIT}+[dD] { yylval.fixed_val = new IDL_Fixed(yytext, currentFile, yylineno); return FIXED_PT_LITERAL; } "//".*\n { Comment::add(yytext, currentFile, yylineno-1); } "/*" { Comment::add(yytext, currentFile, yylineno); BEGIN(comment); } [^*\n]* { Comment::append(yytext); } "*"+[^*/\n]* { Comment::append(yytext); } \n { Comment::append(yytext); } "*"+"/" { Comment::append(yytext); BEGIN(INITIAL); } "__omni_pragma"{WS}+ { BEGIN(omni_pragma); return OMNI_PRAGMA; } {WS}+"__omni_endpragma" { BEGIN(INITIAL); return END_PRAGMA; } [^ \t\v\n\f\r]+ { yylval.string_val = idl_strdup(yytext); return UNKNOWN_PRAGMA_BODY; } {WS}+ { yylval.string_val = idl_strdup(yytext); return UNKNOWN_PRAGMA_BODY; } ^{SPACE}*#{SPACE}*pragma{SPACE}*prefix{SPACE}* { BEGIN(known_pragma); return PRAGMA_PREFIX; } ^{SPACE}*#{SPACE}*pragma{SPACE}*ID{SPACE}* { BEGIN(known_pragma); return PRAGMA_ID; } ^{SPACE}*#{SPACE}*pragma{SPACE}*version{SPACE}* { BEGIN(known_pragma); return PRAGMA_VERSION; } {SPACE}+ { /* Eat spaces and tabs */ } ^{SPACE}*#{SPACE}*pragma{SPACE}* { BEGIN(unknown_pragma); return PRAGMA; } ([^\\\n\r]|(\\[^\n\r]))+ { yylval.string_val = idl_strdup(yytext); return UNKNOWN_PRAGMA_BODY; } \\(\n|(\r\n)) { /* Continue line if it ends with \ */ } \n|(\r\n) { BEGIN(INITIAL); return END_PRAGMA; } ^{SPACE}*#{SPACE}*{DECDIGIT}+{SPACE}+{STR}{SPACE}+{DECDIGIT}*{SPACE}*\n { parseLineDirective(yytext); } ^{SPACE}*#{SPACE}*{DECDIGIT}+{SPACE}+{STR}{SPACE}*\n { parseLineDirective(yytext); } ^{SPACE}*#{SPACE}*{DECDIGIT}{SPACE}*\n { parseLineDirective(yytext); } ^{SPACE}*#line{SPACE}*{DECDIGIT}+{SPACE}+{STR}{SPACE}+{DECDIGIT}*{SPACE}*\n { parseLineDirective(yytext); } ^{SPACE}*#line{SPACE}*{DECDIGIT}+{SPACE}+{STR}{SPACE}*\n { parseLineDirective(yytext); } ^{SPACE}*#line{SPACE}*{DECDIGIT}{SPACE}*\n { parseLineDirective(yytext); } {WS} { /* Eat white space */ } . { return yytext[0]; } %% char octalToChar(char* s) { unsigned long ret = strtoul(s+1, 0, 8); if (ret > 255) { IdlError(currentFile, yylineno, "Octal character value '%s' too big", s); } return ret; } char hexToChar(char* s) { unsigned long ret = strtoul(s+2, 0, 16); return ret; } char escapeToChar(char* s) { switch (s[1]) { case 'n': return '\n'; case 't': return '\t'; case 'v': return '\v'; case 'b': return '\b'; case 'r': return '\r'; case 'f': return '\f'; case 'a': return '\a'; case '\\': return '\\'; case '?': return '?'; case '\'': return '\''; case '\"': return '\"'; } IdlWarning(currentFile, yylineno, "Behaviour for escape sequence '%s' is undefined by IDL; " "using '%c'", s, s[1]); return s[1]; } IDL_UShort octalToWChar(char* s) { unsigned long ret = strtoul(s+1, 0, 8); if (ret > 255) { // This really is meant to be 255 IdlError(currentFile, yylineno, "Octal character value '%s' too big", s); } return ret; } IDL_UShort hexToWChar(char* s) { unsigned long ret = strtoul(s+2, 0, 16); return ret; } IDL_UShort escapeToWChar(char* s) { switch (s[1]) { case 'n': return '\n'; case 't': return '\t'; case 'v': return '\v'; case 'b': return '\b'; case 'r': return '\r'; case 'f': return '\f'; case 'a': return '\a'; case '\\': return '\\'; case '?': return '?'; case '\'': return '\''; case '\"': return '\"'; } IdlWarning(currentFile, yylineno, "Behaviour for escape sequence '%s' is undefined by IDL; " "using '%c'.", s, s[1]); return s[1]; } char* escapedStringToString(char* s) { int len = strlen(s); char* ret = new char[len+1]; char tmp[8]; int from, to, i; for (from=0, to=0; from < len; from++, to++) { if (s[from] == '\\') { tmp[0] = s[from++]; if ('0' <= s[from] && s[from] <= '7') { // Octal for (i=1; i < 4 && from < len && '0' <= s[from] && s[from] <= '7'; from++, i++) tmp[i] = s[from]; tmp[i] = '\0'; ret[to] = octalToChar(tmp); from--; } else if (s[from] == 'x') { // Hex tmp[1] = s[from++]; for (i=2; i < 4 && from < len && isxdigit(s[from]); from++, i++) tmp[i] = s[from]; tmp[i] = '\0'; ret[to] = hexToChar(tmp); from--; } else if (s[from] == 'u') { // Wide hex not allowed IdlError(currentFile, yylineno, "\\u may only be used in wide characters and strings"); ret[to] = '!'; } else { tmp[1] = s[from]; tmp[2] = '\0'; ret[to] = escapeToChar(tmp); } if (ret[to] == '\0') { IdlError(currentFile, yylineno, "String cannot contain \\0"); ret[to] = '!'; } } else ret[to] = s[from]; } ret[to] = '\0'; return ret; } IDL_UShort* escapedStringToWString(char* s) { int len = strlen(s); IDL_UShort* ret = new IDL_UShort[len+1]; char tmp[8]; int from, to, i; for (from=0, to=0; from < len; from++, to++) { if (s[from] == '\\') { tmp[0] = s[from++]; if ('0' <= s[from] && s[from] <= '7') { // Octal for (i=1; i < 4 && from < len && '0' <= s[from] && s[from] <= '7'; from++, i++) tmp[i] = s[from]; tmp[i] = '\0'; ret[to] = octalToWChar(tmp); from--; } else if (s[from] == 'x') { // Hex tmp[1] = s[from++]; for (i=2; i < 4 && from < len && isxdigit(s[from]); from++, i++) tmp[i] = s[from]; tmp[i] = '\0'; ret[to] = hexToWChar(tmp); from--; } else if (s[from] == 'u') { // Wide hex tmp[1] = s[from++]; for (i=2; i < 6 && from < len && isxdigit(s[from]); from++, i++) tmp[i] = s[from]; tmp[i] = '\0'; ret[to] = hexToWChar(tmp); from--; } else { tmp[1] = s[from]; tmp[2] = '\0'; ret[to] = escapeToWChar(tmp); } if (ret[to] == 0) { IdlError(currentFile, yylineno, "Wide string cannot contain wide character zero"); ret[to] = '!'; } } else ret[to] = s[from]; } ret[to] = 0; return ret; } void parseLineDirective(char* s) { char* file = new char[strlen(s) + 1]; long int line = 0, mode = 0; int cnt = sscanf(s, "# %ld \"%[^\"]\" %ld", &line, file, &mode); if (cnt == 0) // Retry with a real "#line" directive. cnt = sscanf(s, "#line %ld \"%[^\"]\" %ld", &line, file, &mode); assert(cnt >= 1); if (cnt > 1) { if (cnt == 3) { if (mode == 1) { // New #included file ++nestDepth; mainFile = 0; Prefix::newFile(); } else if (mode == 2) { // Return from #include if (--nestDepth == 0) mainFile = 1; Prefix::endFile(); } } delete [] currentFile; // cccp escapes \ characters, so use the normal string parser currentFile = escapedStringToString(file); delete [] file; if (mainFile) AST::tree()->setFile(currentFile); } yylineno = line; } synopsis-0.12/Synopsis/Parsers/IDL/idlvalidate.h0000664000076400007640000000442211104703261021165 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlvalidate.h Created on: 1999/10/26 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Visitor object to validate the tree // $Id: idlvalidate.h,v 1.6.2.1 2003/03/23 21:01:43 dgrisby Exp $ // $Log: idlvalidate.h,v $ // Revision 1.6.2.1 2003/03/23 21:01:43 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.3.2.2 2000/11/01 15:44:56 dpg1 // Support for forward-declared structs and unions // // Revision 1.3.2.1 2000/07/17 10:36:05 sll // Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0. // // Revision 1.4 2000/07/13 15:25:52 dpg1 // Merge from omni3_develop for 3.0 release. // // Revision 1.1 1999/10/27 14:05:53 dpg1 // *** empty log message *** // #ifndef _idlvalidate_h_ #define _idlvalidate_h_ #include // AstValidateVisitor currently just issues warnings if interfaces or // values are forward declared but never fully declared class AstValidateVisitor : public AstVisitor { public: AstValidateVisitor() {} virtual ~AstValidateVisitor() {} void visitAST (AST* a); void visitModule (Module* m); void visitInterface (Interface* i); void visitForward (Forward* f); void visitValueForward (ValueForward* f); void visitStructForward (StructForward* f); void visitUnionForward (UnionForward* f); }; #endif // _idlvalidate_h_ synopsis-0.12/Synopsis/Parsers/IDL/idltype.h0000664000076400007640000002071711104703261020362 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idltype.h Created on: 1999/10/18 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Type objects // $Id: idltype.h,v 1.8.2.1 2003/03/23 21:01:44 dgrisby Exp $ // $Log: idltype.h,v $ // Revision 1.8.2.1 2003/03/23 21:01:44 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.5.2.4 2001/03/13 10:32:13 dpg1 // Fixed point support. // // Revision 1.5.2.3 2000/11/01 12:45:57 dpg1 // Update to CORBA 2.4 specification. // // Revision 1.5.2.2 2000/10/27 16:31:10 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.5.2.1 2000/07/17 10:36:05 sll // Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0. // // Revision 1.6 2000/07/13 15:25:52 dpg1 // Merge from omni3_develop for 3.0 release. // // Revision 1.3 1999/11/17 17:16:59 dpg1 // Changes to remove static initialisation of objects. // // Revision 1.2 1999/10/29 15:44:23 dpg1 // DeclaredType() now takes extra DeclRepoId* argument. // // Revision 1.1 1999/10/27 14:05:54 dpg1 // *** empty log message *** // #ifndef _idltype_h_ #define _idltype_h_ #include #include #include // Note on Type object memory management // // All type objects which can be are statically allocated; all others // are allocated on the heap. When Decl objects receive a pointer to a // type object, they should call its shouldDelete() function to see if // they are responsible for deleting the object. This only returns // true for those heap-allocated objects which do not have an // associated Decl object. Type objects created by Decl constructors // must be deleted by the Decls' destructors. class IdlType { public: enum Kind { tk_null = 0, tk_void = 1, tk_short = 2, tk_long = 3, tk_ushort = 4, tk_ulong = 5, tk_float = 6, tk_double = 7, tk_boolean = 8, tk_char = 9, tk_octet = 10, tk_any = 11, tk_TypeCode = 12, tk_Principal = 13, tk_objref = 14, tk_struct = 15, tk_union = 16, tk_enum = 17, tk_string = 18, tk_sequence = 19, tk_array = 20, tk_alias = 21, tk_except = 22, tk_longlong = 23, tk_ulonglong = 24, tk_longdouble = 25, tk_wchar = 26, tk_wstring = 27, tk_fixed = 28, tk_value = 29, tk_value_box = 30, tk_native = 31, tk_abstract_interface = 32, tk_local_interface = 33, // omniidl-specific kinds ot_structforward = 100, ot_unionforward = 101 }; IdlType(Kind k) : kind_(k), local_(0) { } virtual ~IdlType() {}; Kind kind() const { return kind_; } const char* kindAsString() const; IDL_Boolean local() const { return local_; } void setLocal() { local_ = 1; } // True if this is a "local" type which must not be transmitted // across the network. IdlType* unalias(); // Return an equivalent IdlType object with aliases stripped. virtual IDL_Boolean shouldDelete() = 0; virtual void accept(TypeVisitor& visitor) = 0; // Find a type given a name. Marks the name used in current scope static IdlType* scopedNameToType(const char* file, int line, const ScopedName* sn); static void init(); private: Kind kind_; IDL_Boolean local_; static IDL_Boolean initialised_; }; class BaseType : public IdlType { public: BaseType(Kind k) : IdlType(k) {} virtual ~BaseType() {} IDL_Boolean shouldDelete() { return 0; } void accept(TypeVisitor& visitor) { visitor.visitBaseType(this); } // Static base type singletons static BaseType* nullType; static BaseType* voidType; static BaseType* shortType; static BaseType* longType; static BaseType* ushortType; static BaseType* ulongType; static BaseType* floatType; static BaseType* doubleType; static BaseType* booleanType; static BaseType* charType; static BaseType* octetType; static BaseType* anyType; static BaseType* TypeCodeType; static BaseType* PrincipalType; static BaseType* longlongType; static BaseType* ulonglongType; static BaseType* longdoubleType; static BaseType* wcharType; }; // // Strings can be used like base types without a declaration. eg: // // void op(in string<10> s); // // therefore, the String type must include its bound here, rather than // relying on looking at the corresponding declaration // class StringType : public IdlType { public: StringType(IDL_ULong bound) : IdlType(tk_string), bound_(bound) { } virtual ~StringType() {} IDL_ULong bound() { return bound_; } IDL_Boolean shouldDelete() { return bound_ ? 1 : 0; } void accept(TypeVisitor& visitor) { visitor.visitStringType(this); } static StringType* unboundedStringType; private: IDL_ULong bound_; }; class WStringType : public IdlType { public: WStringType(IDL_ULong bound) : IdlType(tk_wstring), bound_(bound) { } virtual ~WStringType() {} IDL_ULong bound() { return bound_; } IDL_Boolean shouldDelete() { return bound_ ? 1 : 0; } void accept(TypeVisitor& visitor) { visitor.visitWStringType(this); } static WStringType* unboundedWStringType; private: IDL_ULong bound_; }; // // Sequences are never declared. They either appear as // // typedef sequence <...> ... // // or inside a struct or union // class SequenceType : public IdlType { public: SequenceType(IdlType* seqType, IDL_ULong bound) : IdlType(tk_sequence), seqType_(seqType), bound_(bound) { if (seqType && seqType->local()) setLocal(); } virtual ~SequenceType() {} IdlType* seqType() { return seqType_; } IDL_ULong bound() { return bound_; } IDL_Boolean shouldDelete() { return 1; } void accept(TypeVisitor& visitor) { visitor.visitSequenceType(this); } private: IdlType* seqType_; IDL_ULong bound_; }; // // Same goes for fixed // class FixedType : public IdlType { public: FixedType(IDL_Short digits, IDL_Short scale) : IdlType(tk_fixed), digits_(digits), scale_(scale) { } virtual ~FixedType() {} IDL_UShort digits() { return digits_; } IDL_UShort scale() { return scale_; } IDL_Boolean shouldDelete() { return 1; } void accept(TypeVisitor& visitor) { visitor.visitFixedType(this); } private: IDL_UShort digits_; IDL_UShort scale_; }; // // All other types must be declared, at least implicitly, so they have // an associated declaration object // class Decl; class DeclRepoId; class DeclaredType : public IdlType { public: DeclaredType(Kind k, Decl* decl, DeclRepoId* declRepoId) : IdlType(k), decl_(decl), declRepoId_(declRepoId) {} virtual ~DeclaredType() {} Decl* decl() { return decl_; } DeclRepoId* declRepoId() { return declRepoId_; } IDL_Boolean shouldDelete() { return 0; } void accept(TypeVisitor& visitor) { visitor.visitDeclaredType(this); } static DeclaredType* corbaObjectType; private: Decl* decl_; DeclRepoId* declRepoId_; }; // // TypeSpec class is used to distinguish simple_type_spec from // constr_type_spec in the grammar // class TypeSpec { public: TypeSpec(IdlType* type, IDL_Boolean constr) : type_(type), constr_(constr) {} ~TypeSpec() {} IdlType* type() const { return type_; } IDL_Boolean constr() const { return constr_; } private: IdlType* type_; IDL_Boolean constr_; }; #endif // _idltype_h_ synopsis-0.12/Synopsis/Parsers/IDL/idlfixed.h0000664000076400007640000000536311104703262020501 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlfixed.h Created on: 2001/01/30 // Author : Duncan Grisby (dpg1) // // Copyright (C) 2001 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Implementation of fixed point type // $Log: idlfixed.h,v $ // Revision 1.1.4.1 2003/03/23 21:01:45 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.1.2.2 2002/01/15 16:38:14 dpg1 // On the road to autoconf. Dependencies refactored, configure.ac // written. No makefiles yet. // // Revision 1.1.2.1 2001/03/13 10:32:12 dpg1 // Fixed point support. // #ifndef _idlfixed_h_ #define _idlfixed_h_ #include #ifndef OMNI_FIXED_DIGITS # define OMNI_FIXED_DIGITS 31 #endif class IDL_Fixed { public: // Subset of functions from CORBA::Fixed IDL_Fixed(); IDL_Fixed(const IDL_Fixed& f); IDL_Fixed(const char* s, const char* file = 0, int line = 0); IDL_Fixed(const IDL_Octet* val, IDL_UShort digits, IDL_UShort scale, IDL_Boolean negative); ~IDL_Fixed(); IDL_Fixed truncate(IDL_UShort scale); IDL_Fixed& operator=(const IDL_Fixed& f); IDL_Fixed operator-() const; IDL_UShort fixed_digits() const { return digits_; } IDL_UShort fixed_scale() const { return scale_; } char* asString() const; // Return the value of the fixed as a string. Caller frees. const IDL_Octet* val() const { return val_; } IDL_Boolean negative() const { return negative_; } class Overflow {}; class DivideByZero {}; // Exceptions thrown when fixed digits overflow or divide by zero private: IDL_Octet val_[OMNI_FIXED_DIGITS]; IDL_UShort digits_; IDL_UShort scale_; IDL_Boolean negative_; // true if negative; false if positive }; IDL_Fixed operator+(const IDL_Fixed& a, const IDL_Fixed& b); IDL_Fixed operator-(const IDL_Fixed& a, const IDL_Fixed& b); IDL_Fixed operator*(const IDL_Fixed& a, const IDL_Fixed& b); IDL_Fixed operator/(const IDL_Fixed& a, const IDL_Fixed& b); #endif // _idlfixed_h_ synopsis-0.12/Synopsis/Parsers/IDL/idlscope.cc0000664000076400007640000010232611104703261020645 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlscope.cc Created on: 1999/10/11 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Scope manipulation // $Id: idlscope.cc,v 1.18.2.5 2005/05/10 22:07:31 dgrisby Exp $ // $Log: idlscope.cc,v $ // Revision 1.18.2.5 2005/05/10 22:07:31 dgrisby // Merge again. // // Revision 1.18.2.4 2005/01/06 23:11:14 dgrisby // Big merge from omni4_0_develop. // // Revision 1.18.2.3 2004/10/13 17:58:25 dgrisby // Abstract interfaces support; values support interfaces; value bug fixes. // // Revision 1.18.2.2 2004/02/16 10:10:33 dgrisby // More valuetype, including value boxes. C++ mapping updates. // // Revision 1.18.2.1 2003/03/23 21:01:44 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.13.2.8 2003/03/20 10:24:27 dgrisby // Warn about use of CORBA 3 keywords in IDL. // // Revision 1.13.2.7 2001/10/29 17:42:43 dpg1 // Support forward-declared structs/unions, ORB::create_recursive_tc(). // // Revision 1.13.2.6 2001/10/17 16:48:33 dpg1 // Minor error message tweaks // // Revision 1.13.2.5 2001/06/08 17:12:23 dpg1 // Merge all the bug fixes from omni3_develop. // // Revision 1.13.2.4 2000/12/05 17:45:19 dpg1 // omniidl case sensitivity updates from omni3_develop. // // Revision 1.13.2.3 2000/10/27 16:31:10 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.13.2.2 2000/10/10 10:18:51 dpg1 // Update omniidl front-end from omni3_develop. // // Revision 1.11.2.6 2000/09/19 09:14:26 dpg1 // Scope::Entry::Kind renamed to Scope::Entry::EntryKind to avoid // problems with over-keen compilers // // Revision 1.11.2.5 2000/08/29 15:20:28 dpg1 // New relativeScope() function. New -i flag to enter interactive loop // after parsing // // Revision 1.11.2.4 2000/08/24 11:33:00 dpg1 // Typo in error message % format string // // Revision 1.11.2.3 2000/08/04 09:10:27 dpg1 // Fix look-up of escaped identifiers broken on 19 July. (Bug 14.) // // Revision 1.11.2.2 2000/08/01 09:46:47 dpg1 // No longer complain about inheriting an operation into an interface // with the same name. // // Revision 1.11.2.1 2000/07/19 17:24:54 dpg1 // omniidl complains if a name which differs only in case is found during // name look-up // // Revision 1.11 1999/11/26 11:33:44 dpg1 // Bug in findWithInheritance() when inherited interface was not found. // // Revision 1.10 1999/11/17 17:23:54 dpg1 // Minor bug when scoped name look-up encounters an identifier which does // not form a scope. // // Revision 1.9 1999/11/17 17:17:00 dpg1 // Changes to remove static initialisation of objects. // // Revision 1.8 1999/11/11 10:20:30 dpg1 // Bug in marking use of fully-scoped names. // // Revision 1.7 1999/11/04 17:16:55 dpg1 // Changes for NT. // // Revision 1.6 1999/11/02 17:07:25 dpg1 // Changes to compile on Solaris. // // Revision 1.5 1999/11/02 12:10:51 dpg1 // Small bug in addUse() // // Revision 1.4 1999/11/02 10:35:03 dpg1 // add...() functions now carry on regardless after a keyword clash, to // prevent later errors. // // Revision 1.3 1999/11/02 10:01:46 dpg1 // Minor fixes. // // Revision 1.2 1999/10/29 10:01:50 dpg1 // Global scope initialisation changed. // // Revision 1.1 1999/10/27 14:05:55 dpg1 // *** empty log message *** // #include #include #include #include #include #include #include // Global Scope pointers Scope* Scope::global_ = 0; Scope* Scope::current_ = 0; int n_builtins = 0; static Decl** builtins = 0; // ScopedName implementation ScopedName:: ScopedName(const char* identifier, IDL_Boolean absolute) : absolute_(absolute) { Fragment* f = new Fragment(identifier); scopeList_ = f; last_ = f; } ScopedName:: ScopedName(const ScopedName* sn) : scopeList_(0), last_(0), absolute_(sn->absolute()) { const Fragment *f; for (f = sn->scopeList(); f; f = f->next()) append(f->identifier()); } ScopedName:: ScopedName(const ScopedName::Fragment* frags, IDL_Boolean absolute) : scopeList_(0), last_(0), absolute_(absolute) { const Fragment *f; for (f = frags; f; f = f->next()) append(f->identifier()); } ScopedName:: ~ScopedName() { Fragment* f; Fragment* g; for (f = scopeList_; f; f = g) { g = f->next_; delete f; } } char* ScopedName:: toString(IDL_Boolean qualify) const { int i; Fragment* f; i = (qualify && absolute_) ? 2 : 0; for (f = scopeList_; f; f = f->next()) i += strlen(f->identifier()) + 2; char* str = new char [i-1]; if (qualify && absolute_) { str[0] = ':'; str[1] = ':'; i = 2; } else i = 0; const char* fi; for (f = scopeList_; f; f = f->next()) { for (fi = f->identifier(); *fi; fi++, i++) str[i] = *fi; if (f->next()) { str[i++] = ':'; str[i++] = ':'; } } str[i] = '\0'; return str; } IDL_Boolean ScopedName:: equal(const ScopedName* sn) const { if (sn->absolute() != absolute()) return 0; Fragment *ourf, *theirf; // Compare fragments for (ourf = scopeList(), theirf = sn->scopeList(); ourf && theirf; ourf = ourf->next(), theirf = theirf->next()) { if (strcmp(ourf->identifier(), theirf->identifier()) != 0) return 0; } // If either name has fragments left, names aren't equal if (ourf || theirf) return 0; return 1; } void ScopedName:: append(const char* identifier) { Fragment* f = new Fragment(identifier); if (last_) last_->next_ = f; else scopeList_ = f; last_ = f; } // Scope implementation Scope:: Entry:: Entry(const Scope* container, EntryKind k, const char* identifier, Scope* scope, Decl* decl, IdlType* idltype, Scope::Entry* inh_from, const char* file, int line) : container_(container), kind_(k), identifier_(idl_strdup(identifier)), scope_(scope), decl_(decl), idltype_(idltype), inh_from_(inh_from), file_(idl_strdup(file)), line_(line), next_(0) { const ScopedName* sn = container->scopedName(); if (identifier) { if (sn) { scopedName_ = new ScopedName(sn); scopedName_->append(identifier); } else scopedName_ = new ScopedName(identifier, 1); } else scopedName_ = 0; } Scope:: Entry:: ~Entry() { if (scopedName_) delete scopedName_; if (identifier_) delete [] identifier_; if (file_) delete [] file_; } void Scope:: EntryList:: merge(Scope::EntryList* ml) { EntryList* l; IDL_Boolean add; for (; ml; ml = ml->tail()) { add = 1; for (l=this; l; l = l->tail()) { if (ml->head() == l->head()) { add = 0; break; } } if (add) append(new EntryList(ml->head())); } delete ml; } Scope:: Scope(Scope* parent, Scope::Kind k, IDL_Boolean nestedUse, const char* file, int line) : parent_(parent), kind_(k), identifier_(0), scopedName_(0), nestedUse_(nestedUse), entries_(0), last_(0), inherited_(0), valueInherited_(0) { if (parent) nestedUse_ |= parent->nestedUse(); } Scope:: Scope(Scope* parent, const char* identifier, Scope::Kind k, IDL_Boolean nestedUse, const char* file, int line) : parent_(parent), kind_(k), nestedUse_(nestedUse), inherited_(0), valueInherited_(0) { const ScopedName* psn = 0; if (identifier && identifier[0] == '_') ++identifier; identifier_ = idl_strdup(identifier); if (parent) { psn = parent->scopedName(); nestedUse_ |= parent->nestedUse(); } if (psn) { scopedName_ = new ScopedName(psn); scopedName_->append(identifier); } else scopedName_ = new ScopedName(identifier, 1); // Add PARENT entry entries_ = new Entry(this, Entry::E_PARENT, identifier, 0, 0, 0, 0, file, line); last_ = entries_; } Scope:: ~Scope() { Entry *e, *f; for (e=entries_; e; e=f) { f = e->next(); delete e; } if (identifier_) delete [] identifier_; if (scopedName_) delete scopedName_; } void Scope:: init() { const char* file = ""; assert(global_ == 0); Prefix::newFile(); global_ = new Scope(0, Scope::S_GLOBAL, 0, file, 0); Scope* s = global_->newModuleScope("CORBA", file, 1); global_->addModule("CORBA", s, 0, file, 1); current_ = global_; n_builtins = 2; assert (builtins == 0); builtins = new Decl*[n_builtins]; builtins[0] = new Native(file, 2, 0, "TypeCode"); builtins[1] = new Native(file, 3, 0, "Principal"); s->addDecl("TypeCode", 0, builtins[0], BaseType::TypeCodeType, file, 2); s->addDecl("Principal", 0, builtins[1], BaseType::PrincipalType, file, 3); Prefix::endOuterFile(); } void Scope:: clear() { assert(global_ != 0); delete global_; global_ = 0; for (int i=0; i < n_builtins; i++) delete builtins[i]; delete [] builtins; builtins = 0; } void Scope:: setInherited(InheritSpec* inherited, const char* file, int line) { inherited_ = inherited; InheritSpec* is; Entry* e; for (is = inherited; is; is = is->next()) { if (!is->scope()) continue; // Skip bad entries from earlier errors for (e = is->scope()->entries(); e; e = e->next()) { switch (e->kind()) { case Entry::E_CALLABLE: addInherited(e->identifier(), e->scope(), e->decl(), e, file, line); break; case Entry::E_INHERITED: addInherited(e->identifier(), e->scope(), e->decl(), e->inh_from(), file, line); break; default: break; } } } } void Scope:: setInherited(ValueInheritSpec* inherited, const char* file, int line) { valueInherited_ = inherited; ValueInheritSpec* is; Entry* e; for (is = inherited; is; is = is->next()) { if (!is->scope()) continue; // Skip bad entries from earlier errors for (e = is->scope()->entries(); e; e = e->next()) { switch (e->kind()) { case Entry::E_CALLABLE: addInherited(e->identifier(), e->scope(), e->decl(), e, file, line); break; case Entry::E_INHERITED: addInherited(e->identifier(), e->scope(), e->decl(), e->inh_from(), file, line); break; default: break; } } } } void Scope:: appendEntry(Entry* e) { if (entries_) last_->next_ = e; else entries_ = e; last_ = e; } void Scope:: startScope(Scope* s) { assert(s->parent() == current_); current_ = s; } void Scope:: endScope() { assert(current_ != 0); current_ = current_->parent(); assert(current_ != 0); } // Scope creation functions Scope* Scope:: newModuleScope(const char* identifier, const char* file, int line) { // Only the global scope and modules can contain modules. The // grammar enforces this assert(kind() == S_GLOBAL || kind() == S_MODULE); // If there is already a module entry for this name, return it Entry* e = find(identifier); if (e && e->kind() == Entry::E_MODULE) return e->scope(); // If there was an entry but it wasn't a module, carry on anyway, // since addModule() will report the error return new Scope(this, identifier, S_MODULE, 0, file, line); } Scope* Scope:: newInterfaceScope(const char* identifier, const char* file, int line) { assert(kind() == S_GLOBAL || kind() == S_MODULE); return new Scope(this, identifier, S_INTERFACE, 1, file, line); } Scope* Scope:: newStructScope(const char* identifier, const char* file, int line) { assert(kind() != S_OPERATION); return new Scope(this, identifier, S_STRUCT, 0, file, line); } Scope* Scope:: newExceptionScope(const char* identifier, const char* file, int line) { assert(kind() != S_OPERATION); return new Scope(this, identifier, S_EXCEPTION, 0, file, line); } Scope* Scope:: newUnionScope(const char* identifier, const char* file, int line) { assert(kind() != S_OPERATION); return new Scope(this, identifier, S_UNION, 0, file, line); } Scope* Scope:: newOperationScope(const char* file, int line) { assert(kind() == S_INTERFACE || kind() == S_VALUE); return new Scope(this, S_OPERATION, 0, file, line); } Scope* Scope:: newValueScope(const char* identifier, const char* file, int line) { assert(kind() == S_GLOBAL || kind() == S_MODULE); return new Scope(this, identifier, S_VALUE, 1, file, line); } // Searching functions Scope::Entry* Scope:: find(const char* identifier) const { Entry* e; if (identifier[0] == '_') ++identifier; for (e = entries_; e; e = e->next()) { if (!(strcmp(identifier, e->identifier()))) return e; } return 0; } Scope::Entry* Scope:: iFind(const char* identifier) const { Entry* e; if (identifier[0] == '_') ++identifier; for (e = entries_; e; e = e->next()) { if (Config::caseSensitive) { if (!(strcmp(identifier, e->identifier()))) return e; } else { if (!(strcasecmp(identifier, e->identifier()))) return e; } } return 0; } Scope::EntryList* Scope:: findWithInheritance(const char* identifier) const { const Entry* e; EntryList* el = 0; EntryList* in_el; if (identifier[0] == '_') ++identifier; if ((e = find(identifier))) { switch (e->kind()) { case Entry::E_MODULE: case Entry::E_DECL: case Entry::E_CALLABLE: case Entry::E_INHERITED: case Entry::E_INSTANCE: el = new EntryList(e); return el; case Entry::E_USE: case Entry::E_PARENT: break; } } // Not found locally -- try inherited scopes for (InheritSpec* is = inherited_; is; is = is->next()) { if (!is->scope()) continue; // Skip broken entries from earlier errors in_el = is->scope()->findWithInheritance(identifier); if (el) el->merge(in_el); else el = in_el; } for (ValueInheritSpec* vis = valueInherited_; vis; vis = vis->next()) { if (!vis->scope()) continue; // Skip broken entries from earlier errors in_el = vis->scope()->findWithInheritance(identifier); if (el) el->merge(in_el); else el = in_el; } return el; } Scope::EntryList* Scope:: iFindWithInheritance(const char* identifier) const { const Entry* e; EntryList* el = 0; EntryList* in_el; if (identifier[0] == '_') ++identifier; if ((e = iFind(identifier))) { switch (e->kind()) { case Entry::E_MODULE: case Entry::E_DECL: case Entry::E_CALLABLE: case Entry::E_INHERITED: case Entry::E_INSTANCE: el = new EntryList(e); return el; case Entry::E_USE: case Entry::E_PARENT: break; } } // Not found locally -- try inherited scopes for (InheritSpec* is = inherited_; is; is = is->next()) { if (!is->scope()) continue; // Skip broken entries from earlier errors in_el = is->scope()->iFindWithInheritance(identifier); if (el) el->merge(in_el); else el = in_el; } for (ValueInheritSpec* vis = valueInherited_; vis; vis = vis->next()) { if (!vis->scope()) continue; // Skip broken entries from earlier errors in_el = vis->scope()->iFindWithInheritance(identifier); if (el) el->merge(in_el); else el = in_el; } return el; } const Scope::Entry* Scope:: findScopedName(const ScopedName* sn, const char* file, int line) const { const Scope* s; // Start at relevant Scope if (sn->absolute()) s = global(); else s = this; // Find entry for each name component const Entry* e = 0; EntryList* el; ScopedName::Fragment* f = sn->scopeList(); const char* fid; IDL_Boolean top_component = 1; while (f) { fid = f->identifier(); if (fid[0] == '_') fid++; do { el = s->iFindWithInheritance(fid); e = 0; if (el) { e = el->head(); if (el->tail()) { // Error -- ambiguous if (file) { char* ssn = sn->toString(); IdlError(file, line, "Ambiguous name '%s':", ssn); delete [] ssn; for (; el; el = el->tail()) { char* ssn = el->head()->container()->scopedName()->toString(); IdlErrorCont(el->head()->file(), el->head()->line(), "('%s' defined in '%s')", el->head()->identifier(), ssn); delete [] ssn; } } delete el; return 0; } delete el; break; } } while (top_component && (s = s->parent())); top_component = 0; if (!e) { if (file) { char* ssn = sn->toString(); IdlError(file, line, "Error in look-up of '%s': '%s' not found", ssn, fid); delete [] ssn; } return 0; } if (strcmp(fid, e->identifier())) { // Case clash if (file) { char* ssn = sn->toString(); IdlError(file, line, "Error in look-up of '%s': '%s' differs in case", ssn, fid); delete [] ssn; ssn = e->scopedName()->toString(); IdlErrorCont(e->file(), e->line(), "from '%s' declared here", ssn); delete [] ssn; } return 0; } f = f->next(); if (f) { // More name fragments: check that current entry forms a scope s = e->scope(); if (!s) { if (file) { char* ssn = sn->toString(); IdlError(file, line, "Error in look-up of '%s': '%s' does not form a scope", ssn, e->identifier()); IdlErrorCont(e->file(), e->line(), "('%s' defined here)", e->identifier()); delete [] ssn; } return 0; } } } return e; } const Scope::Entry* Scope:: findForUse(const ScopedName* sn, const char* file, int line) { const Entry* e = findScopedName(sn, file, line); addUse(sn, file, line); return e; } static ScopedName* findRelativeScope(const ScopedName::Fragment* from, const ScopedName::Fragment* to, const Scope* fromScope, const Scope::Entry* target) { ScopedName* result = 0; if (!to) return 0; if (from && !strcmp(from->identifier(), to->identifier())) { // Top name components match -- recursively try next components result = findRelativeScope(from->next(), to->next(), fromScope, target); } if (!result && fromScope) { ScopedName* test = new ScopedName(to, 0); const Scope::Entry* find = fromScope->findScopedName(test); if (find == target) result = test; else delete test; } return result; } ScopedName* Scope::relativeScopedName(const ScopedName* from, const ScopedName* to) { if (!global_) { // Haven't parsed any IDL yet! return 0; } if ((from && !from->absolute()) || !to->absolute()) return 0; const Scope* fromScope; if (from) { const Entry* fromEntry = global_->findScopedName(from); if (!fromEntry) return 0; fromScope = fromEntry->scope(); } else fromScope = global_; const Entry* toEntry = global_->findScopedName(to); if (!toEntry) return 0; ScopedName* result = findRelativeScope(from ? from->scopeList() : 0, to->scopeList(), fromScope, toEntry); if (!result) result = new ScopedName(to); return result; } // Entry adding functions void Scope:: addUse(const ScopedName* sn, const char* file, int line) { if (!sn->absolute()) { const char* id = sn->scopeList()->identifier(); if (id[0] == '_') ++id; const Entry* clash = iFind(id); if (clash) { if (strcmp(id, clash->identifier())) { char* ssn = sn->toString(); IdlError(file, line, "Use of '%s' clashes with identifier '%s'", ssn, clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "('%s' declared here)", clash->identifier()); delete [] ssn; } // Else the identifier is being used in the same scope that it was // declared, so don't mark it as used. } else { Entry* ue = new Entry(this, Entry::E_USE, id, 0, 0, 0, 0, file, line); appendEntry(ue); if (parent_ && parent_->nestedUse()) parent_->addUse(sn, file, line); } } } void Scope:: addModule(const char* identifier, Scope* scope, Decl* decl, const char* file, int line) { if (*identifier == '_') ++identifier; else keywordClash(identifier, file, line); Entry* clash = iFind(identifier); if (clash) { switch (clash->kind()) { case Entry::E_MODULE: { if (!strcmp(identifier, clash->identifier())) { return; // Reopening the module } IdlError(file, line, "Declaration of module '%s' clashes with declaration " "of module '%s'", identifier, clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "(module '%s' declared here)", clash->identifier()); break; } case Entry::E_DECL: { IdlError(file, line, "Declaration of module '%s' clashes with declaration " "of %s '%s'", identifier, clash->decl()->kindAsString(), clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "(%s '%s' declared here)", clash->decl()->kindAsString(), clash->identifier()); break; } case Entry::E_CALLABLE: case Entry::E_INHERITED: case Entry::E_INSTANCE: case Entry::E_USE: { assert(0); // Should never reach here } case Entry::E_PARENT: { IdlError(file, line, "Declaration of module '%s' clashes with name of " "enclosing module '%s'", identifier, clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "(module '%s' declared here)", clash->identifier()); break; } } } Entry* e = new Entry(this, Entry::E_MODULE, identifier, scope, decl, 0, 0, file, line); appendEntry(e); } void Scope:: addDecl(const char* identifier, Scope* scope, Decl* decl, IdlType* idltype, const char* file, int line) { if (*identifier == '_') ++identifier; else keywordClash(identifier, file, line); Entry* clash = iFind(identifier); if (clash) { switch (clash->kind()) { case Entry::E_MODULE: { IdlError(file, line, "Declaration of %s '%s' clashes with declaration " "of module '%s'", decl->kindAsString(), identifier, clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "(module '%s' declared here)", clash->identifier()); break; } case Entry::E_DECL: { IdlError(file, line, "Declaration of %s '%s' clashes with earlier declaration " "of %s '%s'", decl->kindAsString(), identifier, clash->decl()->kindAsString(), clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "(%s '%s' declared here)", clash->decl()->kindAsString(), clash->identifier()); break; } case Entry::E_CALLABLE: { IdlError(file, line, "Declaration of %s '%s' clashes with %s '%s'", decl->kindAsString(), identifier, clash->decl()->kindAsString(), clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "(%s '%s' declared here)", clash->decl()->kindAsString(), clash->identifier()); break; } case Entry::E_INHERITED: { IdlError(file, line, "Declaration of %s '%s' clashes with inherited %s '%s'", decl->kindAsString(), identifier, clash->decl()->kindAsString(), clash->identifier()); char* inhfrom = clash->inh_from()->container()->scopedName()->toString(); IdlErrorCont(clash->inh_from()->file(), clash->inh_from()->line(), "('%s' declared in %s here)", clash->identifier(), inhfrom); delete [] inhfrom; break; } case Entry::E_INSTANCE: { IdlError(file, line, "Declaration of %s '%s' clashes with instance '%s'", decl->kindAsString(), identifier, clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "('%s' declared here)", clash->identifier()); break; } case Entry::E_USE: { IdlError(file, line, "Declaration of %s '%s' clashes with use of " "identifier '%s'", decl->kindAsString(), identifier, clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "('%s' used here)", clash->identifier()); break; } case Entry::E_PARENT: { IdlError(file, line, "Declaration of %s '%s' clashes with name of " "enclosing scope '%s'", decl->kindAsString(), identifier, clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "('%s' declared here)", clash->identifier()); break; } } } Entry* e = new Entry(this, Entry::E_DECL, identifier, scope, decl, idltype, 0, file, line); appendEntry(e); } void Scope:: addCallable(const char* identifier, Scope* scope, Decl* decl, const char* file, int line) { if (*identifier == '_') ++identifier; else keywordClash(identifier, file, line); Entry* clash = iFind(identifier); if (clash) { switch (clash->kind()) { case Entry::E_MODULE: { IdlError(file, line, "Declaration of %s '%s' clashes with declaration " "of module '%s'", decl->kindAsString(), identifier, clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "(module '%s' declared here)", clash->identifier()); break; } case Entry::E_DECL: { IdlError(file, line, "Declaration of %s '%s' clashes with earlier declaration " "of %s '%s'", decl->kindAsString(), identifier, clash->decl()->kindAsString(), clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "(%s '%s' declared here)", clash->decl()->kindAsString(), clash->identifier()); break; } case Entry::E_CALLABLE: { IdlError(file, line, "Declaration of %s '%s' clashes with %s '%s'", decl->kindAsString(), identifier, clash->decl()->kindAsString(), clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "(%s '%s' declared here)", clash->decl()->kindAsString(), clash->identifier()); break; } case Entry::E_INHERITED: { IdlError(file, line, "Declaration of %s '%s' clashes with inherited %s '%s'", decl->kindAsString(), identifier, clash->decl()->kindAsString(), clash->identifier()); char* inhfrom = clash->inh_from()->container()->scopedName()->toString(); IdlErrorCont(clash->inh_from()->file(), clash->inh_from()->line(), "('%s' declared in %s here)", clash->identifier(), inhfrom); delete [] inhfrom; break; } case Entry::E_INSTANCE: { IdlError(file, line, "Declaration of %s '%s' clashes with instance '%s'", decl->kindAsString(), identifier, clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "('%s' declared here)", clash->identifier()); break; } case Entry::E_USE: { IdlError(file, line, "Declaration of %s '%s' clashes with use of " "identifier '%s'", decl->kindAsString(), identifier, clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "('%s' used here)", clash->identifier()); break; } case Entry::E_PARENT: { IdlError(file, line, "Declaration of %s '%s' clashes with name of " "enclosing scope '%s'", decl->kindAsString(), identifier, clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "('%s' declared here)", clash->identifier()); break; } } } Entry* e = new Entry(this, Entry::E_CALLABLE, identifier, scope, decl, 0, 0, file, line); appendEntry(e); } void Scope:: addInherited(const char* id, Scope* scope, Decl* decl, Scope::Entry* inh_from, const char* file, int line) { if (*id == '_') ++id; Entry* clash = iFind(id); if (clash) { switch (clash->kind()) { case Entry::E_MODULE: case Entry::E_DECL: case Entry::E_CALLABLE: case Entry::E_INSTANCE: case Entry::E_USE: { assert(0); // Should never reach here } case Entry::E_INHERITED: { if (inh_from != clash->inh_from()) { IdlError(file, line, "In definition of '%s': clash between " "inherited identifiers '%s' and '%s'", identifier(), id, clash->identifier()); char* inhfrom = inh_from->container()->scopedName()->toString(); IdlErrorCont(inh_from->file(), inh_from->line(), "(%s '%s' declared in %s here)", decl->kindAsString(), id, inhfrom); delete [] inhfrom; inhfrom = clash->inh_from()->container()->scopedName()->toString(); IdlErrorCont(clash->inh_from()->file(), clash->inh_from()->line(), "(%s '%s' declared in %s here)", clash->decl()->kindAsString(), clash->identifier(), inhfrom); delete [] inhfrom; } break; } case Entry::E_PARENT: { // It's not clear whether this is OK, but the spec doesn't say // it's definitely illegal IdlWarning(file, line, "Inherited %s '%s' clashes with interface name '%s'", decl->kindAsString(), id, clash->identifier()); IdlWarningCont(decl->file(), decl->line(), "(%s '%s' declared here)", decl->kindAsString(), id); break; } } } Entry* e = new Entry(this, Entry::E_INHERITED, id, scope, decl, 0, inh_from, file, line); appendEntry(e); } void Scope:: addInstance(const char* identifier, Decl* decl, IdlType* idltype, const char* file, int line) { if (*identifier == '_') ++identifier; else keywordClash(identifier, file, line); Entry* clash = iFind(identifier); if (clash) { switch (clash->kind()) { case Entry::E_MODULE: { IdlError(file, line, "Instance identifier '%s' clashes with declaration " "of module '%s'", identifier, clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "(module '%s' declared here)", clash->identifier()); break; } case Entry::E_DECL: { IdlError(file, line, "Instance identifier '%s' clashes with declaration " "of %s '%s'", identifier, clash->decl()->kindAsString(), clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "(%s '%s' declared here)", clash->decl()->kindAsString(), clash->identifier()); break; } case Entry::E_CALLABLE: { IdlError(file, line, "Instance identifier '%s' clashes with %s '%s'", identifier, clash->decl()->kindAsString(), clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "(%s '%s' declared here)", clash->decl()->kindAsString(), clash->identifier()); break; } case Entry::E_INHERITED: { IdlError(file, line, "Instance identifier '%s' clashes with inherited %s '%s'", identifier, clash->decl()->kindAsString(), clash->identifier()); char* inhfrom = clash->inh_from()->container()->scopedName()->toString(); IdlErrorCont(clash->inh_from()->file(), clash->inh_from()->line(), "('%s' declared in %s here)", clash->identifier(), inhfrom); delete [] inhfrom; break; } case Entry::E_INSTANCE: { IdlError(file, line, "Instance identifier '%s' clashes with instance '%s'", identifier, clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "('%s' declared here)", clash->identifier()); break; } case Entry::E_USE: { IdlError(file, line, "Instance identifier '%s' clashes with use of " "identifier '%s'", identifier, clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "('%s' used here)", clash->identifier()); break; } case Entry::E_PARENT: { IdlError(file, line, "Instance identifier '%s' clashes with name of " "enclosing scope '%s'", identifier, clash->identifier()); IdlErrorCont(clash->file(), clash->line(), "('%s' declared here)", clash->identifier()); break; } } } Entry* e = new Entry(this, Entry::E_INSTANCE, identifier, 0, decl, idltype, 0, file, line); appendEntry(e); } void Scope:: remEntry(Scope::Entry* re) { if (entries_ == re) { entries_ = re->next(); if (!entries_) last_ = 0; } else { Entry *e; for (e = entries_; e && (e->next() != re); e = e->next()); assert(e != 0); e->next_ = re->next(); if (!e->next_) last_ = e; } re->next_ = 0; delete re; } IDL_Boolean Scope:: keywordClash(const char* identifier, const char* file, int line) { static const char* keywords[] = { "abstract", "any", "attribute", "boolean", "case", "char", "const", "context", "custom", "default", "double", "enum", "exception", "factory", "FALSE", "fixed", "float", "in", "inout", "interface", "local", "long", "module", "native", "Object", "octet", "oneway", "out", "private", "public", "raises", "readonly", "sequence", "short", "string", "struct", "supports", "switch", "TRUE", "truncatable", "typedef", "union", "unsigned", "ValueBase", "valuetype", "void", "wchar", "wstring", 0 }; static const char* new_keywords[] = { "component", "consumes", "emits", "eventtype", "finder", "getraises", "home", "import", "multiple", "primarykey", "provides", "publishes", "setraises", "typeid", "typeprefix", "uses", 0 }; const char** k; for (k = keywords; *k; k++) { if (Config::caseSensitive) { if (!strcmp(*k, identifier)) { IdlError(file, line, "Identifier '%s' is identical to keyword '%s'", identifier, *k); return 1; } } else { if (!strcasecmp(*k, identifier)) { IdlError(file, line, "Identifier '%s' clashes with keyword '%s'", identifier, *k); return 1; } } } for (k = new_keywords; *k; k++) { if (Config::caseSensitive) { if (!strcmp(*k, identifier)) { IdlWarning(file, line, "Identifier '%s' is identical to " "CORBA 3 keyword '%s'.", identifier, *k); return 1; } } else { if (!strcasecmp(*k, identifier)) { IdlWarning(file, line, "Identifier '%s' clashes with " "CORBA 3 keyword '%s'", identifier, *k); return 1; } } } return 0; } synopsis-0.12/Synopsis/Parsers/IDL/idlconfig.h0000664000076400007640000000466611104703261020653 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlconfig.h Created on: 2000/03/06 // Author : Duncan Grisby (dpg1) // // Copyright (C) 2000 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Global configuration for omniidl // $Id: idlconfig.h,v 1.5.2.1 2003/03/23 21:01:47 dgrisby Exp $ // $Log: idlconfig.h,v $ // Revision 1.5.2.1 2003/03/23 21:01:47 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.2.2.3 2000/12/05 17:45:19 dpg1 // omniidl case sensitivity updates from omni3_develop. // // Revision 1.2.2.2 2000/10/27 16:31:08 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.2.2.1 2000/07/17 10:36:03 sll // Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0. // // Revision 1.3 2000/07/13 15:25:53 dpg1 // Merge from omni3_develop for 3.0 release. // // Revision 1.1.2.2 2000/06/05 18:13:27 dpg1 // Comments can be attached to subsequent declarations (with -K). Better // idea of most recent decl in operation declarations // // Revision 1.1.2.1 2000/03/06 15:03:48 dpg1 // Minor bug fixes to omniidl. New -nf and -k flags. // #ifndef _idlconfig_h_ #define _idlconfig_h_ #include class Config { public: static IDL_Boolean quiet; // Don't make any output static IDL_Boolean forwardWarning; // Warn about unresolved forwards static IDL_Boolean keepComments; // Keep comments from source static IDL_Boolean commentsFirst; // Comments come before declarations static IDL_Boolean caseSensitive; // Do not treat identifiers differing // only in case as errors }; #endif // _idlconfig_h_ synopsis-0.12/Synopsis/Parsers/IDL/y.tab.h0000664000076400007640000000706711104703261017730 0ustar stefanstefan#ifndef BISON_Y_TAB_H # define BISON_Y_TAB_H #ifndef YYSTYPE typedef union { char* id_val; int int_val; IDL_ULong ulong_val; IdlIntLiteral int_literal_val; #ifndef __VMS IdlFloatLiteral float_literal_val; #else double float_literal_val; #endif char char_val; char* string_val; IDL_WChar wchar_val; IDL_WChar* wstring_val; IDL_Boolean boolean_val; IDL_Fixed* fixed_val; IdlType* type_val; TypeSpec* type_spec_val; IdlExpr* expr_val; ScopedName* scopedname_val; Decl* decl_val; Module* module_val; Interface* interface_val; InheritSpec* inheritspec_val; Forward* forward_val; Const* const_val; Typedef* typedef_val; Struct* struct_val; Exception* exception_val; Member* member_val; Declarator* declarator_val; Union* union_val; UnionCase* union_case_val; CaseLabel* case_label_val; ValueBase* value_base_val; Value* value_val; ValueForward* value_forward_val; ValueBox* value_box_val; ValueAbs* value_abs_val; ValueInheritSpec* valueinheritspec_val; ValueInheritSupportSpec* valueinheritsupportspec_val; StateMember* statemember_val; Factory* factory_val; Enumerator* enumerator_val; Enum* enum_val; ArraySize* array_size_val; Attribute* attribute_val; Operation* operation_val; Parameter* parameter_val; RaisesSpec* raisesspec_val; ContextSpec* contextspec_val; } yystype; # define YYSTYPE yystype # define YYSTYPE_IS_TRIVIAL 1 #endif # define IDENTIFIER 257 # define ABSTRACT 258 # define ANY 259 # define ATTRIBUTE 260 # define BOOLEAN 261 # define CASE 262 # define CHAR 263 # define CONST 264 # define CONTEXT 265 # define CUSTOM 266 # define DEFAULT 267 # define DOUBLE 268 # define ENUM 269 # define EXCEPTION 270 # define FACTORY 271 # define FALSE_ 272 # define FIXED 273 # define FLOAT 274 # define IN 275 # define INOUT 276 # define INTERFACE 277 # define LOCAL 278 # define LONG 279 # define MODULE 280 # define NATIVE 281 # define OBJECT 282 # define OCTET 283 # define ONEWAY 284 # define OUT 285 # define PRIVATE 286 # define PUBLIC 287 # define RAISES 288 # define READONLY 289 # define SEQUENCE 290 # define SHORT 291 # define STRING 292 # define STRUCT 293 # define SUPPORTS 294 # define SWITCH 295 # define TRUE_ 296 # define TRUNCATABLE 297 # define TYPEDEF 298 # define UNION 299 # define UNSIGNED 300 # define VALUEBASE 301 # define VALUETYPE 302 # define VOID 303 # define WCHAR 304 # define WSTRING 305 # define PRAGMA 306 # define PRAGMA_PREFIX 307 # define PRAGMA_ID 308 # define PRAGMA_VERSION 309 # define OMNI_PRAGMA 310 # define END_PRAGMA 311 # define UNKNOWN_PRAGMA_BODY 312 # define INTEGER_LITERAL 313 # define CHARACTER_LITERAL 314 # define WIDE_CHARACTER_LITERAL 315 # define FLOATING_PT_LITERAL 316 # define STRING_LITERAL 317 # define WIDE_STRING_LITERAL 318 # define FIXED_PT_LITERAL 319 # define SCOPE_DELIM 320 # define LEFT_SHIFT 321 # define RIGHT_SHIFT 322 extern YYSTYPE yylval; #endif /* not BISON_Y_TAB_H */ synopsis-0.12/Synopsis/Parsers/IDL/y.tab.cc0000664000076400007640000040073511104703261020065 0ustar stefanstefan/* A Bison parser, made from ../../../../../src/tool/omniidl/cxx/idl.yy by GNU bison 1.35. */ #define YYBISON 1 /* Identify Bison output. */ # define IDENTIFIER 257 # define ABSTRACT 258 # define ANY 259 # define ATTRIBUTE 260 # define BOOLEAN 261 # define CASE 262 # define CHAR 263 # define CONST 264 # define CONTEXT 265 # define CUSTOM 266 # define DEFAULT 267 # define DOUBLE 268 # define ENUM 269 # define EXCEPTION 270 # define FACTORY 271 # define FALSE_ 272 # define FIXED 273 # define FLOAT 274 # define IN 275 # define INOUT 276 # define INTERFACE 277 # define LOCAL 278 # define LONG 279 # define MODULE 280 # define NATIVE 281 # define OBJECT 282 # define OCTET 283 # define ONEWAY 284 # define OUT 285 # define PRIVATE 286 # define PUBLIC 287 # define RAISES 288 # define READONLY 289 # define SEQUENCE 290 # define SHORT 291 # define STRING 292 # define STRUCT 293 # define SUPPORTS 294 # define SWITCH 295 # define TRUE_ 296 # define TRUNCATABLE 297 # define TYPEDEF 298 # define UNION 299 # define UNSIGNED 300 # define VALUEBASE 301 # define VALUETYPE 302 # define VOID 303 # define WCHAR 304 # define WSTRING 305 # define PRAGMA 306 # define PRAGMA_PREFIX 307 # define PRAGMA_ID 308 # define PRAGMA_VERSION 309 # define OMNI_PRAGMA 310 # define END_PRAGMA 311 # define UNKNOWN_PRAGMA_BODY 312 # define INTEGER_LITERAL 313 # define CHARACTER_LITERAL 314 # define WIDE_CHARACTER_LITERAL 315 # define FLOATING_PT_LITERAL 316 # define STRING_LITERAL 317 # define WIDE_STRING_LITERAL 318 # define FIXED_PT_LITERAL 319 # define SCOPE_DELIM 320 # define LEFT_SHIFT 321 # define RIGHT_SHIFT 322 #line 97 "../../../../../src/tool/omniidl/cxx/idl.yy" #include #include #include #include #include #include #include #include #include #define YYDEBUG 1 // Globals from lexer extern int yylineno; extern char* currentFile; extern IDL_Boolean mainFile; void yyerror(char *s) { } extern int yylex(); // Nasty hack for abstract valuetypes ValueAbs* valueabs_hack = 0; #ifdef __VMS /* Apparently, __ALLOCA is defined for some versions of the C (but not C++) compiler on VAX. */ #if defined(__ALPHA) || defined(__DECC) && __DECC_VER >= 60000000 #include #define alloca __ALLOCA #else #define alloca malloc #endif #endif #line 137 "../../../../../src/tool/omniidl/cxx/idl.yy" #ifndef YYSTYPE typedef union { char* id_val; int int_val; IDL_ULong ulong_val; IdlIntLiteral int_literal_val; #ifndef __VMS IdlFloatLiteral float_literal_val; #else double float_literal_val; #endif char char_val; char* string_val; IDL_WChar wchar_val; IDL_WChar* wstring_val; IDL_Boolean boolean_val; IDL_Fixed* fixed_val; IdlType* type_val; TypeSpec* type_spec_val; IdlExpr* expr_val; ScopedName* scopedname_val; Decl* decl_val; Module* module_val; Interface* interface_val; InheritSpec* inheritspec_val; Forward* forward_val; Const* const_val; Typedef* typedef_val; Struct* struct_val; Exception* exception_val; Member* member_val; Declarator* declarator_val; Union* union_val; UnionCase* union_case_val; CaseLabel* case_label_val; ValueBase* value_base_val; Value* value_val; ValueForward* value_forward_val; ValueBox* value_box_val; ValueAbs* value_abs_val; ValueInheritSpec* valueinheritspec_val; ValueInheritSupportSpec* valueinheritsupportspec_val; StateMember* statemember_val; Factory* factory_val; Enumerator* enumerator_val; Enum* enum_val; ArraySize* array_size_val; Attribute* attribute_val; Operation* operation_val; Parameter* parameter_val; RaisesSpec* raisesspec_val; ContextSpec* contextspec_val; } yystype; # define YYSTYPE yystype # define YYSTYPE_IS_TRIVIAL 1 #endif #ifndef YYDEBUG # define YYDEBUG 0 #endif #define YYFINAL 508 #define YYFLAG -32768 #define YYNTBASE 91 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ #define YYTRANSLATE(x) ((unsigned)(x) <= 322 ? yytranslate[x] : 238) /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ static const 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, 2, 2, 2, 2, 84, 79, 2, 74, 75, 82, 80, 73, 81, 90, 83, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 72, 69, 86, 76, 87, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 88, 2, 89, 78, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 70, 77, 71, 85, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 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 }; #if YYDEBUG static const short yyprhs[] = { 0, 0, 1, 3, 5, 8, 11, 14, 17, 20, 23, 26, 28, 30, 32, 38, 39, 46, 49, 52, 54, 56, 61, 62, 69, 72, 76, 82, 83, 85, 87, 89, 90, 93, 96, 99, 102, 105, 108, 110, 112, 113, 115, 118, 121, 127, 129, 131, 133, 136, 140, 142, 144, 146, 148, 151, 155, 159, 160, 168, 169, 178, 180, 185, 189, 194, 197, 201, 206, 209, 212, 215, 216, 218, 220, 224, 226, 227, 230, 232, 234, 236, 241, 243, 245, 246, 254, 255, 262, 265, 266, 268, 270, 274, 278, 284, 286, 288, 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 312, 314, 318, 320, 324, 326, 330, 334, 336, 340, 344, 346, 350, 354, 358, 361, 363, 365, 367, 369, 371, 373, 377, 379, 381, 383, 385, 387, 389, 391, 393, 395, 398, 400, 403, 405, 407, 409, 412, 414, 416, 418, 421, 423, 426, 428, 430, 432, 434, 436, 438, 440, 442, 444, 446, 448, 450, 452, 454, 456, 458, 460, 462, 464, 466, 468, 471, 477, 479, 481, 483, 485, 487, 489, 492, 494, 496, 498, 500, 502, 504, 506, 509, 511, 513, 515, 518, 521, 525, 527, 529, 531, 533, 535, 537, 544, 547, 550, 553, 557, 561, 563, 577, 580, 583, 585, 587, 589, 591, 593, 595, 598, 602, 606, 608, 611, 616, 620, 623, 630, 633, 636, 639, 645, 647, 654, 659, 664, 666, 671, 673, 676, 678, 681, 685, 690, 691, 693, 696, 702, 709, 712, 715, 716, 719, 720, 728, 731, 735, 736, 738, 740, 742, 744, 749, 753, 757, 760, 766, 770, 772, 774, 776, 777, 780, 785, 788, 794, 795, 798, 803, 806, 812, 814, 816, 818, 820, 827, 829, 831, 834, 837, 839, 841, 843, 845, 847, 850, 851, 853, 857, 860, 865, 869, 876, 880, 884, 888, 890 }; static const short yyrhs[] = { -1, 92, 0, 93, 0, 92, 93, 0, 152, 69, 0, 135, 69, 0, 205, 69, 0, 97, 69, 0, 94, 69, 0, 111, 69, 0, 229, 0, 232, 0, 1, 0, 96, 231, 70, 92, 71, 0, 0, 96, 1, 95, 70, 92, 71, 0, 96, 1, 0, 26, 3, 0, 98, 0, 100, 0, 101, 70, 103, 71, 0, 0, 101, 1, 99, 70, 103, 71, 0, 101, 1, 0, 102, 23, 3, 0, 102, 23, 3, 231, 106, 0, 0, 4, 0, 24, 0, 104, 0, 0, 104, 105, 0, 152, 69, 0, 135, 69, 0, 205, 69, 0, 202, 69, 0, 208, 69, 0, 229, 0, 1, 0, 0, 107, 0, 72, 108, 0, 109, 231, 0, 108, 73, 231, 109, 231, 0, 1, 0, 110, 0, 3, 0, 66, 3, 0, 110, 66, 3, 0, 117, 0, 114, 0, 113, 0, 112, 0, 48, 3, 0, 4, 48, 3, 0, 48, 3, 154, 0, 0, 4, 48, 3, 115, 70, 104, 71, 0, 0, 4, 48, 3, 119, 116, 70, 104, 71, 0, 1, 0, 118, 70, 124, 71, 0, 48, 3, 119, 0, 12, 48, 3, 119, 0, 48, 3, 0, 12, 48, 3, 0, 72, 120, 40, 108, 0, 72, 120, 0, 40, 108, 0, 121, 122, 0, 0, 43, 0, 123, 0, 122, 73, 123, 0, 110, 0, 0, 124, 125, 0, 105, 0, 126, 0, 128, 0, 127, 154, 159, 69, 0, 33, 0, 32, 0, 0, 131, 74, 132, 75, 129, 218, 69, 0, 0, 131, 74, 1, 75, 130, 69, 0, 17, 3, 0, 0, 133, 0, 134, 0, 133, 73, 134, 0, 21, 224, 3, 0, 10, 136, 3, 76, 137, 0, 164, 0, 173, 0, 174, 0, 175, 0, 163, 0, 197, 0, 198, 0, 226, 0, 110, 0, 176, 0, 138, 0, 139, 0, 138, 77, 139, 0, 140, 0, 139, 78, 140, 0, 141, 0, 140, 79, 141, 0, 142, 0, 141, 68, 142, 0, 141, 67, 142, 0, 143, 0, 142, 80, 143, 0, 142, 81, 143, 0, 144, 0, 143, 82, 144, 0, 143, 83, 144, 0, 143, 84, 144, 0, 145, 146, 0, 146, 0, 81, 0, 80, 0, 85, 0, 110, 0, 147, 0, 74, 137, 75, 0, 59, 0, 148, 0, 149, 0, 60, 0, 61, 0, 65, 0, 62, 0, 150, 0, 63, 0, 148, 63, 0, 64, 0, 149, 64, 0, 42, 0, 18, 0, 137, 0, 44, 153, 0, 179, 0, 183, 0, 192, 0, 27, 3, 0, 228, 0, 154, 159, 0, 155, 0, 158, 0, 156, 0, 157, 0, 110, 0, 163, 0, 164, 0, 173, 0, 174, 0, 175, 0, 176, 0, 177, 0, 178, 0, 227, 0, 196, 0, 197, 0, 198, 0, 225, 0, 179, 0, 183, 0, 192, 0, 160, 231, 0, 159, 73, 231, 160, 231, 0, 161, 0, 162, 0, 3, 0, 199, 0, 20, 0, 14, 0, 25, 14, 0, 165, 0, 169, 0, 166, 0, 167, 0, 168, 0, 37, 0, 25, 0, 25, 25, 0, 170, 0, 171, 0, 172, 0, 46, 37, 0, 46, 25, 0, 46, 25, 25, 0, 9, 0, 50, 0, 7, 0, 29, 0, 5, 0, 28, 0, 180, 231, 70, 231, 181, 71, 0, 180, 1, 0, 39, 3, 0, 182, 231, 0, 181, 182, 231, 0, 154, 159, 69, 0, 1, 0, 184, 231, 41, 74, 231, 185, 231, 75, 231, 70, 231, 186, 71, 0, 184, 1, 0, 45, 3, 0, 164, 0, 173, 0, 175, 0, 192, 0, 110, 0, 187, 0, 188, 231, 0, 187, 188, 231, 0, 189, 191, 69, 0, 190, 0, 189, 190, 0, 8, 137, 72, 231, 0, 13, 72, 231, 0, 154, 160, 0, 193, 231, 70, 231, 194, 71, 0, 193, 1, 0, 15, 3, 0, 195, 231, 0, 194, 73, 231, 195, 231, 0, 3, 0, 36, 86, 155, 73, 151, 87, 0, 36, 86, 155, 87, 0, 38, 86, 151, 87, 0, 38, 0, 51, 86, 151, 87, 0, 51, 0, 3, 200, 0, 201, 0, 200, 201, 0, 88, 151, 89, 0, 203, 6, 224, 204, 0, 0, 35, 0, 161, 231, 0, 204, 73, 231, 161, 231, 0, 206, 231, 70, 231, 207, 71, 0, 206, 1, 0, 16, 3, 0, 0, 207, 182, 0, 0, 210, 231, 214, 209, 231, 218, 221, 0, 210, 1, 0, 211, 213, 3, 0, 0, 212, 0, 30, 0, 224, 0, 49, 0, 74, 231, 215, 75, 0, 74, 231, 75, 0, 74, 1, 75, 0, 216, 231, 0, 215, 73, 231, 216, 231, 0, 217, 224, 3, 0, 21, 0, 31, 0, 22, 0, 0, 219, 231, 0, 34, 74, 220, 75, 0, 110, 231, 0, 220, 73, 231, 110, 231, 0, 0, 222, 231, 0, 11, 74, 223, 75, 0, 148, 231, 0, 223, 73, 231, 148, 231, 0, 156, 0, 197, 0, 198, 0, 110, 0, 19, 86, 151, 73, 137, 87, 0, 19, 0, 47, 0, 39, 3, 0, 45, 3, 0, 233, 0, 234, 0, 235, 0, 236, 0, 229, 0, 230, 229, 0, 0, 230, 0, 53, 148, 57, 0, 53, 1, 0, 54, 110, 148, 57, 0, 54, 1, 57, 0, 55, 110, 59, 90, 59, 57, 0, 55, 1, 57, 0, 52, 237, 57, 0, 56, 237, 57, 0, 58, 0, 237, 58, 0 }; #endif #if YYDEBUG /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const short yyrline[] = { 0, 403, 405, 411, 413, 419, 421, 422, 423, 424, 425, 426, 427, 428, 434, 439, 439, 446, 454, 458, 460, 463, 468, 468, 475, 483, 489, 497, 499, 500, 503, 507, 509, 515, 517, 518, 519, 520, 521, 522, 528, 530, 533, 537, 545, 553, 560, 564, 568, 571, 581, 583, 584, 585, 588, 592, 597, 605, 605, 613, 613, 622, 634, 641, 647, 652, 655, 660, 664, 667, 672, 679, 681, 684, 692, 702, 706, 708, 714, 716, 717, 720, 728, 730, 733, 733, 740, 740, 750, 756, 758, 761, 763, 769, 777, 783, 785, 786, 787, 788, 789, 790, 791, 792, 795, 798, 802, 804, 807, 809, 812, 814, 819, 821, 824, 829, 831, 832, 835, 837, 840, 843, 848, 854, 857, 859, 860, 863, 867, 868, 871, 875, 878, 881, 884, 887, 890, 893, 898, 900, 909, 911, 920, 922, 925, 934, 936, 937, 938, 939, 942, 945, 953, 955, 958, 960, 961, 966, 968, 969, 970, 971, 972, 973, 974, 975, 978, 980, 981, 982, 985, 987, 988, 991, 993, 999, 1001, 1004, 1010, 1014, 1016, 1017, 1020, 1022, 1025, 1027, 1028, 1031, 1035, 1039, 1043, 1045, 1046, 1049, 1053, 1057, 1061, 1065, 1069, 1073, 1077, 1081, 1085, 1090, 1098, 1104, 1106, 1112, 1118, 1125, 1134, 1142, 1148, 1150, 1151, 1152, 1153, 1159, 1163, 1165, 1171, 1178, 1180, 1186, 1190, 1195, 1202, 1207, 1214, 1220, 1222, 1228, 1234, 1238, 1243, 1245, 1250, 1252, 1257, 1263, 1265, 1271, 1275, 1281, 1283, 1286, 1288, 1294, 1299, 1307, 1313, 1315, 1321, 1321, 1328, 1337, 1343, 1345, 1348, 1352, 1354, 1357, 1359, 1360, 1367, 1369, 1375, 1381, 1383, 1384, 1387, 1389, 1392, 1396, 1400, 1406, 1408, 1411, 1415, 1419, 1425, 1427, 1428, 1429, 1434, 1457, 1463, 1467, 1471, 1476, 1478, 1479, 1480, 1483, 1485, 1488, 1490, 1493, 1497, 1502, 1507, 1512, 1517, 1522, 1528, 1534, 1536 }; #endif #if (YYDEBUG) || defined YYERROR_VERBOSE /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ static const char *const yytname[] = { "$", "error", "$undefined.", "IDENTIFIER", "ABSTRACT", "ANY", "ATTRIBUTE", "BOOLEAN", "CASE", "CHAR", "CONST", "CONTEXT", "CUSTOM", "DEFAULT", "DOUBLE", "ENUM", "EXCEPTION", "FACTORY", "FALSE_", "FIXED", "FLOAT", "IN", "INOUT", "INTERFACE", "LOCAL", "LONG", "MODULE", "NATIVE", "OBJECT", "OCTET", "ONEWAY", "OUT", "PRIVATE", "PUBLIC", "RAISES", "READONLY", "SEQUENCE", "SHORT", "STRING", "STRUCT", "SUPPORTS", "SWITCH", "TRUE_", "TRUNCATABLE", "TYPEDEF", "UNION", "UNSIGNED", "VALUEBASE", "VALUETYPE", "VOID", "WCHAR", "WSTRING", "PRAGMA", "PRAGMA_PREFIX", "PRAGMA_ID", "PRAGMA_VERSION", "OMNI_PRAGMA", "END_PRAGMA", "UNKNOWN_PRAGMA_BODY", "INTEGER_LITERAL", "CHARACTER_LITERAL", "WIDE_CHARACTER_LITERAL", "FLOATING_PT_LITERAL", "STRING_LITERAL", "WIDE_STRING_LITERAL", "FIXED_PT_LITERAL", "SCOPE_DELIM", "LEFT_SHIFT", "RIGHT_SHIFT", "';'", "'{'", "'}'", "':'", "','", "'('", "')'", "'='", "'|'", "'^'", "'&'", "'+'", "'-'", "'*'", "'/'", "'%'", "'~'", "'<'", "'>'", "'['", "']'", "'.'", "start", "definition_plus", "definition", "module", "@1", "module_header", "interface", "interface_dcl", "@2", "forward_dcl", "interface_header", "abstract_local_opt", "interface_body", "export_star", "export", "interface_inheritance_spec_opt", "interface_inheritance_spec", "interface_inheritance_list", "interface_name", "scoped_name", "value", "value_forward_dcl", "value_box_dcl", "value_abs_dcl", "@3", "@4", "value_dcl", "value_header", "value_inheritance_spec", "value_value_inheritance_spec", "truncatable_opt", "value_inheritance_list", "value_name", "value_element_star", "value_element", "state_member", "member_access", "init_dcl", "@5", "@6", "init_dcl_header", "init_param_decls_opt", "init_param_decls", "init_param_decl", "const_dcl", "const_type", "const_exp", "or_expr", "xor_expr", "and_expr", "shift_expr", "add_expr", "mult_expr", "unary_expr", "unary_operator", "primary_expr", "literal", "string_literal_plus", "wide_string_literal_plus", "boolean_literal", "positive_int_const", "type_dcl", "type_declarator", "type_spec", "simple_type_spec", "base_type_spec", "template_type_spec", "constr_type_spec", "declarators", "declarator", "simple_declarator", "complex_declarator", "floating_pt_type", "integer_type", "signed_int", "signed_short_int", "signed_long_int", "signed_long_long_int", "unsigned_int", "unsigned_short_int", "unsigned_long_int", "unsigned_long_long_int", "char_type", "wide_char_type", "boolean_type", "octet_type", "any_type", "object_type", "struct_type", "struct_header", "member_list", "member", "union_type", "union_header", "switch_type_spec", "switch_body", "case_plus", "case", "case_label_plus", "case_label", "element_spec", "enum_type", "enum_header", "enumerator_list", "enumerator", "sequence_type", "string_type", "wide_string_type", "array_declarator", "fixed_array_size_plus", "fixed_array_size", "attr_dcl", "readonly_opt", "simple_declarator_list", "except_dcl", "except_header", "member_star", "op_dcl", "@7", "op_header", "op_attribute_opt", "op_attribute", "op_type_spec", "parameter_dcls", "param_dcl_list", "param_dcl", "param_attribute", "raises_expr_opt", "raises_expr", "scoped_name_list", "context_expr_opt", "context_expr", "string_literal_list", "param_type_spec", "fixed_pt_type", "fixed_pt_const_type", "value_base_type", "constr_forward_decl", "pragma", "pragmas", "pragmas_opt", "pragma_prefix", "pragma_id", "pragma_version", "unknown_pragma", "omni_pragma", "unknown_pragma_body_plus", 0 }; #endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const short yyr1[] = { 0, 91, 91, 92, 92, 93, 93, 93, 93, 93, 93, 93, 93, 93, 94, 95, 94, 94, 96, 97, 97, 98, 99, 98, 98, 100, 101, 102, 102, 102, 103, 104, 104, 105, 105, 105, 105, 105, 105, 105, 106, 106, 107, 108, 108, 108, 109, 110, 110, 110, 111, 111, 111, 111, 112, 112, 113, 115, 114, 116, 114, 114, 117, 118, 118, 118, 118, 119, 119, 119, 120, 121, 121, 122, 122, 123, 124, 124, 125, 125, 125, 126, 127, 127, 129, 128, 130, 128, 131, 132, 132, 133, 133, 134, 135, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 137, 138, 138, 139, 139, 140, 140, 141, 141, 141, 142, 142, 142, 143, 143, 143, 143, 144, 144, 145, 145, 145, 146, 146, 146, 147, 147, 147, 147, 147, 147, 147, 147, 148, 148, 149, 149, 150, 150, 151, 152, 152, 152, 152, 152, 152, 153, 154, 154, 155, 155, 155, 156, 156, 156, 156, 156, 156, 156, 156, 156, 157, 157, 157, 157, 158, 158, 158, 159, 159, 160, 160, 161, 162, 163, 163, 163, 164, 164, 165, 165, 165, 166, 167, 168, 169, 169, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 179, 180, 181, 181, 182, 182, 183, 183, 184, 185, 185, 185, 185, 185, 186, 187, 187, 188, 189, 189, 190, 190, 191, 192, 192, 193, 194, 194, 195, 196, 196, 197, 197, 198, 198, 199, 200, 200, 201, 202, 203, 203, 204, 204, 205, 205, 206, 207, 207, 209, 208, 208, 210, 211, 211, 212, 213, 213, 214, 214, 214, 215, 215, 216, 217, 217, 217, 218, 218, 219, 220, 220, 221, 221, 222, 223, 223, 224, 224, 224, 224, 225, 226, 227, 228, 228, 229, 229, 229, 229, 230, 230, 231, 231, 232, 232, 233, 233, 234, 234, 235, 236, 237, 237 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const short yyr2[] = { 0, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 5, 0, 6, 2, 2, 1, 1, 4, 0, 6, 2, 3, 5, 0, 1, 1, 1, 0, 2, 2, 2, 2, 2, 2, 1, 1, 0, 1, 2, 2, 5, 1, 1, 1, 2, 3, 1, 1, 1, 1, 2, 3, 3, 0, 7, 0, 8, 1, 4, 3, 4, 2, 3, 4, 2, 2, 2, 0, 1, 1, 3, 1, 0, 2, 1, 1, 1, 4, 1, 1, 0, 7, 0, 6, 2, 0, 1, 1, 3, 3, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 3, 1, 3, 3, 1, 3, 3, 1, 3, 3, 3, 2, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 3, 1, 1, 1, 1, 1, 1, 6, 2, 2, 2, 3, 3, 1, 13, 2, 2, 1, 1, 1, 1, 1, 1, 2, 3, 3, 1, 2, 4, 3, 2, 6, 2, 2, 2, 5, 1, 6, 4, 4, 1, 4, 1, 2, 1, 2, 3, 4, 0, 1, 2, 5, 6, 2, 2, 0, 2, 0, 7, 2, 3, 0, 1, 1, 1, 1, 4, 3, 3, 2, 5, 3, 1, 1, 1, 0, 2, 4, 2, 5, 0, 2, 4, 2, 5, 1, 1, 1, 1, 6, 1, 1, 2, 2, 1, 1, 1, 1, 1, 2, 0, 1, 3, 2, 4, 3, 6, 3, 3, 3, 1, 2 }; /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const short yydefact[] = { 0, 13, 28, 0, 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 19, 20, 0, 0, 0, 53, 52, 51, 50, 0, 0, 0, 146, 0, 147, 0, 148, 0, 0, 0, 150, 11, 12, 289, 290, 291, 292, 0, 47, 198, 196, 180, 285, 179, 188, 199, 187, 235, 0, 197, 237, 0, 103, 0, 99, 95, 182, 184, 185, 186, 183, 190, 191, 192, 96, 97, 98, 104, 100, 101, 102, 0, 228, 249, 18, 149, 204, 200, 0, 201, 0, 0, 0, 286, 156, 145, 0, 152, 154, 155, 153, 157, 158, 159, 160, 161, 162, 163, 164, 170, 171, 172, 166, 167, 168, 169, 165, 211, 54, 305, 0, 298, 138, 0, 0, 0, 0, 0, 0, 4, 9, 15, 293, 296, 0, 8, 22, 31, 0, 10, 76, 6, 5, 203, 0, 210, 0, 227, 0, 7, 248, 0, 55, 181, 189, 0, 194, 193, 0, 48, 0, 0, 66, 0, 0, 204, 211, 177, 151, 295, 175, 176, 178, 0, 71, 63, 56, 303, 306, 297, 139, 300, 0, 302, 0, 304, 0, 294, 0, 0, 0, 0, 295, 0, 295, 0, 295, 295, 0, 59, 143, 142, 130, 133, 134, 136, 140, 135, 0, 125, 124, 126, 127, 144, 105, 106, 108, 110, 112, 115, 118, 0, 123, 128, 131, 132, 137, 0, 195, 0, 49, 0, 64, 0, 0, 0, 238, 239, 295, 173, 45, 69, 295, 46, 72, 68, 0, 299, 0, 0, 0, 31, 21, 39, 258, 244, 32, 0, 0, 0, 0, 0, 0, 0, 0, 257, 38, 40, 0, 83, 82, 62, 78, 77, 79, 0, 80, 0, 0, 295, 0, 250, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 141, 234, 236, 94, 0, 0, 233, 0, 240, 0, 295, 43, 0, 75, 70, 73, 0, 0, 14, 0, 34, 33, 36, 0, 35, 37, 254, 0, 260, 283, 280, 281, 282, 0, 259, 0, 26, 41, 88, 0, 0, 208, 0, 0, 295, 0, 231, 0, 295, 0, 0, 31, 129, 107, 109, 111, 114, 113, 116, 117, 119, 120, 121, 0, 0, 241, 295, 0, 67, 0, 301, 16, 23, 0, 0, 252, 255, 42, 0, 0, 0, 0, 90, 91, 0, 202, 295, 205, 188, 216, 212, 213, 214, 295, 215, 226, 295, 229, 247, 251, 58, 0, 284, 232, 174, 295, 74, 177, 295, 242, 0, 0, 295, 81, 86, 0, 84, 0, 207, 206, 0, 0, 60, 44, 245, 295, 263, 267, 269, 268, 262, 0, 295, 0, 270, 0, 93, 270, 92, 295, 295, 0, 295, 261, 264, 0, 0, 275, 295, 87, 0, 0, 230, 295, 0, 266, 0, 0, 253, 295, 271, 85, 295, 246, 295, 295, 0, 0, 276, 0, 265, 273, 295, 272, 295, 0, 0, 0, 0, 217, 295, 0, 221, 0, 278, 295, 277, 0, 295, 209, 295, 218, 0, 222, 0, 295, 0, 295, 224, 219, 225, 220, 274, 295, 223, 279, 0, 0, 0 }; static const short yydefgoto[] = { 506, 19, 20, 21, 190, 22, 23, 24, 193, 25, 26, 27, 194, 195, 260, 336, 337, 245, 246, 216, 28, 29, 30, 31, 202, 287, 32, 33, 179, 249, 250, 314, 315, 197, 277, 278, 279, 280, 437, 435, 281, 381, 382, 383, 34, 67, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 35, 99, 342, 101, 102, 103, 104, 172, 173, 174, 175, 105, 106, 70, 71, 72, 73, 74, 75, 76, 77, 107, 108, 109, 110, 111, 112, 36, 37, 343, 344, 38, 39, 393, 478, 479, 480, 481, 482, 494, 40, 41, 347, 348, 116, 117, 118, 176, 240, 241, 263, 264, 409, 42, 43, 349, 266, 412, 267, 268, 269, 333, 375, 431, 432, 433, 447, 448, 466, 458, 459, 475, 334, 119, 84, 120, 44, 136, 137, 138, 46, 47, 48, 49, 50, 124 }; static const short yypact[] = { 1261, -31, 23, 1229, 35, 84, 121,-32768, 136, 152, 174, 1037, 177, 191, 86, 56, 34, 39, 86, 1318, -32768, 128, 151, 135,-32768,-32768, 33, 185, 153,-32768, -32768,-32768,-32768, 164, 169, 170,-32768, 157,-32768, 305, -32768, 181, 171, 209,-32768,-32768,-32768,-32768,-32768,-32768, -32768, 241,-32768,-32768,-32768,-32768,-32768,-32768, 31,-32768, -32768, 161, 14,-32768, 173, 245, 189, 253,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768, 257,-32768,-32768,-32768,-32768, 193,-32768, 180,-32768, 184, 268, 272,-32768, 189,-32768, 286,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768, 221, 279,-32768, 116,-32768,-32768, 17, 235, 63, 238, 1, 162,-32768,-32768, 227,-32768, 198, 230,-32768, 228,-32768, 298,-32768,-32768,-32768,-32768,-32768, 232,-32768, 262,-32768, 239,-32768,-32768, 240, -8,-32768,-32768, 30, 288,-32768, 30,-32768, 311, 244, 9, 30, 1086,-32768, -32768, 243, 254, 198,-32768,-32768,-32768, 40, 289,-32768, -32768,-32768,-32768,-32768,-32768,-32768, 77,-32768, 246,-32768, 270,-32768, 1374, 282, 287, 598, 81, 540, 198, 290, 198, 198, 292,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768, 30,-32768,-32768,-32768, 189,-32768, 293, 294, 295, 97, 144, 109,-32768, 124,-32768,-32768, 310, 314, -32768, 296,-32768, 297,-32768, 30,-32768, 302, -37, 30, 243,-32768, 198,-32768,-32768, 312, 198, 189,-32768, 346, 43,-32768, 329, 1374, 877,-32768,-32768,-32768,-32768,-32768, -32768, 323, 325, 327, 391, 333, 334, 107, 1135,-32768, -32768, 332, 403,-32768,-32768,-32768,-32768,-32768,-32768, 1037, -32768, 336, 362, 198, 411,-32768,-32768, 345, 341, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,-32768, -32768,-32768,-32768,-32768, 30, 30,-32768, 328,-32768, 286, 198,-32768, 40, 189, 350,-32768, 367, 934,-32768, 354, -32768,-32768,-32768, 1184,-32768,-32768,-32768, 352,-32768, 189, -32768,-32768,-32768, 424,-32768, 40,-32768,-32768,-32768, 286, 26,-32768, 286, 772, 198, 573,-32768, 129, 198, 825, 656,-32768,-32768, 294, 295, 97, 144, 144, 109, 109, -32768,-32768,-32768, 343, 347,-32768, 198, 43, 312, 43, -32768,-32768,-32768, 432, 76,-32768,-32768, 312, 80, 361, 1184, 364, 369,-32768, 87,-32768, 198,-32768, 412, 189, -32768,-32768,-32768, 198,-32768,-32768, 198,-32768,-32768,-32768, -32768, 714,-32768,-32768,-32768, 198,-32768,-32768, 198, 370, 365, 48, 198,-32768,-32768, 441,-32768, 425,-32768,-32768, 372, 411,-32768,-32768,-32768, 198,-32768,-32768,-32768,-32768, -32768, 3, 198, 1184, 415, 376,-32768, 415,-32768, 198, 198, 432, 198,-32768,-32768, 448, 380, 445, 198,-32768, 389, 390,-32768, 198, 44,-32768, 43, 385,-32768, 198, -32768,-32768, 198,-32768, 198, 91, 141, 398,-32768, 46, -32768,-32768, 198,-32768, 366, 142, 30, 392, 394, 46, 198, 988,-32768, 43,-32768, 198,-32768, 395, 198,-32768, 198,-32768, 286,-32768, 393, 91, 398, 198,-32768,-32768, -32768,-32768,-32768, 366,-32768,-32768, 463, 466,-32768 }; static const short yypgoto[] = { -32768, -131, -12,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768, 213, -233, 275,-32768,-32768, -283, 102, -1, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -93,-32768, -32768,-32768, 104,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768, 57, -178,-32768, -191,-32768, 194, 188, 195, -64, -63, -127,-32768, 263,-32768, -15,-32768,-32768, -137, -175,-32768, -5, 321, -255,-32768,-32768, -284, -297, -342,-32768, 487, 5,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768, 8, 488, 11, 489,-32768,-32768, -6,-32768, -32768, -195, -2,-32768,-32768,-32768,-32768, 16,-32768, 13, -32768, -10,-32768,-32768, 75,-32768, 0, 15,-32768,-32768, 259,-32768,-32768,-32768, -171,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768, 47,-32768, 60,-32768,-32768, -32768,-32768,-32768, -295,-32768,-32768,-32768,-32768, 4,-32768, 45,-32768,-32768,-32768,-32768,-32768, 482 }; #define YYLAST 1430 static const short yytable[] = { 127, 115, 66, 82, 45, 113, 100, 133, 69, 114, 98, 78, 366, 330, 80, 129, 131, 261, 83, 261, 262, 288, 262, 45, 265, 233, 265, 379, 373, 368, 237, 408, 177, 52, 140, 128, 305, 52, -61, 160, 130, 244, 52, 52, 303, 157, 52, 380, 204, 177, 306, 161, 377, 350, 476, 378, 158, 125, 384, 477, 188, 254, -57, 203, 178, 427, 428, 164, 330, 427, 428, 51, 205, 236, 183, 429, 442, 410, 443, 429, 184, 178, 148, 85, 150, 415, 152, 86, 155, 206, 207, 208, 209, 126, 210, 211, 65, -295, -295, 453, 65, -89, 307, 141, 212, 65, 65, -295, 326, 65, 213, 214, 115, 363, 186, 215, 113, 180, 401, 126, 114, 98, 317, 430, 87, 330, 126, 52, 14, 164, 16, 17, 18, 14, 251, 16, 17, 18, 445, 88, 184, 191, 204, 14, 123, 16, 17, 18, 386, 413, -25, -295, 135, 242, 399, 89, 418, 164, 147, 14, 242, 16, 17, 18, 292, 293, 205, 98, 364, 360, 361, 362, 261, 181, 182, 262, 247, 90, 330, 265, 121, -295, 151, 206, 207, 208, 209, 126, 210, 211, 65, 296, 297, 298, 122, 500, 45, 134, 212, 270, 395, 270, 396, 14, 139, 16, 17, 18, 142, 14, 154, 16, 17, 18, 472, 485, 473, 486, 243, 189, 182, -295, 143, 261, 294, 295, 262, -295, 356, 357, 265, 358, 359, 14, 144, 16, 17, 18, 145, 146, 153, 271, 133, 282, 156, 284, 285, 159, 163, 313, 14, -295, 16, 17, 18, 164, 165, 45, 45, 162, 166, 14, -287, 16, 17, 18, 167, 329, 331, 115, 168, 169, 115, 113, 339, 170, 113, 114, 98, -295, 114, 98, 52, 332, 91, 487, 53, 309, 54, 171, -288, 311, 185, 55, 5, 187, -17, -24, 92, 57, 192, 196, 198, 199, 58, 133, 149, 93, 59, 200, 201, 247, 327, 232, 234, 94, 60, 61, 95, 177, 235, 45, 329, 331, 96, 62, 97, 242, 345, 63, 64, 239, 248, 115, 247, 394, 252, 113, 332, 115, 253, 114, 98, 113, 389, 65, -295, 114, 98, -65, 390, 178, 255, 391, 270, 367, 392, 14, 256, 16, 17, 18, 286, 341, 283, 52, 247, 91, 313, 53, 289, 54, 290, 184, 291, 304, 55, 5, 300, 329, 331, 92, 57, 301, 302, 310, 312, 58, 316, 387, 93, 59, 320, 397, 321, 332, 322, 323, 94, 60, 61, 95, 324, 325, 335, 270, 338, 96, 62, 97, 340, 404, 63, 64, 346, 351, 352, 365, 14, 411, 16, 17, 18, 369, 370, 372, 374, 376, 65, 184, 402, 419, 329, 331, 403, 407, 414, 158, 420, 416, 426, 421, 417, 425, 436, 449, 380, 439, 332, 446, 423, 455, 474, 424, 456, 465, 457, 434, 461, 467, 462, 126, 501, 507, 488, 489, 508, 497, 319, 405, 441, 115, 276, 406, 438, 113, 492, 444, 354, 114, 98, 503, 495, 353, 451, 452, 355, 454, 299, 238, 68, 79, 81, 460, 493, 490, 440, 450, 463, 308, 132, 464, 0, 0, 468, 0, 0, 469, 0, 470, 471, 0, 0, 0, 0, 0, 0, 483, 0, 484, 0, 0, 0, 0, 0, 491, 0, 0, 0, 0, 496, 0, 0, 498, 0, 499, 0, 0, 0, 0, 502, 257, 504, -256, 0, -256, -243, -256, 505, -256, 3, 0, 0, 0, -256, 5, 6, 272, 0, 0, -256, 0, 0, 0, 0, -256, 0, 9, -256, -256, 258, 0, 273, 274, 0, 259, 52, -256, -256, 10, 53, 0, 54, 0, 11, 12, -256, -256, 5, -256, -256, -256, 14, 0, 16, 17, 18, 0, 388, 257, 0, -256, 0, -256, -243, -256, -256, -256, 3, 0, 60, 275, -256, 5, 6, 0, 0, 0, -256, 62, 0, 0, 0, -256, 0, 9, -256, -256, 258, 0, 0, 0, 0, 259, 0, -256, -256, 10, 0, 65, 0, 0, 11, 12, -256, -256, 0, -256, -256, -256, 14, 0, 16, 17, 18, 0, 0, 257, 0, -256, 0, -256, -243, -256, -256, -256, 3, 0, 0, -30, -256, 5, 6, 0, 0, 0, -256, 0, 0, 0, 0, -256, 0, 9, -256, -256, 258, 0, 0, 0, 0, 259, 0, -256, -256, 10, 0, 0, 0, 0, 11, 12, -256, -256, 0, -256, -256, -256, 14, 0, 16, 17, 18, 0, 0, 257, 0, -256, 0, -256, -243, -256, -256, -256, 3, 0, 0, 400, -256, 5, 6, 0, 0, 0, -256, 0, 0, 0, 0, -256, 0, 9, -256, -256, 258, 0, 0, 0, 0, 259, 0, -256, -256, 10, 0, 0, 0, 0, 11, 12, -256, -256, 0, -256, -256, -256, 14, 0, 16, 17, 18, 0, 0, 341, 0, 52, 0, 91, 0, 53, -256, 54, 0, 0, 0, 422, 55, 5, 0, 0, 0, 92, 57, 0, 0, 0, 0, 58, 0, 0, 93, 59, 0, 0, 0, 0, 0, 0, 94, 60, 61, 95, 0, 0, 0, 0, 0, 96, 62, 97, 0, 0, 63, 64, 0, 0, 341, 0, 52, 0, 91, 0, 53, 0, 54, 0, 0, 0, 65, 55, 5, 0, 0, 385, 92, 57, 0, 0, 0, 0, 58, 0, 0, 93, 59, 0, 0, 0, 0, 0, 0, 94, 60, 61, 95, 0, 0, 0, 0, 0, 96, 62, 97, 0, 0, 63, 64, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 3, 0, 4, 0, 65, 5, 6, 0, 0, 398, 0, 0, 0, -27, 7, 0, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 11, 12, 0, 0, 13, 0, 0, 0, 14, 15, 16, 17, 18, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 3, 0, 4, 0, 318, 5, 6, 0, 0, 0, 0, 0, 0, -27, 7, 0, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 11, 12, 0, 0, 13, 0, 0, 0, 14, 15, 16, 17, 18, 52, 0, 91, 0, 53, 476, 54, 0, 0, 0, 477, 55, 5, 0, 371, 0, 92, 57, 0, 0, 0, 0, 58, 0, 0, 93, 59, 0, 0, 0, 0, 0, 0, 94, 60, 61, 95, 0, 0, 0, 0, 0, 96, 62, 97, 0, 0, 63, 64, 52, 0, 91, 0, 53, 0, 54, 0, 0, 0, 0, 55, 5, 0, 65, 0, 92, 57, 0, 0, 0, 0, 58, 0, 0, 93, 59, 0, 0, 0, 0, 0, 0, 94, 60, 61, 95, 0, 0, 0, 0, 0, 96, 62, 97, 0, 0, 63, 64, 52, 0, 91, 0, 53, 0, 54, 0, 0, 0, 0, 55, 0, 0, 65, 0, 92, 57, 0, 0, 0, 0, 58, 0, 0, 93, 59, 0, 0, 0, 0, 0, 0, 94, 60, 61, 0, 0, 0, 0, 0, 0, 0, 62, 97, 0, 0, 63, 64, 52, 0, 91, 0, 53, 0, 54, 0, 0, 0, 0, 55, 0, 0, 65, 0, 0, 57, 0, 0, 0, 0, 58, 0, 0, 93, 59, 0, 0, 0, 0, 0, 0, 0, 60, 61, 0, 0, 0, 0, 0, 0, 0, 62, 97, 0, 328, 63, 64, 52, 0, 91, 0, 53, 0, 54, 0, 0, 0, 0, 55, 0, 0, 65, 0, 0, 57, 0, 0, 0, 0, 58, 0, 0, 93, 59, 0, 0, 0, 0, 0, 0, 0, 60, 61, 0, 0, 0, 0, 0, 0, 0, 62, 97, 52, 0, 63, 64, 53, 0, 54, 0, 0, 0, 0, 55, 0, 0, 0, 0, 56, 57, 65, 0, 0, 0, 58, 0, 0, 0, 59, 0, 0, -1, 1, 0, 0, 2, 60, 61, 0, 0, 0, 3, 0, 4, 0, 62, 5, 6, 0, 63, 64, 0, 0, 0, -27, 7, 0, 8, 9, 0, 0, 0, 0, 0, 0, 65, 0, 0, 0, 0, 10, 0, 0, 0, 0, 11, 12, 0, 0, 13, 0, 0, 0, 14, 15, 16, 17, 18, -2, 1, 0, 0, 2, 0, 0, 0, 0, 0, 3, 0, 4, 0, 0, 5, 6, 0, 0, 0, 0, 0, 0, -27, 7, 0, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 11, 12, 0, 0, 13, 0, 0, 0, 14, 15, 16, 17, 18, 1, 0, 0, 2, 0, 0, 0, 0, 0, 3, 0, 4, 0, 0, 5, 6, 0, 0, 0, 0, 0, 0, -27, 7, 0, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 11, 12, 0, 0, 13, 0, 0, 0, 14, 15, 16, 17, 18 }; static const short yycheck[] = { 15, 11, 3, 3, 0, 11, 11, 19, 3, 11, 11, 3, 309, 268, 3, 16, 17, 195, 3, 197, 195, 212, 197, 19, 195, 162, 197, 1, 323, 312, 167, 373, 40, 3, 1, 1, 73, 3, 69, 25, 1, 1, 3, 3, 235, 14, 3, 21, 18, 40, 87, 37, 335, 286, 8, 339, 25, 1, 342, 13, 59, 192, 70, 156, 72, 21, 22, 66, 323, 21, 22, 48, 42, 166, 57, 31, 73, 1, 75, 31, 63, 72, 37, 48, 39, 380, 41, 3, 43, 59, 60, 61, 62, 63, 64, 65, 66, 21, 22, 441, 66, 75, 239, 70, 74, 66, 66, 31, 1, 66, 80, 81, 122, 304, 129, 85, 122, 122, 351, 63, 122, 122, 253, 75, 3, 380, 63, 3, 52, 66, 54, 55, 56, 52, 57, 54, 55, 56, 433, 3, 63, 137, 18, 52, 58, 54, 55, 56, 343, 69, 69, 75, 1, 73, 349, 3, 69, 66, 1, 52, 73, 54, 55, 56, 67, 68, 42, 168, 305, 296, 297, 298, 350, 57, 58, 350, 177, 3, 433, 350, 3, 74, 1, 59, 60, 61, 62, 63, 64, 65, 66, 82, 83, 84, 3, 492, 192, 69, 74, 195, 71, 197, 73, 52, 69, 54, 55, 56, 23, 52, 1, 54, 55, 56, 73, 73, 75, 75, 173, 57, 58, 70, 69, 401, 80, 81, 401, 70, 292, 293, 401, 294, 295, 52, 70, 54, 55, 56, 69, 69, 69, 196, 254, 198, 3, 200, 201, 86, 3, 250, 52, 70, 54, 55, 56, 66, 3, 253, 254, 86, 3, 52, 69, 54, 55, 56, 86, 268, 268, 279, 86, 3, 282, 279, 279, 3, 282, 279, 279, 70, 282, 282, 3, 268, 5, 476, 7, 242, 9, 3, 69, 246, 57, 14, 15, 57, 69, 69, 19, 20, 70, 3, 70, 41, 25, 317, 1, 28, 29, 70, 70, 312, 267, 25, 3, 36, 37, 38, 39, 40, 76, 317, 323, 323, 45, 46, 47, 73, 283, 50, 51, 88, 43, 343, 335, 345, 90, 343, 323, 349, 70, 343, 343, 349, 345, 66, 41, 349, 349, 70, 345, 72, 70, 345, 350, 310, 345, 52, 71, 54, 55, 56, 70, 1, 74, 3, 367, 5, 369, 7, 77, 9, 78, 63, 79, 73, 14, 15, 64, 380, 380, 19, 20, 87, 87, 73, 40, 25, 59, 344, 28, 29, 69, 348, 69, 380, 69, 6, 36, 37, 38, 39, 69, 69, 72, 401, 3, 45, 46, 47, 74, 366, 50, 51, 3, 70, 75, 89, 52, 374, 54, 55, 56, 73, 57, 71, 74, 3, 66, 63, 87, 386, 433, 433, 87, 3, 75, 25, 393, 75, 75, 396, 73, 73, 3, 69, 21, 75, 433, 34, 405, 3, 467, 408, 74, 456, 11, 412, 69, 74, 70, 63, 69, 0, 72, 71, 0, 72, 255, 367, 425, 481, 197, 369, 417, 481, 481, 432, 290, 481, 481, 496, 483, 289, 439, 440, 291, 442, 225, 168, 3, 3, 3, 448, 481, 479, 421, 437, 453, 240, 18, 454, -1, -1, 459, -1, -1, 462, -1, 464, 465, -1, -1, -1, -1, -1, -1, 472, -1, 474, -1, -1, -1, -1, -1, 480, -1, -1, -1, -1, 485, -1, -1, 488, -1, 490, -1, -1, -1, -1, 495, 1, 497, 3, -1, 5, 6, 7, 503, 9, 10, -1, -1, -1, 14, 15, 16, 17, -1, -1, 20, -1, -1, -1, -1, 25, -1, 27, 28, 29, 30, -1, 32, 33, -1, 35, 3, 37, 38, 39, 7, -1, 9, -1, 44, 45, 46, 47, 15, 49, 50, 51, 52, -1, 54, 55, 56, -1, 25, 1, -1, 3, -1, 5, 6, 7, 66, 9, 10, -1, 37, 71, 14, 15, 16, -1, -1, -1, 20, 46, -1, -1, -1, 25, -1, 27, 28, 29, 30, -1, -1, -1, -1, 35, -1, 37, 38, 39, -1, 66, -1, -1, 44, 45, 46, 47, -1, 49, 50, 51, 52, -1, 54, 55, 56, -1, -1, 1, -1, 3, -1, 5, 6, 7, 66, 9, 10, -1, -1, 71, 14, 15, 16, -1, -1, -1, 20, -1, -1, -1, -1, 25, -1, 27, 28, 29, 30, -1, -1, -1, -1, 35, -1, 37, 38, 39, -1, -1, -1, -1, 44, 45, 46, 47, -1, 49, 50, 51, 52, -1, 54, 55, 56, -1, -1, 1, -1, 3, -1, 5, 6, 7, 66, 9, 10, -1, -1, 71, 14, 15, 16, -1, -1, -1, 20, -1, -1, -1, -1, 25, -1, 27, 28, 29, 30, -1, -1, -1, -1, 35, -1, 37, 38, 39, -1, -1, -1, -1, 44, 45, 46, 47, -1, 49, 50, 51, 52, -1, 54, 55, 56, -1, -1, 1, -1, 3, -1, 5, -1, 7, 66, 9, -1, -1, -1, 71, 14, 15, -1, -1, -1, 19, 20, -1, -1, -1, -1, 25, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, 36, 37, 38, 39, -1, -1, -1, -1, -1, 45, 46, 47, -1, -1, 50, 51, -1, -1, 1, -1, 3, -1, 5, -1, 7, -1, 9, -1, -1, -1, 66, 14, 15, -1, -1, 71, 19, 20, -1, -1, -1, -1, 25, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, 36, 37, 38, 39, -1, -1, -1, -1, -1, 45, 46, 47, -1, -1, 50, 51, -1, 1, -1, -1, 4, -1, -1, -1, -1, -1, 10, -1, 12, -1, 66, 15, 16, -1, -1, 71, -1, -1, -1, 23, 24, -1, 26, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, -1, -1, -1, 44, 45, -1, -1, 48, -1, -1, -1, 52, 53, 54, 55, 56, -1, 1, -1, -1, 4, -1, -1, -1, -1, -1, 10, -1, 12, -1, 71, 15, 16, -1, -1, -1, -1, -1, -1, 23, 24, -1, 26, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, -1, -1, -1, 44, 45, -1, -1, 48, -1, -1, -1, 52, 53, 54, 55, 56, 3, -1, 5, -1, 7, 8, 9, -1, -1, -1, 13, 14, 15, -1, 71, -1, 19, 20, -1, -1, -1, -1, 25, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, 36, 37, 38, 39, -1, -1, -1, -1, -1, 45, 46, 47, -1, -1, 50, 51, 3, -1, 5, -1, 7, -1, 9, -1, -1, -1, -1, 14, 15, -1, 66, -1, 19, 20, -1, -1, -1, -1, 25, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, 36, 37, 38, 39, -1, -1, -1, -1, -1, 45, 46, 47, -1, -1, 50, 51, 3, -1, 5, -1, 7, -1, 9, -1, -1, -1, -1, 14, -1, -1, 66, -1, 19, 20, -1, -1, -1, -1, 25, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, 36, 37, 38, -1, -1, -1, -1, -1, -1, -1, 46, 47, -1, -1, 50, 51, 3, -1, 5, -1, 7, -1, 9, -1, -1, -1, -1, 14, -1, -1, 66, -1, -1, 20, -1, -1, -1, -1, 25, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, 37, 38, -1, -1, -1, -1, -1, -1, -1, 46, 47, -1, 49, 50, 51, 3, -1, 5, -1, 7, -1, 9, -1, -1, -1, -1, 14, -1, -1, 66, -1, -1, 20, -1, -1, -1, -1, 25, -1, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, 37, 38, -1, -1, -1, -1, -1, -1, -1, 46, 47, 3, -1, 50, 51, 7, -1, 9, -1, -1, -1, -1, 14, -1, -1, -1, -1, 19, 20, 66, -1, -1, -1, 25, -1, -1, -1, 29, -1, -1, 0, 1, -1, -1, 4, 37, 38, -1, -1, -1, 10, -1, 12, -1, 46, 15, 16, -1, 50, 51, -1, -1, -1, 23, 24, -1, 26, 27, -1, -1, -1, -1, -1, -1, 66, -1, -1, -1, -1, 39, -1, -1, -1, -1, 44, 45, -1, -1, 48, -1, -1, -1, 52, 53, 54, 55, 56, 0, 1, -1, -1, 4, -1, -1, -1, -1, -1, 10, -1, 12, -1, -1, 15, 16, -1, -1, -1, -1, -1, -1, 23, 24, -1, 26, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, -1, -1, -1, 44, 45, -1, -1, 48, -1, -1, -1, 52, 53, 54, 55, 56, 1, -1, -1, 4, -1, -1, -1, -1, -1, 10, -1, 12, -1, -1, 15, 16, -1, -1, -1, -1, -1, -1, 23, 24, -1, 26, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, -1, -1, -1, 44, 45, -1, -1, 48, -1, -1, -1, 52, 53, 54, 55, 56 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/share/bison/bison.simple" /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ /* This is the parser code that is written into each bison parser when the %semantic_parser declaration is not specified in the grammar. It was written by Richard Stallman by simplifying the hairy parser used when %semantic_parser is specified. */ /* 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. */ #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) /* The parser invokes alloca or malloc; define the necessary symbols. */ # if YYSTACK_USE_ALLOCA # define YYSTACK_ALLOC alloca # else # ifndef YYSTACK_USE_ALLOCA # if defined (alloca) || defined (_ALLOCA_H) # define YYSTACK_ALLOC alloca # else # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # endif # 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 malloc # define YYSTACK_FREE free # endif #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ #if (! defined (yyoverflow) \ && (! defined (__cplusplus) \ || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { short yyss; YYSTYPE yyvs; # if YYLSP_NEEDED YYLTYPE yyls; # endif }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # if YYLSP_NEEDED # define YYSTACK_BYTES(N) \ ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + 2 * YYSTACK_GAP_MAX) # else # define YYSTACK_BYTES(N) \ ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAX) # endif /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if 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_MAX; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0) #endif #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 yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yychar1 = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { \ yyerror ("syntax error: cannot back up"); \ YYERROR; \ } \ while (0) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Compute the default location (before the actions are run). When YYLLOC_DEFAULT is run, CURRENT is set the location of the first token. By default, to implement support for ranges, extend its range to the last symbol. */ #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ Current.last_line = Rhs[N].last_line; \ Current.last_column = Rhs[N].last_column; #endif /* YYLEX -- calling `yylex' with the right arguments. */ #if YYPURE # if YYLSP_NEEDED # ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) # else # define YYLEX yylex (&yylval, &yylloc) # endif # else /* !YYLSP_NEEDED */ # ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, YYLEX_PARAM) # else # define YYLEX yylex (&yylval) # endif # endif /* !YYLSP_NEEDED */ #else /* !YYPURE */ # define YYLEX yylex () #endif /* !YYPURE */ /* 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) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) #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. */ #if YYMAXDEPTH == 0 # undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #ifdef 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 #line 315 "/usr/share/bison/bison.simple" /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. It should actually point to an object. Grammar actions can access the variable by casting it to the proper pointer type. */ #ifdef YYPARSE_PARAM # if defined (__STDC__) || defined (__cplusplus) # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM # define YYPARSE_PARAM_DECL # else # define YYPARSE_PARAM_ARG YYPARSE_PARAM # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; # endif #else /* !YYPARSE_PARAM */ # define YYPARSE_PARAM_ARG # define YYPARSE_PARAM_DECL #endif /* !YYPARSE_PARAM */ /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ # ifdef YYPARSE_PARAM int yyparse (void *); # else int yyparse (void); # endif #endif /* YY_DECL_VARIABLES -- depending whether we use a pure parser, variables are global, or local to YYPARSE. */ #define YY_DECL_NON_LSP_VARIABLES \ /* The lookahead symbol. */ \ int yychar; \ \ /* The semantic value of the lookahead symbol. */ \ YYSTYPE yylval; \ \ /* Number of parse errors so far. */ \ int yynerrs; #if YYLSP_NEEDED # define YY_DECL_VARIABLES \ YY_DECL_NON_LSP_VARIABLES \ \ /* Location data for the lookahead symbol. */ \ YYLTYPE yylloc; #else # define YY_DECL_VARIABLES \ YY_DECL_NON_LSP_VARIABLES #endif /* If nonreentrant, generate the variables here. */ #if !YYPURE YY_DECL_VARIABLES #endif /* !YYPURE */ int yyparse (YYPARSE_PARAM_ARG) YYPARSE_PARAM_DECL { /* If reentrant, generate the variables here. */ #if YYPURE YY_DECL_VARIABLES #endif /* !YYPURE */ register int yystate; register int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Lookahead token as an internal (translated) token number. */ int yychar1 = 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 yyssa[YYINITDEPTH]; short *yyss = yyssa; register short *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; register YYSTYPE *yyvsp; #if YYLSP_NEEDED /* The location stack. */ YYLTYPE yylsa[YYINITDEPTH]; YYLTYPE *yyls = yylsa; YYLTYPE *yylsp; #endif #if YYLSP_NEEDED # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) #else # define YYPOPSTACK (yyvsp--, yyssp--) #endif YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYLSP_NEEDED YYLTYPE yyloc; #endif /* 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; #if YYLSP_NEEDED yylsp = yyls; #endif 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 (yyssp >= yyss + yystacksize - 1) { /* 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 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. */ # if YYLSP_NEEDED YYLTYPE *yyls1 = yyls; /* 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), &yyls1, yysize * sizeof (*yylsp), &yystacksize); yyls = yyls1; # else yyoverflow ("parser stack overflow", &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); # endif yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyoverflowlab; # else /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) goto yyoverflowlab; yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; { short *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyoverflowlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # if YYLSP_NEEDED YYSTACK_RELOCATE (yyls); # endif # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; #if YYLSP_NEEDED yylsp = yyls + yysize - 1; #endif YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyssp >= yyss + yystacksize - 1) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. */ /* Read a lookahead token if we need one and don't already have one. */ /* yyresume: */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYFLAG) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* yychar is either YYEMPTY or YYEOF or a valid token in external form. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } /* Convert token to internal form (in yychar1) for indexing tables with */ if (yychar <= 0) /* This means end of input. */ { yychar1 = 0; yychar = YYEOF; /* Don't call YYLEX any more */ YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yychar1 = YYTRANSLATE (yychar); #if YYDEBUG /* We have to keep this `#if YYDEBUG', since we use variables which are defined only if `YYDEBUG' is set. */ if (yydebug) { YYFPRINTF (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); /* Give the individual parser a way to print the precise meaning of a token, for further debugging info. */ # ifdef YYPRINT YYPRINT (stderr, yychar, yylval); # endif YYFPRINTF (stderr, ")\n"); } #endif } yyn += yychar1; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) goto yydefault; yyn = yytable[yyn]; /* yyn is what to do for this token type in this state. Negative => reduce, -yyn is rule number. Positive => shift, yyn is new state. New state is final state => don't bother to shift, just return success. 0, or most negative number => error. */ if (yyn < 0) { if (yyn == YYFLAG) goto yyerrlab; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ YYDPRINTF ((stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1])); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; #if YYLSP_NEEDED *++yylsp = yylloc; #endif /* 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 the semantic value of the lookahead token. 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]; #if YYLSP_NEEDED /* Similarly for the default location. Let the user run additional commands if for instance locations are ranges. */ yyloc = yylsp[1-yylen]; YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); #endif #if YYDEBUG /* We have to keep this `#if YYDEBUG', since we use variables which are defined only if `YYDEBUG' is set. */ if (yydebug) { int yyi; YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", yyn, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); } #endif switch (yyn) { case 1: #line 404 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = 0; ; break;} case 2: #line 405 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[0].decl_val; AST::tree()->setDeclarations(yyvsp[0].decl_val); ; break;} case 3: #line 412 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[0].decl_val; ; break;} case 4: #line 413 "../../../../../src/tool/omniidl/cxx/idl.yy" { if (yyvsp[-1].decl_val) { yyvsp[-1].decl_val->append(yyvsp[0].decl_val); yyval.decl_val = yyvsp[-1].decl_val; } else yyval.decl_val = yyvsp[0].decl_val; ; break;} case 5: #line 420 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[-1].decl_val; ; break;} case 6: #line 421 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[-1].const_val; ; break;} case 7: #line 422 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[-1].exception_val; ; break;} case 8: #line 423 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[-1].decl_val; ; break;} case 9: #line 424 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[-1].module_val; ; break;} case 10: #line 425 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[-1].value_base_val; ; break;} case 11: #line 426 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = 0; ; break;} case 12: #line 427 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = 0; ; break;} case 13: #line 428 "../../../../../src/tool/omniidl/cxx/idl.yy" { IdlSyntaxError(currentFile, yylineno, "Syntax error in definition"); yyval.decl_val = 0; ; break;} case 14: #line 435 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-4].module_val->finishConstruction(yyvsp[-1].decl_val); yyval.module_val = yyvsp[-4].module_val; ; break;} case 15: #line 439 "../../../../../src/tool/omniidl/cxx/idl.yy" { IdlSyntaxError(currentFile, yylineno, "Syntax error in module definition"); ; break;} case 16: #line 442 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-5].module_val->finishConstruction(yyvsp[-1].decl_val); yyval.module_val = yyvsp[-5].module_val; ; break;} case 17: #line 446 "../../../../../src/tool/omniidl/cxx/idl.yy" { IdlSyntaxError(currentFile, yylineno, "Syntax error in module definition (no body found)"); yyvsp[-1].module_val->finishConstruction(0); yyval.module_val = yyvsp[-1].module_val; ; break;} case 18: #line 455 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.module_val = new Module(currentFile, yylineno, mainFile, yyvsp[0].id_val); ; break;} case 19: #line 459 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[0].interface_val; ; break;} case 20: #line 460 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[0].forward_val; ; break;} case 21: #line 464 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-3].interface_val->finishConstruction(yyvsp[-1].decl_val); yyval.interface_val = yyvsp[-3].interface_val; ; break;} case 22: #line 468 "../../../../../src/tool/omniidl/cxx/idl.yy" { IdlSyntaxError(currentFile, yylineno, "Syntax error in interface definition"); ; break;} case 23: #line 471 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-5].interface_val->finishConstruction(yyvsp[-1].decl_val); yyval.interface_val = yyvsp[-5].interface_val; ; break;} case 24: #line 475 "../../../../../src/tool/omniidl/cxx/idl.yy" { IdlSyntaxError(currentFile, yylineno, "Syntax error in interface definition (no body found)"); yyvsp[-1].interface_val->finishConstruction(0); yyval.interface_val = yyvsp[-1].interface_val; ; break;} case 25: #line 484 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.forward_val = new Forward(currentFile, yylineno, mainFile, yyvsp[0].id_val, yyvsp[-2].int_val==1, yyvsp[-2].int_val==2); ; break;} case 26: #line 491 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.interface_val = new Interface(currentFile, yylineno, mainFile, yyvsp[-2].id_val, yyvsp[-4].int_val==1, yyvsp[-4].int_val==2, yyvsp[0].inheritspec_val); ; break;} case 27: #line 498 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.int_val = 0; ; break;} case 28: #line 499 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.int_val = 1; ; break;} case 29: #line 500 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.int_val = 2; ; break;} case 30: #line 504 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[0].decl_val; ; break;} case 31: #line 508 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = 0; ; break;} case 32: #line 509 "../../../../../src/tool/omniidl/cxx/idl.yy" { if (yyvsp[-1].decl_val) { yyvsp[-1].decl_val->append(yyvsp[0].decl_val); yyval.decl_val = yyvsp[-1].decl_val; } else yyval.decl_val = yyvsp[0].decl_val; ; break;} case 33: #line 516 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[-1].decl_val; ; break;} case 34: #line 517 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[-1].const_val; ; break;} case 35: #line 518 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[-1].exception_val; ; break;} case 36: #line 519 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[-1].attribute_val; ; break;} case 37: #line 520 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[-1].operation_val; ; break;} case 38: #line 521 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = 0; ; break;} case 39: #line 522 "../../../../../src/tool/omniidl/cxx/idl.yy" { IdlSyntaxError(currentFile, yylineno, "Syntax error in interface body"); yyval.decl_val = 0; ; break;} case 40: #line 529 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.inheritspec_val = 0; ; break;} case 41: #line 530 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.inheritspec_val = yyvsp[0].inheritspec_val; ; break;} case 42: #line 534 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.inheritspec_val = yyvsp[0].inheritspec_val; ; break;} case 43: #line 538 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.inheritspec_val = new InheritSpec(yyvsp[-1].scopedname_val, currentFile, yylineno); if (!yyval.inheritspec_val->interface()) { delete yyval.inheritspec_val; yyval.inheritspec_val = 0; } ; break;} case 44: #line 545 "../../../../../src/tool/omniidl/cxx/idl.yy" { if (yyvsp[-4].inheritspec_val) { yyvsp[-4].inheritspec_val->append(new InheritSpec(yyvsp[-1].scopedname_val, currentFile, yylineno), currentFile, yylineno); yyval.inheritspec_val = yyvsp[-4].inheritspec_val; } else yyval.inheritspec_val = new InheritSpec(yyvsp[-1].scopedname_val, currentFile, yylineno); ; break;} case 45: #line 553 "../../../../../src/tool/omniidl/cxx/idl.yy" { IdlSyntaxError(currentFile, yylineno, "Syntax error in inheritance list"); yyval.inheritspec_val = 0; ; break;} case 46: #line 561 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.scopedname_val = yyvsp[0].scopedname_val; ; break;} case 47: #line 565 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.scopedname_val = new ScopedName(yyvsp[0].id_val, 0); ; break;} case 48: #line 568 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.scopedname_val = new ScopedName(yyvsp[0].id_val, 1); ; break;} case 49: #line 571 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-2].scopedname_val->append(yyvsp[0].id_val); yyval.scopedname_val=yyvsp[-2].scopedname_val; ; break;} case 50: #line 582 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.value_base_val = yyvsp[0].value_val; ; break;} case 51: #line 583 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.value_base_val = yyvsp[0].value_abs_val; ; break;} case 52: #line 584 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.value_base_val = yyvsp[0].value_box_val; ; break;} case 53: #line 585 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.value_base_val = yyvsp[0].value_forward_val; ; break;} case 54: #line 589 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.value_forward_val = new ValueForward(currentFile, yylineno, mainFile, 0, yyvsp[0].id_val); ; break;} case 55: #line 592 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.value_forward_val = new ValueForward(currentFile, yylineno, mainFile, 1, yyvsp[0].id_val); ; break;} case 56: #line 598 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.value_box_val = new ValueBox(currentFile, yylineno, mainFile, yyvsp[-1].id_val, yyvsp[0].type_spec_val->type(), yyvsp[0].type_spec_val->constr()); delete yyvsp[0].type_spec_val; ; break;} case 57: #line 606 "../../../../../src/tool/omniidl/cxx/idl.yy" { valueabs_hack = new ValueAbs(currentFile, yylineno, mainFile, yyvsp[0].id_val, 0, 0); ; break;} case 58: #line 608 "../../../../../src/tool/omniidl/cxx/idl.yy" { valueabs_hack->finishConstruction(yyvsp[-1].decl_val); yyval.value_abs_val = valueabs_hack; valueabs_hack = 0; ; break;} case 59: #line 613 "../../../../../src/tool/omniidl/cxx/idl.yy" { valueabs_hack = new ValueAbs(currentFile, yylineno, mainFile, yyvsp[-1].id_val, yyvsp[0].valueinheritsupportspec_val->inherits(), yyvsp[0].valueinheritsupportspec_val->supports()); delete yyvsp[0].valueinheritsupportspec_val; ; break;} case 60: #line 617 "../../../../../src/tool/omniidl/cxx/idl.yy" { valueabs_hack->finishConstruction(yyvsp[-1].decl_val); yyval.value_abs_val = valueabs_hack; valueabs_hack = 0; ; break;} case 61: #line 622 "../../../../../src/tool/omniidl/cxx/idl.yy" { IdlSyntaxError(currentFile, yylineno, "Syntax error in abstract valuetype"); if (valueabs_hack) { valueabs_hack->finishConstruction(0); yyval.value_abs_val = valueabs_hack; valueabs_hack = 0; } else yyval.value_abs_val = 0; ; break;} case 62: #line 635 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-3].value_val->finishConstruction(yyvsp[-1].decl_val); yyval.value_val = yyvsp[-3].value_val; ; break;} case 63: #line 642 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.value_val = new Value(currentFile, yylineno, mainFile, 0, yyvsp[-1].id_val, yyvsp[0].valueinheritsupportspec_val->inherits(), yyvsp[0].valueinheritsupportspec_val->supports()); delete yyvsp[0].valueinheritsupportspec_val; ; break;} case 64: #line 647 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.value_val = new Value(currentFile, yylineno, mainFile, 1, yyvsp[-1].id_val, yyvsp[0].valueinheritsupportspec_val->inherits(), yyvsp[0].valueinheritsupportspec_val->supports()); delete yyvsp[0].valueinheritsupportspec_val; ; break;} case 65: #line 652 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.value_val = new Value(currentFile, yylineno, mainFile, 0, yyvsp[0].id_val, 0, 0); ; break;} case 66: #line 655 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.value_val = new Value(currentFile, yylineno, mainFile, 1, yyvsp[0].id_val, 0, 0); ; break;} case 67: #line 661 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.valueinheritsupportspec_val = new ValueInheritSupportSpec(yyvsp[-2].valueinheritspec_val, yyvsp[0].inheritspec_val); ; break;} case 68: #line 664 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.valueinheritsupportspec_val = new ValueInheritSupportSpec(yyvsp[0].valueinheritspec_val, 0); ; break;} case 69: #line 667 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.valueinheritsupportspec_val = new ValueInheritSupportSpec(0, yyvsp[0].inheritspec_val); ; break;} case 70: #line 673 "../../../../../src/tool/omniidl/cxx/idl.yy" { if (yyvsp[-1].boolean_val) yyvsp[0].valueinheritspec_val->setTruncatable(); yyval.valueinheritspec_val = yyvsp[0].valueinheritspec_val; ; break;} case 71: #line 680 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.boolean_val = 0; ; break;} case 72: #line 681 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.boolean_val = 1; ; break;} case 73: #line 685 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.valueinheritspec_val = new ValueInheritSpec(yyvsp[0].scopedname_val, currentFile, yylineno); if (!yyval.valueinheritspec_val->value()) { delete yyval.valueinheritspec_val; yyval.valueinheritspec_val = 0; } ; break;} case 74: #line 692 "../../../../../src/tool/omniidl/cxx/idl.yy" { if (yyvsp[-2].valueinheritspec_val) { yyvsp[-2].valueinheritspec_val->append(new ValueInheritSpec(yyvsp[0].scopedname_val, currentFile, yylineno), currentFile, yylineno); yyval.valueinheritspec_val = yyvsp[-2].valueinheritspec_val; } else yyval.valueinheritspec_val = new ValueInheritSpec(yyvsp[0].scopedname_val, currentFile, yylineno); ; break;} case 75: #line 703 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.scopedname_val = yyvsp[0].scopedname_val; ; break;} case 76: #line 707 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = 0; ; break;} case 77: #line 708 "../../../../../src/tool/omniidl/cxx/idl.yy" { if (yyvsp[-1].decl_val) { yyvsp[-1].decl_val->append(yyvsp[0].decl_val); yyval.decl_val = yyvsp[-1].decl_val; } else yyval.decl_val = yyvsp[0].decl_val; ; break;} case 78: #line 715 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[0].decl_val; ; break;} case 79: #line 716 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[0].statemember_val; ; break;} case 80: #line 717 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[0].factory_val; ; break;} case 81: #line 721 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.statemember_val = new StateMember(currentFile, yylineno, mainFile, yyvsp[-3].ulong_val, yyvsp[-2].type_spec_val->type(), yyvsp[-2].type_spec_val->constr(), yyvsp[-1].declarator_val); delete yyvsp[-2].type_spec_val; ; break;} case 82: #line 729 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.ulong_val = 0; ; break;} case 83: #line 730 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.ulong_val = 1; ; break;} case 84: #line 734 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-3].factory_val->closeParens(); ; break;} case 85: #line 736 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-6].factory_val->finishConstruction(yyvsp[-4].parameter_val, yyvsp[-1].raisesspec_val); yyval.factory_val = yyvsp[-6].factory_val; ; break;} case 86: #line 740 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-3].factory_val->closeParens(); ; break;} case 87: #line 742 "../../../../../src/tool/omniidl/cxx/idl.yy" { IdlSyntaxError(currentFile, yylineno, "Syntax error in factory parameters"); yyvsp[-5].factory_val->finishConstruction(0, 0); yyval.factory_val = yyvsp[-5].factory_val; ; break;} case 88: #line 751 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.factory_val = new Factory(currentFile, yylineno, mainFile, yyvsp[0].id_val); ; break;} case 89: #line 757 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.parameter_val = 0; ; break;} case 90: #line 758 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.parameter_val = yyvsp[0].parameter_val; ; break;} case 91: #line 762 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.parameter_val = yyvsp[0].parameter_val; ; break;} case 92: #line 763 "../../../../../src/tool/omniidl/cxx/idl.yy" { if (yyvsp[-2].parameter_val) { yyvsp[-2].parameter_val->append(yyvsp[0].parameter_val); yyval.parameter_val = yyvsp[-2].parameter_val; } else yyval.parameter_val = yyvsp[0].parameter_val; ; break;} case 93: #line 770 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.parameter_val = new Parameter(currentFile, yylineno, mainFile, 0, yyvsp[-1].type_val, yyvsp[0].id_val); ; break;} case 94: #line 778 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.const_val = new Const(currentFile, yylineno, mainFile, yyvsp[-3].type_val, yyvsp[-2].id_val, yyvsp[0].expr_val); ; break;} case 95: #line 784 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 96: #line 785 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 97: #line 786 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 98: #line 787 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 99: #line 788 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 100: #line 789 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 101: #line 790 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 102: #line 791 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 103: #line 792 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = IdlType::scopedNameToType(currentFile, yylineno, yyvsp[0].scopedname_val); ; break;} case 104: #line 795 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 105: #line 799 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = yyvsp[0].expr_val; ; break;} case 106: #line 803 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = yyvsp[0].expr_val; ; break;} case 107: #line 804 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = new OrExpr(currentFile, yylineno, yyvsp[-2].expr_val, yyvsp[0].expr_val); ; break;} case 108: #line 808 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = yyvsp[0].expr_val; ; break;} case 109: #line 809 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = new XorExpr(currentFile, yylineno, yyvsp[-2].expr_val, yyvsp[0].expr_val); ; break;} case 110: #line 813 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = yyvsp[0].expr_val; ; break;} case 111: #line 814 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = new AndExpr(currentFile, yylineno, yyvsp[-2].expr_val, yyvsp[0].expr_val); ; break;} case 112: #line 820 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = yyvsp[0].expr_val; ; break;} case 113: #line 821 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = new RShiftExpr(currentFile, yylineno, yyvsp[-2].expr_val, yyvsp[0].expr_val); ; break;} case 114: #line 824 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = new LShiftExpr(currentFile, yylineno, yyvsp[-2].expr_val, yyvsp[0].expr_val); ; break;} case 115: #line 830 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = yyvsp[0].expr_val; ; break;} case 116: #line 831 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = new AddExpr(currentFile, yylineno, yyvsp[-2].expr_val, yyvsp[0].expr_val); ; break;} case 117: #line 832 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = new SubExpr(currentFile, yylineno, yyvsp[-2].expr_val, yyvsp[0].expr_val); ; break;} case 118: #line 836 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = yyvsp[0].expr_val; ; break;} case 119: #line 837 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = new MultExpr(currentFile, yylineno, yyvsp[-2].expr_val, yyvsp[0].expr_val); ; break;} case 120: #line 840 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = new DivExpr(currentFile, yylineno, yyvsp[-2].expr_val, yyvsp[0].expr_val); ; break;} case 121: #line 843 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = new ModExpr(currentFile, yylineno, yyvsp[-2].expr_val, yyvsp[0].expr_val); ; break;} case 122: #line 849 "../../../../../src/tool/omniidl/cxx/idl.yy" { if (yyvsp[-1].char_val == '-') yyval.expr_val = new MinusExpr(currentFile, yylineno, yyvsp[0].expr_val); if (yyvsp[-1].char_val == '+') yyval.expr_val = new PlusExpr(currentFile, yylineno, yyvsp[0].expr_val); if (yyvsp[-1].char_val == '~') yyval.expr_val = new InvertExpr(currentFile, yylineno, yyvsp[0].expr_val); ; break;} case 123: #line 854 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = yyvsp[0].expr_val; ; break;} case 124: #line 858 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.char_val = '-'; ; break;} case 125: #line 859 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.char_val = '+'; ; break;} case 126: #line 860 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.char_val = '~'; ; break;} case 127: #line 864 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = IdlExpr::scopedNameToExpr(currentFile, yylineno, yyvsp[0].scopedname_val); ; break;} case 128: #line 867 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = yyvsp[0].expr_val; ; break;} case 129: #line 868 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = yyvsp[-1].expr_val; ; break;} case 130: #line 872 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = new IntegerExpr(currentFile, yylineno, yyvsp[0].int_literal_val); ; break;} case 131: #line 875 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = new StringExpr(currentFile, yylineno, yyvsp[0].string_val); ; break;} case 132: #line 878 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = new WStringExpr(currentFile, yylineno, yyvsp[0].wstring_val); ; break;} case 133: #line 881 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = new CharExpr(currentFile, yylineno, yyvsp[0].char_val); ; break;} case 134: #line 884 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = new WCharExpr(currentFile, yylineno, yyvsp[0].wchar_val); ; break;} case 135: #line 887 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = new FixedExpr(currentFile, yylineno, yyvsp[0].fixed_val); ; break;} case 136: #line 890 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = new FloatExpr(currentFile, yylineno, yyvsp[0].float_literal_val); ; break;} case 137: #line 893 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.expr_val = new BooleanExpr(currentFile, yylineno, yyvsp[0].boolean_val); ; break;} case 138: #line 899 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.string_val = yyvsp[0].string_val; ; break;} case 139: #line 900 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.string_val = new char [strlen(yyvsp[-1].string_val) + strlen(yyvsp[0].string_val) + 1]; strcpy(yyval.string_val, yyvsp[-1].string_val); strcat(yyval.string_val, yyvsp[0].string_val); delete [] yyvsp[-1].string_val; delete [] yyvsp[0].string_val; ; break;} case 140: #line 910 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.wstring_val = yyvsp[0].wstring_val; ; break;} case 141: #line 911 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.wstring_val = new IDL_WChar [idl_wstrlen(yyvsp[-1].wstring_val) + idl_wstrlen(yyvsp[0].wstring_val) + 1]; idl_wstrcpy(yyval.wstring_val, yyvsp[-1].wstring_val); idl_wstrcat(yyval.wstring_val, yyvsp[0].wstring_val); delete [] yyvsp[-1].wstring_val; delete [] yyvsp[0].wstring_val; ; break;} case 142: #line 921 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.boolean_val = 1; ; break;} case 143: #line 922 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.boolean_val = 0; ; break;} case 144: #line 926 "../../../../../src/tool/omniidl/cxx/idl.yy" { IdlLongVal v = yyvsp[0].expr_val->evalAsLongV(); if (v.negative || v.u == 0) IdlError(currentFile, yylineno, "Size must be at least 1"); yyval.ulong_val = v.u; ; break;} case 145: #line 935 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[0].typedef_val; ; break;} case 146: #line 936 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[0].struct_val; ; break;} case 147: #line 937 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[0].union_val; ; break;} case 148: #line 938 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[0].enum_val; ; break;} case 149: #line 939 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = new Native(currentFile, yylineno, mainFile, yyvsp[0].id_val); ; break;} case 150: #line 942 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = yyvsp[0].decl_val; ; break;} case 151: #line 946 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.typedef_val = new Typedef(currentFile, yylineno, mainFile, yyvsp[-1].type_spec_val->type(), yyvsp[-1].type_spec_val->constr(), yyvsp[0].declarator_val); delete yyvsp[-1].type_spec_val; ; break;} case 152: #line 954 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_spec_val = new TypeSpec(yyvsp[0].type_val, 0); ; break;} case 153: #line 955 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_spec_val = new TypeSpec(yyvsp[0].type_val, 1); ; break;} case 154: #line 959 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 155: #line 960 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 156: #line 961 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = IdlType::scopedNameToType(currentFile, yylineno, yyvsp[0].scopedname_val); ; break;} case 157: #line 967 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 158: #line 968 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 159: #line 969 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 160: #line 970 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 161: #line 971 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 162: #line 972 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 163: #line 973 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 164: #line 974 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 165: #line 975 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 166: #line 979 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 167: #line 980 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 168: #line 981 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 169: #line 982 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 170: #line 986 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].struct_val->thisType(); ; break;} case 171: #line 987 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].union_val->thisType(); ; break;} case 172: #line 988 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].enum_val->thisType(); ; break;} case 173: #line 992 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.declarator_val = yyvsp[-1].declarator_val; ; break;} case 174: #line 993 "../../../../../src/tool/omniidl/cxx/idl.yy" { if (yyvsp[-4].declarator_val) { yyvsp[-4].declarator_val->append(yyvsp[-1].declarator_val); yyval.declarator_val = yyvsp[-4].declarator_val; } else yyval.declarator_val = yyvsp[-1].declarator_val; ; break;} case 175: #line 1000 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.declarator_val = yyvsp[0].declarator_val; ; break;} case 176: #line 1001 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.declarator_val = yyvsp[0].declarator_val; ; break;} case 177: #line 1005 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.declarator_val = new Declarator(currentFile, yylineno, mainFile, yyvsp[0].id_val, 0); ; break;} case 178: #line 1011 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.declarator_val = yyvsp[0].declarator_val; ; break;} case 179: #line 1015 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = BaseType::floatType; ; break;} case 180: #line 1016 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = BaseType::doubleType; ; break;} case 181: #line 1017 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = BaseType::longdoubleType; ; break;} case 182: #line 1021 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 183: #line 1022 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 184: #line 1026 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 185: #line 1027 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 186: #line 1028 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 187: #line 1032 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = BaseType::shortType; ; break;} case 188: #line 1036 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = BaseType::longType; ; break;} case 189: #line 1040 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = BaseType::longlongType; ; break;} case 190: #line 1044 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 191: #line 1045 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 192: #line 1046 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 193: #line 1050 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = BaseType::ushortType; ; break;} case 194: #line 1054 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = BaseType::ulongType; ; break;} case 195: #line 1058 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = BaseType::ulonglongType; ; break;} case 196: #line 1062 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = BaseType::charType; ; break;} case 197: #line 1066 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = BaseType::wcharType; ; break;} case 198: #line 1070 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = BaseType::booleanType; ; break;} case 199: #line 1074 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = BaseType::octetType; ; break;} case 200: #line 1078 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = BaseType::anyType; ; break;} case 201: #line 1082 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = DeclaredType::corbaObjectType; ; break;} case 202: #line 1086 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-5].struct_val->finishConstruction(yyvsp[-1].member_val); yyval.struct_val = yyvsp[-5].struct_val; ; break;} case 203: #line 1090 "../../../../../src/tool/omniidl/cxx/idl.yy" { IdlSyntaxError(currentFile, yylineno, "Syntax error in struct definition"); yyvsp[-1].struct_val->finishConstruction(0); yyval.struct_val = yyvsp[-1].struct_val; ; break;} case 204: #line 1099 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.struct_val = new Struct(currentFile, yylineno, mainFile, yyvsp[0].id_val); ; break;} case 205: #line 1105 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.member_val = yyvsp[-1].member_val; ; break;} case 206: #line 1106 "../../../../../src/tool/omniidl/cxx/idl.yy" { if (yyvsp[-2].member_val) { yyvsp[-2].member_val->append(yyvsp[-1].member_val); yyval.member_val = yyvsp[-2].member_val; } else yyval.member_val = yyvsp[-1].member_val; ; break;} case 207: #line 1113 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.member_val = new Member(currentFile, yylineno, mainFile, yyvsp[-2].type_spec_val->type(), yyvsp[-2].type_spec_val->constr(), yyvsp[-1].declarator_val); delete yyvsp[-2].type_spec_val; ; break;} case 208: #line 1118 "../../../../../src/tool/omniidl/cxx/idl.yy" { IdlSyntaxError(currentFile, yylineno, "Syntax error in member declaration"); yyval.member_val = 0; ; break;} case 209: #line 1128 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-12].union_val->finishConstruction(yyvsp[-7].type_spec_val->type(), yyvsp[-7].type_spec_val->constr(), yyvsp[-1].union_case_val); delete yyvsp[-7].type_spec_val; yyval.union_val = yyvsp[-12].union_val; ; break;} case 210: #line 1134 "../../../../../src/tool/omniidl/cxx/idl.yy" { IdlSyntaxError(currentFile, yylineno, "Syntax error in union declaration"); yyvsp[-1].union_val->finishConstruction(0, 0, 0); yyval.union_val = yyvsp[-1].union_val; ; break;} case 211: #line 1143 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.union_val = new Union(currentFile, yylineno, mainFile, yyvsp[0].id_val); ; break;} case 212: #line 1149 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_spec_val = new TypeSpec(yyvsp[0].type_val, 0); ; break;} case 213: #line 1150 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_spec_val = new TypeSpec(yyvsp[0].type_val, 0); ; break;} case 214: #line 1151 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_spec_val = new TypeSpec(yyvsp[0].type_val, 0); ; break;} case 215: #line 1152 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_spec_val = new TypeSpec(yyvsp[0].enum_val->thisType(), 1); ; break;} case 216: #line 1153 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_spec_val = new TypeSpec(IdlType::scopedNameToType(currentFile, yylineno, yyvsp[0].scopedname_val), 0); ; break;} case 217: #line 1160 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.union_case_val = yyvsp[0].union_case_val; ; break;} case 218: #line 1164 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.union_case_val = yyvsp[-1].union_case_val; ; break;} case 219: #line 1165 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-2].union_case_val->append(yyvsp[-1].union_case_val); yyval.union_case_val = yyvsp[-2].union_case_val; ; break;} case 220: #line 1172 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-1].union_case_val->finishConstruction(yyvsp[-2].case_label_val); yyval.union_case_val = yyvsp[-1].union_case_val; ; break;} case 221: #line 1179 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.case_label_val = yyvsp[0].case_label_val; ; break;} case 222: #line 1180 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-1].case_label_val->append(yyvsp[0].case_label_val); yyval.case_label_val = yyvsp[-1].case_label_val; ; break;} case 223: #line 1187 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.case_label_val = new CaseLabel(currentFile, yylineno, mainFile, yyvsp[-2].expr_val); ; break;} case 224: #line 1190 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.case_label_val = new CaseLabel(currentFile, yylineno, mainFile, 0); ; break;} case 225: #line 1196 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.union_case_val = new UnionCase(currentFile, yylineno, mainFile, yyvsp[-1].type_spec_val->type(), yyvsp[-1].type_spec_val->constr(), yyvsp[0].declarator_val); ; break;} case 226: #line 1203 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-5].enum_val->finishConstruction(yyvsp[-1].enumerator_val); yyval.enum_val = yyvsp[-5].enum_val; ; break;} case 227: #line 1207 "../../../../../src/tool/omniidl/cxx/idl.yy" { IdlSyntaxError(currentFile, yylineno, "Syntax error in enum definition"); yyvsp[-1].enum_val->finishConstruction(0); yyval.enum_val = yyvsp[-1].enum_val; ; break;} case 228: #line 1215 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.enum_val = new Enum(currentFile, yylineno, mainFile, yyvsp[0].id_val); ; break;} case 229: #line 1221 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.enumerator_val = yyvsp[-1].enumerator_val; ; break;} case 230: #line 1222 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-4].enumerator_val->append(yyvsp[-1].enumerator_val); yyval.enumerator_val = yyvsp[-4].enumerator_val; ; break;} case 231: #line 1229 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.enumerator_val = new Enumerator(currentFile, yylineno, mainFile, yyvsp[0].id_val); ; break;} case 232: #line 1235 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = new SequenceType(yyvsp[-3].type_val, yyvsp[-1].ulong_val); ; break;} case 233: #line 1238 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = new SequenceType(yyvsp[-1].type_val, 0); ; break;} case 234: #line 1244 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = new StringType(yyvsp[-1].ulong_val); ; break;} case 235: #line 1245 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = StringType::unboundedStringType; ; break;} case 236: #line 1251 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = new WStringType(yyvsp[-1].ulong_val); ; break;} case 237: #line 1252 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = WStringType::unboundedWStringType; ; break;} case 238: #line 1258 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.declarator_val = new Declarator(currentFile, yylineno, mainFile, yyvsp[-1].id_val, yyvsp[0].array_size_val); ; break;} case 239: #line 1264 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.array_size_val = yyvsp[0].array_size_val; ; break;} case 240: #line 1265 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-1].array_size_val->append(yyvsp[0].array_size_val); yyval.array_size_val = yyvsp[-1].array_size_val; ; break;} case 241: #line 1272 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.array_size_val = new ArraySize(yyvsp[-1].ulong_val); ; break;} case 242: #line 1276 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.attribute_val = new Attribute(currentFile, yylineno, mainFile, yyvsp[-3].boolean_val, yyvsp[-1].type_val, yyvsp[0].declarator_val); ; break;} case 243: #line 1282 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.boolean_val = 0; ; break;} case 244: #line 1283 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.boolean_val = 1; ; break;} case 245: #line 1287 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.declarator_val = yyvsp[-1].declarator_val; ; break;} case 246: #line 1288 "../../../../../src/tool/omniidl/cxx/idl.yy" { if (yyvsp[-4].declarator_val) { yyvsp[-4].declarator_val->append(yyvsp[-1].declarator_val); yyval.declarator_val = yyvsp[-4].declarator_val; } else yyval.declarator_val = yyvsp[-1].declarator_val; ; break;} case 247: #line 1295 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-5].exception_val->finishConstruction(yyvsp[-1].member_val); yyval.exception_val = yyvsp[-5].exception_val; ; break;} case 248: #line 1299 "../../../../../src/tool/omniidl/cxx/idl.yy" { IdlSyntaxError(currentFile, yylineno, "Syntax error in exception definition"); yyvsp[-1].exception_val->finishConstruction(0); yyval.exception_val = yyvsp[-1].exception_val; ; break;} case 249: #line 1308 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.exception_val = new Exception(currentFile, yylineno, mainFile, yyvsp[0].id_val); ; break;} case 250: #line 1314 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.member_val = 0; ; break;} case 251: #line 1315 "../../../../../src/tool/omniidl/cxx/idl.yy" { if (yyvsp[-1].member_val) { yyvsp[-1].member_val->append(yyvsp[0].member_val); yyval.member_val = yyvsp[-1].member_val; } else yyval.member_val = yyvsp[0].member_val; ; break;} case 252: #line 1322 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-2].operation_val->closeParens(); ; break;} case 253: #line 1324 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-6].operation_val->finishConstruction(yyvsp[-4].parameter_val, yyvsp[-1].raisesspec_val, yyvsp[0].contextspec_val); yyval.operation_val = yyvsp[-6].operation_val; ; break;} case 254: #line 1328 "../../../../../src/tool/omniidl/cxx/idl.yy" { IdlSyntaxError(currentFile, yylineno, "Syntax error in operation declaration"); yyvsp[-1].operation_val->closeParens(); yyvsp[-1].operation_val->finishConstruction(0, 0, 0); yyval.operation_val = yyvsp[-1].operation_val; ; break;} case 255: #line 1338 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.operation_val = new Operation(currentFile, yylineno, mainFile, yyvsp[-2].boolean_val, yyvsp[-1].type_val, yyvsp[0].id_val); ; break;} case 256: #line 1344 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.boolean_val = 0; ; break;} case 257: #line 1345 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.boolean_val = yyvsp[0].boolean_val; ; break;} case 258: #line 1349 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.boolean_val = 1; ; break;} case 259: #line 1353 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 260: #line 1354 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = BaseType::voidType; ; break;} case 261: #line 1358 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.parameter_val = yyvsp[-1].parameter_val; ; break;} case 262: #line 1359 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.parameter_val = 0; ; break;} case 263: #line 1360 "../../../../../src/tool/omniidl/cxx/idl.yy" { IdlSyntaxError(currentFile, yylineno, "Syntax error in operation parameters"); yyval.parameter_val = 0; ; break;} case 264: #line 1368 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.parameter_val = yyvsp[-1].parameter_val; ; break;} case 265: #line 1369 "../../../../../src/tool/omniidl/cxx/idl.yy" { if (yyvsp[-4].parameter_val) { yyvsp[-4].parameter_val->append(yyvsp[-1].parameter_val); yyval.parameter_val = yyvsp[-4].parameter_val; } else yyval.parameter_val = yyvsp[-1].parameter_val; ; break;} case 266: #line 1376 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.parameter_val = new Parameter(currentFile, yylineno, mainFile, yyvsp[-2].int_val, yyvsp[-1].type_val, yyvsp[0].id_val); ; break;} case 267: #line 1382 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.int_val = 0; ; break;} case 268: #line 1383 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.int_val = 1; ; break;} case 269: #line 1384 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.int_val = 2; ; break;} case 270: #line 1388 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.raisesspec_val = 0; ; break;} case 271: #line 1389 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.raisesspec_val = yyvsp[-1].raisesspec_val; ; break;} case 272: #line 1393 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.raisesspec_val = yyvsp[-1].raisesspec_val; ; break;} case 273: #line 1397 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.raisesspec_val = new RaisesSpec(yyvsp[-1].scopedname_val, currentFile, yylineno); ; break;} case 274: #line 1400 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-4].raisesspec_val->append(new RaisesSpec(yyvsp[-1].scopedname_val, currentFile, yylineno)); yyval.raisesspec_val = yyvsp[-4].raisesspec_val; ; break;} case 275: #line 1407 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.contextspec_val = 0; ; break;} case 276: #line 1408 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.contextspec_val = yyvsp[-1].contextspec_val; ; break;} case 277: #line 1412 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.contextspec_val = yyvsp[-1].contextspec_val; ; break;} case 278: #line 1416 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.contextspec_val = new ContextSpec(yyvsp[-1].string_val, currentFile, yylineno); ; break;} case 279: #line 1419 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyvsp[-4].contextspec_val->append(new ContextSpec(yyvsp[-1].string_val, currentFile, yylineno)); yyval.contextspec_val = yyvsp[-4].contextspec_val; ; break;} case 280: #line 1426 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 281: #line 1427 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 282: #line 1428 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = yyvsp[0].type_val; ; break;} case 283: #line 1429 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = IdlType::scopedNameToType(currentFile, yylineno, yyvsp[0].scopedname_val); ; break;} case 284: #line 1435 "../../../../../src/tool/omniidl/cxx/idl.yy" { IdlLongVal scalev = yyvsp[-1].expr_val->evalAsLongV(); if (scalev.negative) { IdlError(currentFile, yylineno, "Fixed point scale must be >= 0"); } IDL_ULong scale = scalev.u; if (yyvsp[-3].ulong_val > 31) { IdlError(currentFile, yylineno, "Fixed point values may not have more than 31 digits"); } if (scale > yyvsp[-3].ulong_val) { IdlError(currentFile, yylineno, "Fixed point scale factor is greater than " "the number of digits"); } yyval.type_val = new FixedType(yyvsp[-3].ulong_val, scale); ; break;} case 285: #line 1458 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = new FixedType(0, 0); ; break;} case 286: #line 1464 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.type_val = new DeclaredType(IdlType::tk_value, 0, 0); ; break;} case 287: #line 1468 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = new StructForward(currentFile, yylineno, mainFile, yyvsp[0].id_val); ; break;} case 288: #line 1471 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.decl_val = new UnionForward(currentFile, yylineno, mainFile, yyvsp[0].id_val); ; break;} case 297: #line 1494 "../../../../../src/tool/omniidl/cxx/idl.yy" { Prefix::setPrefix(idl_strdup(yyvsp[-1].string_val)); ; break;} case 298: #line 1497 "../../../../../src/tool/omniidl/cxx/idl.yy" { IdlSyntaxError(currentFile, yylineno, "Malformed #pragma prefix"); ; break;} case 299: #line 1503 "../../../../../src/tool/omniidl/cxx/idl.yy" { Decl* d = Decl::scopedNameToDecl(currentFile, yylineno, yyvsp[-2].scopedname_val); if (d) DeclRepoId::setRepoId(d, yyvsp[-1].string_val, currentFile, yylineno); ; break;} case 300: #line 1507 "../../../../../src/tool/omniidl/cxx/idl.yy" { IdlSyntaxError(currentFile, yylineno, "Malformed #pragma id"); ; break;} case 301: #line 1513 "../../../../../src/tool/omniidl/cxx/idl.yy" { Decl* d = Decl::scopedNameToDecl(currentFile, yylineno, yyvsp[-4].scopedname_val); if (d) DeclRepoId::setVersion(d, yyvsp[-3].int_literal_val, yyvsp[-1].int_literal_val, currentFile, yylineno); ; break;} case 302: #line 1517 "../../../../../src/tool/omniidl/cxx/idl.yy" { IdlSyntaxError(currentFile, yylineno, "Malformed #pragma version"); ; break;} case 303: #line 1523 "../../../../../src/tool/omniidl/cxx/idl.yy" { Pragma::add(yyvsp[-1].string_val, currentFile, yylineno-1); ; break;} case 304: #line 1529 "../../../../../src/tool/omniidl/cxx/idl.yy" { Pragma::add(yyvsp[-1].string_val, currentFile, yylineno); ; break;} case 305: #line 1535 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.string_val = yyvsp[0].string_val; ; break;} case 306: #line 1536 "../../../../../src/tool/omniidl/cxx/idl.yy" { yyval.string_val = new char [strlen(yyvsp[-1].string_val) + strlen(yyvsp[0].string_val) + 1]; strcpy(yyval.string_val, yyvsp[-1].string_val); strcat(yyval.string_val, yyvsp[0].string_val); delete [] yyvsp[-1].string_val; delete [] yyvsp[0].string_val; ; break;} } #line 705 "/usr/share/bison/bison.simple" yyvsp -= yylen; yyssp -= yylen; #if YYLSP_NEEDED yylsp -= yylen; #endif #if YYDEBUG if (yydebug) { short *yyssp1 = yyss - 1; YYFPRINTF (stderr, "state stack now"); while (yyssp1 != yyssp) YYFPRINTF (stderr, " %d", *++yyssp1); YYFPRINTF (stderr, "\n"); } #endif *++yyvsp = yyval; #if YYLSP_NEEDED *++yylsp = yyloc; #endif /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTBASE] + *yyssp; if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTBASE]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #ifdef YYERROR_VERBOSE yyn = yypact[yystate]; if (yyn > YYFLAG && yyn < YYLAST) { YYSIZE_T yysize = 0; char *yymsg; int yyx, yycount; yycount = 0; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ for (yyx = yyn < 0 ? -yyn : 0; yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) if (yycheck[yyx + yyn] == yyx) yysize += yystrlen (yytname[yyx]) + 15, yycount++; yysize += yystrlen ("parse error, unexpected ") + 1; yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); yymsg = (char *) YYSTACK_ALLOC (yysize); if (yymsg != 0) { char *yyp = yystpcpy (yymsg, "parse error, unexpected "); yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); if (yycount < 5) { yycount = 0; for (yyx = yyn < 0 ? -yyn : 0; yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) if (yycheck[yyx + yyn] == yyx) { const char *yyq = ! yycount ? ", expecting " : " or "; yyp = yystpcpy (yyp, yyq); yyp = yystpcpy (yyp, yytname[yyx]); yycount++; } } yyerror (yymsg); YYSTACK_FREE (yymsg); } else yyerror ("parse error; also virtual memory exhausted"); } else #endif /* defined (YYERROR_VERBOSE) */ yyerror ("parse error"); } goto yyerrlab1; /*--------------------------------------------------. | yyerrlab1 -- error raised explicitly by an action | `--------------------------------------------------*/ yyerrlab1: if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ /* return failure if at end of input */ if (yychar == YYEOF) YYABORT; YYDPRINTF ((stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1])); yychar = YYEMPTY; } /* Else will try to reuse lookahead token after shifting the error token. */ yyerrstatus = 3; /* Each real token shifted decrements this */ goto yyerrhandle; /*-------------------------------------------------------------------. | yyerrdefault -- current state does not do anything special for the | | error token. | `-------------------------------------------------------------------*/ yyerrdefault: #if 0 /* This is wrong; only states that explicitly want error tokens should shift them. */ /* If its default is to accept any token, ok. Otherwise pop it. */ yyn = yydefact[yystate]; if (yyn) goto yydefault; #endif /*---------------------------------------------------------------. | yyerrpop -- pop the current state because it cannot handle the | | error token | `---------------------------------------------------------------*/ yyerrpop: if (yyssp == yyss) YYABORT; yyvsp--; yystate = *--yyssp; #if YYLSP_NEEDED yylsp--; #endif #if YYDEBUG if (yydebug) { short *yyssp1 = yyss - 1; YYFPRINTF (stderr, "Error: state stack now"); while (yyssp1 != yyssp) YYFPRINTF (stderr, " %d", *++yyssp1); YYFPRINTF (stderr, "\n"); } #endif /*--------------. | yyerrhandle. | `--------------*/ yyerrhandle: yyn = yypact[yystate]; if (yyn == YYFLAG) goto yyerrdefault; yyn += YYTERROR; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) goto yyerrdefault; yyn = yytable[yyn]; if (yyn < 0) { if (yyn == YYFLAG) goto yyerrpop; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; YYDPRINTF ((stderr, "Shifting error token, ")); *++yyvsp = yylval; #if YYLSP_NEEDED *++yylsp = yylloc; #endif yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; /*---------------------------------------------. | yyoverflowab -- parser overflow comes here. | `---------------------------------------------*/ yyoverflowlab: yyerror ("parser stack overflow"); yyresult = 2; /* Fall through. */ yyreturn: #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif return yyresult; } #line 1545 "../../../../../src/tool/omniidl/cxx/idl.yy" synopsis-0.12/Synopsis/Parsers/IDL/Makefile.in0000664000076400007640000000354211104703261020601 0ustar stefanstefan# # Copyright (C) 2006 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # SHELL := /bin/sh srcdir := @srcdir@ builddir:= @builddir@ PYTHON := @PYTHON@ SYNOPSIS:= $(PYTHON) synopsis.py CXX := @CXX@ LDSHARED:= @LDSHARED@ LEX := @LEX@ YACC := @YACC@ -d MAKEDEP := $(CXX) -M IDLMODULE_VERSION := 0x2630# => CORBA 2.6, front-end 3.0 CPPFLAGS:= @CPPFLAGS@ -I . CPPFLAGS+= -I $(srcdir) CPPFLAGS+= -I @PYTHON_INCLUDE@ -DPYTHON_INCLUDE="" CPPFLAGS+= -DIDLMODULE_VERSION="\"$(IDLMODULE_VERSION)\"" CXXFLAGS:= @CXXFLAGS@ LDFLAGS := @LDFLAGS@ LIBS := @LIBS@ LIBRARY_EXT := @LIBEXT@ YYSRC := idl.yy LLSRC := idl.ll SRC := y.tab.cc lex.yy.cc idlerr.cc idlutil.cc idltype.cc \ idlrepoId.cc idlscope.cc idlexpr.cc idlast.cc idlvalidate.cc \ idldump.cc idlconfig.cc idlfixed.cc idlpython.cc #idlc.cc OBJ := $(patsubst %.cc, %.o, $(SRC)) DEP := $(patsubst %.cc, %.d, $(SRC)) TARGET := _omniidl$(LIBRARY_EXT) vpath %.yy $(srcdir) vpath %.ll $(srcdir) vpath %.hh $(srcdir) vpath %.cc $(srcdir) all: $(TARGET) $(TARGET): $(OBJ) $(LDSHARED) $(LDFLAGS) -o $@ $^ $(LIBS) clean: rm -f $(CTOOL_SO) rm -rf $(OBJ) $(DEP) y.tab.h y.tab.cc: $(YYSRC) @rm -f $@ $(YACC) $< mv -f y.tab.c y.tab.cc lex.yy.cc: $(LLSRC) y.tab.h $(LEX) -o$@ $< echo '#ifdef __VMS' >> $@ echo '// Some versions of DEC C++ for OpenVMS set the module name used by the' >> $@ echo '// librarian based on the last #line encountered.' >> $@ echo '#line' `cat $@ | wc -l` '"lex_yy.cc"' >> $@ echo '#endif' >> $@ %.o: %.cc $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< %.d: %.cc $(SHELL) -ec '$(MAKEDEP) $(CPPFLAGS) $< | sed "s/$*\\.o[ :]*/$*\\.d $*\\.o : /g" > $@' Makefile: $(srcdir)/Makefile.in ./config.status --file Makefile ifeq (,$(filter $(MAKECMDGOALS), clean)) -include $(DEP) endif synopsis-0.12/Synopsis/Parsers/IDL/configure.ac0000664000076400007640000000271311104703261021021 0ustar stefanstefandnl dnl Copyright (C) 2006 Stefan Seefeld dnl All rights reserved. dnl Licensed to the public under the terms of the GNU LGPL (>= 2), dnl see the file COPYING for details. dnl dnl ------------------------------------------------------------------ dnl Autoconf initialization dnl ------------------------------------------------------------------ AC_PREREQ(2.56) AC_REVISION($Revision: 1.4 $) AC_INIT(Synopsis, 1.0, synopsis-devel@fresco.org) AC_CONFIG_HEADERS(acconfig.h) AC_ARG_WITH(syn-cxx, [ --with-syn-cxx=PATH specify the Synopsis C++ library prefix], SYN_CXX="$with_syn_cxx", SYN_CXX="/usr/local" ) AC_PROG_CPP AC_PROG_CC AC_PROG_CXX AC_PROG_LEX if test $LEX != flex then AC_MSG_ERROR(This package needs flex to build.) fi AC_PROG_YACC # Unfortunately, AC_PROG_YACC sets $YACC to 'yacc' if it couldn't # find anything (yacc itself doesn't appear to be checked for.) # Thus we take this as an indication that the test failed. if test "$YACC" = yacc then AC_MSG_ERROR(This package needs bison to build.) fi dnl ** Integer representation AC_C_BIGENDIAN AC_CHECK_SIZEOF(char, 1) AC_CHECK_SIZEOF(unsigned char, 1) AC_CHECK_SIZEOF(bool, 1) AC_CHECK_SIZEOF(short, 2) AC_CHECK_SIZEOF(int, 4) AC_CHECK_SIZEOF(long, 4) AC_CHECK_SIZEOF(long long, 8) AC_CHECK_SIZEOF(float, 4) AC_CHECK_SIZEOF(double, 8) AC_CHECK_SIZEOF(long double, 16) AC_CHECK_SIZEOF(wchar_t, 4) AC_CHECK_SIZEOF(void*, 4) AC_CHECK_FUNCS(strcasecmp) AC_PYTHON_EXT AC_CONFIG_FILES([Makefile]) AC_OUTPUT synopsis-0.12/Synopsis/Parsers/IDL/idlerr.h0000664000076400007640000000437011104703261020166 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlerr.h Created on: 1999/10/11 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // IDL compiler error handling // $Id: idlerr.h,v 1.7.2.1 2003/03/23 21:01:46 dgrisby Exp $ // $Log: idlerr.h,v $ // Revision 1.7.2.1 2003/03/23 21:01:46 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.4.2.2 2000/10/27 16:31:09 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.4.2.1 2000/07/17 10:36:03 sll // Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0. // // Revision 1.5 2000/07/13 15:25:53 dpg1 // Merge from omni3_develop for 3.0 release. // // Revision 1.2 1999/10/29 15:43:44 dpg1 // Error counts now reset when Report...() is called. // // Revision 1.1 1999/10/27 14:05:57 dpg1 // *** empty log message *** // #ifndef _idlerr_h_ #define _idlerr_h_ #include extern int errorCount; extern int warningCount; // Error report and continuation void IdlError(const char* file, int line, const char* fmt ...); void IdlErrorCont(const char* file, int line, const char* fmt ...); void IdlSyntaxError(const char* file, int line, const char* mesg); // Warning report and continuation void IdlWarning(const char* file, int line, const char* fmt ...); void IdlWarningCont(const char* file, int line, const char* fmt ...); IDL_Boolean IdlReportErrors(); #endif // _idlerr_h_ synopsis-0.12/Synopsis/Parsers/IDL/idlconfig.cc0000664000076400007640000000417711104703261021006 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlconfig.cc Created on: 2000/03/06 // Author : Duncan Grisby (dpg1) // // Copyright (C) 2000 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Global configuration for omniidl // $Id: idlconfig.cc,v 1.5.2.1 2003/03/23 21:01:47 dgrisby Exp $ // $Log: idlconfig.cc,v $ // Revision 1.5.2.1 2003/03/23 21:01:47 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.2.2.3 2000/12/05 17:45:19 dpg1 // omniidl case sensitivity updates from omni3_develop. // // Revision 1.2.2.2 2000/10/27 16:31:08 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.2.2.1 2000/07/17 10:36:02 sll // Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0. // // Revision 1.3 2000/07/13 15:25:53 dpg1 // Merge from omni3_develop for 3.0 release. // // Revision 1.1.2.2 2000/06/05 18:13:27 dpg1 // Comments can be attached to subsequent declarations (with -K). Better // idea of most recent decl in operation declarations // // Revision 1.1.2.1 2000/03/06 15:03:48 dpg1 // Minor bug fixes to omniidl. New -nf and -k flags. // #include IDL_Boolean Config::quiet = 0; IDL_Boolean Config::forwardWarning = 1; IDL_Boolean Config::keepComments = 0; IDL_Boolean Config::commentsFirst = 0; IDL_Boolean Config::caseSensitive = 0; synopsis-0.12/Synopsis/Parsers/IDL/idlexpr.h0000664000076400007640000002705611104703261020362 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlexpr.h Created on: 1999/10/18 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Expression tree and evaluator // $Id: idlexpr.h,v 1.7.2.1 2003/03/23 21:01:45 dgrisby Exp $ // $Log: idlexpr.h,v $ // Revision 1.7.2.1 2003/03/23 21:01:45 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.4.2.4 2001/08/29 11:54:20 dpg1 // Clean up const handling in IDL compiler. // // Revision 1.4.2.3 2001/03/13 10:32:12 dpg1 // Fixed point support. // // Revision 1.4.2.2 2000/10/27 16:31:09 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.4.2.1 2000/07/17 10:36:03 sll // Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0. // // Revision 1.5 2000/07/13 15:25:53 dpg1 // Merge from omni3_develop for 3.0 release. // // Revision 1.2 1999/11/02 17:07:26 dpg1 // Changes to compile on Solaris. // // Revision 1.1 1999/10/27 14:05:56 dpg1 // *** empty log message *** // #ifndef _idlexpr_h_ #define _idlexpr_h_ #include #include #include class Enumerator; class Enum; class Const; struct IdlLongVal { IdlLongVal(IDL_ULong a) : negative(0), u(a) {} IdlLongVal(IDL_Long a) : negative(0), s(a) { if (a<0) negative=1; } IDL_Boolean negative; union { IDL_ULong u; IDL_Long s; }; }; #ifdef HAS_LongLong struct IdlLongLongVal { IdlLongLongVal(IDL_ULongLong a) : negative(0), u(a) {} IdlLongLongVal(IDL_LongLong a) : negative(0), s(a) { if (a<0) negative=1; } IDL_Boolean negative; union { IDL_ULongLong u; IDL_LongLong s; }; }; #endif class IdlExpr { public: IdlExpr(const char* file, int line) : file_(idl_strdup(file)), line_(line) {} virtual ~IdlExpr() { delete [] file_; } // // Virtual functions overridded by derived expression types // virtual IdlLongVal evalAsLongV(); #ifdef HAS_LongLong virtual IdlLongLongVal evalAsLongLongV(); #endif virtual IDL_Float evalAsFloat(); virtual IDL_Double evalAsDouble(); virtual IDL_Boolean evalAsBoolean(); virtual IDL_Char evalAsChar(); virtual const char* evalAsString(); virtual Enumerator* evalAsEnumerator(const Enum* target); #ifdef HAS_LongDouble virtual IDL_LongDouble evalAsLongDouble(); #endif virtual IDL_WChar evalAsWChar(); virtual const IDL_WChar* evalAsWString(); virtual IDL_Fixed* evalAsFixed(); // // Functions to convert an integer represented as a signed/unsigned // union to an IDL integer type // IDL_Short evalAsShort(); IDL_Long evalAsLong(); IDL_UShort evalAsUShort(); IDL_ULong evalAsULong(); IDL_Octet evalAsOctet(); #ifdef HAS_LongLong IDL_LongLong evalAsLongLong(); IDL_ULongLong evalAsULongLong(); #endif inline const char* file() { return file_; } inline int line() { return line_; } virtual const char* errText() = 0; static IdlExpr* scopedNameToExpr(const char* file, int line, ScopedName* sn); private: char* file_; int line_; }; // Dummy expression class used as a place-holder after an error class DummyExpr : public IdlExpr { public: DummyExpr(const char* file, int line) : IdlExpr(file, line) {} virtual ~DummyExpr() {} IdlLongVal evalAsLongV() { return IdlLongVal (IDL_ULong(1)); } #ifdef HAS_LongLong IdlLongLongVal evalAsLongLongV() { return IdlLongLongVal(IDL_ULongLong(1));} #endif IDL_Float evalAsFloat() { return 1.0; } IDL_Double evalAsDouble() { return 1.0; } IDL_Boolean evalAsBoolean() { return 0; } IDL_Char evalAsChar() { return '!'; } const char* evalAsString() { return "!"; } Enumerator* evalAsEnumerator(const Enum* target) { return 0; } #ifdef HAS_LongDouble IDL_LongDouble evalAsLongDouble() { return 1.0; } #endif IDL_WChar evalAsWChar() { return '!'; } const IDL_WChar* evalAsWString(); IDL_Fixed* evalAsFixed() { return new IDL_Fixed("1"); } const char* errText() { return "dummy"; } }; // Literals class IntegerExpr : public IdlExpr { public: IntegerExpr(const char* file, int line, IdlIntLiteral v) : IdlExpr(file, line), value_(v) { } ~IntegerExpr() {} IdlLongVal evalAsLongV(); #ifdef HAS_LongLong IdlLongLongVal evalAsLongLongV(); #endif const char* errText() { return "integer literal"; } private: IdlIntLiteral value_; }; class StringExpr : public IdlExpr { public: StringExpr(const char* file, int line, const char* v) : IdlExpr(file, line), value_(idl_strdup(v)) { } ~StringExpr() { delete [] value_; } const char* evalAsString(); const char* errText() { return "string literal"; } private: char* value_; }; class WStringExpr : public IdlExpr { public: WStringExpr(const char* file, int line, const IDL_WChar* v) : IdlExpr(file, line), value_(idl_wstrdup(v)) {} ~WStringExpr() { delete [] value_; } const IDL_WChar* evalAsWString(); const char* errText() { return "wide string literal"; } private: IDL_WChar* value_; }; class CharExpr : public IdlExpr { public: CharExpr(const char* file, int line, IDL_Char v) : IdlExpr(file, line), value_(v) { } ~CharExpr() {} IDL_Char evalAsChar(); const char* errText() { return "character literal"; } private: IDL_Char value_; }; class WCharExpr : public IdlExpr { public: WCharExpr(const char* file, int line, IDL_WChar v) : IdlExpr(file, line), value_(v) {} ~WCharExpr() {} IDL_WChar evalAsWChar(); const char* errText() { return "wide character literal"; } private: IDL_WChar value_; }; class FixedExpr : public IdlExpr { public: FixedExpr(const char* file, int line, IDL_Fixed* v) : IdlExpr(file, line), value_(v) {} ~FixedExpr() {} IDL_Fixed* evalAsFixed(); const char* errText() { return "fixed point literal"; } private: IDL_Fixed* value_; }; class FloatExpr : public IdlExpr { public: FloatExpr(const char* file, int line, IdlFloatLiteral v) : IdlExpr(file, line), value_(v) { } ~FloatExpr() {} IDL_Float evalAsFloat(); IDL_Double evalAsDouble(); #ifdef HAS_LongDouble IDL_LongDouble evalAsLongDouble(); #endif const char* errText() { return "floating point literal"; } private: IdlFloatLiteral value_; }; class BooleanExpr : public IdlExpr { public: BooleanExpr(const char* file, int line, IDL_Boolean v) : IdlExpr(file, line), value_(v) { } ~BooleanExpr() {} IDL_Boolean evalAsBoolean(); const char* errText() { return "boolean literal"; } private: IDL_Boolean value_; }; // Enumerator referred to by scoped name class EnumExpr : public IdlExpr { public: EnumExpr(const char* file, int line, Enumerator* e, ScopedName* sn) : IdlExpr(file, line), value_(e), scopedName_(sn) {} ~EnumExpr() {} Enumerator* evalAsEnumerator(const Enum* target); const char* errText() { return "enumerator"; } private: Enumerator* value_; ScopedName* scopedName_; }; // Constant referred to by scoped name class ConstExpr : public IdlExpr { public: ConstExpr(const char* file, int line, Const* c, ScopedName* sn) : IdlExpr(file, line), c_(c), scopedName_(sn) {} ~ConstExpr() {} IdlLongVal evalAsLongV(); #ifdef HAS_LongLong IdlLongLongVal evalAsLongLongV(); #endif IDL_Float evalAsFloat(); IDL_Double evalAsDouble(); IDL_Boolean evalAsBoolean(); IDL_Char evalAsChar(); IDL_Octet evalAsOctet(); const char* evalAsString(); Enumerator* evalAsEnumerator(const Enum* target); #ifdef HAS_LongDouble IDL_LongDouble evalAsLongDouble(); #endif IDL_WChar evalAsWChar(); const IDL_WChar* evalAsWString(); IDL_Fixed* evalAsFixed(); const char* errText() { return "constant"; } private: Const* c_; ScopedName* scopedName_; }; // Expressions #ifdef HAS_LongLong #define EXPR_INT_CONVERSION_FUNCTIONS \ IdlLongVal evalAsLongV(); \ IdlLongLongVal evalAsLongLongV(); #else #define EXPR_INT_CONVERSION_FUNCTIONS \ IdlLongVal evalAsLongV(); #endif #ifdef HAS_LongDouble #define EXPR_FLOAT_CONVERSION_FUNCTIONS \ IDL_Float evalAsFloat(); \ IDL_Double evalAsDouble(); \ IDL_LongDouble evalAsLongDouble(); #else #define EXPR_FLOAT_CONVERSION_FUNCTIONS \ IDL_Float evalAsFloat(); \ IDL_Double evalAsDouble(); #endif #define EXPR_FIXED_CONVERSION_FUNCTIONS \ IDL_Fixed* evalAsFixed(); #define EXPR_CONVERSION_FUNCTIONS \ EXPR_INT_CONVERSION_FUNCTIONS \ EXPR_FLOAT_CONVERSION_FUNCTIONS \ EXPR_FIXED_CONVERSION_FUNCTIONS #define EXPR_INT_BINARY_CLASS(cls, str) \ class cls : public IdlExpr { \ public: \ cls(const char* file, int line, IdlExpr* a, IdlExpr* b) \ : IdlExpr(file, line), a_(a), b_(b) { } \ ~cls() { delete a_; delete b_; } \ EXPR_INT_CONVERSION_FUNCTIONS \ const char* errText() { return "result of " str " operation"; } \ private: \ IdlExpr* a_; \ IdlExpr* b_; \ }; #define EXPR_BINARY_CLASS(cls, str) \ class cls : public IdlExpr { \ public: \ cls(const char* file, int line, IdlExpr* a, IdlExpr* b) \ : IdlExpr(file, line), a_(a), b_(b) { } \ ~cls() { delete a_; delete b_; } \ EXPR_CONVERSION_FUNCTIONS \ const char* errText() { return "result of " str " operation"; } \ private: \ IdlExpr* a_; \ IdlExpr* b_; \ }; EXPR_INT_BINARY_CLASS(OrExpr, "or") EXPR_INT_BINARY_CLASS(XorExpr, "exclusive or") EXPR_INT_BINARY_CLASS(AndExpr, "and") EXPR_INT_BINARY_CLASS(RShiftExpr, "right shift") EXPR_INT_BINARY_CLASS(LShiftExpr, "left shift") EXPR_INT_BINARY_CLASS(ModExpr, "remainder") EXPR_BINARY_CLASS(AddExpr, "add") EXPR_BINARY_CLASS(SubExpr, "subtract") EXPR_BINARY_CLASS(MultExpr, "multiply") EXPR_BINARY_CLASS(DivExpr, "divide") class InvertExpr : public IdlExpr { public: InvertExpr(const char* file, int line, IdlExpr* e) : IdlExpr(file, line), e_(e) { } ~InvertExpr() { delete e_; } EXPR_INT_CONVERSION_FUNCTIONS const char* errText() { return "result of unary invert operator"; } private: IdlExpr* e_; }; class MinusExpr : public IdlExpr { public: MinusExpr(const char* file, int line, IdlExpr* e) : IdlExpr(file, line), e_(e) { } ~MinusExpr() { delete e_; } EXPR_CONVERSION_FUNCTIONS const char* errText() { return "result of unary negate operator"; } private: IdlExpr* e_; }; class PlusExpr : public IdlExpr { public: PlusExpr(const char* file, int line, IdlExpr* e) : IdlExpr(file, line), e_(e) { } ~PlusExpr() { delete e_; } EXPR_CONVERSION_FUNCTIONS const char* errText() { return "result of unary plus operator"; } private: IdlExpr* e_; }; #endif // _idlexpr_h_ synopsis-0.12/Synopsis/Parsers/IDL/idlpython.cc0000664000076400007640000013140011104703261021050 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlpython.cc Created on: 1999/10/27 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Python interface to front-end // $Id: idlpython.cc,v 1.22.2.3 2005/01/06 23:11:14 dgrisby Exp $ // $Log: idlpython.cc,v $ // Revision 1.22.2.3 2005/01/06 23:11:14 dgrisby // Big merge from omni4_0_develop. // // Revision 1.22.2.2 2003/09/04 14:00:29 dgrisby // ValueType IDL updates. // // Revision 1.22.2.1 2003/03/23 21:01:45 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.17.2.15 2003/01/16 11:08:27 dgrisby // Patches to support Digital Mars C++. Thanks Christof Meerwald. // // Revision 1.17.2.14 2002/10/28 11:56:50 dgrisby // Work around VC++ 7 problem with FILE* change. // // Revision 1.17.2.13 2002/09/21 21:07:48 dgrisby // Support ValueBase in omniidl. (No use to omniORB yet...) // // Revision 1.17.2.12 2001/11/14 17:13:43 dpg1 // Long double support. // // Revision 1.17.2.11 2001/10/17 16:48:33 dpg1 // Minor error message tweaks // // Revision 1.17.2.10 2001/08/29 11:55:23 dpg1 // Enumerator nodes record their value. // // Revision 1.17.2.9 2001/08/15 10:31:23 dpg1 // Minor tweaks and fixes. // // Revision 1.17.2.8 2001/03/13 10:32:12 dpg1 // Fixed point support. // // Revision 1.17.2.7 2001/01/08 12:35:26 dpg1 // Incorrect exception handling when omniidl is an executable. // // Revision 1.17.2.6 2000/12/05 17:45:19 dpg1 // omniidl case sensitivity updates from omni3_develop. // // Revision 1.17.2.5 2000/11/01 15:57:03 dpg1 // More updates for 2.4. // // Revision 1.17.2.4 2000/11/01 12:45:56 dpg1 // Update to CORBA 2.4 specification. // // Revision 1.17.2.3 2000/10/27 16:31:09 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.17.2.2 2000/10/10 10:18:51 dpg1 // Update omniidl front-end from omni3_develop. // // Revision 1.15.2.15 2000/09/06 11:20:50 dpg1 // Support for Python 1.6 and 2.0b1. // // Revision 1.15.2.14 2000/08/30 18:12:46 dpg1 // Register operation declarations so they can be found with findDecl(). // // Revision 1.15.2.13 2000/08/29 15:20:28 dpg1 // New relativeScope() function. New -i flag to enter interactive loop // after parsing // // Revision 1.15.2.12 2000/08/29 10:20:26 dpg1 // Operations and attributes now have repository ids. // // Revision 1.15.2.11 2000/08/14 16:07:52 dpg1 // Error message now says "Could not open..." rather than "Could not // find..." when Python imports fail. // // Revision 1.15.2.10 2000/08/07 15:34:36 dpg1 // Partial back-port of long long from omni3_1_develop. // // Revision 1.15.2.9 2000/06/27 16:23:25 sll // Merged OpenVMS port. // // Revision 1.15.2.8 2000/06/20 13:55:58 dpg1 // omniidl now keeps the C++ tree until after the back-ends have run. // This means that back-ends can be C++ extension modules. // // Revision 1.15.2.7 2000/06/08 14:36:19 dpg1 // Comments and pragmas are now objects rather than plain strings, so // they can have file,line associated with them. // // Revision 1.15.2.6 2000/06/06 15:21:47 dpg1 // Comments and pragmas attached to attribute declarators are now // attached to the Python Attribute object. // // Revision 1.15.2.5 2000/06/05 18:13:27 dpg1 // Comments can be attached to subsequent declarations (with -K). Better // idea of most recent decl in operation declarations // // Revision 1.15.2.4 2000/03/10 10:04:40 dpg1 // Windows file/directory names are case insensitive. // // Revision 1.15.2.3 2000/03/06 15:03:48 dpg1 // Minor bug fixes to omniidl. New -nf and -k flags. // // Revision 1.15.2.2 2000/02/17 10:00:38 dpg1 // More robust path discovery. // // Revision 1.15.2.1 2000/02/16 16:23:52 dpg1 // Support things for Python neophytes. // // Revision 1.15 2000/02/04 12:17:08 dpg1 // Support for VMS. // // Revision 1.14 2000/01/18 17:15:05 dpg1 // Changes for "small" distribution. // // Revision 1.13 1999/12/15 12:17:18 dpg1 // Changes to compile with SunPro CC 5.0. // // Revision 1.12 1999/12/01 11:35:22 dpg1 // Include path for Python.h changed to be consistent with omnipy module. // // Revision 1.11 1999/11/17 14:34:42 dpg1 // More multi-platform support (NT and AIX). // // Revision 1.10 1999/11/11 15:55:19 dpg1 // Python back-end interface now supports valuetype declarations. // Back-ends still don't support them, though. // // Revision 1.9 1999/11/08 11:43:34 dpg1 // Changes for NT support. // // Revision 1.8 1999/11/04 17:16:55 dpg1 // Changes for NT. // // Revision 1.7 1999/11/04 11:46:19 dpg1 // Now uses our own version of the GNU C preprocessor. // // Revision 1.6 1999/11/02 17:07:26 dpg1 // Changes to compile on Solaris. // // Revision 1.5 1999/11/02 10:01:47 dpg1 // Minor fixes. // // Revision 1.4 1999/11/01 20:19:56 dpg1 // Support for union switch types declared inside the switch statement. // // Revision 1.3 1999/11/01 10:05:27 dpg1 // New file attribute to AST. // Fix stupid bug in module initialisation. // // Revision 1.2 1999/10/29 18:19:19 dpg1 // Added dump() function // // Revision 1.1 1999/10/29 15:44:45 dpg1 // First revision. // #if defined(__VMS) # include #else # include PYTHON_INCLUDE #endif #include #include #include #include #include #include #include #include // PyLongFromLongLong is broken in Python 1.5.2. Workaround here: #ifdef HAS_LongLong # if !defined(PY_VERSION_HEX) || (PY_VERSION_HEX < 0x01050200) # error "omniidl requires Python 1.5.2 or higher" # elif (PY_VERSION_HEX < 0x02000000) // Don't know when it was fixed -- certainly in 2.0.0 static inline PyObject* MyPyLong_FromLongLong(IDL_LongLong ll) { if (ll >= 0) // Positive numbers work OK return PyLong_FromLongLong(ll); else { IDL_ULongLong ull = (~ll) + 1; // Hope integers are 2's complement... PyObject* p = PyLong_FromUnsignedLongLong(ull); PyObject* n = PyNumber_Negative(p); Py_DECREF(p); return n; } } # else # define MyPyLong_FromLongLong(ll) PyLong_FromLongLong(ll) # endif #endif #define ASSERT_RESULT if (!result_) PyErr_Print(); assert(result_) #define ASSERT_PYOBJ(pyo) if (!pyo) PyErr_Print(); assert(pyo) class PythonVisitor : public AstVisitor, public TypeVisitor { public: PythonVisitor(); virtual ~PythonVisitor(); void visitAST (AST*); void visitModule (Module*); void visitInterface (Interface*); void visitForward (Forward*); void visitConst (Const*); void visitDeclarator (Declarator*); void visitTypedef (Typedef*); void visitMember (Member*); void visitStruct (Struct*); void visitStructForward (StructForward*); void visitException (Exception*); void visitCaseLabel (CaseLabel*); void visitUnionCase (UnionCase*); void visitUnion (Union*); void visitUnionForward (UnionForward*); void visitEnumerator (Enumerator*); void visitEnum (Enum*); void visitAttribute (Attribute*); void visitParameter (Parameter*); void visitOperation (Operation*); void visitNative (Native*); void visitStateMember (StateMember*); void visitFactory (Factory*); void visitValueForward (ValueForward*); void visitValueBox (ValueBox*); void visitValueAbs (ValueAbs*); void visitValue (Value*); void visitBaseType (BaseType*); void visitStringType (StringType*); void visitWStringType (WStringType*); void visitSequenceType(SequenceType*); void visitFixedType (FixedType*); void visitDeclaredType(DeclaredType*); PyObject* result() { return result_; } static PyObject* scopedNameToList(const ScopedName* sn); static PyObject* wstringToList(const IDL_WChar* ws); private: PyObject* pragmasToList(const Pragma* ps); PyObject* commentsToList(const Comment* cs); void registerPyDecl(const ScopedName* sn, PyObject* pydecl); PyObject* findPyDecl(const ScopedName* sn); PyObject* idlast_; PyObject* idltype_; PyObject* result_; // Current working value }; PythonVisitor:: PythonVisitor() { idlast_ = PyImport_ImportModule((char*)"idlast"); idltype_ = PyImport_ImportModule((char*)"idltype"); ASSERT_PYOBJ(idlast_); ASSERT_PYOBJ(idltype_); } PythonVisitor:: ~PythonVisitor() { Py_DECREF(idlast_); Py_DECREF(idltype_); } PyObject* PythonVisitor:: scopedNameToList(const ScopedName* sn) { ScopedName::Fragment* f; int i; for (i=0, f = sn->scopeList(); f; f = f->next(), ++i); PyObject* pylist = PyList_New(i); for (i=0, f = sn->scopeList(); f; f = f->next(), ++i) PyList_SetItem(pylist, i, PyString_FromString(f->identifier())); return pylist; } PyObject* PythonVisitor:: pragmasToList(const Pragma* ps) { const Pragma* p; int i; for (i=0, p = ps; p; p = p->next(), ++i); PyObject* pylist = PyList_New(i); PyObject* pypragma; for (i=0, p = ps; p; p = p->next(), ++i) { pypragma = PyObject_CallMethod(idlast_, (char*)"Pragma", (char*)"ssi", p->pragmaText(), p->file(), p->line()); ASSERT_PYOBJ(pypragma); PyList_SetItem(pylist, i, pypragma); } return pylist; } PyObject* PythonVisitor:: commentsToList(const Comment* cs) { const Comment* c; int i; for (i=0, c = cs; c; c = c->next(), ++i); PyObject* pylist = PyList_New(i); PyObject* pycomment; for (i=0, c = cs; c; c = c->next(), ++i) { pycomment = PyObject_CallMethod(idlast_, (char*)"Comment", (char*)"ssi", c->commentText(), c->file(), c->line()); ASSERT_PYOBJ(pycomment); PyList_SetItem(pylist, i, pycomment); } return pylist; } void PythonVisitor:: registerPyDecl(const ScopedName* sn, PyObject* pydecl) { PyObject* pysn = scopedNameToList(sn); PyObject* r = PyObject_CallMethod(idlast_, (char*)"registerDecl", (char*)"NO", pysn, pydecl); ASSERT_PYOBJ(r); Py_DECREF(r); } PyObject* PythonVisitor:: findPyDecl(const ScopedName* sn) { PyObject* pysn = scopedNameToList(sn); PyObject* pydecl = PyObject_CallMethod(idlast_, (char*)"findDecl", (char*)"N", pysn); ASSERT_PYOBJ(pydecl); return pydecl; } PyObject* PythonVisitor:: wstringToList(const IDL_WChar* ws) { int i; const IDL_WChar* wc; for (i=0, wc=ws; *wc; ++wc, ++i); PyObject* pyl = PyList_New(i); for (i=0, wc=ws; *wc; ++wc, ++i) PyList_SetItem(pyl, i, PyInt_FromLong(*wc)); return pyl; } // // AST visit functions // void PythonVisitor:: visitAST(AST* a) { Decl* d; int i; for (i=0, d = a->declarations(); d; d = d->next(), ++i); PyObject* pydecls = PyList_New(i); for (i=0, d = a->declarations(); d; d = d->next(), ++i) { d->accept(*this); PyList_SetItem(pydecls, i, result_); } result_ = PyObject_CallMethod(idlast_, (char*)"AST", (char*)"sNNN", a->file(), pydecls, pragmasToList(a->pragmas()), commentsToList(a->comments())); ASSERT_RESULT; } void PythonVisitor:: visitModule(Module* m) { Decl* d; int i; for (i=0, d = m->definitions(); d; d = d->next(), ++i); PyObject* pydecls = PyList_New(i); for (i=0, d = m->definitions(); d; d = d->next(), ++i) { d->accept(*this); PyList_SetItem(pydecls, i, result_); } result_ = PyObject_CallMethod(idlast_, (char*)"Module", (char*)"siiNNsNsN", m->file(), m->line(), (int)m->mainFile(), pragmasToList(m->pragmas()), commentsToList(m->comments()), m->identifier(), scopedNameToList(m->scopedName()), m->repoId(), pydecls); ASSERT_RESULT; registerPyDecl(m->scopedName(), result_); } void PythonVisitor:: visitInterface(Interface* i) { int l; PyObject* pyobj; Decl* d; // Inherited interfaces InheritSpec* inh; for (l=0, inh = i->inherits(); inh; inh = inh->next(), ++l); PyObject* pyinherits = PyList_New(l); for (l=0, inh = i->inherits(); inh; inh = inh->next(), ++l) { d = inh->decl(); if (d->kind() == Decl::D_INTERFACE) pyobj = findPyDecl(((Interface*)d)->scopedName()); else if (d->kind() == Decl::D_DECLARATOR) pyobj = findPyDecl(((Declarator*)d)->scopedName()); else assert(0); PyList_SetItem(pyinherits, l, pyobj); } PyObject* pyintf = PyObject_CallMethod(idlast_, (char*)"Interface", (char*)"siiNNsNsiiN", i->file(), i->line(), (int)i->mainFile(), pragmasToList(i->pragmas()), commentsToList(i->comments()), i->identifier(), scopedNameToList(i->scopedName()), i->repoId(), (int)i->abstract(), (int)i->local(), pyinherits); ASSERT_PYOBJ(pyintf); registerPyDecl(i->scopedName(), pyintf); // Contents for (l=0, d = i->contents(); d; d = d->next(), ++l); PyObject* pycontents = PyList_New(l); for (l=0, d = i->contents(); d; d = d->next(), ++l) { d->accept(*this); PyList_SetItem(pycontents, l, result_); } PyObject* r = PyObject_CallMethod(pyintf, (char*)"_setContents", (char*)"N", pycontents); ASSERT_PYOBJ(r); Py_DECREF(r); result_ = pyintf; } void PythonVisitor:: visitForward(Forward* f) { result_ = PyObject_CallMethod(idlast_, (char*)"Forward", (char*)"siiNNsNsii", f->file(), f->line(), (int)f->mainFile(), pragmasToList(f->pragmas()), commentsToList(f->comments()), f->identifier(), scopedNameToList(f->scopedName()), f->repoId(), (int)f->abstract(), (int)f->local()); ASSERT_RESULT; registerPyDecl(f->scopedName(), result_); } void PythonVisitor:: visitConst(Const* c) { c->constType()->accept(*this); PyObject* pytype = result_; PyObject* pyv; switch(c->constKind()) { case IdlType::tk_short: pyv = PyInt_FromLong(c->constAsShort()); break; case IdlType::tk_long: pyv = PyInt_FromLong(c->constAsLong()); break; case IdlType::tk_ushort: pyv = PyInt_FromLong(c->constAsUShort()); break; case IdlType::tk_ulong: pyv = PyLong_FromUnsignedLong(c->constAsULong()); break; case IdlType::tk_float: pyv = PyFloat_FromDouble(c->constAsFloat()); break; case IdlType::tk_double: pyv = PyFloat_FromDouble(c->constAsDouble()); break; case IdlType::tk_boolean: pyv = PyInt_FromLong(c->constAsBoolean()); break; case IdlType::tk_char: pyv = Py_BuildValue((char*)"c", c->constAsChar()); break; case IdlType::tk_octet: pyv = PyInt_FromLong(c->constAsOctet()); break; case IdlType::tk_string: pyv = PyString_FromString(c->constAsString()); break; #ifdef HAS_LongLong case IdlType::tk_longlong: pyv = MyPyLong_FromLongLong(c->constAsLongLong()); break; case IdlType::tk_ulonglong: pyv = PyLong_FromUnsignedLongLong(c->constAsULongLong()); break; #endif #ifdef HAS_LongDouble case IdlType::tk_longdouble: pyv = PyFloat_FromDouble(c->constAsLongDouble()); IdlWarning(c->file(), c->line(), "long double constant truncated to double. Sorry."); break; #endif case IdlType::tk_wchar: pyv = PyInt_FromLong(c->constAsWChar()); break; case IdlType::tk_wstring: pyv = wstringToList(c->constAsWString()); break; case IdlType::tk_fixed: { char* fs = c->constAsFixed()->asString(); pyv = PyString_FromString(fs); delete [] fs; } break; case IdlType::tk_enum: pyv = findPyDecl(c->constAsEnumerator()->scopedName()); break; default: assert(0); } result_ = PyObject_CallMethod(idlast_, (char*)"Const", (char*)"siiNNsNsNiN", c->file(), c->line(), (int)c->mainFile(), pragmasToList(c->pragmas()), commentsToList(c->comments()), c->identifier(), scopedNameToList(c->scopedName()), c->repoId(), pytype, (int)c->constKind(), pyv); ASSERT_RESULT; registerPyDecl(c->scopedName(), result_); } void PythonVisitor:: visitDeclarator(Declarator* d) { ArraySize* s; int i; for (i=0, s = d->sizes(); s; s = s->next(), ++i); PyObject* pysizes = PyList_New(i); for (i=0, s = d->sizes(); s; s = s->next(), ++i) PyList_SetItem(pysizes, i, PyInt_FromLong(s->size())); result_ = PyObject_CallMethod(idlast_, (char*)"Declarator",(char*)"siiNNsNsN", d->file(), d->line(), (int)d->mainFile(), pragmasToList(d->pragmas()), commentsToList(d->comments()), d->identifier(), scopedNameToList(d->scopedName()), d->repoId(), pysizes); ASSERT_RESULT; registerPyDecl(d->scopedName(), result_); } void PythonVisitor:: visitTypedef(Typedef* t) { if (t->constrType()) { ((DeclaredType*)t->aliasType())->decl()->accept(*this); Py_DECREF(result_); } t->aliasType()->accept(*this); PyObject* pyaliasType = result_; Declarator* d; int i, l; for (l=0, d = t->declarators(); d; d = (Declarator*)d->next(), ++l); PyObject* pydeclarators = PyList_New(l); for (i=0, d = t->declarators(); d; d = (Declarator*)d->next(), ++i) { d->accept(*this); PyList_SetItem(pydeclarators, i, result_); } result_ = PyObject_CallMethod(idlast_, (char*)"Typedef", (char*)"siiNNNiN", t->file(), t->line(), (int)t->mainFile(), pragmasToList(t->pragmas()), commentsToList(t->comments()), pyaliasType, (int)t->constrType(), pydeclarators); ASSERT_RESULT; // Give each Declarator a reference to the Typedef. This creates a // loop which Python's GC won't collect :-( for (i=0; iconstrType()) { ((DeclaredType*)m->memberType())->decl()->accept(*this); Py_DECREF(result_); } m->memberType()->accept(*this); PyObject* pymemberType = result_; Declarator* d; int i; for (i=0, d = m->declarators(); d; d = (Declarator*)d->next(), ++i); PyObject* pydeclarators = PyList_New(i); for (i=0, d = m->declarators(); d; d = (Declarator*)d->next(), ++i) { d->accept(*this); PyList_SetItem(pydeclarators, i, result_); } result_ = PyObject_CallMethod(idlast_, (char*)"Member", (char*)"siiNNNiN", m->file(), m->line(), (int)m->mainFile(), pragmasToList(m->pragmas()), commentsToList(m->comments()), pymemberType, (int)m->constrType(), pydeclarators); ASSERT_RESULT; } void PythonVisitor:: visitStruct(Struct* s) { Member* m; int i; PyObject* pystruct = PyObject_CallMethod(idlast_, (char*)"Struct", (char*)"siiNNsNsi", s->file(), s->line(), (int)s->mainFile(), pragmasToList(s->pragmas()), commentsToList(s->comments()), s->identifier(), scopedNameToList(s->scopedName()), s->repoId(), (int)s->recursive()); ASSERT_PYOBJ(pystruct); registerPyDecl(s->scopedName(), pystruct); for (i=0, m = s->members(); m; m = (Member*)m->next(), ++i); PyObject* pymembers = PyList_New(i); for (i=0, m = s->members(); m; m = (Member*)m->next(), ++i) { m->accept(*this); PyList_SetItem(pymembers, i, result_); } PyObject* r = PyObject_CallMethod(pystruct, (char*)"_setMembers", (char*)"N", pymembers); ASSERT_PYOBJ(r); Py_DECREF(r); result_ = pystruct; } void PythonVisitor:: visitStructForward(StructForward* f) { result_ = PyObject_CallMethod(idlast_, (char*)"StructForward", (char*)"siiNNsNs", f->file(), f->line(), (int)f->mainFile(), pragmasToList(f->pragmas()), commentsToList(f->comments()), f->identifier(), scopedNameToList(f->scopedName()), f->repoId()); ASSERT_RESULT; registerPyDecl(f->scopedName(), result_); } void PythonVisitor:: visitException(Exception* e) { Member* m; int i; for (i=0, m = e->members(); m; m = (Member*)m->next(), ++i); PyObject* pymembers = PyList_New(i); for (i=0, m = e->members(); m; m = (Member*)m->next(), ++i) { m->accept(*this); PyList_SetItem(pymembers, i, result_); } result_ = PyObject_CallMethod(idlast_, (char*)"Exception", (char*)"siiNNsNsN", e->file(), e->line(), (int)e->mainFile(), pragmasToList(e->pragmas()), commentsToList(e->comments()), e->identifier(), scopedNameToList(e->scopedName()), e->repoId(), pymembers); ASSERT_RESULT; registerPyDecl(e->scopedName(), result_); } void PythonVisitor:: visitCaseLabel(CaseLabel* l) { PyObject* pyv; switch(l->labelKind()) { case IdlType::tk_short: pyv = PyInt_FromLong(l->labelAsShort()); break; case IdlType::tk_long: pyv = PyInt_FromLong(l->labelAsLong()); break; case IdlType::tk_ushort: pyv = PyInt_FromLong(l->labelAsUShort()); break; case IdlType::tk_ulong: pyv = PyLong_FromUnsignedLong(l->labelAsULong()); break; case IdlType::tk_boolean: pyv = PyInt_FromLong(l->labelAsBoolean()); break; case IdlType::tk_char: pyv = Py_BuildValue((char*)"c", l->labelAsChar()); break; #ifdef HAS_LongLong case IdlType::tk_longlong: pyv = MyPyLong_FromLongLong(l->labelAsLongLong()); break; case IdlType::tk_ulonglong: pyv = PyLong_FromUnsignedLongLong(l->labelAsULongLong()); break; #endif case IdlType::tk_wchar: pyv = PyInt_FromLong(l->labelAsWChar()); break; case IdlType::tk_enum: pyv = findPyDecl(l->labelAsEnumerator()->scopedName()); break; default: assert(0); } result_ = PyObject_CallMethod(idlast_, (char*)"CaseLabel", (char*)"siiNNiNi", l->file(), l->line(), (int)l->mainFile(), pragmasToList(l->pragmas()), commentsToList(l->comments()), (int)l->isDefault(), pyv, (int)l->labelKind()); ASSERT_RESULT; } void PythonVisitor:: visitUnionCase(UnionCase* c) { if (c->constrType()) { ((DeclaredType*)c->caseType())->decl()->accept(*this); Py_DECREF(result_); } CaseLabel* l; int i; for (i=0, l = c->labels(); l; l = (CaseLabel*)l->next(), ++i); PyObject* pylabels = PyList_New(i); for (i=0, l = c->labels(); l; l = (CaseLabel*)l->next(), ++i) { l->accept(*this); PyList_SetItem(pylabels, i, result_); } c->caseType()->accept(*this); PyObject* pycaseType = result_; c->declarator()->accept(*this); PyObject* pydeclarator = result_; result_ = PyObject_CallMethod(idlast_, (char*)"UnionCase", (char*)"siiNNNNiN", c->file(), c->line(), (int)c->mainFile(), pragmasToList(c->pragmas()), commentsToList(c->comments()), pylabels, pycaseType, (int)c->constrType(), pydeclarator); ASSERT_RESULT; } void PythonVisitor:: visitUnion(Union* u) { if (u->constrType()) { ((DeclaredType*)u->switchType())->decl()->accept(*this); Py_DECREF(result_); } u->switchType()->accept(*this); PyObject* pyswitchType = result_; PyObject* pyunion = PyObject_CallMethod(idlast_, (char*)"Union", (char*)"siiNNsNsNii", u->file(), u->line(), (int)u->mainFile(), pragmasToList(u->pragmas()), commentsToList(u->comments()), u->identifier(), scopedNameToList(u->scopedName()), u->repoId(), pyswitchType, (int)u->constrType(), (int)u->recursive()); ASSERT_PYOBJ(pyunion); registerPyDecl(u->scopedName(), pyunion); UnionCase* c; int i; for (i=0, c = u->cases(); c; c = (UnionCase*)c->next(), ++i); PyObject* pycases = PyList_New(i); for (i=0, c = u->cases(); c; c = (UnionCase*)c->next(), ++i) { c->accept(*this); PyList_SetItem(pycases, i, result_); } PyObject* r = PyObject_CallMethod(pyunion, (char*)"_setCases", (char*)"N", pycases); ASSERT_PYOBJ(r); Py_DECREF(r); result_ = pyunion; } void PythonVisitor:: visitUnionForward(UnionForward* f) { result_ = PyObject_CallMethod(idlast_, (char*)"UnionForward", (char*)"siiNNsNs", f->file(), f->line(), (int)f->mainFile(), pragmasToList(f->pragmas()), commentsToList(f->comments()), f->identifier(), scopedNameToList(f->scopedName()), f->repoId()); ASSERT_RESULT; registerPyDecl(f->scopedName(), result_); } void PythonVisitor:: visitEnumerator(Enumerator* e) { result_ = PyObject_CallMethod(idlast_, (char*)"Enumerator", (char*)"siiNNsNsi", e->file(), e->line(), (int)e->mainFile(), pragmasToList(e->pragmas()), commentsToList(e->comments()), e->identifier(), scopedNameToList(e->scopedName()), e->repoId(), e->value()); ASSERT_RESULT; registerPyDecl(e->scopedName(), result_); } void PythonVisitor:: visitEnum(Enum* e) { Enumerator* n; int i; for (i=0, n = e->enumerators(); n; n = (Enumerator*)n->next(), ++i); PyObject* pyenumerators = PyList_New(i); for (i=0, n = e->enumerators(); n; n = (Enumerator*)n->next(), ++i) { n->accept(*this); PyList_SetItem(pyenumerators, i, result_); } result_ = PyObject_CallMethod(idlast_, (char*)"Enum", (char*)"siiNNsNsN", e->file(), e->line(), (int)e->mainFile(), pragmasToList(e->pragmas()), commentsToList(e->comments()), e->identifier(), scopedNameToList(e->scopedName()), e->repoId(), pyenumerators); ASSERT_RESULT; registerPyDecl(e->scopedName(), result_); } void PythonVisitor:: visitAttribute(Attribute* a) { a->attrType()->accept(*this); PyObject* pyattrType = result_; Declarator* d; int i, l; for (l=0, d = a->declarators(); d; d = (Declarator*)d->next(), ++l); PyObject* pydeclarators = PyList_New(l); for (i=0, d = a->declarators(); d; d = (Declarator*)d->next(), ++i) { d->accept(*this); PyList_SetItem(pydeclarators, i, result_); } result_ = PyObject_CallMethod(idlast_, (char*)"Attribute", (char*)"siiNNiNN", a->file(), a->line(), (int)a->mainFile(), pragmasToList(a->pragmas()), commentsToList(a->comments()), (int)a->readonly(), pyattrType, pydeclarators); ASSERT_RESULT; } void PythonVisitor:: visitParameter(Parameter* p) { p->paramType()->accept(*this); PyObject* pyparamType = result_; result_ = PyObject_CallMethod(idlast_, (char*)"Parameter", (char*)"siiNNiNs", p->file(), p->line(), (int)p->mainFile(), pragmasToList(p->pragmas()), commentsToList(p->comments()), p->direction(), pyparamType, p->identifier()); ASSERT_RESULT; } void PythonVisitor:: visitOperation(Operation* o) { o->returnType()->accept(*this); PyObject* pyreturnType = result_; Parameter* p; int i; for (i=0, p = o->parameters(); p; p = (Parameter*)p->next(), ++i); PyObject* pyparameters = PyList_New(i); for (i=0, p = o->parameters(); p; p = (Parameter*)p->next(), ++i) { p->accept(*this); PyList_SetItem(pyparameters, i, result_); } RaisesSpec* r; for (i=0, r = o->raises(); r; r = r->next(), ++i); PyObject* pyraises = PyList_New(i); for (i=0, r = o->raises(); r; r = r->next(), ++i) PyList_SetItem(pyraises, i, findPyDecl(r->exception()->scopedName())); ContextSpec* c; for (i=0, c = o->contexts(); c; c = c->next(), ++i); PyObject* pycontexts = PyList_New(i); for (i=0, c = o->contexts(); c; c = c->next(), ++i) PyList_SetItem(pycontexts, i, PyString_FromString(c->context())); result_ = PyObject_CallMethod(idlast_,(char*)"Operation",(char*)"siiNNiNsNsNNN", o->file(), o->line(), (int)o->mainFile(), pragmasToList(o->pragmas()), commentsToList(o->comments()), (int)o->oneway(), pyreturnType, o->identifier(), scopedNameToList(o->scopedName()), o->repoId(), pyparameters, pyraises, pycontexts); ASSERT_RESULT; registerPyDecl(o->scopedName(), result_); } void PythonVisitor:: visitNative(Native* n) { result_ = PyObject_CallMethod(idlast_, (char*)"Native", (char*)"siiNNsNs", n->file(), n->line(), (int)n->mainFile(), pragmasToList(n->pragmas()), commentsToList(n->comments()), n->identifier(), scopedNameToList(n->scopedName()), n->repoId()); ASSERT_RESULT; registerPyDecl(n->scopedName(), result_); } void PythonVisitor:: visitStateMember(StateMember* s) { if (s->constrType()) { ((DeclaredType*)s->memberType())->decl()->accept(*this); Py_DECREF(result_); } s->memberType()->accept(*this); PyObject* pymemberType = result_; Declarator* d; int i; for (i=0, d = s->declarators(); d; d = (Declarator*)d->next(), ++i); PyObject* pydeclarators = PyList_New(i); for (i=0, d = s->declarators(); d; d = (Declarator*)d->next(), ++i) { d->accept(*this); PyList_SetItem(pydeclarators, i, result_); } result_ = PyObject_CallMethod(idlast_,(char*)"StateMember",(char*)"siiNNiNiN", s->file(), s->line(), (int)s->mainFile(), pragmasToList(s->pragmas()), commentsToList(s->comments()), s->memberAccess(), pymemberType, (int)s->constrType(), pydeclarators); ASSERT_RESULT; } void PythonVisitor:: visitFactory(Factory* f) { Parameter* p; int i; for (i=0, p = f->parameters(); p; p = (Parameter*)p->next(), ++i); PyObject* pyparameters = PyList_New(i); for (i=0, p = f->parameters(); p; p = (Parameter*)p->next(), ++i) { p->accept(*this); PyList_SetItem(pyparameters, i, result_); } RaisesSpec* r; for (i=0, r = f->raises(); r; r = r->next(), ++i); PyObject* pyraises = PyList_New(i); for (i=0, r = f->raises(); r; r = r->next(), ++i) PyList_SetItem(pyraises, i, findPyDecl(r->exception()->scopedName())); result_ = PyObject_CallMethod(idlast_, (char*)"Factory", (char*)"siiNNsNN", f->file(), f->line(), (int)f->mainFile(), pragmasToList(f->pragmas()), commentsToList(f->comments()), f->identifier(), pyparameters, pyraises); ASSERT_RESULT; } void PythonVisitor:: visitValueForward(ValueForward* f) { result_ = PyObject_CallMethod(idlast_, (char*)"ValueForward", (char*)"siiNNsNsi", f->file(), f->line(), (int)f->mainFile(), pragmasToList(f->pragmas()), commentsToList(f->comments()), f->identifier(), scopedNameToList(f->scopedName()), f->repoId(), (int)f->abstract()); ASSERT_RESULT; registerPyDecl(f->scopedName(), result_); } void PythonVisitor:: visitValueBox(ValueBox* b) { if (b->constrType()) { ((DeclaredType*)b->boxedType())->decl()->accept(*this); Py_DECREF(result_); } b->boxedType()->accept(*this); PyObject* pyboxedType = result_; result_ = PyObject_CallMethod(idlast_, (char*)"ValueBox", (char*)"siiNNsNsNi", b->file(), b->line(), (int)b->mainFile(), pragmasToList(b->pragmas()), commentsToList(b->comments()), b->identifier(), scopedNameToList(b->scopedName()), b->repoId(), pyboxedType, (int)b->constrType()); ASSERT_RESULT; registerPyDecl(b->scopedName(), result_); } void PythonVisitor:: visitValueAbs(ValueAbs* a) { int l; PyObject* pyobj; Decl* d; // Inherited values and interfaces InheritSpec* inh; ValueInheritSpec* vinh; for (l=0, vinh = a->inherits(); vinh; vinh = vinh->next(), ++l); PyObject* pyinherits = PyList_New(l); for (l=0, vinh = a->inherits(); vinh; vinh = vinh->next(), ++l) { d = vinh->decl(); if (d->kind() == Decl::D_VALUEABS) pyobj = findPyDecl(((ValueAbs*)d)->scopedName()); else if (d->kind() == Decl::D_DECLARATOR) pyobj = findPyDecl(((Declarator*)d)->scopedName()); else assert(0); PyList_SetItem(pyinherits, l, pyobj); } for (l=0, inh = a->supports(); inh; inh = inh->next(), ++l); PyObject* pysupports = PyList_New(l); for (l=0, inh = a->supports(); inh; inh = inh->next(), ++l) { d = inh->decl(); if (d->kind() == Decl::D_INTERFACE) pyobj = findPyDecl(((Interface*)d)->scopedName()); else if (d->kind() == Decl::D_DECLARATOR) pyobj = findPyDecl(((Declarator*)d)->scopedName()); else assert(0); PyList_SetItem(pysupports, l, pyobj); } PyObject* pyvalue = PyObject_CallMethod(idlast_, (char*)"ValueAbs", (char*)"siiNNsNsNN", a->file(), a->line(), (int)a->mainFile(), pragmasToList(a->pragmas()), commentsToList(a->comments()), a->identifier(), scopedNameToList(a->scopedName()), a->repoId(), pyinherits, pysupports); ASSERT_PYOBJ(pyvalue); registerPyDecl(a->scopedName(), pyvalue); // Contents for (l=0, d = a->contents(); d; d = d->next(), ++l); PyObject* pycontents = PyList_New(l); for (l=0, d = a->contents(); d; d = d->next(), ++l) { d->accept(*this); PyList_SetItem(pycontents, l, result_); } PyObject* r = PyObject_CallMethod(pyvalue, (char*)"_setContents", (char*)"N", pycontents); ASSERT_PYOBJ(r); Py_DECREF(r); result_ = pyvalue; } void PythonVisitor:: visitValue(Value* v) { int l; PyObject* pyobj; Decl* d; // Inherited values and interfaces InheritSpec* inh; ValueInheritSpec* vinh; int truncatable = 0; if (v->inherits()) truncatable = v->inherits()->truncatable(); for (l=0, vinh = v->inherits(); vinh; vinh = vinh->next(), ++l); PyObject* pyinherits = PyList_New(l); for (l=0, vinh = v->inherits(); vinh; vinh = vinh->next(), ++l) { d = vinh->decl(); if (d->kind() == Decl::D_VALUE) pyobj = findPyDecl(((Value*)d)->scopedName()); else if (d->kind() == Decl::D_VALUEABS) pyobj = findPyDecl(((ValueAbs*)d)->scopedName()); else if (d->kind() == Decl::D_DECLARATOR) pyobj = findPyDecl(((Declarator*)d)->scopedName()); else assert(0); PyList_SetItem(pyinherits, l, pyobj); } for (l=0, inh = v->supports(); inh; inh = inh->next(), ++l); PyObject* pysupports = PyList_New(l); for (l=0, inh = v->supports(); inh; inh = inh->next(), ++l) { d = inh->decl(); if (d->kind() == Decl::D_INTERFACE) pyobj = findPyDecl(((Interface*)d)->scopedName()); else if (d->kind() == Decl::D_DECLARATOR) pyobj = findPyDecl(((Declarator*)d)->scopedName()); else assert(0); PyList_SetItem(pysupports, l, pyobj); } PyObject* pyvalue = PyObject_CallMethod(idlast_, (char*)"Value", (char*)"siiNNsNsiNiN", v->file(), v->line(), (int)v->mainFile(), pragmasToList(v->pragmas()), commentsToList(v->comments()), v->identifier(), scopedNameToList(v->scopedName()), v->repoId(), (int)v->custom(), pyinherits, truncatable, pysupports); ASSERT_PYOBJ(pyvalue); registerPyDecl(v->scopedName(), pyvalue); // Contents for (l=0, d = v->contents(); d; d = d->next(), ++l); PyObject* pycontents = PyList_New(l); for (l=0, d = v->contents(); d; d = d->next(), ++l) { d->accept(*this); PyList_SetItem(pycontents, l, result_); } PyObject* r = PyObject_CallMethod(pyvalue, (char*)"_setContents", (char*)"N", pycontents); ASSERT_PYOBJ(r); Py_DECREF(r); result_ = pyvalue; } // Types void PythonVisitor:: visitBaseType(BaseType* t) { result_ = PyObject_CallMethod(idltype_, (char*)"baseType", (char*)"i", (int)t->kind()); ASSERT_RESULT; } void PythonVisitor:: visitStringType(StringType* t) { result_ = PyObject_CallMethod(idltype_, (char*)"stringType", (char*)"i", t->bound()); ASSERT_RESULT; } void PythonVisitor:: visitWStringType(WStringType* t) { result_ = PyObject_CallMethod(idltype_, (char*)"wstringType", (char*)"i", t->bound()); ASSERT_RESULT; } void PythonVisitor:: visitSequenceType(SequenceType* t) { t->seqType()->accept(*this); result_ = PyObject_CallMethod(idltype_, (char*)"sequenceType", (char*)"Nii", result_, t->bound(), (int)t->local()); ASSERT_RESULT; } void PythonVisitor:: visitFixedType(FixedType* t) { result_ = PyObject_CallMethod(idltype_, (char*)"fixedType", (char*)"ii", t->digits(), t->scale()); ASSERT_RESULT; } void PythonVisitor:: visitDeclaredType(DeclaredType* t) { if (t->decl()) { result_ = PyObject_CallMethod(idltype_, (char*)"declaredType", (char*)"NNii", findPyDecl(t->declRepoId()->scopedName()), scopedNameToList(t->declRepoId()->scopedName()), (int)t->kind(), (int)t->local()); } else { if (t->kind() == IdlType::tk_objref) { PyObject* pysn = Py_BuildValue((char*)"[ss]", (char*)"CORBA", (char*)"Object"); PyObject* pydecl = PyObject_CallMethod(idlast_, (char*)"findDecl", (char*)"O", pysn); result_ = PyObject_CallMethod(idltype_, (char*)"declaredType", (char*)"NNii", pydecl, pysn, (int)t->kind(), (int)t->local()); } else if (t->kind() == IdlType::tk_value) { PyObject* pysn = Py_BuildValue((char*)"[ss]", (char*)"CORBA", (char*)"ValueBase"); PyObject* pydecl = PyObject_CallMethod(idlast_, (char*)"findDecl", (char*)"O", pysn); result_ = PyObject_CallMethod(idltype_, (char*)"declaredType", (char*)"NNii", pydecl, pysn, (int)t->kind(), (int)t->local()); } else abort(); } ASSERT_RESULT; } extern "C" { static PyObject* IdlPyCompile(PyObject* self, PyObject* args) { PyObject* arg; const char* name; FILE* file; IDL_Boolean to_close = 0; if (!PyArg_ParseTuple(args, (char*)"O", &arg)) return 0; if (PyString_Check(arg)) { name = PyString_AsString(arg); file = fopen(name, "r"); if (!file) { PyErr_SetString(PyExc_IOError, (char*)"Cannot open file"); return 0; } to_close = 1; } else if (PyFile_Check(arg)) { PyObject* pyname = PyFile_Name(arg); file = PyFile_AsFile(arg); name = PyString_AsString(pyname); } else { PyErr_SetString(PyExc_TypeError, (char*)"Argument must be a file or filename"); return 0; } IDL_Boolean success = AST::process(file, name); if (to_close) fclose(file); if (success) { PythonVisitor v; AST::tree()->accept(v); return v.result(); } else { AST::clear(); Py_INCREF(Py_None); return Py_None; } } static PyObject* IdlPyClear(PyObject* self, PyObject* args) { if (!PyArg_ParseTuple(args, (char*)"")) return 0; AST::clear(); Py_INCREF(Py_None); return Py_None; } static PyObject* IdlPyDump(PyObject* self, PyObject* args) { PyObject* arg; const char* name; FILE* file; IDL_Boolean to_close = 0; if (!PyArg_ParseTuple(args, (char*)"O", &arg)) return 0; if (PyString_Check(arg)) { name = PyString_AsString(arg); file = fopen(name, "r"); if (!file) { PyErr_SetString(PyExc_IOError, (char*)"Cannot open file"); return 0; } to_close = 1; } else if (PyFile_Check(arg)) { PyObject* pyname = PyFile_Name(arg); file = PyFile_AsFile(arg); name = PyString_AsString(pyname); } else { PyErr_SetString(PyExc_TypeError, (char*)"Argument must be a file or filename"); return 0; } IDL_Boolean success = AST::process(file, name); if (to_close) fclose(file); if (success) { DumpVisitor v; AST::tree()->accept(v); } AST::clear(); Py_INCREF(Py_None); return Py_None; } static PyObject* IdlPyQuiet(PyObject* self, PyObject* args) { if (!PyArg_ParseTuple(args, (char*)"")) return 0; Config::quiet = 1; Py_INCREF(Py_None); return Py_None; } static PyObject* IdlPyNoForwardWarning(PyObject* self, PyObject* args) { if (!PyArg_ParseTuple(args, (char*)"")) return 0; Config::forwardWarning = 0; Py_INCREF(Py_None); return Py_None; } static PyObject* IdlPyKeepComments(PyObject* self, PyObject* args) { int first; if (!PyArg_ParseTuple(args, (char*)"i", &first)) return 0; Config::keepComments = 1; Config::commentsFirst = first; Py_INCREF(Py_None); return Py_None; } static PyObject* IdlPyRelativeScopedName(PyObject* self, PyObject* args) { PyObject *pyfrom, *pyto; if (!PyArg_ParseTuple(args, (char*)"OO", &pyfrom, &pyto)) return 0; if (!PySequence_Check(pyfrom) || !PySequence_Check(pyto)) { PyErr_SetString(PyExc_TypeError, (char*)"Both arguments must be sequences of strings"); return 0; } if (PyObject_Length(pyto) == 0) { PyErr_SetString(PyExc_TypeError, (char*)"Argument 2 must be a non-empty sequence"); return 0; } ScopedName* from = 0; ScopedName* to = 0; int i; // Convert lists to absolute ScopedNames for (i=0; i < PyObject_Length(pyfrom); i++) { PyObject* tmp = PySequence_GetItem(pyfrom, i); if (!PyString_Check(tmp)) { if (from) delete from; PyErr_SetString(PyExc_TypeError, (char*)"Both arguments must be sequences of strings"); return 0; } if (from) from->append(PyString_AsString(tmp)); else from = new ScopedName(PyString_AsString(tmp), 1); } for (i=0; i < PyObject_Length(pyto); i++) { PyObject* tmp = PySequence_GetItem(pyto, i); if (!PyString_Check(tmp)) { if (from) delete from; if (to) delete to; PyErr_SetString(PyExc_TypeError, (char*)"Both arguments must be sequences of strings"); return 0; } if (to) to->append(PyString_AsString(tmp)); else to = new ScopedName(PyString_AsString(tmp), 1); } ScopedName* result = Scope::relativeScopedName(from, to); if (from) delete from; delete to; if (result) { PyObject* pyresult = PythonVisitor::scopedNameToList(result); if (result->absolute()) PyList_Insert(pyresult, 0, Py_None); delete result; return pyresult; } Py_INCREF(Py_None); return Py_None; } static PyObject* IdlPyRunInteractiveLoop(PyObject* self, PyObject* args) { PyRun_InteractiveLoop(stdin, (char*)""); Py_INCREF(Py_None); return Py_None; } static PyObject* IdlPyCaseSensitive(PyObject* self, PyObject* args) { if (!PyArg_ParseTuple(args, (char*)"")) return 0; Config::caseSensitive = 1; Py_INCREF(Py_None); return Py_None; } static PyObject* IdlPyPlatformDefines(PyObject* self, PyObject* args) { if (!PyArg_ParseTuple(args, (char*)"")) return 0; PyObject* l = PyList_New(0); #ifdef HAS_LongLong PyList_Append(l, PyString_FromString("-DHAS_LongLong")); #endif #ifdef HAS_LongDouble PyList_Append(l, PyString_FromString("-DHAS_LongDouble")); #endif return l; } static PyObject* IdlPyAlwaysTempFile(PyObject* self, PyObject* args) { if (!PyArg_ParseTuple(args, (char*)"")) return 0; #if defined (_MSC_VER) && _MSC_VER > 1200 || defined(__DMC__) return PyInt_FromLong(1); #else return PyInt_FromLong(0); #endif } static PyMethodDef omniidl_methods[] = { {(char*)"compile", IdlPyCompile, METH_VARARGS}, {(char*)"clear", IdlPyClear, METH_VARARGS}, {(char*)"dump", IdlPyDump, METH_VARARGS}, {(char*)"quiet", IdlPyQuiet, METH_VARARGS}, {(char*)"noForwardWarning", IdlPyNoForwardWarning, METH_VARARGS}, {(char*)"keepComments", IdlPyKeepComments, METH_VARARGS}, {(char*)"relativeScopedName", IdlPyRelativeScopedName, METH_VARARGS}, {(char*)"runInteractiveLoop", IdlPyRunInteractiveLoop, METH_VARARGS}, {(char*)"caseSensitive", IdlPyCaseSensitive, METH_VARARGS}, {(char*)"platformDefines", IdlPyPlatformDefines, METH_VARARGS}, {(char*)"alwaysTempFile", IdlPyAlwaysTempFile, METH_VARARGS}, {NULL, NULL} }; void DLL_EXPORT init_omniidl() { PyObject* m = Py_InitModule((char*)"_omniidl", omniidl_methods); PyObject_SetAttrString(m, (char*)"version", PyString_FromString(IDLMODULE_VERSION)); } } #ifdef OMNIIDL_EXECUTABLE // It's awkward to make a command named 'omniidl' on NT which runs // Python, so we make the front-end a Python executable which always // runs omniidl.main. #ifdef __VMS #ifdef PYTHON_1 extern "C" int PyVMS_init(int* pvi_argc, char*** pvi_argv); #endif #endif int main(int argc, char** argv) { const char* omniidl_string = "import sys, os, os.path, string\n" "\n" "pylibdir = None\n" "binarchdir = os.path.abspath(os.path.dirname(sys.executable))\n" "\n" "if binarchdir != '':\n" " sys.path.insert(0, binarchdir)\n" " bindir, archname = os.path.split(binarchdir)\n" " treedir, bin = os.path.split(bindir)\n" " if string.lower(bin) == 'bin':\n" " pylibdir = os.path.join(treedir, 'lib', 'python')\n" "\n" " if os.path.isdir(pylibdir):\n" " sys.path.insert(0, pylibdir)\n" "else:\n" " print '''can't parse %s's path name!''' % sys.executable\n" "\n" "try:\n" " import omniidl.main\n" "except ImportError, msg:\n" " sys.stderr.write('\\n\\n')\n" " sys.stderr.write('omniidl: ERROR!\\n\\n')\n" " sys.stderr.write('omniidl: Could not open Python files for IDL compiler\\n')\n" " sys.stderr.write('omniidl: Please put them in directory ' + \\\n" " (pylibdir or binarchdir) + '\\n')\n" " sys.stderr.write('omniidl: (or set the PYTHONPATH environment variable)\\n')\n" " sys.stderr.write('\\n')\n" " sys.stderr.write('omniidl: (The error was \\'' + str(msg) + '\\')\\n')\n" " sys.stderr.write('\\n\\n')\n" " sys.stderr.flush()\n" " sys.exit(1)\n" "\n" "omniidl.main.main()\n"; #ifdef __VMS #ifdef PYTHON_1 PyVMS_init(&argc, &argv); #endif Py_SetProgramName(argv[0]); #endif Py_Initialize(); PySys_SetArgv(argc, argv); init_omniidl(); return PyRun_SimpleString((char*)omniidl_string); } #endif synopsis-0.12/Synopsis/Parsers/IDL/idlvalidate.cc0000664000076400007640000000676711104703261021341 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlvalidate.cc Created on: 1999/10/26 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Visitor object to validate the tree // $Id: idlvalidate.cc,v 1.7.2.1 2003/03/23 21:01:43 dgrisby Exp $ // $Log: idlvalidate.cc,v $ // Revision 1.7.2.1 2003/03/23 21:01:43 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.4.2.3 2001/10/17 16:48:34 dpg1 // Minor error message tweaks // // Revision 1.4.2.2 2000/11/01 15:44:56 dpg1 // Support for forward-declared structs and unions // // Revision 1.4.2.1 2000/07/17 10:36:05 sll // Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0. // // Revision 1.5 2000/07/13 15:25:52 dpg1 // Merge from omni3_develop for 3.0 release. // // Revision 1.2.2.1 2000/03/06 15:03:47 dpg1 // Minor bug fixes to omniidl. New -nf and -k flags. // // Revision 1.2 1999/11/02 17:07:24 dpg1 // Changes to compile on Solaris. // // Revision 1.1 1999/10/27 14:05:53 dpg1 // *** empty log message *** // #include #include #include #include void AstValidateVisitor:: visitAST(AST* a) { for (Decl* d = a->declarations(); d; d = d->next()) d->accept(*this); } void AstValidateVisitor:: visitModule(Module* m) { for (Decl* d = m->definitions(); d; d = d->next()) d->accept(*this); } void AstValidateVisitor:: visitInterface(Interface* i) { for (Decl* d = i->contents(); d; d = d->next()) d->accept(*this); } void AstValidateVisitor:: visitForward(Forward* f) { if (Config::forwardWarning) { if (f->isFirst() && !f->definition()) { char* ssn = f->scopedName()->toString(); IdlWarning(f->file(), f->line(), "Forward declared interface '%s' was never fully defined", ssn); delete [] ssn; } } } void AstValidateVisitor:: visitValueForward(ValueForward* f) { if (Config::forwardWarning) { if (f->isFirst() && !f->definition()) { char* ssn = f->scopedName()->toString(); IdlWarning(f->file(), f->line(), "Forward declared valuetype '%s' was never fully defined", ssn); delete [] ssn; } } } void AstValidateVisitor:: visitStructForward(StructForward* f) { if (f->isFirst() && !f->definition()) { char* ssn = f->scopedName()->toString(); IdlError(f->file(), f->line(), "Forward declared struct '%s' was never fully defined", ssn); delete [] ssn; } } void AstValidateVisitor:: visitUnionForward(UnionForward* f) { if (f->isFirst() && !f->definition()) { char* ssn = f->scopedName()->toString(); IdlError(f->file(), f->line(), "Forward declared union '%s' was never fully defined", ssn); delete [] ssn; } } synopsis-0.12/Synopsis/Parsers/IDL/idlc.cc0000664000076400007640000000457011104703261017760 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlc.cc Created on: 1999/10/20 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Simple main() function to test front-end // $Id: idlc.cc,v 1.6.2.1 2003/03/23 21:01:47 dgrisby Exp $ // $Log: idlc.cc,v $ // Revision 1.6.2.1 2003/03/23 21:01:47 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.3.2.2 2000/10/27 16:31:08 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.3.2.1 2000/07/17 10:36:02 sll // Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0. // // Revision 1.4 2000/07/13 15:25:53 dpg1 // Merge from omni3_develop for 3.0 release. // // Revision 1.1 1999/10/27 14:05:59 dpg1 // *** empty log message *** // #include #include #include #include #include #include #include #include #include extern int yydebug; int main(int argc, char** argv) { if (argc != 1 && argc != 2) { cerr << "Usage: " << argv[0] << " [idl file]" << endl; exit(2); } // yydebug = 1; FILE* f; const char* name; if (argc == 2) { name = argv[1]; if (!((f = fopen(name, "r")))) { cerr << "Can't open " << name << endl; exit(2); } } else { name = ""; f = stdin; } IDL_Boolean success = AST::process(f, name); fclose(f); if (!success) exit(1); DumpVisitor v; AST::tree()->accept(v); cout << "Done." << endl; return 0; } synopsis-0.12/Synopsis/Parsers/IDL/idltype.py0000664000076400007640000002563711104703261020571 0ustar stefanstefan# -*- python -*- # Package : omniidl # idltype.py Created on: 1999/10/27 # Author : Duncan Grisby (dpg1) # # Copyright (C) 1999 AT&T Laboratories Cambridge # # This file is part of omniidl. # # omniidl is free software; you can redistribute 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. # # Description: # # IDL type representation """Definitions for IDL type representation Classes: Type -- abstract base class. Base -- class for CORBA base types. String -- class for string types. WString -- class for wide string types. Sequence -- class for sequence types. Fixed -- class for fixed-point types. Declared -- class for declared types. TypeCode kind constants: tk_null, tk_void, tk_short, tk_long, tk_ushort, tk_ulong, tk_float, tk_double, tk_boolean, tk_char, tk_octet, tk_any, tk_TypeCode, tk_Principal, tk_objref, tk_struct, tk_union, tk_enum, tk_string, tk_sequence, tk_array, tk_alias, tk_except, tk_longlong, tk_ulonglong, tk_longdouble, tk_wchar, tk_wstring, tk_fixed, tk_value, tk_value_box, tk_native, tk_abstract_interface""" import idlutil tk_null = 0 tk_void = 1 tk_short = 2 tk_long = 3 tk_ushort = 4 tk_ulong = 5 tk_float = 6 tk_double = 7 tk_boolean = 8 tk_char = 9 tk_octet = 10 tk_any = 11 tk_TypeCode = 12 tk_Principal = 13 tk_objref = 14 tk_struct = 15 tk_union = 16 tk_enum = 17 tk_string = 18 tk_sequence = 19 tk_array = 20 tk_alias = 21 tk_except = 22 tk_longlong = 23 tk_ulonglong = 24 tk_longdouble = 25 tk_wchar = 26 tk_wstring = 27 tk_fixed = 28 tk_value = 29 tk_value_box = 30 tk_native = 31 tk_abstract_interface = 32 tk_local_interface = 33 # Non-standard kinds for forward-declared structs and unions ot_structforward = 100 ot_unionforward = 101 class Error: """Exception class used by IdlType internals.""" def __init__(self, err): self.err = err def __repr__(self): return self.err class Type: """Type abstract class. Function: kind() -- TypeCode kind of type. unalias() -- Return an equivalent Type object with aliases stripped accept(visitor) -- visitor pattern accept. See idlvisitor.py.""" def __init__(self, kind, local): self.__kind = kind self.__local = local def kind(self): return self.__kind def local(self): return self.__local def unalias(self): type = self while type.kind() == tk_alias: if len(type.decl().sizes()) > 0: return type type = type.decl().alias().aliasType() return type def accept(self, visitor): pass # Base types class Base (Type): """Class for CORBA base types. (Type) No non-inherited functions.""" def __init__(self, kind): if kind not in [tk_null, tk_void, tk_short, tk_long, tk_ushort, tk_ulong, tk_float, tk_double, tk_boolean, tk_char, tk_octet, tk_any, tk_TypeCode, tk_Principal, tk_longlong, tk_ulonglong, tk_longdouble, tk_wchar]: raise Error("Attempt to create Base type with invalid kind.") Type.__init__(self, kind, 0) def accept(self, visitor): visitor.visitBaseType(self) # Strings can be used like base types without a declaration. eg: # # void op(in string<10> s); # # therefore, the String type must include its bound here, rather than # relying on looking at the corresponding declaration class String (Type): """Class for string types (Type) Function: bound() -- bound of bounded string. 0 for unbounded.""" def __init__(self, bound): Type.__init__(self, tk_string, 0) self.__bound = bound def accept(self, visitor): visitor.visitStringType(self) def bound(self): return self.__bound class WString (Type): """Class for wide string types (Type) Function: bound() -- bound of bounded wstring. 0 for unbounded.""" def __init__(self, bound): Type.__init__(self, tk_wstring, 0) self.__bound = bound def accept(self, visitor): visitor.visitWStringType(self) def bound(self): return self.__bound # Sequences are never declared. They either appear as # # typedef sequence <...> ... # # or inside a struct, union, or valuetype class Sequence (Type): """Class for sequence types (Type) Functions: seqType() -- Type this is a sequence of. bound() -- bound of bounded sequence. 0 for unbounded.""" def __init__(self, seqType, bound, local): Type.__init__(self, tk_sequence, local) self.__seqType = seqType self.__bound = bound def accept(self, visitor): visitor.visitSequenceType(self) def seqType(self): return self.__seqType def bound(self): return self.__bound # Same goes for fixed class Fixed (Type): """Class for fixed point types (Type) Functions: digits() -- digits. scale() -- scale.""" def __init__(self, digits, scale): Type.__init__(self, tk_fixed, 0) self.__digits = digits self.__scale = scale def accept(self, visitor): visitor.visitFixedType(self) def digits(self): return self.__digits def scale(self): return self.__scale # All other types must be declared, at least implicitly, so they have # an associated declaration object class Declared (Type): """Class for declared types (Type) Functions: decl() -- Decl object which corresponds to this type. scopedName() -- Fully scoped name of the type as a list of strings. name() -- Simple name of the type.""" def __init__(self, decl, scopedName, kind, local): if kind not in [tk_objref, tk_struct, tk_union, tk_enum, tk_array, tk_alias, tk_except, tk_value, tk_value_box, tk_native, tk_abstract_interface, tk_local_interface, ot_structforward, ot_unionforward]: raise Error("Attempt to create Declared type with invalid kind.") Type.__init__(self, kind, local) self.__decl = decl self.__scopedName = scopedName def accept(self, visitor): visitor.visitDeclaredType(self) # Decl object where the type was declared. def decl(self): return self.__decl # List containing scoped name: def scopedName(self): return self.__scopedName # Simple name def name(self): return self.__scopedName[-1] def containsValueType(t, track=None): """Returns true if the type contains valuetypes""" import idlast if track is None: track = {} if track.has_key(id(t)): return 0 track[id(t)] = None if isinstance(t, Sequence): return containsValueType(t.seqType(), track) if isinstance(t, Declared): d = t.decl() if isinstance(d, idlast.Declarator): alias = d.alias() if alias: return containsValueType(alias.aliasType(), track) if isinstance(d, idlast.Struct): for m in d.members(): if containsValueType(m.memberType(), track): return 1 if isinstance(d, idlast.Union): for c in d.cases(): if containsValueType(c.caseType(), track): return 1 if isinstance(d, idlast.ValueAbs): return 1 if isinstance(d, idlast.Value): return 1 if isinstance(d, idlast.ValueBox): return 1 if isinstance(d, idlast.Interface) and d.abstract(): return 1 return 0 # Map of singleton Base Type objects baseTypeMap = { tk_null: Base(tk_null), tk_void: Base(tk_void), tk_short: Base(tk_short), tk_long: Base(tk_long), tk_ushort: Base(tk_ushort), tk_ulong: Base(tk_ulong), tk_float: Base(tk_float), tk_double: Base(tk_double), tk_boolean: Base(tk_boolean), tk_char: Base(tk_char), tk_octet: Base(tk_octet), tk_any: Base(tk_any), tk_TypeCode: Base(tk_TypeCode), tk_Principal: Base(tk_Principal), tk_longlong: Base(tk_longlong), tk_ulonglong: Base(tk_ulonglong), tk_longdouble: Base(tk_longdouble), tk_wchar: Base(tk_wchar) } # Maps of String and WString Type objects, indexed by bound stringTypeMap = { 0: String(0) } wstringTypeMap = { 0: WString(0) } # Map of Sequence Type objects, indexed by (type object,bound) sequenceTypeMap = {} # Map of Fixed Type objects, indexed by (digits,scale) fixedTypeMap = {} # Map of declared type objects, indexed by stringified scoped name declaredTypeMap = {} # Private functions to create or return existing Type objects def baseType(kind): return baseTypeMap[kind] def stringType(bound): try: return stringTypeMap[bound] except KeyError: st = String(bound) stringTypeMap[bound] = st return st def wstringType(bound): try: return wstringTypeMap[bound] except KeyError: wst = WString(bound) wstringTypeMap[bound] = wst return wst def sequenceType(type_spec, bound, local): try: return sequenceTypeMap[(type_spec,bound)] except KeyError: st = Sequence(type_spec, bound, local) sequenceTypeMap[(type_spec,bound)] = st return st def fixedType(digits, scale): try: return fixedTypeMap[(digits,scale)] except KeyError: ft = Fixed(digits, scale) fixedTypeMap[(digits,scale)] = ft return ft def declaredType(decl, scopedName, kind, local): sname = idlutil.slashName(scopedName) if declaredTypeMap.has_key(sname): dt = declaredTypeMap[sname] if dt.kind() == kind: return dt dt = Declared(decl, scopedName, kind, local) declaredTypeMap[sname] = dt return dt def clear(): """Clear back-end structures ready for another run""" stringTypeMap.clear() wstringTypeMap.clear() sequenceTypeMap.clear() fixedTypeMap.clear() declaredTypeMap.clear() synopsis-0.12/Synopsis/Parsers/IDL/aclocal.m40000664000076400007640000000120311171624006020367 0ustar stefanstefan# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_include([../../../config/python_ext.m4]) synopsis-0.12/Synopsis/Parsers/IDL/idlvisitor.h0000664000076400007640000001057311104703262021100 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idlvisitor.h Created on: 1999/10/11 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Visitor base class // $Id: idlvisitor.h,v 1.6.2.1 2003/03/23 21:01:43 dgrisby Exp $ // $Log: idlvisitor.h,v $ // Revision 1.6.2.1 2003/03/23 21:01:43 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.3.2.2 2000/11/01 12:45:57 dpg1 // Update to CORBA 2.4 specification. // // Revision 1.3.2.1 2000/07/17 10:36:06 sll // Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0. // // Revision 1.4 2000/07/13 15:25:52 dpg1 // Merge from omni3_develop for 3.0 release. // // Revision 1.1 1999/10/27 14:05:52 dpg1 // *** empty log message *** // #ifndef _idlvisitor_h_ #define _idlvisitor_h_ // // Visitor for AST // class AST; class Module; class Interface; class Forward; class Const; class ArraySize; class TypedefDeclarator; class Typedef; class Declarator; class Member; class Struct; class StructForward; class Exception; class CaseLabel; class UnionCase; class Union; class UnionForward; class Enumerator; class Enum; class Attribute; class Parameter; class Operation; class Native; class StateMember; class Factory; class ValueForward; class ValueBox; class ValueInheritSpec; class ValueAbs; class Value; class AstVisitor { public: AstVisitor() {} virtual ~AstVisitor() {} virtual void visitAST (AST*) { } virtual void visitModule (Module*) { } virtual void visitInterface (Interface*) { } virtual void visitForward (Forward*) { } virtual void visitConst (Const*) { } virtual void visitDeclarator (Declarator*) { } virtual void visitTypedef (Typedef*) { } virtual void visitMember (Member*) { } virtual void visitStruct (Struct*) { } virtual void visitStructForward (StructForward*) { } virtual void visitException (Exception*) { } virtual void visitCaseLabel (CaseLabel*) { } virtual void visitUnionCase (UnionCase*) { } virtual void visitUnion (Union*) { } virtual void visitUnionForward (UnionForward*) { } virtual void visitEnumerator (Enumerator*) { } virtual void visitEnum (Enum*) { } virtual void visitAttribute (Attribute*) { } virtual void visitParameter (Parameter*) { } virtual void visitOperation (Operation*) { } virtual void visitNative (Native*) { } virtual void visitStateMember (StateMember*) { } virtual void visitFactory (Factory*) { } virtual void visitValueForward (ValueForward*) { } virtual void visitValueBox (ValueBox*) { } virtual void visitValueAbs (ValueAbs*) { } virtual void visitValue (Value*) { } }; // // Visitor for types // class BaseType; class StringType; class WStringType; class SequenceType; class FixedType; class DeclaredType; class TypeVisitor{ public: TypeVisitor() {} virtual ~TypeVisitor() {} virtual void visitBaseType (BaseType*) { } virtual void visitStringType (StringType*) { } virtual void visitWStringType (WStringType*) { } virtual void visitSequenceType(SequenceType*) { } virtual void visitFixedType (FixedType*) { } virtual void visitDeclaredType(DeclaredType*) { } }; #endif // _idlvisitor_h_ synopsis-0.12/Synopsis/Parsers/IDL/omni.py0000664000076400007640000004342011104703261020047 0ustar stefanstefan# # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import IR, ASG from Synopsis.QualifiedName import QualifiedCxxName as QName from Synopsis.SourceFile import * import idlast, idltype, idlvisitor, idlutil import _omniidl import sys, getopt, os, os.path, string, types sourcefile = None def strip_filename(filename): "This is aliased as strip if -b used and basename set" if len(basename) > len(filename): return filename if filename[:len(basename)] == basename: return filename[len(basename):] return filename class TypeTranslator(idlvisitor.TypeVisitor): """maps idltype objects to ASG.TypeId objects in a ASG.Dictionary""" def __init__(self, types): self.types = types self.__result = None self.__basetypes = {idltype.tk_void: QName(('void',)), idltype.tk_short: QName(('short',)), idltype.tk_long: QName(('long',)), idltype.tk_ushort: QName(('unsigned short',)), idltype.tk_ulong: QName(('unsigned long',)), idltype.tk_float: QName(('float',)), idltype.tk_double: QName(('double',)), idltype.tk_boolean: QName(('boolean',)), idltype.tk_char: QName(('char',)), idltype.tk_octet: QName(('octet',)), idltype.tk_any: QName(('any',)), idltype.tk_TypeCode: QName(('CORBA','TypeCode',)), idltype.tk_Principal: QName(('CORBA','Principal',)), idltype.tk_longlong: QName(('long long',)), idltype.tk_ulonglong: QName(('unsigned long long',)), idltype.tk_longdouble: QName(('long double',)), idltype.tk_wchar: QName(('wchar',))} def internalize(self, idltype): idltype.accept(self) return self.__result def has_key(self, name): return self.types.has_key(name) def add(self, name, type): self.types[name] = type def get(self, name): return self.types[name] def visitBaseType(self, idltype): type = ASG.BuiltinTypeId('IDL', self.__basetypes[idltype.kind()]) self.types[type.name] = type self.__result = type.name def visitStringType(self, idltype): # FIXME: Should we create a ParametrizedTypeId with the appropriate bound parameters ? if idltype.bound() == 0: qname = QName(('string',)) else: qname = QName(('string<%s>'%idltype.bound(),)) if qname not in self.types: self.types[qname] = ASG.BuiltinTypeId('IDL', qname) self.__result = qname def visitWStringType(self, idltype): # FIXME: Should we create a ParametrizedTypeId with the appropriate bound parameters ? if idltype.bound() == 0: qname = QName(('wstring',)) else: qname = QName(('wstring<%s>'%idltype.bound(),)) if qname not in self.types: self.types[qname] = ASG.BuiltinTypeId('IDL', qname) self.__result = qname def visitSequenceType(self, idltype): qname = QName(('sequence',)) if not self.types.has_key(qname): self.types[qname] = ASG.BuiltinTypeId("IDL", qname) idltype.seqType().accept(self) ptype = self.types[self.__result] type = ASG.ParametrizedTypeId("IDL", self.types[qname], [ptype]) qname = QName(('sequence<%s>'%str(ptype.name),)) self.types[qname] = type self.__result = qname def visitDeclaredType(self, idltype): self.__result = QName(idltype.decl().scopedName()) class ASGTranslator(idlvisitor.AstVisitor): def __init__(self, declarations, types, primary_file_only): self.declarations = declarations self.primary_file_only = primary_file_only self.types = types self.__scope = [] self.__operation = None self.__enum = None def scope(self): return self.__scope[-1].name def add_declaration(self, declaration): self.__scope[-1].declarations.append(declaration) def addType(self, name, type): if self.types.has_key(name): if isinstance(self.types.get(name), ASG.UnknownTypeId): self.types.add(name, type) else: pass return self.types.add(name, type) def getType(self, name): return self.types.get(QName(name)) def visitAST(self, node): self.__scope.append(ASG.Scope(sourcefile, 0, 'file', QName())) # add an 'Object' Type to the Type Dictionary. Don't declare it in the ASG since # there is no corresponding declaration qname = QName(('CORBA', 'Object')) object = ASG.Class(sourcefile, 0, 'interface', qname) self.addType(qname, ASG.DeclaredTypeId('IDL', qname, object)) for n in node.declarations(): n.accept(self) for d in self.__scope[-1].declarations: self.declarations.append(d) def visitModule(self, node): visible = node.mainFile() or not self.primary_file_only qname = QName(list(self.scope()) + [node.identifier()]) module = ASG.Module(sourcefile, node.line(), 'module', qname) if visible: self.add_declaration(module) self.__scope.append(module) self.addType(qname, ASG.DeclaredTypeId('IDL', qname, module)) if not self.primary_file_only or node.mainFile(): comments = [c.text() for c in node.comments()] if comments: module.annotations['comments'] = comments for n in node.definitions(): n.accept(self) self.__scope.pop() def visitInterface(self, node): visible = node.mainFile() or not self.primary_file_only qname = QName(list(self.scope()) + [node.identifier()]) class_ = ASG.Class(sourcefile, node.line(), 'interface', qname) if visible: self.add_declaration(class_) self.__scope.append(class_) self.addType(qname, ASG.DeclaredTypeId('IDL', qname, class_)) if not self.primary_file_only or node.mainFile(): comments = [c.text() for c in node.comments()] if comments: class_.annotations['comments'] = comments for i in node.inherits(): parent = self.getType(i.scopedName()) class_.parents.append(ASG.Inheritance("", parent, [])) for c in node.contents(): c.accept(self) self.__scope.pop() def visitForward(self, node): visible = node.mainFile() or not self.primary_file_only name = list(self.scope()) qname = QName(name + [node.identifier()]) forward = ASG.Forward(sourcefile, node.line(), 'interface', qname) if visible: self.add_declaration(forward) self.addType(qname, ASG.UnknownTypeId('IDL', qname)) def visitConst(self, node): visible = node.mainFile() or not self.primary_file_only name = list(self.scope()) qname = QName(name + [node.identifier()]) type = self.types.internalize(node.constType()) if node.constType().kind() == idltype.tk_enum: value = "::" + idlutil.ccolonName(node.value().scopedName()) else: value = str(node.value()) const = ASG.Const(sourcefile, node.line(), 'const', self.getType(type), qname, value) if visible: self.add_declaration(const) comments = [c.text() for c in node.comments()] if comments: const.annotations['comments'] = comments def visitTypedef(self, node): visible = node.mainFile() or not self.primary_file_only # if this is an inline constructed type, it is a 'Declared' type # and we need to visit the declaration first if node.constrType(): node.aliasType().decl().accept(self) type = self.types.internalize(node.aliasType()) comments = [c.text() for c in node.comments()] for d in node.declarators(): # reinit the type for this declarator, as each declarator of # a single typedef declaration can have a different type. *sigh* dtype = type if d.sizes(): array = ASG.ArrayTypeId('IDL', self.getType(type), [str(s) for s in d.sizes()]) dtype = map(None, type[:-1]) dtype.append(type[-1] + string.join(map(lambda s:"["+ str(s) +"]", d.sizes()),'')) self.addType(QName(dtype), array) name = list(self.scope()) qname = QName(name + [d.identifier()]) typedef = ASG.Typedef(sourcefile, node.line(), 'typedef', qname, self.getType(dtype), node.constrType()) d_comments = comments + [c.text() for c in d.comments()] if d_comments: typedef.annotations['comments'] = d_comments self.addType(qname, ASG.DeclaredTypeId('IDL', qname, typedef)) if visible: self.add_declaration(typedef) def visitMember(self, node): visible = node.mainFile() or not self.primary_file_only # if this is an inline constructed type, it is a 'Declared' type # and we need to visit the declaration first if node.constrType(): node.memberType().decl().accept(self) type = self.types.internalize(node.memberType()) comments = [c.text() for c in node.comments()] for d in node.declarators(): # reinit the type for this declarator, as each declarator of # a single typedef declaration can have a different type. *sigh* dtype = type if d.sizes(): array = ASG.ArrayTypeId('IDL', self.getType(type), [str(s) for s in node.sizes()]) dtype = type[:-1] dtype.append(type[-1] + string.join(map(lambda s:"["+s+"]", d.sizes()),'')) self.addType(dtype, array) qname = QName(list(self.scope()) + [d.identifier()]) member = ASG.Variable(sourcefile, node.line(), 'variable', qname, self.getType(dtype), node.constrType()) d_comments = comments + [c.text() for c in d.comments()] if d_comments: member.annotations['comments'] = d_comments self.addType(qname, ASG.DeclaredTypeId('IDL', qname, member)) if visible: self.add_declaration(member) def visitStruct(self, node): visible = node.mainFile() or not self.primary_file_only qname = QName(list(self.scope()) + [node.identifier()]) if self.primary_file_only and not node.mainFile(): forward = ASG.Forward(sourcefile, node.line(), 'struct', qname) if visible: self.add_declaration(forward) self.addType(qname, ASG.DeclaredTypeId('IDL', qname, forward)) return struct = ASG.Class(sourcefile, node.line(), 'struct', qname) if visible: self.add_declaration(struct) self.addType(qname, ASG.DeclaredTypeId('IDL', qname, struct)) comments = [c.text() for c in node.comments()] if comments: struct.annotations['comments'] = comments self.__scope.append(struct) for member in node.members(): member.accept(self) self.__scope.pop() def visitException(self, node): visible = node.mainFile() or not self.primary_file_only qname = QName(list(self.scope()) + [node.identifier()]) if self.primary_file_only and not node.mainFile(): forward = ASG.Forward(sourcefile, node.line(), 'exception', qname) if visible: self.add_declaration(forward) self.addType(qname, ASG.DeclaredTypeId('IDL', qname, forward)) return exc = ASG.Class(sourcefile, node.line(), 'exception', qname) if visible: self.add_declaration(exc) self.addType(qname, ASG.DeclaredTypeId('IDL', qname, exc)) self.__scope.append(exc) comments = [c.text() for c in node.comments()] if comments: exc.annotations['comments'] = comments for member in node.members(): member.accept(self) self.__scope.pop() # def visitCaseLabel(self, node): return def visitUnionCase(self, node): # if this is an inline constructed type, it is a 'Declared' type # and we need to visit the declaration first if node.constrType(): node.caseType().decl().accept(self) type = self.types.internalize(node.caseType()) declarator = node.declarator() if declarator.sizes(): array = ASG.ArrayTypeId('IDL', self.getType(type), [str(s) for s in declarator.sizes()]) type = type[:-1] type.append(type[-1] + string.join(map(lambda s:"["+s+"]",node.sizes()),'')) self.addType(type, array) qname = QName(list(self.scope()) + [node.declarator().identifier()]) self.__scope[-1].declarations.append( ASG.Operation(sourcefile, node.line(), 'case', [], self.getType(type), [], qname, qname[-1])) def visitUnion(self, node): visible = node.mainFile() or not self.primary_file_only qname = QName(list(self.scope()) + [node.identifier()]) if self.primary_file_only and not node.mainFile(): forward = ASG.Forward(sourcefile, node.line(), 'union', qname) if visible: self.add_declaration(forward) self.addType(qname, ASG.DeclaredTypeId('IDL', qname, forward)) return class_ = ASG.Class(sourcefile, node.line(), 'union', qname) self.add_declaration(class_) self.__scope.append(class_) self.addType(qname, ASG.DeclaredTypeId('IDL', qname, class_)) comments = [c.text() for c in node.comments()] if comments: class_.annotations['comments'] = comments for c in node.cases(): c.accept(self) self.__scope.pop() def visitEnumerator(self, node): qname = QName(list(self.scope()) + [node.identifier()]) enum = ASG.Enumerator(sourcefile, node.line(), qname, '') self.addType(qname, ASG.DeclaredTypeId('IDL', qname, enum)) self.__enum.enumerators.append(enum) def visitEnum(self, node): visible = node.mainFile() or not self.primary_file_only qname = QName(list(self.scope()) + [node.identifier()]) if self.primary_file_only and not node.mainFile(): forward = ASG.Forward(sourcefile, node.line(), 'enum', qname) if visible: self.add_declaration(forward) self.addType(qname, ASG.DeclaredTypeId('IDL', qname, forward)) return self.__enum = ASG.Enum(sourcefile, node.line(), qname, []) if visible: self.add_declaration(self.__enum) self.addType(qname, ASG.DeclaredTypeId('IDL', qname, self.__enum)) comments = [c.text() for c in node.comments()] if comments: self.__enum.annotations['comments'] = comments for enumerator in node.enumerators(): enumerator.accept(self) self.__enum = None def visitAttribute(self, node): visible = node.mainFile() or not self.primary_file_only scopename = list(self.scope()) if self.primary_file_only and not node.mainFile(): return # Add real Operation objects pre = [] if node.readonly(): pre.append("readonly") type = self.types.internalize(node.attrType()) comments = [c.text() for c in node.comments()] for id in node.identifiers(): qname = QName(scopename + [id]) attr = ASG.Operation(sourcefile, node.line(), 'attribute', pre, self.getType(type), [], qname, qname[-1]) if comments: attr.annotations['comments'] = comments if visible: self.add_declaration(attr) def visitParameter(self, node): operation = self.__operation pre = [] if node.direction() == 0: pre.append("in") elif node.direction() == 1: pre.append("out") else: pre.append("inout") post = [] name = self.types.internalize(node.paramType()) operation.parameters.append(ASG.Parameter(pre, self.getType(name), post, node.identifier())) def visitOperation(self, node): visible = node.mainFile() or not self.primary_file_only pre = [] if node.oneway(): pre.append("oneway") return_type = self.types.internalize(node.returnType()) qname = QName(list(self.scope()) + [node.identifier()]) self.__operation = ASG.Operation(sourcefile, node.line(), 'operation', pre, self.getType(return_type), [], qname, qname[-1]) comments = [c.text() for c in node.comments()] if comments: self.__operation.annotations['comments'] = comments for p in node.parameters(): p.accept(self) for e in node.raises(): exception = self.getType(e.scopedName()) self.__operation.exceptions.append(exception) if visible: self.add_declaration(self.__operation) self.__operation = None # def visitNative(self, node): return # def visitStateMember(self, node): return # def visitFactory(self, node): return # def visitValueForward(self, node): return # def visitValueBox(self, node): return # def visitValueAbs(self, node): return # def visitValue(self, node): return def parse(ir, cppfile, src, primary_file_only, base_path, verbose, debug): global basename, strip, sourcefile if base_path: basename = base_path _omniidl.keepComments(1) _omniidl.noForwardWarning() tree = _omniidl.compile(open(cppfile, 'r+')) if tree == None: sys.stderr.write("omni: Error parsing %s\n"%cppfile) sys.exit(1) sourcefile = SourceFile(strip_filename(src), src, 'IDL') sourcefile.annotations['primary'] = True new_ir = IR.IR() new_ir.files[sourcefile.name] = sourcefile type_trans = TypeTranslator(new_ir.asg.types) ast_trans = ASGTranslator(new_ir.asg.declarations, type_trans, primary_file_only) tree.accept(ast_trans) sourcefile.declarations[:] = new_ir.asg.declarations ir.merge(new_ir) _omniidl.clear() return ir synopsis-0.12/Synopsis/Parsers/IDL/idl.yy0000664000076400007640000011501311104703261017664 0ustar stefanstefan// -*- c++ -*- // Package : omniidl // idl.yy Created on: 1999/10/05 // Author : Duncan Grisby (dpg1) // // Copyright (C) 1999 AT&T Laboratories Cambridge // // This file is part of omniidl. // // omniidl is free software; you can redistribute 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. // // Description: // // Bison parser // $Id: idl.yy,v 1.15.2.2 2003/09/04 14:00:23 dgrisby Exp $ // $Log: idl.yy,v $ // Revision 1.15.2.2 2003/09/04 14:00:23 dgrisby // ValueType IDL updates. // // Revision 1.15.2.1 2003/03/23 21:01:48 dgrisby // Start of omniORB 4.1.x development branch. // // Revision 1.11.2.7 2001/08/29 11:54:19 dpg1 // Clean up const handling in IDL compiler. // // Revision 1.11.2.6 2001/03/13 10:32:10 dpg1 // Fixed point support. // // Revision 1.11.2.5 2000/12/05 17:45:18 dpg1 // omniidl case sensitivity updates from omni3_develop. // // Revision 1.11.2.4 2000/11/01 12:45:55 dpg1 // Update to CORBA 2.4 specification. // // Revision 1.11.2.3 2000/10/27 16:31:07 dpg1 // Clean up of omniidl dependencies and types, from omni3_develop. // // Revision 1.11.2.2 2000/10/10 10:18:50 dpg1 // Update omniidl front-end from omni3_develop. // // Revision 1.9.2.5 2000/08/01 11:27:45 dpg1 // Comments were incorrectly attached to struct members. // // Revision 1.9.2.4 2000/06/09 11:20:47 dpg1 // Last fix put __omni_pragma line numbers off by one... // // Revision 1.9.2.3 2000/06/08 14:58:19 dpg1 // Line numbers for #pragmas and // comments were off by one // // Revision 1.9.2.2 2000/06/08 14:36:19 dpg1 // Comments and pragmas are now objects rather than plain strings, so // they can have file,line associated with them. // // Revision 1.9.2.1 2000/06/05 18:13:26 dpg1 // Comments can be attached to subsequent declarations (with -K). Better // idea of most recent decl in operation declarations // // Revision 1.9 2000/02/04 12:17:09 dpg1 // Support for VMS. // // Revision 1.8 1999/12/28 18:16:07 dpg1 // positive_int_const isn't allowed to be zero. // // Revision 1.7 1999/11/17 17:17:00 dpg1 // Changes to remove static initialisation of objects. // // Revision 1.6 1999/11/04 17:16:55 dpg1 // Changes for NT. // // Revision 1.5 1999/11/03 17:24:05 dpg1 // Added optional pragmas all over the place. // // Revision 1.4 1999/11/02 17:07:28 dpg1 // Changes to compile on Solaris. // // Revision 1.3 1999/11/01 20:19:57 dpg1 // Support for union switch types declared inside the switch statement. // // Revision 1.2 1999/10/29 15:41:31 dpg1 // DeclaredType() now takes extra DeclRepoId* argument. // // Revision 1.1 1999/10/27 14:06:00 dpg1 // *** empty log message *** // %{ #include #include #include #include #include #include #include #include #include #define YYDEBUG 1 // Globals from lexer extern int yylineno; extern char* currentFile; extern IDL_Boolean mainFile; void yyerror(char *s) { } extern int yylex(); // Nasty hack for abstract valuetypes ValueAbs* valueabs_hack = 0; #ifdef __VMS /* Apparently, __ALLOCA is defined for some versions of the C (but not C++) compiler on VAX. */ #if defined(__ALPHA) || defined(__DECC) && __DECC_VER >= 60000000 #include #define alloca __ALLOCA #else #define alloca malloc #endif #endif %} %union { char* id_val; int int_val; IDL_ULong ulong_val; IdlIntLiteral int_literal_val; #ifndef __VMS IdlFloatLiteral float_literal_val; #else double float_literal_val; #endif char char_val; char* string_val; IDL_WChar wchar_val; IDL_WChar* wstring_val; IDL_Boolean boolean_val; IDL_Fixed* fixed_val; IdlType* type_val; TypeSpec* type_spec_val; IdlExpr* expr_val; ScopedName* scopedname_val; Decl* decl_val; Module* module_val; Interface* interface_val; InheritSpec* inheritspec_val; Forward* forward_val; Const* const_val; Typedef* typedef_val; Struct* struct_val; Exception* exception_val; Member* member_val; Declarator* declarator_val; Union* union_val; UnionCase* union_case_val; CaseLabel* case_label_val; ValueBase* value_base_val; Value* value_val; ValueForward* value_forward_val; ValueBox* value_box_val; ValueAbs* value_abs_val; ValueInheritSpec* valueinheritspec_val; ValueInheritSupportSpec* valueinheritsupportspec_val; StateMember* statemember_val; Factory* factory_val; Enumerator* enumerator_val; Enum* enum_val; ArraySize* array_size_val; Attribute* attribute_val; Operation* operation_val; Parameter* parameter_val; RaisesSpec* raisesspec_val; ContextSpec* contextspec_val; } %token IDENTIFIER // Keywords %token ABSTRACT %token ANY %token ATTRIBUTE %token BOOLEAN %token CASE %token CHAR %token CONST %token CONTEXT %token CUSTOM %token DEFAULT %token DOUBLE %token ENUM %token EXCEPTION %token FACTORY %token FALSE_ %token FIXED %token FLOAT %token IN %token INOUT %token INTERFACE %token LOCAL %token LONG %token MODULE %token NATIVE %token OBJECT %token OCTET %token ONEWAY %token OUT %token PRIVATE %token PUBLIC %token RAISES %token READONLY %token SEQUENCE %token SHORT %token STRING %token STRUCT %token SUPPORTS %token SWITCH %token TRUE_ %token TRUNCATABLE %token TYPEDEF %token UNION %token UNSIGNED %token VALUEBASE %token VALUETYPE %token VOID %token WCHAR %token WSTRING // Pragmas %token PRAGMA %token PRAGMA_PREFIX %token PRAGMA_ID %token PRAGMA_VERSION %token OMNI_PRAGMA %token END_PRAGMA %token UNKNOWN_PRAGMA_BODY // Literals %token INTEGER_LITERAL %token CHARACTER_LITERAL %token WIDE_CHARACTER_LITERAL %token FLOATING_PT_LITERAL %token STRING_LITERAL %token WIDE_STRING_LITERAL %token FIXED_PT_LITERAL // Scope delimiter %token SCOPE_DELIM // Operators %token LEFT_SHIFT %token RIGHT_SHIFT // Types of nonterminals %type start %type definition_plus %type definition %type module %type module_header %type interface %type interface_dcl %type forward_dcl %type interface_header %type interface_body %type export_star %type export %type interface_inheritance_spec_opt %type interface_inheritance_spec %type interface_inheritance_list %type interface_name %type scoped_name %type value %type value_forward_dcl %type abstract_local_opt %type value_box_dcl %type value_abs_dcl %type value_dcl %type value_header %type value_inheritance_spec %type value_value_inheritance_spec %type truncatable_opt %type value_inheritance_list %type value_name %type value_element_star %type value_element %type state_member %type member_access %type init_dcl %type init_dcl_header %type init_param_decls_opt %type init_param_decls %type init_param_decl %type const_dcl %type const_type %type const_exp %type or_expr %type xor_expr %type and_expr %type shift_expr %type add_expr %type mult_expr %type unary_expr %type unary_operator %type primary_expr %type literal %type boolean_literal %type string_literal_plus %type wide_string_literal_plus %type positive_int_const %type type_dcl %type type_declarator %type type_spec %type simple_type_spec %type base_type_spec %type template_type_spec %type constr_type_spec %type declarators %type declarator %type simple_declarator %type complex_declarator %type floating_pt_type %type integer_type %type signed_int %type signed_short_int %type signed_long_int %type signed_long_long_int %type unsigned_int %type unsigned_short_int %type unsigned_long_int %type unsigned_long_long_int %type char_type %type wide_char_type %type boolean_type %type octet_type %type any_type %type object_type %type struct_type %type struct_header %type member_list %type member %type union_type %type union_header %type switch_type_spec %type switch_body %type case_plus %type case %type case_label_plus %type case_label %type element_spec %type enum_type %type enum_header %type enumerator_list %type enumerator %type sequence_type %type string_type %type wide_string_type %type array_declarator %type fixed_array_size_plus %type fixed_array_size %type attr_dcl %type readonly_opt %type simple_declarator_list %type except_dcl %type except_header %type member_star %type op_dcl %type op_header %type op_attribute_opt %type op_attribute %type op_type_spec %type parameter_dcls %type param_dcl_list %type param_dcl %type param_attribute %type raises_expr_opt %type raises_expr %type scoped_name_list %type context_expr_opt %type context_expr %type string_literal_list %type param_type_spec %type fixed_pt_type %type fixed_pt_const_type %type value_base_type %type constr_forward_decl %type unknown_pragma_body_plus %% start: /* empty */ { $$ = 0; } | definition_plus { $$ = $1; AST::tree()->setDeclarations($1); } ; definition_plus: definition { $$ = $1; } | definition_plus definition { if ($1) { $1->append($2); $$ = $1; } else $$ = $2; } ; definition: type_dcl ';' { $$ = $1; } | const_dcl ';' { $$ = $1; } | except_dcl ';' { $$ = $1; } | interface ';' { $$ = $1; } | module ';' { $$ = $1; } | value ';' { $$ = $1; } | pragma { $$ = 0; } | pragma_prefix { $$ = 0; } | error { IdlSyntaxError(currentFile, yylineno, "Syntax error in definition"); $$ = 0; } ; module: module_header pragmas_opt '{' definition_plus '}' { $1->finishConstruction($4); $$ = $1; } | module_header error { IdlSyntaxError(currentFile, yylineno, "Syntax error in module definition"); } '{' definition_plus '}' { $1->finishConstruction($5); $$ = $1; } | module_header error { IdlSyntaxError(currentFile, yylineno, "Syntax error in module definition (no body found)"); $1->finishConstruction(0); $$ = $1; } ; module_header: MODULE IDENTIFIER { $$ = new Module(currentFile, yylineno, mainFile, $2); } ; interface: interface_dcl { $$ = $1; } | forward_dcl { $$ = $1; } ; interface_dcl: interface_header '{' interface_body '}' { $1->finishConstruction($3); $$ = $1; } | interface_header error { IdlSyntaxError(currentFile, yylineno, "Syntax error in interface definition"); } '{' interface_body '}' { $1->finishConstruction($5); $$ = $1; } | interface_header error { IdlSyntaxError(currentFile, yylineno, "Syntax error in interface definition (no body found)"); $1->finishConstruction(0); $$ = $1; } ; forward_dcl: abstract_local_opt INTERFACE IDENTIFIER { $$ = new Forward(currentFile, yylineno, mainFile, $3, $1==1, $1==2); } ; interface_header: abstract_local_opt INTERFACE IDENTIFIER pragmas_opt interface_inheritance_spec_opt { $$ = new Interface(currentFile, yylineno, mainFile, $3, $1==1, $1==2, $5); } ; abstract_local_opt: /* empty */ { $$ = 0; } | ABSTRACT { $$ = 1; } | LOCAL { $$ = 2; } ; interface_body: export_star { $$ = $1; } ; export_star: /* empty */ { $$ = 0; } | export_star export { if ($1) { $1->append($2); $$ = $1; } else $$ = $2; } ; export: type_dcl ';' { $$ = $1; } | const_dcl ';' { $$ = $1; } | except_dcl ';' { $$ = $1; } | attr_dcl ';' { $$ = $1; } | op_dcl ';' { $$ = $1; } | pragma { $$ = 0; } | error { IdlSyntaxError(currentFile, yylineno, "Syntax error in interface body"); $$ = 0; } ; interface_inheritance_spec_opt: /* empty */ { $$ = 0; } | interface_inheritance_spec { $$ = $1; } ; interface_inheritance_spec: ':' interface_inheritance_list { $$ = $2; } ; interface_inheritance_list: interface_name pragmas_opt { $$ = new InheritSpec($1, currentFile, yylineno); if (!$$->interface()) { delete $$; $$ = 0; } } | interface_inheritance_list ',' pragmas_opt interface_name pragmas_opt { if ($1) { $1->append(new InheritSpec($4, currentFile, yylineno), currentFile, yylineno); $$ = $1; } else $$ = new InheritSpec($4, currentFile, yylineno); } | error { IdlSyntaxError(currentFile, yylineno, "Syntax error in inheritance list"); $$ = 0; } ; interface_name: scoped_name { $$ = $1; } ; scoped_name: IDENTIFIER { $$ = new ScopedName($1, 0); } | SCOPE_DELIM IDENTIFIER { $$ = new ScopedName($2, 1); } | scoped_name SCOPE_DELIM IDENTIFIER { $1->append($3); $$=$1; } ; /* The obvious way to specify valuetypes isn't LALR(1), but the following is: */ value: value_dcl { $$ = $1; } | value_abs_dcl { $$ = $1; } | value_box_dcl { $$ = $1; } | value_forward_dcl { $$ = $1; } ; value_forward_dcl: VALUETYPE IDENTIFIER { $$ = new ValueForward(currentFile, yylineno, mainFile, 0, $2); } | ABSTRACT VALUETYPE IDENTIFIER { $$ = new ValueForward(currentFile, yylineno, mainFile, 1, $3); } ; value_box_dcl: VALUETYPE IDENTIFIER type_spec { $$ = new ValueBox(currentFile, yylineno, mainFile, $2, $3->type(), $3->constr()); delete $3; } ; value_abs_dcl: ABSTRACT VALUETYPE IDENTIFIER { valueabs_hack = new ValueAbs(currentFile, yylineno, mainFile, $3, 0, 0); } '{' export_star '}' { valueabs_hack->finishConstruction($6); $$ = valueabs_hack; valueabs_hack = 0; } | ABSTRACT VALUETYPE IDENTIFIER value_inheritance_spec { valueabs_hack = new ValueAbs(currentFile, yylineno, mainFile, $3, $4->inherits(), $4->supports()); delete $4; } '{' export_star '}' { valueabs_hack->finishConstruction($7); $$ = valueabs_hack; valueabs_hack = 0; } | error { IdlSyntaxError(currentFile, yylineno, "Syntax error in abstract valuetype"); if (valueabs_hack) { valueabs_hack->finishConstruction(0); $$ = valueabs_hack; valueabs_hack = 0; } else $$ = 0; } ; value_dcl: value_header '{' value_element_star '}' { $1->finishConstruction($3); $$ = $1; } ; value_header: VALUETYPE IDENTIFIER value_inheritance_spec { $$ = new Value(currentFile, yylineno, mainFile, 0, $2, $3->inherits(), $3->supports()); delete $3; } | CUSTOM VALUETYPE IDENTIFIER value_inheritance_spec { $$ = new Value(currentFile, yylineno, mainFile, 1, $3, $4->inherits(), $4->supports()); delete $4; } | VALUETYPE IDENTIFIER { $$ = new Value(currentFile, yylineno, mainFile, 0, $2, 0, 0); } | CUSTOM VALUETYPE IDENTIFIER { $$ = new Value(currentFile, yylineno, mainFile, 1, $3, 0, 0); } ; value_inheritance_spec: ':' value_value_inheritance_spec SUPPORTS interface_inheritance_list { $$ = new ValueInheritSupportSpec($2, $4); } | ':' value_value_inheritance_spec { $$ = new ValueInheritSupportSpec($2, 0); } | SUPPORTS interface_inheritance_list { $$ = new ValueInheritSupportSpec(0, $2); } ; value_value_inheritance_spec: truncatable_opt value_inheritance_list { if ($1) $2->setTruncatable(); $$ = $2; } ; truncatable_opt: /* empty */ { $$ = 0; } | TRUNCATABLE { $$ = 1; } ; value_inheritance_list: value_name { $$ = new ValueInheritSpec($1, currentFile, yylineno); if (!$$->value()) { delete $$; $$ = 0; } } | value_inheritance_list ',' value_name { if ($1) { $1->append(new ValueInheritSpec($3, currentFile, yylineno), currentFile, yylineno); $$ = $1; } else $$ = new ValueInheritSpec($3, currentFile, yylineno); } ; value_name: scoped_name { $$ = $1; } ; value_element_star: /* empty */ { $$ = 0; } | value_element_star value_element { if ($1) { $1->append($2); $$ = $1; } else $$ = $2; } ; value_element: export { $$ = $1; } | state_member { $$ = $1; } | init_dcl { $$ = $1; } ; state_member: member_access type_spec declarators ';' { $$ = new StateMember(currentFile, yylineno, mainFile, $1, $2->type(), $2->constr(), $3); delete $2; } ; member_access: PUBLIC { $$ = 0; } | PRIVATE { $$ = 1; } ; init_dcl: init_dcl_header '(' init_param_decls_opt ')' { $1->closeParens(); } raises_expr_opt ';' { $1->finishConstruction($3, $6); $$ = $1; } | init_dcl_header '(' error ')' { $1->closeParens(); } ';' { IdlSyntaxError(currentFile, yylineno, "Syntax error in factory parameters"); $1->finishConstruction(0, 0); $$ = $1; } ; init_dcl_header: FACTORY IDENTIFIER { $$ = new Factory(currentFile, yylineno, mainFile, $2); } ; init_param_decls_opt: /* empty */ { $$ = 0; } | init_param_decls { $$ = $1; } ; init_param_decls: init_param_decl { $$ = $1; } | init_param_decls ',' init_param_decl { if ($1) { $1->append($3); $$ = $1; } else $$ = $3; } ; init_param_decl: IN param_type_spec IDENTIFIER { $$ = new Parameter(currentFile, yylineno, mainFile, 0, $2, $3); } ; // End of ValueType nastiness const_dcl: CONST const_type IDENTIFIER '=' const_exp { $$ = new Const(currentFile, yylineno, mainFile, $2, $3, $5); } ; const_type: integer_type { $$ = $1; } | char_type { $$ = $1; } | wide_char_type { $$ = $1; } | boolean_type { $$ = $1; } | floating_pt_type { $$ = $1; } | string_type { $$ = $1; } | wide_string_type { $$ = $1; } | fixed_pt_const_type { $$ = $1; } | scoped_name { $$ = IdlType::scopedNameToType(currentFile, yylineno, $1); } | octet_type { $$ = $1; } ; const_exp: or_expr { $$ = $1; } ; or_expr: xor_expr { $$ = $1; } | or_expr '|' xor_expr { $$ = new OrExpr(currentFile, yylineno, $1, $3); } ; xor_expr: and_expr { $$ = $1; } | xor_expr '^' and_expr { $$ = new XorExpr(currentFile, yylineno, $1, $3); } ; and_expr: shift_expr { $$ = $1; } | and_expr '&' shift_expr { $$ = new AndExpr(currentFile, yylineno, $1, $3); } ; shift_expr: add_expr { $$ = $1; } | shift_expr RIGHT_SHIFT add_expr { $$ = new RShiftExpr(currentFile, yylineno, $1, $3); } | shift_expr LEFT_SHIFT add_expr { $$ = new LShiftExpr(currentFile, yylineno, $1, $3); } ; add_expr: mult_expr { $$ = $1; } | add_expr '+' mult_expr { $$ = new AddExpr(currentFile, yylineno, $1, $3); } | add_expr '-' mult_expr { $$ = new SubExpr(currentFile, yylineno, $1, $3); } ; mult_expr: unary_expr { $$ = $1; } | mult_expr '*' unary_expr { $$ = new MultExpr(currentFile, yylineno, $1, $3); } | mult_expr '/' unary_expr { $$ = new DivExpr(currentFile, yylineno, $1, $3); } | mult_expr '%' unary_expr { $$ = new ModExpr(currentFile, yylineno, $1, $3); } ; unary_expr: unary_operator primary_expr { if ($1 == '-') $$ = new MinusExpr(currentFile, yylineno, $2); if ($1 == '+') $$ = new PlusExpr(currentFile, yylineno, $2); if ($1 == '~') $$ = new InvertExpr(currentFile, yylineno, $2); } | primary_expr { $$ = $1; } ; unary_operator: '-' { $$ = '-'; } | '+' { $$ = '+'; } | '~' { $$ = '~'; } ; primary_expr: scoped_name { $$ = IdlExpr::scopedNameToExpr(currentFile, yylineno, $1); } | literal { $$ = $1; } | '(' const_exp ')' { $$ = $2; } ; literal: INTEGER_LITERAL { $$ = new IntegerExpr(currentFile, yylineno, $1); } | string_literal_plus { $$ = new StringExpr(currentFile, yylineno, $1); } | wide_string_literal_plus { $$ = new WStringExpr(currentFile, yylineno, $1); } | CHARACTER_LITERAL { $$ = new CharExpr(currentFile, yylineno, $1); } | WIDE_CHARACTER_LITERAL { $$ = new WCharExpr(currentFile, yylineno, $1); } | FIXED_PT_LITERAL { $$ = new FixedExpr(currentFile, yylineno, $1); } | FLOATING_PT_LITERAL { $$ = new FloatExpr(currentFile, yylineno, $1); } | boolean_literal { $$ = new BooleanExpr(currentFile, yylineno, $1); } ; string_literal_plus: STRING_LITERAL { $$ = $1; } | string_literal_plus STRING_LITERAL { $$ = new char [strlen($1) + strlen($2) + 1]; strcpy($$, $1); strcat($$, $2); delete [] $1; delete [] $2; } ; wide_string_literal_plus: WIDE_STRING_LITERAL { $$ = $1; } | wide_string_literal_plus WIDE_STRING_LITERAL { $$ = new IDL_WChar [idl_wstrlen($1) + idl_wstrlen($2) + 1]; idl_wstrcpy($$, $1); idl_wstrcat($$, $2); delete [] $1; delete [] $2; } ; boolean_literal: TRUE_ { $$ = 1; } | FALSE_ { $$ = 0; } ; positive_int_const: const_exp { IdlLongVal v = $1->evalAsLongV(); if (v.negative || v.u == 0) IdlError(currentFile, yylineno, "Size must be at least 1"); $$ = v.u; } ; type_dcl: TYPEDEF type_declarator { $$ = $2; } | struct_type { $$ = $1; } | union_type { $$ = $1; } | enum_type { $$ = $1; } | NATIVE IDENTIFIER { $$ = new Native(currentFile, yylineno, mainFile, $2); } | constr_forward_decl { $$ = $1; } ; type_declarator: type_spec declarators { $$ = new Typedef(currentFile, yylineno, mainFile, $1->type(), $1->constr(), $2); delete $1; } ; type_spec: simple_type_spec { $$ = new TypeSpec($1, 0); } | constr_type_spec { $$ = new TypeSpec($1, 1); } ; simple_type_spec: base_type_spec { $$ = $1; } | template_type_spec { $$ = $1; } | scoped_name { $$ = IdlType::scopedNameToType(currentFile, yylineno, $1); } ; base_type_spec: floating_pt_type { $$ = $1; } | integer_type { $$ = $1; } | char_type { $$ = $1; } | wide_char_type { $$ = $1; } | boolean_type { $$ = $1; } | octet_type { $$ = $1; } | any_type { $$ = $1; } | object_type { $$ = $1; } | value_base_type { $$ = $1; } ; template_type_spec: sequence_type { $$ = $1; } | string_type { $$ = $1; } | wide_string_type { $$ = $1; } | fixed_pt_type { $$ = $1; } ; constr_type_spec: struct_type { $$ = $1->thisType(); } | union_type { $$ = $1->thisType(); } | enum_type { $$ = $1->thisType(); } ; declarators: declarator pragmas_opt { $$ = $1; } | declarators ',' pragmas_opt declarator pragmas_opt { if ($1) { $1->append($4); $$ = $1; } else $$ = $4; } ; declarator: simple_declarator { $$ = $1; } | complex_declarator { $$ = $1; } ; simple_declarator: IDENTIFIER { $$ = new Declarator(currentFile, yylineno, mainFile, $1, 0); } ; complex_declarator: array_declarator { $$ = $1; } ; floating_pt_type: FLOAT { $$ = BaseType::floatType; } | DOUBLE { $$ = BaseType::doubleType; } | LONG DOUBLE { $$ = BaseType::longdoubleType; } ; integer_type: signed_int { $$ = $1; } | unsigned_int { $$ = $1; } ; signed_int: signed_short_int { $$ = $1; } | signed_long_int { $$ = $1; } | signed_long_long_int { $$ = $1; } ; signed_short_int: SHORT { $$ = BaseType::shortType; } ; signed_long_int: LONG { $$ = BaseType::longType; } ; signed_long_long_int: LONG LONG { $$ = BaseType::longlongType; } ; unsigned_int: unsigned_short_int { $$ = $1; } | unsigned_long_int { $$ = $1; } | unsigned_long_long_int { $$ = $1; } ; unsigned_short_int: UNSIGNED SHORT { $$ = BaseType::ushortType; } ; unsigned_long_int: UNSIGNED LONG { $$ = BaseType::ulongType; } ; unsigned_long_long_int: UNSIGNED LONG LONG { $$ = BaseType::ulonglongType; } ; char_type: CHAR { $$ = BaseType::charType; } ; wide_char_type: WCHAR { $$ = BaseType::wcharType; } ; boolean_type: BOOLEAN { $$ = BaseType::booleanType; } ; octet_type: OCTET { $$ = BaseType::octetType; } ; any_type: ANY { $$ = BaseType::anyType; } ; object_type: OBJECT { $$ = DeclaredType::corbaObjectType; } ; struct_type: struct_header pragmas_opt '{' pragmas_opt member_list '}' { $1->finishConstruction($5); $$ = $1; } | struct_header error { IdlSyntaxError(currentFile, yylineno, "Syntax error in struct definition"); $1->finishConstruction(0); $$ = $1; } ; struct_header: STRUCT IDENTIFIER { $$ = new Struct(currentFile, yylineno, mainFile, $2); } ; member_list: member pragmas_opt { $$ = $1; } | member_list member pragmas_opt { if ($1) { $1->append($2); $$ = $1; } else $$ = $2; } ; member: type_spec declarators ';' { $$ = new Member(currentFile, yylineno, mainFile, $1->type(), $1->constr(), $2); delete $1; } | error { IdlSyntaxError(currentFile, yylineno, "Syntax error in member declaration"); $$ = 0; } ; union_type: union_header pragmas_opt SWITCH '(' pragmas_opt switch_type_spec pragmas_opt ')' pragmas_opt '{' pragmas_opt switch_body '}' { $1->finishConstruction($6->type(), $6->constr(), $12); delete $6; $$ = $1; } | union_header error { IdlSyntaxError(currentFile, yylineno, "Syntax error in union declaration"); $1->finishConstruction(0, 0, 0); $$ = $1; } ; union_header: UNION IDENTIFIER { $$ = new Union(currentFile, yylineno, mainFile, $2); } ; switch_type_spec: integer_type { $$ = new TypeSpec($1, 0); } | char_type { $$ = new TypeSpec($1, 0); } | boolean_type { $$ = new TypeSpec($1, 0); } | enum_type { $$ = new TypeSpec($1->thisType(), 1); } | scoped_name { $$ = new TypeSpec(IdlType::scopedNameToType(currentFile, yylineno, $1), 0); } ; switch_body: case_plus { $$ = $1; } ; case_plus: case pragmas_opt { $$ = $1; } | case_plus case pragmas_opt { $1->append($2); $$ = $1; } ; case: case_label_plus element_spec ';' { $2->finishConstruction($1); $$ = $2; } ; case_label_plus: case_label { $$ = $1; } | case_label_plus case_label { $1->append($2); $$ = $1; } ; case_label: CASE const_exp ':' pragmas_opt { $$ = new CaseLabel(currentFile, yylineno, mainFile, $2); } | DEFAULT ':' pragmas_opt { $$ = new CaseLabel(currentFile, yylineno, mainFile, 0); } ; element_spec: type_spec declarator { $$ = new UnionCase(currentFile, yylineno, mainFile, $1->type(), $1->constr(), $2); } ; enum_type: enum_header pragmas_opt '{' pragmas_opt enumerator_list '}' { $1->finishConstruction($5); $$ = $1; } | enum_header error { IdlSyntaxError(currentFile, yylineno, "Syntax error in enum definition"); $1->finishConstruction(0); $$ = $1; } ; enum_header: ENUM IDENTIFIER { $$ = new Enum(currentFile, yylineno, mainFile, $2); } ; enumerator_list: enumerator pragmas_opt { $$ = $1; } | enumerator_list ',' pragmas_opt enumerator pragmas_opt { $1->append($4); $$ = $1; } ; enumerator: IDENTIFIER { $$ = new Enumerator(currentFile, yylineno, mainFile, $1); } ; sequence_type: SEQUENCE '<' simple_type_spec ',' positive_int_const '>' { $$ = new SequenceType($3, $5); } | SEQUENCE '<' simple_type_spec '>' { $$ = new SequenceType($3, 0); } ; string_type: STRING '<' positive_int_const '>' { $$ = new StringType($3); } | STRING { $$ = StringType::unboundedStringType; } ; wide_string_type: WSTRING '<' positive_int_const '>' { $$ = new WStringType($3); } | WSTRING { $$ = WStringType::unboundedWStringType; } ; array_declarator: IDENTIFIER fixed_array_size_plus { $$ = new Declarator(currentFile, yylineno, mainFile, $1, $2); } ; fixed_array_size_plus: fixed_array_size { $$ = $1; } | fixed_array_size_plus fixed_array_size { $1->append($2); $$ = $1; } ; fixed_array_size: '[' positive_int_const ']' { $$ = new ArraySize($2); } ; attr_dcl: readonly_opt ATTRIBUTE param_type_spec simple_declarator_list { $$ = new Attribute(currentFile, yylineno, mainFile, $1, $3, $4); } ; readonly_opt: /* empty */ { $$ = 0; } | READONLY { $$ = 1; } ; simple_declarator_list: simple_declarator pragmas_opt { $$ = $1; } | simple_declarator_list ',' pragmas_opt simple_declarator pragmas_opt { if ($1) { $1->append($4); $$ = $1; } else $$ = $4; } ; except_dcl: except_header pragmas_opt '{' pragmas_opt member_star '}' { $1->finishConstruction($5); $$ = $1; } | except_header error { IdlSyntaxError(currentFile, yylineno, "Syntax error in exception definition"); $1->finishConstruction(0); $$ = $1; } ; except_header: EXCEPTION IDENTIFIER { $$ = new Exception(currentFile, yylineno, mainFile, $2); } ; member_star: /* empty */ { $$ = 0; } | member_star member { if ($1) { $1->append($2); $$ = $1; } else $$ = $2; } ; op_dcl: op_header pragmas_opt parameter_dcls { $1->closeParens(); } pragmas_opt raises_expr_opt context_expr_opt { $1->finishConstruction($3, $6, $7); $$ = $1; } | op_header error { IdlSyntaxError(currentFile, yylineno, "Syntax error in operation declaration"); $1->closeParens(); $1->finishConstruction(0, 0, 0); $$ = $1; } ; op_header: op_attribute_opt op_type_spec IDENTIFIER { $$ = new Operation(currentFile, yylineno, mainFile, $1, $2, $3); } ; op_attribute_opt: /* empty */ { $$ = 0; } | op_attribute { $$ = $1; } ; op_attribute: ONEWAY { $$ = 1; } ; op_type_spec: param_type_spec { $$ = $1; } | VOID { $$ = BaseType::voidType; } ; parameter_dcls: '(' pragmas_opt param_dcl_list ')' { $$ = $3; } | '(' pragmas_opt ')' { $$ = 0; } | '(' error ')' { IdlSyntaxError(currentFile, yylineno, "Syntax error in operation parameters"); $$ = 0; } ; param_dcl_list: param_dcl pragmas_opt { $$ = $1; } | param_dcl_list ',' pragmas_opt param_dcl pragmas_opt { if ($1) { $1->append($4); $$ = $1; } else $$ = $4; } ; param_dcl: param_attribute param_type_spec IDENTIFIER { $$ = new Parameter(currentFile, yylineno, mainFile, $1, $2, $3); } ; param_attribute: IN { $$ = 0; } | OUT { $$ = 1; } | INOUT { $$ = 2; } ; raises_expr_opt: /* empty */ { $$ = 0; } | raises_expr pragmas_opt { $$ = $1; } ; raises_expr: RAISES '(' scoped_name_list ')' { $$ = $3; } ; scoped_name_list: scoped_name pragmas_opt { $$ = new RaisesSpec($1, currentFile, yylineno); } | scoped_name_list ',' pragmas_opt scoped_name pragmas_opt { $1->append(new RaisesSpec($4, currentFile, yylineno)); $$ = $1; } ; context_expr_opt: /* empty */ { $$ = 0; } | context_expr pragmas_opt { $$ = $1; } ; context_expr: CONTEXT '(' string_literal_list ')' { $$ = $3; } ; string_literal_list: string_literal_plus pragmas_opt { $$ = new ContextSpec($1, currentFile, yylineno); } | string_literal_list ',' pragmas_opt string_literal_plus pragmas_opt { $1->append(new ContextSpec($4, currentFile, yylineno)); $$ = $1; } ; param_type_spec: base_type_spec { $$ = $1; } | string_type { $$ = $1; } | wide_string_type { $$ = $1; } | scoped_name { $$ = IdlType::scopedNameToType(currentFile, yylineno, $1); } ; fixed_pt_type: FIXED '<' positive_int_const ',' const_exp '>' { IdlLongVal scalev = $5->evalAsLongV(); if (scalev.negative) { IdlError(currentFile, yylineno, "Fixed point scale must be >= 0"); } IDL_ULong scale = scalev.u; if ($3 > 31) { IdlError(currentFile, yylineno, "Fixed point values may not have more than 31 digits"); } if (scale > $3) { IdlError(currentFile, yylineno, "Fixed point scale factor is greater than " "the number of digits"); } $$ = new FixedType($3, scale); } ; fixed_pt_const_type: FIXED { $$ = new FixedType(0, 0); } ; value_base_type: VALUEBASE { $$ = new DeclaredType(IdlType::tk_value, 0, 0); } ; constr_forward_decl: STRUCT IDENTIFIER { $$ = new StructForward(currentFile, yylineno, mainFile, $2); } | UNION IDENTIFIER { $$ = new UnionForward(currentFile, yylineno, mainFile, $2); } ; pragma: pragma_id | pragma_version | unknown_pragma | omni_pragma ; pragmas: pragma | pragmas pragma ; pragmas_opt: /* empty */ | pragmas ; pragma_prefix: PRAGMA_PREFIX string_literal_plus END_PRAGMA { Prefix::setPrefix(idl_strdup($2)); } | PRAGMA_PREFIX error { IdlSyntaxError(currentFile, yylineno, "Malformed #pragma prefix"); } ; pragma_id: PRAGMA_ID scoped_name string_literal_plus END_PRAGMA { Decl* d = Decl::scopedNameToDecl(currentFile, yylineno, $2); if (d) DeclRepoId::setRepoId(d, $3, currentFile, yylineno); } | PRAGMA_ID error END_PRAGMA { IdlSyntaxError(currentFile, yylineno, "Malformed #pragma id"); } ; pragma_version: PRAGMA_VERSION scoped_name INTEGER_LITERAL '.' INTEGER_LITERAL END_PRAGMA { Decl* d = Decl::scopedNameToDecl(currentFile, yylineno, $2); if (d) DeclRepoId::setVersion(d, $3, $5, currentFile, yylineno); } | PRAGMA_VERSION error END_PRAGMA { IdlSyntaxError(currentFile, yylineno, "Malformed #pragma version"); } ; unknown_pragma: PRAGMA unknown_pragma_body_plus END_PRAGMA { Pragma::add($2, currentFile, yylineno-1); } ; omni_pragma: OMNI_PRAGMA unknown_pragma_body_plus END_PRAGMA { Pragma::add($2, currentFile, yylineno); } ; unknown_pragma_body_plus: UNKNOWN_PRAGMA_BODY { $$ = $1; } | unknown_pragma_body_plus UNKNOWN_PRAGMA_BODY { $$ = new char [strlen($1) + strlen($2) + 1]; strcpy($$, $1); strcat($$, $2); delete [] $1; delete [] $2; } ; %% synopsis-0.12/Synopsis/Parsers/IDL/config.h0000664000076400007640000000174611104703262020157 0ustar stefanstefan// // Copyright (C) 2006 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #ifndef config_h_ #define config_h_ #include #define HAS_Cplusplus_Bool #if defined(SIZEOF_LONG) && (SIZEOF_LONG == 8) # define HAS_LongLong # define _CORBA_LONGLONG_DECL long # define _CORBA_ULONGLONG_DECL unsigned long # define _CORBA_LONGLONG_CONST(x) (x) #elif defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 8) # define HAS_LongLong # define _CORBA_LONGLONG_DECL long long # define _CORBA_ULONGLONG_DECL unsigned long long # define _CORBA_LONGLONG_CONST(x) (x##LL) #endif #if defined(SIZEOF_LONG_DOUBLE) && (SIZEOF_LONG_DOUBLE == 16) # define HAS_LongDouble # define _CORBA_LONGDOUBLE_DECL long double #endif #if defined(SIZEOF_LONG_DOUBLE) && (SIZEOF_LONG_DOUBLE == 12) && defined(__i386__) # define HAS_LongDouble # define _CORBA_LONGDOUBLE_DECL long double #endif #endif synopsis-0.12/Synopsis/Parsers/IDL/acconfig.h.in0000664000076400007640000000473511104703261021070 0ustar stefanstefan/* acconfig.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_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 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 /* The size of `bool', as computed by sizeof. */ #undef SIZEOF_BOOL /* The size of `char', as computed by sizeof. */ #undef SIZEOF_CHAR /* The size of `double', as computed by sizeof. */ #undef SIZEOF_DOUBLE /* The size of `float', as computed by sizeof. */ #undef SIZEOF_FLOAT /* The size of `int', as computed by sizeof. */ #undef SIZEOF_INT /* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG /* The size of `long double', as computed by sizeof. */ #undef SIZEOF_LONG_DOUBLE /* The size of `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG /* The size of `short', as computed by sizeof. */ #undef SIZEOF_SHORT /* The size of `unsigned char', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_CHAR /* The size of `void*', as computed by sizeof. */ #undef SIZEOF_VOIDP /* The size of `wchar_t', as computed by sizeof. */ #undef SIZEOF_WCHAR_T /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* 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 1 if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */ #undef YYTEXT_POINTER synopsis-0.12/Synopsis/ASG.py0000664000076400007640000004660311170474724015512 0ustar stefanstefan# # Copyright (C) 2000 Stefan Seefeld # Copyright (C) 2000 Stephen Davies # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # """Abstract Syntax Tree classes. This file contains classes which encapsulate nodes in the ASG. The base class is the Declaration class that encapsulates a named declaration. All names used are scoped tuples. Also defined in module scope are the constants DEFAULT, PUBLIC, PROTECTED and PRIVATE. """ # Accessibility constants DEFAULT = 0 PUBLIC = 1 PROTECTED = 2 PRIVATE = 3 def ccmp(a,b): """Compares classes of two objects""" return cmp(type(a),type(b)) or cmp(a.__class__,b.__class__) class Error: """Exception class used by ASG internals.""" def __init__(self, err): self.err = err def __repr__(self): return self.err class Debugger(type): """Wrap the object's 'accept' method, printing out the visitor's type. Useful for tracing visitors visiting declarations.""" def __init__(cls, name, bases, dict): accept = dict['accept'] "The original instancemethod." def accept_wrapper(self, visitor): "The wrapper. The original 'accept' method is part of its closure." print '%s accepting %s.%s'%(self.__class__.__name__, visitor.__module__, visitor.__class__.__name__) accept(self, visitor) setattr(cls, 'accept', accept_wrapper) class TypeId(object): """Type-id abstract class.""" def __init__(self, language): self.language = language def accept(self, visitor): """visitor pattern accept. @see Visitor""" pass def __cmp__(self, other): "Comparison operator" return cmp(id(self),id(other)) class NamedTypeId(TypeId): """Named type abstract class""" def __init__(self, language, name): super(NamedTypeId, self).__init__(language) self.name = name class BuiltinTypeId(NamedTypeId): """Class for builtin type-ids""" def __init__(self, language, name): super(BuiltinTypeId, self).__init__(language, name) def accept(self, visitor): visitor.visit_builtin_type_id(self) def __cmp__(self, other): "Comparison operator" return ccmp(self,other) or cmp(self.name,other.name) def __str__(self): return str(self.name) class DependentTypeId(NamedTypeId): """Class for template dependent type-ids""" def __init__(self, language, name): super(DependentTypeId, self).__init__(language, name) def accept(self, visitor): visitor.visit_dependent_type_id(self) def __cmp__(self, other): "Comparison operator" return ccmp(self,other) or cmp(self.name,other.name) def __str__(self): return str(self.name) class UnknownTypeId(NamedTypeId): """Class for not (yet) known type-ids.""" base = TypeId def __init__(self, language, name): super(UnknownTypeId, self).__init__(language, name) self.link = name def resolve(self, language, name, link): """Associate this type-id with an external reference, instead of a declaration.""" self.base.language = language self.name = name self.link = link def accept(self, visitor): visitor.visit_unknown_type_id(self) def __cmp__(self, other): "Comparison operator" return ccmp(self,other) or cmp(self.name,other.name) def __str__(self): return str(self.name) class DeclaredTypeId(NamedTypeId): """Class for declared types""" def __init__(self, language, name, declaration): super(DeclaredTypeId, self).__init__(language, name) self.declaration = declaration def accept(self, visitor): visitor.visit_declared_type_id(self) def __cmp__(self, other): "Comparison operator" return ccmp(self,other) or cmp(self.name,other.name) def __str__(self): return str(self.name) class TemplateId(DeclaredTypeId): """Class for template-ids.""" def __init__(self, language, name, declaration, parameters): super(TemplateId, self).__init__(language, name, declaration) self.parameters = parameters def accept(self, visitor): visitor.visit_template_id(self) def __cmp__(self, other): "Comparison operator" return ccmp(self,other) or cmp(self.parameters,other.parameters) def __str__(self): return "template<%s>%s"%(','.join([str(p) for p in self.parameters]), str(self.name)) class ModifierTypeId(TypeId): """Class for alias types with modifiers (such as 'const', '&', etc.)""" def __init__(self, language, alias, premod, postmod): super(ModifierTypeId, self).__init__(language) self.alias = alias self.premod = premod self.postmod = postmod def accept(self, visitor): visitor.visit_modifier_type_id(self) def __cmp__(self, other): "Comparison operator" return (ccmp(self,other) or cmp(self.alias,other.alias) or cmp(self.premod,other.premod) or cmp(self.postmod,other.postmod)) def __str__(self): return "%s%s%s"%(''.join(['%s '%s for s in self.premod]), str(self.alias), ''.join(self.postmod)) class ArrayTypeId(TypeId): """A modifier that adds array dimensions to a type-id.""" def __init__(self, language, alias, sizes): super(ArrayId, self).__init__(language) self.alias = alias self.sizes = sizes def accept(self, visitor): visitor.visit_array_type_id(self) def __cmp__(self, other): "Comparison operator" return (ccmp(self,other) or cmp(self.alias,other.alias) or cmp(self.sizes,other.sizes)) def __str__(self): return "%s%s"%(str(self.alias), ''.join(['[%d]'%s for s in self.sizes])) class ParametrizedTypeId(TypeId): """Class for parametrized type-id instances.""" def __init__(self, language, template, parameters): super(ParametrizedTypeId, self).__init__(language) self.template = template self.parameters = parameters def accept(self, visitor): visitor.visit_parametrized_type_id(self) def __cmp__(self, other): "Comparison operator" return ccmp(self,other) or cmp(self.template,other.template) def __str__(self): return "%s<%s>"%('::'.join(self.template.name), ','.join([str(a) for a in self.parameters])) class FunctionTypeId(TypeId): """Class for function (pointer) types.""" def __init__(self, language, return_type, premod, parameters): super(FunctionTypeId, self).__init__(language) self.return_type = return_type self.premod = premod self.parameters = parameters def accept(self, visitor): visitor.visit_function_type_id(self) class Dictionary(dict): """Dictionary extends the builtin 'dict' by adding a lookup method to it.""" def lookup(self, name, scopes): """locate 'name' in one of the scopes""" for s in scopes: scope = list(s) while len(scope) > 0: if self.has_key(scope + name): return self[scope + name] else: del scope[-1] if self.has_key(name): return self[name] return None def merge(self, dict): """merge in a foreign dictionary, overriding already defined types only if they are of type 'Unknown'.""" for i in dict.keys(): if self.has_key(i): if isinstance(self[i], UnknownTypeId): self[i] = dict[i] else: pass else: self[i] = dict[i] class Declaration(object): """Declaration base class. Every declaration has a name, type, accessibility and annotations. The default accessibility is DEFAULT except for C++ where the Parser always sets it to one of the other three. """ #__metaclass__ = Debugger def __init__(self, file, line, type, name): self.file = file """SourceFile instance this declaration is part of.""" self.line = line """The line number of this declaration.""" self.name = name """The (fully qualified) name of the declared object.""" self.type = type """A string describing the (language-specific) type of the declared object.""" self.accessibility = DEFAULT """Accessibility descriptor for the declared object.""" self.annotations = {} """A dictionary holding any annotations of this object.""" def accept(self, visitor): """Visit the given visitor""" visitor.visit_declaration(self) class Builtin(Declaration): """A node for internal use only.""" def accept(self, visitor): visitor.visit_builtin(self) class UsingDirective(Builtin): """Import one module's content into another.""" def accept(self, visitor): visitor.visit_using_directive(self) class UsingDeclaration(Builtin): """Import a declaration into this module.""" def __init__(self, file, line, type, name, alias): super(UsingDeclaration, self).__init__(file, line, type, name) self.alias = alias def accept(self, visitor): visitor.visit_using_declaration(self) class Macro(Declaration): """A preprocessor macro. Note that macros are not strictly part of the ASG, and as such are always in the global scope. A macro is "temporary" if it was #undefined in the same file it was #defined in.""" def __init__(self, file, line, type, name, parameters, text): Declaration.__init__(self, file, line, type, name) self.parameters = parameters self.text = text def accept(self, visitor): visitor.visit_macro(self) class Forward(Declaration): """Forward declaration""" def __init__(self, file, line, type, name, is_template_specialization = False): Declaration.__init__(self, file, line, type, name) self.template = None self.is_template_specialization = is_template_specialization self.primary_template = None self.specializations = [] def accept(self, visitor): visitor.visit_forward(self) class Group(Declaration): """Base class for groups which contain declarations. This class doesn't correspond to any language construct. Rather, it may be used with comment-embedded grouping tags to regroup declarations that are to appear together in the manual.""" def __init__(self, file, line, type, name): Declaration.__init__(self, file, line, type, name) self.declarations = [] def accept(self, visitor): visitor.visit_group(self) class Scope(Declaration): """Base class for scopes (named groups).""" def __init__(self, file, line, type, name): Declaration.__init__(self, file, line, type, name) self.declarations = [] def accept(self, visitor): visitor.visit_scope(self) class Module(Scope): """Module class""" def __init__(self, file, line, type, name): Scope.__init__(self, file, line, type, name) def accept(self, visitor): visitor.visit_module(self) class MetaModule(Module): """Module Class that references all places where this Module occurs""" def __init__(self, type, name): Scope.__init__(self, None, "", type, name) self.module_declarations = [] def accept(self, visitor): visitor.visit_meta_module(self) class Inheritance(object): """Inheritance class. This class encapsulates the information about an inheritance, such as attributes like 'virtual' and 'public' """ def __init__(self, type, parent, attributes): self.type = type self.parent = parent self.attributes = attributes def accept(self, visitor): visitor.visit_inheritance(self) class Class(Scope): def __init__(self, file, line, type, name, is_template_specialization = False): Scope.__init__(self, file, line, type, name) self.parents = [] self.is_template_specialization = is_template_specialization self.primary_template = None def accept(self, visitor): visitor.visit_class(self) class ClassTemplate(Scope): def __init__(self, file, line, type, name, template = None, is_template_specialization = False): Scope.__init__(self, file, line, type, name) self.parents = [] self.template = template self.is_template_specialization = is_template_specialization self.primary_template = None self.specializations = [] def accept(self, visitor): visitor.visit_class_template(self) class Typedef(Declaration): def __init__(self, file, line, type, name, alias, constr): Declaration.__init__(self, file, line, type, name) self.alias = alias self.constr = constr def accept(self, visitor): visitor.visit_typedef(self) class Enumerator(Declaration): """Enumerator of an Enum. Enumerators represent the individual names and values in an enum.""" def __init__(self, file, line, name, value): Declaration.__init__(self, file, line, "enumerator", name) self.value = value def accept(self, visitor): visitor.visit_enumerator(self) class Enum(Declaration): """Enum declaration. The actual names and values are encapsulated by Enumerator objects.""" def __init__(self, file, line, name, enumerators): Declaration.__init__(self, file, line, "enum", name) self.enumerators = enumerators[:] #FIXME: the Cxx parser will append a Builtin('eos') to the #list of enumerators which we need to extract here. self.eos = None if self.enumerators and isinstance(self.enumerators[-1], Builtin): self.eos = self.enumerators.pop() def accept(self, visitor): visitor.visit_enum(self) class Variable(Declaration): """Variable definition""" def __init__(self, file, line, type, name, vtype, constr): Declaration.__init__(self, file, line, type, name) self.vtype = vtype self.constr = constr def accept(self, visitor): visitor.visit_variable(self) class Const(Declaration): """Constant declaration. A constant is a name with a type and value.""" def __init__(self, file, line, type, ctype, name, value): Declaration.__init__(self, file, line, type, name) self.ctype = ctype self.value = value def accept(self, visitor): visitor.visit_const(self) class Parameter(object): """Function Parameter""" def __init__(self, premod, type, postmod, name='', value=''): self.premodifier = premod self.type = type self.postmodifier = postmod self.name = name self.value = value def accept(self, visitor): visitor.visit_parameter(self) def __cmp__(self, other): "Comparison operator" #print "Parameter.__cmp__" return cmp(self.type,other.type) def __str__(self): return "%s%s%s"%(' '.join(self.premodifier), str(self.type), ' '.join(self.postmodifier)) class Function(Declaration): """Function declaration. Note that function names are stored in mangled form to allow overriding. Formatters should use the real_name to extract the unmangled name.""" def __init__(self, file, line, type, premod, return_type, postmod, name, real_name): Declaration.__init__(self, file, line, type, name) self._real_name = real_name self.premodifier = premod self.return_type = return_type self.parameters = [] self.postmodifier = postmod self.exceptions = [] real_name = property(lambda self: self.name[:-1] + (self._real_name,)) def accept(self, visitor): visitor.visit_function(self) def __cmp__(self, other): "Recursively compares the typespec of the function" return ccmp(self,other) or cmp(self.parameters, other.parameters) class FunctionTemplate(Function): def __init__(self, file, line, type, premod, return_type, postmod, name, real_name, template = None): Function.__init__(self, file, line, type, premod, return_type, postmod, name, real_name) self.template = template def accept(self, visitor): visitor.visit_function_template(self) class Operation(Function): """Operation class. An operation is related to a Function and is currently identical. """ def __init__(self, file, line, type, premod, return_type, postmod, name, real_name): Function.__init__(self, file, line, type, premod, return_type, postmod, name, real_name) def accept(self, visitor): visitor.visit_operation(self) class OperationTemplate(Operation): def __init__(self, file, line, type, premod, return_type, postmod, name, real_name, template = None): Operation.__init__(self, file, line, type, premod, return_type, postmod, name, real_name) self.template = template def accept(self, visitor): visitor.visit_operation_template(self) class Visitor(object): """Visitor for ASG nodes""" def visit_builtin_type_id(self, type): pass def visit_unknown_type_id(self, type): pass def visit_declared_type_id(self, type): pass def visit_modifier_type_id(self, type): pass def visit_array_type_id(self, type): pass def visit_template_id(self, type): pass def visit_parametrized_type_id(self, type): pass def visit_function_type_id(self, type): pass def visit_dependent_type_id(self, type): pass def visit_declaration(self, node): pass def visit_builtin(self, node): """Visit a Builtin instance. By default do nothing. Processors who operate on Builtin nodes have to provide an appropriate implementation.""" pass def visit_using_directive(self, node): self.visit_builtin(node) def visit_using_declaration(self, node): self.visit_builtin(node) def visit_macro(self, node): self.visit_declaration(node) def visit_forward(self, node): self.visit_declaration(node) def visit_group(self, node): self.visit_declaration(node) for d in node.declarations: d.accept(self) def visit_scope(self, node): self.visit_declaration(node) for d in node.declarations: d.accept(self) def visit_module(self, node): self.visit_scope(node) def visit_meta_module(self, node): self.visit_module(node) def visit_class(self, node): self.visit_scope(node) def visit_class_template(self, node): self.visit_class(node) def visit_typedef(self, node): self.visit_declaration(node) def visit_enumerator(self, node): self.visit_declaration(node) def visit_enum(self, node): self.visit_declaration(node) for e in node.enumerators: e.accept(self) if node.eos: node.eos.accept(self) def visit_variable(self, node): self.visit_declaration(node) def visit_const(self, node): self.visit_declaration(node) def visit_function(self, node): self.visit_declaration(node) for parameter in node.parameters: parameter.accept(self) def visit_function_template(self, node): self.visit_function(node) def visit_operation(self, node): self.visit_function(node) def visit_operation_template(self, node): self.visit_operation(node) def visit_parameter(self, node): pass def visit_inheritance(self, node): pass class ASG(object): def __init__(self, declarations = None, types = None): self.declarations = declarations or [] self.types = types or Dictionary() def copy(self): return type(self)(self.declarations[:], self.types.copy()) def merge(self, other): self.declarations.extend(other.declarations) self.types.merge(other.types) synopsis-0.12/Synopsis/SXR.py0000664000076400007640000000314211104703266015534 0ustar stefanstefan# # Copyright (C) 2008 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # class Entry(object): def __init__(self): """Represents a set of references found for a given symbol.""" self.definitions = [] "List of (file, line, scope) tuples." self.calls = [] "List of (file, line, scope) tuples." self.references = [] "List of (file, line, scope) tuples." class SXR(dict): """Symboltable containing source code locations of symbol definitions, as well as different types of references.""" def __init__(self): self._index = {} def index(self): return self._index def generate_index(self): """(Re-)generate an index after entries have been added.""" # Sort the data for target, entry in self.items(): entry.calls.sort() entry.references.sort() name = target[-1] self._index.setdefault(name,[]).append(target) # If it's a function name, also add without the parameters paren = name.find('(') if paren != -1: self._index.setdefault(name[:paren],[]).append(target) def merge(self, other): for k in other: e = other[k] entry = self.setdefault(k, Entry()) # TODO: Should we try to eliminate duplicates here ? entry.definitions += e.definitions entry.calls += e.calls entry.references += e.references self.generate_index() synopsis-0.12/Synopsis/Processor.py0000644000076400007640000001622311104703265017040 0ustar stefanstefan# # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # import IR class Error(Exception): """An exception a processor may raise during processing.""" def __init__(self, what): self.what = what def __str__(self): return "%s: %s"%(self.__class__.__name__, self.what) class InvalidArgument(Error): pass class MissingArgument(Error): pass class InvalidCommand(Error): pass class InternalError(Error): pass class Parameter(object): """A Parameter is a documented value, kept inside a Processor.""" def __init__(self, value, doc): self.value = value self.doc = doc class Type(type): """Type is the Processor's __metaclass__.""" def __init__(cls, name, bases, dict): """Generate a '_parameters' dictionary holding all the 'Parameter' objects. Then replace 'Parameter' objects by their values for convenient use inside the code.""" parameters = {} for i in dict: if isinstance(dict[i], Parameter): parameters[i] = dict[i] for i in parameters: setattr(cls, i, dict[i].value) setattr(cls, '_parameters', parameters) class Parametrized(object): """Parametrized implements handling of Parameter attributes.""" __metaclass__ = Type def __new__(cls, *args, **kwds): """merge all parameter catalogs for easy access to documentation, then use keyword arguments to override default values.""" instance = object.__new__(cls) # iterate over all base classes, starting at the 'Parametrized' base class # i.e. remove mixin classes hierarchy = list(filter(lambda i:issubclass(i, Parametrized), cls.__mro__)) hierarchy.reverse() parameters = {} for c in hierarchy: parameters.update(c._parameters) setattr(instance, '_parameters', parameters) for p in kwds: if not p in instance._parameters: raise InvalidArgument('"%s.%s" processor does not have "%s" parameter' %(cls.__module__, cls.__name__, p)) else: setattr(instance, p, kwds[p]) return instance def __init__(self, **kwds): """The constructor uses the keywords to update the parameter list.""" self.set_parameters(kwds) def clone(self, *args, **kwds): """Create a copy of this Parametrized. The only copied attributes are the ones corresponding to parameters.""" new_kwds = dict([(k, getattr(self, k)) for k in self._parameters]) new_kwds.update(kwds) return type(self)(*args, **new_kwds) def get_parameters(self): return self._parameters def set_parameters(self, kwds): """Sets the given parameters to override the default values.""" for i in kwds: if i in self._parameters: setattr(self, i, kwds[i]) else: raise InvalidArgument, "No parameter '%s' in '%s'"%(i, self.__class__.__name__) class Processor(Parametrized): """Processor documentation...""" verbose = Parameter(False, "operate verbosely") debug = Parameter(False, "generate debug traces") profile = Parameter(False, "output profile data") input = Parameter([], "input files to process") output = Parameter('', "output file to save the ir to") def merge_input(self, ir): """Join the given IR with a set of IRs to be read from 'input' parameter""" input = getattr(self, 'input', []) for file in input: try: ir.merge(IR.load(file)) except: raise InvalidArgument('unable to load IR from %s'%file) return ir def output_and_return_ir(self): """writes output if the 'output' attribute is set, then returns""" output = getattr(self, 'output', None) if output: self.ir.save(output) return self.ir def process(self, ir, **kwds): """The process method provides the interface to be implemented by subclasses. Commonly used arguments are 'input' and 'output'. If 'input' is defined, it is interpreted as one or more input file names. If 'output' is defined, it is interpreted as an output file (or directory) name. This implementation may serve as a template for real processors.""" # override default parameter values self.set_parameters(kwds) # merge in IR from 'input' parameter if given self.ir = self.merge_input(ir) # do the real work here... # write to output (if given) and return IR return self.output_and_return_ir() class Composite(Processor): """A Composite processor.""" processors = Parameter([], 'the list of processors this is composed of') def __init__(self, *processors, **kwds): """This __init__ is a convenience constructor that takes a var list to list the desired processors. If the named values contain 'processors', they override the var list.""" if processors: self.processors = processors self.set_parameters(kwds) def process(self, ir, **kwds): """apply a list of processors. The 'input' value is passed to the first processor only, the 'output' to the last. 'verbose' and 'debug' are passed down if explicitely given as named values. All other keywords are ignored.""" if not self.processors: return super(Composite, self).process(ir, **kwds) self.set_parameters(kwds) if len(self.processors) == 1: my_kwds = {} if self.input: my_kwds['input'] = self.input if self.output: my_kwds['output'] = self.output if self.verbose: my_kwds['verbose'] = self.verbose if self.debug: my_kwds['debug'] = self.debug if self.profile: my_kwds['profile'] = self.profile return self.processors[0].process(ir, **my_kwds) # more than one processor... # call the first, passing the 'input' parameter, if present my_kwds = {} if self.input: my_kwds['input'] = self.input if self.verbose: my_kwds['verbose'] = self.verbose if self.debug: my_kwds['debug'] = self.debug if self.profile: my_kwds['profile'] = self.profile ir = self.processors[0].process(ir, **my_kwds) # deal with all between the first and the last; # they only get 'verbose', 'debug', and 'profile' flags my_kwds = {} if self.verbose: my_kwds['verbose'] = self.verbose if self.debug: my_kwds['debug'] = self.debug if self.profile: my_kwds['profile'] = self.profile if len(self.processors) > 2: for p in self.processors[1:-1]: ir = p.process(ir, **my_kwds) # call the last, passing the 'output' parameter, if present if self.output: my_kwds['output'] = self.output ir = self.processors[-1].process(ir, **my_kwds) return ir class Store(Processor): """Store is a convenience class useful to write out the intermediate state of the IR within a pipeline such as represented by the 'Composite'""" def process(self, ir, **kwds): """Simply store the current IR in the 'output' file.""" self.set_parameters(kwds) self.ir = self.merge_input(ir) return self.output_and_return_ir() synopsis-0.12/Synopsis/IR.py0000664000076400007640000000500011104703265015364 0ustar stefanstefan# # Copyright (C) 2007 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # import ASG import SXR import cPickle class IR(object): """Top-level Internal Representation. This is essentially a dictionary of different representations such as Parse Tree, Abstract Semantic Graph, etc. """ def __init__(self, files=None, asg=None, sxr=None): """Constructor""" self.files = files or {} """A dictionary mapping filenames to `SourceFile.SourceFile` instances.""" self.asg = asg or ASG.ASG() """The Abstract Semantic Graph.""" self.sxr = sxr or SXR.SXR() """The Source Cross-Reference SymbolTable.""" def copy(self): """Make a shallow copy of this IR.""" return type(self)(self.files.copy(), self.asg.copy(), self.sxr) def save(self, filename): """Saves an IR object to the given filename""" file = open(filename, 'wb') pickler = cPickle.Pickler(file, 1) pickler.dump(self) file.close() def merge(self, other): """Merges another IR. Files and declarations are appended to those in this IR, and types are merged by overwriting existing types - Unduplicator is responsible for sorting out the mess this may cause :)""" #merge files replacement = {} for filename, file in other.files.iteritems(): if not self.files.has_key(filename): self.files[filename] = file continue myfile = self.files[filename] replacement[file] = myfile # the 'main' flag dominates... if not myfile.annotations['primary']: myfile.annotations['primary'] = file.annotations['primary'] myfile.declarations.extend(file.declarations) myfile.includes.extend(file.includes) # fix dangling inclusions of 'old' files for r in replacement: for f in self.files.values(): for i in f.includes: if i.target == r: i.target = replacement[r] # merge ASG self.asg.merge(other.asg) # merge SXR self.sxr.merge(other.sxr) def load(filename): """Loads an IR object from the given filename""" file = open(filename, 'rb') unpickler = cPickle.Unpickler(file) ir = unpickler.load() file.close() return ir synopsis-0.12/Synopsis/Formatters/0000775000076400007640000000000011172123232016626 5ustar stefanstefansynopsis-0.12/Synopsis/Formatters/List.py0000664000076400007640000000404211104703264020117 0ustar stefanstefan# # Copyright (C) 2006 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import Processor, Parameter from Synopsis import ASG class Formatter(Processor, ASG.Visitor): """Generate a high-level list of the content of a syn file. This formatter can lists source files (by name), as well as declarations (by name, type) contained in a given scope.""" show_files = Parameter(False, 'list files') show_scope = Parameter(None, 'list declarations in the given scope') def process(self, ir, **kwds): self.set_parameters(kwds) self.ir = self.merge_input(ir) if self.show_files: for f in self.ir.files.values(): print '%s (language=%s, primary=%d)'%(f.name, f.annotations['language'], f.annotations['primary']) if self.show_scope is not None: if '.' in self.show_scope: self.scope = tuple(self.show_scope.split('.')) elif '::' in self.show_scope: self.scope = tuple(self.show_scope.split('::')) else: self.scope = (self.show_scope,) for d in self.ir.asg.declarations: d.accept(self) return self.ir def visit_scope(self, node): if self.scope == node.name: # We found the right scope. # List all declarations directly contained in it. declarations = node.declarations[:] declarations.sort(lambda x, y : cmp(x.name, y.name)) for d in declarations: if isinstance(d, ASG.Builtin): continue print '%s : %s'%(d.name[-1], d.type) elif (len(node.name) < self.scope and self.scope[0:len(node.name)] == node.name): # We found a parent scope. # Visit child scopes. for d in node.declarations: d.accept(self) synopsis-0.12/Synopsis/Formatters/BoostBook.py0000664000076400007640000002120211104703264021102 0ustar stefanstefan# # Copyright (C) 2000 Stefan Seefeld # Copyright (C) 2000 Stephen Davies # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # """a BoostBook formatter""" from Synopsis.Processor import Processor, Parameter from Synopsis import ASG import sys, getopt, os, os.path class Formatter(Processor, ASG.Visitor): """ The type visitors should generate names relative to the current scope. The generated references however are fully scoped names """ def process(self, ir, **kwds): self.set_parameters(kwds) self.ir = self.merge_input(ir) self.__os = open(self.output, 'w') self.__scope = () self.__scopestack = [] self.__indent = 0 self.__type_label = '' for d in ir.asg.declarations: d.accept(self) self.__os.close() return self.ir def scope(self): return self.__scope def push_scope(self, newscope): self.__scopestack.append(self.__scope) self.__scope = newscope def pop_scope(self): self.__scope = self.__scopestack[-1] del self.__scopestack[-1] def write(self, text): """Write some text to the output stream, replacing \n's with \n's and indents.""" indent = ' ' * self.__indent self.__os.write(text.replace('\n', '\n'+indent)) def start_entity(self, __type, **__params): """Write the start of an entity, ending with a newline""" param_text = "" if __params: param_text = " " + string.join(map(lambda p:'%s="%s"'%(p[0].lower(), p[1]), __params.items())) self.write("<" + __type + param_text + ">") self.__indent = self.__indent + 2 self.write("\n") def end_entity(self, type): """Write the end of an entity, starting with a newline""" self.__indent = self.__indent - 2 self.write("\n") def write_entity(self, __type, __body, **__params): """Write a single entity on one line (though body may contain newlines)""" param_text = "" if __params: param_text = " " + string.join(map(lambda p:'%s="%s"'%(p[0].lower(), p[1]), __params.items())) self.write("<" + __type + param_text + ">") self.__indent = self.__indent + 2 self.write(__body) self.__indent = self.__indent - 2 self.write("") def entity(self, __type, __body, **__params): """Return but do not write the text for an entity on one line""" param_text = "" if __params: param_text = " " + string.join(map(lambda p:'%s="%s"'%(p[0].lower(), p[1]), __params.items())) return "<%s%s>%s"%(__type, param_text, __body, __type) def reference(self, ref, label): """reference takes two strings, a reference (used to look up the symbol and generated the reference), and the label (used to actually write it)""" location = self.__toc.lookup(ref) if location != "": return href("#" + location, label) else: return span("type", str(label)) def label(self, ref): location = self.__toc.lookup(str(ref)) ref = str(self.scope().prune(ref)) if location != "": return name("\"" + location + "\"", ref) else: return ref def type_label(self): return self.__type_label #################### Type Visitor ########################################## def visit_builtin_type_id(self, type): self.__type_ref = str(type.name) self.__type_label = str(type.name) def visit_unknown_type_id(self, type): self.__type_ref = str(type.name) self.__type_label = str(self.scope().prune(type.name)) def visit_declared_type_id(self, type): self.__type_label = str(self.scope().prune(type.name)) self.__type_ref = str(type.name) def visit_modifier_type_id(self, type): type.alias.accept(self) self.__type_ref = ''.join(type.premod) + ' ' + self.__type_ref + ' ' + ''.join(type.postmod) self.__type_label = ''.join(type.premod) + ' ' + self.__type_label + ' ' + ''.join(type.postmod) def visit_parametrized_type_id(self, type): type.template.accept(self) type_label = self.__type_label + "<" parameters_label = [] for p in type.parameters: p.accept(self) parameters_label.append(self.__type_label) self.__type_label = type_label + ', '.join(parameters_label) + '>' def format_type(self, type): type.accept(self) return self.__type_label def visit_function_type_id(self, type): # TODO: this needs to be implemented self.__type_ref = 'function_type' self.__type_label = 'function_type' def process_doc(self, doc): text = doc.replace('\n\n', '') self.write(self.entity("para", text)+'\n') #################### ASG Visitor ########################################### def visit_declarator(self, node): self.__declarator = node.name for i in node.sizes: self.__declarator[-1] = self.__declarator[-1] + '[%d]'%i def visit_typedef(self, typedef): self.start_entity("typedef", name=str(self.scope().prune(typedef.name))) self.write_entity("type", self.format_type(typedef.alias)) self.end_entity("typedef") def visit_variable(self, variable): self.start_entity("fieldsynopsis") variable.vtype.accept(self) self.entity("type", self.type_label()) self.entity("varname", variable.name[-1]) self.end_entity("fieldsynopsis") def visit_const(self, const): print "sorry, not implemented" def visit_module(self, module): self.start_entity("namespace", name=str(self.scope().prune(module.name))) self.write("\n") self.process_doc(module.annotations.get('doc', '')) self.push_scope(module.name) for declaration in module.declarations: declaration.accept(self) self.pop_scope() self.end_entity("namespace") def visit_class(self, class_): self.start_entity("class", name=str(self.scope().prune(class_.name))) # class_.type for p in class_.parents: p.accept(self) self.push_scope(class_.name) if class_.annotations.has_key('doc'): self.start_entity("purpose") self.process_doc(class_.annotations.get['doc']) self.end_entity("purpose") for d in class_.declarations: d.accept(self) self.pop_scope() self.end_entity("class") def visit_inheritance(self, inheritance): if len(inheritance.attributes()): self.start_entity("inherit", access=inheritance.attributes()[0]) else: self.start_entity("inherit") self.write_entity("classname", self.format_type(inheritance.parent())) self.end_entity("inherit") def visit_parameter(self, parameter): self.start_entity("parameter", name=parameter.name) self.write_entity("param_type", self.format_type(parameter.type)) #map(lambda m, this=self: this.write_entity("modifier", m), parameter.premodifier) #map(lambda m, this=self: this.write_entity("modifier", m), parameter.postmodifier) self.end_entity("parameter") self.write("\n") def visit_function(self, function): self.start_entity("function", name=str(self.scope().prune(function.real_name))) self.do_function(function) self.end_entity("function") self.write("\n") def visit_operation(self, operation): name = operation.name tag = None if len(name) > 1: if name[-1] == name[-2]: tag = "constructor" self.start_entity(tag) elif name[-1] == "~"+name[-2]: tag = "destructor" self.start_entity(tag) if tag is None: tag = "method" self.start_entity(tag, name=str(self.scope().prune(operation.real_name))) self.do_function(operation) self.end_entity(tag) self.write("\n") def do_function(self, func): """Stuff common to functions and methods, contructors, destructors""" for parameter in func.parameters: parameter.accept(self) if func.return_type: self.write_entity("type", self.format_type(func.return_type)) self.write("\n") if func.annotations.has_key('doc'): self.start_entity("purpose") self.process_doc(func.annotations['doc']) self.end_entity("purpose") self.write("\n") if func.exceptions: self.start_entity("throws") for ex in func.exceptions: self.write_entity("simpara", ex) self.end_entity("throws") self.write("\n") def visit_enumerator(self, enumerator): print "sorry, not implemented" def visit_enum(self, enum): print "sorry, not implemented" synopsis-0.12/Synopsis/Formatters/__init__.py0000664000076400007640000000433411136117214020746 0ustar stefanstefan# # Copyright (C) 2008 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # import os, stat try: import hashlib md5 = hashlib.md5 except ImportError: # 2.4 compatibility import md5 md5 = md5.new def quote_name(name): """Quotes a (file-) name to remove illegal characters and keep it within a reasonable length for the filesystem. The md5 hash function is used if the length of the name after quoting is more than 100 characters. If it is used, then as many characters at the start of the name as possible are kept intact, and the hash appended to make 100 characters. Do not pass filenames with meaningful extensions to this function, as the hash could destroy them.""" original = name # save the old name # a . is usually an extension, eg source page filename: "_page-foo.hpp" + .html # name = re.sub('\.','_',name) # The . is arbitrary.. for p in [('<', '.L'), ('>', '.R'), ('(', '.l'), (')', '.r'), ('::', '-'), (':', '.'), ('&', '.A'), ('*', '.S'), (' ', '.s'), (',', '.c'), (';', '.C')]: name = name.replace(*p) if len(name) > 100: digest = md5(original).hexdigest() # Keep as much of the name as possible name = name[:100 - len(digest)] + digest return name def open_file(path, mode=511): """Open a file for writing. Create all intermediate directories.""" directory = os.path.dirname(path) if directory and not os.path.isdir(directory): os.makedirs(directory, mode) return open(path, 'w+') def copy_file(src, dest): """Copy src to dest, if dest doesn't exist yet or is outdated.""" filetime = os.stat(src)[stat.ST_MTIME] if not os.path.exists(dest) or filetime > os.stat(dest)[stat.ST_MTIME]: open_file(dest).write(open(src, 'r').read()) def join_paths(prefix, path): """ This function joins `prefix` and `path`, irrespectively of whether `path` is absolute or not. To do this portably is non-trivial.""" # FIXME: Figure out how to do this portably. if path.startswith('/'): path = path[1:] return os.path.join(prefix, path) synopsis-0.12/Synopsis/Formatters/TOC.py0000664000076400007640000000632411104703264017636 0ustar stefanstefan# # Copyright (C) 2000 Stefan Seefeld # Copyright (C) 2000 Stephen Davies # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # """Table of Contents classes""" from Synopsis import ASG import re class Linker: """Abstract class for linking declarations. This class has only one method, link(decl), which returns the link for the given declaration. This is dependant on the type of formatter used, and so a Linker derivative must be passed to the TOC upon creation.""" def link(decl): pass class TOC(ASG.Visitor): """Maintains a dictionary of all declarations which can be looked up to create cross references. Names are fully scoped.""" class Entry: """Struct for an entry in the table of contents. Vars: link, lang, type (all strings) Also: name (scoped)""" def __init__(self, name, link, lang, type): self.name = name self.link = link self.lang = lang self.type = type def __init__(self, linker, verbose = False): """linker is an instance that implements the Linker interface and is used to generate the links from declarations.""" self.__toc = {} self.linker = linker self.verbose = verbose def keys(self): return self.__toc.keys() def lookup(self, name): name = tuple(name) if self.__toc.has_key(name): return self.__toc[name] if self.verbose and len(name) > 1: print "Warning: TOC lookup of",name,"failed!" return None def size(self): return len(self.__toc) __getitem__ = lookup def insert(self, entry): self.__toc[tuple(entry.name)] = entry def store(self, file): """store the table of contents into a file, such that it can be used later when cross referencing""" fout = open(file, 'w') nocomma = lambda str: str.replace("&","&").replace(",","&2c;") for name in self.__toc.keys(): scopedname = nocomma('::'.join(name)) lang = self.__toc[tuple(name)].lang link = nocomma(self.__toc[tuple(name)].link) fout.write(scopedname + "," + lang + "," + link + "\n") def load(self, resource): args = resource.split('|') file = args[0] if len(args) > 1: url = args[1] else: url = "" fin = open(file, 'r') line = fin.readline() recomma = lambda str: re.sub('&2c;', ',', str) while line: if line[-1] == '\n': line = line[:-1] scopedname, lang, link = line.split(',') scopedname, link = recomma(scopedname), recomma(link) param_index = scopedname.find('(') if param_index >= 0: name = scopedname[:param_index].split('::') name = name[:-1] + [name[-1]+scopedname[param_index:]] else: name = scopedname.split('::') if len(url): link = '/'.join([url, link]) entry = TOC.Entry(name, link, lang, "decl") self.insert(entry) line = fin.readline() def visit_declaration(self, decl): file = decl.file entry = TOC.Entry(decl.name, self.linker.link(decl), file and file.annotations['language'] or '', 'decl') self.insert(entry) synopsis-0.12/Synopsis/Formatters/ClassTree.py0000664000076400007640000001074711104703264021102 0ustar stefanstefan# # Copyright (C) 2000 Stefan Seefeld # Copyright (C) 2000 Stephen Davies # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # """Contains the utility class ClassTree, for creating inheritance trees.""" from Synopsis import ASG class ClassTree(ASG.Visitor): """Maintains a tree of classes directed by inheritance. This object always exists in HTML, since it is used for other things such as printing class bases.""" # TODO - only create if needed (if Info tells us to) def __init__(self): self.__superclasses = {} self.__subclasses = {} self.__classes = [] # Graph stuffs: self.__buckets = [] # List of buckets, each a list of classnames def add_inheritance(self, supername, subname): """Adds an edge to the graph. Supername and subname are the scoped names of the two classes involved in the edge, and are copied before being stored.""" self.add_class(supername) if not self.__subclasses.has_key(supername): subs = self.__subclasses[supername] = [] else: subs = self.__subclasses[supername] if subname not in subs: subs.append(subname) subs.sort() if not self.__superclasses.has_key(subname): sups = self.__superclasses[subname] = [] else: sups = self.__superclasses[subname] if supername not in sups: sups.append(supername) sups.sort() def subclasses(self, classname): """Returns a sorted list of all classes derived from the given class""" if self.__subclasses.has_key(classname): return self.__subclasses[classname] else: return [] def superclasses(self, classname): """Returns a sorted list of all classes the given class derives from. The classes are returned as scoped names, which you may use to lookup the class declarations in the 'types' dictionary if you need to.""" if self.__superclasses.has_key(classname): return self.__superclasses[classname] else: return [] def classes(self): """Returns a sorted list of all class names""" return self.__classes def add_class(self, name): """Adds a class to the list of classes by name""" if name not in self.__classes: self.__classes.append(name) self.__classes.sort() def roots(self): """Returns a list of classes that have no superclasses""" return [c for c in self.classes() if c not in self.__superclasses] # # Graph methods # def graphs(self): """Returns a list of graphs. Each graph is just a list of connected classes.""" self._make_graphs() return self.__buckets def leaves(self, graph): """Returns a list of leaves in the given graph. A leaf is a class with no subclasses""" return [c for c in graph if c not in self.__subclasses] def _make_graphs(self): processed = {} for root in self.roots(): if root in processed: continue bucket = [] self.__buckets.append(bucket) classes = [root] while len(classes): name = classes.pop() if name in processed: continue # Add to bucket bucket.append(name) processed[name] = True # Add super- and sub-classes classes.extend(self.superclasses(name)) classes.extend(self.subclasses(name)) # # ASG Visitor # def visit_scope(self, scope): for d in scope.declarations: d.accept(self) def visit_class(self, class_): """Adds this class and all edges to the lists""" self.add_class(class_.name) for inheritance in class_.parents: parent = inheritance.parent if hasattr(parent, 'declaration'): self.add_inheritance(parent.declaration.name, class_.name) elif isinstance(parent, ASG.ParametrizedTypeId) and parent.template: self.add_inheritance(parent.template.name, class_.name) elif isinstance(parent, ASG.UnknownTypeId): self.add_inheritance(parent.link, class_.name) for d in class_.declarations: d.accept(self) synopsis-0.12/Synopsis/Formatters/Dump.py0000664000076400007640000001561211122312026020106 0ustar stefanstefan# # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # """ Verbose attribute-oriented xml dump of ASG, useful for validation, introspection, and debugging. """ from Synopsis import config from Synopsis.Processor import * from Synopsis.SourceFile import SourceFile from Synopsis.DocString import DocString from Synopsis.QualifiedName import * import sys, getopt, os, os.path, string, types from xml.dom.minidom import getDOMImplementation dom = getDOMImplementation().createDocument(None, 'dump', None) class Formatter(Processor): show_ids = Parameter(True, 'output object ids as attributes') show_declarations = Parameter(True, 'output declarations') show_types = Parameter(True, 'output types') show_files = Parameter(True, 'output files') stylesheet = Parameter(config.datadir + '/dump.css', 'stylesheet to be referenced for rendering') def process(self, ir, **kwds): self.set_parameters(kwds) if not self.output: raise MissingArgument('output') self.ir = self.merge_input(ir) self.handlers = {type(None) : self.visit_none, type : self.visit_type, int : self.visit_string, long : self.visit_string, float : self.visit_string, str : self.visit_string, bool : self.visit_string, tuple : self.visit_tuple, list : self.visit_list, dict : self.visit_dict, types.InstanceType : self.visit_instance, QualifiedName : self.visit_string, QualifiedCxxName : self.visit_string, QualifiedPythonName : self.visit_string, SourceFile : self.visit_sourcefile, DocString : self.visit_docstring} self.visited = [] self.os = open(self.output, 'w') self.os.write('\n') if self.stylesheet: self.os.write('\n'%self.stylesheet) self.os.write('\n') self.os.write('\n') if self.show_declarations: self.write_declarations(self.ir.asg.declarations) if self.show_types: self.write_types(self.ir.asg.types) self.os.write('\n') if self.show_files: self.write_files(self.ir.files) self.os.write('\n') return self.ir def push(self, name): element = dom.createElement(name) self.node.appendChild(element) self.node = element def pop(self): self.node = self.node.parentNode def add_text(self, text): node = dom.createTextNode(text) self.node.appendChild(node) def visit(self, obj): i,t = id(obj), type(obj) if i in self.visited: if self.show_ids: self.node.setAttribute('xref', str(i)) return if self.handlers.has_key(t): self.handlers[t](obj) elif issubclass(t, object): self.visit_instance(obj) else: print 'Unknown type %s for object: "%s"'%(t,obj) def visit_none(self, obj): pass def visit_string(self, obj): self.add_text(str(obj)) def visit_type(self, obj): self.write(obj) # where is that used ?? def visit_tuple(self, obj): if len(obj) == 0: return for i in obj: self.push('item') self.visit(i) self.pop() def visit_list(self, obj): if len(obj) == 0: return for i in obj: self.push('item') self.visit(i) self.pop() def visit_dict(self, dict): items = dict.items() if len(items) == 0: return items.sort() for i in items: self.push('key') self.visit(i[0]) self.pop() self.push('value') self.visit(i[1]) self.pop() def visit_sourcefile(self, obj): self.node.setAttribute('name', obj.name) self.node.setAttribute('language', obj.annotations.get('language', '')) self.node.setAttribute('primary', str(obj.annotations.get('primary', False))) includes = getattr(obj, 'includes') if includes: self.push('includes') self.visit(includes) self.pop() if self.show_declarations: for name in ['declarations', 'macro_calls']: self.push(name) self.visit(getattr(obj, name)) self.pop() def visit_docstring(self, obj): self.node.setAttribute('markup', obj.markup) self.push('text') self.visit(obj.text) self.pop() def visit_instance(self, obj): self.visited.append(id(obj)) self.push('instance') self.node.setAttribute('class', '%s.%s'%(obj.__class__.__module__,obj.__class__.__name__)) if self.show_ids: self.node.setAttribute('id', str(id(obj))) if self.handlers.has_key(obj.__class__): self.handlers[obj.__class__](obj) else: attrs = obj.__dict__.items() attrs.sort() for name, value in attrs: # ignore None values if value in (None, [], ()): continue # ignore private attributes if name[0] == '_': continue # String attributes map to xml attributes. if self.handlers.get(type(value)) == self.visit_string: self.node.setAttribute(name, str(value)) # Everything else maps to sub-elements. else: self.push(name) self.visit(value) self.pop() self.pop() def write_declarations(self, declarations): self.node = dom.createElement('declarations') for d in declarations: self.push('item') self.visit(d) self.pop() self.node.writexml(self.os, indent=' ', addindent=' ', newl='\n') self.node.unlink() del self.node def write_types(self, types): self.node = dom.createElement('types') values = types.values() values.sort() for t in values: self.visit(t) self.node.writexml(self.os, indent=' ', addindent=' ', newl='\n') self.node.unlink() del self.node def write_files(self, files): self.node = dom.createElement('files') for f in files: self.visit(files[f]) self.node.writexml(self.os, indent=' ', addindent=' ', newl='\n') self.node.unlink() del self.node synopsis-0.12/Synopsis/Formatters/DocBook/0000775000076400007640000000000011172123232020146 5ustar stefanstefansynopsis-0.12/Synopsis/Formatters/DocBook/__init__.py0000664000076400007640000005350611104703264022274 0ustar stefanstefan# # Copyright (C) 2007 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # """a DocBook formatter (producing Docbook 4.5 XML output""" from Synopsis.Processor import * from Synopsis import ASG, DeclarationSorter from Synopsis.Formatters import quote_name from Synopsis.Formatters.TOC import TOC from Syntax import * from Markup.Javadoc import Javadoc try: from Markup.RST import RST except ImportError: from Markup import Formatter as RST import os def escape(text): for p in [('&', '&'), ('"', '"'), ('<', '<'), ('>', '>'),]: text = text.replace(*p) return text def reference(name): """Generate an id suitable as a 'linkend' / 'id' attribute, i.e. for linking.""" return quote_name(str(name)) class Linker: """Helper class to be used to resolve references from doc-strings to declarations.""" def link(self, decl): return reference(decl.name) class _BaseClasses(ASG.Visitor): def __init__(self): self.classes = [] # accumulated set of classes self.classes_once = [] # classes not to be included again def visit_declared_type_id(self, declared): declared.declaration.accept(self) def visit_class(self, class_): self.classes.append(class_) for p in class_.parents: p.accept(self) def visit_inheritance(self, inheritance): if 'private' in inheritance.attributes: return # Ignore private base classes, they are not visible anyway. elif inheritance.parent in self.classes_once: return # Do not include virtual base classes more than once. if 'virtual' in inheritance.attributes: self.classes_once.append(inheritance.parent) inheritance.parent.accept(self) _summary_syntax = { 'IDL': CxxSummarySyntax, 'C++': CxxSummarySyntax, 'C': CxxSummarySyntax, 'Python': PythonSummarySyntax } _detail_syntax = { 'IDL': CxxDetailSyntax, 'C++': CxxDetailSyntax, 'C': CxxDetailSyntax, 'Python': PythonDetailSyntax } class ModuleLister(ASG.Visitor): """Maps a module-tree to a (flat) list of modules.""" def __init__(self): self.modules = [] def visit_module(self, module): self.modules.append(module) for d in module.declarations: d.accept(self) class InheritanceFormatter: def __init__(self, base_dir, bgcolor): self.base_dir = base_dir self.bgcolor = bgcolor def format_class(self, class_, format): if not class_.parents: return '' from Synopsis.Formatters import Dot filename = os.path.join(self.base_dir, escape(str(class_.name)) + '.%s'%format) dot = Dot.Formatter(bgcolor=self.bgcolor) try: dot.process(IR.IR(asg = ASG.ASG(declarations = [class_])), output=filename, format=format, type='single') return filename except InvalidCommand, e: print 'Warning : %s'%str(e) return '' class FormatterBase: def __init__(self, processor, output, base_dir, nested_modules, secondary_index, inheritance_graphs, graph_color): self.processor = processor self.output = output self.base_dir = base_dir self.nested_modules = nested_modules self.secondary_index = secondary_index self.inheritance_graphs = inheritance_graphs self.graph_color = graph_color self.__scope = () self.__scopestack = [] self.__indent = 0 self.__elements = [] def scope(self): return self.__scope def push_scope(self, newscope): self.__scopestack.append(self.__scope) self.__scope = newscope def pop_scope(self): self.__scope = self.__scopestack[-1] del self.__scopestack[-1] def write(self, text): """Write some text to the output stream, replacing \n's with \n's and indents.""" indent = ' ' * self.__indent self.output.write(text.replace('\n', '\n'+indent)) def start_element(self, type, **params): """Write the start of an element, ending with a newline""" self.__elements.append(type) param_text = '' if params: param_text = ' ' + ' '.join(['%s="%s"'%(p[0].lower(), p[1]) for p in params.items()]) self.write('<' + type + param_text + '>') self.__indent = self.__indent + 2 self.write('\n') def end_element(self): """Write the end of an element, starting with a newline""" type = self.__elements.pop() self.__indent = self.__indent - 2 self.write('\n') self.write('\n') def write_element(self, element, body, end = '\n', **params): """Write a single element on one line (though body may contain newlines)""" param_text = '' if params: param_text = ' ' + ' '.join(['%s="%s"'%(p[0].lower(), p[1]) for p in params.items()]) self.write('<' + element + param_text + '>') self.__indent = self.__indent + 2 self.write(body) self.__indent = self.__indent - 2 self.write('' + end) def element(self, element, body, **params): """Return but do not write the text for an element on one line""" param_text = '' if params: param_text = ' ' + ' '.join(['%s="%s"'%(p[0].lower(), p[1]) for p in params.items()]) return '<%s%s>%s'%(element, param_text, body, element) class SummaryFormatter(FormatterBase, ASG.Visitor): """A SummaryFormatter.""" def process_doc(self, decl): if decl.annotations.get('doc', ''): summary = self.processor.documentation.summary(decl) if summary: # FIXME: Unfortunately, as of xsl-docbook 1.73, a section role # doesn't translate into a div class attribute, so there # is no way to style summaries and descriptions per se. #self.write('
    \n%s
    \n'%summary) self.write('%s\n'%summary) #################### ASG Visitor ########################################### def visit_declaration(self, declaration): language = declaration.file.annotations['language'] syntax = _summary_syntax[language](self.output) declaration.accept(syntax) syntax.finish() self.process_doc(declaration) visit_module = visit_declaration visit_class = visit_declaration def visit_meta_module(self, meta): self.visit_module(meta.module_declarations[0]) visit_function = visit_declaration def visit_enum(self, enum): print "sorry, not implemented" class DetailFormatter(FormatterBase, ASG.Visitor): #################### Type Visitor ########################################## def visit_builtin_type_id(self, type): self.__type_ref = str(type.name) self.__type_label = str(type.name) def visit_unknown_type_id(self, type): self.__type_ref = str(type.name) self.__type_label = str(self.scope().prune(type.name)) def visit_declared_type_id(self, type): self.__type_label = str(self.scope().prune(type.name)) self.__type_ref = str(type.name) def visit_modifier_type_id(self, type): type.alias.accept(self) self.__type_ref = ''.join(type.premod) + ' ' + self.__type_ref + ' ' + ''.join(type.postmod) self.__type_label = escape(''.join(type.premod) + ' ' + self.__type_label + ' ' + ''.join(type.postmod)) def visit_parametrized_type_id(self, type): type.template.accept(self) type_label = self.__type_label + '<' parameters_label = [] for p in type.parameters: p.accept(self) parameters_label.append(self.__type_label) self.__type_label = type_label + ', '.join(parameters_label) + '>' def visit_function_type_id(self, type): # TODO: this needs to be implemented self.__type_ref = 'function_type' self.__type_label = 'function_type' def process_doc(self, decl): if decl.annotations.get('doc', ''): detail = self.processor.documentation.details(decl) if detail: # FIXME: Unfortunately, as of xsl-docbook 1.73, a section role # doesn't translate into a div class attribute, so there # is no way to style summaries and descriptions per se. #self.write('
    \n%s
    \n'%detail) self.write('%s\n'%detail) #################### ASG Visitor ########################################### def visit_declaration(self, declaration): if self.processor.hide_undocumented and not declaration.annotations.get('doc'): return self.start_element('section', id=reference(declaration.name)) self.write_element('title', escape(declaration.name[-1])) if isinstance(declaration, ASG.Function): # The primary index term is the unqualified name, # the secondary the qualified name. # This will result in index terms being grouped by name, with each # qualified name being listed within that group. indexterm = self.element('primary', escape(declaration.real_name[-1])) if self.secondary_index: indexterm += self.element('secondary', escape(str(declaration.real_name))) self.write_element('indexterm', indexterm, type='functions') language = declaration.file.annotations['language'] syntax = _detail_syntax[language](self.output) declaration.accept(syntax) syntax.finish() self.process_doc(declaration) self.end_element() def generate_module_list(self, modules): if modules: modules.sort(cmp=lambda a,b:cmp(a.name, b.name)) self.start_element('section') self.write_element('title', modules[0].type.capitalize() + 's') self.start_element('itemizedlist') for m in modules: link = self.element('link', escape(str(m.name)), linkend=reference(m.name)) self.write_element('listitem', self.element('para', link)) self.end_element() self.end_element() def format_module_or_group(self, module, title, sort): self.start_element('section', id=reference(module.name)) self.write_element('title', title) declarations = module.declarations if not self.nested_modules: modules = [d for d in declarations if isinstance(d, ASG.Module)] declarations = [d for d in declarations if not isinstance(d, ASG.Module)] self.generate_module_list(modules) sorter = DeclarationSorter.DeclarationSorter(declarations, group_as_section=False) if self.processor.generate_summary: self.start_element('section') self.write_element('title', 'Summary') summary = SummaryFormatter(self.processor, self.output) if sort: for s in sorter: #if s[-1] == 's': title = s + 'es Summary' #else: title = s + 's Summary' #self.start_element('section') #self.write_element('title', escape(title)) for d in sorter[s]: if not self.processor.hide_undocumented or d.annotations.get('doc'): d.accept(summary) #self.end_element() else: for d in declarations: if not self.processor.hide_undocumented or d.annotations.get('doc'): d.accept(summary) self.end_element() self.write('\n') self.start_element('section') self.write_element('title', 'Details') self.process_doc(module) self.push_scope(module.name) suffix = self.processor.generate_summary and ' Details' or '' if sort: for section in sorter: #title = section + suffix #self.start_element('section') #self.write_element('title', escape(title)) for d in sorter[section]: d.accept(self) #self.end_element() else: for d in declarations: d.accept(self) self.pop_scope() self.end_element() self.write('\n') if self.processor.generate_summary: self.end_element() self.write('\n') def visit_module(self, module): if module.name: # Only print qualified names when modules are flattened. name = self.nested_modules and module.name[-1] or str(module.name) title = '%s %s'%(module.type.capitalize(), name) else: title = 'Global %s'%module.type.capitalize() self.format_module_or_group(module, title, True) def visit_group(self, group): self.format_module_or_group(group, group.name[-1].capitalize(), False) def visit_class(self, class_): if self.processor.hide_undocumented and not class_.annotations.get('doc'): return self.start_element('section', id=reference(class_.name)) title = '%s %s'%(class_.type, class_.name[-1]) self.write_element('title', escape(title)) indexterm = self.element('primary', escape(class_.name[-1])) if self.secondary_index: indexterm += self.element('secondary', escape(str(class_.name))) self.write_element('indexterm', indexterm, type='types') if self.inheritance_graphs: formatter = InheritanceFormatter(os.path.join(self.base_dir, 'images'), self.graph_color) png = formatter.format_class(class_, 'png') svg = formatter.format_class(class_, 'svg') if png or svg: self.start_element('mediaobject') if png: imagedata = self.element('imagedata', '', fileref=png, format='PNG') self.write_element('imageobject', imagedata) if svg: imagedata = self.element('imagedata', '', fileref=svg, format='SVG') self.write_element('imageobject', imagedata) self.end_element() declarations = class_.declarations # If so desired, flatten inheritance tree if self.processor.inline_inherited_members: declarations = class_.declarations[:] bases = _BaseClasses() for i in class_.parents: bases.visit_inheritance(i) for base in bases.classes: for d in base.declarations: if type(d) == ASG.Operation: if d.real_name[-1] == base.name[-1]: # Constructor continue elif d.real_name[-1] == '~' + base.name[-1]: # Destructor continue elif d.real_name[-1] == 'operator=': # Assignment continue declarations.append(d) sorter = DeclarationSorter.DeclarationSorter(declarations, group_as_section=False) if self.processor.generate_summary: self.start_element('section') self.write_element('title', 'Summary') summary = SummaryFormatter(self.processor, self.output) summary.process_doc(class_) for section in sorter: #title = section + ' Summary' #self.start_element('section') #self.write_element('title', escape(title)) for d in sorter[section]: if not self.processor.hide_undocumented or d.annotations.get('doc'): d.accept(summary) #self.end_element() self.end_element() self.write('\n') self.start_element('section') self.write_element('title', 'Details') self.process_doc(class_) self.push_scope(class_.name) suffix = self.processor.generate_summary and ' Details' or '' for section in sorter: #title = section + suffix #self.start_element('section') #self.write_element('title', escape(title)) for d in sorter[section]: d.accept(self) #self.end_element() self.pop_scope() self.end_element() self.write('\n') if self.processor.generate_summary: self.end_element() self.write('\n') def visit_inheritance(self, inheritance): for a in inheritance.attributes: self.element("modifier", a) self.element("classname", str(self.scope().prune((inheritance.parent.name)))) def visit_parameter(self, parameter): parameter.type.accept(self) visit_function = visit_declaration def visit_enum(self, enum): if self.processor.hide_undocumented and not declaration.annotations.get('doc'): return self.start_element('section', id=reference(enum.name)) self.write_element('title', escape(enum.name[-1])) indexterm = self.element('primary', escape(enum.name[-1])) if self.secondary_index: indexterm += self.element('secondary', escape(str(enum.name))) self.write_element('indexterm', indexterm, type='types') language = enum.file.annotations['language'] syntax = _detail_syntax[language](self.output) enum.accept(syntax) syntax.finish() self.process_doc(enum) self.end_element() class DocCache: """""" def __init__(self, processor, markup_formatters): self._processor = processor self._markup_formatters = markup_formatters # Make sure we have a default markup formatter. if '' not in self._markup_formatters: self._markup_formatters[''] = Markup.Formatter() for f in self._markup_formatters.values(): f.init(self._processor) self._doc_cache = {} def _process(self, decl): """Return the documentation for the given declaration.""" key = id(decl) if key not in self._doc_cache: doc = decl.annotations.get('doc') if doc: formatter = self._markup_formatters.get(doc.markup, self._markup_formatters['']) doc = formatter.format(decl) else: doc = Markup.Struct() self._doc_cache[key] = doc return doc else: return self._doc_cache[key] def summary(self, decl): """""" doc = self._process(decl) return doc.summary def details(self, decl): """""" doc = self._process(decl) return doc.details class Formatter(Processor): """Generate a DocBook reference.""" markup_formatters = Parameter({'rst':RST(), 'reStructuredText':RST(), 'javadoc':Javadoc()}, 'Markup-specific formatters.') title = Parameter(None, 'title to be used in top-level section') nested_modules = Parameter(False, """Map the module tree to a tree of docbook sections.""") generate_summary = Parameter(False, 'generate scope summaries') hide_undocumented = Parameter(False, 'hide declarations without a doc-string') inline_inherited_members = Parameter(False, 'show inherited members') secondary_index_terms = Parameter(True, 'add fully-qualified names to index') with_inheritance_graphs = Parameter(True, 'whether inheritance graphs should be generated') graph_color = Parameter('#ffcc99', 'base color for inheritance graphs') def process(self, ir, **kwds): self.set_parameters(kwds) if not self.output: raise MissingArgument('output') self.ir = self.merge_input(ir) self.documentation = DocCache(self, self.markup_formatters) self.toc = TOC(Linker()) for d in self.ir.asg.declarations: d.accept(self.toc) output = open(self.output, 'w') output.write('
    \n') if self.title: output.write('%s\n'%self.title) detail_formatter = DetailFormatter(self, output, os.path.dirname(self.output), self.nested_modules, self.secondary_index_terms, self.with_inheritance_graphs, self.graph_color) declarations = self.ir.asg.declarations if not self.nested_modules: modules = [d for d in declarations if isinstance(d, ASG.Module)] detail_formatter.generate_module_list(modules) module_lister = ModuleLister() for d in self.ir.asg.declarations: d.accept(module_lister) modules = module_lister.modules modules.sort(cmp=lambda a,b:cmp(a.name, b.name)) declarations = [d for d in self.ir.asg.declarations if not isinstance(d, ASG.Module)] declarations.sort(cmp=lambda a,b:cmp(a.name, b.name)) declarations = modules + declarations for d in declarations: d.accept(detail_formatter) output.write('
    \n') output.close() return self.ir synopsis-0.12/Synopsis/Formatters/DocBook/Markup/0000775000076400007640000000000011172123232021405 5ustar stefanstefansynopsis-0.12/Synopsis/Formatters/DocBook/Markup/__init__.py0000664000076400007640000000664211104703264023532 0ustar stefanstefan# # Copyright (C) 2006 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # """Markup formatters.""" from Synopsis.Processor import Parametrized, Parameter from Synopsis import ASG from Synopsis.QualifiedName import * import re def escape(text): for p in [('&', '&'), ('"', '"'), ('<', '<'), ('>', '>'),]: text = text.replace(*p) return text class Struct: def __init__(self, summary = '', details = ''): self.summary = summary self.details = details class Formatter(Parametrized): """Interface class that takes a 'doc' annotation and formats its text. Markup-specific subclasses should provide appropriate format methods.""" def init(self, processor): self.processor = processor def format(self, decl): """Format the declaration's documentation. @param view the View to use for references and determining the correct relative filename. @param decl the declaration @returns Struct containing summary / details pair. """ doc = decl.annotations.get('doc') text = doc and escape(doc.text) or '' m = re.match(r'(\s*[\w\W]*?\.)(\s|$)', text) summary = m and '%s\n'%m.group(1) or '' if text: text = '%s\n'%text return Struct(summary, text) def lookup_symbol(self, symbol, scope): """Given a symbol and a scope, returns an URL. Various methods are tried to resolve the symbol. First the parameters are taken off, then we try to split the symbol using '.' or '::'. The params are added back, and then we try to match this scoped name against the current scope. If that fails, then we recursively try enclosing scopes. """ # Remove params index = symbol.find('(') if index >= 0: params = symbol[index:] symbol = symbol[:index] else: params = '' if '.' in symbol: symbol = QualifiedPythonName(symbol.split('.')) else: symbol = QualifiedCxxName(symbol.split('::')) # Add params back symbol = symbol[:-1] + (symbol[-1] + params,) # Find in all scopes while 1: entry = self._lookup_symbol_in(symbol, scope) if entry: return entry.link if len(scope) == 0: break scope = scope[:-1] # Not found return None def _lookup_symbol_in(self, symbol, scope): paren = symbol[-1].find('(') if paren != -1: return self._find_method_entry(symbol[-1], scope + symbol[:-1]) else: return self.processor.toc.lookup(scope + symbol) def _find_method_entry(self, name, scope): try: scope = self.processor.ir.asg.types[scope] except KeyError: return None if not isinstance(scope, ASG.DeclaredTypeId): return None scope = scope.declaration if not isinstance(scope, ASG.Scope): return None # For now disregard parameters during lookup. name = name[:name.find('(')] for d in scope.declarations: if isinstance(d, ASG.Function): if d.real_name[-1] == name: return self.processor.toc.lookup(d.name) return None synopsis-0.12/Synopsis/Formatters/DocBook/Markup/Javadoc.py0000664000076400007640000002210411104703264023331 0ustar stefanstefan# # Copyright (C) 2006 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Formatters.DocBook.Markup import * import re def attributes(keys): "Convert a name/value dict to a string of attributes" return ''.join(['%s="%s"'%(k,v) for k,v in keys.items()]) def element(_type, body, **keys): "Wrap the body in a tag of given type and attributes" return '<%s %s>%s'%(_type,attributes(keys),body,_type) def title(name) : return element('title', name) def para(body) : return element('para', body) def listitem(body) : return element('listitem', body) def term(body) : return element('term', body) def link(linkend, label) : return element('link', label, linkend=linkend) class Javadoc(Formatter): """ A formatter that formats comments similar to Javadoc. See `Javadoc Spec`_ for info. .. _Javadoc Spec: http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javadoc.html""" class Block: def __init__(self, tag, arg, body): self.tag, self.arg, self.body = tag, arg, body summary = r'(\s*[\w\W]*?\.)(\s|$)' block_tag = r'(^\s*\@\w+[\s$])' inline_tag = r'{@(?P\w+)\s+(?P[^}]+)}' inline_tag_split = r'({@\w+\s+[^}]+})' xref = r'([\w#.]+)(?:\([^\)]*\))?\s*(.*)' tag_name = { 'author': ['Author', 'Authors'], 'date': ['Date', 'Dates'], 'deprecated': ['Deprecated', 'Deprecated'], 'exception': ['Exception', 'Exceptions'], 'invariant': ['Invariant', 'Invariants'], 'keyword': ['Keyword', 'Keywords'], 'param': ['Parameter', 'Parameters'], 'postcondition': ['Postcondition', 'Postcondition'], 'precondition': ['Precondition', 'Preconditions'], 'return': ['Returns', 'Returns'], 'see': ['See also', 'See also'], 'throws': ['Throws', 'Throws'], 'version': ['Version', 'Versions']} arg_tags = ['param', 'keyword', 'exception'] def __init__(self): """Create regex objects for regexps""" self.summary = re.compile(Javadoc.summary) self.block_tag = re.compile(Javadoc.block_tag, re.M) self.inline_tag = re.compile(Javadoc.inline_tag) self.inline_tag_split = re.compile(Javadoc.inline_tag_split) self.xref = re.compile(Javadoc.xref) def split(self, doc): """Split a javadoc comment into description and blocks.""" chunks = self.block_tag.split(doc) description = chunks[0] blocks = [] for i in range(1, len(chunks)): if i % 2 == 1: tag = chunks[i].strip()[1:] else: if tag in self.arg_tags: arg, body = chunks[i].strip().split(None, 1) else: arg, body = None, chunks[i] if tag == 'see' and body: if body[0] in ['"', "'"]: if body[-1] == body[0]: body = body[1:-1] elif body[0] == '<': pass else: # @link tags are interpreted as cross-references # and resolved later (see format_inline_tag) body = '{@link %s}'%body blocks.append(Javadoc.Block(tag, arg, body)) return description, blocks def extract_summary(self, description): """Generate a summary from the given description.""" m = self.summary.match(description) if m: return '%s\n'%m.group(1) else: return '%s\n'%(description.split('\n', 1)[0]+'...') def format(self, decl): """Format using javadoc markup.""" doc = decl.annotations.get('doc') doc = doc and doc.text or '' if not doc: return Struct('', '') description, blocks = self.split(doc) details = self.format_description(description, decl) summary = self.extract_summary(details) details += self.format_params(blocks, decl) details += self.format_variablelist('return', blocks, decl) details += self.format_throws(blocks, decl) vl = self.format_varlistentry('precondition', blocks, decl) vl += self.format_varlistentry('postcondition', blocks, decl) vl += self.format_varlistentry('invariant', blocks, decl) vl += self.format_varlistentry('author', blocks, decl) vl += self.format_varlistentry('date', blocks, decl) vl += self.format_varlistentry('version', blocks, decl) vl += self.format_varlistentry('deprecated', blocks, decl) vl += self.format_varlistentry('see', blocks, decl) if vl: details += '\n%s\n\n'%vl return Struct(summary, details) def format_description(self, text, decl): return '%s\n'%self.format_inlines(decl, text) def format_inlines(self, decl, text): """Formats inline tags in the text.""" chunks = self.inline_tag_split.split(text) text = '' # Every other chunk is now an inlined tag, which we process # in this loop. for i in range(len(chunks)): if i % 2 == 0: text += chunks[i] else: m = self.inline_tag.match(chunks[i]) if m: text += self.format_inline_tag(m.group('tag'), m.group('content'), decl) return text def format_params(self, blocks, decl): """Formats a list of (param, description) tags""" content = '' params = [b for b in blocks if b.tag == 'param'] if params: params = [element('varlistentry', term(p.arg) + listitem(para(p.body))) for p in params] content += element('variablelist', title('Parameters') + '\n' + '\n'.join(params)) kwds = [b for b in blocks if b.tag == 'keyword'] if kwds: kwds = [element('varlistentry', term(k.arg) + listitem(para(k.body))) for k in kwds] content += element('variablelist', title('Keywords') + '\n' + '\n'.join(kwds)) return content def format_throws(self, blocks, decl): content = '' throws = [b for b in blocks if b.tag in ['throws', 'exception']] if throws: throws = [element('varlistentry', term(t.arg) + listitem(para(t.body))) for t in throws] content += element('variablelist', title('Throws') + '\n' + '\n'.join(throws)) return content def format_variablelist(self, tag, blocks, decl): """ Generate a variablelist for the given tag. Each matching block is formatted to a varlistentry, with the value of its 'arg' member becoming the term.""" content = '' items = [b for b in blocks if b.tag == tag] if items: items = [element('varlistentry', term(i.arg) + listitem(para(self.format_inlines(decl, i.body)))) for i in items] content += element('variablelist', title(self.tag_name[tag][1]) + '\n' + '\n'.join(items)) return content def format_varlistentry(self, tag, blocks, decl): """ Generate a varlistentry for the given tag. The tag value itself becomes the term. If multiple blocks match, format them as an (inlined) simplelist, otherwise as a para.""" items = [b for b in blocks if b.tag == tag] if not items: return '' if len(items) > 1: items = [element('member', self.format_inlines(decl, i.body)) for i in items] content = element('simplelist', '\n'.join(items), type='inline') + '\n' else: content = element('para', self.format_inlines(decl, items[0].body)) return element('varlistentry', term(self.tag_name[tag][1]) + '\n' + listitem(content)) def format_inline_tag(self, tag, content, decl): text = '' if tag == 'link': xref = self.xref.match(content) name, label = xref.groups() if not label: label = name # javadoc uses '{@link package.class#member label}' # Here we simply replace '#' by either '::' or '.' to match # language-specific qualification rules. if '#' in name: if '::' in name: name = name.replace('#', '::') else: name = name.replace('#', '.') target = self.lookup_symbol(name, decl.name[:-1]) if target: text += link(target, label) else: text += label elif tag == 'code': text += '%s'%escape(content) elif tag == 'literal': text += '%s'%escape(content) return text synopsis-0.12/Synopsis/Formatters/DocBook/Markup/RST.py0000664000076400007640000011564311104703264022445 0ustar stefanstefan# # Copyright (C) 2007 Stefan Seefeld # Copyright (C) Ollie Rutherford # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Formatters.DocBook.Markup import * from docutils import writers, nodes, languages from docutils.nodes import * from docutils.core import * from docutils.parsers.rst import roles import string, re, StringIO class Writer(writers.Writer): settings_spec = ( 'DocBook-Specific Options', None, (('Set DocBook document type. ' 'Choices are "article", "book", and "chapter". ' 'Default is "article".', ['--doctype'], {'default': 'article', 'metavar': '', 'type': 'choice', 'choices': ('article', 'book', 'chapter',) } ), ) ) """DocBook does its own section numbering""" settings_default_overrides = {'enable_section_numbering': 0} output = None """Final translated form of `document`.""" def translate(self): visitor = DocBookTranslator(self.document) self.document.walkabout(visitor) self.output = visitor.astext() class DocBookTranslator(nodes.NodeVisitor): def __init__(self, document): nodes.NodeVisitor.__init__(self, document) self.language = languages.get_language( document.settings.language_code) self.doctype = document.settings.doctype self.body = [] self.section = 0 self.context = [] self.colnames = [] self.footnotes = {} self.footnote_map = {} self.docinfo = [] self.title = '' self.subtitle = '' def astext(self): return ''.join(self.docinfo + self.body) def encode(self, text): """Encode special characters in `text` & return.""" # @@@ A codec to do these and all other # HTML entities would be nice. text = text.replace("&", "&") text = text.replace("<", "<") text = text.replace('"', """) text = text.replace(">", ">") return text def encodeattr(self, text): """Encode attributes characters > 128 as &#XXX;""" buff = [] for c in text: if ord(c) >= 128: buff.append('&#%d;' % ord(c)) else: buff.append(c) return ''.join(buff) def rearrange_footnotes(self): """ Replaces ``foonote_reference`` placeholders with ``footnote`` element content as DocBook and reST handle footnotes differently. DocBook defines footnotes inline, whereas they may be anywere in reST. This function replaces the first instance of a ``footnote_reference`` with the ``footnote`` element itself, and later references of the same a footnote with ``footnoteref`` elements. """ for (footnote_id,refs) in self.footnote_map.items(): ref_id, context, pos = refs[0] context[pos] = ''.join(self.footnotes[footnote_id]) for ref_id, context, pos in refs[1:]: context[pos] = '' \ % (footnote_id,) def attval(self, text, transtable=string.maketrans('\n\r\t\v\f', ' ')): """Cleanse, encode, and return attribute value text.""" return self.encode(text.translate(transtable)) def starttag(self, node, tagname, suffix='\n', infix='', **attributes): """ Construct and return a start tag given a node (id & class attributes are extracted), tag name, and optional attributes. """ atts = {} for (name, value) in attributes.items(): atts[name.lower()] = value for att in ('id',): # node attribute overrides if node.has_key(att): atts[att] = node[att] attlist = atts.items() attlist.sort() parts = [tagname.lower()] for name, value in attlist: if value is None: # boolean attribute # this came from the html writer, but shouldn't # apply here, as an element with no attribute # isn't well-formed XML. parts.append(name.lower()) elif isinstance(value, list): values = [str(v) for v in value] parts.append('%s="%s"' % (name.lower(), self.attval(' '.join(values)))) else: name = self.encodeattr(name.lower()) value = str(self.encodeattr(unicode(value))) value = self.attval(value) parts.append('%s="%s"' % (name,value)) return '<%s%s>%s' % (' '.join(parts), infix, suffix) def emptytag(self, node, tagname, suffix='\n', **attributes): """Construct and return an XML-compatible empty tag.""" return self.starttag(node, tagname, suffix, infix=' /', **attributes) def visit_Text(self, node): self.body.append(self.encode(node.astext())) def depart_Text(self, node): pass def visit_address(self, node): # handled by visit_docinfo pass def depart_address(self, node): # handled by visit_docinfo pass def visit_admonition(self, node, name=''): self.body.append(self.starttag(node, 'note')) def depart_admonition(self, node=None): self.body.append('\n') def visit_attention(self, node): self.body.append(self.starttag(node, 'note')) self.body.append('\n%s\n' % (self.language.labels[node.tagname],)) def depart_attention(self, node): self.body.append('\n') def visit_attribution(self, node): # attribution must precede blockquote content if isinstance(node.parent, nodes.block_quote): raise nodes.SkipNode self.body.append(self.starttag(node, 'attribution', '')) def depart_attribution(self, node): # attribution must precede blockquote content if not isinstance(node.parent, nodes.block_quote): self.body.append('\n') # author is handled in ``visit_docinfo()`` def visit_author(self, node): raise nodes.SkipNode # authors is handled in ``visit_docinfo()`` def visit_authors(self, node): raise nodes.SkipNode def visit_block_quote(self, node): self.body.append(self.starttag(node, 'blockquote')) if isinstance(node[-1], nodes.attribution): self.body.append('%s\n' % node[-1].astext()) def depart_block_quote(self, node): self.body.append('\n') def visit_bullet_list(self, node): self.body.append(self.starttag(node, 'itemizedlist')) def depart_bullet_list(self, node): self.body.append('\n') def visit_caption(self, node): # NOTE: ideally, this should probably be stuffed into # the mediaobject as a "caption" element self.body.append(self.starttag(node, 'para')) def depart_caption(self, node): self.body.append('') def visit_caution(self, node): self.body.append(self.starttag(node, 'caution')) self.body.append('\n%s\n' % (self.language.labels[node.tagname],)) def depart_caution(self, node): self.body.append('\n') # reST & DocBook ciations are somewhat # different creatures. # # reST seems to handle citations as a labled # footnotes, whereas DocBook doesn't from what # I can tell. In DocBook, it looks like they're # an abbreviation for a published work, which # might be in the bibliography. # # Quote: # # The content of a Citation is assumed to be a reference # string, perhaps identical to an abbreviation in an entry # in a Bibliography. # # I hoped to have citations behave look footnotes, # using the citation label as the footnote label, # which would seem functionally equivlent, however # the DocBook stylesheets for generating HTML & FO # output don't seem to be using the label for foonotes # so this doesn't work very well. # # Any ideas or suggestions would be welcome. def visit_citation(self, node): self.visit_footnote(node) def depart_citation(self, node): self.depart_footnote(node) def visit_citation_reference(self, node): self.visit_footnote_reference(node) def depart_citation_reference(self, node): # there isn't a a depart_footnote_reference pass def visit_classifier(self, node): self.body.append(self.starttag(node, 'type')) def depart_classifier(self, node): self.body.append('\n') def visit_colspec(self, node): self.colnames.append('col_%d' % (len(self.colnames) + 1,)) atts = {'colname': self.colnames[-1]} self.body.append(self.emptytag(node, 'colspec', **atts)) def depart_colspec(self, node): pass def visit_comment(self, node, sub=re.compile('-(?=-)').sub): """Escape double-dashes in comment text.""" self.body.append('\n' % sub('- ', node.astext())) raise nodes.SkipNode # contact is handled in ``visit_docinfo()`` def visit_contact(self, node): raise nodes.SkipNode # copyright is handled in ``visit_docinfo()`` def visit_copyright(self, node): raise nodes.SkipNode def visit_danger(self, node): self.body.append(self.starttag(node, 'caution')) self.body.append('\n%s\n' % (self.language.labels[node.tagname],)) def depart_danger(self, node): self.body.append('\n') # date is handled in ``visit_docinfo()`` def visit_date(self, node): raise nodes.SkipNode def visit_decoration(self, node): pass def depart_decoration(self, node): pass def visit_definition(self, node): # "term" is not closed in depart_term self.body.append('\n') self.body.append(self.starttag(node, 'listitem')) def depart_definition(self, node): self.body.append('\n') def visit_definition_list(self, node): self.body.append(self.starttag(node, 'variablelist')) def depart_definition_list(self, node): self.body.append('\n') def visit_definition_list_item(self, node): self.body.append(self.starttag(node, 'varlistentry')) def depart_definition_list_item(self, node): self.body.append('\n') def visit_description(self, node): self.body.append(self.starttag(node, 'entry')) def depart_description(self, node): self.body.append('\n') def visit_docinfo(self, node): """ Collects all docinfo elements for the document. Since reST's bibliography elements don't map very cleanly to DocBook, rather than maintain state and check dependencies within the different visitor fuctions all processing of bibliography elements is dont within this function. .. NOTE:: Skips processing of all child nodes as everything should be collected here. """ # XXX There are a number of fields in docinfo elements # which don't map nicely to docbook elements and # reST allows one to insert arbitrary fields into # the header, We need to be able to handle fields # which either don't map nicely or are unexpected. # I'm thinking of just using DocBook to display these # elements in some sort of tabular format -- but # to collect them is not straight-forward. # Paragraphs, links, lists, etc... can all live within # the values so we either need a separate visitor # to translate these elements, or to maintain state # in any possible child elements (not something I # want to do). docinfo = ['<%sinfo>\n' % self.doctype] address = '' authors = [] author = '' contact = '' date = '' legalnotice = '' orgname = '' releaseinfo = '' revision,version = '','' docinfo.append('%s\n' % self.title) if self.subtitle: docinfo.append('%s\n' % self.subtitle) for n in node: if isinstance(n, nodes.address): address = n.astext() elif isinstance(n, nodes.author): author = n.astext() elif isinstance(n, nodes.authors): for a in n: authors.append(a.astext()) elif isinstance(n, nodes.contact): contact = n.astext() elif isinstance(n, nodes.copyright): legalnotice = n.astext() elif isinstance(n, nodes.date): date = n.astext() elif isinstance(n, nodes.organization): orgname = n.astext() elif isinstance(n, nodes.revision): # XXX yuck revision = 'Revision ' + n.astext() elif isinstance(n, nodes.status): releaseinfo = n.astext() elif isinstance(n, nodes.version): # XXX yuck version = 'Version ' + n.astext() elif isinstance(n, nodes.field): # XXX import sys print >> sys.stderr, "I don't do 'field' yet" print n.astext() # since all child nodes are handled here raise an exception # if node is not handled, so it doesn't silently slip through. else: print dir(n) print n.astext() raise self.unimplemented_visit(n) # can only add author if name is present # since contact is associate with author, the contact # can also only be added if an author name is given. if author: docinfo.append('\n') docinfo.append('%s\n' % author) if contact: docinfo.append('%s\n' % contact) docinfo.append('\n') if authors: docinfo.append('\n') for name in authors: docinfo.append( '%s\n' % name) docinfo.append('\n') if revision or version: edition = version if edition and revision: edition += ', ' + revision elif revision: edition = revision docinfo.append('%s\n' % edition) if date: docinfo.append('%s\n' % date) if orgname: docinfo.append('%s\n' % orgname) if releaseinfo: docinfo.append('%s\n' % releaseinfo) if legalnotice: docinfo.append('\n') docinfo.append('%s\n' % legalnotice) docinfo.append('\n') if address: docinfo.append('
    ' + address + '
    \n') if len(docinfo) > 1: docinfo.append('\n' % self.doctype) self.docinfo = docinfo raise nodes.SkipChildren def depart_docinfo(self, node): pass def visit_doctest_block(self, node): self.body.append('\n') self.body.append(self.starttag(node, 'programlisting')) def depart_doctest_block(self, node): self.body.append('\n') self.body.append('\n') def visit_document(self, node): pass def depart_document(self, node): self.rearrange_footnotes() def visit_emphasis(self, node): self.body.append('') def depart_emphasis(self, node): self.body.append('') def visit_entry(self, node): tagname = 'entry' atts = {} if node.has_key('morerows'): atts['morerows'] = node['morerows'] if node.has_key('morecols'): atts['namest'] = self.colnames[self.entry_level] atts['nameend'] = self.colnames[self.entry_level \ + node['morecols']] self.entry_level += 1 # for tracking what namest and nameend are self.body.append(self.starttag(node, tagname, '', **atts)) def depart_entry(self, node): self.body.append('\n') def visit_enumerated_list(self, node): # TODO: need to specify "mark" type used for list items self.body.append(self.starttag(node, 'orderedlist')) def depart_enumerated_list(self, node): self.body.append('\n') def visit_error(self, node): self.body.append(self.starttag(node, 'caution')) self.body.append('\n%s\n' % (self.language.labels[node.tagname],)) def depart_error(self, node): self.body.append('\n') # TODO: wrap with some element (filename used in DocBook example) def visit_field(self, node): self.body.append(self.starttag(node, 'varlistentry')) def depart_field(self, node): self.body.append('\n') # TODO: see if this should be wrapped with some element def visit_field_argument(self, node): self.body.append(' ') def depart_field_argument(self, node): pass def visit_field_body(self, node): # NOTE: this requires that a field body always # be present, which looks like the case # (from docutils.dtd) self.body.append(self.context.pop()) self.body.append(self.starttag(node, 'listitem')) def depart_field_body(self, node): self.body.append('\n') def visit_field_list(self, node): self.body.append(self.starttag(node, 'variablelist')) def depart_field_list(self, node): self.body.append('\n') def visit_field_name(self, node): self.body.append(self.starttag(node, 'term')) # popped by visit_field_body, so "field_argument" is # content within "term" self.context.append('\n') def depart_field_name(self, node): pass def visit_figure(self, node): self.body.append(self.starttag(node, 'informalfigure')) self.body.append('
    ') def depart_figure(self, node): self.body.append('
    ') self.body.append('\n') # TODO: footer (this is where 'generated by docutils' arrives) # if that's all that will be there, it could map to "colophon" def visit_footer(self, node): raise nodes.SkipChildren def depart_footer(self, node): pass def visit_footnote(self, node): self.footnotes[node['ids'][0]] = [] atts = {'id': node['ids'][0]} if isinstance(node[0], nodes.label): atts['label'] = node[0].astext() self.footnotes[node['ids'][0]].append( self.starttag(node, 'footnote', **atts)) # replace body with this with a footnote collector list # which will hold all the contents for this footnote. # This needs to be kept separate so it can be used to replace # the first ``footnote_reference`` as DocBook defines # ``footnote`` elements inline. self._body = self.body self.body = self.footnotes[node['ids'][0]] def depart_footnote(self, node): # finish footnote and then replace footnote collector # with real body list. self.footnotes[node['ids'][0]].append('') self.body = self._body self._body = None def visit_footnote_reference(self, node): if node.has_key('refid'): refid = node['refid'] else: refid = self.document.nameids[node['refname']] # going to replace this footnote reference with the actual # footnote later on, so store the footnote id to replace # this reference with and the list and position to replace it # in. Both list and position are stored in case a footnote # reference is within a footnote, in which case ``self.body`` # won't really be ``self.body`` but a footnote collector # list. refs = self.footnote_map.get(refid, []) refs.append((node['ids'][0], self.body, len(self.body),)) self.footnote_map[refid] = refs # add place holder list item which should later be # replaced with the contents of the footnote element # and it's child elements self.body.append('') raise nodes.SkipNode def visit_header(self, node): pass def depart_header(self, node): pass # ??? does anything need to be done for generated? def visit_generated(self, node): pass def depart_generated(self, node): pass def visit_hint(self, node): self.body.append(self.starttag(node, 'note')) self.body.append('\n%s\n' % (self.language.labels[node.tagname],)) def depart_hint(self, node): self.body.append('\n') def visit_image(self, node): if isinstance(node.parent, nodes.paragraph): element = 'inlinemediaobject' elif isinstance(node.parent, nodes.reference): element = 'inlinemediaobject' else: element = 'mediaobject' atts = node.attributes.copy() atts['fileref'] = atts['uri'] alt = None del atts['uri'] if atts.has_key('alt'): alt = atts['alt'] del atts['alt'] if atts.has_key('height'): atts['depth'] = atts['height'] del atts['height'] self.body.append('<%s>' % element) self.body.append('') self.body.append(self.emptytag(node, 'imagedata', **atts)) self.body.append('') if alt: self.body.append('' \ '%s\n' % alt) self.body.append('' % element) def depart_image(self, node): pass def visit_important(self, node): self.body.append(self.starttag(node, 'important')) def depart_important(self, node): self.body.append('') # @@@ Incomplete, pending a proper implementation on the # Parser/Reader end. # XXX see if the default for interpreted should be ``citetitle`` def visit_interpreted(self, node): self.body.append('\n') def depart_interpreted(self, node): self.body.append('\n') def visit_label(self, node): # getting label for "footnote" in ``visit_footnote`` # because label is an attribute for the ``footnote`` # element. if isinstance(node.parent, nodes.footnote): raise nodes.SkipNode # citations are currently treated as footnotes elif isinstance(node.parent, nodes.citation): raise nodes.SkipNode def depart_label(self, node): pass def visit_legend(self, node): # legend is placed inside the figure's ``blockquote`` # so there's nothing special to be done for it pass def depart_legend(self, node): pass def visit_line_block(self, node): self.body.append(self.starttag(node, 'literallayout')) def depart_line_block(self, node): self.body.append('\n') def visit_list_item(self, node): self.body.append(self.starttag(node, 'listitem')) def depart_list_item(self, node): self.body.append('\n') def visit_literal(self, node): self.body.append('') def depart_literal(self, node): self.body.append('') def visit_literal_block(self, node): self.body.append(self.starttag(node, 'programlisting')) def depart_literal_block(self, node): self.body.append('\n') def visit_note(self, node): self.body.append(self.starttag(node, 'note')) self.body.append('\n%s\n' % (self.language.labels[node.tagname],)) def depart_note(self, node): self.body.append('\n') def visit_option(self, node): self.body.append(self.starttag(node, 'command')) if self.context[-1]: self.body.append(', ') def depart_option(self, node): self.context[-1] += 1 self.body.append('') def visit_option_argument(self, node): self.body.append(node.get('delimiter', ' ')) self.body.append(self.starttag(node, 'replaceable', '')) def depart_option_argument(self, node): self.body.append('') def visit_option_group(self, node): self.body.append(self.starttag(node, 'entry')) self.context.append(0) def depart_option_group(self, node): self.context.pop() self.body.append('\n') def visit_option_list(self, node): self.body.append(self.starttag(node, 'informaltable', frame='all')) self.body.append('\n') self.body.append('\n') self.body.append('\n') self.body.append('\n') def depart_option_list(self, node): self.body.append('') self.body.append('\n') self.body.append('\n') def visit_option_list_item(self, node): self.body.append(self.starttag(node, 'row')) def depart_option_list_item(self, node): self.body.append('\n') def visit_option_string(self, node): pass def depart_option_string(self, node): pass # organization is handled in ``visit_docinfo()`` def visit_organization(self, node): raise nodes.SkipNode def visit_paragraph(self, node): self.body.append(self.starttag(node, 'para', '')) def depart_paragraph(self, node): self.body.append('') # TODO: problematic visit_problematic = depart_problematic = lambda self, node: None def visit_raw(self, node): if node.has_key('format') and node['format'] == 'docbook': self.body.append(node.astext()) raise node.SkipNode def visit_reference(self, node): atts = {} if node.has_key('refuri'): atts['url'] = node['refuri'] self.context.append('ulink') elif node.has_key('refid'): atts['linkend'] = node['refid'] self.context.append('link') elif node.has_key('refname'): atts['linkend'] = self.document.nameids[node['refname']] self.context.append('link') # if parent is a section, # wrap link in a para if isinstance(node.parent, nodes.section): self.body.append('') self.body.append(self.starttag(node, self.context[-1], '', **atts)) def depart_reference(self, node): self.body.append('' % (self.context.pop(),)) # if parent is a section, # wrap link in a para if isinstance(node.parent, nodes.section): self.body.append('') # revision is handled in ``visit_docinfo()`` def visit_revision(self, node): raise nodes.SkipNode def visit_row(self, node): self.entry_level = 0 self.body.append(self.starttag(node, 'row')) def depart_row(self, node): self.body.append('\n') def visit_rubric(self, node): self.body.append(self.starttag(node, 'bridgehead')) def depart_rubric(self, node): self.body.append('') def visit_section(self, node): if self.section == 0 and self.doctype == 'book': self.body.append(self.starttag(node, 'chapter')) else: self.body.append(self.starttag(node, 'section')) self.section += 1 def depart_section(self, node): self.section -= 1 if self.section == 0 and self.doctype == 'book': self.body.append('\n') else: self.body.append('
    \n') def visit_sidebar(self, node): self.body.append(self.starttag(node, 'sidebar')) if isinstance(node[0], nodes.title): self.body.append('\n') self.body.append('%s\n' % node[0].astext()) if isinstance(node[1], nodes.subtitle): self.body.append('%s\n' % node[1].astext()) self.body.append('\n') def depart_sidebar(self, node): self.body.append('\n') # author is handled in ``visit_docinfo()`` def visit_status(self, node): raise nodes.SkipNode def visit_strong(self, node): self.body.append('') def depart_strong(self, node): self.body.append('') def visit_subscript(self, node): self.body.append(self.starttag(node, 'subscript', '')) def depart_subscript(self, node): self.body.append('') def visit_substitution_definition(self, node): raise nodes.SkipNode def visit_substitution_reference(self, node): self.unimplemented_visit(node) def visit_subtitle(self, node): # document title needs to go into # info/subtitle, so save it for # when we do visit_docinfo if isinstance(node.parent, nodes.document): self.subtitle = node.astext() raise nodes.SkipNode else: # sidebar subtitle needs to go into a sidebarinfo element #if isinstance(node.parent, nodes.sidebar): # self.body.append('') if isinstance(node.parent, nodes.sidebar): raise nodes.SkipNode self.body.append(self.starttag(node, 'subtitle', '')) def depart_subtitle(self, node): if not isinstance(node.parent, nodes.document): self.body.append('\n') #if isinstance(node.parent, nodes.sidebar): # self.body.append('\n') def visit_superscript(self, node): self.body.append(self.starttag(node, 'superscript', '')) def depart_superscript(self, node): self.body.append('') # TODO: system_message visit_system_message = depart_system_message = lambda self, node: None def visit_table(self, node): self.body.append( self.starttag(node, 'informaltable', frame='all') ) def depart_table(self, node): self.body.append('\n') # don't think anything is needed for targets def visit_target(self, node): # XXX this would like to be a transform! # XXX comment this mess! handled = 0 siblings = node.parent.children for i in range(len(siblings)): if siblings[i] is node: if i+1 < len(siblings): next = siblings[i+1] if isinstance(next,nodes.Text): pass elif not next.attributes.has_key('id'): next['id'] = node['ids'][0] handled = 1 if not handled: if not node.parent.attributes.has_key('id'): # TODO node["ids"] node.parent.attributes['id'] = node['ids'][0] handled = 1 # might need to do more... # (if not handled, update the referrer to refer to the parent's id) def depart_target(self, node): pass def visit_tbody(self, node): self.body.append(self.starttag(node, 'tbody')) def depart_tbody(self, node): self.body.append('\n') def visit_term(self, node): self.body.append(self.starttag(node, 'term')) self.body.append('') def depart_term(self, node): # Leave the end tag "term" to ``visit_definition()``, # in case there's a classifier. self.body.append('') def visit_tgroup(self, node): self.colnames = [] atts = {'cols': node['cols']} self.body.append(self.starttag(node, 'tgroup', **atts)) def depart_tgroup(self, node): self.body.append('\n') def visit_thead(self, node): self.body.append(self.starttag(node, 'thead')) def depart_thead(self, node): self.body.append('\n') def visit_tip(self, node): self.body.append(self.starttag(node, 'tip')) def depart_tip(self, node): self.body.append('\n') def visit_title(self, node): # document title needs to go inside # info/title if isinstance(node.parent, nodes.document): self.title = node.astext() raise nodes.SkipNode elif isinstance(node.parent, nodes.sidebar): # sidebar title and subtitle are collected in visit_sidebar raise nodes.SkipNode else: self.body.append(self.starttag(node, 'title', '')) def depart_title(self, node): if not isinstance(node.parent, nodes.document): self.body.append('\n') def visit_title_reference(self, node): self.body.append('') def depart_title_reference(self, node): self.body.append('') def visit_topic(self, node): # let DocBook handle Table of Contents generation if node.get('class') == 'contents': raise nodes.SkipChildren elif node.get('class') == 'abstract': self.body.append(self.starttag(node, 'abstract')) self.context.append('abstract') elif node.get('class') == 'dedication': # docbook only supports dedication in a book, # so we're faking it for article & chapter if self.doctype == 'book': self.body.append(self.starttag(node, 'dedication')) self.context.append('dedication') else: self.body.append(self.starttag(node, 'section')) self.context.append('section') # generic "topic" element treated as a section elif node.get('class','') == '': self.body.append(self.starttag(node, 'section')) self.context.append('section') else: # XXX DEBUG CODE print 'class:', node.get('class') print node.__class__.__name__ print node print `node` print dir(node) self.unimplemented_visit(node) def depart_topic(self, node): if len(self.context): self.body.append('\n' % (self.context.pop(),)) def visit_transition(self, node): pass def depart_transition(self, node): pass # author is handled in ``visit_docinfo()`` def visit_version(self, node): raise nodes.SkipNode def visit_warning(self, node): self.body.append(self.starttag(node, 'warning')) def depart_warning(self, node): self.body.append('\n') def unimplemented_visit(self, node): raise NotImplementedError('visiting unimplemented node type: %s' % node.__class__.__name__) class SummaryExtractor(NodeVisitor): """A SummaryExtractor creates a document containing the first sentence of a source document.""" def __init__(self, document): NodeVisitor.__init__(self, document) self.summary = None def visit_paragraph(self, node): """Copy the paragraph but only keep the first sentence.""" if self.summary is not None: return summary_pieces = [] # Extract the first sentence. for child in node: if isinstance(child, Text): m = re.match(r'(\s*[\w\W]*?\.)(\s|$)', child.data) if m: summary_pieces.append(Text(m.group(1))) break else: summary_pieces.append(Text(child)) else: summary_pieces.append(child) self.summary = self.document.copy() para = node.copy() para[:] = summary_pieces self.summary[:] = [para] def unknown_visit(self, node): 'Ignore all unknown nodes' pass class RST(Formatter): """Format summary and detail documentation according to restructured text markup. """ def format(self, decl): def ref(name, rawtext, text, lineno, inliner, options={}, content=[]): name = utils.unescape(text) uri = self.lookup_symbol(name, decl.name[:-1]) if uri: node = reference(rawtext, name, refid=uri, **options) else: node = emphasis(rawtext, name) return [node], [] roles.register_local_role('', ref) errstream = StringIO.StringIO() settings = {} settings['halt_level'] = 2 settings['warning_stream'] = errstream settings['traceback'] = True doc = decl.annotations.get('doc') if doc: try: doctree = publish_doctree(doc.text, settings_overrides=settings) # Extract the summary. extractor = SummaryExtractor(doctree) doctree.walk(extractor) reader = docutils.readers.doctree.Reader(parser_name='null') # Publish the summary. if extractor.summary: pub = Publisher(reader, None, None, source=io.DocTreeInput(extractor.summary), destination_class=io.StringOutput) pub.writer = Writer() pub.process_programmatic_settings(None, None, None) dummy = pub.publish(enable_exit_status=None) summary = pub.writer.output else: summary = '' # Publish the details. pub = Publisher(reader, None, None, source=io.DocTreeInput(doctree), destination_class=io.StringOutput) pub.writer = Writer() pub.process_programmatic_settings(None, None, None) dummy = pub.publish(enable_exit_status=None) details = pub.writer.output return Struct(summary, details) except docutils.utils.SystemMessage, error: xx, line, message = str(error).split(':', 2) print 'In DocString attached to declaration at %s:%d:'%(decl.file.name, decl.line) print ' line %s:%s'%(line, message) return Struct('', '') synopsis-0.12/Synopsis/Formatters/DocBook/Syntax.py0000664000076400007640000001767211104703264022027 0ustar stefanstefan# # Copyright (C) 2007 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import ASG def escape(text): for p in [('&', '&'), ('"', '"'), ('<', '<'), ('>', '>'),]: text = text.replace(*p) return text class Syntax(ASG.Visitor): """Even though DocBook provides markup for some programming artifacts, it is incomplete, and the XSL stylesheets are buggy, resulting in incorrect syntax. Thus, we use the 'synopsis' element, and attempt to reproduce the original syntax with language-specific subclasses.""" def __init__(self, output): self.output = output def finish(self): pass def typeid(self, type): self._typeid = '' type.accept(self) return self._typeid class PythonSyntax(Syntax): def visit_function(self, node): text = escape(str(node.return_type)) text += '%s(%s)\n'%(escape(node.real_name[-1]), ', '.join([self.visit_parameter(p) for p in node.parameters])) self.output.write(text) def visit_parameter(self, parameter): text = str(parameter.name) if parameter.value: text += ' = %s'%escape(parameter.value) return text def visit_variable(self, variable): variable.vtype.accept(self) self.output.write(variable.name[-1]) def visit_const(self, const): const.ctype.accept(self) self.output.write(const.name[-1]) class PythonSummarySyntax(PythonSyntax): """Generate DocBook Synopsis for Python declarations.""" def __init__(self, output): super(PythonSummarySyntax, self).__init__(output) self.output.write('') def finish(self): self.output.write('\n') def visit_group(self, node): for d in node.declarations: d.accept(self) def visit_module(self, module): self.output.write('%s %s\n'%(module.type, module.name[-1])) def visit_class(self, class_): self.output.write('class %s\n'%escape(class_.name[-1])) def visit_inheritance(self, node): pass class PythonDetailSyntax(PythonSyntax): """Generate DocBook Synopsis for Python declarations.""" def __init__(self, output): super(PythonDetailSyntax, self).__init__(output) self.output.write('') def finish(self): self.output.write('\n') def visit_group(self, node): for d in node.declarations: d.accept(self) def visit_module(self, module): self.output.write('%s %s\n'%(module.type, module.name[-1])) def visit_class(self, class_): self.output.write('class %s\n'%escape(class_.name[-1])) def visit_inheritance(self, node): pass class CxxSyntax(Syntax): def visit_function(self, node): text = node.return_type and self.typeid(node.return_type) or '' text += ' %s(%s);\n'%(escape(node.real_name[-1]), ', '.join([self.visit_parameter(p) for p in node.parameters])) self.output.write(text) def visit_parameter(self, parameter): text = escape(str(parameter.type)) if parameter.name: text += ' %s'%parameter.name if parameter.value: text += ' = %s'%escape(parameter.value) return text def visit_typedef(self, node): self.output.write('typedef %s %s;\n'%(self.typeid(node.alias), node.name[-1])) def visit_variable(self, variable): self.output.write('%s %s;\n'%(self.typeid(variable.vtype), variable.name[-1])) def visit_const(self, const): self.output.write('%s %s;\n'%(self.typeid(const.ctype), const.name[-1])) def visit_builtin_type_id(self, type): self._typeid = type.name[-1] def visit_unknown_type_id(self, type): self._typeid = escape(str(type.name)) def visit_declared_type_id(self, type): self._typeid = escape(str(type.name)) def visit_modifier_type_id(self, type): self._typeid = '%s %s %s'%(escape(' '.join(type.premod)), self.typeid(type.alias), escape(' '.join(type.postmod))) def visit_array_type_id(self, type): self._typeid = '%s%s'%(escape(str(type.name)), ''.join(['[%s]'%s for s in type.sizes])) def visit_template_id(self, type): self._typeid = escape(str(type.name)) def visit_parametrized_type_id(self, type): self._typeid = '%s<%s>'%(self.typeid(type.template), ', '.join([self.typeid(p) for p in type.parameters])) def visit_function_type_id(self, type): self._typeid = '%s(%s)'%(self.typeid(type.return_type), ', '.join([self.typeid(p) for p in type.parameters])) def visit_dependent_type_id(self, type): self._typeid = type.name[-1] class CxxSummarySyntax(CxxSyntax): """Generate DocBook Synopsis for C++ declarations.""" def __init__(self, output): super(CxxSummarySyntax, self).__init__(output) self.output.write('') def finish(self): self.output.write('\n') def visit_macro(self, macro): self.output.write(macro.name[-1]) if macro.parameters: self.output.write('(%)'%(', '.join([p for p in macro.parameters]))) self.output.write('\n') def visit_forward(self, node): pass def visit_group(self, node): for d in node.declarations: d.accept(self) def visit_module(self, module): self.output.write('%s %s;\n'%(module.type, module.name[-1])) def visit_class(self, class_): self.output.write('%s %s;\n'%(class_.type, escape(class_.name[-1]))) def visit_class_template(self, class_): self.visit_class(class_) def visit_enumerator(self, node): if node.value: return '%s=%s'%(node.name[-1], escape(node.value)) else: return node.name[-1] def visit_enum(self, node): self.output.write('%s %s { '%(node.type, node.name[-1])) self.output.write(', '.join([self.visit_enumerator(e) for e in node.enumerators if isinstance(e, ASG.Enumerator)])) self.output.write('};\n') def visit_inheritance(self, node): pass class CxxDetailSyntax(CxxSyntax): """Generate DocBook Synopsis for C++ declarations.""" def __init__(self, output): super(CxxDetailSyntax, self).__init__(output) self.output.write('') def finish(self): self.output.write('\n') def visit_macro(self, macro): self.output.write(macro.name[-1]) if macro.parameters: self.output.write('(%s)'%(', '.join([p for p in macro.parameters]))) self.output.write('\n') def visit_forward(self, node): pass def visit_group(self, node): for d in node.declarations: d.accept(self) def visit_module(self, module): self.output.write('%s %s;\n'%(module.type, module.name[-1])) def visit_class(self, class_): self.output.write('%s %s;\n'%(class_.type, escape(class_.name[-1]))) def visit_class_template(self, node): pass def visit_enumerator(self, node): if node.value: return '%s=%s'%(node.name[-1], escape(node.value)) else: return node.name[-1] def visit_enum(self, node): self.output.write('%s %s { '%(node.type, node.name[-1])) self.output.write(', '.join([self.visit_enumerator(e) for e in node.enumerators if isinstance(e, ASG.Enumerator)])) self.output.write('};\n') def visit_inheritance(self, node): pass synopsis-0.12/Synopsis/Formatters/SXR.py0000664000076400007640000001012411104703265017657 0ustar stefanstefan# # Copyright (C) 2004 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # """The SXR Facade around the HTML Formatter """ from Synopsis import config from Synopsis import IR from Synopsis.Processor import * import HTML from HTML.View import View, Template from HTML.Views import Directory, Source, RawFile import os, os.path from shutil import copyfile class SXRIndex(View): """Top level Index View. This is the starting point for the SXR browser.""" sxr_cgi = Parameter('sxr.cgi', 'URL to use for sxr.cgi script') def filename(self): return self.directory_layout.index() def title(self): return 'Index' def root(self): return self.filename(), self.title() def process(self): """Recursively visit each directory below the base path given in the config.""" self.start_file() self.write("""
    Click here to start browsing at the root of the directory tree: /
    Enter a file name to search:
    Enter a variable, type, or function name to search:
    """%{'script' : self.sxr_cgi}) self.end_file() class Formatter(Processor): """This is a facade to the HTML.Formatter. It adds an 'url' parameter and dispatches it to various 'views'.""" title = Parameter('Synopsis - Cross-Reference', 'title to put into html header') url = Parameter('/sxr.cgi', 'the base url to use for the sxr cgi') sxr_prefix = Parameter(None, 'path prefix (directory) to contain sxr info') src_dir = Parameter('', 'starting point for directory listing') exclude = Parameter([], 'TODO: define an exclusion mechanism (glob based ?)') sxr_template = Parameter(os.path.join(config.datadir, 'sxr-template.html'), 'html template to be used by the sxr.cgi script') stylesheet = Parameter(os.path.join(config.datadir, 'html.css'), 'stylesheet to be used') def process(self, ir, **kwds): self.set_parameters(kwds) if not self.output: raise MissingArgument('output') if not self.sxr_prefix: raise MissingArgument('sxr_prefix') self.ir = self.merge_input(ir) if not os.path.exists(self.output): os.makedirs(self.output) content = [SXRIndex(sxr_cgi = self.url, template = Template(template = self.sxr_template)), Directory(src_dir = self.src_dir, base_path = self.src_dir, exclude = self.exclude, template = Template(template = self.sxr_template)), Source(external_url = '%s/ident?full=1&string='%self.url, template = Template(template = self.sxr_template)), RawFile(src_dir = self.src_dir, base_path = self.src_dir, exclude = self.exclude, template = Template(template = self.sxr_template))] html = HTML.Formatter(index = [], detail = [], content = content, sxr_prefix = self.sxr_prefix, stylesheet = self.stylesheet) self.ir = html.process(self.ir, output = self.output) if self.sxr_template: copyfile(self.sxr_template, os.path.join(self.output, 'sxr-template.html')) # Store the SXR data only. ir = IR.IR(sxr=self.ir.sxr) ir.save(os.path.join(self.output, 'sxr.syn')) return self.ir synopsis-0.12/Synopsis/Formatters/Texinfo.py0000664000076400007640000002030011104703264020613 0ustar stefanstefan# # Copyright (C) 2000 Stefan Seefeld # Copyright (C) 2000 Stephen Davies # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # """a TexInfo formatter """ from Synopsis.Processor import * from Synopsis import ASG from Synopsis.DocString import DocString import sys, os, re _tags = re.compile(r'@(?!(table|item|samp|end))') def escape(text): return _tags.sub('@@', text).replace('{', '@{').replace('}', '@}') class MenuMaker(ASG.Visitor): """generate a texinfo menu for the declarations of a given scope""" def __init__(self, scope, os): self.scope = scope self.os = os def write(self, text): self.os.write(text) def start(self): self.write('@menu\n') def end(self): self.write('@end menu\n') def visit_declaration(self, node): name = escape(str(self.scope.prune(node.name))) self.write('* ' + name + '::\t' + node.type + '\n') visit_group = visit_declaration visit_enum = visit_declaration class Formatter(Processor, ASG.Visitor): """The type visitors should generate names relative to the current scope. The generated references however are fully scoped names.""" def process(self, ir, **kwds): self.set_parameters(kwds) if not self.output: raise MissingArgument('output') self.ir = self.merge_input(ir) self.os = open(self.output, 'w+') self.scope = () for d in self.ir.asg.declarations: d.accept(self) return self.ir def write(self, text): self.os.write(text) def type_label(self): return escape(self.__type_label) def decl_label(self, decl): return escape(decl[-1]) def format_type(self, type): "Returns a reference string for the given type object" if type is None: return "(unknown)" type.accept(self) return self.type_label() def format_comments(self, decl): doc = decl.annotations.get('doc', DocString('', '')) # TODO: implement markup formatters for e.g. javadoc and rst self.write(escape(doc.text) + '\n') #################### Type Visitor ########################################### def visit_builtin_type_id(self, type): self.__type_ref = str(type.name) self.__type_label = str(type.name) def visit_unknown_type_id(self, type): self.__type_ref = str(type.name) self.__type_label = str(self.scope.prune(type.name)) def visit_declared_type_id(self, type): self.__type_label = str(self.scope.prune(type.name)) self.__type_ref = str(type.name) def visit_modifier_type_id(self, type): type.alias.accept(self) self.__type_ref = ''.join(type.premod) + ' ' + self.__type_ref + ' ' + ''.join(type.postmod) self.__type_label = ''.join(type.premod) + ' ' + self.__type_label + ' ' + ''.join(type.postmod) def visit_parametrized_type_id(self, type): if type.template: type.template.accept(self) type_label = self.__type_label + '<' else: type_label = '(unknown)<' parameters_label = [] for p in type.parameters: p.accept(self) parameters_label.append(self.__type_label) self.__type_label = type_label + ', '.join(parameters_label) + '>' def visit_function_type_id(self, type): # TODO: this needs to be implemented self.__type_ref = 'function_type' self.__type_label = 'function_type' #################### ASG Visitor ############################################ def visit_declarator(self, node): self.__declarator = node.name for i in node.sizes: self.__declarator[-1] = self.__declarator[-1] + '[%d]'%i def visit_typedef(self, typedef): #self.write('@node ' + self.decl_label(typedef.name) + '\n') self.write('@deftp ' + typedef.type + ' {' + self.format_type(typedef.alias) + '} {' + self.decl_label(typedef.name) + '}\n') self.format_comments(typedef) self.write('@end deftp\n') def visit_variable(self, variable): #self.write('@node ' + self.decl_label(variable.name) + '\n') self.write('@deftypevr {' + variable.type + '} {' + self.format_type(variable.vtype) + '} {' + self.decl_label(variable.name) + '}\n') #FIXME !: how can values be represented in texinfo ? self.format_comments(variable) self.write('@end deftypevr\n') def visit_const(self, const): print "sorry, not implemented" def visit_module(self, module): #self.write('@node ' + self.decl_label(module.name) + '\n') self.write('@deftp ' + module.type + ' ' + self.decl_label(module.name) + '\n') self.format_comments(module) old_scope = self.scope self.scope = module.name #menu = MenuMaker(str(self.scope), self.os) #menu.start() #for declaration in module.declarations: declaration.accept(menu) #menu.end() for declaration in module.declarations: declaration.accept(self) self.scope = old_scope self.write('@end deftp\n') def visit_class(self, class_): #self.write('@node ' + self.decl_label(clas.name) + '\n') self.write('@deftp ' + class_.type + ' ' + self.decl_label(class_.name) + '\n') if len(class_.parents): self.write('parents:') first = 1 for parent in class_.parents: if not first: self.write(', ') else: self.write(' ') parent.accept(self) self.write('\n') self.format_comments(class_) old_scope = self.scope self.scope = class_.name #menu = MenuMaker(str(self.scope), self.os) #menu.start() #for d in class_.declarations: d.accept(menu) #menu.end() for d in class_.declarations: d.accept(self) self.scope = old_scope self.write('@end deftp\n') def visit_inheritance(self, inheritance): self.write('parent class') def visit_parameter(self, parameter): parameter.type.accept(self) label = self.write('{' + self.type_label() + '}') label = self.write(' @var{' + parameter.name + '}') def visit_function(self, function): ret = function.return_type if ret: ret.accept(self) ret_label = '{' + self.type_label() + '}' else: ret_label = '{}' self.write('@deftypefn ' + function.type + ' ' + ret_label + ' ' + self.decl_label(function.real_name) + ' (') first = 1 for parameter in function.parameters: if not first: self.write(', ') else: self.write(' ') parameter.accept(self) first = 0 self.write(')\n') # map(lambda e, this=self: this.entity("exceptionname", e), operation.exceptions) self.format_comments(function) self.write('@end deftypefn\n') def visit_operation(self, operation): ret = operation.return_type if ret: ret.accept(self) ret_label = '{' + self.type_label() + '}' else: ret_label = '{}' try: #self.write('@node ' + self.decl_label(operation.name) + '\n') self.write('@deftypeop ' + operation.type + ' ' + self.decl_label(self.scope) + ' ' + ret_label + ' ' + self.decl_label(operation.real_name) + ' (') except: print operation.real_name sys.exit(0) first = 1 for parameter in operation.parameters: if not first: self.write(', ') else: self.write(' ') parameter.accept(self) first = 0 self.write(')\n') # map(lambda e, this=self: this.entity("exceptionname", e), operation.exceptions) self.format_comments(operation) self.write('@end deftypeop\n') def visit_enumerator(self, enumerator): self.write('@deftypevr {' + enumerator.type + '} {} {' + self.decl_label(enumerator.name) + '}') #FIXME !: how can values be represented in texinfo ? if enumerator.value: self.write('\n') else: self.write('\n') self.format_comments(enumerator) self.write('@end deftypevr\n') def visit_enum(self, enum): #self.write('@node ' + self.decl_label(enum.name) + '\n') self.write('@deftp ' + enum.type + ' ' + self.decl_label(enum.name) + '\n') self.format_comments(enum) for enumerator in enum.enumerators: enumerator.accept(self) self.write('@end deftp\n') synopsis-0.12/Synopsis/Formatters/HTML/0000775000076400007640000000000011172123232017372 5ustar stefanstefansynopsis-0.12/Synopsis/Formatters/HTML/Fragment.py0000664000076400007640000000600511170474765021532 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Tags import * class Fragment(object): """Generates HTML fragment for a declaration. Multiple strategies are combined to generate the output for a single declaration, allowing the user to customise the output by choosing a set of strategies. This follows the Strategy design pattern. The key concept of this class is the format* methods. Any class derived from Strategy that overrides one of the format methods will have that method called by the Summary and Detail formatters when they visit that ASG type. Summary and Detail maintain a list of Strategies, and a list for each ASG type. For example, when Strategy.Summary visits a Function object, it calls the formatFunction method on all Strategys registed with SummaryFormatter that implemented that method. Each of these format methods returns a string, which may contain a TD tag to create a new column. An important point to note is that only Strategies which override a particular format method are called - if that format method is not overridden then it is not called for that declaration type. """ def register(self, formatter): """Store formatter as self.formatter. The formatter is either a SummaryFormatter or DetailFormatter, and is used for things like reference() and label() calls. Local references to the formatter's reference and label methods are stored in self for more efficient use of them.""" self.processor = formatter.processor self.directory_layout = self.processor.directory_layout self.formatter = formatter self.label = formatter.label self.reference = formatter.reference self.format_type = formatter.format_type self.view = formatter.view() # # Utility methods # def format_modifiers(self, modifiers): """Returns a HTML string from the given list of string modifiers. The modifiers are enclosed in 'keyword' spans.""" def keyword(m): if m == '&': return span('keyword', '&') return span('keyword', m) return ''.join([keyword(m) for m in modifiers]) # # ASG Formatters # def format_declaration(self, decl): pass def format_macro(self, decl): pass def format_forward(self, decl): pass def format_group(self, decl): pass def format_scope(self, decl): pass def format_module(self, decl): pass def format_meta_module(self, decl): pass def format_class(self, decl): pass def format_class_template(self, decl): pass def format_typedef(self, decl): pass def format_enum(self, decl): pass def format_variable(self, decl): pass def format_const(self, decl): pass def format_function(self, decl): pass def format_function_template(self, decl): pass def format_operation(self, decl): pass def format_operation_template(self, decl): pass synopsis-0.12/Synopsis/Formatters/HTML/Fragments/0000775000076400007640000000000011172123232021320 5ustar stefanstefansynopsis-0.12/Synopsis/Formatters/HTML/Fragments/DetailCommenter.py0000664000076400007640000000100411104703265024746 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Formatters.HTML.Tags import * from Default import Default class DetailCommenter(Default): """Add annotation details to all declarations.""" def format_declaration(self, decl): details = self.processor.documentation.details(decl, self.view) return div('doc', details or '') synopsis-0.12/Synopsis/Formatters/HTML/Fragments/__init__.py0000664000076400007640000000104611104703265023437 0ustar stefanstefanfrom TemplateSpecializations import TemplateSpecializations from ClassHierarchySimple import ClassHierarchySimple from ClassHierarchyGraph import ClassHierarchyGraph from InheritanceFormatter import InheritanceFormatter from HeadingFormatter import HeadingFormatter from DeclarationFormatter import DeclarationDetailFormatter from DeclarationFormatter import DeclarationSummaryFormatter from SummaryCommenter import SummaryCommenter from DetailCommenter import DetailCommenter from SourceLinker import SourceLinker from XRefLinker import XRefLinker synopsis-0.12/Synopsis/Formatters/HTML/Fragments/ClassHierarchyGraph.py0000664000076400007640000000354711104703265025576 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import IR from Synopsis import ASG from Synopsis.Processor import InvalidCommand from ClassHierarchySimple import ClassHierarchySimple import os class ClassHierarchyGraph(ClassHierarchySimple): """Prints a graphical hierarchy for classes, using the Dot formatter. @see Formatters.Dot """ def format_class(self, class_): from Synopsis.Formatters import Dot super = self.processor.class_tree.superclasses(class_.name) sub = self.processor.class_tree.subclasses(class_.name) if len(super) == 0 and len(sub) == 0: # Skip classes with a boring graph return '' #label = self.processor.files.scoped_special('inheritance', clas.name) label = self.formatter.filename()[:-5] + '-inheritance.html' tmp = os.path.join(self.processor.output, label) ir = IR.IR(files={}, asg=ASG.ASG([class_], self.processor.ir.asg.types)) dot = Dot.Formatter(bgcolor=self.processor.graph_color) dot.toc = self.processor.toc try: dot.process(ir, output=tmp, format='html', base_url=self.formatter.filename(), type='single', title=label) text = '' input = open(tmp, "r+") line = input.readline() while line: text = text + line line = input.readline() input.close() os.unlink(tmp) return text except InvalidCommand, e: print 'Warning : %s'%str(e) return '' format_class_template = format_class synopsis-0.12/Synopsis/Formatters/HTML/Fragments/SummaryCommenter.py0000664000076400007640000000100511104703265025202 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Formatters.HTML.Tags import * from Default import Default class SummaryCommenter(Default): """Adds summary annotations to all declarations.""" def format_declaration(self, decl): summary = self.processor.documentation.summary(decl, self.view) return div('doc', summary or '') synopsis-0.12/Synopsis/Formatters/HTML/Fragments/InheritanceFormatter.py0000664000076400007640000000150311104703265026013 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Formatters.HTML.Tags import * from Default import Default class InheritanceFormatter(Default): """Prints just the name of each declaration, with a link to its doc""" def format_declaration(self, decl, label=None): if not label: label = decl.name[-1] qname = self.formatter.scope().prune(decl.name) title = decl.type + ' ' + escape(str(qname)) return self.reference(decl.name, label=label, title=title) + ' ' def format_function(self, decl): return self.format_declaration(decl, label=decl.real_name[-1]) def format_operation(self, decl): return self.format_function(decl) synopsis-0.12/Synopsis/Formatters/HTML/Fragments/Default.py0000664000076400007640000000303611170633245023270 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Formatters.HTML.Fragment import Fragment class Default(Fragment): """A base ASG strategy that calls format_declaration for all types""" # All these use the same method: def format_macro(self, decl): return self.format_declaration(decl) def format_forward(self, decl): return self.format_declaration(decl) def format_group(self, decl): return self.format_declaration(decl) def format_scope(self, decl): return self.format_declaration(decl) def format_module(self, decl): return self.format_declaration(decl) def format_meta_module(self, decl): return self.format_declaration(decl) def format_class(self, decl): return self.format_declaration(decl) def format_class_template(self, decl): return self.format_declaration(decl) def format_typedef(self, decl): return self.format_declaration(decl) def format_enum(self, decl): return self.format_declaration(decl) def format_variable(self, decl): return self.format_declaration(decl) def format_const(self, decl): return self.format_declaration(decl) def format_function(self, decl): return self.format_declaration(decl) def format_function_template(self, decl): return self.format_declaration(decl) def format_operation(self, decl): return self.format_declaration(decl) def format_operation_template(self, decl): return self.format_declaration(decl) synopsis-0.12/Synopsis/Formatters/HTML/Fragments/XRefLinker.py0000664000076400007640000000167511104703265023721 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Formatters.HTML.Tags import * from Default import Default class XRefLinker(Default): """Adds an xref link to all declarations""" def register(self, formatter): Default.register(self, formatter) self.pager = self.processor.xref self.sxr = self.processor.sxr_prefix and self.processor.ir.sxr def format_declaration(self, decl): entry = self.sxr and self.sxr.get(decl.name) if not entry: return '' page = self.pager.get(decl.name) url = self.directory_layout.xref(page) url += '#' + quote_as_id(str(decl.name)) label = img(src=rel(self.view.filename(), 'xref.png'), alt='references') return href(rel(self.view.filename(), url), label) synopsis-0.12/Synopsis/Formatters/HTML/Fragments/DeclarationFormatter.py0000664000076400007640000002724711171367143026031 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import ASG from Synopsis.Formatters.HTML.Fragment import Fragment from Synopsis.Formatters.HTML.Tags import * from SourceLinker import SourceLinker from XRefLinker import XRefLinker class DeclarationFormatter(Fragment): """Base class for SummaryFormatter and DetailFormatter. The two classes SummaryFormatter and DetailFormatter are actually very similar in operation, and so most of their methods are defined here. Both of them print out the definition of the declarations, including type, parameters, etc. Some things such as exception specifications are only printed out in the detailed version. """ def register(self, formatter): super(DeclarationFormatter, self).register(formatter) if self.processor.has_view('XRef'): self.xref = XRefLinker() self.xref.register(formatter) else: self.xref = None if self.processor.has_view('Source'): self.source = SourceLinker() self.source.register(formatter) else: self.source = None def format_parameters(self, parameters): """Returns formatted string for the given parameter list.""" return ', '.join([self.format_parameter(p) for p in parameters]) def format_declaration(self, decl): """The default is to return no type and just the declarations name for the name.""" return div('synopsis', self.label(decl.name)) def format_macro(self, decl): """""" chunk = div('synopsis', self.label(decl.name)) if self.xref: chunk += ' %s'%div('xref', self.xref.format_macro(decl)) if self.source: chunk += ' %s'%div('source', self.source.format_macro(decl)) return chunk def format_forward(self, decl): # treat template syntax like a premodifier if decl.template: templ = 'template <%s>'%(self.format_parameters(decl.template.parameters),) templ = div('template', templ) type = '%s %s'%(templ, decl.type) else: type = decl.type if decl.specializations: # Treat it like a (non-forward declared) class template. name = self.format_scope(decl) else: name = self.label(decl.name) chunk = div('synopsis', type + ' ' + name) if self.xref: chunk += ' %s'%div('xref', self.xref.format_forward(decl)) if self.source: chunk += ' %s'%div('source', self.source.format_forward(decl)) return chunk def format_group(self, decl): return '' def format_scope(self, decl): """Scopes have their own views, so return a reference to it.""" name = decl.name link = rel(self.formatter.filename(), self.directory_layout.scope(name)) return href(link, escape(name[-1])) def format_module(self, decl): return self.format_scope(decl) def format_meta_module(self, decl): return self.format_module(decl) def format_class(self, decl): chunk = div('synopsis', decl.type + ' ' + self.format_scope(decl)) if self.xref: chunk += ' %s'%div('xref', self.xref.format_class(decl)) if self.source: chunk += ' %s'%div('source', self.source.format_class(decl)) return chunk def format_class_template(self, decl): # treat template syntax like a premodifier if decl.template: templ = 'template <%s>'%(self.format_parameters(decl.template.parameters),) templ = div('template', templ) type = '%s %s'%(templ, decl.type) name = self.format_scope(decl) chunk = div('synopsis', type + ' ' + name) if self.xref: chunk += ' %s'%div('xref', self.xref.format_class(decl)) if self.source: chunk += ' %s'%div('source', self.source.format_class(decl)) return chunk def format_typedef(self, decl): "(typedef type, typedef name)" type = self.format_type(decl.alias) chunk = '%s'%div('synopsis', type + ' ' + self.label(decl.name)) if self.xref: chunk += ' %s'%div('xref', self.xref.format_class(decl)) if self.source: chunk += ' %s'%div('source', self.source.format_class(decl)) return chunk def format_enumerator(self, decl): """This is only called by formatEnum""" self.format_declaration(decl) def format_enum(self, decl): "(enum name, list of enumerator names)" type = self.label(decl.name) name = ', '.join([e.name[-1] for e in decl.enumerators]) chunk = '%s'%div('synopsis', type + ' ' + name) if self.xref: chunk += ' %s'%div('xref', self.xref.format_class(decl)) if self.source: chunk += ' %s'%div('source', self.source.format_class(decl)) return chunk def format_variable(self, decl): # TODO: deal with sizes type = self.format_type(decl.vtype) chunk = '%s'%div('synopsis', type + ' ' + self.label(decl.name)) if self.xref: chunk += ' %s'%div('xref', self.xref.format_class(decl)) if self.source: chunk += ' %s'%div('source', self.source.format_class(decl)) return chunk def format_const(self, decl): "(const type, const name = const value)" type = self.format_type(decl.ctype) name = self.label(decl.name) + " = " + escape(decl.value) chunk = '%s'%div('synopsis', type + ' ' + name) if self.xref: chunk += ' %s'%div('xref', self.xref.format_class(decl)) if self.source: chunk += ' %s'%div('source', self.source.format_class(decl)) return chunk def format_function(self, decl): "(return type, func + params + exceptions)" premod = self.format_modifiers(decl.premodifier) type = self.format_type(decl.return_type) name = self.label(decl.name, decl.real_name) # Special C++ functions TODO: maybe move to a separate ASG formatter... if decl.file.annotations['language'] == 'C++' and len(decl.real_name)>1: lt = decl.real_name[-2].find('<') # check whether this is a template sname = lt == -1 and decl.real_name[-2] or decl.real_name[-2][:lt] if decl.real_name[-1] == sname: type = 'constructor' elif decl.real_name[-1] == '~'+sname: type = 'destructor' elif decl.real_name[-1] == '(conversion)': name = '(%s)'%type params = self.format_parameters(decl.parameters) postmod = self.format_modifiers(decl.postmodifier) raises = self.format_exceptions(decl) # prepend the type by the premodifier(s) type = '%s %s'%(premod,type) # Prevent linebreaks on shorter lines if len(type) < 60: type = replace_spaces(type) if decl.type == 'attribute': name = '%s %s %s'%(name, postmod, raises) else: name = '%s(%s) %s %s'%(name, params, postmod, raises) chunk = '%s'%div('synopsis', type + ' ' + name) if self.xref: chunk += ' %s'%div('xref', self.xref.format_class(decl)) if self.source: chunk += ' %s'%div('source', self.source.format_class(decl)) return chunk def format_function_template(self, decl): "(return type, func + params + exceptions)" premod = self.format_modifiers(decl.premodifier) type = self.format_type(decl.return_type) name = self.label(decl.name, decl.real_name) # Special C++ functions TODO: maybe move to a separate ASG formatter... if decl.file.annotations['language'] == 'C++' and len(decl.real_name)>1: lt = decl.real_name[-2].find('<') # check whether this is a template sname = lt == -1 and decl.real_name[-2] or decl.real_name[-2][:lt] if decl.real_name[-1] == sname: type = 'constructor' elif decl.real_name[-1] == '~'+sname: type = 'destructor' elif decl.real_name[-1] == '(conversion)': name = '(%s)'%type params = self.format_parameters(decl.parameters) postmod = self.format_modifiers(decl.postmodifier) raises = self.format_exceptions(decl) # prepend the type by the premodifier(s) type = '%s %s'%(premod,type) # Prevent linebreaks on shorter lines if len(type) < 60: type = replace_spaces(type) if decl.type == 'attribute': name = '%s %s %s'%(name, postmod, raises) else: name = '%s(%s) %s %s'%(name, params, postmod, raises) # treat template syntax like a premodifier if decl.template: templ = 'template <%s>'%(self.format_parameters(decl.template.parameters),) templ = div('template', templ) type = '%s %s'%(templ, type) chunk = '%s'%div('synopsis', type + ' ' + name) if self.xref: chunk += ' %s'%div('xref', self.xref.format_class(decl)) if self.source: chunk += ' %s'%div('source', self.source.format_class(decl)) return chunk def format_operation(self, decl): # Default operation is same as function, and quickest way is to assign: return self.format_function(decl) def format_operation_template(self, decl): # Default operation is same as function, and quickest way is to assign: return self.format_function_template(decl) def format_parameter(self, parameter): """Returns one string for the given parameter""" text = [] # Premodifiers text.extend([span('keyword', escape(m)) for m in parameter.premodifier]) # Param Type id_holder = [parameter.name] typestr = self.format_type(parameter.type, id_holder) if typestr: text.append(typestr) # Postmodifiers text.extend([span('keyword', escape(m)) for m in parameter.postmodifier]) # Param name if id_holder and len(parameter.name) != 0: text.append(span('variable', escape(parameter.name))) # Param value if len(parameter.value) != 0: text.append('= %s'%span('value', escape(parameter.value))) return ' '.join(text) class DeclarationSummaryFormatter(DeclarationFormatter): """Derives from BaseStrategy to provide summary-specific methods. Currently the only one is format_exceptions""" def format_exceptions(self, oper): """Returns a reference to the detail if there are any exceptions.""" if len(oper.exceptions): return self.reference(oper.name, ' raises') return '' class DeclarationDetailFormatter(DeclarationFormatter): """Provide detail-specific Declaration formatting.""" def format_exceptions(self, oper): """Prints out the full exception spec""" if len(oper.exceptions): raises = span('keyword', 'raises') exceptions = [] for exception in oper.exceptions: exceptions.append(self.reference(exception.name)) exceptions = span('raises', ', '.join(exceptions)) return '%s (%s)'%(raises, exceptions) else: return '' def format_enum(self, enum): name = span('keyword', 'enum') + ' ' + self.label(enum.name) enumors = ''.join([self.format_enumerator(e) for e in enum.enumerators]) return name + div('enum', enumors) def format_enumerator(self, enumerator): text = self.label(enumerator.name) if len(enumerator.value): value = ' = ' + span('value', escape(enumerator.value)) else: value = '' doc = self.processor.documentation.details(enumerator, self.view) return div('enumerator','%s%s%s'%(text, value, doc)) synopsis-0.12/Synopsis/Formatters/HTML/Fragments/TemplateSpecializations.py0000644000076400007640000000307211104703265026534 0ustar stefanstefan# # Copyright (C) 2008 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Formatters.HTML.Tags import * from Synopsis.Formatters.HTML.Fragment import Fragment class TemplateSpecializations(Fragment): """Cross-link primary templates with their specializations.""" def format_forward(self, forward): if not forward.template: return '' if forward.specializations: spec = '\n'.join([div(None, self.reference(s)) for s in forward.specializations]) return div('specializations', 'Specializations: ' + div(None, spec)) elif forward.primary_template: return div('primary-template', 'Primary template: ' + self.reference(forward.primary_template)) return '' def format_class(self, class_): if class_.primary_template: return div('primary-template', 'Primary template: ' + self.reference(class_.primary_template)) return '' def format_class_template(self, template_): if template_.specializations: spec = ' '.join([div(None, self.reference(s)) for s in template_.specializations]) return div('specializations', 'Specializations: ' + spec) elif template_.primary_template: return div('primary-template', 'Primary template: ' + self.reference(template_.primary_template)) return '' synopsis-0.12/Synopsis/Formatters/HTML/Fragments/HeadingFormatter.py0000664000076400007640000002170311104703265025125 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import ASG from Synopsis.Formatters.HTML.Fragment import Fragment from Synopsis.Formatters.HTML.Tags import * from SourceLinker import SourceLinker from XRefLinker import XRefLinker class HeadingFormatter(Fragment): """Formats the top of a view - it is passed only the Declaration that the view is for (a Module or Class).""" def register(self, formatter): super(HeadingFormatter, self).register(formatter) if self.processor.has_view('XRef'): self.xref = XRefLinker() self.xref.register(formatter) else: self.xref = None if self.processor.has_view('Source'): self.source = SourceLinker() self.source.register(formatter) else: self.source = None def format_name(self, qname): """Formats a qualified name such that each name component becomes a link to the respective scope.""" scope, text = type(qname)(), [] for name in qname[:-1]: scope = scope + (name,) text.append(self.reference(scope)) text.append(escape(qname[-1])) return '%s\n'%(qname.sep).join(text) + '\n' def format_name_in_module(self, qname): """Formats a reference to each parent scope, starting at the first non-module scope.""" types = self.processor.ir.asg.types scope, text = type(qname)(), [] for name in qname[:-1]: scope += (name,) if types.has_key(scope): ns_type = types[scope] if isinstance(ns_type, ASG.DeclaredTypeId): decl = ns_type.declaration if isinstance(decl, ASG.Module): # Skip modules continue text.append(self.reference(scope)) text.append(escape(qname[-1])) return '%s\n'%qname.sep.join(text) + '\n' def format_module_of_name(self, qname): """Formats a reference to each parent scope and this one.""" types = self.processor.ir.asg.types scope, text = type(qname)(), [] last_decl = None for name in qname: scope += (name,) if types.has_key(scope): ns_type = types[scope] if isinstance(ns_type, ASG.DeclaredTypeId): decl = ns_type.declaration if isinstance(decl, ASG.Module): # Only do modules text.append(self.reference(scope)) last_decl = decl continue break return last_decl, qname.sep.join(text) + '\n' def format_module(self, module): """Formats the module by linking to each parent scope in the name.""" # Module details are only printed at the top of their view if not module.name: title = 'Global %s'%module.type.capitalize() else: title = '%s %s'%(module.type.capitalize(), self.format_name(module.name)) return element('h1', title) def format_meta_module(self, module): """Calls format_module.""" return self.format_module(module) def format_class(self, class_): """Formats the class by linking to each parent scope in the name.""" # Calculate the module string decl, module = self.format_module_of_name(class_.name) if decl: module = '%s %s'%(decl.type, module) module = div('class-module', module) else: module = '' # Calculate class name string type = class_.type name = self.format_name_in_module(class_.name) name = div('class-name', '%s %s'%(type, name)) # Calculate file-related string file_name = rel(self.processor.output, class_.file.name) # Try the file index view first file_link = self.directory_layout.file_index(class_.file.name) if self.processor.filename_info(file_link): file_ref = href(rel(self.formatter.filename(), file_link), file_name, target='detail') else: # Try source file next file_link = self.directory_layout.file_source(class_.file.name) if self.processor.filename_info(file_link): file_ref = href(rel(self.formatter.filename(), file_link), file_name) else: file_ref = file_name links = div('file', 'File: %s'%file_ref) if self.xref: links += ' %s'%div('xref', self.xref.format_class(class_)) if self.source: links += ' %s'%div('source', self.source.format_class(class_)) info = div('links', links) return '%s%s%s'%(module, name, info) def format_class_template(self, class_): """Formats the class template by linking to each parent scope in the name.""" # Calculate the module string decl, module = self.format_module_of_name(class_.name) if decl: module = '%s %s'%(decl.type, module) module = div('class-module', module) else: module = '' # Calculate template string templ = class_.template params = templ.parameters params = ', '.join([self.format_parameter(p) for p in params]) templ = div('class-template', "template <%s>"%params) # Calculate class name string type = class_.type name = self.format_name_in_module(class_.name) name = div('class-name', '%s %s'%(type, name)) # Calculate file-related string file_name = rel(self.processor.output, class_.file.name) # Try the file index view first file_link = self.directory_layout.file_index(class_.file.name) if self.processor.filename_info(file_link): file_ref = href(rel(self.formatter.filename(), file_link), file_name, target='detail') else: # Try source file next file_link = self.directory_layout.file_source(class_.file.name) if self.processor.filename_info(file_link): file_ref = href(rel(self.formatter.filename(), file_link), file_name) else: file_ref = file_name links = div('file', 'File: %s'%file_ref) if self.xref: links += ' %s'%div('xref', self.xref.format_class(class_)) if self.source: links += ' %s'%div('source', self.source.format_class(class_)) info = div('links', links) return '%s%s%s%s'%(module, templ, name, info) def format_forward(self, forward): """Formats the forward declaration if it is a template declaration.""" # Calculate the module string decl, module = self.format_module_of_name(forward.name) if decl: module = '%s %s'%(decl.type, module) module = div('class-module', module) else: module = '' # Calculate template string if not forward.template: return '' params = forward.template.parameters params = ', '.join([self.format_parameter(p) for p in params]) templ = div('class-template', "template <%s>"%params) # Calculate class name string type = forward.type name = self.format_name_in_module(forward.name) name = div('class-name', '%s %s'%(type, name)) # Calculate file-related string file_name = rel(self.processor.output, forward.file.name) # Try the file index view first file_link = self.directory_layout.file_index(forward.file.name) if self.processor.filename_info(file_link): file_ref = href(rel(self.formatter.filename(), file_link), file_name, target='detail') else: # Try source file next file_link = self.directory_layout.file_source(forward.file.name) if self.processor.filename_info(file_link): file_ref = href(rel(self.formatter.filename(), file_link), file_name) else: file_ref = file_name links = div('file', 'File: %s'%file_ref) info = div('links', links) return '%s%s%s%s'%(module, templ, name, info) def format_parameter(self, parameter): """Returns one string for the given parameter""" chunks = [] # Premodifiers chunks.extend([span("keyword", escape(m)) for m in parameter.premodifier]) # Param Type typestr = self.format_type(parameter.type) if typestr: chunks.append(typestr) # Postmodifiers chunks.extend([span("keyword", m) for m in parameter.postmodifier]) # Param name if len(parameter.name) != 0: chunks.append(span("variable", parameter.name)) # Param value if len(parameter.value) != 0: chunks.append(" = " + span("value", parameter.value)) return ' '.join(chunks) synopsis-0.12/Synopsis/Formatters/HTML/Fragments/ClassHierarchySimple.py0000664000076400007640000000217611104703265025763 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Formatters.HTML.Tags import * from Synopsis.Formatters.HTML.Fragment import Fragment class ClassHierarchySimple(Fragment): "Prints a simple text hierarchy for classes" def format_inheritance(self, inheritance): return '%s %s'%(self.format_modifiers(inheritance.attributes), self.format_type(inheritance.parent)) def format_class(self, class_): # Print out a list of the parents super = sub = '' if class_.parents: parents = [self.format_inheritance(i) for i in class_.parents] super = ', '.join(parents) super = div('superclasses', "Superclasses: "+super) # Print subclasses subs = self.processor.class_tree.subclasses(class_.name) if subs: sub = ', '.join([self.reference(s) for s in subs]) sub = div('subclasses', "Known subclasses: "+sub) return super + sub format_class_template = format_class synopsis-0.12/Synopsis/Formatters/HTML/Fragments/SourceLinker.py0000664000076400007640000000175111171367174024321 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Formatters.HTML.Tags import * from Default import Default _icons = {'C':'src-c.png', 'C++':'src-c++.png', 'Python':'src-py.png'} class SourceLinker(Default): """Adds a link to the decl on the file view to all declarations""" def register(self, formatter): Default.register(self, formatter) self.sxr = self.processor.sxr_prefix and True def format_declaration(self, decl): if not self.sxr or not decl.file: return '' language = decl.file.annotations['language'] icon = _icons[language] url = self.directory_layout.file_source(decl.file.name) + '#line%d' % decl.line label = img(src=rel(self.view.filename(), icon), alt='source code') return href(rel(self.view.filename(), url), label) synopsis-0.12/Synopsis/Formatters/HTML/Parts/0000775000076400007640000000000011172123232020463 5ustar stefanstefansynopsis-0.12/Synopsis/Formatters/HTML/Parts/__init__.py0000664000076400007640000000016711104703265022605 0ustar stefanstefan from Heading import Heading from Summary import Summary from Detail import Detail from Inheritance import Inheritance synopsis-0.12/Synopsis/Formatters/HTML/Parts/Heading.py0000664000076400007640000000211011104703265022373 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import Parameter from Synopsis.Formatters.HTML.Part import Part from Synopsis.Formatters.HTML.Fragments import * from Synopsis.Formatters.HTML.Tags import * class Heading(Part): """Heading view part. Displays a header for the view -- its strategies are only passed the object that the view is for; ie a Class or Module""" fragments = Parameter([HeadingFormatter(), TemplateSpecializations(), ClassHierarchyGraph(), DetailCommenter()], '') def write_section_item(self, text): """Writes text and follows with a horizontal rule""" self.write(text + '\n') def process(self, decl): """Process this Part by formatting only the given decl""" self.write_start() decl.accept(self) self.write_end() synopsis-0.12/Synopsis/Formatters/HTML/Parts/Inheritance.py0000664000076400007640000000741311104703265023300 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import Parameter from Synopsis import ASG from Synopsis.Formatters.HTML.Part import Part from Synopsis.Formatters.HTML.Fragments import * from Synopsis.Formatters.HTML.Tags import * def short_name(decl): return isinstance(decl, ASG.Function) and decl.real_name[-1] or decl.name[-1] class Inheritance(Part): fragments = Parameter([InheritanceFormatter()], '') def register(self, view): Part.register(self, view) self.__start_list = 0 def process(self, decl): "Walk the hierarchy to find inherited members to print." if not isinstance(decl, (ASG.Class, ASG.ClassTemplate)): return self.write_start() names = [short_name(d) for d in decl.declarations] self._process_superclasses(decl, names) self.write_end() def _process_class(self, class_, names): "Prints info for the given class, and calls _process_superclasses after" sorter = self.processor.sorter.clone(class_.declarations) child_names = [] # Iterate through the sections for section in sorter: # Write a heading heading = section+' Inherited from '+ str(self.scope().prune(class_.name)) started = 0 # Lazy section start incase no details for this section # Iterate through the children in this section for child in sorter[section]: child_name = short_name(child) if child_name in names: continue # FIXME: This doesn't account for the inheritance type # (private etc) if child.accessibility == ASG.PRIVATE: continue # Don't include constructors and destructors! if (isinstance(child, ASG.Function) and child.file.annotations['language'] == 'C++' and len(child.real_name) > 1): if child.real_name[-1] == child.real_name[-2]: continue elif child.real_name[-1] == "~"+child.real_name[-2]: continue # FIXME: skip overriden declarations child_names.append(child_name) # Check section heading if not started: started = 1 self.write_section_start(heading) child.accept(self) # Finish the section if started: self.write_section_end(heading) self._process_superclasses(class_, names + child_names) def _process_superclasses(self, class_, names): """Iterates through the superclasses of clas and calls _process_clas for each""" for inheritance in class_.parents: parent = inheritance.parent if isinstance(parent, ASG.DeclaredTypeId): parent = parent.declaration if isinstance(parent, ASG.Class): self._process_class(parent, names) continue #print "Ignoring", parent.__class__.__name__, "parent of", clas.name pass #ignore def write_section_start(self, heading): """Creates a table with one row. The row has a td of class 'heading' containing the heading string""" self.write('\n'%heading) self.write('\n') self.write('
    ' + heading + '
    ') self.__start_list = 1 def write_section_item(self, text): """Adds a table row""" if self.__start_list: self.write(text) self.__start_list = 0 else: self.write(',\n'+text) def write_section_end(self, heading): self.write('
    \n') synopsis-0.12/Synopsis/Formatters/HTML/Parts/Summary.py0000664000076400007640000000551311170475031022503 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import ASG from Synopsis.Processor import Parameter from Synopsis.Formatters.HTML.Part import Part from Synopsis.Formatters.HTML.Fragments import * from Synopsis.Formatters.HTML.Tags import * class Summary(Part): """Formatting summary visitor. This formatter displays a summary for each declaration, with links to the details if there is one. All of this is controlled by the ASGFormatters.""" fragments = Parameter([DeclarationSummaryFormatter(), SummaryCommenter()], '') def register(self, view): Part.register(self, view) self.__link_detail = False def set_link_detail(self, flag): """Sets link_detail flag to given value. @see label()""" self.__link_detail = flag def label(self, ref, label=None): """Override to check link_detail flag. If it's set, returns a reference instead - which will be to the detailed info""" if label is None: label = ref if self.__link_detail: # Insert a reference instead return span('name',self.reference(ref, str(self.scope().prune(label)))) return Part.label(self, ref, label) def write_section_start(self, heading): """Start a 'summary' section and write an appropriate heading.""" self.write('
    \n') self.write(div('heading', heading) + '\n') def write_section_end(self, heading): """Close the section.""" self.write('
    \n') def write_section_item(self, text): """Add an item.""" self.write(div('item', text) + '\n') def process(self, scope): "Print out the summaries from the given scope" if type(scope) == ASG.Forward: return doc = self.processor.documentation sorter = self.processor.sorter.clone(scope.declarations) self.write_start() for section in sorter: # Write a header for this section heading = section+' Summary:' self.write_section_start(heading) # Iterate through the children in this section for child in sorter[section]: # Check if need to add to detail list if doc.details(child, self.view()): # Setup the linking stuff self.set_link_detail(1) child.accept(self) self.set_link_detail(0) else: # Just do it child.accept(self) # Finish off this section self.write_section_end(heading) self.write_end() synopsis-0.12/Synopsis/Formatters/HTML/Parts/Detail.py0000664000076400007640000000403311104703265022244 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import ASG from Synopsis.Processor import Parameter from Synopsis.Formatters.HTML.Part import Part from Synopsis.Formatters.HTML.Fragments import * from Synopsis.Formatters.HTML.Tags import * class Detail(Part): fragments = Parameter([DeclarationDetailFormatter(), DetailCommenter()], '') def write_section_start(self, heading): """Start a 'detail' section and write an appropriate heading.""" self.write('
    \n') self.write(div('heading', heading) + '\n') def write_section_end(self, heading): """Close the section.""" self.write('
    \n') def write_section_item(self, text): """Add an item.""" self.write(div('item',text) + '\n') def process(self, decl): "Print out the details for the children of the given decl" if type(decl) == ASG.Forward: return doc = self.processor.documentation sorter = self.processor.sorter.clone(decl.declarations) # Iterate through the sections with details self.write_start() for section in sorter: # Write a heading heading = section+' Details:' started = 0 # Lazy section start incase no details for this section # Iterate through the children in this section for child in sorter[section]: # Check if need to add to detail list if not doc.details(child, self.view()): continue # Check section heading if not started: started = 1 self.write_section_start(heading) child.accept(self) # Finish the section if started: self.write_section_end(heading) self.write_end() synopsis-0.12/Synopsis/Formatters/HTML/__init__.py0000664000076400007640000001613611133207125021513 0ustar stefanstefan# # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import config from Synopsis.Processor import * from Synopsis import IR, ASG from Synopsis.QualifiedName import * from Synopsis.DocString import DocString from Synopsis.FileTree import make_file_tree from Synopsis.Formatters.TOC import TOC from Synopsis.Formatters.ClassTree import ClassTree from DirectoryLayout import * from XRefPager import XRefPager from Views import * from Frame import Frame from FrameSet import FrameSet from Synopsis.Formatters.HTML.Markup.Javadoc import Javadoc try: from Synopsis.Formatters.HTML.Markup.RST import RST except ImportError: from Synopsis.Formatters.HTML.Markup import Formatter as RST import Markup import Tags import time class DocCache: """""" def __init__(self, processor, markup_formatters): self._processor = processor self._markup_formatters = markup_formatters # Make sure we have a default markup formatter. if '' not in self._markup_formatters: self._markup_formatters[''] = Markup.Formatter() for f in self._markup_formatters.values(): f.init(self._processor) self._doc_cache = {} def _process(self, decl, view): """Return the documentation for the given declaration.""" key = id(decl) if key not in self._doc_cache: doc = decl.annotations.get('doc') if doc: formatter = self._markup_formatters.get(doc.markup, self._markup_formatters['']) doc = formatter.format(decl, view) else: doc = Markup.Struct() # FIXME: Unfortunately we can't easily cache these, as they may # contain relative URLs that aren't valid across views. # self._doc_cache[key] = doc return doc else: return self._doc_cache[key] def summary(self, decl, view): """""" doc = self._process(decl, view) return doc.summary def details(self, decl, view): """""" doc = self._process(decl, view) return doc.details class Formatter(Processor): title = Parameter('Synopsis - Generated Documentation', 'title to put into html header') stylesheet = Parameter(os.path.join(config.datadir, 'html.css'), 'stylesheet to be used') directory_layout = Parameter(NestedDirectoryLayout(), 'how to lay out the output files') toc_in = Parameter([], 'list of table of content files to use for symbol lookup') toc_out = Parameter('', 'name of file into which to store the TOC') sxr_prefix = Parameter(None, 'path prefix (directory) under which to find sxr info') index = Parameter([ModuleTree(), FileTree()], 'set of index views') detail = Parameter([ModuleIndex(), FileIndex()], 'set of detail views') content = Parameter([Scope(), Source(), XRef(), FileDetails(), InheritanceTree(), InheritanceGraph(), NameIndex()], 'set of content views') markup_formatters = Parameter({'javadoc':Javadoc(), 'rst':RST(), 'reStructuredText':RST()}, 'Markup-specific formatters.') graph_color = Parameter('#ffcc99', 'base color for inheritance graphs') def process(self, ir, **kwds): self.set_parameters(kwds) if not self.output: raise MissingArgument('output') self.ir = self.merge_input(ir) # Make sure we operate on a single top-level node. # (Python package, C++ global namespace, etc.) if (len(self.ir.asg.declarations) != 1 or not isinstance(self.ir.asg.declarations[0], ASG.Module)): # Assume this is C++ in this case. self.root = ASG.Module(None, -1, 'namespace', QualifiedName()) self.root.declarations = ir.asg.declarations else: self.root = self.ir.asg.declarations[0] self.directory_layout.init(self) self.documentation = DocCache(self, self.markup_formatters) # Create the class tree (shared by inheritance graph / tree views). self.class_tree = ClassTree() for d in self.root.declarations: d.accept(self.class_tree) # Create the file tree (shared by file listing / tree views). self.file_tree = make_file_tree(self.ir.files.values()) # Create the cross reference table (shared by XRef / Scope views) self.xref = XRefPager(self.ir) from Synopsis.DeclarationSorter import DeclarationSorter self.sorter = DeclarationSorter() # Make all views queryable through Formatter.has_view() self.views = self.content + self.index + self.detail frames = [] # If only content contains views don't use frames. if self.index or self.detail: Tags.using_frames = True frames.append(Frame(self, self.index)) frames.append(Frame(self, self.detail)) frames.append(Frame(self, self.content)) else: Tags.using_frames = False frames.append(Frame(self, self.content, noframes = True)) self.__files = {} # map from filename to (view,scope) # The table of content is by definition the TOC of the first # view on the content frame. self.toc = self.content[0].toc() if self.verbose: print "TOC size:", self.toc.size() if self.toc_out: self.toc.store(self.toc_out) # load external references from toc files, if any for t in self.toc_in: self.toc.load(t) if self.verbose: print "HTML Formatter: Generating views..." # Process the views. if len(frames) > 1: frameset = FrameSet() frameset.process(self.output, self.directory_layout.index(), self.title, self.index[0].root()[0] or self.index[0].filename(), self.detail[0].root()[0] or self.detail[0].filename(), self.content[0].root()[0] or self.content[0].filename()) for frame in frames: frame.process() return self.ir def has_view(self, name): """test whether the given view is part of the views list.""" return name in [x.__class__.__name__ for x in self.views] def register_filename(self, filename, view, scope): """Registers a file for later production. The first view to register the filename gets to keep it.""" filename = str(filename) if not self.__files.has_key(filename): self.__files[filename] = (view, scope) def filename_info(self, filename): """Returns information about a registered file, as a (view,scope) pair. Will return None if the filename isn't registered.""" return self.__files.get(filename) synopsis-0.12/Synopsis/Formatters/HTML/XRefPager.py0000664000076400007640000000260411122312026021565 0ustar stefanstefan# # Copyright (C) 2008 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # class XRefPager: """Generates pages of cross-references.""" def __init__(self, ir): self.page_map = {} self.page_info = [] # Split the data into multiple files based on size page = 0 count = 0 names = ir.sxr.keys() if names: self.page_info.append([]) names.sort() for name in names: if count > 200: count = 0 page += 1 self.page_info.append([]) self.page_info[page].append(name) self.page_map[name] = page entry = ir.sxr[name] d, c, r = len(entry.definitions), len(entry.calls), len(entry.references) count += 1 + d + c + r if d: count += 1 if c: count += 1 if r: count += 1 def get(self, name): """Returns the number of the page that the xref info for the given name is on, or None if not found.""" return self.page_map.get(name) def pages(self): """Returns a list of pages, each consisting of a list of names on that page. This method is intended to be used by whatever generates the files...""" return self.page_info synopsis-0.12/Synopsis/Formatters/HTML/Tags.py0000664000076400007640000000733011104703265020652 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # """HTML Tag generation utilities. You will probably find it easiest to import * from this module.""" using_frames = True #overwritten by Formatter... def attributes(keys): "Convert a name/value dict to a string of attributes" return ' '.join(['%s="%s"'%(k,v) for k,v in keys.items()]) def rel(origin, target): "Find link to target relative to origin." origin, target = origin.split('/'), target.split('/') if len(origin) < len(target): check = len(origin) - 1 else: check = len(target) - 1 for l in range(check): if target[0] == origin[0]: del target[0] del origin[0] else: break # If origin is a directory, and target is in that directory, origin[0] == target[0] if len(origin) == 1 and len(target) > 1 and origin[0] == target[0]: # Remove directory from target, but respect len(origin) - 1 below del target[0] if origin: target = ['..'] * (len(origin) - 1) + target return '/'.join(target) def href(_ref, _label, **attrs): "Return a href to 'ref' with name 'label' and attributes" # Remove target if not using frames if attrs.has_key('target') and not using_frames: del attrs['target'] return '%s'%(_ref,attributes(attrs),_label) def img(**attrs): "Return an img element." return ''%attributes(attrs) def name(ref, label): "Return a name anchor with given reference and label" if '(' in ref: raise error return '%s'%(ref,label) def span(class_, body): "Wrap the body in a span of the given class" if class_: return '%s'%(class_,body) else: return '%s'%body def div(class_, body): "Wrap the body in a div of the given class" if class_: return '
    %s
    '%(class_,body) else: return '
    %s
    '%body def element(_, body = None, **keys): "Wrap the body in a tag of given type and attributes" if body: return '<%s %s>%s'%(_, attributes(keys), body, _) else: return '<%s %s />'%(_, attributes(keys)) def desc(text): "Create a description div for the given text" return text and div("desc", text) or '' def escape(text): for p in [('&', '&'), ('"', '"'), ('<', '<'), ('>', '>'), ('(', '('), (')', ')'), (',', ','), (',', ';')]: text = text.replace(*p) return text def quote_as_id(text): for p in [(' ', '.'), ('<', '_L'), ('>', '_R'), ('(', '_l'), (')', '_r'), ('::', '-'), ('~', '_t'), (':', '.'), ('&', '_A'), ('*', '_S'), (' ', '_s'), (',', '_c'), (';', '_C'), ('!', '_n'), ('[', '_b'), (']', '_B'), ('=', '_e'), ('+', '_p'), ('-', '_m')]: text = text.replace(*p) return text def replace_spaces(text): """Replaces spaces in the given string with   sequences. Does NOT replace spaces inside tags""" # original "hello fool yohi" tags = text.split('<') # now ['hello ', 'there stuff> fool ', 'thing me bob>yo', 'a>hi'] tags = [x.split('>') for x in tags] # now [['hello '], ['there stuff', ' fool '], ['thing me bob', 'yo'], ['a', 'hi']] tags = reduce(lambda x,y: x+y, tags) # now ['hello ', 'there stuff', ' fool ', 'thing me bob', 'yo', 'a', 'hi'] for i in range(0,len(tags),2): tags[i] = tags[i].replace(' ', ' ') for i in range(1,len(tags),2): tags[i] = '<' + tags[i] + '>' return ''.join(tags) synopsis-0.12/Synopsis/Formatters/HTML/Frame.py0000664000076400007640000000326511104703264021010 0ustar stefanstefan# # Copyright (C) 2006 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Formatters.HTML.Tags import * import sys, time class Frame: """A Frame is a mediator for views that get displayed in it (as well as other frames. It supports the creation of links across views.""" def __init__(self, processor, views, noframes = False): self.processor = processor self.views = views self.noframes = noframes if self.noframes: self.views[0].main = True for v in self.views: v.register(self) def process(self): for v in self.views: v.register_filenames() for v in self.views: if self.processor.profile: print 'Time for %s:'%v.__class__.__name__, sys.stdout.flush() start_time = time.time() v.process() if self.processor.profile: print '%f seconds'%(time.time() - start_time) def navigation_bar(self, view): """Generates a navigation bar for the given view.""" # Only include views that set a root title. views = [v for v in self.views if v.root()[1]] def item(v): """Generate a navigation bar item.""" url, label = v.root() if url == view.filename(): return span('selected', label) + '\n' else: return span('normal', href(rel(view.filename(), url), label)) + '\n' items = [item(v) for v in views] return items and div('navigation', '\n' + ''.join(items)) or '' synopsis-0.12/Synopsis/Formatters/HTML/View.py0000664000076400007640000002525211104703265020671 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # """ View base class, contains base functionality and common interface for all Views. """ from Synopsis.Processor import Parametrized, Parameter from Synopsis.Formatters import open_file from Tags import * import re, os class Format(Parametrized): """Default and base class for formatting a view layout. The Format class basically defines the HTML used at the start and end of the view. The default creates an XHTML compliant header and footer with a proper title, and link to the stylesheet.""" def init(self, processor, prefix): self.prefix = prefix def view_header(self, os, title, body, headextra, view): """Called to output the view header to the given output stream. @param os a file-like object (use os.write()) @param title the title of this view @param body the body tag, which may contain extra parameters such as onLoad scripts, and may also be empty eg: for the frames index @param headextra extra html to put in the head section, such as scripts """ os.write('\n') os.write('\n') os.write('\n') os.write('\n') os.write('\n') os.write("\n") os.write('\n') os.write(element('title','Synopsis - '+ title) + '\n') css = self.prefix + 'style.css' os.write(element('link', type='text/css', rel='stylesheet', href=css) + '\n') os.write(headextra) os.write("\n%s\n"%body) def view_footer(self, os, body): """Called to output the view footer to the given output stream. @param os a file-like object (use os.write()) @param body the close body tag, which may be empty eg: for the frames index """ os.write("\n%s\n\n"%body) class Template(Format): """Format subclass that uses a template file to define the HTML header and footer for each view.""" template = Parameter('', 'the html template file') copy_files = Parameter([], 'a list of files to be copied into the output dir') def init(self, processor, prefix): Format.init(self, processor, prefix) self.__re_body = re.compile('([ \t\n]+[-a-zA-Z0-9]+=("[^"]*"|\'[^\']*\'|[^ \t\n>]*))*)>', re.I) self.__re_closebody = re.compile('', re.I) self.__re_closehead = re.compile('', re.I) self.__title_tag = '@TITLE@' self.__content_tag = '@CONTENT@' for file in self.copy_files: processor.file_layout.copy_file(file, file) self.load_file() def load_file(self): """Loads and parses the template file""" f = open(self.template, 'rt') text = f.read(1024*64) # arbitrary max limit of 64kb f.close() # Find the content tag content_index = text.find(self.__content_tag) if content_index == -1: print "Fatal: content tag '%s' not found in template file!"%self.__content_tag raise SystemError, "Content tag not found" header = text[:content_index] # Find the title (doesn't matter if not found) self.__title_index = text.find(self.__title_tag) if self.__title_index != -1: # Remove the title tag header = header[:self.__title_index] + \ header[self.__title_index+len(self.__title_tag):] # Find the close head tag mo = self.__re_closehead.search(header) if mo: self.__headextra_index = mo.start() else: self.__headextra_index = -1 # Find the body tag mo = self.__re_body.search(header) if not mo: print "Fatal: body tag not found in template file!" print "(if you are sure there is one, this may be a bug in Synopsis)" raise SystemError, "Body tag not found" if mo.group('params'): self.__body_params = mo.group('params') else: self.__body_params = '' self.__body_index = mo.start() header = header[:mo.start()] + header[mo.end():] # Store the header self.__header = header footer = text[content_index+len(self.__content_tag):] # Find the close body tag mo = self.__re_closebody.search(footer) if not mo: print "Fatal: close body tag not found in template file" raise SystemError, "Close body tag not found" self.__closebody_index = mo.start() footer = footer[:mo.start()] + footer[mo.end():] self.__footer = footer def write(self, os, text): """Writes the text to the output stream, replaceing @PREFIX@ with the prefix for this file""" sections = text.split('@PREFIX@') os.write(self.prefix.join(sections)) def view_header(self, os, title, body, headextra, view): """Formats the header using the template file""" if not body: return Format.view_header(self, os, title, body, headextra) header = self.__header index = 0 if self.__title_index != -1: self.write(os, header[:self.__title_index]) self.write(os, title) index = self.__title_index if self.__headextra_index != -1: self.write(os, header[index:self.__headextra_index]) self.write(os, headextra) index = self.__headextra_index self.write(os, header[index:self.__body_index]) if body: if body[-1] == '>': self.write(os, body[:-1]+self.__body_params+body[-1]) else: # Hmmmm... Should not happen, perhaps use regex? self.write(os, body) self.write(os, header[self.__body_index:]) def view_footer(self, os, body): """Formats the footer using the template file""" if not body: return Format.view_footer(self, os, body) footer = self.__footer self.write(os, footer[:self.__closebody_index]) self.write(os, body) self.write(os, footer[self.__closebody_index:]) class View(Parametrized): """Base class for Views. The base class provides a common interface, and also handles common operations such as opening the file, and delegating the view formatting to a strategy class.""" template = Parameter(Format(), 'the object that provides the html template for the view') def __init__(self, **kwds): super(View, self).__init__(**kwds) self.main = False def register(self, frame): """Registers this View class with its frame.""" self.frame = frame self.directory_layout = self.frame.processor.directory_layout self.processor = frame.processor self.__os = None def filename(self): """Return the filename (currently) associated with the view.""" return '' def title(self): """Return the title (currently) associated with the view.""" return '' def root(self): """Return a pair of (url, label) to link to the entry point of this view.""" return None, None def write_navigation_bar(self): """Generate a navigation bar for this view.""" self.write(self.frame.navigation_bar(self) + '\n') def os(self): "Returns the output stream opened with start_file" return self.__os def write(self, str): """Writes the given string to the currently opened file""" self.__os.write(str) def register_filenames(self): """Register filenames for each file this View will generate.""" pass def toc(self): """Retrieves the TOC for this view. This method assumes that the view generates info for the the whole ASG, which could be the Scope, the Source (source code) or the XRef (cross reference info). The default implementation returns None.""" pass def process(self): """Process the ASG, creating view-specific html pages.""" pass def open_file(self): """Returns a new output stream. This template method is for internal use only, but may be overriden in derived classes. The default joins output dir and self.filename()""" path = os.path.join(self.processor.output, self.filename()) return open_file(path) def close_file(self): """Closes the internal output stream. This template method is for internal use only, but may be overriden in derived classes.""" self.__os.close() self.__os = None def start_file(self, body='', headextra=''): """Start a new file with given filename, title and body. This method opens a file for writing, and writes the html header crap at the top. You must specify a title, which is prepended with the project name. The body argument is optional, and it is preferred to use stylesheets for that sort of stuff. You may want to put an onLoad handler in it though in which case that's the place to do it. The opened file is stored and can be accessed using the os() method.""" self.__os = self.open_file() prefix = rel(self.filename(), '') self.template.init(self.processor, prefix) if not body: body = ''%self.__class__.__name__ self.template.view_header(self.__os, self.title(), body, headextra, self) def end_file(self, body=''): """Close the file using given close body tag. The default is just a close body tag, but if you specify '' then nothing will be written (useful for a frames view)""" self.template.view_footer(self.__os, body) self.close_file() def reference(self, name, scope, label=None, **keys): """Returns a reference to the given name. The name is a scoped name, and the optional label is an alternative name to use as the link text. The name is looked up in the TOC so the link may not be local. The optional keys are appended as attributes to the A tag.""" if not label: label = escape(str(scope.prune(name))) entry = self.processor.toc[name] if entry: return href(rel(self.filename(), entry.link), label, **keys) return label or '' synopsis-0.12/Synopsis/Formatters/HTML/Views/0000775000076400007640000000000011172123232020467 5ustar stefanstefansynopsis-0.12/Synopsis/Formatters/HTML/Views/Scope.py0000664000076400007640000001042211104703265022116 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import config from Synopsis.Processor import Parameter from Synopsis import ASG from Synopsis.Formatters.TOC import TOC from Synopsis.Formatters.HTML.View import View from Synopsis.Formatters.HTML.Tags import * from Synopsis.Formatters.HTML.Parts import * import time class Scope(View): """A module for creating a view for each Scope with summaries and details. This module is highly modular, using the classes from ASGFormatter to do the actual formatting. The classes to use may be controlled via the config script, resulting in a very configurable output. @see ASGFormatter The ASGFormatter module @see Config.Formatters.HTML.ScopeViews Config for ScopeViews """ parts = Parameter([Heading(), Summary(), Inheritance(), Detail()], '') def register(self, frame): super(Scope, self).register(frame) for part in self.parts: part.register(self) self.scope_queue = [] self.__toc = TOC(self.directory_layout) for d in self.processor.ir.asg.declarations: d.accept(self.__toc) def toc(self): return self.__toc def filename(self): return self.__filename def title(self): return self.__title def root(self): if self.main: url = self.directory_layout.index() else: url = self.directory_layout.scope(self.processor.root.name) title = 'Global %s'%(self.processor.root.type.capitalize()) return url, title def scope(self): """return the current scope processed by this object""" return self.__scope def process(self): """Creates a view for every Scope.""" module = self.processor.root self.scopes_queue = [module] while self.scopes_queue: scope = self.scopes_queue.pop(0) self.process_scope(scope) scopes = [c for c in scope.declarations if isinstance(c, ASG.Scope)] self.scopes_queue.extend(scopes) forwards = [c for c in scope.declarations if isinstance(c, ASG.Forward) and c.specializations] # Treat forward-declared class template like a scope if it has # specializations, since these are only listed in a Scope view. # Process them directly as they don't have child declarations. for f in forwards: self.process_scope(f) def register_filenames(self): """Registers a view for every Scope.""" self.scopes_queue = [self.processor.root] while self.scopes_queue: scope = self.scopes_queue.pop(0) if scope.name: filename = self.directory_layout.scope(scope.name) else: filename = self.root()[0] self.processor.register_filename(filename, self, scope) scopes = [c for c in scope.declarations if isinstance(c, ASG.Module)] self.scopes_queue.extend(scopes) def process_scope(self, scope): """Creates a view for the given scope""" # Open file and setup scopes self.__scope = scope.name if self.__scope: self.__filename = self.directory_layout.scope(self.__scope) self.__title = escape(str(self.__scope)) else: self.__filename, self.__title = self.root() self.start_file() self.write_navigation_bar() # Loop throught all the view Parts for part in self.parts: part.process(scope) self.end_file() def end_file(self): """Overrides end_file to provide synopsis logo""" self.write('\n') now = time.strftime(r'%c', time.localtime(time.time())) logo = img(src=rel(self.filename(), 'synopsis.png'), alt='logo') logo = href('http://synopsis.fresco.org', logo + ' synopsis', target='_blank') logo += ' (version %s)'%config.version self.write(div('logo', 'Generated on ' + now + ' by \n
    \n' + logo)) View.end_file(self) synopsis-0.12/Synopsis/Formatters/HTML/Views/NameIndex.py0000664000076400007640000001015311104703264022715 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import config from Synopsis.Processor import Parameter from Synopsis import ASG from Synopsis.Formatters.HTML.View import View from Synopsis.Formatters.HTML.Tags import * import time class NameIndex(View): """Creates an index of all names on one view in alphabetical order.""" columns = Parameter(2, 'the number of columns for the listing') def filename(self): if self.main: return self.directory_layout.index() else: return self.directory_layout.special('NameIndex') def title(self): return 'Name Index' def root(self): return self.filename(), self.title() def process(self): self.start_file() self.write_navigation_bar() self.write(element('h1', 'Name Index')) self.write('Hold the mouse over a link to see the scope of each name\n') dict = self.make_dictionary() keys = dict.keys() keys.sort() linker = lambda key: '
    %s'%(ord(key),key) self.write(div('nameindex-index', ''.join([linker(k) for k in keys])) + '\n') for key in keys: self.write(''%ord(key)+'') self.write(element('h2', key) + '\n') self.write('\n') self.write(''*self.columns + '\n') self.write('\n') items = dict[key] numitems = len(items) start = 0 for column in range(self.columns): end = numitems * (column + 1) / self.columns self.write('\n') start = end self.write('\n
    \n') for item in items[start:end]: self._process_item(item) self.write('
    \n') self.end_file() def make_dictionary(self): """Returns a dictionary of items. The keys of the dictionary are the headings - the first letter of the name. The values are each a sorted list of items with that first letter.""" dict = {} def hasher(type): name = type.name try: key = name[-1][0] except: print 'name:',name, 'type:',repr(type), id(type) raise if key >= 'a' and key <= 'z': key = chr(ord(key) - 32) if dict.has_key(key): dict[key].append(type) else: dict[key] = [type] # Fill the dict [hasher(t) for t in self.processor.ir.asg.types.values() if isinstance(t, ASG.DeclaredTypeId) and not isinstance(t.declaration, ASG.Builtin)] # Now sort the dict def name_cmp(a,b): a, b = a.name, b.name res = cmp(a[-1],b[-1]) if res == 0: res = cmp(a,b) return res for items in dict.values(): items.sort(name_cmp) return dict def _process_item(self, type): """Process the given name for output""" name = type.name decl = type.declaration # non-declared types are filtered out if isinstance(decl, ASG.Function): realname = escape(decl.real_name[-1]) + '()' else: realname = escape(name[-1]) self.write('\n') title = escape(str(name)) type = decl.type name = self.reference(name, (), realname, title=title)+' '+type self.write(div('nameindex-item', name)) def end_file(self): """Overrides end_file to provide synopsis logo""" self.write('\n') now = time.strftime(r'%c', time.localtime(time.time())) logo = img(src=rel(self.filename(), 'synopsis.png'), alt='logo') logo = href('http://synopsis.fresco.org', logo + ' synopsis', target='_blank') logo += ' (version %s)'%config.version self.write(div('logo', 'Generated on ' + now + ' by \n
    \n' + logo)) View.end_file(self) synopsis-0.12/Synopsis/Formatters/HTML/Views/__init__.py0000664000076400007640000000127311104703264022607 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Directory import Directory from Scope import Scope from ModuleListing import ModuleListing from ModuleTree import ModuleTree from ModuleIndex import ModuleIndex from FileListing import FileListing from FileTree import FileTree from FileIndex import FileIndex from FileDetails import FileDetails from InheritanceTree import InheritanceTree from InheritanceGraph import InheritanceGraph from Source import Source from NameIndex import NameIndex from XRef import XRef from RawFile import RawFile synopsis-0.12/Synopsis/Formatters/HTML/Views/FileTree.py0000664000076400007640000000371011104703264022545 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import Parameter from Tree import Tree from Synopsis.Formatters.HTML.Tags import * import os class FileTree(Tree): """Create a javascript-enabled file tree.""" link_to_views = Parameter(False, 'some docs...') def filename(self): if self.main: return self.directory_layout.index() else: return self.directory_layout.special('FileTree') def title(self): return 'File Tree' def root(self): return self.filename(), self.title() def process(self): # Start the file self.start_file() self.write_navigation_bar() # recursively visit all nodes self.process_node(self.processor.file_tree) self.end_tree() self.end_file() def process_node(self, node): def node_cmp(a, b): a_leaf = hasattr(a, 'declarations') b_leaf = hasattr(b, 'declarations') if a_leaf != b_leaf: return cmp(b_leaf, a_leaf) return cmp(a.path[-1].upper(), b.path[-1].upper()) dirname, filename = os.path.split(node.path) if hasattr(node, 'declarations'): # Leaf node text = href(self.directory_layout.file_index(node.path), filename, target='detail') self.write_leaf(text) return # Non-leaf node children = node.children[:] children.sort(node_cmp) if node.path: self.write_node_start(filename + os.sep) if len(children): for child in children: # self.write('
    ') self.process_node(child) # self.write('
    ') if node.path: self.write_node_end() synopsis-0.12/Synopsis/Formatters/HTML/Views/Source.py0000664000076400007640000001235311133252255022312 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import config from Synopsis.Processor import * from Synopsis.QualifiedName import * from Synopsis.Formatters import join_paths from Synopsis.Formatters.HTML.View import View from Synopsis.Formatters.HTML.Tags import * from xml.dom.minidom import parse import os, urllib, time class SXRTranslator: """Read in an sxr file, resolve references, and write it out as part of a Source view.""" def __init__(self, filename, language, debug): try: self.sxr = parse(filename) except: if debug: print 'Error parsing', filename raise else: raise InternalError('parsing %s'%filename) if language == 'Python': self.qname = lambda name: QualifiedPythonName(str(name).split('.')) else: self.qname = lambda name: QualifiedCxxName(str(name).split('::')) def link(self, linker): for a in self.sxr.getElementsByTagName('a'): ref = self.qname(a.getAttribute('href')) target = linker(ref) a.setAttribute('href', target) if a.hasAttribute('type'): a.removeAttribute('type') if a.hasAttribute('from'): a.removeAttribute('from') if a.hasAttribute('continuation'): a.removeAttribute('continuation') def translate(self, writer): writer.write('
    ')
            lines = self.sxr.getElementsByTagName('line')
            lineno_template = '%%%ds' % len(`len(lines)`)
            for lineno, line in enumerate(lines):
                writer.write(''%(lineno + 1))
                text = lineno_template % (lineno + 1)
                writer.write('%s'%text)
                text = ''.join([n.toxml() for n in line.childNodes])
                if text:
                    writer.write('%s\n'%text)
                else:
                    writer.write('\n')
            writer.write('
    ') class Source(View): """A module for creating a view for each file with hyperlinked source""" external_url = Parameter(None, 'base url to use for external links (if None the toc will be used') def register(self, frame): super(Source, self).register(frame) self.icons = {} if self.processor.sxr_prefix: share = config.datadir self.icons['C'] = 'src-c.png' self.icons['C++'] = 'src-c++.png' self.icons['Python'] = 'src-py.png' for l in self.icons: src = os.path.join(share, self.icons[l]) self.directory_layout.copy_file(src, self.icons[l]) def filename(self): return self.__filename def title(self): return self.__title def process(self): """Creates a view for every file""" self.prefix = self.processor.sxr_prefix if self.prefix is None: return # Get the TOC self.__toc = self.processor.toc # create a view for each primary file for file in self.processor.ir.files.values(): if file.annotations['primary']: self.process_node(file) def register_filenames(self): """Registers a view for every source file""" if self.processor.sxr_prefix is None: return for file in self.processor.ir.files.values(): if file.annotations['primary']: filename = file.name filename = self.directory_layout.file_source(filename) self.processor.register_filename(filename, self, file) def process_node(self, file): """Creates a view for the given file""" # Start view filename = file.name self.__filename = self.directory_layout.file_source(filename) self.rel_url = rel(self.filename(), '') source = file.name self.__title = source self.start_file() self.write_navigation_bar() self.write('File: '+element('b', self.__title)) sxr = join_paths(self.prefix, source + '.sxr') if os.path.exists(sxr): translator = SXRTranslator(sxr, file.annotations['language'], self.processor.debug) linker = self.external_url and self.external_ref or self.lookup_symbol translator.link(linker) translator.translate(self) self.end_file() def lookup_symbol(self, name): e = self.__toc.lookup(name) return e and self.rel_url + e.link or '' def external_ref(self, name): return self.external_url + urllib.quote(str(name)) def end_file(self): """Overrides end_file to provide synopsis logo""" self.write('\n') now = time.strftime(r'%c', time.localtime(time.time())) logo = img(src=rel(self.filename(), 'synopsis.png'), alt='logo') logo = href('http://synopsis.fresco.org', logo + ' synopsis', target='_blank') logo += ' (version %s)'%config.version self.write(div('logo', 'Generated on ' + now + ' by \n
    \n' + logo)) View.end_file(self) synopsis-0.12/Synopsis/Formatters/HTML/Views/Directory.py0000664000076400007640000001455511104703264023023 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import config from Synopsis.Processor import Parameter from Synopsis.Formatters.HTML.View import View from Synopsis.Formatters.HTML.Tags import * import os, stat, os.path, time, re def compile_glob(globstr): """Returns a compiled regular expression for the given glob string. A glob string is something like "*.?pp" which gets translated into "^.*\..pp$".""" glob = globstr.replace('.', '\.') glob = glob.replace('?', '.') glob = glob.replace('*', '.*') glob = re.compile('^%s$'%glob) return glob class Directory(View): """A view that lists the content of a directory.""" src_dir = Parameter('', 'starting point for directory listing') base_path = Parameter('', 'path prefix to strip off of the file names') exclude = Parameter([], 'TODO: define an exclusion mechanism (glob based ?)') def filename(self): return self.__filename def title(self): return 'Directory Listing' def root(self): if self.main: url = self.directory_layout.index() else: url = self.directory_layout.special('dir') return url, self.title() def filename_for_dir(self, dir): """Returns the output filename for the given input directory.""" if dir == self.src_dir: return self.root()[0] else: scope = rel(self.src_dir, dir).split(os.sep) return self.directory_layout.scoped_special('dir', scope) def register(self, frame): View.register(self, frame) self._exclude = [compile_glob(e) for e in self.exclude] self.__filename = self.root()[0] def register_filenames(self): dirs = [self.src_dir] while dirs: dir = dirs.pop(0) for entry in os.listdir(os.path.abspath(dir)): exclude = 0 for re in self._exclude: if re.match(entry): exclude = 1 break if exclude: continue entry_path = os.path.join(dir, entry) if os.path.isdir(entry_path): filename = self.filename_for_dir(dir) self.processor.register_filename(filename, self, entry_path) dirs.append(entry_path) def process(self): self.process_dir(self.src_dir) def process_dir(self, path): # Find the filename self.__filename = self.filename_for_dir(path) # Start the file self.start_file() self.write_navigation_bar() # Write intro stuff root = '' if self.base_path != self.src_dir: rel(self.base_path, self.src_dir) if not len(root) or root[-1] != '/': root = root + '/' if path is self.src_dir: self.write('

    '+root) else: self.write('

    ' + href(self.root()[0], root + ' ')) dirscope = [] scope = rel(self.src_dir, path).split(os.sep) for dir in scope[:-1]: dirscope.append(dir) dirlink = self.directory_layout.scoped_special('dir', dirscope) dirlink = rel(self.filename(), dirlink) self.write(href(dirlink, dir+'/ ')) if len(scope) > 0: self.write(scope[-1]+'/') self.write(' - Directory listing

    ') # Start the table self.write('\n') self.write('') self.write('') self.write('\n') # List all files in the directory entries = os.listdir(os.path.abspath(path)) entries.sort() files = [] dirs = [] for entry in entries: exclude = 0 for re in self._exclude: if re.match(entry): exclude = 1 break if exclude: continue entry_path = os.path.join(path, entry) info = os.stat(entry_path) if stat.S_ISDIR(info[stat.ST_MODE]): # A directory, process now scope = rel(self.src_dir, entry_path).split(os.sep) linkpath = self.directory_layout.scoped_special('dir', scope) linkpath = rel(self.filename(), linkpath) self.write('\n'%( href(linkpath, entry+'/'), time.asctime(time.gmtime(info[stat.ST_MTIME])))) dirs.append(entry_path) else: files.append((entry_path, entry, info)) for path, entry, info in files: size = info[stat.ST_SIZE] timestr = time.asctime(time.gmtime(info[stat.ST_MTIME])) # strip of base_path path = path[len(self.base_path):] if path[0] == '/': path = path[1:] linkpath = self.directory_layout.file_source(path) rego = self.processor.filename_info(linkpath) if rego: linkurl = rel(self.filename(), linkpath) self.write('\n'%( href(linkurl, entry, target='content'), size, timestr)) else: # print "No link for",linkpath self.write('\n'%( entry, size, timestr)) # End the table and file self.write('
    NameSize (bytes)Last modified (GMT)
    %s%s
    %s%d%s
    %s%d%s
    ') self.end_file() # recursively create all child directory views for dir in dirs: self.process_dir(dir) def end_file(self): """Overrides end_file to provide synopsis logo""" self.write('\n') now = time.strftime(r'%c', time.localtime(time.time())) logo = img(src=rel(self.filename(), 'synopsis.png'), alt='logo') logo = href('http://synopsis.fresco.org', logo + ' synopsis', target='_blank') logo += ' (version %s)'%config.version self.write(div('logo', 'Generated on ' + now + ' by \n
    \n' + logo)) View.end_file(self) synopsis-0.12/Synopsis/Formatters/HTML/Views/InheritanceTree.py0000664000076400007640000000303511104703264024117 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import Parameter from Synopsis.Formatters.HTML.View import View from Synopsis.Formatters.HTML.Tags import * class InheritanceTree(View): def filename(self): if self.main: return self.directory_layout.index() else: return self.directory_layout.special('InheritanceTree') def title(self): return 'Inheritance Tree' def root(self): return self.filename(), self.title() def process(self): self.start_file() self.write_navigation_bar() self.write(element('h1', 'Inheritance Tree')) self.write('
      ') module = self.processor.root for r in self.processor.class_tree.roots(): self.process_inheritance(r, module.name) self.write('
    ') self.end_file() def process_inheritance(self, name, rel_name): self.write('
  • ') self.write(self.reference(name, rel_name)) parents = self.processor.class_tree.superclasses(name) if parents: self.write(' (%s)'%', '.join([str(p) for p in parents])) subs = self.processor.class_tree.subclasses(name) if subs: self.write('
      ') for s in subs: self.process_inheritance(s, name) self.write('
    \n') self.write('
  • ') synopsis-0.12/Synopsis/Formatters/HTML/Views/FileListing.py0000664000076400007640000000524211104703264023261 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import Parameter from Synopsis import FileTree from Synopsis.Formatters.HTML.View import View from Synopsis.Formatters.HTML.Tags import * import os class FileListing(View): """A view that creates an index of files, and an index for each file. First the index of files is created, intended for the top-left frame. Second a view is created for each file, listing the major declarations for that file, eg: classes, global functions, namespaces, etc.""" def filename(self): if self.main: return self.directory_layout.index() else: return self.directory_layout.special('FileListing') def title(self): return 'Files' def root(self): return self.filename(), self.title() def register_filenames(self): """Registers a view for each file indexed.""" self.processor.register_filename(self.filename(), self, None) def process(self): """Creates the listing using the recursive process_file_tree_node method""" # Start the file self.start_file() self.write_navigation_bar() self.write('
      ') # recursively visit all nodes self.process_file_tree_node(self.processor.file_tree.root()) self.write('
    ') self.end_file() def _node_sorter(self, a, b): """Compares file nodes a and b depending on whether they are leaves or not""" a_leaf = isinstance(a, FileTree.File) b_leaf = isinstance(b, FileTree.File) if a_leaf != b_leaf: return cmp(b_leaf, a_leaf) return cmp(a.path.upper(), b.path.upper()) def process_file_tree_node(self, node): """Creates a portion of the tree for the given file node. This method assumes that the file is already in progress, and just appends to it. This method is recursive, calling itself for each child of node (file or directory).""" if isinstance(node, FileTree.File): # Leaf node ref = rel(self.filename(), self.directory_layout.file_index(node.path)) text = href(ref, node.filename, target='detail') self.write('
  • %s
  • '%text) return # Non-leaf node children = node.children children.sort(self._node_sorter) if len(node.path): self.write('
  • %s
      '%node.filename+os.sep) if len(children): for child in children: self.process_file_tree_node(child) if len(node.path): self.write('
  • ') synopsis-0.12/Synopsis/Formatters/HTML/Views/RawFile.py0000664000076400007640000000650011104703264022377 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import Parameter from Synopsis.Formatters.HTML.View import View from Synopsis.Formatters.HTML.Tags import * from Directory import compile_glob import time, os, stat, os.path class RawFile(View): """A module for creating a view for each file with hyperlinked source""" src_dir = Parameter('', 'starting point for directory listing') base_path = Parameter('', 'path prefix to strip off of the file names') exclude = Parameter([], 'TODO: define an exclusion mechanism (glob based ?)') def register(self, frame): super(RawFile, self).register(frame) self._exclude = [compile_glob(e) for e in self.exclude] self.__files = None def filename(self): return self.__filename def title(self): return self.__title def _get_files(self): """Returns a list of (path, output_filename) for each file.""" if self.__files is not None: return self.__files self.__files = [] dirs = [self.src_dir] while dirs: dir = dirs.pop(0) for entry in os.listdir(os.path.abspath(dir)): exclude = 0 for re in self._exclude: if re.match(entry): exclude = 1 break if exclude: continue entry_path = os.path.join(dir, entry) info = os.stat(entry_path) if stat.S_ISDIR(info[stat.ST_MODE]): dirs.append(entry_path) else: # strip of base_path path = entry_path[len(self.base_path):] if path[0] == '/': path = path[1:] filename = self.directory_layout.file_source(path) self.__files.append((entry_path, filename)) return self.__files def process(self): """Creates a view for every file.""" for path, filename in self._get_files(): self.process_file(path, filename) def register_filenames(self): for path, filename in self._get_files(): self.processor.register_filename(filename, self, path) def process_file(self, original, filename): """Creates a view for the given filename.""" # Check that we got the rego reg_view, reg_scope = self.processor.filename_info(filename) if reg_view is not self: return self.__filename = filename self.__title = original[len(self.base_path):] self.start_file() self.write_navigation_bar() self.write('File: '+element('b', self.__title)) try: lines = open(original, 'rt').readlines() lineno_template = '%%%ds' % len(`len(lines)`) lines = ['%s%s\n' %(lineno_template % (i + 1), escape(l[:-1])) for i, l in enumerate(lines)] self.write('
    ')
                self.write(''.join(lines))
                self.write('
    ') except: self.write('An error occurred') self.end_file() synopsis-0.12/Synopsis/Formatters/HTML/Views/ModuleTree.py0000664000076400007640000000430711104703264023116 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import ASG from Synopsis.Formatters.HTML.Tags import * from Tree import Tree class ModuleTree(Tree): """Create a javascript-enabled module tree.""" def register(self, frame): super(ModuleTree, self).register(frame) self._children_cache = {} def filename(self): if self.main: return self.directory_layout.index() else: return self.directory_layout.special('ModuleTree') def title(self): return 'Module Tree' def root(self): return self.filename(), self.title() def process(self): self.start_file() self.write_navigation_bar() module = self.processor.root self.index_module(module, module.name) self.end_tree() self.end_file() def _link_href(self, module): return self.directory_layout.module_index(module.name) def get_children(self, decl): try: return self._children_cache[decl] except KeyError: pass children = [c for c in decl.declarations if isinstance(c, ASG.Module)] self._children_cache[decl] = children return children def index_module(self, module, qname): """Write a link for this module and recursively visit child modules.""" # Find children, and sort so that compound children (packages) go first children = self.get_children(module) children.sort(lambda a,b,g=self.get_children: cmp(len(g(b)),len(g(a)))) # Print link to this module if module.name: label = str(qname.prune(module.name)) else: label = 'Global %s'%module.type.capitalize() link = self._link_href(module) text = href(link, label, target='detail') if not len(children): self.write_leaf(text) else: self.write_node_start(text) # Add children for child in children: self.index_module(child, module.name) self.write_node_end() synopsis-0.12/Synopsis/Formatters/HTML/Views/FileDetails.py0000664000076400007640000001251411171712174023241 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import Parameter from Synopsis import ASG from Synopsis.Formatters.HTML.View import View from Synopsis.Formatters.HTML.Tags import * from Source import * import os class FileDetails(View): """A view that creates an index of files, and an index for each file. First the index of files is created, intended for the top-left frame. Second a view is created for each file, listing the major declarations for that file, eg: classes, global functions, namespaces, etc.""" def register(self, frame): super(FileDetails, self).register(frame) self.__filename = '' self.__title = '' self.link_source = self.processor.has_view('Source') and self.processor.sxr_prefix def filename(self): """since FileTree generates a whole file hierarchy, this method returns the current filename, which may change over the lifetime of this object""" return self.__filename def title(self): """since FileTree generates a while file hierarchy, this method returns the current title, which may change over the lifetime of this object""" return self.__title def register_filenames(self): """Registers a view for each file indexed.""" for filename, file in self.processor.ir.files.items(): if file.annotations['primary']: filename = self.directory_layout.file_details(filename) self.processor.register_filename(filename, self, file) def process(self): """Creates a view for each known source file.""" for filename, file in self.processor.ir.files.items(): if file.annotations['primary']: self.process_file(filename, file) def process_file(self, filename, file): """Creates a view for the given file. The view is just an index, containing a list of declarations.""" # set up filename and title for the current view self.__filename = self.directory_layout.file_details(filename) # (get rid of ../'s in the filename) name = filename.split(os.sep) while len(name) and name[0] == '..': del name[0] self.__title = os.sep.join(name)+' Details' self.start_file() self.write_navigation_bar() self.write(element('h1', os.sep.join(name))) if self.link_source: link = rel(self.filename(), self.directory_layout.file_source(filename)) self.write(div('', href(link, 'source code', target='content')) + '\n') # Print list of includes try: # Only show files from the project includes = [i for i in file.includes if i.target.annotations['primary']] self.write('

    Includes from this file:

    ') if not includes: self.write('

    No includes.

    \n') else: self.write('
      \n') for include in includes: target_filename = include.target.name if include.is_next: idesc = 'include_next ' else: idesc = 'include ' if include.is_macro: idesc = idesc + 'from macro ' link = rel(self.filename(), self.directory_layout.file_details(target_filename)) self.write('
    • ' + idesc + href(link, target_filename)+'
    • \n') self.write('
    \n') except: pass self.write('

    Declarations in this file:

    \n') # Sort items (by name) items = [(d.type, d.name, d) for d in file.declarations # We don't want to list (function, template) parameters, and neither 'this'. if type(d) is not ASG.Parameter and d.type not in ('this', 'parameter', 'local variable')] # ignore ASG.Builtin items = [i for i in items if not isinstance(i[2], ASG.Builtin)] items.sort() curr_scope = None curr_type = None for decl_type, name, decl in items: # Check scope and type to see if they've changed since the last # declaration, thereby forming sections of scope and type decl_scope = name[:-1] if decl_scope != curr_scope or decl_type != curr_type: if curr_scope is not None: self.write('\n\n') curr_scope = decl_scope curr_type = decl_type if len(curr_type) and curr_type[-1] == 's': plural = 'es' else: plural = 's' if len(curr_scope): self.write('

    %s%s in %s

    \n'%( curr_type.capitalize(), plural, escape(str(curr_scope)))) else: self.write('

    %s%s

    \n'%(curr_type.capitalize(),plural)) # Format this declaration entry = self.processor.toc[name] label = escape(str(curr_scope.prune(name))) label = replace_spaces(label) if entry: link = rel(self.filename(), entry.link) item = href(link, label) else: item = label doc = div('doc', self.processor.documentation.summary(decl, self)) self.write(div('item', item + '\n' + doc) + '\n') # Close open div if curr_scope is not None: self.write('
    \n') self.end_file() synopsis-0.12/Synopsis/Formatters/HTML/Views/Tree.py0000664000076400007640000000576011104703264021754 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import config from Synopsis.Processor import Parameter from Synopsis.Formatters.HTML.View import View from Synopsis.Formatters.HTML.Tags import * import os class Tree(View): """View that makes Javascript trees. The trees have expanding and collapsing nodes. call js_init() with the button images and default open/close policy during process""" def register(self, frame): super(Tree, self).register(frame) self.__id = 0 share = config.datadir open_img = os.path.join(share, 'syn-down.png') close_img = os.path.join(share, 'syn-right.png') leaf_img = os.path.join(share, 'syn-dot.png') js = os.path.join(share, 'html.js') self.tree_open = 'tree_open.png' self.tree_close = 'tree_close.png' self.tree_leaf = 'tree_leaf.png' # Copy resources across self.directory_layout.copy_file(open_img, self.tree_open) self.directory_layout.copy_file(open_img, self.tree_open) self.directory_layout.copy_file(close_img, self.tree_close) self.directory_layout.copy_file(leaf_img, self.tree_leaf) self.directory_layout.copy_file(js, 'synopsis.js') def get_id(self): self.__id += 1 return 'tree%d'%self.__id def start_file(self): js = '' View.start_file(self, headextra=js) def write_leaf(self, text): """Write a leaf node to the output at the current tree level.""" i = img(src=self.tree_leaf, alt='leaf') self.write(div('module-section', i + text) + '\n') def write_node_start(self, text): """Write a non-leaf node to the output at the current tree level, and start a new level.""" # Get a unique id for this node id = self.get_id() # Get the image for this node node = img(id='%s_img'%id, src=self.tree_close, alt='node', border='0') # Get the scripted link for the image link = href("javascript:toggle('%s');"%id, node) # Write the item self.write('
    %s%s'%(link, text)) # Start the (collapsible) section for the child nodes self.write('\n
    \n') def end_tree(self): """Writes the end of the tree.""" js_end = """""" self.write(js_end%self.__id) self.write(div('tree-navigation', href('javascript:open_all()', 'Open All') + href('javascript:close_all()', 'Close All'))) synopsis-0.12/Synopsis/Formatters/HTML/Views/FileIndex.py0000664000076400007640000001077311104703264022724 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import Parameter from Synopsis import ASG from Synopsis.QualifiedName import * from Synopsis.Formatters.HTML.View import View from Synopsis.Formatters.HTML.Tags import * import os class FileIndex(View): """A view that creates an index of files, and an index for each file. First the index of files is created, intended for the top-left frame. Second a view is created for each file, listing the major declarations for that file, eg: classes, global functions, namespaces, etc.""" def register(self, frame): super(FileIndex, self).register(frame) self.__filename = '' self.__title = '' self.link_source = self.processor.has_view('Source') and self.processor.sxr_prefix self.link_details = self.processor.has_view('FileDetails') def filename(self): """since FileTree generates a whole file hierarchy, this method returns the current filename, which may change over the lifetime of this object""" return self.__filename def title(self): """since FileTree generates a while file hierarchy, this method returns the current title, which may change over the lifetime of this object""" return self.__title def register_filenames(self): """Registers a view for each file indexed.""" for filename, file in self.processor.ir.files.items(): if file.annotations['primary']: filename = self.directory_layout.file_index(filename) self.processor.register_filename(filename, self, file) def process(self): """Creates a view for each known file.""" for filename, file in self.processor.ir.files.items(): if file.annotations['primary']: self.process_file(filename, file) def process_file(self, filename, file): """Creates a view for the given file. The view is just an index, containing a list of declarations.""" # set up filename and title for the current view self.__filename = self.directory_layout.file_index(filename) # (get rid of ../'s in the filename) name = filename.split(os.sep) while len(name) and name[0] == '..': del name[0] self.__title = os.sep.join(name) self.start_file() self.write(element('b', os.sep.join(name))+'\n') if self.link_source: link = rel(self.filename(), self.directory_layout.file_source(filename)) self.write(div('', href(link, 'source code', target='content')) + '\n') if self.link_details: link = rel(self.filename(), self.directory_layout.file_details(filename)) self.write(div('', href(link, 'details', target='content')) + '\n') self.write(div('heading', 'Declarations') + '\n') # Sort items (by name) items = [(d.name, d) for d in file.declarations] items.sort() if file.annotations.get('language') == 'Python': scope = QualifiedPythonName() else: scope = QualifiedCxxName() last = scope for name, decl in items: entry = self.processor.toc[name] if not entry: continue # Print link to declaration's view link = rel(self.filename(), entry.link) label = isinstance(decl, ASG.Function) and decl.real_name or decl.name i = 0 while i < len(label) - 1 and i < len(scope) and label[i] == scope[i]: i += 1 self.write('
    ' * (len(scope) - i)) scope = scope[:i] while i < len(label) - 1: scope = scope + (label[i],) if len(last) >= len(scope) and last[:len(scope)] == scope: div_bit = '' else: div_bit = label[i]+'
    \n' self.write('%s
    '%div_bit) i += 1 # Now print the actual item label = replace_spaces(escape(str(scope.prune(label)))) title = '(%s)'%decl.type self.write(div('href',href(link, label, target='content', title=title))) # Store this name in case, f.ex, it's a class and the next item is # in that class scope last = name self.write('
    \n' * len(scope)) self.end_file() synopsis-0.12/Synopsis/Formatters/HTML/Views/ModuleListing.py0000664000076400007640000000517111104703264023630 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import Parameter from Synopsis import ASG from Synopsis.Formatters.HTML.View import View from Synopsis.Formatters.HTML.Tags import * class ModuleListing(View): """Create an index of all modules.""" short_title = Parameter('Modules', 'short title') child_types = Parameter(None, 'the types of children to include') def register(self, frame): super(ModuleListing, self).register(frame) self._children_cache = {} def filename(self): return self.directory_layout.special('ModuleListing') def title(self): return self.short_title def root(self): return self.filename(), self.title() def process(self): """Create a view with an index of all modules.""" # Create the file self.start_file() self.write_navigation_bar() self.write('
      ') # FIXME: see HTML.Formatter module = self.processor.ir.asg.declarations[0] self.index_module(module, module.name) self.write('
    ') self.end_file() def _link_href(self, module): """Returns the link to the given declaration""" return rel(self.filename(), self.directory_layout.module_index(module.name)) def get_children(self, decl): """Returns the children of the given declaration""" try: return self._children_cache[decl] except KeyError: pass children = [c for c in decl.declarations if isinstance(c, ASG.Module) and (not self.child_types or child.type in self.child_types)] self._children_cache[decl] = children return children def index_module(self, module, rel_scope): "Write a link for this module and recursively visit child modules." my_scope = module.name # Find children, and sort so that compound children (packages) go first children = self.get_children(module) children.sort(lambda a,b,g=self.get_children: cmp(len(g(b)),len(g(a)))) # Print link to this module name = str(rel_scope.prune(my_scope)) or 'Global %s'%module.type.capitalize() link = self._link_href(module) text = href(link, name, target='detail') if not len(children): self.write('
  • %s
  • '%text) else: self.write('
  • %s
      '%text) # Add children for child in children: self.index_module(child, my_scope) self.write('
  • ') synopsis-0.12/Synopsis/Formatters/HTML/Views/XRef.py0000664000076400007640000001512711104703264021717 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import config from Synopsis.Processor import Parameter from Synopsis import ASG from Synopsis.Formatters.TOC import TOC, Linker from Synopsis.Formatters.HTML.View import View from Synopsis.Formatters.HTML.Tags import * import os, time class XRef(View): """A module for creating views full of xref infos""" link_to_scope = Parameter(True, '') def register(self, frame): super(XRef, self).register(frame) self.__filename = None self.__title = None self.__toc = TOC(None) if self.processor.sxr_prefix is None: return self.icon = 'xref.png' share = config.datadir src = os.path.join(share, 'xref.png') self.directory_layout.copy_file(src, self.icon) # Add an entry for every xref for name in self.processor.ir.sxr.keys(): page = self.processor.xref.get(name) file = self.directory_layout.special('xref%d'%page) file += '#' + quote_as_id(str(name)) self.__toc.insert(TOC.Entry(name, file, 'C++', 'xref')) def toc(self, start): return self.__toc def filename(self): return self.__filename def title(self): return self.__title def process(self): if self.processor.sxr_prefix is None: return pages = self.processor.xref.pages() if not pages: return for p in range(len(pages)): self.__filename = self.directory_layout.xref(p) first, last = pages[p][0], pages[p][-1] self.__title = 'Cross Reference : %s - %s'%(escape(str(first)), escape(str(last))) self.start_file() self.write_navigation_bar() self.write(element('h1', self.title())) for name in pages[p]: self.write('
    ') self.process_name(name) self.write('
    ') self.end_file() def register_filenames(self): """Registers each view""" if self.processor.sxr_prefix is None: return pages = self.processor.xref.pages() if not pages: return for p in range(len(pages)): filename = self.directory_layout.special('xref%d'%p) self.processor.register_filename(filename, self, p) def process_link(self, file, line, scope): """Outputs the info for one link""" file_link = self.directory_layout.file_source(file) file_link = rel(self.filename(), file_link) + "#%d"%line desc = '' type = self.processor.ir.asg.types.get(scope) if isinstance(type, ASG.DeclaredTypeId): desc = ' ' + type.declaration.type entry = self.processor.toc[scope] if entry: label = href(rel(self.filename(), entry.link), escape(str(scope))) else: label = escape(str(scope)) self.write('
  • %s:%s: in%s %s
  • \n'%( file_link, file, line, desc, label)) def describe_declaration(self, decl): """Returns a description of the declaration. Detects constructors and destructors""" name = decl.name if isinstance(decl, ASG.Function) and len(name) > 1: real = decl.real_name[-1] if name[-2] == real: return 'Constructor ' elif real[0] == '~' and name[-2] == real[1:]: return 'Destructor ' return decl.type.capitalize() + ' ' def process_name(self, name): """Outputs the info for a given name""" entry = self.processor.ir.sxr.get(name) if not entry: return self.write(element('a', '', id=quote_as_id(str(name)))) desc = '' decl = None type = self.processor.ir.asg.types.get(name) if isinstance(type, ASG.DeclaredTypeId): decl = type.declaration desc = self.describe_declaration(decl) self.write(element('h2', desc + escape(str(name))) + '
      \n') if self.link_to_scope: type = self.processor.ir.asg.types.get(name, None) if isinstance(type, ASG.DeclaredTypeId): link = self.directory_layout.link(type.declaration) self.write('
    • '+href(rel(self.__filename, link), 'Documentation')+'
    • ') if entry.definitions: self.write('
    • Defined at:\n
        \n') for file, line, scope in entry.definitions: self.process_link(file, line, scope) self.write('
    • \n') if entry.calls: self.write('
    • Called from:\n
        \n') for file, line, scope in entry.calls: self.process_link(file, line, scope) self.write('
    • \n') if entry.references: self.write('
    • Referenced from:\n
        \n') for file, line, scope in entry.references: self.process_link(file, line, scope) self.write('
    • \n') if isinstance(decl, ASG.Scope) and decl.declarations: self.write('
    • Declarations:\n
        \n') for child in decl.declarations: if isinstance(child, ASG.Builtin) and child.type == 'EOS': continue file, line = child.file.name, child.line file_link = self.directory_layout.file_source(file) file_link = rel(self.filename(),file_link) + '#%d'%line file_href = '%s:%s: '%(file_link,file,line) cname = child.name entry = self.processor.toc[cname] type = self.describe_declaration(child) if entry: link = href(rel(self.filename(), entry.link), escape(str(name.prune(cname)))) self.write(element('li', file_href + type + link)) else: self.write(element('li', file_href + type + str(name.prune(cname)))) self.write('
      \n
    • \n') self.write('
    \n') def end_file(self): """Overrides end_file to provide synopsis logo""" self.write('\n') now = time.strftime(r'%c', time.localtime(time.time())) logo = img(src=rel(self.filename(), 'synopsis.png'), alt='logo') logo = href('http://synopsis.fresco.org', logo + ' synopsis', target='_blank') logo += ' (version %s)'%config.version self.write(div('logo', 'Generated on ' + now + ' by \n
    \n' + logo)) View.end_file(self) synopsis-0.12/Synopsis/Formatters/HTML/Views/InheritanceGraph.py0000664000076400007640000001421711104703264024265 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import * from Synopsis import IR, ASG from Synopsis.Formatters.HTML.View import View from Synopsis.Formatters.HTML.Tags import * import os class DeclarationFinder(ASG.Visitor): def __init__(self, types, verbose): self.types = types self.verbose = verbose def __call__(self, name): try: typeobj = self.types[name] except KeyError: # Eg: Unknown parent which has been NameMapped if self.verbose: print "Warning: %s not found in type dict."%(name,) return None self.__decl = None typeobj.accept(self) #if self.__decl is None: # return None return self.__decl def visit_buitin_type_id(self, type): return def visit_unknown_type_id(self, type): return def visit_declared_type_id(self, type): self.__decl = type.declaration def visit_modifier_type_id(self, type): type.alias.accept(self) def visit_array_type_id(self, type): type.alias.accept(self) def visit_template_id(self, type): self.__decl = type.declaration def visit_parametrized_type_id(self, type): type.template.accept(self) def visit_function_type_id(self, type): return def find_common_name(graph): common_name = list(graph[0]) for decl_name in graph[1:]: if len(common_name) > len(decl_name): common_name = common_name[:len(decl_name)] for i in range(min(len(decl_name), len(common_name))): if decl_name[i] != common_name[i]: common_name = common_name[:i] break return '::'.join(common_name) class InheritanceGraph(View): min_size = Parameter(2, 'minimum number of nodes for a graph to be displayed') min_group_size = Parameter(5, 'how many nodes to put into a group') direction = Parameter('vertical', 'layout of the graph') def register(self, frame): super(InheritanceGraph, self).register(frame) self.decl_finder = DeclarationFinder(self.processor.ir.asg.types, self.processor.verbose) def filename(self): if self.main: return self.directory_layout.index() else: return self.directory_layout.special('InheritanceGraph') def title(self): return 'Inheritance Graph' def root(self): return self.filename(), self.title() def consolidate(self, graphs): """Consolidates small graphs into larger ones""" # Weed out the small graphs and group by common base name common = {} for graph in graphs: len_graph = len(graph) if len_graph < self.min_size: # Ignore the graph continue common.setdefault(find_common_name(graph), []).append(graph) # Consolidate each group for name, graphs in common.items(): conned = [] pending = [] for graph in graphs: # Try adding to an already pending graph for pend in pending: if len_graph + len(pend) <= self.min_group_size: pend.extend(graph) graph = None if len(pend) == self.min_group_size: conned.append(pend) pending.remove(pend) break if graph: if len_graph >= self.min_group_size: # Add to final list conned.append(graph) else: # Add to pending list pending.append(graph) graphs[:] = conned + pending return common def process(self): """Creates a file with the inheritance graph""" filename = self.filename() self.start_file() self.write_navigation_bar() self.write(element('h1', "Inheritance Graph")) from Synopsis.Formatters import Dot # Create a toc file for Dot to use toc_file = filename + "-dot.toc" self.processor.toc.store(toc_file) graphs = self.processor.class_tree.graphs() count = 0 # Consolidate the graphs, and sort to make the largest appear first lensorter = lambda a, b: cmp(len(b),len(a)) common_graphs = self.consolidate(graphs) names = common_graphs.keys() names.sort() for name in names: graphs = common_graphs[name] graphs.sort(lensorter) if name: self.write('
    ') type_str = '' types = self.processor.ir.asg.types type = types.get(name, None) if isinstance(type, ASG.DeclaredTypeId): type_str = type.declaration.type + ' ' self.write('Graphs in '+type_str+name+':
    ') for graph in graphs: if self.processor.verbose: print "Creating graph #%s - %s classes"%(count,len(graph)) # Find declarations declarations = map(self.decl_finder, graph) declarations = filter(lambda x: x is not None, declarations) #output = os.path.join(self.processor.output, 'InheritanceGraph', str(count)) output = os.path.join(self.processor.output, os.path.splitext(self.filename())[0]) + '-%s'%count dot = Dot.Formatter(bgcolor=self.processor.graph_color) ir = IR.IR(files={}, asg=ASG.ASG(declarations, self.processor.ir.asg.types)) try: dot.process(ir, output=output, format='html', toc_in=[toc_file], base_url=self.filename(), title='Synopsis %s'%count, layout=self.direction) dot_file = open(output + '.html', 'r') self.write(dot_file.read()) dot_file.close() os.remove(output + ".html") except InvalidCommand, e: print 'Warning : %s'%str(e) count = count + 1 if name: self.write('
    ') os.remove(toc_file) self.end_file() synopsis-0.12/Synopsis/Formatters/HTML/Views/ModuleIndex.py0000664000076400007640000001005211104703265023261 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Processor import Parameter from Synopsis import ASG from Synopsis.Formatters.HTML.View import View from Synopsis.Formatters.HTML.Tags import * class ModuleIndex(View): """A module for indexing ASG.Modules. Each module gets its own view with a list of nested scope declarations with documentation. It is intended to go in the left frame...""" def register(self, frame): super(ModuleIndex, self).register(frame) self.__filename = self.directory_layout.module_index(self.processor.root.name) self.__title = 'Global %s Index'%self.processor.root.type.capitalize() def filename(self): return self.__filename def title(self): return self.__title def process(self): self.module_queue = [self.processor.root] while self.module_queue: m = self.module_queue.pop(0) self.process_module_index(m) def make_view_heading(self, module): """Creates a HTML fragment which becomes the name at the top of the index view. This may be overridden, but the default is (now) to make a linked fully scoped name, where each scope has a link to the relevant index.""" name = module.name if not name: return 'Global Index' links = [] for depth in range(0, len(name)): url = self.directory_layout.module_index(name[:depth+1]) label = escape(name[depth]) links.append(href(rel(self.__filename, url), label)) return element('b', name.sep.join(links) + ' Index') def process_module_index(self, module): "Index one module" sorter = self.processor.sorter.clone(module.declarations) self.__filename = self.directory_layout.module_index(module.name) self.__title = str(module.name) or 'Global Module' self.__title = self.__title + ' Index' # Create file self.start_file() #target = rel(self.__filename, self.directory_layout.scope(module.name)) #link = href(target, self.__title, target='content') self.write(self.make_view_heading(module)) toc = self.processor.toc # Make script to switch main frame upon load load_script = '' self.write(element('script', load_script, type='text/javascript')) # Loop throught all the types of children for section in sorter: heading = '
    \n'+element('i', escape(section))+'
    \n' # Get a list of children of this type for child in sorter[section]: # Print out summary for the child if not isinstance(child, ASG.Scope): continue if heading: self.write(heading) heading = None label = str(module.name.prune(child.name)) label = escape(label) label = replace_spaces(label) if isinstance(child, ASG.Module): index_url = rel(self.__filename, self.directory_layout.module_index(child.name)) self.write(href(index_url, label, target='detail')) else: entry = toc[child.name] if entry: url = rel(self.__filename, entry.link) self.write(href(url, label, target='content')) else: self.write(label) self.write('
    \n') self.end_file() children = [c for c in module.declarations if isinstance(c, ASG.Module)] self.module_queue.extend(children) synopsis-0.12/Synopsis/Formatters/HTML/Part.py0000664000076400007640000002526111170473327020673 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # """ASG Formatting classes. This module contains classes for formatting parts of a scope view (class, module, etc with methods, variables etc. The actual formatting of the declarations is delegated to multiple strategies for each part of the view, and are defined in the FormatStrategy module. """ from Synopsis.Processor import Parametrized, Parameter from Synopsis import ASG from Fragment import Fragment import Tags # need both because otherwise 'Tags.name' would be ambiguous from Tags import * class Part(Parametrized, ASG.Visitor): """Base class for formatting a Part of a Scope View. This class contains functionality for modularly formatting an ASG node and its children for display. It is typically used to construct Heading, Summary and Detail formatters. Strategy objects are added according to configuration, and this base class then checks which format methods each strategy implements. For each ASG declaration visited, the Part asks all Strategies which implement the appropriate format method to generate output for that declaration. The final writing of the formatted html is delegated to the write_section_start, write_section_end, and write_section_item methods, which must be implemented in a subclass. """ fragments = Parameter([], "list of Fragments") def register(self, view): self.processor = view.processor self.__view = view self.__fragments = [] self.__id_holder = None # Lists of format methods for each ASG type self.__formatdict = {'format_declaration':[], 'format_macro':[], 'format_forward':[], 'format_group':[], 'format_scope':[], 'format_module':[], 'format_meta_module':[], 'format_class':[], 'format_class_template':[], 'format_typedef':[], 'format_enum':[], 'format_variable':[], 'format_const':[], 'format_function':[], 'format_function_template':[], 'format_operation':[], 'format_operation_template':[]} for fragment in self.fragments: fragment.register(self) for method in self.__formatdict.keys(): no_func = getattr(Fragment, method).im_func method_obj = getattr(fragment, method) # If it was overridden in fragment if method_obj.im_func is not no_func: # Add to the dictionary self.__formatdict[method].append(method_obj) def view(self): return self.__view def filename(self): return self.__view.filename() def os(self): return self.__view.os() def scope(self): return self.__view.scope() def write(self, text): self.os().write(text) # Access to generated values def type_ref(self): return self.__type_ref def type_label(self): return self.__type_label def declarator(self): return self.__declarator def parameter(self): return self.__parameter def reference(self, name, label=None, **keys): """Returns a reference to the given name. The name is a scoped name, and the optional label is an alternative name to use as the link text. The name is looked up in the TOC so the link may not be local. The optional keys are appended as attributes to the A tag.""" if not label: label = escape(str(self.scope().prune(name))) entry = self.processor.toc[name] if entry: return href(rel(self.filename(), entry.link), label, **keys) else: return label or '' def label(self, name, label=None): """Create a label for the given name. The label is an anchor so it can be referenced by other links. The name of the label is derived by looking up the name in the TOC and using the link in the TOC entry. The optional label is an alternative name to use as the displayed name. If the name is not found in the TOC then the name is not anchored and just label is returned (or name if no label is given). """ if label is None: label = name # some labels are templates with <>'s entry = self.processor.toc[name] label = escape(str(self.scope().prune(label))) if entry is None: return label location = entry.link index = location.find('#') if index >= 0: location = location[index+1:] return location and Tags.name(location, label) or label def format_declaration(self, decl, method): """Format decl using named method of each fragment. Each fragment returns two strings - type and name. All the types are joined and all the names are joined separately. The consolidated type and name strings are then passed to write_section_item.""" type_name = [f(decl) for f in self.__formatdict[method]] if type_name: text = ' '.join(type_name).strip() self.write_section_item(text) def process(self, decl): """Formats the given decl, creating the output for this Part of the view. This method is implemented in various subclasses in different ways, for example Summary and Detail iterate through the children of 'decl' section by section, whereas Heading only formats decl itself. """ pass #################### ASG Visitor ############################################ def visit_declaration(self, decl): self.format_declaration(decl, 'format_declaration') def visit_macro(self, decl): self.format_declaration(decl, 'format_macro') def visit_forward(self, decl): self.format_declaration(decl, 'format_forward') def visit_group(self, decl): self.format_declaration(decl, 'format_group') def visit_scope(self, decl): self.format_declaration(decl, 'format_scope') def visit_module(self, decl): self.format_declaration(decl, 'format_module') def visit_meta_module(self, decl): self.format_declaration(decl, 'format_meta_module') def visit_class(self, decl): self.format_declaration(decl, 'format_class') def visit_class_template(self, decl): self.format_declaration(decl, 'format_class_template') def visit_typedef(self, decl): self.format_declaration(decl, 'format_typedef') def visit_enum(self, decl): self.format_declaration(decl, 'format_enum') def visit_variable(self, decl): self.format_declaration(decl, 'format_variable') def visit_const(self, decl): self.format_declaration(decl, 'format_const') def visit_function(self, decl): self.format_declaration(decl, 'format_function') def visit_function_template(self, decl): self.format_declaration(decl, 'format_function_template') def visit_operation(self, decl): self.format_declaration(decl, 'format_operation') def visit_operation_template(self, decl): self.format_declaration(decl, 'format_operation_template') #################### Type Formatter/Visitor ################################# def format_type(self, typeObj, id_holder = None): "Returns a reference string for the given type object" if typeObj is None: return "(unknown)" if id_holder: save_id = self.__id_holder self.__id_holder = id_holder typeObj.accept(self) if id_holder: self.__id_holder = save_id return self.__type_label def visit_builtin_type_id(self, type): "Sets the label to be a reference to the type's name" self.__type_label = self.reference(type.name) def visit_unknown_type_id(self, type): "Sets the label to be a reference to the type's link" self.__type_label = self.reference(type.link) def visit_declared_type_id(self, type): "Sets the label to be a reference to the type's name" self.__type_label = self.reference(type.name) def visit_dependent_type_id(self, type): "Sets the label to be the type's name (which has no proper scope)" self.__type_label = type.name[-1] def visit_modifier_type_id(self, type): "Adds modifiers to the formatted label of the modifier's alias" alias = self.format_type(type.alias) def amp(x): if x == '&': return '&' return x pre = ''.join(['%s '%amp(x) for x in type.premod]) post = ''.join([amp(x) for x in type.postmod]) self.__type_label = "%s%s%s"%(pre,alias,post) def visit_parametrized_type_id(self, type): "Adds the parameters to the template name in angle brackets" if type.template: type_label = self.reference(type.template.name) else: type_label = "(unknown)" parameters = [self.format_type(p) for p in type.parameters] self.__type_label = "%s<%s>"%(type_label,', '.join(parameters)) def visit_template_id(self, type): "Labs the template with the parameters" self.__type_label = "template<%s>"%','.join(['typename %s'%self.format_type(p) for p in type.parameters]) def visit_function_type_id(self, type): "Labels the function type with return type, name and parameters" ret = self.format_type(type.return_type) params = map(self.format_type, type.parameters) pre = ''.join(type.premod) if self.__id_holder: ident = self.__id_holder[0] del self.__id_holder[0] else: ident = '' self.__type_label = "%s(%s%s)(%s)"%(ret,pre,ident,', '.join(params)) # These are overridden in {Summary,Detail}Formatter def write_start(self): "Abstract method to start the output, eg table headings" self.write('\n') def write_section_start(self, heading): "Abstract method to start a section of declaration types" pass def write_section_end(self, heading): "Abstract method to end a section of declaration types" pass def write_section_item(self, text): "Abstract method to write the output of one formatted declaration" pass def write_end(self): "Abstract method to end the output, eg close the table" pass synopsis-0.12/Synopsis/Formatters/HTML/Markup/0000775000076400007640000000000011172123232020631 5ustar stefanstefansynopsis-0.12/Synopsis/Formatters/HTML/Markup/__init__.py0000664000076400007640000000640111104703264022747 0ustar stefanstefan# # Copyright (C) 2006 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # """Markup formatters.""" from Synopsis.Processor import Parametrized, Parameter from Synopsis import ASG from Synopsis.QualifiedName import * from Synopsis.Formatters.HTML.Tags import escape import re class Struct: def __init__(self, summary = '', details = ''): self.summary = summary self.details = details class Formatter(Parametrized): """Interface class that takes a 'doc' annotation and formats its text. Markup-specific subclasses should provide appropriate format methods.""" def init(self, processor): self.processor = processor def format(self, decl, view): """Format the declaration's documentation. @param view the View to use for references and determining the correct relative filename. @param decl the declaration @returns Struct containing summary / details pair. """ doc = decl.annotations.get('doc') text = doc and escape(doc.text) or '' m = re.match(r'(\s*[\w\W]*?\.)(\s|$)', text) summary = m and m.group(1) or '' return Struct(summary, text) def lookup_symbol(self, symbol, scope): """Given a symbol and a scope, returns an URL. Various methods are tried to resolve the symbol. First the parameters are taken off, then we try to split the symbol using '.' or '::'. The params are added back, and then we try to match this scoped name against the current scope. If that fails, then we recursively try enclosing scopes. """ # Remove params index = symbol.find('(') if index >= 0: params = symbol[index:] symbol = symbol[:index] else: params = '' if '.' in symbol: symbol = QualifiedPythonName(symbol.split('.')) else: symbol = QualifiedCxxName(symbol.split('::')) # Add params back symbol = symbol[:-1] + (symbol[-1] + params,) # Find in all scopes while 1: entry = self._lookup_symbol_in(symbol, scope) if entry: return entry.link if len(scope) == 0: break scope = scope[:-1] # Not found return None def _lookup_symbol_in(self, symbol, scope): paren = symbol[-1].find('(') if paren != -1: return self._find_method_entry(symbol[-1], scope + symbol[:-1]) else: return self.processor.toc.lookup(scope + symbol) def _find_method_entry(self, name, scope): try: scope = self.processor.ir.asg.types[scope] except KeyError: return None if not isinstance(scope, ASG.DeclaredTypeId): return None scope = scope.declaration if not isinstance(scope, ASG.Scope): return None # For now disregard parameters during lookup. name = name[:name.find('(')] for d in scope.declarations: if isinstance(d, ASG.Function): if d.real_name[-1] == name: return self.processor.toc.lookup(d.name) return None synopsis-0.12/Synopsis/Formatters/HTML/Markup/Javadoc.py0000664000076400007640000001723511104703264022566 0ustar stefanstefan# # Copyright (C) 2006 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Formatters.HTML.Tags import * from Synopsis.Formatters.HTML.Markup import * import re class Javadoc(Formatter): """ A formatter that formats comments similar to Javadoc. See `Javadoc Spec`_ for info. .. _Javadoc Spec: http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javadoc.html""" class Block: def __init__(self, tag, arg, body): self.tag, self.arg, self.body = tag, arg, body summary = r'(\s*[\w\W]*?\.)(\s|$)' block_tag = r'(^\s*\@\w+[\s$])' inline_tag = r'{@(?P\w+)\s+(?P[^}]+)}' inline_tag_split = r'({@\w+\s+[^}]+})' xref = r'([\w#.]+)(?:\([^\)]*\))?\s*(.*)' tag_name = { 'author': ['Author', 'Authors'], 'date': ['Date', 'Dates'], 'deprecated': ['Deprecated', 'Deprecated'], 'exception': ['Exception', 'Exceptions'], 'invariant': ['Invariant', 'Invariants'], 'keyword': ['Keyword', 'Keywords'], 'param': ['Parameter', 'Parameters'], 'postcondition': ['Postcondition', 'Postcondition'], 'precondition': ['Precondition', 'Preconditions'], 'return': ['Returns', 'Returns'], 'see': ['See also', 'See also'], 'throws': ['Throws', 'Throws'], 'version': ['Version', 'Versions']} arg_tags = ['param', 'keyword', 'exception'] def __init__(self): """Create regex objects for regexps""" self.summary = re.compile(Javadoc.summary) self.block_tag = re.compile(Javadoc.block_tag, re.M) self.inline_tag = re.compile(Javadoc.inline_tag) self.inline_tag_split = re.compile(Javadoc.inline_tag_split) self.xref = re.compile(Javadoc.xref) def split(self, doc): """Split a javadoc comment into description and blocks.""" chunks = self.block_tag.split(doc) description = chunks[0] blocks = [] for i in range(1, len(chunks)): if i % 2 == 1: tag = chunks[i].strip()[1:] else: if tag in self.arg_tags: arg, body = chunks[i].strip().split(None, 1) else: arg, body = None, chunks[i] if tag == 'see' and body: if body[0] in ['"', "'"]: if body[-1] == body[0]: body = body[1:-1] elif body[0] == '<': pass else: # @link tags are interpreted as cross-references # and resolved later (see format_inline_tag) body = '{@link %s}'%body blocks.append(Javadoc.Block(tag, arg, body)) return description, blocks def extract_summary(self, description): """Generate a summary from the given description.""" m = self.summary.match(description) if m: return m.group(1) else: return description.split('\n', 1)[0]+'...' def format(self, decl, view): """Format using javadoc markup.""" doc = decl.annotations.get('doc') doc = doc and doc.text or '' if not doc: return Struct('', '') description, blocks = self.split(doc) details = self.format_description(description, view, decl) summary = self.extract_summary(details) details += self.format_params(blocks, view, decl) details += self.format_tag('return', blocks, view, decl) details += self.format_throws(blocks, view, decl) details += self.format_tag('precondition', blocks, view, decl) details += self.format_tag('postcondition', blocks, view, decl) details += self.format_tag('invariant', blocks, view, decl) details += self.format_tag('author', blocks, view, decl) details += self.format_tag('date', blocks, view, decl) details += self.format_tag('version', blocks, view, decl) details += self.format_tag('deprecated', blocks, view, decl) details += self.format_tag('see', blocks, view, decl) return Struct(summary, details) def format_description(self, text, view, decl): return self.format_inlines(view, decl, text) def format_inlines(self, view, decl, text): """Formats inline tags in the text.""" chunks = self.inline_tag_split.split(text) text = '' # Every other chunk is now an inlined tag, which we process # in this loop. for i in range(len(chunks)): if i % 2 == 0: text += chunks[i] else: m = self.inline_tag.match(chunks[i]) if m: text += self.format_inline_tag(m.group('tag'), m.group('content'), view, decl) return text def format_params(self, blocks, view, decl): """Formats a list of (param, description) tags""" content = '' params = [b for b in blocks if b.tag == 'param'] def row(dt, dd): return element('tr', element('th', dt, Class='dt') + element('td', dd, Class='dd')) if params: content += div('tag-heading',"Parameters:") dl = element('table', ''.join([row(p.arg, p.body) for p in params]), Class='dl') content += div('tag-section', dl) kwds = [b for b in blocks if b.tag == 'keyword'] if kwds: content += div('tag-heading',"Keywords:") dl = element('dl', ''.join([row( k.arg, k.body) for k in kwds]), Class='dl') content += div('tag-section', dl) return content def format_throws(self, blocks, view, decl): content = '' throws = [b for b in blocks if b.tag in ['throws', 'exception']] if throws: content += div('tag-heading',"Throws:") dl = element('dl', ''.join([element('dt', t.arg) + element('dd', t.body) for t in throws])) content += div('tag-section', dl) return content def format_tag(self, tag, blocks, view, decl): content = '' items = [b for b in blocks if b.tag == tag] if items: content += div('tag-heading', self.tag_name[tag][1]) content += div('tag-section', '
    '.join([self.format_inlines(view, decl, i.body) for i in items])) return content def format_inline_tag(self, tag, content, view, decl): text = '' if tag == 'link': xref = self.xref.match(content) name, label = xref.groups() if not label: label = name # javadoc uses '{@link package.class#member label}' # Here we simply replace '#' by either '::' or '.' to match # language-specific qualification rules. if '#' in name: if '::' in name: name = name.replace('#', '::') else: name = name.replace('#', '.') target = self.lookup_symbol(name, decl.name[:-1]) if target: url = rel(view.filename(), target) text += href(url, label) else: text += label elif tag == 'code': text += '%s'%escape(content) elif tag == 'literal': text += '%s'%escape(content) return text synopsis-0.12/Synopsis/Formatters/HTML/Markup/RST.py0000664000076400007640000001122511104703264021660 0ustar stefanstefan# # Copyright (C) 2006 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Formatters.HTML.Tags import * from Synopsis.Formatters.HTML.Markup import * from docutils.nodes import * from docutils.core import * from docutils.parsers.rst import roles import re, StringIO class SummaryExtractor(NodeVisitor): """A SummaryExtractor creates a document containing the first sentence of a source document.""" def __init__(self, document): NodeVisitor.__init__(self, document) self.summary = None def visit_paragraph(self, node): """Copy the paragraph but only keep the first sentence.""" if self.summary is not None: return summary_pieces = [] # Extract the first sentence. for child in node: if isinstance(child, Text): m = re.match(r'(\s*[\w\W]*?\.)(\s|$)', child.data) if m: summary_pieces.append(Text(m.group(1))) break else: summary_pieces.append(Text(child)) else: summary_pieces.append(child) self.summary = self.document.copy() para = node.copy() para[:] = summary_pieces self.summary[:] = [para] def unknown_visit(self, node): 'Ignore all unknown nodes' pass class RST(Formatter): """Format summary and detail documentation according to restructured text markup. """ def format(self, decl, view): formatter = self def ref(name, rawtext, text, lineno, inliner, options={}, content=[]): name = utils.unescape(text) uri = formatter.lookup_symbol(name, decl.name[:-1]) if uri: ref = rel(view.filename(), uri) node = reference(rawtext, name, refuri=ref, **options) else: node = emphasis(rawtext, name) return [node], [] roles.register_local_role('', ref) errstream = StringIO.StringIO() settings = {} settings['halt_level'] = 2 settings['warning_stream'] = errstream settings['traceback'] = True doc = decl.annotations.get('doc') if doc: try: doctree = publish_doctree(doc.text, settings_overrides=settings) # Extract the summary. extractor = SummaryExtractor(doctree) doctree.walk(extractor) reader = docutils.readers.doctree.Reader(parser_name='null') # Publish the summary. if extractor.summary: pub = Publisher(reader, None, None, source=io.DocTreeInput(extractor.summary), destination_class=io.StringOutput) pub.set_writer('html') pub.process_programmatic_settings(None, None, None) dummy = pub.publish(enable_exit_status=None) summary = pub.writer.parts['html_body'] # Hack to strip off some redundant blocks to make the output # more compact. if (summary.startswith('
    \n') and summary.endswith('
    \n')): summary=summary[23:-7] else: summary = '' # Publish the details. pub = Publisher(reader, None, None, source=io.DocTreeInput(doctree), destination_class=io.StringOutput) pub.set_writer('html') pub.process_programmatic_settings(None, None, None) dummy = pub.publish(enable_exit_status=None) details = pub.writer.parts['html_body'] # Hack to strip off some redundant blocks to make the output # more compact. if (details.startswith('
    \n') and details.endswith('
    \n')): details=details[23:-7] return Struct(summary, details) except docutils.utils.SystemMessage, error: xx, line, message = str(error).split(':', 2) print 'In DocString attached to declaration at %s:%d:'%(decl.file.name, decl.line) print ' line %s:%s'%(line, message) return Struct('', '') synopsis-0.12/Synopsis/Formatters/HTML/DirectoryLayout.py0000664000076400007640000001356411122312026023113 0ustar stefanstefan# # Copyright (C) 2000 Stephen Davies # Copyright (C) 2000 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis import config from Synopsis import ASG from Synopsis.Formatters import TOC from Synopsis.Formatters import quote_name, open_file, copy_file from Tags import * import os, sys class DirectoryLayout (TOC.Linker): """DirectoryLayout defines how the generated html files are organized. The default implementation uses a flat layout with all files being part of a single directory.""" def init(self, processor): self.processor = processor self.base = self.processor.output if not os.path.exists(self.base): if processor.verbose: print "Warning: Output directory does not exist. Creating." try: os.makedirs(self.base, 0755) except EnvironmentError, reason: print "ERROR: Creating directory:",reason sys.exit(2) elif not os.path.isdir(self.base): print "ERROR: Output must be a directory." sys.exit(1) if os.path.isfile(processor.stylesheet): self.copy_file(processor.stylesheet, 'style.css') else: print "ERROR: stylesheet %s doesn't exist"%processor.stylesheet sys.exit(1) self.copy_file(os.path.join(config.datadir, 'logo-small.png'), 'synopsis.png') def copy_file(self, src, dest): """Copy src to dest, if dest doesn't exist yet or is outdated.""" copy_file(src, os.path.join(self.base, dest)) def scope(self, scope = None): """Return the filename of a scoped name (class or module). The default implementation is to join the names with '-' and append ".html". Additionally, special characters are quoted.""" if not scope: return self.special('global') return quote_name('.'.join(scope)) + '.html' def _strip(self, filename): if filename.endswith('/'): filename = filename[:-1] if filename.startswith('/'): filename = filename[1:] return filename def file_index(self, filename): """Return the filename for the index of an input file. Default implementation is to join the path with '.', prepend '_file.' and append '.html' """ filename = self._strip(filename) return '_file.%s.html'%filename.replace(os.sep, '.') def file_source(self, filename): """Return the filename for the source of an input file. Default implementation is to join the path with '.', prepend '_source.' and append '.html' """ file = self._strip(filename) return '_source.'+file.replace(os.sep, '.')+'.html' def file_details(self, filename): """Return the filename for the details of an input file. Default implementation is to join the path with '.', prepend '_file_detail.' and append '.html' """ return '_file_detail.'+self._strip(filename).replace(os.sep, '.')+'.html' def index(self): """Return the name of the main index file. Default is index.html""" return 'index.html' def special(self, name): """Return the name of a special file (tree, etc). Default is _name.html""" return '_%s.html'%name def scoped_special(self, name, scope, ext='.html'): """Return the name of a special type of scope file. Default is to join the scope with '.' and prepend '.'+name""" return "_%s%s%s"%(name, quote_name('.'.join(scope)), ext) def xref(self, page): """Return the name of the xref file for the given page""" return '_xref%d.html'%page def module_tree(self): """Return the name of the module tree index. Default is _modules.html""" return '_modules.html' def module_index(self, scope): """Return the name of the index of the given module. Default is to join the name with '.', prepend '_module' and append '.html' """ return quote_name('_module' + '.'.join(scope)) + '.html' def link(self, decl): """Create a link to the named declaration. This method may have to deal with the directory layout.""" if (isinstance(decl, ASG.Scope) or # If this is a forward-declared class template with known specializations, # we want to treat it like an ASG.Class, as far as formatting is concerned. (isinstance(decl, ASG.Forward) and decl.specializations)): # This is a class or module, so it has its own file return self.scope(decl.name) # Assume parent scope is class or module, and this is a name in it filename = self.scope(decl.name[:-1]) fragment = quote_as_id(decl.name[-1]) return filename + '#' + fragment class NestedDirectoryLayout(DirectoryLayout): """Organizes files in a directory tree.""" def scope(self, scope = None): if not scope: return 'Scopes/global.html' else: return quote_name('Scopes/' + '/'.join(scope)) + '.html' def file_index(self, filename): return 'File/%s.html'%self._strip(filename) def file_source(self, filename): return 'Source/%s.html'%self._strip(filename) def file_details(self, filename): return 'FileDetails/%s.html'%self._strip(filename) def special(self, name): return name + '.html' def scoped_special(self, name, scope, ext='.html'): return quote_name(name + '/' + '/'.join(scope)) + ext def xref(self, page): return 'XRef/xref%d.html'%page def module_tree(self): return 'Modules.html' def module_index(self, scope): if not len(scope): return 'Modules/global.html' else: return quote_name('Modules/' + '/'.join(scope)) + '.html' synopsis-0.12/Synopsis/Formatters/HTML/FrameSet.py0000664000076400007640000000420711104703264021461 0ustar stefanstefan# # Copyright (C) 2006 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # from Synopsis.Formatters.HTML.DirectoryLayout import open_file from Synopsis.Formatters.HTML.Tags import * import os class FrameSet: """A class that creates an index with frames""" def process(self, output, filename, title, index, detail, content): """Creates a frames index file.""" out = open_file(os.path.join(output, filename)) out.write('\n') out.write('\n') out.write('\n') out.write('\n') out.write('\n') out.write(element('title',title) + '\n') out.write(element('link', type='text/css', rel='stylesheet', href='style.css') + '\n') out.write('\n') index = rel(filename, index) detail = rel(filename, detail) content = rel(filename, content) frame1 = element('frame', name='index', src=index) frame2 = element('frame', name='detail', src=detail) frame3 = element('frame', name='content', src=content) frameset = element('frameset', '%s\n%s\n'%(frame1, frame2), rows="30%,*") noframes = 'This document was configured to use frames.\n' noframes += '
      \n' noframes += element('li', href(index, 'The default Index frame')) + '\n' noframes += element('li', href(detail, 'The default Detail frame')) + '\n' noframes += element('li', href(content, 'The default Content frame')) + '\n' noframes += '
    \n' noframes = element('body', noframes + 'Generated by Synopsis.') + '\n' noframes = element('noframes', noframes) frameset = element('frameset', '%s\n%s\n%s\n'%(frameset, frame3, noframes), cols="200,*") out.write(frameset) out.write('\n\n') out.close() synopsis-0.12/Synopsis/Formatters/Dot.py0000664000076400007640000005013711123016554017740 0ustar stefanstefan# # Copyright (C) 2000 Stefan Seefeld # Copyright (C) 2000 Stephen Davies # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # """ Uses 'dot' from graphviz to generate various graphs. """ from Synopsis.Processor import * from Synopsis.QualifiedName import * from Synopsis import ASG from Synopsis.Formatters import TOC from Synopsis.Formatters import quote_name, open_file import sys, os verbose = False debug = False class SystemError: """Error thrown by the system() function. Attributes are 'retval', encoded as per os.wait(): low-byte is killing signal number, high-byte is return value of command.""" def __init__(self, retval, command): self.retval = retval self.command = command def __repr__(self): return 'SystemError: %(retval)x"%(command)s" failed.'%self.__dict__ def system(command): """Run the command. If the command fails, an exception SystemError is thrown.""" ret = os.system(command) if (ret>>8) != 0: raise SystemError(ret, command) def normalize(color): """Generate a color triplet from a color string.""" if type(color) is str and color[0] == '#': return (int(color[1:3], 16), int(color[3:5], 16), int(color[5:7], 16)) elif type(color) is tuple: return (color[0] * 255, color[1] * 255, color[2] * 255) def light(color): import colorsys hsv = colorsys.rgb_to_hsv(*color) return colorsys.hsv_to_rgb(hsv[0], hsv[1], hsv[2]/2) class DotFileGenerator: """A class that encapsulates the dot file generation""" def __init__(self, os, direction, bgcolor): self.__os = os self.direction = direction self.bgcolor = bgcolor and '"#%X%X%X"'%bgcolor self.light_color = bgcolor and '"#%X%X%X"'%light(bgcolor) or 'gray75' self.nodes = {} def write(self, text): self.__os.write(text) def write_node(self, ref, name, label, **attr): """helper method to generate output for a given node""" if self.nodes.has_key(name): return self.nodes[name] = len(self.nodes) number = self.nodes[name] # Quote to remove characters that dot can't handle for p in [('<', '\<'), ('>', '\>'), ('{','\{'), ('}','\}')]: label = label.replace(*p) if self.bgcolor: attr['fillcolor'] = self.bgcolor attr['style'] = 'filled' self.write("Node" + str(number) + " [shape=\"record\", label=\"{" + label + "}\"") #self.write(", fontSize = 10, height = 0.2, width = 0.4") self.write(''.join([', %s=%s'%item for item in attr.items()])) if ref: self.write(', URL="' + ref + '"') self.write('];\n') def write_edge(self, parent, child, **attr): self.write("Node" + str(self.nodes[parent]) + " -> ") self.write("Node" + str(self.nodes[child])) self.write('[ color="black", fontsize=10, dir=back' + ''.join([', %s="%s"'%item for item in attr.items()]) + '];\n') class InheritanceGenerator(DotFileGenerator, ASG.Visitor): """A Formatter that generates an inheritance graph. If the 'toc' argument is not None, it is used to generate URLs. If no reference could be found in the toc, the node will be grayed out.""" def __init__(self, os, direction, operations, attributes, aggregation, toc, prefix, no_descend, bgcolor): DotFileGenerator.__init__(self, os, direction, bgcolor) if operations: self.__operations = [] else: self.__operations = None if attributes: self.__attributes = [] else: self.__attributes = None self.aggregation = aggregation self.toc = toc self.scope = QualifiedName() if prefix: if prefix.contains('::'): self.scope = QualifiedCxxName(prefix.split('::')) elif prefix.contains('.'): self.scope = QualifiedPythonName(prefix.split('.')) else: self.scope = QualifiedName((prefix,)) self.__type_ref = None self.__type_label = '' self.__no_descend = no_descend self.nodes = {} def type_ref(self): return self.__type_ref def type_label(self): return self.__type_label def parameter(self): return self.__parameter def format_type(self, typeObj): "Returns a reference string for the given type object" if typeObj is None: return "(unknown)" typeObj.accept(self) return self.type_label() def clear_type(self): self.__type_ref = None self.__type_label = '' def get_class_name(self, node): """Returns the name of the given class node, relative to all its parents. This makes the graph simpler by making the names shorter""" base = node.name for i in node.parents: try: parent = i.parent pname = parent.name for j in range(len(base)): if j > len(pname) or pname[j] != base[j]: # Base is longer than parent name, or found a difference base[j:] = [] break except: pass # typedefs etc may cause errors here.. ignore if not node.parents: base = self.scope return str(self.scope.prune(node.name)) #################### Type Visitor ########################################## def visit_modifier_type(self, type): self.format_type(type.alias) self.__type_label = ''.join(type.premod) + self.__type_label self.__type_label = self.__type_label + ''.join(type.postmod) def visit_unknown_type(self, type): self.__type_ref = self.toc and self.toc[type.link] or None self.__type_label = str(self.scope.prune(type.name)) def visit_builtin_type_id(self, type): self.__type_ref = None self.__type_label = type.name[-1] def visit_dependent_type_id(self, type): self.__type_ref = None self.__type_label = type.name[-1] def visit_declared_type_id(self, type): self.__type_ref = self.toc and self.toc[type.declaration.name] or None if isinstance(type.declaration, ASG.Class): self.__type_label = self.get_class_name(type.declaration) else: self.__type_label = str(self.scope.prune(type.declaration.name)) def visit_parametrized_type_id(self, type): if type.template: type_ref = self.toc and self.toc[type.template.name] or None type_label = str(self.scope.prune(type.template.name)) else: type_ref = None type_label = "(unknown)" parameters_label = [] for p in type.parameters: parameters_label.append(self.format_type(p)) self.__type_ref = type_ref self.__type_label = type_label + "<" + ','.join(parameters_label) + ">" def visit_template_id(self, type): self.__type_ref = None def clip(x, max=20): if len(x) > max: return '...' return x self.__type_label = "template<%s>"%(clip(','.join([clip(self.format_type(p)) for p in type.parameters]), 40)) #################### ASG Visitor ########################################### def visit_inheritance(self, node): self.format_type(node.parent) if self.type_ref(): self.write_node(self.type_ref().link, self.type_label(), self.type_label()) elif self.toc: self.write_node('', self.type_label(), self.type_label(), color=self.light_color, fontcolor=self.light_color) else: self.write_node('', self.type_label(), self.type_label()) def visit_class(self, node): if self.__operations is not None: self.__operations.append([]) if self.__attributes is not None: self.__attributes.append([]) name = self.get_class_name(node) ref = self.toc and self.toc[node.name] or None for d in node.declarations: d.accept(self) # NB: old version of dot needed the label surrounded in {}'s (?) label = name if type(node) is ASG.ClassTemplate and node.template: if self.direction == 'vertical': label = self.format_type(node.template) + '\\n' + label else: label = self.format_type(node.template) + ' ' + label if self.__operations or self.__attributes: label = label + '\\n' if self.__operations: label += '|' + ''.join([x[-1] + '()\\l' for x in self.__operations[-1]]) if self.__attributes: label += '|' + ''.join([x[-1] + '\\l' for x in self.__attributes[-1]]) if ref: self.write_node(ref.link, name, label) elif self.toc: self.write_node('', name, label, color=self.light_color, fontcolor=self.light_color) else: self.write_node('', name, label) if self.aggregation: #FIXME: we shouldn't only be looking for variables of the exact type, # but also derived types such as pointers, references, STL containers, etc. # # find attributes of type 'Class' so we can link to it for a in filter(lambda a:isinstance(a, ASG.Variable), node.declarations): if isinstance(a.vtype, ASG.DeclaredTypeId): d = a.vtype.declaration if isinstance(d, ASG.Class) and self.nodes.has_key(self.get_class_name(d)): self.write_edge(self.get_class_name(node), self.get_class_name(d), arrowtail='ediamond') for p in node.parents: p.accept(self) self.write_edge(self.type_label(), name, arrowtail='empty') if self.__no_descend: return if self.__operations: self.__operations.pop() if self.__attributes: self.__attributes.pop() def visit_operation(self, operation): if self.__operations: self.__operations[-1].append(operation.real_name) def visit_variable(self, variable): if self.__attributes: self.__attributes[-1].append(variable.name) class SingleInheritanceGenerator(InheritanceGenerator): """A Formatter that generates an inheritance graph for a specific class. This Visitor visits the ASG upwards, i.e. following the inheritance links, instead of the declarations contained in a given scope.""" def __init__(self, os, direction, operations, attributes, levels, types, toc, prefix, no_descend, bgcolor): InheritanceGenerator.__init__(self, os, direction, operations, attributes, False, toc, prefix, no_descend, bgcolor) self.__levels = levels self.__types = types self.__current = 1 self.__visited_classes = {} # classes already visited, to prevent recursion #################### Type Visitor ########################################## def visit_declared_type_id(self, type): if self.__current < self.__levels or self.__levels == -1: self.__current = self.__current + 1 type.declaration.accept(self) self.__current = self.__current - 1 # to restore the ref/label... InheritanceGenerator.visit_declared_type_id(self, type) #################### ASG Visitor ########################################### def visit_inheritance(self, node): node.parent.accept(self) if self.type_label(): if self.type_ref(): self.write_node(self.type_ref().link, self.type_label(), self.type_label()) elif self.toc: self.write_node('', self.type_label(), self.type_label(), color=self.light_color, fontcolor=self.light_color) else: self.write_node('', self.type_label(), self.type_label()) def visit_class(self, node): # Prevent recursion if self.__visited_classes.has_key(id(node)): return self.__visited_classes[id(node)] = None name = self.get_class_name(node) if self.__current == 1: self.write_node('', name, name, style='filled', color=self.light_color, fontcolor=self.light_color) else: ref = self.toc and self.toc[node.name] or None if ref: self.write_node(ref.link, name, name) elif self.toc: self.write_node('', name, name, color=self.light_color, fontcolor=self.light_color) else: self.write_node('', name, name) for p in node.parents: p.accept(self) if self.nodes.has_key(self.type_label()): self.write_edge(self.type_label(), name, arrowtail='empty') # if this is the main class and if there is a type dictionary, # look for classes that are derived from this class # if this is the main class if self.__current == 1 and self.__types: # fool the visit_declared_type_id method to stop walking upwards self.__levels = 0 for t in self.__types.values(): if isinstance(t, ASG.DeclaredTypeId): child = t.declaration if isinstance(child, ASG.Class): for i in child.parents: type = i.parent type.accept(self) if self.type_ref(): if self.type_ref().name == node.name: child_label = self.get_class_name(child) ref = self.toc and self.toc[child.name] or None if ref: self.write_node(ref.link, child_label, child_label) elif self.toc: self.write_node('', child_label, child_label, color=self.light_color, fontcolor=self.light_color) else: self.write_node('', child_label, child_label) self.write_edge(name, child_label, arrowtail='empty') class FileDependencyGenerator(DotFileGenerator, ASG.Visitor): """A Formatter that generates a file dependency graph""" def visit_file(self, file): if file.annotations['primary']: self.write_node('', file.name, file.name) for i in file.includes: target = i.target if target.annotations['primary']: self.write_node('', target.name, target.name) name = i.name name = name.replace('"', '\\"') self.write_edge(target.name, file.name, label=name, style='dashed') def _rel(frm, to): "Find link to to relative to frm" frm = frm.split('/'); to = to.split('/') for l in range((len(frm)\n') line = input.readline() def _format(input, output, format): command = 'dot -T%s -o "%s" "%s"'%(format, output, input) if verbose: print "Dot Formatter: running command '" + command + "'" try: system(command) except SystemError, e: if debug: print 'failed to execute "%s"'%command raise InvalidCommand, "could not execute 'dot'" def _format_png(input, output): _format(input, output, "png") def _format_html(input, output, base_url): """generate (active) image for html. input and output are file names. If output ends in '.html', its stem is used with an '.png' suffix for the actual image.""" if output[-5:] == ".html": output = output[:-5] _format_png(input, output + ".png") _format(input, output + ".map", "imap") prefix, name = os.path.split(output) reference = name + ".png" html = open_file(output + ".html") html.write(''+name+'\n") html.write("") dotmap = open(output + ".map", "r+") _convert_map(dotmap, html, base_url) dotmap.close() os.remove(output + ".map") html.write("\n") class Formatter(Processor): """The Formatter class acts merely as a frontend to the various InheritanceGenerators""" title = Parameter('Inheritance Graph', 'the title of the graph') type = Parameter('class', 'type of graph (one of "file", "class", "single"') hide_operations = Parameter(True, 'hide operations') hide_attributes = Parameter(True, 'hide attributes') show_aggregation = Parameter(False, 'show aggregation') bgcolor = Parameter(None, 'background color for nodes') format = Parameter('ps', 'Generate output in format "dot", "ps", "png", "svg", "gif", "map", "html"') layout = Parameter('vertical', 'Direction of graph') prefix = Parameter(None, 'Prefix to strip from all class names') toc_in = Parameter([], 'list of table of content files to use for symbol lookup') base_url = Parameter(None, 'base url to use for generated links') def process(self, ir, **kwds): global verbose, debug self.set_parameters(kwds) if self.bgcolor: bgcolor = normalize(self.bgcolor) if not bgcolor: raise InvalidArgument('bgcolor=%s'%repr(self.bgcolor)) else: self.bgcolor = bgcolor self.ir = self.merge_input(ir) verbose = self.verbose debug = self.debug formats = {'dot' : 'dot', 'ps' : 'ps', 'png' : 'png', 'gif' : 'gif', 'svg' : 'svg', 'map' : 'imap', 'html' : 'html'} if formats.has_key(self.format): format = formats[self.format] else: print "Error: Unknown format. Available formats are:", print ', '.join(formats.keys()) return self.ir # we only need the toc if format=='html' if format == 'html': # beware: HTML.Fragments.ClassHierarchyGraph sets self.toc !! toc = getattr(self, 'toc', TOC.TOC(TOC.Linker())) for t in self.toc_in: toc.load(t) else: toc = None head, tail = os.path.split(self.output) tmpfile = os.path.join(head, quote_name(tail)) + ".dot" if self.verbose: print "Dot Formatter: Writing dot file..." dotfile = open_file(tmpfile) dotfile.write("digraph \"%s\" {\n"%(self.title)) if self.layout == 'horizontal': dotfile.write('rankdir="LR";\n') dotfile.write('ranksep="1.0";\n') dotfile.write("node[shape=record, fontsize=10, height=0.2, width=0.4, color=black]\n") if self.type == 'single': generator = SingleInheritanceGenerator(dotfile, self.layout, not self.hide_operations, not self.hide_attributes, -1, self.ir.asg.types, toc, self.prefix, False, self.bgcolor) elif self.type == 'class': generator = InheritanceGenerator(dotfile, self.layout, not self.hide_operations, not self.hide_attributes, self.show_aggregation, toc, self.prefix, False, self.bgcolor) elif self.type == 'file': generator = FileDependencyGenerator(dotfile, self.layout, self.bgcolor) else: sys.stderr.write("Dot: unknown type\n"); if self.type == 'file': for f in self.ir.files.values(): generator.visit_file(f) else: for d in self.ir.asg.declarations: d.accept(generator) dotfile.write("}\n") dotfile.close() if format == "dot": os.rename(tmpfile, self.output) elif format == "png": _format_png(tmpfile, self.output) os.remove(tmpfile) elif format == "html": _format_html(tmpfile, self.output, self.base_url) os.remove(tmpfile) else: _format(tmpfile, self.output, format) os.remove(tmpfile) return self.ir synopsis-0.12/sandbox/0000775000076400007640000000000011172123232014307 5ustar stefanstefansynopsis-0.12/sandbox/README0000664000076400007640000000175511104702610015175 0ustar stefanstefanThis directory contains experimental code that may or may not be moved into the 'public' framework. As synopsis is in heavy development, it is distributed with the source distribution anyways, hoping that it may whet your appetit. To be able to compile the code, you will have to adjust the (local) build system to your platform. You will at least have to call $(srcdir)/configure where options is at least: --with-python= the name of the python executable. --with-syn-cxx= the prefix to the Synopsis library. Additionally, you may have to modify the Makefiles to adjust the names of the various boost libraries being used (unfortunately the naming isn't consistent across platforms). The following subprojects are being worked on: * bpl : A set of python extension modules that reflect the low level C++ parser API to python using boost.python. * wave : A new CPP parser (i.e. preprocessor) backend based on boost.wave. Good luck ! synopsis-0.12/sandbox/call_graph/0000775000076400007640000000000011172123232016403 5ustar stefanstefansynopsis-0.12/sandbox/call_graph/call-graph.cc0000664000076400007640000001067211104702610020730 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include #include #include #include #include #include using namespace Synopsis; namespace PT = Synopsis::PTree; namespace SL = Synopsis::SymbolLookup; class EnclosingFunctionFinder : private SL::ScopeVisitor { public: //. Find the nearest enclosing scope that is either //. a function or namespace (i.e. global scope). SL::Scope const *find(SL::Scope const *s) { my_scope = 0; const_cast(s)->accept(this); return my_scope; } private: virtual void visit(SL::LocalScope *s) { const_cast(s->outer_scope())->accept(this);} virtual void visit(SL::FunctionScope *s) { my_scope = s;} virtual void visit(SL::Namespace *s) { my_scope = s;} SL::Scope const *my_scope; }; //. A simple call graph generator. //. This class finds function call expressions and //. reports the (function) scope of the call together //. with the name of the callee. //. As this is only a demo of part of the Synopsis API //. no attempt has been made for completeness, i.e. there //. is no pointer analysis, etc. //. Further, only C sources are supported as for C++ //. type analysis would be needed to do proper //. overload resolution, which is not yet implemented. class CallGraphGenerator : private SL::Walker { public: CallGraphGenerator(std::ostream &os, SL::Scope *symbols) : Walker(symbols), my_os(os) {} void generate(PT::Node const *node) { my_os << "digraph CallGraph\n{\n" << "node[fillcolor=\"#ffffcc\", pencolor=\"#424242\" style=\"filled\"];\n"; const_cast(node)->accept(this); my_os << '}' << std::endl; } private: void visit(PT::FuncallExpr *func) { PT::Node *name = PT::first(func); EnclosingFunctionFinder function_finder; SL::Scope const *scope = function_finder.find(current_scope()); std::string caller = ""; if (SL::FunctionScope const *func = dynamic_cast(scope)) caller = func->name(); std::string callee = PT::reify(name); if (my_cache.find(caller) == my_cache.end()) { my_cache.insert(caller); my_os << '"' << caller << "\" [label=\"" << caller << "\"];\n"; } if (my_cache.find(callee) == my_cache.end()) { my_cache.insert(callee); my_os << '"' << callee << "\" [label=\"" << callee << "\"];\n"; } my_os << '"' << caller << "\" -> \"" << callee << '"' << std::endl; } std::set my_cache; std::ostream & my_os; }; int usage(const char *command) { std::cerr << "Usage: " << command << " [-C] [-d] [-o ] " << std::endl; return -1; } int main(int argc, char **argv) { const char *input = argv[1]; std::ofstream output; if (argc == 1) return usage(argv[0]); input = argv[argc - 1]; bool cxx = false; for (size_t i = 1; i != argc - 1; ++i) { if (argv[i] == std::string("-C")) cxx = true; else if (argv[i] == std::string("-d")) Trace::enable(); else if (argv[i] == std::string("-o") && i < argc - 1) output.open(argv[++i]); else return usage(argv[0]); } if (!output.is_open()) { output.copyfmt(std::cout); output.clear(std::cout.rdstate()); static_cast &>(output).rdbuf(std::cout.rdbuf()); } // try { // FIXME: For now we have to initialize the Encoding... PT::Encoding::do_init_static(); std::ifstream ifs(input); Buffer buffer(ifs.rdbuf(), input); int tokenset = Lexer::C | Lexer::GCC | Lexer::MSVC; int ruleset = 0; if (cxx) { tokenset |= Lexer::CXX; ruleset = Parser::CXX | Parser::MSVC; } Lexer lexer(&buffer, tokenset); SymbolFactory symbols; Parser parser(lexer, symbols, ruleset); PT::Node *node = parser.parse(); const Parser::ErrorList &errors = parser.errors(); for (Parser::ErrorList::const_iterator i = errors.begin(); i != errors.end(); ++i) (*i)->write(std::cerr); if (!node) return -1; CallGraphGenerator generator(output, symbols.current_scope()); generator.generate(node); } // catch (const std::exception &e) // { // std::cerr << "Caught exception : " << e.what() << std::endl; // throw; // } } synopsis-0.12/sandbox/call_graph/Makefile0000664000076400007640000000071111104702610020040 0ustar stefanstefan# # Copyright (C) 2005 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # SHELL := /bin/sh CPPFLAGS:= `pkg-config --cflags Synopsis` LIBS := `pkg-config --libs Synopsis` TARGET := call-graph call-graph: call-graph.o $(CXX) $(LDFLAGS) -o $@ $< $(LIBS) %.o: %.cc @echo compiling $(@D)/$(@F) $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< clean : rm -f call-graph synopsis-0.12/sandbox/bpl/0000775000076400007640000000000011172123232015064 5ustar stefanstefansynopsis-0.12/sandbox/bpl/Processor.cc0000664000076400007640000000622011104702610017350 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include #include #include #include #include #include namespace bpl = boost::python; using namespace Synopsis; namespace { Buffer *construct_buffer(char const *filename) { std::ifstream ifs(filename); return new Buffer(ifs.rdbuf(), filename); } void write_buffer(Buffer const &buffer, char const *output, std::string const &filename) { std::ofstream ofs(output); buffer.write(ofs, filename); } //. insert the given string after the given node void insert_buffer(Buffer &buffer, PTree::Node *node, std::string const &string) { char *str = static_cast(memmove(new (GC) char[string.length() + 1], string.data(), string.length())); str[string.length()] = '\0'; buffer.replace(node->end(), node->end(), str, string.length()); } //. replace the given node by the given string void replace_buffer(Buffer &buffer, PTree::Node *node, std::string const &string) { char *str = static_cast(memmove(new (GC) char[string.length() + 1], string.data(), string.length())); str[string.length()] = '\0'; buffer.replace(node->begin(), node->end(), str, string.length()); } Parser *construct_parser(Lexer &lexer, SymbolFactory &symbols, int rule_set) { return new Parser(lexer, symbols, rule_set); } PTree::Node *parse(Parser *parser) { PTree::Node *node = parser->parse(); const Parser::ErrorList &errors = parser->errors(); for (Parser::ErrorList::const_iterator i = errors.begin(); i != errors.end(); ++i) (*i)->write(std::cerr); return node; } } BOOST_PYTHON_MODULE(Processor) { bpl::class_ buffer("Buffer", bpl::no_init); buffer.def("__init__", bpl::make_constructor(construct_buffer)); buffer.def("write", write_buffer); buffer.def("insert", insert_buffer); buffer.def("replace", replace_buffer); bpl::enum_ token_set("TokenSet"); token_set.value("C", Lexer::C); token_set.value("CXX", Lexer::CXX); token_set.value("GCC", Lexer::GCC); token_set.value("MSVC", Lexer::MSVC); bpl::class_ lexer("Lexer", bpl::init()); bpl::enum_ rule_set("RuleSet"); rule_set.value("CXX", Parser::CXX); rule_set.value("MSVC", Parser::MSVC); bpl::enum_ language("Language"); language.value("NONE", SymbolFactory::NONE); language.value("C99", SymbolFactory::C99); language.value("CXX", SymbolFactory::CXX); bpl::class_ symbols("SymbolFactory", bpl::init()); bpl::class_ parser("Parser", bpl::no_init); // keep the symbol table hidden as it will be exported in its own module later parser.def("__init__", bpl::make_constructor(construct_parser)); // The PTree module uses garbage collection so just ignore memory management, // at least for now. parser.def("parse", parse, bpl::return_value_policy()); } synopsis-0.12/sandbox/bpl/README0000664000076400007640000000060511104702610015743 0ustar stefanstefanThis is experimental code ! Use boost.python (http://boost.org/libs/python/doc/index.html) to provide a python API to the C/C++ parser. This may or may not become an 'official' synopsis API at some point. For now it is only meant to be a sandbox for prototyping. To compile it, be sure to have boost version >= 1.32 installed. You may have to adjust the Makefile. Good luck ! Stefan synopsis-0.12/sandbox/bpl/decorate-functions.py0000664000076400007640000000330311104702610021227 0ustar stefanstefan#! /usr/bin/env python import os, os.path, sys sys.path.insert(0, os.getcwd()) import PTree import SymbolLookup from Processor import * class FunctionDecorator(PTree.Visitor): """A FunctionDecorator walks over a parse tree and inserts comments at the beginning of function definitions.""" def __init__(self, buffer): super(FunctionDecorator, self).__init__() self.__buffer = buffer def visit_list(self, l): if l.car(): l.car().accept(self) if l.cdr(): l.cdr().accept(self) def visit_declaration(self, d): third = d.third() if type(third) == PTree.Declarator and third.type.is_function: body = d.nth(3); # body.first() is '{', so we insert a comment after it comment = '\n// this is the start of %s'%third.name self.__buffer.insert(body.first(), comment) body.accept(self) # create a buffer from the given input file test = os.path.join(os.path.dirname(__file__), 'functions.cc') buffer = Buffer(test) # create a lexer operating on that buffer, using std C++ with gcc extensions lexer = Lexer(buffer, TokenSet.CXX|TokenSet.GCC) # create a dummy symbol lookup table (will use a real one once it is fully functional symbols = SymbolLookup.Table(SymbolLookup.Language.NONE) # create a parser with the above lexer and symbol table, using the std C++ grammar parser = Parser(lexer, symbols, RuleSet.CXX) # generate a parser tree ptree = parser.parse() # walk over the parse tree to insert comments at the beginning of functions decorator = FunctionDecorator(buffer) ptree.accept(decorator) # write the modified buffer to the new file buffer.write('functions-dec.cc', '') synopsis-0.12/sandbox/bpl/test.cc0000664000076400007640000000005111104702610016344 0ustar stefanstefanstruct Foo { int foo; double bar; }; synopsis-0.12/sandbox/bpl/PTree.cc0000664000076400007640000010460711104702610016420 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include namespace bpl = boost::python; using namespace Synopsis; using namespace Synopsis::PTree; namespace { class VisitorWrapper : public Visitor { public: VisitorWrapper(PyObject *s) : self(s) {} virtual void visit_node(Node *) {} virtual void visit_atom(Atom *a) { apply("visit_node", a);} virtual void visit_list(List *l) { apply("visit_node", l);} virtual void visit_literal(Literal *a) { apply("visit_atom", a);} virtual void visit_commented_atom(CommentedAtom *a) { apply("visit_atom", a);} virtual void visit_dup_atom(DupAtom *a) { apply("visit_atom", a);} virtual void visit_identifier(Identifier *a) { apply("visit_atom", a);} virtual void visit_keyword(Keyword *a) { apply("visit_atom", a);} // virtual void visit_this(Kwd::This *a) { apply("visit_keyword", a);} // virtual void visit_auto(Kwd::Auto *a) { apply("visit_keyword", a);} // virtual void visit_boolean(Kwd::Bool *a) { apply("visit_keyword", a);} // virtual void visit_char(Kwd::Char *a) { apply("visit_keyword", a);} // virtual void visit_wchar(Kwd::WChar *a) { apply("visit_keyword", a);} // virtual void visit_const(Kwd::Const *a) { apply("visit_keyword", a);} // virtual void visit_double(Kwd::Double *a) { apply("visit_keyword", a);} // virtual void visit_extern(Kwd::Extern *a) { apply("visit_keyword", a);} // virtual void visit_float(Kwd::Float *a) { apply("visit_keyword", a);} // virtual void visit_friend(Kwd::Friend *a) { apply("visit_keyword", a);} // virtual void visit_inline(Kwd::Inline *a) { apply("visit_keyword", a);} // virtual void visit_int(Kwd::Int *a) { apply("visit_keyword", a);} // virtual void visit_long(Kwd::Long *a) { apply("visit_keyword", a);} // virtual void visit_mutable(Kwd::Mutable *a) { apply("visit_keyword", a);} // virtual void visit_namespace(Kwd::Namespacec *a) { apply("visit_keyword", a);} // virtual void visit_private(Kwd::Private *a) { apply("visit_keyword", a);} // virtual void visit_protected(Kwd::Protected *a) { apply("visit_keyword", a);} // virtual void visit_public(Kwd::Public *a) { apply("visit_keyword", a);} // virtual void visit_register(Kwd::Register *a) { apply("visit_keyword", a);} // virtual void visit_short(Kwd::Short *a) { apply("visit_keyword", a);} // virtual void visit_signed(Kwd::Signed *a) { apply("visit_keyword", a);} // virtual void visit_static(Kwd::Static *a) { apply("visit_keyword", a);} // virtual void visit_unsigned(Kwd::Unsigned *a) { apply("visit_keyword", a);} // virtual void visit_using_(Kwd::Using *a) { apply("visit_keyword", a);} // virtual void visit_virtual(Kwd::Virtual *a) { apply("visit_keyword", a);} // virtual void visit_void(Kwd::Void *a) { apply("visit_keyword", a);} // virtual void visit_volatile(Lwd::Volatile *a) { apply("visit_keyword", a);} virtual void visit_brace(Brace *l) { apply("visit_list", l);} virtual void visit_block(Block *l) { apply("visit_brace", l);} virtual void visit_class_body(ClassBody *l) { apply("visit_brace", l);} virtual void visit_typedef(Typedef *l) { apply("visit_list", l);} virtual void visit_template_decl(TemplateDecl *l) { apply("visit_list", l);} virtual void visit_template_instantiation(TemplateInstantiation *l) { apply("visit_list", l);} virtual void visit_extern_template(ExternTemplate *l) { apply("visit_list", l);} virtual void visit_metaclass_decl(MetaclassDecl *l) { apply("visit_list", l);} virtual void visit_linkage_spec(LinkageSpec *l) { apply("visit_list", l);} virtual void visit_namespace_spec(NamespaceSpec *l) { apply("visit_list", l);} virtual void visit_declaration(Declaration *l) { apply("visit_list", l);} virtual void visit_namespace_alias(NamespaceAlias *l) { apply("visit_declaration", l);} virtual void visit_using_directive(UsingDirective *l) { apply("visit_declaration", l);} virtual void visit_parameter_declaration(ParameterDeclaration *l) { apply("visit_declaration", l);} virtual void visit_function_definition(FunctionDefinition *l) { apply("visit_declaration", l);} virtual void visit_using_declaration(UsingDeclaration *l) { apply("visit_list", l);} virtual void visit_declarator(Declarator *l) { apply("visit_list", l);} virtual void visit_name(Name *l) { apply("visit_list", l);} virtual void visit_fstyle_cast_expr(FstyleCastExpr *l) { apply("visit_list", l);} virtual void visit_class_spec(ClassSpec *l) { apply("visit_list", l);} virtual void visit_enum_spec(EnumSpec *l) { apply("visit_list", l);} virtual void visit_access_spec(AccessSpec *l) { apply("visit_list", l);} virtual void visit_access_decl(AccessDecl *l) { apply("visit_list", l);} virtual void visit_user_access_spec(UserAccessSpec *l) { apply("visit_list", l);} virtual void visit_if_statement(IfStatement *l) { apply("visit_list", l);} virtual void visit_switch_statement(SwitchStatement *l) { apply("visit_list", l);} virtual void visit_while_statement(WhileStatement *l) { apply("visit_list", l);} virtual void visit_do_statement(DoStatement *l) { apply("visit_list", l);} virtual void visit_for_statement(ForStatement *l) { apply("visit_list", l);} virtual void visit_try_statement(TryStatement *l) { apply("visit_list", l);} virtual void visit_break_statement(BreakStatement *l) { apply("visit_list", l);} virtual void visit_continue_statement(ContinueStatement *l) { apply("visit_list", l);} virtual void visit_return_statement(ReturnStatement *l) { apply("visit_list", l);} virtual void visit_goto_statement(GotoStatement *l) { apply("visit_list", l);} virtual void visit_case_statement(CaseStatement *l) { apply("visit_list", l);} virtual void visit_default_statement(DefaultStatement *l) { apply("visit_list", l);} virtual void visit_label_statement(LabelStatement *l) { apply("visit_list", l);} virtual void visit_expr_statement(ExprStatement *l) { apply("visit_list", l);} virtual void visit_expression(Expression *l) { apply("visit_list", l);} virtual void visit_assign_expr(AssignExpr *l) { apply("visit_list", l);} virtual void visit_cond_expr(CondExpr *l) { apply("visit_list", l);} virtual void visit_infix_expr(InfixExpr *l) { apply("visit_list", l);} virtual void visit_pm_expr(PmExpr *l) { apply("visit_list", l);} virtual void visit_cast_expr(CastExpr *l) { apply("visit_list", l);} virtual void visit_unary_expr(UnaryExpr *l) { apply("visit_list", l);} virtual void visit_throw_expr(ThrowExpr *l) { apply("visit_list", l);} virtual void visit_sizeof_expr(SizeofExpr *l) { apply("visit_list", l);} virtual void visit_typeid_expr(TypeidExpr *l) { apply("visit_list", l);} virtual void visit_typeof_expr(TypeofExpr *l) { apply("visit_list", l);} virtual void visit_new_expr(NewExpr *l) { apply("visit_list", l);} virtual void visit_delete_expr(DeleteExpr *l) { apply("visit_list", l);} virtual void visit_array_expr(ArrayExpr *l) { apply("visit_list", l);} virtual void visit_funcall_expr(FuncallExpr *l) { apply("visit_list", l);} virtual void visit_postfix_expr(PostfixExpr *l) { apply("visit_list", l);} virtual void visit_dot_member_expr(DotMemberExpr *l) { apply("visit_list", l);} virtual void visit_arrow_member_expr(ArrowMemberExpr *l) { apply("visit_list", l);} virtual void visit_paren_expr(ParenExpr *l) { apply("visit_list", l);} virtual void visit(Node *n) { apply("visit_node", n);} virtual void visit(Atom *n) { apply("visit_atom", n);} virtual void visit(List* n) { apply("visit_list", n);} virtual void visit(Literal *n) { apply("visit_literal", n);} virtual void visit(CommentedAtom *n) { apply("visit_commented_atom", n);} virtual void visit(DupAtom *n) { apply("visit_dup_atom", n);} virtual void visit(Identifier *n) { apply("visit_identifier", n);} virtual void visit(Keyword *n) { apply("visit_keyword", n);} // virtual void visit(This *n) { apply("visit_this", n);} // virtual void visit(Kwd::Auto *n) { apply("visit_auto", n);} // virtual void visit(Kwd::Bool *n) { apply("visit_boolean", n);} // virtual void visit(Kwd::Char *n) { apply("visit_char", n);} // virtual void visit(Kwd::WChar *n) { apply("visit_wchar", n);} // virtual void visit(Kwd::Const *n) { apply("visit_const", n);} // virtual void visit(Kwd::Double *n) { apply("visit_double", n);} // virtual void visit(Kwd::Extern *n) { apply("visit_extern", n);} // virtual void visit(Kwd::Float *n) { apply("visit_float", n);} // virtual void visit(Kwd::Friend *n) { apply("visit_friend", n);} // virtual void visit(Kwd::Inline *n) { apply("visit_inline", n);} // virtual void visit(Kwd::Int *n) { apply("visit_int", n);} // virtual void visit(Kwd::Long *n) { apply("visit_long", n);} // virtual void visit(Kwd::Mutable *n) { apply("visit_mutable", n);} // virtual void visit(Kwd::Namespace *n) { apply("visit_namespace", n);} // virtual void visit(Kwd::Private *n) { apply("visit_private", n);} // virtual void visit(Kwd::Protected *n) { apply("visit_protected", n);} // virtual void visit(Kwd::Public *n) { apply("visit_public", n);} // virtual void visit(Kwd::Register *n) { apply("visit_register", n);} // virtual void visit(Kwd::Short *n) { apply("visit_short", n);} // virtual void visit(Kwd::Signed *n) { apply("visit_signed", n);} // virtual void visit(Kwd::Static *n) { apply("visit_static", n);} // virtual void visit(Kwd::Unsigned *n) { apply("visit_unsigned", n);} // virtual void visit(Kwd::Using *n) { apply("visit_using_", n);} // virtual void visit(Kwd::Virtual *n) { apply("visit_virtual", n);} // virtual void visit(Kwd::Void *n) { apply("visit_void", n);} // virtual void visit(Kwd::Volatile *n) { apply("visit_volatile", n);} virtual void visit(Brace *n) { apply("visit_brace", n);} virtual void visit(Block *n) { apply("visit_block", n);} virtual void visit(ClassBody *n) { apply("visit_class_body", n);} virtual void visit(Typedef *n) { apply("visit_typedef", n);} virtual void visit(TemplateDecl *n) { apply("visit_template_decl", n);} virtual void visit(TemplateInstantiation *n) { apply("visit_template_instantiation", n);} virtual void visit(ExternTemplate *n) { apply("visit_extern_template", n);} virtual void visit(MetaclassDecl *n) { apply("visit_metaclass_decl", n);} virtual void visit(LinkageSpec *n) { apply("visit_linkage_spec", n);} virtual void visit(NamespaceSpec *n) { apply("visit_namespace_spec", n);} virtual void visit(NamespaceAlias *n) { apply("visit_namespace_alias", n);} virtual void visit(UsingDirective *n) { apply("visit_using_directive", n);} virtual void visit(Declaration *n) { apply("visit_declaration", n);} virtual void visit(FunctionDefinition *n) { apply("visit_function_definition", n);} virtual void visit(ParameterDeclaration *n) { apply("visit_parameter_declaration", n);} virtual void visit(UsingDeclaration *n) { apply("visit_using_declaration", n);} virtual void visit(Declarator *n) { apply("visit_declarator", n);} virtual void visit(Name *n) { apply("visit_name", n);} virtual void visit(FstyleCastExpr *n) { apply("visit_fstyle_cast_expr", n);} virtual void visit(ClassSpec *n) { apply("visit_class_spec", n);} virtual void visit(EnumSpec *n) { apply("visit_enum_spec", n);} virtual void visit(AccessSpec *n) { apply("visit_access_spec", n);} virtual void visit(AccessDecl *n) { apply("visit_access_decl", n);} virtual void visit(UserAccessSpec *n) { apply("visit_user_access_spec", n);} virtual void visit(IfStatement *n) { apply("visit_if_statement", n);} virtual void visit(SwitchStatement *n) { apply("visit_switch_statement", n);} virtual void visit(WhileStatement *n) { apply("visit_while_statement", n);} virtual void visit(DoStatement *n) { apply("visit_do_statement", n);} virtual void visit(ForStatement *n) { apply("visit_for_statement", n);} virtual void visit(TryStatement *n) { apply("visit_try_statement", n);} virtual void visit(BreakStatement *n) { apply("visit_break_statement", n);} virtual void visit(ContinueStatement *n) { apply("visit_continue_statement", n);} virtual void visit(ReturnStatement *n) { apply("visit_return_statement", n);} virtual void visit(GotoStatement *n) { apply("visit_goto_statement", n);} virtual void visit(CaseStatement *n) { apply("visit_case_statement", n);} virtual void visit(DefaultStatement *n) { apply("visit_default_statement", n);} virtual void visit(LabelStatement *n) { apply("visit_label_statement", n);} virtual void visit(ExprStatement *n) { apply("visit_expr_statement", n);} virtual void visit(Expression *n) { apply("visit_expression", n);} virtual void visit(AssignExpr *n) { apply("visit_assign_expr", n);} virtual void visit(CondExpr *n) { apply("visit_cond_expr", n);} virtual void visit(InfixExpr *n) { apply("visit_infix_expr", n);} virtual void visit(PmExpr *n) { apply("visit_pm_expr", n);} virtual void visit(CastExpr *n) { apply("visit_cast_expr", n);} virtual void visit(UnaryExpr *n) { apply("visit_unary_expr", n);} virtual void visit(ThrowExpr *n) { apply("visit_throw_expr", n);} virtual void visit(SizeofExpr *n) { apply("visit_sizeof_expr", n);} virtual void visit(TypeidExpr *n) { apply("visit_typeid_expr", n);} virtual void visit(TypeofExpr *n) { apply("visit_typeof_expr", n);} virtual void visit(NewExpr *n) { apply("visit_new_expr", n);} virtual void visit(DeleteExpr *n) { apply("visit_delete_expr", n);} virtual void visit(ArrayExpr *n) { apply("visit_array_expr", n);} virtual void visit(FuncallExpr *n) { apply("visit_funcall_expr", n);} virtual void visit(PostfixExpr *n) { apply("visit_postfix_expr", n);} virtual void visit(DotMemberExpr *n) { apply("visit_dot_member_expr", n);} virtual void visit(ArrowMemberExpr *n) { apply("visit_arrow_member_expr", n);} virtual void visit(ParenExpr *n) { apply("visit_paren_expr", n);} private: void apply(char const *f, Node* n) { bpl::call_method(self, f, bpl::ptr(n));} PyObject *self; }; std::string as_string(Encoding const &e) { std::ostringstream oss; oss << e; return oss.str(); } void accept(Node *n, Visitor *v) { n->accept(v);} std::string atom_value(Atom *a) { return std::string(a->position(), a->length());} Node *car(List *l) { return l->car();} Node *cdr(List *l) { return l->cdr();} Node *first_(List *l) { return PTree::first(l);} Node *second_(List *l) { return PTree::second(l);} Node *third_(List *l) { return PTree::third(l);} Node *nth_(List *l, size_t k) { return PTree::nth(l, k);} Node *rest_(List *l) { return PTree::rest(l);} Node *tail_(List *l, size_t k) { return PTree::tail(l, k);} } BOOST_PYTHON_MODULE(PTree) { bpl::class_ encoding("Encoding"); encoding.def("__str__", as_string); encoding.def("unmangled", &Encoding::unmangled); encoding.add_property("is_simple_name", &Encoding::is_simple_name); encoding.add_property("is_global_scope", &Encoding::is_global_scope); encoding.add_property("is_qualified", &Encoding::is_qualified); encoding.add_property("is_function", &Encoding::is_function); encoding.add_property("is_template", &Encoding::is_template); bpl::class_ visitor("Visitor"); visitor.def("visit_node", &VisitorWrapper::visit_node); visitor.def("visit_atom", &VisitorWrapper::visit_atom); visitor.def("visit_list", &VisitorWrapper::visit_list); visitor.def("visit_literal", &VisitorWrapper::visit_literal); visitor.def("visit_commented_atom", &VisitorWrapper::visit_commented_atom); visitor.def("visit_dup_atom", &VisitorWrapper::visit_dup_atom); visitor.def("visit_identifier", &VisitorWrapper::visit_identifier); visitor.def("visit_keyword", &VisitorWrapper::visit_keyword); // visitor.def("visit_this", &VisitorWrapper::visit_this); // visitor.def("visit_auto", &VisitorWrapper::visit_auto); // visitor.def("visit_boolean", &VisitorWrapper::visit_boolean); // visitor.def("visit_char", &VisitorWrapper::visit_char); // visitor.def("visit_wchar", &VisitorWrapper::visit_wchar); // visitor.def("visit_const", &VisitorWrapper::visit_const); // visitor.def("visit_double", &VisitorWrapper::visit_double); // visitor.def("visit_extern", &VisitorWrapper::visit_extern); // visitor.def("visit_float", &VisitorWrapper::visit_float); // visitor.def("visit_friend", &VisitorWrapper::visit_friend); // visitor.def("visit_inline", &VisitorWrapper::visit_inline); // visitor.def("visit_int", &VisitorWrapper::visit_int); // visitor.def("visit_long", &VisitorWrapper::visit_long); // visitor.def("visit_mutable", &VisitorWrapper::visit_mutable); // visitor.def("visit_namespace", &VisitorWrapper::visit_namespace); // visitor.def("visit_private", &VisitorWrapper::visit_private); // visitor.def("visit_protected", &VisitorWrapper::visit_protected); // visitor.def("visit_public", &VisitorWrapper::visit_public); // visitor.def("visit_register", &VisitorWrapper::visit_register); // visitor.def("visit_short", &VisitorWrapper::visit_short); // visitor.def("visit_signed", &VisitorWrapper::visit_signed); // visitor.def("visit_static", &VisitorWrapper::visit_static); // visitor.def("visit_unsigned", &VisitorWrapper::visit_unsigned); // visitor.def("visit_using_", &VisitorWrapper::visit_using_); // visitor.def("visit_virtual", &VisitorWrapper::visit_virtual); // visitor.def("visit_void", &VisitorWrapper::visit_void); // visitor.def("visit_volatile", &VisitorWrapper::visit_volatile); visitor.def("visit_brace", &VisitorWrapper::visit_brace); visitor.def("visit_block", &VisitorWrapper::visit_block); visitor.def("visit_class_body", &VisitorWrapper::visit_class_body); visitor.def("visit_typedef", &VisitorWrapper::visit_typedef); visitor.def("visit_template_decl", &VisitorWrapper::visit_template_decl); visitor.def("visit_template_instantiation", &VisitorWrapper::visit_template_instantiation); visitor.def("visit_extern_template", &VisitorWrapper::visit_extern_template); visitor.def("visit_metaclass_decl", &VisitorWrapper::visit_metaclass_decl); visitor.def("visit_linkage_spec", &VisitorWrapper::visit_linkage_spec); visitor.def("visit_namespace_spec", &VisitorWrapper::visit_namespace_spec); visitor.def("visit_namespace_alias", &VisitorWrapper::visit_namespace_alias); visitor.def("visit_using_directive", &VisitorWrapper::visit_using_directive); visitor.def("visit_declaration", &VisitorWrapper::visit_declaration); visitor.def("visit_parameter_declaration", &VisitorWrapper::visit_parameter_declaration); visitor.def("visit_using_declaration", &VisitorWrapper::visit_using_declaration); visitor.def("visit_declarator", &VisitorWrapper::visit_declarator); visitor.def("visit_name", &VisitorWrapper::visit_name); visitor.def("visit_fstyle_cast_expr", &VisitorWrapper::visit_fstyle_cast_expr); visitor.def("visit_class_spec", &VisitorWrapper::visit_class_spec); visitor.def("visit_enum_spec", &VisitorWrapper::visit_enum_spec); visitor.def("visit_access_spec", &VisitorWrapper::visit_access_spec); visitor.def("visit_access_decl", &VisitorWrapper::visit_access_decl); visitor.def("visit_user_access_spec", &VisitorWrapper::visit_user_access_spec); visitor.def("visit_if_statement", &VisitorWrapper::visit_if_statement); visitor.def("visit_switch_statement", &VisitorWrapper::visit_switch_statement); visitor.def("visit_while_statement", &VisitorWrapper::visit_while_statement); visitor.def("visit_do_statement", &VisitorWrapper::visit_do_statement); visitor.def("visit_for_statement", &VisitorWrapper::visit_for_statement); visitor.def("visit_try_statement", &VisitorWrapper::visit_try_statement); visitor.def("visit_break_statement", &VisitorWrapper::visit_break_statement); visitor.def("visit_continue_statement", &VisitorWrapper::visit_continue_statement); visitor.def("visit_return_statement", &VisitorWrapper::visit_return_statement); visitor.def("visit_goto_statement", &VisitorWrapper::visit_goto_statement); visitor.def("visit_case_statement", &VisitorWrapper::visit_case_statement); visitor.def("visit_default_statement", &VisitorWrapper::visit_default_statement); visitor.def("visit_label_statement", &VisitorWrapper::visit_label_statement); visitor.def("visit_expr_statement", &VisitorWrapper::visit_expr_statement); visitor.def("visit_expression", &VisitorWrapper::visit_expression); visitor.def("visit_assign_expr", &VisitorWrapper::visit_assign_expr); visitor.def("visit_cond_expr", &VisitorWrapper::visit_cond_expr); visitor.def("visit_infix_expr", &VisitorWrapper::visit_infix_expr); visitor.def("visit_pm_expr", &VisitorWrapper::visit_pm_expr); visitor.def("visit_cast_expr", &VisitorWrapper::visit_cast_expr); visitor.def("visit_unary_expr", &VisitorWrapper::visit_unary_expr); visitor.def("visit_throw_expr", &VisitorWrapper::visit_throw_expr); visitor.def("visit_sizeof_expr", &VisitorWrapper::visit_sizeof_expr); visitor.def("visit_typeid_expr", &VisitorWrapper::visit_typeid_expr); visitor.def("visit_typeof_expr", &VisitorWrapper::visit_typeof_expr); visitor.def("visit_new_expr", &VisitorWrapper::visit_new_expr); visitor.def("visit_delete_expr", &VisitorWrapper::visit_delete_expr); visitor.def("visit_array_expr", &VisitorWrapper::visit_array_expr); visitor.def("visit_funcall_expr", &VisitorWrapper::visit_funcall_expr); visitor.def("visit_postfix_expr", &VisitorWrapper::visit_postfix_expr); visitor.def("visit_dot_member_expr", &VisitorWrapper::visit_dot_member_expr); visitor.def("visit_arrow_member_expr", &VisitorWrapper::visit_arrow_member_expr); visitor.def("visit_paren_expr", &VisitorWrapper::visit_paren_expr); bpl::class_ node("Node", bpl::no_init); // no idea why we can't pass &Node::accept here, but if we do, // the registry will complain that there is no lvalue conversion... node.def("accept", accept); bpl::class_, Atom *, boost::noncopyable> atom("Atom", bpl::no_init); atom.def("__str__", atom_value); atom.add_property("position", &Atom::position); atom.add_property("length", &Atom::length); bpl::class_, List *, boost::noncopyable> list("List", bpl::no_init); // The PTree module uses garbage collection so just ignore memory management, // at least for now. list.def("car", car, bpl::return_value_policy()); list.def("cdr", cdr, bpl::return_value_policy()); list.def("first", first_, bpl::return_value_policy()); list.def("second", second_, bpl::return_value_policy()); list.def("third", third_, bpl::return_value_policy()); list.def("nth", nth_, bpl::return_value_policy()); list.def("rest", rest_, bpl::return_value_policy()); list.def("tail", tail_, bpl::return_value_policy()); list.add_property("name", &List::encoded_name); list.add_property("type", &List::encoded_type); // various atoms bpl::class_, Literal *, boost::noncopyable> literal("Literal", bpl::no_init); bpl::class_, CommentedAtom *, boost::noncopyable> comment_atom("CommentedAtom", bpl::no_init); bpl::class_, DupAtom *, boost::noncopyable> dup_atom("DupAtom", bpl::no_init); bpl::class_, Identifier *, boost::noncopyable> identifier("Identifier", bpl::no_init); bpl::class_, Keyword *, boost::noncopyable> reserved("Keyword", bpl::no_init); // bpl::class_, This *, boost::noncopyable> this_("This", bpl::no_init); // bpl::class_, AtomAUTO *, boost::noncopyable> atom_auto("AtomAUTO", bpl::no_init); // bpl::class_, AtomBOOLEAN *, boost::noncopyable> atom_boolean("AtomBOOLEAN", bpl::no_init); // bpl::class_, AtomCHAR *, boost::noncopyable> atom_char("AtomCHAR", bpl::no_init); // bpl::class_, AtomWCHAR *, boost::noncopyable> atom_wchar("AtomWCHAR", bpl::no_init); // bpl::class_, AtomCONST *, boost::noncopyable> atom_const("AtomCONST", bpl::no_init); // bpl::class_, AtomDOUBLE *, boost::noncopyable> atom_double("AtomDOUBLE", bpl::no_init); // bpl::class_, AtomEXTERN *, boost::noncopyable> atom_extern("AtomEXTERN", bpl::no_init); // bpl::class_, AtomFLOAT *, boost::noncopyable> atom_float("AtomFLOAT", bpl::no_init); // bpl::class_, AtomFRIEND *, boost::noncopyable> atom_friend("AtomFRIEND", bpl::no_init); // bpl::class_, AtomINLINE *, boost::noncopyable> atom_inline("AtomINLINE", bpl::no_init); // bpl::class_, AtomINT *, boost::noncopyable> atom_int("AtomINT", bpl::no_init); // bpl::class_, AtomLONG *, boost::noncopyable> atom_long("AtomLONG", bpl::no_init); // bpl::class_, AtomMUTABLE *, boost::noncopyable> atom_mutable("AtomMUTABLE", bpl::no_init); // bpl::class_, AtomNAMESPACE *, boost::noncopyable> atom_namespace("AtomNAMESPACE", bpl::no_init); // bpl::class_, AtomPRIVATE *, boost::noncopyable> atom_private("AtomPRIVATE", bpl::no_init); // bpl::class_, AtomPROTECTED *, boost::noncopyable> atom_protected("AtomPROTECTED", bpl::no_init); // bpl::class_, AtomPUBLIC *, boost::noncopyable> atom_public("AtomPUBLIC", bpl::no_init); // bpl::class_, AtomREGISTER *, boost::noncopyable> atom_register("AtomREGISTER", bpl::no_init); // bpl::class_, AtomSHORT *, boost::noncopyable> atom_short("AtomSHORT", bpl::no_init); // bpl::class_, AtomSIGNED *, boost::noncopyable> atom_signed("AtomSIGNED", bpl::no_init); // bpl::class_, AtomSTATIC *, boost::noncopyable> atom_static("AtomSTATIC", bpl::no_init); // bpl::class_, AtomUNSIGNED *, boost::noncopyable> atom_unsigned("AtomUNSIGNED", bpl::no_init); // bpl::class_, AtomUSING *, boost::noncopyable> atom_using("AtomUSING", bpl::no_init); // bpl::class_, AtomVIRTUAL *, boost::noncopyable> atom_virtual("AtomVIRTUAL", bpl::no_init); // bpl::class_, AtomVOID *, boost::noncopyable> atom_void("AtomVOID", bpl::no_init); // bpl::class_, AtomVOLATILE *, boost::noncopyable> atom_volatile("AtomVOLATILE", bpl::no_init); // bpl::class_, AtomUserKeyword2 *, boost::noncopyable> atom_user_kwd2("AtomUserKeyword2", bpl::no_init); // various lists bpl::class_, Brace *, boost::noncopyable> brace("Brace", bpl::no_init); bpl::class_, Block *, boost::noncopyable> block("Block", bpl::no_init); bpl::class_, ClassBody *, boost::noncopyable> class_body("ClassBody", bpl::no_init); bpl::class_, Typedef *, boost::noncopyable> typedef_("Typedef", bpl::no_init); bpl::class_, TemplateDecl *, boost::noncopyable> template_decl("TemplateDecl", bpl::no_init); bpl::class_, TemplateInstantiation *, boost::noncopyable> template_instantiation("TemplateInstantiation", bpl::no_init); bpl::class_, ExternTemplate *, boost::noncopyable> extern_template("ExternTemplate", bpl::no_init); bpl::class_, MetaclassDecl *, boost::noncopyable> meta_class_decl("MetaclassDecl", bpl::no_init); bpl::class_, LinkageSpec *, boost::noncopyable> linkage_spec("LinkageSpec", bpl::no_init); bpl::class_, NamespaceSpec *, boost::noncopyable> namespace_spec("NamespaceSpec", bpl::no_init); bpl::class_, Declaration *, boost::noncopyable> declaration("Declaration", bpl::no_init); bpl::class_, NamespaceAlias *, boost::noncopyable> namespace_alias("NamespaceAlias", bpl::no_init); bpl::class_, UsingDirective *, boost::noncopyable> using_directive("UsingDirective", bpl::no_init); bpl::class_, UsingDeclaration *, boost::noncopyable> using_declaration("UsingDeclaration", bpl::no_init); bpl::class_, FunctionDefinition *, boost::noncopyable> function_definition("FunctionDefinition", bpl::no_init); bpl::class_, ParameterDeclaration *, boost::noncopyable> parameter_declaration("ParameterDeclaration", bpl::no_init); bpl::class_, Declarator *, boost::noncopyable> declarator("Declarator", bpl::no_init); declarator.add_property("initializer", bpl::make_function(&Declarator::initializer, bpl::return_internal_reference<>())); bpl::class_, Name *, boost::noncopyable> name("Name", bpl::no_init); bpl::class_, FstyleCastExpr *, boost::noncopyable> fstyle_cast_expr("FstyleCastExpr", bpl::no_init); bpl::class_, ClassSpec *, boost::noncopyable> class_spec("ClassSpec", bpl::no_init); bpl::class_, EnumSpec *, boost::noncopyable> enum_spec("EnumSpec", bpl::no_init); bpl::class_, AccessSpec *, boost::noncopyable> access_spec("AccessSpec", bpl::no_init); bpl::class_, AccessDecl *, boost::noncopyable> access_decl("AccessDecl", bpl::no_init); bpl::class_, UserAccessSpec *, boost::noncopyable> user_access_spec("UserAccessSpec", bpl::no_init); bpl::class_, UserdefKeyword *, boost::noncopyable> user_def_kwd("UserdefKeyword", bpl::no_init); // statements bpl::class_, IfStatement *, boost::noncopyable> if_statement("IfStatement", bpl::no_init); bpl::class_, SwitchStatement *, boost::noncopyable> switch_statement("SwitchStatement", bpl::no_init); bpl::class_, WhileStatement *, boost::noncopyable> while_statement("WhileStatement", bpl::no_init); bpl::class_, DoStatement *, boost::noncopyable> do_statement("DoStatement", bpl::no_init); bpl::class_, ForStatement *, boost::noncopyable> for_statement("ForStatement", bpl::no_init); bpl::class_, TryStatement *, boost::noncopyable> try_statement("TryStatement", bpl::no_init); bpl::class_, BreakStatement *, boost::noncopyable> break_statement("BreakStatement", bpl::no_init); bpl::class_, ContinueStatement *, boost::noncopyable> continue_statement("ContinueStatement", bpl::no_init); bpl::class_, ReturnStatement *, boost::noncopyable> return_statement("ReturnStatement", bpl::no_init); bpl::class_, GotoStatement *, boost::noncopyable> goto_statement("GotoStatement", bpl::no_init); bpl::class_, CaseStatement *, boost::noncopyable> case_statement("CaseStatement", bpl::no_init); bpl::class_, DefaultStatement *, boost::noncopyable> default_statement("DefaultStatement", bpl::no_init); bpl::class_, LabelStatement *, boost::noncopyable> label_statement("LabelStatement", bpl::no_init); bpl::class_, ExprStatement *, boost::noncopyable> expr_statement("ExprStatement", bpl::no_init); // expressions bpl::class_, Expression *, boost::noncopyable> expression("Expression", bpl::no_init); bpl::class_, AssignExpr *, boost::noncopyable> assign_expr("AssignExpr", bpl::no_init); bpl::class_, CondExpr *, boost::noncopyable> cond_expr("CondExpr", bpl::no_init); bpl::class_, InfixExpr *, boost::noncopyable> infix_expr("InfixExpr", bpl::no_init); bpl::class_, PmExpr *, boost::noncopyable> pm_expr("PmExpr", bpl::no_init); bpl::class_, CastExpr *, boost::noncopyable> cast_expr("CastExpr", bpl::no_init); bpl::class_, UnaryExpr *, boost::noncopyable> unary_expr("UnaryExpr", bpl::no_init); bpl::class_, ThrowExpr *, boost::noncopyable> throw_expr("ThrowExpr", bpl::no_init); bpl::class_, SizeofExpr *, boost::noncopyable> sizeof_expr("SizeofExpr", bpl::no_init); bpl::class_, TypeidExpr *, boost::noncopyable> typeid_expr("TypeidExpr", bpl::no_init); bpl::class_, TypeofExpr *, boost::noncopyable> typeof_expr("TypeofExpr", bpl::no_init); bpl::class_, NewExpr *, boost::noncopyable> new_expr("NewExpr", bpl::no_init); bpl::class_, DeleteExpr *, boost::noncopyable> delete_expr("DeleteExpr", bpl::no_init); bpl::class_, ArrayExpr *, boost::noncopyable> array_expr("ArrayExpr", bpl::no_init); bpl::class_, FuncallExpr *, boost::noncopyable> funcall_expr("FuncallExpr", bpl::no_init); bpl::class_, PostfixExpr *, boost::noncopyable> postfix_expr("PostfixExpr", bpl::no_init); bpl::class_, UserStatementExpr *, boost::noncopyable> user_statement_expr("UserStatementExpr", bpl::no_init); bpl::class_, DotMemberExpr *, boost::noncopyable> dot_member_expr("DotMemberExpr", bpl::no_init); bpl::class_, ArrowMemberExpr *, boost::noncopyable> arrow_member_expr("ArrowMemberExpr", bpl::no_init); bpl::class_, ParenExpr *, boost::noncopyable> paren_expr("ParenExpr", bpl::no_init); bpl::class_, StaticUserStatementExpr *, boost::noncopyable> static_user_statement_expr("StaticUserStatementExpr", bpl::no_init); } synopsis-0.12/sandbox/bpl/functions.cc0000664000076400007640000000017511104702610017404 0ustar stefanstefanclass Foo { public: Foo() { init();} private: void init(); }; void Foo::init() { } Foo *bar() { return new Foo(); } synopsis-0.12/sandbox/bpl/SymbolLookup.cc0000664000076400007640000000725011104702610020034 0ustar stefanstefan// // Copyright (C) 2005 Stefan Seefeld // All rights reserved. // Licensed to the public under the terms of the GNU LGPL (>= 2), // see the file COPYING for details. // #include #include namespace bpl = boost::python; using namespace Synopsis; using namespace Synopsis::SymbolLookup; namespace { SymbolSet lookup_symbol(Scope const *scope, PTree::Encoding const &enc) { return scope->lookup(enc); } } BOOST_PYTHON_MODULE(SymbolLookup) { bpl::class_ symbol_set("SymbolSet"); bpl::class_ scope("Scope", bpl::no_init); scope.def("outer_scope", &Scope::outer_scope, bpl::return_value_policy()); scope.def("global_scope", &Scope::global_scope, bpl::return_value_policy()); scope.def("lookup", lookup_symbol); bpl::class_ symbol("Symbol", bpl::no_init); symbol.add_property("type", bpl::make_function(&Symbol::type, bpl::return_internal_reference<>())); // FIXME: find appropriate return value policy symbol.add_property("scope", bpl::make_function(&Symbol::scope, bpl::return_value_policy())); // FIXME: should probably rename Symbol::ptree to Symbol::declarator, too symbol.add_property("declarator", bpl::make_function(&Symbol::ptree, bpl::return_value_policy())); // symbols bpl::class_, VariableName *, boost::noncopyable> variable_name("VariableName", bpl::no_init); bpl::class_, ConstName *, boost::noncopyable> const_name("ConstName", bpl::no_init); // FIXME: should probably rename ConstName::defined to ConstName::is_defined, too const_name.def("is_defined", &ConstName::defined); const_name.add_property("value", &ConstName::value); bpl::class_, TypeName *, boost::noncopyable> type_name("TypeName", bpl::no_init); bpl::class_, TypedefName *, boost::noncopyable> typedef_name("TypedefName", bpl::no_init); bpl::class_, ClassTemplateName *, boost::noncopyable> class_tmpl_name("ClassTemplateName", bpl::no_init); bpl::class_, FunctionName *, boost::noncopyable> function_name("FunctionName", bpl::no_init); bpl::class_, FunctionTemplateName *, boost::noncopyable> function_tmpl_name("FunctionTemplateName", bpl::no_init); bpl::class_, NamespaceName *, boost::noncopyable> namespace_name("NamespaceName", bpl::no_init); // scopes bpl::class_, TemplateParameterScope *, boost::noncopyable> template_parameter_scope("TemplateParameterScope", bpl::no_init); bpl::class_, LocalScope *, boost::noncopyable> local_scope("LocalScope", bpl::no_init); bpl::class_, FunctionScope *, boost::noncopyable> function_scope("FunctionScope", bpl::no_init); bpl::class_, PrototypeScope *, boost::noncopyable> prototype_scope("PrototypeScope", bpl::no_init); bpl::class_, Class *, boost::noncopyable> class_("Class", bpl::no_init); bpl::class_, Namespace *, boost::noncopyable> namespace_("Namespace", bpl::no_init); } synopsis-0.12/sandbox/bpl/dump-ptree.py0000664000076400007640000000074411104702610017523 0ustar stefanstefan#! /usr/bin/env python import os, os.path, sys sys.path.insert(0, os.getcwd()) import PTree import Processor class Walker(PTree.Visitor): def visit_atom(self, a): print a def visit_list(self, l): if l.car(): l.car().accept(self) if l.cdr(): l.cdr().accept(self) test = os.path.join(os.path.dirname(__file__), 'test.cc') buffer = Processor.Buffer(test) ptree = Processor.parse(buffer) walker = Walker() ptree.accept(walker) synopsis-0.12/sandbox/bpl/Makefile.in0000664000076400007640000000235711104702610017136 0ustar stefanstefan# # Copyright (C) 2005 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # SHELL := /bin/sh srcdir := @srcdir@ builddir:= @builddir@ PYTHON := @PYTHON@ SYNOPSIS:= $(PYTHON) synopsis.py CXX := @CXX@ MAKEDEP := $(CXX) -M CPPFLAGS:= -I $(srcdir) -I . CPPFLAGS+= @SYN_CPP@ -I @PYTHON_INCLUDE@ @CPPFLAGS@ CXXFLAGS:= @CXXFLAGS@ LDFLAGS := @LDFLAGS@ LIBS := @SYN_LIBS@ -lboost_python @LIBS@ LIBRARY_EXT := @LIBEXT@ MODULES := PTree SymbolLookup Processor DEP := $(patsubst %, %.d, $(MODULES)) TARGETS := $(patsubst %, %.so, $(MODULES)) vpath %.cc $(srcdir) all: $(TARGETS) %.so: %.o @echo linking $(@F) $(CXX) -shared $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) strip --strip-unneeded $@ %.d: %.cc @echo generating dependencies for $( $@' %.o: %.cc @echo compiling $(@F) $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< Makefile: $(srcdir)/Makefile.in $(SHELL) -ec 'cd .. && ./config.status --file bpl/Makefile' clean : rm -f *~ *.o *.d \ *.dll *.so *core \ *.pyc *.pyo base_lib ifeq (,$(filter $(MAKECMDGOALS), depend clean distclean)) -include $(DEP) endif synopsis-0.12/sandbox/configure0000775000076400007640000046263311171624016016241 0ustar stefanstefan#! /bin/sh # From configure.ac Revision: 1.9 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for sandbox 1.0. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='sandbox' PACKAGE_TARNAME='sandbox' PACKAGE_VERSION='1.0' PACKAGE_STRING='sandbox 1.0' PACKAGE_BUGREPORT='synopsis-devel@fresco.org' ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP CXX CXXFLAGS ac_ct_CXX SYN_CPP SYN_LIBS PYTHON PYTHON_INCLUDE LIBEXT LDSHARED BOOST_VERSION BOOST_CPPFLAGS BOOST_LDFLAGS BOOST_LIBS LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP CXX CXXFLAGS CCC' # 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. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_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 ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_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'` 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 ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_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'` 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; }; } 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 directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $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 test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures sandbox 1.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/sandbox] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of sandbox 1.0:";; esac cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-syn-cxx=PATH specify the Synopsis C++ library prefix --with-python=PATH specify the Python interpreter --with-boost-prefix=PREFIX specify boost installation prefix --with-boost-version=VERSION specify boost version --with-boost-lib-suffix=list use the given list of suffixes when searching for boost libraries. Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF sandbox configure 1.0 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by sandbox $as_me 1.0, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file 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 $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { 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 # Check whether --with-syn-cxx was given. if test "${with_syn_cxx+set}" = set; then withval=$with_syn_cxx; SYN_CXX="$with_syn_cxx" else SYN_CXX="/usr/local" 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { 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` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then 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 # Check that 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' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 that 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 { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { 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 ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { 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.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { 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` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { 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 ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { 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 g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { 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 if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { 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 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 SYN_CPP="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --cflags synopsis-uninstalled`" SYN_LIBS="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --libs synopsis-uninstalled`" { echo "$as_me:$LINENO: checking for python extension module build information" >&5 echo $ECHO_N "checking for python extension module build information... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: " >&5 echo "${ECHO_T}" >&6; } # Check whether --with-python was given. if test "${with_python+set}" = set; then withval=$with_python; PYTHON="$with_python" else PYTHON="python" fi if test -n "$PYTHON" -a "$PYTHON" != yes; then # Extract the first word of "$PYTHON", so it can be a program name with args. set dummy $PYTHON; 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_PYTHON+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$PYTHON"; then ac_cv_prog_PYTHON="$PYTHON" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PYTHON="{ { echo "$as_me:$LINENO: error: Cannot find Python interpreter" >&5 echo "$as_me: error: Cannot find Python interpreter" >&2;} { (exit 1); exit 1; }; }" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PYTHON=$ac_cv_prog_PYTHON if test -n "$PYTHON"; then { echo "$as_me:$LINENO: result: $PYTHON" >&5 echo "${ECHO_T}$PYTHON" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi else # Extract the first word of "python2 python", so it can be a program name with args. set dummy python2 python; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_PYTHON+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $PYTHON in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_PYTHON" && ac_cv_path_PYTHON="python" ;; esac fi PYTHON=$ac_cv_path_PYTHON if test -n "$PYTHON"; then { echo "$as_me:$LINENO: result: $PYTHON" >&5 echo "${ECHO_T}$PYTHON" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi PYTHON_PREFIX=`$PYTHON -c "import sys; print(sys.prefix)" | tr -d "\r"` { echo "$as_me:$LINENO: checking for Python development environment" >&5 echo $ECHO_N "checking for Python development environment... $ECHO_C" >&6; } PYTHON_INCLUDE=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_inc())" | tr -d "\r"` PYTHON_H=`$PYTHON -c "from os.path import *; h = join('$PYTHON_INCLUDE', 'Python.h'); print(exists(h) and h or '')"` if test $PYTHON_H then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else { { echo "$as_me:$LINENO: error: Python.h not found." >&5 echo "$as_me: error: Python.h not found." >&2;} { (exit 1); exit 1; }; } fi LIBEXT=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_var('SO'))" | tr -d "\r"` case `uname -s` in CYGWIN*) if test `$PYTHON -c "import os; print(os.name)" | tr -d "\r"` = posix; then PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d'%(sys.version_info[0],sys.version_info[1]))"` PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" PYTHON_DEP_LIBS=`$PYTHON -c "from distutils import sysconfig; import re; print(re.sub(r'\\s*-lutil', '', sysconfig.get_config_var('LIBS') or ''))"` else if test "$CXX" = "g++"; then CPPFLAGS="$CPPFLAGS -D PARSE_MSVC" CFLAGS="-mno-cygwin $CFLAGS" CXXFLAGS="-mno-cygwin $CXXFLAGS" LDFLAGS="-mno-cygwin $LDFLAGS" PYTHON_VERSION=`$PYTHON -c "import sys; print('%d%d'%(sys.version_info[0],sys.version_info[1]))" | tr -d "\r"` PYTHON_LIBS="-L`cygpath -a $PYTHON_PREFIX | tr -d \"\r\"`/Libs -lpython$PYTHON_VERSION" fi PYTHON_INCLUDE=`cygpath -a $PYTHON_INCLUDE | tr -d "\r"` PYTHON_DEP_LIBS=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_config_var('LIBS') or '')" | tr -d "\r"` fi LDSHARED="$CXX -shared" CXXFLAGS="-D_REENTRANT $CXXFLAGS" LIBS="$LIBS $PYTHON_LIBS $PYTHON_DEP_LIBS" ;; Darwin) PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d'%(sys.version_info[0],sys.version_info[1]))"` PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" CFLAGS="$CFLAGS -fPIC" CXXFLAGS="$CXXFLAGS -fPIC" LDSHARED="$CXX -dynamiclib -Wl,-undefined,dynamic_lookup" ;; *) PYTHON_VERSION=`$PYTHON -c "import sys; print('%d.%d'%(sys.version_info[0],sys.version_info[1]))"` PYTHON_LIBS="-L$PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" CFLAGS="$CFLAGS -fPIC" CXXFLAGS="$CXXFLAGS -fPIC" LDSHARED="$CXX -shared" ;; esac CPPFLAGS="$CPPFLAGS -I $PYTHON_INCLUDE" ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # Check whether --with-boost_prefix was given. if test "${with_boost_prefix+set}" = set; then withval=$with_boost_prefix; fi # Check whether --with-boost_version was given. if test "${with_boost_version+set}" = set; then withval=$with_boost_version; boost_version="$withval" else boost_version=1.33 fi boost_version_req=$boost_version boost_version_req_shorten=`expr $boost_version_req : '\([0-9]*\.[0-9]*\)'` boost_version_req_major=`expr $boost_version_req : '\([0-9]*\)'` boost_version_req_minor=`expr $boost_version_req : '[0-9]*\.\([0-9]*\)'` boost_version_req_sub_minor=`expr $boost_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'` if test "x$boost_version_req_sub_minor" = "x" ; then boost_version_req_sub_minor="0" fi REQ_BOOST_VERSION=`expr $boost_version_req_major \* 100000 \+ $boost_version_req_minor \* 100 \+ $boost_version_req_sub_minor` { echo "$as_me:$LINENO: checking for boost >= $boost_version_req" >&5 echo $ECHO_N "checking for boost >= $boost_version_req... $ECHO_C" >&6; } succeeded=no if test "$with_boost_prefix" != ""; then BOOST_LDFLAGS="-L$with_boost_prefix/lib" BOOST_CPPFLAGS="-I$with_boost_prefix/include" else for prefix in /usr /usr/local /opt ; do if test -d "$prefix/include/boost" && test -r "$prefix/include/boost"; then BOOST_LDFLAGS="-L$prefix/lib" BOOST_CPPFLAGS="-I$prefix/include" break; fi done fi CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if BOOST_VERSION >= $REQ_BOOST_VERSION std::ofstream ofs("conftest.out"); ofs << BOOST_VERSION / 100000 << '.' << BOOST_VERSION / 100 % 1000; #else # error Boost version is too old #endif ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then BOOST_VERSION=`cat conftest.out` { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } succeeded=yes found_system=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test "x$succeeded" != "xyes"; then _version=0 if test "$with_boost_prefix" != ""; then BOOST_LDFLAGS="-L$with_boost_prefix/lib" if test -d "$with_boost_prefix" && test -r "$with_boost_prefix"; then for i in `ls -d $with_boost_prefix/include/boost-* 2>/dev/null`; do _version_tmp=`echo $i | sed "s#$with_boost_prefix##" | sed 's/\/include\/boost-//' | sed 's/_/./'` V_CHECK=`expr $_version_tmp \> $_version` if test "$V_CHECK" = "1" ; then _version=$_version_tmp fi VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` BOOST_CPPFLAGS="-I$with_boost_prefix/include/boost-$VERSION_UNDERSCORE" done fi else for prefix in /usr /usr/local /opt ; do if test -d "$prefix" && test -r "$prefix"; then for i in `ls -d $prefix/include/boost-* 2>/dev/null`; do _version_tmp=`echo $i | sed "s#$prefix##" | sed 's/\/include\/boost-//' | sed 's/_/./'` V_CHECK=`expr $_version_tmp \> $_version` if test "$V_CHECK" = "1" ; then _version=$_version_tmp best_path=$prefix fi done fi done VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE" BOOST_LDFLAGS="-L$best_path/lib" if test "x$BOOST_ROOT" != "x"; then if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'` stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'` stage_version_shorten=`expr $stage_version : '\([0-9]*\.[0-9]*\)'` V_CHECK=`expr $stage_version_shorten \>\= $_version` if test "$V_CHECK" = "1" ; then { echo "$as_me:$LINENO: We will use a staged boost library from $BOOST_ROOT" >&5 echo "$as_me: We will use a staged boost library from $BOOST_ROOT" >&6;} BOOST_CPPFLAGS="-I$BOOST_ROOT" BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib" fi fi fi fi CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #if BOOST_VERSION >= $REQ_BOOST_VERSION // Everything is okay #else # error Boost version is too old #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } succeeded=yes found_system=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu BOOST_VERSION="$_version" fi if test "$succeeded" != "yes" ; then if test "$_version" = "0" ; then { { echo "$as_me:$LINENO: error: We could not detect the boost libraries (version $boost_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in . See http://randspringer.de/boost for more documentation." >&5 echo "$as_me: error: We could not detect the boost libraries (version $boost_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in . See http://randspringer.de/boost for more documentation." >&2;} { (exit 1); exit 1; }; } else { { echo "$as_me:$LINENO: error: boost $_version too old; version $boost_version_req or newer required." >&5 echo "$as_me: error: boost $_version too old; version $boost_version_req or newer required." >&2;} { (exit 1); exit 1; }; } fi else cat >>confdefs.h <<\_ACEOF #define HAVE_BOOST _ACEOF fi CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" # Check whether --with-boost-lib-suffix was given. if test "${with_boost_lib_suffix+set}" = set; then withval=$with_boost_lib_suffix; BOOST_LIB_SUFFIX="$withval" else BOOST_LIB_SUFFIX="none -gcc -mipspro -mt -sunpro -sw -mgw -gcc-mt -gcc-mt-s" fi found=no LIBS_SAVED="$LIBS" CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" for s in $BOOST_LIB_SUFFIX do if test "x$s" = xnone; then s='' fi if test "x${BOOST_LIBDIR}" != x; then lib="${BOOST_LIBDIR}/libboost_system${s}.a" else lib="-lboost_system$s" fi LIBS="$lib $BOOST_LIBS $LIBS_SAVED" cv=`echo "ac_cv_boost_lib_system${s}_${BOOST_LIBDIR}" | $as_tr_sh` { echo "$as_me:$LINENO: checking for the boost_system$s library" >&5 echo $ECHO_N "checking for the boost_system$s library... $ECHO_C" >&6; } if { as_var=$cv; eval "test \"\${$as_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. */ #include using namespace boost::system; int main () { error_code c; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval $cv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval $cv=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$cv'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if eval "test \"\${$cv}\" = yes"; then found=yes break fi done CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" LIBS="$LIBS_SAVED" if test $found = yes; then BOOST_LIB_SUFFIX=${s:-none} BOOST_LIBS="$lib $BOOST_LIBS" fi found=no LIBS_SAVED="$LIBS" CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" for s in $BOOST_LIB_SUFFIX do if test "x$s" = xnone; then s='' fi if test "x${BOOST_LIBDIR}" != x; then lib="${BOOST_LIBDIR}/libboost_filesystem${s}.a" else lib="-lboost_filesystem$s" fi LIBS="$lib $BOOST_LIBS $LIBS_SAVED" cv=`echo "ac_cv_boost_lib_filesystem${s}_${BOOST_LIBDIR}" | $as_tr_sh` { echo "$as_me:$LINENO: checking for the boost_filesystem$s library" >&5 echo $ECHO_N "checking for the boost_filesystem$s library... $ECHO_C" >&6; } if { as_var=$cv; eval "test \"\${$as_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. */ #include #include using namespace boost::filesystem; int main () { exists(path("/boot")); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval $cv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval $cv=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$cv'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if eval "test \"\${$cv}\" = yes"; then found=yes break fi done CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" LIBS="$LIBS_SAVED" if test $found = yes; then BOOST_LIB_SUFFIX=${s:-none} BOOST_LIBS="$lib $BOOST_LIBS" else { { echo "$as_me:$LINENO: error: the boost_filesystem library is required See \`config.log' for more details." >&5 echo "$as_me: error: the boost_filesystem library is required See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi save_LIBS=$LIBS LIBS="$LIBS $PYTHON_LIBS" found=no LIBS_SAVED="$LIBS" CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" for s in $BOOST_LIB_SUFFIX do if test "x$s" = xnone; then s='' fi if test "x${BOOST_LIBDIR}" != x; then lib="${BOOST_LIBDIR}/libboost_python${s}.a" else lib="-lboost_python$s" fi LIBS="$lib $BOOST_LIBS $LIBS_SAVED" cv=`echo "ac_cv_boost_lib_python${s}_${BOOST_LIBDIR}" | $as_tr_sh` { echo "$as_me:$LINENO: checking for the boost_python$s library" >&5 echo $ECHO_N "checking for the boost_python$s library... $ECHO_C" >&6; } if { as_var=$cv; eval "test \"\${$as_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. */ #include using namespace boost::python; int main () { object("dummy"); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval $cv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval $cv=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$cv'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if eval "test \"\${$cv}\" = yes"; then found=yes break fi done CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" LIBS="$LIBS_SAVED" if test $found = yes; then BOOST_LIB_SUFFIX=${s:-none} BOOST_LIBS="$lib $BOOST_LIBS" else { { echo "$as_me:$LINENO: error: the boost_python library is required See \`config.log' for more details." >&5 echo "$as_me: error: the boost_python library is required See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi LIBS=$save_LIBS templates=`find $srcdir -name '*.in' -print | sed -e "s,^$srcdir/,,g" -e "s,\.in$,,g"` ac_config_files="$ac_config_files $templates" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${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 more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by sandbox $as_me 1.0, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" _ACEOF 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 and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ sandbox config.status 1.0 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' _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 ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "$templates") CONFIG_FILES="$CONFIG_FILES $templates" ;; *) { { 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 fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for 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 _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim CPP!$CPP$ac_delim CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim ac_ct_CXX!$ac_ct_CXX$ac_delim SYN_CPP!$SYN_CPP$ac_delim SYN_LIBS!$SYN_LIBS$ac_delim PYTHON!$PYTHON$ac_delim PYTHON_INCLUDE!$PYTHON_INCLUDE$ac_delim LIBEXT!$LIBEXT$ac_delim LDSHARED!$LDSHARED$ac_delim BOOST_VERSION!$BOOST_VERSION$ac_delim BOOST_CPPFLAGS!$BOOST_CPPFLAGS$ac_delim BOOST_LDFLAGS!$BOOST_LDFLAGS$ac_delim BOOST_LIBS!$BOOST_LIBS$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 60; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF 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&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; esac done # for ac_tag { (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 synopsis-0.12/sandbox/rsttodocbook.py0000664000076400007640000007770611104703243017417 0ustar stefanstefan""" :Author: Ollie Rutherfurd :Contact: oliver@rutherfurd.net :Revision: $Revision: 1.4 $ :Date: $Date: 2003/02/20 23:10:10 $ :Copyright: This module has been placed in the public domain. DocBook document tree Writer. This Writer converts a reST document tree to a subset of DocBook. .. Note:: This is an unfinished work in progress. Document Types ============== This writer can create 3 types of DocBook documents: 1. "article" *(default)* 2. "book" 3. "chapter" .. Note:: When creating a "book" document, all first-level sections are output as "chapter" elements instead of "section" as in "article" and "chapter". Mappings ======== Option List ----------- As there is no direct equivlent for a listing of program options in DocBook_, as defined in reST_, a table containing the option list contents is generated. Field List ---------- Like `Option List`_, there is not direct equivlent for a Field List in DocBook, so this is done using a "variablelist". .. NOTE:: It might be better to switch Definition List to glossary or something similar, so Field List and Definition List are generating the same type of output. Bibliography Elements --------------------- Here's how reST's bibliography elements are mapped to DocBook elements: +--------------+---------------------------------------------+ | reST Element | DocBook Element | +==============+=============================================+ | author | {doctype}info/author/othername | | | or | | | {doctype}info/authorgroup/author/othername | | | if nested under ``authors`` | +--------------+---------------------------------------------+ | authors | {doctype}info/authorgroup/ | +--------------+---------------------------------------------+ | contact | {doctype}info/author/email | +--------------+---------------------------------------------+ | copyright | {doctype}info/legalnotice | +--------------+---------------------------------------------+ | date | {doctype}info/date | +--------------+---------------------------------------------+ | organization | {doctype}info/orgname | +--------------+---------------------------------------------+ | revision | concatenated with ``version`` into | | | {doctype}info/edition | +--------------+---------------------------------------------+ | status | {doctype}info/releaseinfo | +--------------+---------------------------------------------+ | version | concatenated with ``revision`` into | | | {doctype}info/edition | +--------------+---------------------------------------------+ Note: ``{doctype}`` is the type of the DocBook document being generated, one of the following: ``article``, ``book``, or ``chapter``. Todo ==== - Inline images -- need to figure out how to identify an inline image - list item marks are not guarenteed to be what was specified (if they are it is be coincidence, however unless one starts out of order they should match most of the time). Should para, note, etc... not in a section at the start of the document be stuffed into an untitled ``section``? """ __docformat__ = 'reStructuredText' import re import string from docutils import writers, nodes, languages from types import ListType class Writer(writers.Writer): settings_spec = ( 'DocBook-Specific Options', None, (('Set DocBook document type. ' 'Choices are "article", "book", and "chapter". ' 'Default is "article".', ['--doctype'], {'default': 'article', 'metavar': '', 'type': 'choice', 'choices': ('article', 'book', 'chapter',) } ), ) ) output = None """Final translated form of `document`.""" def translate(self): visitor = DocBookTranslator(self.document) self.document.walkabout(visitor) self.output = visitor.astext() class DocBookTranslator(nodes.NodeVisitor): XML_DECL = '\n' DOCTYPE_DECL = """\n""" def __init__(self, document): nodes.NodeVisitor.__init__(self, document) self.language = languages.get_language( document.settings.language_code) self.doctype = document.settings.doctype self.doc_header = [ self.XML_DECL % (document.settings.output_encoding,), self.DOCTYPE_DECL % (self.doctype,), '<%s>\n' % (self.doctype,), ] self.doc_footer = [ '\n' % (self.doctype,) ] self.body = [] self.section = 0 self.context = [] self.colnames = [] self.footnotes = {} self.footnote_map = {} self.docinfo = [] def astext(self): return ''.join(self.doc_header + self.docinfo + self.body + self.doc_footer) def encode(self, text): """Encode special characters in `text` & return.""" # @@@ A codec to do these and all other # HTML entities would be nice. text = text.replace("&", "&") text = text.replace("<", "<") text = text.replace('"', """) text = text.replace(">", ">") return text def rearrange_footnotes(self): """ Replaces ``foonote_reference`` placeholders with ``footnote`` element content as DocBook and reST handle footnotes differently. DocBook defines footnotes inline, whereas they may be anywere in reST. This function replaces the first instance of a ``footnote_reference`` with the ``footnote`` element itself, and later references of the same a footnote with ``footnoteref`` elements. """ for (footnote_id,refs) in self.footnote_map.items(): ref_id, context, pos = refs[0] context[pos] = ''.join(self.footnotes[footnote_id]) for ref_id, context, pos in refs[1:]: context[pos] = '' \ % (footnote_id,) def attval(self, text, transtable=string.maketrans('\n\r\t\v\f', ' ')): """Cleanse, encode, and return attribute value text.""" return self.encode(text.translate(transtable)) def starttag(self, node, tagname, suffix='\n', infix='', **attributes): """ Construct and return a start tag given a node (id & class attributes are extracted), tag name, and optional attributes. """ atts = {} for (name, value) in attributes.items(): atts[name.lower()] = value for att in ('id',): # node attribute overrides if node.has_key(att): atts[att] = node[att] attlist = atts.items() attlist.sort() parts = [tagname.lower()] for name, value in attlist: if value is None: # boolean attribute # According to the HTML spec, ```` is good, # ```` is bad. # (But the XHTML (XML) spec says the opposite. ) parts.append(name.lower()) elif isinstance(value, ListType): values = [str(v) for v in value] parts.append('%s="%s"' % (name.lower(), self.attval(' '.join(values)))) else: parts.append('%s="%s"' % (name.lower(), self.attval(str(value)))) return '<%s%s>%s' % (' '.join(parts), infix, suffix) def emptytag(self, node, tagname, suffix='\n', **attributes): """Construct and return an XML-compatible empty tag.""" return self.starttag(node, tagname, suffix, infix=' /', **attributes) def visit_Text(self, node): self.body.append(self.encode(node.astext())) def depart_Text(self, node): pass def visit_attention(self, node): self.body.append(self.starttag(node, 'note')) self.body.append('\n%s\n' % (self.language.labels[node.tagname],)) def depart_attention(self, node): self.body.append('\n') # author is handled in ``visit_docinfo()`` def visit_author(self, node): raise nodes.SkipNode # authors is handled in ``visit_docinfo()`` def visit_authors(self, node): raise nodes.SkipNode def visit_block_quote(self, node): self.body.append(self.starttag(node, 'blockquote')) def depart_block_quote(self, node): self.body.append('\n') def visit_bullet_list(self, node): self.body.append(self.starttag(node, 'itemizedlist')) def depart_bullet_list(self, node): self.body.append('\n') def visit_caption(self, node): # NOTE: ideally, this should probably be stuffed into # the mediaobject as a "caption" element self.body.append(self.starttag(node, 'para')) def depart_caption(self, node): self.body.append('') def visit_caution(self, node): self.body.append(self.starttag(node, 'caution')) self.body.append('\n%s\n' % (self.language.labels[node.tagname],)) def depart_caution(self, node): self.body.append('\n') # reST seems to handle citations as a labled # footnotes, whereas DocBook doesn't from what # I can tell, so I'm not sure how to give DocBook # citations that result in equivlent output # as the docutils html writer. # # Currently, citations are handled as footnotes, # using the citation label as the footnote label # which seems functionally equivlent, but the # DocBook stylesheets for generating HTML output # don't seem to be using the label for foonotes # so this doesn't work. # # So I'm at a bit of a loss as to how to # handle citations. Any ideas or suggestions would # be welcome. # TODO: citation def visit_citation(self, node): self.visit_footnote(node) def depart_citation(self, node): self.depart_footnote(node) # TODO: citation_reference def visit_citation_reference(self, node): self.visit_footnote_reference(node) def depart_citation_reference(self, node): pass def visit_classifier(self, node): self.body.append(' : ') self.body.append(self.starttag(node, 'type')) def depart_classifier(self, node): self.body.append('
    \n') def visit_colspec(self, node): self.colnames.append('col_%d' % (len(self.colnames) + 1,)) atts = {'colname': self.colnames[-1]} self.body.append(self.emptytag(node, 'colspec', **atts)) def depart_colspec(self, node): pass def visit_comment(self, node, sub=re.compile('-(?=-)').sub): """Escape double-dashes in comment text.""" self.body.append('\n' % sub('- ', node.astext())) raise nodes.SkipNode # contact is handled in ``visit_docinfo()`` def visit_contact(self, node): raise nodes.SkipNode # copyright is handled in ``visit_docinfo()`` def visit_copyright(self, node): raise nodes.SkipNode def visit_danger(self, node): self.body.append(self.starttag(node, 'caution')) self.body.append('\n%s\n' % (self.language.labels[node.tagname],)) def depart_danger(self, node): self.body.append('\n') # date is handled in ``visit_docinfo()`` def visit_date(self, node): raise nodes.SkipNode # TODO: decoration def visit_decoration(self, node): pass def depart_decoration(self, node): pass def visit_definition(self, node): # "term" is not closed in depart_term self.body.append('\n') self.body.append(self.starttag(node, 'listitem')) def depart_definition(self, node): self.body.append('\n') def visit_definition_list(self, node): self.body.append(self.starttag(node, 'variablelist')) def depart_definition_list(self, node): self.body.append('\n') def visit_definition_list_item(self, node): self.body.append(self.starttag(node, 'varlistentry')) def depart_definition_list_item(self, node): self.body.append('\n') def visit_description(self, node): self.body.append(self.starttag(node, 'entry')) def depart_description(self, node): self.body.append('\n') def visit_docinfo(self, node): """ Collects all docinfo elements for the document. Since reST's bibliography elements don't map very cleanly to DocBook, rather than maintain state and check dependencies within the different visitor fuctions all processing of bibliography elements is dont within this function. .. NOTE:: Skips processing of all child nodes as everything should be collected here. """ docinfo = ['<%sinfo>\n' % self.doctype] authors = [] author = '' contact = '' date = '' legalnotice = '' orgname = '' releaseinfo = '' revision,version = '','' for n in node: if isinstance(n, nodes.author): author = n.astext() elif isinstance(n, nodes.authors): for a in n: authors.append(a.astext()) elif isinstance(n, nodes.contact): contact = n.astext() elif isinstance(n, nodes.copyright): legalnotice = n.astext() elif isinstance(n, nodes.date): date = n.astext() elif isinstance(n, nodes.organization): orgname = n.astext() elif isinstance(n, nodes.revision): revision = 'Revision ' + n.astext() elif isinstance(n, nodes.status): releaseinfo = n.astext() elif isinstance(n, nodes.version): version = 'Version ' + n.astext() # since all child nodes are handled here raise an exception # if node is not handled, so it doesn't silently slip through. else: raise self.unimplemented_visit(n) # can only add author if name is present # since contact is associate with author, the contact # can also only be added if an author name is given. if author: docinfo.append('\n') docinfo.append('%s\n' % author) if contact: docinfo.append('%s\n' % contact) docinfo.append('\n') if authors: docinfo.append('\n') for name in authors: docinfo.append( '%s\n' % name) docinfo.append('\n') if revision or version: edition = version if edition and revision: edition += ', ' + revision elif revision: edition = revision docinfo.append('%s\n' % edition) if date: docinfo.append('%s\n' % date) if orgname: docinfo.append('%s\n' % orgname) if releaseinfo: docinfo.append('%s\n' % releaseinfo) if legalnotice: docinfo.append('\n') docinfo.append('%s\n' % legalnotice) docinfo.append('\n') if len(docinfo) > 1: docinfo.append('\n' % self.doctype) self.docinfo = docinfo raise nodes.SkipChildren def depart_docinfo(self, node): pass def visit_doctest_block(self, node): self.body.append('\n') self.body.append(self.starttag(node, 'programlisting')) def depart_doctest_block(self, node): self.body.append('\n') self.body.append('\n') def visit_document(self, node): pass def depart_document(self, node): self.rearrange_footnotes() def visit_emphasis(self, node): self.body.append(self.starttag(node, 'emphasis')) def depart_emphasis(self, node): self.body.append('\n') def visit_entry(self, node): tagname = 'entry' atts = {} if node.has_key('morerows'): atts['morerows'] = node['morerows'] if node.has_key('morecols'): atts['namest'] = self.colnames[self.entry_level] atts['nameend'] = self.colnames[self.entry_level \ + node['morecols']] self.entry_level += 1 # for tracking what namest and nameend are self.body.append(self.starttag(node, tagname, **atts)) def depart_entry(self, node): self.body.append('\n') def visit_enumerated_list(self, node): # TODO: need to specify "mark" type used for list items self.body.append(self.starttag(node, 'orderedlist')) def depart_enumerated_list(self, node): self.body.append('\n') def visit_error(self, node): self.body.append(self.starttag(node, 'caution')) self.body.append('\n%s\n' % (self.language.labels[node.tagname],)) def depart_error(self, node): self.body.append('\n') # TODO: wrap with some element (filename used in DocBook example) def visit_field(self, node): self.body.append(self.starttag(node, 'varlistentry')) def depart_field(self, node): self.body.append('\n') # TODO: see if this should be wrapped with some element def visit_field_argument(self, node): self.body.append(' ') def depart_field_argument(self, node): pass def visit_field_body(self, node): # NOTE: this requires that a field body always # be present, which looks like the case # (from docutils.dtd) self.body.append(self.context.pop()) self.body.append(self.starttag(node, 'listitem')) def depart_field_body(self, node): self.body.append('\n') def visit_field_list(self, node): self.body.append(self.starttag(node, 'variablelist')) def depart_field_list(self, node): self.body.append('\n') def visit_field_name(self, node): self.body.append(self.starttag(node, 'term')) # popped by visit_field_body, so "field_argument" is # content within "term" self.context.append('\n') def depart_field_name(self, node): pass def visit_figure(self, node): self.body.append(self.starttag(node, 'informalfigure')) self.body.append('
    ') def depart_figure(self, node): self.body.append('
    ') self.body.append('\n') # TODO: footer (this is where 'generated by docutils' arrives) # if that's all that will be there, it could map to "colophon" def visit_footer(self, node): raise nodes.SkipChildren def depart_footer(self, node): pass def visit_footnote(self, node): self.footnotes[node['id']] = [] atts = {'id': node['id']} if isinstance(node[0], nodes.label): # FIXME: this fails with the second auto-sequenece character # used in the test document ``test.txt``. atts['label'] = node[0].astext() self.footnotes[node['id']].append( self.starttag(node, 'footnote', **atts)) # replace body with this with a footnote collector list # which will hold all the contents for this footnote. # This needs to be kept separate so it can be used to replace # the first ``footnote_reference`` as DocBook defines # ``footnote`` elements inline. self._body = self.body self.body = self.footnotes[node['id']] def depart_footnote(self, node): # finish footnote and then replace footnote collector # with real body list. self.footnotes[node['id']].append('\n') self.body = self._body self._body = None def visit_footnote_reference(self, node): if node.has_key('refid'): refid = node['refid'] else: refid = self.document.nameids[node['refname']] # going to replace this footnote reference with the actual # footnote later on, so store the footnote id to replace # this reference with and the list and position to replace it # in. Both list and position are stored in case a footnote # reference is within a footnote, in which case ``self.body`` # won't really be ``self.body`` but a footnote collector # list. refs = self.footnote_map.get(refid, []) refs.append((node['id'], self.body, len(self.body),)) self.footnote_map[refid] = refs # add place holder list item which should later be # replaced with the contents of the footnote element # and it's child elements self.body.append('') raise nodes.SkipNode # TODO: header def visit_hint(self, node): self.body.append(self.starttag(node, 'note')) self.body.append('\n%s\n' % (self.language.labels[node.tagname],)) def depart_hint(self, node): self.body.append('\n') def visit_image(self, node): atts = node.attributes.copy() atts['fileref'] = atts['uri'] alt = None del atts['uri'] if atts.has_key('alt'): alt = atts['alt'] del atts['alt'] if atts.has_key('height'): atts['depth'] = atts['height'] del atts['height'] # NOTE: using win32 port of xsltproc and docbook-stylesheets-1.51.1 # I'm getting the following error when transforming: # Error C:\home\igor\src\gnome-xml\xpath.c:8023: Undefined # namespace prefix xmlXPathCompiledEval: evaluation failed # When I switched to version 1.49 of the docbook-stylesheets # I didn't have this problem. self.body.append('\n') self.body.append('\n') self.body.append(self.emptytag(node, 'imagedata', **atts)) self.body.append('\n') if alt: self.body.append('' \ '%s\n' % alt) self.body.append('\n') def depart_image(self, node): pass def visit_important(self, node): self.body.append(self.starttag(node, 'important')) def depart_important(self, node): self.body.append('') # @@@ Incomplete, pending a proper implementation on the # Parser/Reader end. def visit_interpreted(self, node): self.body.append('\n') def depart_interpreted(self, node): self.body.append('\n') def visit_label(self, node): # getting label for "footnote" in ``visit_footnote`` # because label is an attribute for the ``footnote`` # element. if isinstance(node.parent, nodes.footnote): raise nodes.SkipNode # TODO: handle citation label elif isinstance(node.parent, nodes.citation): raise nodes.SkipNode def depart_label(self, node): pass def visit_legend(self, node): # TODO: explain why this is empty.... pass def depart_legend(self, node): pass def visit_list_item(self, node): self.body.append(self.starttag(node, 'listitem')) def depart_list_item(self, node): self.body.append('\n') def visit_literal(self, node): self.body.append('') def depart_literal(self, node): self.body.append('') def visit_literal_block(self, node): self.body.append(self.starttag(node, 'programlisting')) def depart_literal_block(self, node): self.body.append('\n') def visit_note(self, node): self.body.append(self.starttag(node, 'note')) self.body.append('\n%s\n' % (self.language.labels[node.tagname],)) def depart_note(self, node): self.body.append('\n') def visit_option(self, node): self.body.append(self.starttag(node, 'command')) if self.context[-1]: self.body.append(', ') def depart_option(self, node): self.context[-1] += 1 self.body.append('') def visit_option_argument(self, node): self.body.append(node.get('delimiter', ' ')) self.body.append(self.starttag(node, 'replaceable', '')) def depart_option_argument(self, node): self.body.append('') def visit_option_group(self, node): self.body.append(self.starttag(node, 'entry')) self.context.append(0) def depart_option_group(self, node): self.context.pop() self.body.append('\n') def visit_option_list(self, node): self.body.append(self.starttag(node, 'informaltable', frame='all')) self.body.append('\n') self.body.append('\n') self.body.append('\n') self.body.append('\n') self.body.append('\n') # FIXME: shouldn't hardcode everything... self.body.append('Option\n') self.body.append('Description\n') self.body.append('\n') self.body.append('\n') self.body.append('\n') def depart_option_list(self, node): self.body.append('') self.body.append('\n') self.body.append('\n') def visit_option_list_item(self, node): self.body.append(self.starttag(node, 'row')) def depart_option_list_item(self, node): self.body.append('\n') def visit_option_string(self, node): pass def depart_option_string(self, node): pass # organization is handled in ``visit_docinfo()`` def visit_organization(self, node): raise nodes.SkipNode def visit_paragraph(self, node): self.body.append(self.starttag(node, 'para', '')) def depart_paragraph(self, node): self.body.append('\n') # TODO: problematic visit_problematic = depart_problematic = lambda self, node: None def visit_raw(self, node): if node.has_key('format') and node['format'] == 'docbook': self.body.append(node.astext()) raise node.SkipNode def visit_reference(self, node): atts = {} if node.has_key('refuri'): atts['url'] = node['refuri'] self.context.append('ulink') elif node.has_key('refid'): atts['linkend'] = node['refid'] self.context.append('link') elif node.has_key('refname'): atts['linkend'] = self.document.nameids[node['refname']] self.context.append('link') self.body.append(self.starttag(node, self.context[-1], '', **atts)) def depart_reference(self, node): self.body.append('' % (self.context.pop(),)) # revision is handled in ``visit_docinfo()`` def visit_revision(self, node): raise nodes.SkipNode def visit_row(self, node): self.entry_level = 0 self.body.append(self.starttag(node, 'row')) def depart_row(self, node): self.body.append('\n') def visit_section(self, node): if self.section == 0 and self.doctype == 'book': self.body.append(self.starttag(node, 'chapter')) else: self.body.append(self.starttag(node, 'section')) self.section += 1 def depart_section(self, node): self.section -= 1 if self.section == 0 and self.doctype == 'book': self.body.append('\n') else: self.body.append('
    \n') def visit_sidebar(self, node): self.body.append(self.starttag(node, 'sidebar')) def depart_sidebar(self, node): self.body.append('\n') # author is handled in ``visit_docinfo()`` def visit_status(self, node): raise nodes.SkipNode def visit_strong(self, node): self.body.append(self.starttag(node, 'emphasis', role='strong')) def depart_strong(self, node): self.body.append('\n') def visit_substitution_definition(self, node): raise nodes.SkipNode def visit_substitution_reference(self, node): self.unimplemented_visit(node) def visit_subtitle(self, node): self.body.append(self.starttag(node, 'subtitle')) def depart_subtitle(self, node): self.body.append('\n') # TODO: system_message visit_system_message = depart_system_message = lambda self, node: None def visit_table(self, node): self.body.append( self.starttag(node, 'informaltable', frame='all') ) def depart_table(self, node): self.body.append('\n') # TODO: target visit_target = depart_target = lambda self,node: None def visit_tbody(self, node): self.body.append(self.starttag(node, 'tbody')) def depart_tbody(self, node): self.body.append('\n') def visit_term(self, node): self.body.append(self.starttag(node, 'term')) self.body.append('') def depart_term(self, node): # Leave the end tag "term" to ``visit_definition()``, # in case there's a classifier. self.body.append('') def visit_tgroup(self, node): self.colnames = [] atts = {'cols': node['cols']} self.body.append(self.starttag(node, 'tgroup', **atts)) def depart_tgroup(self, node): self.body.append('\n') def visit_thead(self, node): self.body.append(self.starttag(node, 'thead')) def depart_thead(self, node): self.body.append('\n') def visit_tip(self, node): self.body.append(self.starttag(node, 'tip')) def depart_tip(self, node): self.body.append('\n') def visit_title(self, node): self.body.append(self.starttag(node, 'title')) def depart_title(self, node): self.body.append('\n') def visit_topic(self, node): # Table of Contents generation handled by DocBook if node.get('class') == 'contents': raise nodes.SkipChildren elif node.get('class') == 'abstract': self.body.append(self.starttag(node, 'abstract')) self.context.append('abstract') else: print node print `node` print dir(node) self.unimplemented_visit(node) def depart_topic(self, node): if len(self.context): self.body.append('\n' % (self.context.pop(),)) # QUESTION: what to do for "transition"? def visit_transition(self, node): pass def depart_transition(self, node): pass # author is handled in ``visit_docinfo()`` def visit_version(self, node): raise nodes.SkipNode def visit_warning(self, node): self.body.append(self.starttag(node, 'warning')) def depart_warning(self, node): self.body.append('\n') def unimplemented_visit(self, node): raise NotImplementedError('visiting unimplemented node type: %s' % node.__class__.__name__) synopsis-0.12/sandbox/configure.ac0000664000076400007640000000217311104702610016576 0ustar stefanstefandnl dnl Copyright (C) 2005 Stefan Seefeld dnl All rights reserved. dnl Licensed to the public under the terms of the GNU LGPL (>= 2), dnl see the file COPYING for details. dnl dnl ------------------------------------------------------------------ dnl Autoconf initialization dnl ------------------------------------------------------------------ AC_PREREQ(2.56) AC_REVISION($Revision: 1.9 $) AC_INIT(sandbox, 1.0, synopsis-devel@fresco.org) AC_ARG_WITH(syn-cxx, [ --with-syn-cxx=PATH specify the Synopsis C++ library prefix], SYN_CXX="$with_syn_cxx", SYN_CXX="/usr/local" ) AC_PROG_CPP AC_PROG_CC AC_PROG_CXX SYN_CPP="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --cflags synopsis-uninstalled`" SYN_LIBS="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --libs synopsis-uninstalled`" AC_SUBST(SYN_CPP) AC_SUBST(SYN_LIBS) AC_PYTHON_EXT CPPFLAGS="$CPPFLAGS -I $PYTHON_INCLUDE" AC_LANG(C++) AC_BOOST([1.33]) SYN_BOOST_LIB_FILESYSTEM SYN_BOOST_LIB_PYTHON dnl find all template files and strip off the $srcdir and .in suffix templates=`find $srcdir -name '*.in' -print | sed -e "s,^$srcdir/,,g" -e "s,\.in$,,g"` AC_CONFIG_FILES([$templates]) AC_OUTPUT synopsis-0.12/sandbox/boost/0000775000076400007640000000000011172123232015435 5ustar stefanstefansynopsis-0.12/sandbox/boost/synopsis.py0000644000076400007640000000276011104703243017702 0ustar stefanstefan#! /usr/bin/env python from Synopsis.process import process from Synopsis.Processor import * from Synopsis.Parsers import Cxx from Synopsis.Processors import * from Synopsis.Formatters import Dump from Synopsis.Formatters import HTML from Synopsis.Formatters.HTML.DirectoryLayout import * from Synopsis.Formatters.HTML.Views import * from Synopsis.Formatters import SXR from distutils import sysconfig import sys, os.path # the python include path can be obtained from distutils.sysconfig, # assuming that the python version used to run synopsis is the same # boost should be compiled with parser = Cxx.Parser(cppflags = ['-U_GNU_SOURCE -DPYTHON_INCLUDE='%sys.version[0:3], '-DBOOST_PYTHON_SYNOPSIS', '-Iboost', '-I%s'%(sysconfig.get_python_inc())], base_path = 'boost/', primary_file_only = False) translator = Comments.Translator(markup='rst', # use restructured text markup in comments filter=Comments.SSFilter(), # filter out any non-'//' comments processor=Composite(Comments.Grouper(), Comments.Previous())) linker = Linker(translator) html = HTML.Formatter(title = 'Boost Python Reference Manual') process(parse = Composite(parser, linker), link = linker, dump = Dump.Formatter(), html = html) synopsis-0.12/sandbox/boost/Makefile0000644000076400007640000000115211104702610017070 0ustar stefanstefansynopsis:= python synopsis.py all: @echo "The boost demo is not run by default. If you have the boost sources," @echo "you must create a symlink to the boost root directory as 'boost' here" @echo "eg: ln -s ~/boost boost" @echo "Then you can run 'make bpl'" bpl: bpl.syn $(synopsis) html --debug --output=$@ $< sxr: bpl.syn $(synopsis) sxr --url=http://localhost:8000/sxr.cgi --output=$@ $< @echo "now start 'sxr-server -d sxr -u /sxr.cgi -s /files' to activate the sxr engine" bpl.syn: boost/boost/python.hpp $(synopsis) parse --output=$@ $? clean: rm -rf *~ bpl.syn distclean: clean rm -rf bpl sxr synopsis-0.12/sandbox/aclocal.m40000664000076400007640000000123611171624016016156 0ustar stefanstefan# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_include([../config/boost.m4]) m4_include([../config/python_ext.m4]) synopsis-0.12/tests/0000775000076400007640000000000011172123233014014 5ustar stefanstefansynopsis-0.12/tests/expectation.xml0000664000076400007640000154121311104703266017075 0ustar stefanstefan -I /group/fresco/local/include/python2.3 -I/group/synopsis/workspace/Synopsis/build/ctemp.linux-i686/src -I/group/synopsis/workspace/Synopsis/src stefan 2001 2005-06-22T19:32:16Z g++ -g -O2 Linux frida 2.4.29 #1 Wed Jan 26 22:40:49 UTC 2005 i686 -rdynamic 2005-06-22T19:33:06Z -L/group/synopsis/workspace/Synopsis/build/ctemp.linux-i686/src/lib -lSupport -lSynopsis -L /group/fresco/local/lib/python2.3/config -lpython2.3 -lpthread -ldl -lutil /group/synopsis/local/bin/qmtest run 2.2 "local" "2005-06-22T19:32:23Z" "2005-06-22T19:32:23Z" "local" "2005-06-22T19:32:23Z" "2005-06-22T19:32:23Z" "local" "local" "2005-06-22T19:32:30Z" "2005-06-22T19:32:30Z" "local" "local" "2005-06-22T19:32:35Z" "2005-06-22T19:32:35Z" "local" "local" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "error reading expected output" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "No such file or directory" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "error reading expected output" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "No such file or directory" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "2005-06-22T19:32:45Z" "2005-06-22T19:32:45Z" "local" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:46Z" "2005-06-22T19:32:46Z" "local" "No such file or directory" "local" "error reading expected output" "2005-06-22T19:32:53Z" "2005-06-22T19:32:53Z" "local" "No such file or directory" "error reading expected output" "2005-06-22T19:32:53Z" "2005-06-22T19:32:53Z" "local" "No such file or directory" "incorrect output" "2005-06-22T19:32:53Z" "2005-06-22T19:32:53Z" "local" "<pre>--- +++ @@ -1,8 +1,8 @@ &lt;?xml version='1.0' encoding='ISO-8859-1'?&gt; &lt;ast&gt; &lt;declarations&gt; - &lt;instance accessibility="0" class="Synopsis.AST.Macro" file="Parsers/Cpp/input/../include/header.hh" language="C++" line="3" name="_header_hh" text="" type="macro"/&gt; - &lt;instance accessibility="0" class="Synopsis.AST.Macro" file="Parsers/Cpp/input/../include/header2.hh" language="C++" line="3" name="_header2_hh" text="" type="macro"/&gt; + &lt;instance accessibility="0" class="Synopsis.AST.Macro" file="Parsers/Cpp/include/header.hh" language="C++" line="3" name="_header_hh" text="" type="macro"/&gt; + &lt;instance accessibility="0" class="Synopsis.AST.Macro" file="Parsers/Cpp/include/header2.hh" language="C++" line="3" name="_header2_hh" text="" type="macro"/&gt; &lt;/declarations&gt; &lt;types&gt; &lt;instance class="Synopsis.Type.Declared" language="C++" name="_header2_hh"&gt; @@ -13,11 +13,11 @@ &lt;/instance&gt; &lt;/types&gt; &lt;files&gt; - &lt;instance class="Synopsis.AST.SourceFile" filename="Parsers/Cpp/include/header.hh" is_main="0" language="C++"&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="Parsers/Cpp/include/header.hh" is_main="1" language="C++"&gt; &lt;includes&gt; - &lt;instance class="Synopsis.AST.Include" is_macro="0" is_next="0"&gt; + &lt;instance class="Synopsis.AST.Include" is_macro="0" is_next="0" name="&amp;quot;header2.hh&amp;quot;"&gt; &lt;target&gt; - &lt;instance class="Synopsis.AST.SourceFile" filename="Parsers/Cpp/include/header2.hh" is_main="0" language="C++"&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="Parsers/Cpp/include/header2.hh" is_main="1" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;/target&gt; @@ -27,17 +27,11 @@ &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="Parsers/Cpp/input/include.cc" is_main="1" language="C++"&gt; &lt;includes&gt; - &lt;instance class="Synopsis.AST.Include" is_macro="0" is_next="0"&gt; + &lt;instance class="Synopsis.AST.Include" is_macro="0" is_next="0" name="&amp;quot;../include/header.hh&amp;quot;"&gt; &lt;target/&gt; &lt;/instance&gt; &lt;/includes&gt; &lt;macro_calls/&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.SourceFile" filename="Parsers/Cpp/input/../include/header.hh" is_main="1" language="C++"&gt; - &lt;macro_calls/&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.SourceFile" filename="Parsers/Cpp/input/../include/header2.hh" is_main="1" language="C++"&gt; - &lt;macro_calls/&gt; - &lt;/instance&gt; &lt;/files&gt; &lt;/ast&gt; </pre>" "<pre>&lt;?xml version='1.0' encoding='ISO-8859-1'?&gt; &lt;ast&gt; &lt;declarations&gt; &lt;instance accessibility="0" class="Synopsis.AST.Macro" file="Parsers/Cpp/input/../include/header.hh" language="C++" line="3" name="_header_hh" text="" type="macro"/&gt; &lt;instance accessibility="0" class="Synopsis.AST.Macro" file="Parsers/Cpp/input/../include/header2.hh" language="C++" line="3" name="_header2_hh" text="" type="macro"/&gt; &lt;/declarations&gt; &lt;types&gt; &lt;instance class="Synopsis.Type.Declared" language="C++" name="_header2_hh"&gt; &lt;declaration/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.Type.Declared" language="C++" name="_header_hh"&gt; &lt;declaration/&gt; &lt;/instance&gt; &lt;/types&gt; &lt;files&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="Parsers/Cpp/include/header.hh" is_main="0" language="C++"&gt; &lt;includes&gt; &lt;instance class="Synopsis.AST.Include" is_macro="0" is_next="0"&gt; &lt;target&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="Parsers/Cpp/include/header2.hh" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;/target&gt; &lt;/instance&gt; &lt;/includes&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="Parsers/Cpp/input/include.cc" is_main="1" language="C++"&gt; &lt;includes&gt; &lt;instance class="Synopsis.AST.Include" is_macro="0" is_next="0"&gt; &lt;target/&gt; &lt;/instance&gt; &lt;/includes&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="Parsers/Cpp/input/../include/header.hh" is_main="1" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="Parsers/Cpp/input/../include/header2.hh" is_main="1" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;/files&gt; &lt;/ast&gt; </pre>" "<pre>&lt;?xml version='1.0' encoding='ISO-8859-1'?&gt; &lt;ast&gt; &lt;declarations&gt; &lt;instance accessibility="0" class="Synopsis.AST.Macro" file="Parsers/Cpp/include/header.hh" language="C++" line="3" name="_header_hh" text="" type="macro"/&gt; &lt;instance accessibility="0" class="Synopsis.AST.Macro" file="Parsers/Cpp/include/header2.hh" language="C++" line="3" name="_header2_hh" text="" type="macro"/&gt; &lt;/declarations&gt; &lt;types&gt; &lt;instance class="Synopsis.Type.Declared" language="C++" name="_header2_hh"&gt; &lt;declaration/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.Type.Declared" language="C++" name="_header_hh"&gt; &lt;declaration/&gt; &lt;/instance&gt; &lt;/types&gt; &lt;files&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="Parsers/Cpp/include/header.hh" is_main="1" language="C++"&gt; &lt;includes&gt; &lt;instance class="Synopsis.AST.Include" is_macro="0" is_next="0" name="&amp;quot;header2.hh&amp;quot;"&gt; &lt;target&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="Parsers/Cpp/include/header2.hh" is_main="1" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;/target&gt; &lt;/instance&gt; &lt;/includes&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="Parsers/Cpp/input/include.cc" is_main="1" language="C++"&gt; &lt;includes&gt; &lt;instance class="Synopsis.AST.Include" is_macro="0" is_next="0" name="&amp;quot;../include/header.hh&amp;quot;"&gt; &lt;target/&gt; &lt;/instance&gt; &lt;/includes&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;/files&gt; &lt;/ast&gt; </pre>" "2005-06-22T19:32:54Z" "2005-06-22T19:32:53Z" "local" "2005-06-22T19:32:54Z" "2005-06-22T19:32:54Z" "local" "2005-06-22T19:32:55Z" "2005-06-22T19:32:54Z" "local" "2005-06-22T19:32:55Z" "2005-06-22T19:32:55Z" "local" "2005-06-22T19:32:55Z" "2005-06-22T19:32:55Z" "local" "2005-06-22T19:32:55Z" "2005-06-22T19:32:55Z" "local" "2005-06-22T19:32:56Z" "2005-06-22T19:32:55Z" "local" "2005-06-22T19:32:56Z" "2005-06-22T19:32:56Z" "local" "2005-06-22T19:32:56Z" "2005-06-22T19:32:56Z" "local" "2005-06-22T19:32:56Z" "2005-06-22T19:32:56Z" "local" "2005-06-22T19:32:57Z" "2005-06-22T19:32:56Z" "local" "2005-06-22T19:32:57Z" "2005-06-22T19:32:57Z" "local" "2005-06-22T19:32:57Z" "2005-06-22T19:32:57Z" "local" "2005-06-22T19:32:57Z" "2005-06-22T19:32:57Z" "local" "2005-06-22T19:32:58Z" "2005-06-22T19:32:57Z" "local" "2005-06-22T19:32:58Z" "2005-06-22T19:32:58Z" "local" "2005-06-22T19:32:58Z" "2005-06-22T19:32:58Z" "local" "2005-06-22T19:32:58Z" "2005-06-22T19:32:58Z" "local" "incorrect output" "2005-06-22T19:33:01Z" "2005-06-22T19:32:58Z" "local" "<pre>--- +++ @@ -1,44 +1,308 @@ &lt;?xml version='1.0' encoding='ISO-8859-1'?&gt; &lt;ast&gt; &lt;declarations&gt; - &lt;instance accessibility="0" class="Synopsis.AST.Module" file="/usr/include/c++/3.2.2/bits/stl_bvector.h" language="C++" line="0" name="std" type="namespace"&gt; + &lt;instance accessibility="0" class="Synopsis.AST.Module" file="/group/fresco/local/include/c++/3.3/bits/vector.tcc" language="C++" line="0" name="std" type="namespace"&gt; &lt;comments&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/cstring - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/vector" line="1" suspect="1"&gt; + &lt;text&gt; + // &amp;lt;vector&amp;gt; -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/vector" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute 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. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/vector" line="11" suspect="1"&gt; + &lt;text&gt; + // This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/vector" line="16" suspect="1"&gt; + &lt;text&gt; + // You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/vector" line="21" suspect="1"&gt; + &lt;text&gt; + // As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/vector" line="30" suspect="1"&gt; + &lt;text&gt; + /* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. + * + * + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/vector" line="56" suspect="1"&gt; + &lt;text&gt; + /** @file vector + * This is a Standard C++ Library header. You should @c #include this header + * in your programs, rather than any of the &amp;quot;st[dl]_*.h&amp;quot; implementation files. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="1" suspect="1"&gt; + &lt;text&gt; + // Function-Based Exception Support -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute 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. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="11" suspect="1"&gt; + &lt;text&gt; + // This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="16" suspect="1"&gt; + &lt;text&gt; + // You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="21" suspect="1"&gt; + &lt;text&gt; + // As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="30" suspect="1"&gt; + &lt;text&gt; + // +// ISO C++ 14882: 19.1 Exception classes +// + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="1" suspect="1"&gt; + &lt;text&gt; + // -fno-exceptions Support -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute 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. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="11" suspect="1"&gt; + &lt;text&gt; + // This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="16" suspect="1"&gt; + &lt;text&gt; + // You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="21" suspect="1"&gt; + &lt;text&gt; + // As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="30" suspect="1"&gt; + &lt;text&gt; + // +// ISO C++ 14882: 19.1 Exception classes +// + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="40" suspect="1"&gt; + &lt;text&gt; + // Else proceed normally. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stddef.h" line="239" suspect="1"&gt; + &lt;text&gt; + /* Wide character type. + Locale-writers should change this as necessary to + be big enough to hold unique values not between 0 and 127, + and not (wchar_t) -1, for each defined multibyte character. */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stddef.h" line="244" suspect="1"&gt; + &lt;text&gt; + /* Define this type if we are doing the whole job, + or if we want this type in particular. */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stddef.h" line="280" suspect="1"&gt; + &lt;text&gt; + /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_ + instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other + symbols in the _FOO_T_ family, stays defined even after its + corresponding type is defined). If we define wchar_t, then we + must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if + we undef _WCHAR_T_, then we must also define rune_t, since + headers like runetype.h assume that if machine/ansi.h is included, + and _BSD_WCHAR_T_ is not defined, then rune_t is available. + machine/ansi.h says, &amp;quot;Note that _WCHAR_T_ and _RUNE_T_ must be of + the same type.&amp;quot; */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stddef.h" line="307" suspect="1"&gt; + &lt;text&gt; + /* FreeBSD 5 can't be handled well using &amp;quot;traditional&amp;quot; logic above + since it no longer defines _BSD_RUNE_T_ yet still desires to export + rune_t in some cases... */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stddef.h" line="359" suspect="1"&gt; + &lt;text&gt; + /* In 4.3bsd-net2, leave these undefined to indicate that size_t, etc. + are already defined. */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stddef.h" line="361" suspect="1"&gt; + &lt;text&gt; + /* BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here. */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stddef.h" line="394" suspect="1"&gt; + &lt;text&gt; + /* A null pointer constant. */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stddef.h" line="412" suspect="1"&gt; + &lt;text&gt; + /* Offset of member MEMBER in a struct of type TYPE. */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cstring" line="53" suspect="1"&gt; &lt;text&gt; // Get rid of those macros defined in &amp;lt;string.h&amp;gt; in lieu of real functions. &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/cstdlib - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cstdlib" line="54" suspect="1"&gt; &lt;text&gt; // Get rid of those macros defined in &amp;lt;stdlib.h&amp;gt; in lieu of real functions. &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/exception - &lt;/file&gt; - &lt;text&gt; - // Exception Handling support header for -*- C++ -*- - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/exception - &lt;/file&gt; - &lt;text&gt; - // Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002 + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/new" line="1" suspect="1"&gt; + &lt;text&gt; + // The -*- C++ -*- dynamic memory management header. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/new" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 1994, 1996, 1997, 1998, 2000, 2001, 2002 // Free Software Foundation -// -// This file is part of GNU CC. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/new" line="6" suspect="1"&gt; + &lt;text&gt; + // This file is part of GNU CC. // // GNU CC is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -57,10 +321,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/exception - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/new" line="23" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate @@ -73,70 +334,47 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/exception - &lt;/file&gt; - &lt;text&gt; - /** @file exception - * This header defines several types and functions relating to the - * handling of exceptions in a C++ program. - */ - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stringfwd.h - &lt;/file&gt; - &lt;text&gt; - // String support -*- C++ -*- - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stringfwd.h - &lt;/file&gt; - &lt;text&gt; - // Copyright (C) 2001, 2002 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute 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) + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/new" line="32" suspect="1"&gt; + &lt;text&gt; + /** @file new + * The header @c new defines several functions to manage dynamic memory and + * handling memory allocation errors; see + * http://gcc.gnu.org/onlinedocs/libstdc++/18_support/howto.html#4 for more. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception" line="1" suspect="1"&gt; + &lt;text&gt; + // Exception Handling support header for -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002 +// Free Software Foundation +// +// This file is part of GNU CC. +// +// GNU CC is free software; you can redistribute 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. - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stringfwd.h - &lt;/file&gt; - &lt;text&gt; - // This library is distributed in the hope that it will be useful, +// +// GNU CC is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stringfwd.h - &lt;/file&gt; - &lt;text&gt; - // You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stringfwd.h - &lt;/file&gt; +// +// You should have received a copy of the GNU General Public License +// along with GNU CC; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception" line="23" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate @@ -149,54 +387,42 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stringfwd.h - &lt;/file&gt; - &lt;text&gt; - // -// ISO C++ 14882: 21 Strings library -// - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stringfwd.h - &lt;/file&gt; - &lt;text&gt; - /** @file stringfwd.h - * This is an internal header file, included by other library headers. - * You should not attempt to use it directly. - */ - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/cstdio - &lt;/file&gt; - &lt;text&gt; - // Get rid of those macros defined in &amp;lt;stdio.h&amp;gt; in lieu of real functions. - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/ctime - &lt;/file&gt; - &lt;text&gt; - // -*- C++ -*- forwarding header. - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/ctime - &lt;/file&gt; - &lt;text&gt; - // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 -// Free Software Foundation, Inc. + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception" line="32" suspect="1"&gt; + &lt;text&gt; + /** @file exception + * This header defines several types and functions relating to the + * handling of exceptions in a C++ program. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception" line="116" suspect="1"&gt; + &lt;text&gt; + // extern &amp;quot;C++&amp;quot; + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/clocale" line="51" suspect="1"&gt; + &lt;text&gt; + // Get rid of those macros defined in &amp;lt;locale.h&amp;gt; in lieu of real functions. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cctype" line="51" suspect="1"&gt; + &lt;text&gt; + // Get rid of those macros defined in &amp;lt;ctype.h&amp;gt; in lieu of real functions. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stringfwd.h" line="1" suspect="1"&gt; + &lt;text&gt; + // String support -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stringfwd.h" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -206,10 +432,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/ctime - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stringfwd.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -218,10 +441,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/ctime - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stringfwd.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free @@ -230,10 +450,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/ctime - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stringfwd.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate @@ -246,76 +463,45 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/ctime - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stringfwd.h" line="30" suspect="1"&gt; &lt;text&gt; // -// ISO C++ 14882: 20.5 Date and time -// - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/ctime - &lt;/file&gt; - &lt;text&gt; - /** @file ctime - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the &amp;quot;*.h&amp;quot; implementation files. - * - * This is the C++ version of the Standard C Library header @c time.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std. - */ - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/ctime - &lt;/file&gt; - &lt;text&gt; - // Get rid of those macros defined in &amp;lt;time.h&amp;gt; in lieu of real functions. - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/cwchar - &lt;/file&gt; - &lt;text&gt; - // Need to do a bit of trickery here with mbstate_t as char_traits -// assumes it is in wchar.h, regardless of wchar_t specializations. - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/cwchar - &lt;/file&gt; - &lt;text&gt; - // Get rid of those macros defined in &amp;lt;wchar.h&amp;gt; in lieu of real functions. - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_pair.h - &lt;/file&gt; - &lt;text&gt; - // Pair implementation -*- C++ -*- - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_pair.h - &lt;/file&gt; - &lt;text&gt; - // Copyright (C) 2001 Free Software Foundation, Inc. +// ISO C++ 14882: 21 Strings library +// + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stringfwd.h" line="34" suspect="1"&gt; + &lt;text&gt; + /** @file stringfwd.h + * This is an internal header file, included by other library headers. + * You should not attempt to use it directly. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cstdio" line="54" suspect="1"&gt; + &lt;text&gt; + // Get rid of those macros defined in &amp;lt;stdio.h&amp;gt; in lieu of real functions. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/i686-pc-linux-gnu/bits/gthr.h" line="100" suspect="1"&gt; + &lt;text&gt; + /* Fallback to single thread definitions. */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cwchar" line="1" suspect="1"&gt; + &lt;text&gt; + // -*- C++ -*- forwarding header. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cwchar" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 +// Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -325,10 +511,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_pair.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cwchar" line="12" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -337,10 +520,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_pair.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cwchar" line="17" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free @@ -349,10 +529,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_pair.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cwchar" line="22" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate @@ -365,66 +542,37 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_pair.h - &lt;/file&gt; - &lt;text&gt; - /* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. - */ - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_pair.h - &lt;/file&gt; - &lt;text&gt; - /** @file stl_pair.h - * This is an internal header file, included by other library headers. - * You should not attempt to use it directly. - */ - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h - &lt;/file&gt; - &lt;text&gt; - // Types used in iterator implementation -*- C++ -*- - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h - &lt;/file&gt; - &lt;text&gt; - // Copyright (C) 2001, 2002 Free Software Foundation, Inc. + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cwchar" line="31" suspect="1"&gt; + &lt;text&gt; + // +// ISO C++ 14882: 21.4 +// + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cwchar" line="35" suspect="1"&gt; + &lt;text&gt; + /** @file cwchar + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the &amp;quot;*.h&amp;quot; implementation files. + * + * This is the C++ version of the Standard C Library header @c wchar.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/ctime" line="1" suspect="1"&gt; + &lt;text&gt; + // -*- C++ -*- forwarding header. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/ctime" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 +// Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -434,10 +582,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/ctime" line="12" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -446,10 +591,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/ctime" line="17" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free @@ -458,10 +600,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/ctime" line="22" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate @@ -474,80 +613,61 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h - &lt;/file&gt; - &lt;text&gt; - /* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. - * - * - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. - */ - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h - &lt;/file&gt; - &lt;text&gt; - /** @file stl_iterator_base_types.h - * This is an internal header file, included by other library headers. - * You should not attempt to use it directly. - * - * This file contains all of the general iterator-related utility types, - * such as iterator_traits and struct iterator. - */ - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="0"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_iterator_base_funcs.h - &lt;/file&gt; - &lt;text&gt; - // Since this entire file is within namespace std, there's no reason to -// waste two spaces along the left column. Thus the leading indentation is -// slightly violated from here on. - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_iterator.h - &lt;/file&gt; - &lt;text&gt; - // Iterators -*- C++ -*- - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_iterator.h - &lt;/file&gt; - &lt;text&gt; - // Copyright (C) 2001, 2002 Free Software Foundation, Inc. + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/ctime" line="31" suspect="1"&gt; + &lt;text&gt; + // +// ISO C++ 14882: 20.5 Date and time +// + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/ctime" line="35" suspect="1"&gt; + &lt;text&gt; + /** @file ctime + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the &amp;quot;*.h&amp;quot; implementation files. + * + * This is the C++ version of the Standard C Library header @c time.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/ctime" line="53" suspect="1"&gt; + &lt;text&gt; + // Get rid of those macros defined in &amp;lt;time.h&amp;gt; in lieu of real functions. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cwchar" line="57" suspect="1"&gt; + &lt;text&gt; + // Need to do a bit of trickery here with mbstate_t as char_traits +// assumes it is in wchar.h, regardless of wchar_t specializations. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cwchar" line="74" suspect="1"&gt; + &lt;text&gt; + // Get rid of those macros defined in &amp;lt;wchar.h&amp;gt; in lieu of real functions. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/fpos.h" line="125" suspect="1"&gt; + &lt;text&gt; + // namespace std + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="1" suspect="1"&gt; + &lt;text&gt; + // Function-Based Exception Support -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 2001 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -557,10 +677,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_iterator.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -569,10 +686,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_iterator.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free @@ -581,10 +695,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_iterator.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate @@ -597,68 +708,21 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_iterator.h - &lt;/file&gt; - &lt;text&gt; - /* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. - * - * - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. - */ - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_iterator.h - &lt;/file&gt; - &lt;text&gt; - /** @file stl_iterator.h - * This is an internal header file, included by other library headers. - * You should not attempt to use it directly. - * - * This file implements reverse_iterator, back_insert_iterator, - * front_insert_iterator, insert_iterator, __normal_iterator, and their - * supporting functions and overloaded operators. - */ - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_threads.h - &lt;/file&gt; - &lt;text&gt; - // Threading support -*- C++ -*- - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_threads.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="30" suspect="1"&gt; + &lt;text&gt; + // +// ISO C++ 14882: 19.1 Exception classes +// + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="1" suspect="1"&gt; + &lt;text&gt; + // -fno-exceptions Support -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001 Free Software Foundation, Inc. // @@ -670,10 +734,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_threads.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -682,10 +743,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_threads.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free @@ -694,10 +752,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_threads.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate @@ -710,62 +765,41 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_threads.h - &lt;/file&gt; - &lt;text&gt; - /* - * Copyright (c) 1997-1999 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. - */ - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_threads.h - &lt;/file&gt; - &lt;text&gt; - /** @file stl_threads.h - * This is an internal header file, included by other library headers. - * You should not attempt to use it directly. - */ - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_threads.h - &lt;/file&gt; - &lt;text&gt; - // The only supported threading model is GCC's own gthr.h abstraction layer. - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_construct.h - &lt;/file&gt; - &lt;text&gt; - // nonstandard construct and destroy functions -*- C++ -*- - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_construct.h - &lt;/file&gt; - &lt;text&gt; - // Copyright (C) 2001, 2002 Free Software Foundation, Inc. + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="30" suspect="1"&gt; + &lt;text&gt; + // +// ISO C++ 14882: 19.1 Exception classes +// + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="40" suspect="1"&gt; + &lt;text&gt; + // Else proceed normally. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="84" suspect="1"&gt; + &lt;text&gt; + // namespace std + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/iosfwd" line="166" suspect="1"&gt; + &lt;text&gt; + // namespace std + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_pair.h" line="1" suspect="1"&gt; + &lt;text&gt; + // Pair implementation -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_pair.h" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 2001 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -775,10 +809,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_construct.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_pair.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -787,10 +818,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_construct.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_pair.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free @@ -799,10 +827,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_construct.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_pair.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate @@ -815,10 +840,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_construct.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_pair.h" line="30" suspect="1"&gt; &lt;text&gt; /* * @@ -848,33 +870,32 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_construct.h - &lt;/file&gt; - &lt;text&gt; - /** @file stl_construct.h + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_pair.h" line="56" suspect="1"&gt; + &lt;text&gt; + /** @file stl_pair.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_uninitialized.h - &lt;/file&gt; - &lt;text&gt; - // Raw memory manipulators -*- C++ -*- - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_uninitialized.h - &lt;/file&gt; - &lt;text&gt; - // Copyright (C) 2001 Free Software Foundation, Inc. + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/type_traits.h" line="337" suspect="0"&gt; + &lt;text&gt; + // Local Variables: +// mode:C++ +// End: + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_types.h" line="1" suspect="1"&gt; + &lt;text&gt; + // Types used in iterator implementation -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_types.h" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -884,10 +905,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_uninitialized.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_types.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -896,10 +914,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_uninitialized.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_types.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free @@ -908,10 +923,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_uninitialized.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_types.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate @@ -924,10 +936,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_uninitialized.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_types.h" line="30" suspect="1"&gt; &lt;text&gt; /* * @@ -943,7 +952,7 @@ * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. * * - * Copyright (c) 1996,1997 + * Copyright (c) 1996-1998 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software @@ -957,31 +966,31 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_uninitialized.h - &lt;/file&gt; - &lt;text&gt; - /** @file stl_uninitialized.h + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_types.h" line="56" suspect="1"&gt; + &lt;text&gt; + /** @file stl_iterator_base_types.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. - */ - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_bvector.h - &lt;/file&gt; - &lt;text&gt; - // bit_vector and vector&amp;lt;bool&amp;gt; specialization -*- C++ -*- - - &lt;/text&gt; - &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_bvector.h - &lt;/file&gt; + * + * This file contains all of the general iterator-related utility types, + * such as iterator_traits and struct iterator. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_types.h" line="162" suspect="1"&gt; + &lt;text&gt; + // namespace std + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_funcs.h" line="1" suspect="1"&gt; + &lt;text&gt; + // Functions used by iterators -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_funcs.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // @@ -993,10 +1002,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_bvector.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_funcs.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -1005,10 +1011,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_bvector.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_funcs.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free @@ -1017,10 +1020,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_bvector.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_funcs.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate @@ -1033,10 +1033,7 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_bvector.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_funcs.h" line="30" suspect="1"&gt; &lt;text&gt; /* * @@ -1052,7 +1049,7 @@ * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. * * - * Copyright (c) 1996-1999 + * Copyright (c) 1996-1998 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software @@ -1066,10 +1063,1067 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_bvector.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_funcs.h" line="56" suspect="1"&gt; + &lt;text&gt; + /** @file stl_iterator_base_funcs.h + * This is an internal header file, included by other library headers. + * You should not attempt to use it directly. + * + * This file contains all of the general iterator-related utility + * functions, such as distance() and advance(). + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/concept_check.h" line="1" suspect="1"&gt; + &lt;text&gt; + // Concept-checking control -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/concept_check.h" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute 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. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/concept_check.h" line="11" suspect="1"&gt; + &lt;text&gt; + // This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/concept_check.h" line="16" suspect="1"&gt; + &lt;text&gt; + // You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/concept_check.h" line="21" suspect="1"&gt; + &lt;text&gt; + // As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/concept_check.h" line="30" suspect="1"&gt; + &lt;text&gt; + /** @file concept_check.h + * This is an internal header file, included by other library headers. + * You should not attempt to use it directly. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/concept_check.h" line="42" suspect="1"&gt; + &lt;text&gt; + // All places in libstdc++-v3 where these are used, or /might/ be used, or +// don't need to be used, or perhaps /should/ be used, are commented with +// &amp;quot;concept requirements&amp;quot; (and maybe some more text). So grep like crazy +// if you're looking for additional places to use these. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/concept_check.h" line="47" suspect="1"&gt; + &lt;text&gt; + // Concept-checking code is off by default unless users turn it on via +// configure options or editing c++config.h. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_funcs.h" line="169" suspect="1"&gt; + &lt;text&gt; + // namespace std + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" line="1" suspect="1"&gt; + &lt;text&gt; + // Iterators -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute 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. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" line="11" suspect="1"&gt; + &lt;text&gt; + // This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" line="16" suspect="1"&gt; + &lt;text&gt; + // You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" line="21" suspect="1"&gt; + &lt;text&gt; + // As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" line="30" suspect="1"&gt; + &lt;text&gt; + /* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. + * + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" line="56" suspect="1"&gt; + &lt;text&gt; + /** @file stl_iterator.h + * This is an internal header file, included by other library headers. + * You should not attempt to use it directly. + * + * This file implements reverse_iterator, back_insert_iterator, + * front_insert_iterator, insert_iterator, __normal_iterator, and their + * supporting functions and overloaded operators. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" line="739" suspect="1"&gt; + &lt;text&gt; + // namespace __gnu_cxx + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" line="743" suspect="0"&gt; + &lt;text&gt; + // Local Variables: +// mode:C++ +// End: + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_algobase.h" line="814" suspect="1"&gt; + &lt;text&gt; + // namespace std + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_algobase.h" line="818" suspect="0"&gt; + &lt;text&gt; + // Local Variables: +// mode:C++ +// End: + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_alloc.h" line="1" suspect="1"&gt; + &lt;text&gt; + // Allocators -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_alloc.h" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute 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. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_alloc.h" line="11" suspect="1"&gt; + &lt;text&gt; + // This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_alloc.h" line="16" suspect="1"&gt; + &lt;text&gt; + // You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_alloc.h" line="21" suspect="1"&gt; + &lt;text&gt; + // As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_alloc.h" line="30" suspect="1"&gt; + &lt;text&gt; + /* + * Copyright (c) 1996-1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_alloc.h" line="43" suspect="1"&gt; + &lt;text&gt; + /** @file stl_alloc.h + * This is an internal header file, included by other library headers. + * You should not attempt to use it directly. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_alloc.h" line="51" suspect="1"&gt; + &lt;text&gt; + /** + * @defgroup Allocators Memory Allocators + * @if maint + * stl_alloc.h implements some node allocators. These are NOT the same as + * allocators in the C++ standard, nor in the original H-P STL. They do not + * encapsulate different pointer types; we assume that there is only one + * pointer type. The C++ standard allocators are intended to allocate + * individual objects, not pools or arenas. + * + * In this file allocators are of two different styles: &amp;quot;standard&amp;quot; and + * &amp;quot;SGI&amp;quot; (quotes included). &amp;quot;Standard&amp;quot; allocators conform to 20.4. &amp;quot;SGI&amp;quot; + * allocators differ in AT LEAST the following ways (add to this list as you + * discover them): + * + * - &amp;quot;Standard&amp;quot; allocate() takes two parameters (n_count,hint=0) but &amp;quot;SGI&amp;quot; + * allocate() takes one paramter (n_size). + * - Likewise, &amp;quot;standard&amp;quot; deallocate()'s argument is a count, but in &amp;quot;SGI&amp;quot; + * is a byte size. + * - max_size(), construct(), and destroy() are missing in &amp;quot;SGI&amp;quot; allocators. + * - reallocate(p,oldsz,newsz) is added in &amp;quot;SGI&amp;quot;, and behaves as + * if p=realloc(p,newsz). + * + * &amp;quot;SGI&amp;quot; allocators may be wrapped in __allocator to convert the interface + * into a &amp;quot;standard&amp;quot; one. + * @endif + * + * @note The @c reallocate member functions have been deprecated for 3.2 + * and will be removed in 3.4. You must define @c _GLIBCPP_DEPRECATED + * to make this visible in 3.2; see c++config.h. + * + * The canonical description of these classes is in docs/html/ext/howto.html + * or online at http://gcc.gnu.org/onlinedocs/libstdc++/ext/howto.html#3 +*/ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="1" suspect="1"&gt; + &lt;text&gt; + // Function-Based Exception Support -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute 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. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="11" suspect="1"&gt; + &lt;text&gt; + // This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="16" suspect="1"&gt; + &lt;text&gt; + // You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="21" suspect="1"&gt; + &lt;text&gt; + // As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="30" suspect="1"&gt; + &lt;text&gt; + // +// ISO C++ 14882: 19.1 Exception classes +// + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="1" suspect="1"&gt; + &lt;text&gt; + // -fno-exceptions Support -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute 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. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="11" suspect="1"&gt; + &lt;text&gt; + // This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="16" suspect="1"&gt; + &lt;text&gt; + // You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="21" suspect="1"&gt; + &lt;text&gt; + // As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="30" suspect="1"&gt; + &lt;text&gt; + // +// ISO C++ 14882: 19.1 Exception classes +// + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="40" suspect="1"&gt; + &lt;text&gt; + // Else proceed normally. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="84" suspect="1"&gt; + &lt;text&gt; + // namespace std + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="1" suspect="1"&gt; + &lt;text&gt; + // Threading support -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute 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. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="11" suspect="1"&gt; + &lt;text&gt; + // This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="16" suspect="1"&gt; + &lt;text&gt; + // You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="21" suspect="1"&gt; + &lt;text&gt; + // As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="30" suspect="1"&gt; + &lt;text&gt; + /* + * Copyright (c) 1997-1999 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="43" suspect="1"&gt; + &lt;text&gt; + /** @file stl_threads.h + * This is an internal header file, included by other library headers. + * You should not attempt to use it directly. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="51" suspect="1"&gt; + &lt;text&gt; + // The only supported threading model is GCC's own gthr.h abstraction layer. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="129" suspect="1"&gt; + &lt;text&gt; + //namespace std + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="131" suspect="1"&gt; + &lt;text&gt; + // Locking class. Note that this class *does not have a + // constructor*. It must be initialized either statically, with + // __STL_MUTEX_INITIALIZER, or dynamically, by explicitly calling + // the _M_initialize member function. (This is similar to the ways + // that a pthreads mutex can be initialized.) There are explicit + // member functions for acquiring and releasing the lock. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="138" suspect="1"&gt; + &lt;text&gt; + // There is no constructor because static initialization is + // essential for some uses, and only a class aggregate (see section + // 8.5.1 of the C++ standard) can be initialized that way. That + // means we must have no constructors, no base classes, no virtual + // functions, and no private or protected members. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_alloc.h" line="972" suspect="1"&gt; + &lt;text&gt; + // namespace std + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_construct.h" line="1" suspect="1"&gt; + &lt;text&gt; + // nonstandard construct and destroy functions -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_construct.h" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute 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. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_construct.h" line="11" suspect="1"&gt; + &lt;text&gt; + // This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_construct.h" line="16" suspect="1"&gt; + &lt;text&gt; + // You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_construct.h" line="21" suspect="1"&gt; + &lt;text&gt; + // As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_construct.h" line="30" suspect="1"&gt; + &lt;text&gt; + /* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_construct.h" line="56" suspect="1"&gt; + &lt;text&gt; + /** @file stl_construct.h + * This is an internal header file, included by other library headers. + * You should not attempt to use it directly. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_construct.h" line="145" suspect="1"&gt; + &lt;text&gt; + // namespace std + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_uninitialized.h" line="1" suspect="1"&gt; + &lt;text&gt; + // Raw memory manipulators -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_uninitialized.h" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute 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. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_uninitialized.h" line="11" suspect="1"&gt; + &lt;text&gt; + // This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_uninitialized.h" line="16" suspect="1"&gt; + &lt;text&gt; + // You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_uninitialized.h" line="21" suspect="1"&gt; + &lt;text&gt; + // As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_uninitialized.h" line="30" suspect="1"&gt; + &lt;text&gt; + /* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_uninitialized.h" line="56" suspect="1"&gt; + &lt;text&gt; + /** @file stl_uninitialized.h + * This is an internal header file, included by other library headers. + * You should not attempt to use it directly. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_uninitialized.h" line="284" suspect="1"&gt; + &lt;text&gt; + // namespace std + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_uninitialized.h" line="288" suspect="0"&gt; + &lt;text&gt; + // Local Variables: +// mode:C++ +// End: + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_vector.h" line="1" suspect="1"&gt; + &lt;text&gt; + // Vector implementation -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_vector.h" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute 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. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_vector.h" line="11" suspect="1"&gt; + &lt;text&gt; + // This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_vector.h" line="16" suspect="1"&gt; + &lt;text&gt; + // You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_vector.h" line="21" suspect="1"&gt; + &lt;text&gt; + // As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_vector.h" line="30" suspect="1"&gt; + &lt;text&gt; + /* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. + * + * + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_vector.h" line="56" suspect="1"&gt; + &lt;text&gt; + /** @file stl_vector.h + * This is an internal header file, included by other library headers. + * You should not attempt to use it directly. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="1" suspect="1"&gt; + &lt;text&gt; + // Function-Based Exception Support -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute 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. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="11" suspect="1"&gt; + &lt;text&gt; + // This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="16" suspect="1"&gt; + &lt;text&gt; + // You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="21" suspect="1"&gt; + &lt;text&gt; + // As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="30" suspect="1"&gt; + &lt;text&gt; + // +// ISO C++ 14882: 19.1 Exception classes +// + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="1" suspect="1"&gt; + &lt;text&gt; + // -fno-exceptions Support -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute 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. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="11" suspect="1"&gt; + &lt;text&gt; + // This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="16" suspect="1"&gt; + &lt;text&gt; + // You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="21" suspect="1"&gt; + &lt;text&gt; + // As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="30" suspect="1"&gt; + &lt;text&gt; + // +// ISO C++ 14882: 19.1 Exception classes +// + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="40" suspect="1"&gt; + &lt;text&gt; + // Else proceed normally. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="84" suspect="1"&gt; + &lt;text&gt; + // namespace std + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_vector.h" line="990" suspect="1"&gt; + &lt;text&gt; + // namespace std + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="1" suspect="1"&gt; + &lt;text&gt; + // bit_vector and vector&amp;lt;bool&amp;gt; specialization -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute 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. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="11" suspect="1"&gt; + &lt;text&gt; + // This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="16" suspect="1"&gt; + &lt;text&gt; + // You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="21" suspect="1"&gt; + &lt;text&gt; + // As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="30" suspect="1"&gt; + &lt;text&gt; + /* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. + * + * + * Copyright (c) 1996-1999 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="56" suspect="1"&gt; &lt;text&gt; /** @file stl_bvector.h * This is an internal header file, included by other library headers. @@ -1078,50 +2132,137 @@ &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_bvector.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="337" suspect="1"&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_bvector.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="339" suspect="1"&gt; &lt;text&gt; // Declare a partial specialization of vector&amp;lt;T, Alloc&amp;gt;. &lt;/text&gt; &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="723" suspect="1"&gt; + &lt;text&gt; + // namespace std + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="727" suspect="0"&gt; + &lt;text&gt; + // Local Variables: +// mode:C++ +// End: + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/vector.tcc" line="1" suspect="1"&gt; + &lt;text&gt; + // Vector implementation (out of line) -*- C++ -*- + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/vector.tcc" line="3" suspect="1"&gt; + &lt;text&gt; + // Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute 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. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/vector.tcc" line="11" suspect="1"&gt; + &lt;text&gt; + // This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/vector.tcc" line="16" suspect="1"&gt; + &lt;text&gt; + // You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/vector.tcc" line="21" suspect="1"&gt; + &lt;text&gt; + // As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/vector.tcc" line="30" suspect="1"&gt; + &lt;text&gt; + /* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. + * + * + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. + */ + + &lt;/text&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/vector.tcc" line="56" suspect="1"&gt; + &lt;text&gt; + /** @file vector.tcc + * This is an internal header file, included by other library headers. + * You should not attempt to use it directly. + */ + + &lt;/text&gt; + &lt;/instance&gt; &lt;/comments&gt; &lt;/instance&gt; - &lt;instance accessibility="0" class="Synopsis.AST.Module" file="/usr/include/c++/3.2.2/bits/stl_iterator.h" language="C++" line="0" name="__gnu_cxx" type="namespace"&gt; + &lt;instance accessibility="0" class="Synopsis.AST.Module" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" language="C++" line="0" name="__gnu_cxx" type="namespace"&gt; &lt;comments&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/exception - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception" line="101" suspect="1"&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="0"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/type_traits.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/type_traits.h" line="324" suspect="0"&gt; &lt;text&gt; // Forward declaration hack, should really include this from somewhere. &lt;/text&gt; &lt;/instance&gt; - &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_iterator.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" line="557" suspect="1"&gt; &lt;text&gt; // namespace std @@ -1130,6 +2271,14 @@ &lt;/comments&gt; &lt;/instance&gt; &lt;instance accessibility="0" class="Synopsis.AST.Module" file="Parsers/Cxx/input/std.cc" language="C++" line="0" name="Foo" type="namespace"&gt; + &lt;comments&gt; + &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/vector.tcc" line="435" suspect="1"&gt; + &lt;text&gt; + // namespace std + + &lt;/text&gt; + &lt;/instance&gt; + &lt;/comments&gt; &lt;declarations&gt; &lt;instance accessibility="0" class="Synopsis.AST.Function" file="Parsers/Cxx/input/std.cc" language="C++" line="5" name="Foo.func(std::vector&amp;lt;int&amp;gt;)" realname="func" type="function"&gt; &lt;parameters&gt; @@ -1181,254 +2330,281 @@ &lt;/instance&gt; &lt;/types&gt; &lt;files&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_iterator_base_funcs.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/i386-redhat-linux/bits/c++config.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/cstddef - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/fpos.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_alloc.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/bits/sigthread.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/xlocale.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_bvector.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/bits/sigset.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/bits/xopen_lim.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/bits/local_lim.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/exception - &lt;/file&gt; - &lt;file&gt; - /usr/include/sys/sysmacros.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/iosfwd - &lt;/file&gt; - &lt;file&gt; - /usr/include/_G_config.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_threads.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_construct.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/signal.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/sys/cdefs.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/i386-redhat-linux/bits/gthr-default.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_uninitialized.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/new - &lt;/file&gt; - &lt;file&gt; - /usr/include/bits/posix2_lim.h - &lt;/file&gt; - &lt;file&gt; - /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stddef.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/string.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/i386-redhat-linux/bits/atomicity.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/stdlib.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/cstdlib - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/i386-redhat-linux/bits/c++io.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/gnu/stubs.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/functexcept.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/bits/waitflags.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/i386-redhat-linux/bits/gthr.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/bits/waitstatus.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/bits/endian.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/limits.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_vector.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stringfwd.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/bits/posix1_lim.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/bits/typesizes.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/bits/sched.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/pthread.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_iterator.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/wchar.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/climits - &lt;/file&gt; - &lt;file&gt; - /usr/include/libio.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_algobase.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/bits/wchar.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/features.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/bits/sys_errlist.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/bits/pthreadtypes.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/exception_defines.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/bits/select.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/alloca.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/ctime - &lt;/file&gt; - &lt;file&gt; - /usr/include/bits/types.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/cwchar - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/cassert - &lt;/file&gt; - &lt;file&gt; - /usr/include/bits/stdio_lim.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/bits/initspin.h - &lt;/file&gt; - &lt;file&gt; - /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stdarg.h - &lt;/file&gt; - &lt;file&gt; - Parsers/Cxx/input/std.cc - &lt;/file&gt; - &lt;file&gt; - /usr/include/bits/time.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/time.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/linux/limits.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/assert.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/i386-redhat-linux/bits/os_defines.h - &lt;/file&gt; - &lt;file&gt; - /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/limits.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/gconv.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/sys/types.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/type_traits.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/concept_check.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/endian.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/sched.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/bits/wordsize.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/vector - &lt;/file&gt; - &lt;file&gt; - /usr/include/sys/select.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/cstdio - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/bits/stl_pair.h - &lt;/file&gt; - &lt;file&gt; - /usr/include/c++/3.2.2/cstring - &lt;/file&gt; - &lt;file&gt; - /usr/include/stdio.h - &lt;/file&gt; - &lt;file&gt; - /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/syslimits.h - &lt;/file&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/locale.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/unistd.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/sys/sysmacros.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/locale.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/_G_config.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/posix2_lim.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/stdlib.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/gnu/stubs.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/gconv.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_construct.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/iosfwd" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/exception_defines.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/bits/sigthread.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/concept_check.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stdio.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/vector" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/endian.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/cwchar" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/environments.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stringfwd.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/sys/types.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/wordsize.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/functexcept.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stdarg.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/i686-pc-linux-gnu/bits/atomicity.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/clocale" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/i686-pc-linux-gnu/bits/c++io.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/xopen_lim.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_vector.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_uninitialized.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/wchar.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/new" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_alloc.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/limits.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/waitstatus.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/posix1_lim.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/typesizes.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/sched.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/posix_opt.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/features.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/confname.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/exception" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/cstdio" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/libio.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/local_lim.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/cstddef" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/signal.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/i686-pc-linux-gnu/bits/c++config.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/xlocale.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/ctype.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/i686-pc-linux-gnu/bits/gthr.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/fpos.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/cstring" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_pair.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/sys/cdefs.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/cstdlib" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/pthreadtypes.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/time.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/select.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/alloca.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/stdio_lim.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="Parsers/Cxx/input/std.cc" is_main="1" language="C++"&gt; + &lt;declarations/&gt; + &lt;includes&gt; + &lt;instance class="Synopsis.AST.Include" is_macro="0" is_next="0" name="&amp;lt;vector&amp;gt;"&gt; + &lt;target/&gt; + &lt;/instance&gt; + &lt;/includes&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_algobase.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/i686-pc-linux-gnu/bits/c++locale.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/pthread.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/i686-pc-linux-gnu/bits/gthr-default.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/syslimits.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/ctime" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/sigset.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/i686-pc-linux-gnu/bits/os_defines.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/sched.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/waitflags.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/string.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/limits.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/climits" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_types.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stddef.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/wchar.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/type_traits.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/sys/select.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/vector.tcc" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/types.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/getopt.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/time.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_funcs.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/cctype" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; + &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/endian.h" is_main="0" language="C++"&gt; + &lt;macro_calls/&gt; + &lt;/instance&gt; &lt;/files&gt; &lt;/ast&gt; </pre>" "<pre>&lt;?xml version='1.0' encoding='ISO-8859-1'?&gt; &lt;ast&gt; &lt;declarations&gt; &lt;instance accessibility="0" class="Synopsis.AST.Module" file="/usr/include/c++/3.2.2/bits/stl_bvector.h" language="C++" line="0" name="std" type="namespace"&gt; &lt;comments&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/cstring &lt;/file&gt; &lt;text&gt; // Get rid of those macros defined in &amp;lt;string.h&amp;gt; in lieu of real functions. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/cstdlib &lt;/file&gt; &lt;text&gt; // Get rid of those macros defined in &amp;lt;stdlib.h&amp;gt; in lieu of real functions. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/exception &lt;/file&gt; &lt;text&gt; // Exception Handling support header for -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/exception &lt;/file&gt; &lt;text&gt; // Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002 // Free Software Foundation // // This file is part of GNU CC. // // GNU CC is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) // any later version. // // GNU CC is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with GNU CC; see the file COPYING. If not, write to // the Free Software Foundation, 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/exception &lt;/file&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/exception &lt;/file&gt; &lt;text&gt; /** @file exception * This header defines several types and functions relating to the * handling of exceptions in a C++ program. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stringfwd.h &lt;/file&gt; &lt;text&gt; // String support -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stringfwd.h &lt;/file&gt; &lt;text&gt; // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stringfwd.h &lt;/file&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stringfwd.h &lt;/file&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stringfwd.h &lt;/file&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stringfwd.h &lt;/file&gt; &lt;text&gt; // // ISO C++ 14882: 21 Strings library // &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stringfwd.h &lt;/file&gt; &lt;text&gt; /** @file stringfwd.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/cstdio &lt;/file&gt; &lt;text&gt; // Get rid of those macros defined in &amp;lt;stdio.h&amp;gt; in lieu of real functions. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/ctime &lt;/file&gt; &lt;text&gt; // -*- C++ -*- forwarding header. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/ctime &lt;/file&gt; &lt;text&gt; // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/ctime &lt;/file&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/ctime &lt;/file&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/ctime &lt;/file&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/ctime &lt;/file&gt; &lt;text&gt; // // ISO C++ 14882: 20.5 Date and time // &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/ctime &lt;/file&gt; &lt;text&gt; /** @file ctime * This is a Standard C++ Library file. You should @c #include this file * in your programs, rather than any of the &amp;quot;*.h&amp;quot; implementation files. * * This is the C++ version of the Standard C Library header @c time.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/ctime &lt;/file&gt; &lt;text&gt; // Get rid of those macros defined in &amp;lt;time.h&amp;gt; in lieu of real functions. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/cwchar &lt;/file&gt; &lt;text&gt; // Need to do a bit of trickery here with mbstate_t as char_traits // assumes it is in wchar.h, regardless of wchar_t specializations. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/cwchar &lt;/file&gt; &lt;text&gt; // Get rid of those macros defined in &amp;lt;wchar.h&amp;gt; in lieu of real functions. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_pair.h &lt;/file&gt; &lt;text&gt; // Pair implementation -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_pair.h &lt;/file&gt; &lt;text&gt; // Copyright (C) 2001 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_pair.h &lt;/file&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_pair.h &lt;/file&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_pair.h &lt;/file&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_pair.h &lt;/file&gt; &lt;text&gt; /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_pair.h &lt;/file&gt; &lt;text&gt; /** @file stl_pair.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h &lt;/file&gt; &lt;text&gt; // Types used in iterator implementation -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h &lt;/file&gt; &lt;text&gt; // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h &lt;/file&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h &lt;/file&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h &lt;/file&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h &lt;/file&gt; &lt;text&gt; /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. * * * Copyright (c) 1996-1998 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h &lt;/file&gt; &lt;text&gt; /** @file stl_iterator_base_types.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. * * This file contains all of the general iterator-related utility types, * such as iterator_traits and struct iterator. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="0"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_iterator_base_funcs.h &lt;/file&gt; &lt;text&gt; // Since this entire file is within namespace std, there's no reason to // waste two spaces along the left column. Thus the leading indentation is // slightly violated from here on. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_iterator.h &lt;/file&gt; &lt;text&gt; // Iterators -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_iterator.h &lt;/file&gt; &lt;text&gt; // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_iterator.h &lt;/file&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_iterator.h &lt;/file&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_iterator.h &lt;/file&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_iterator.h &lt;/file&gt; &lt;text&gt; /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. * * * Copyright (c) 1996-1998 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_iterator.h &lt;/file&gt; &lt;text&gt; /** @file stl_iterator.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. * * This file implements reverse_iterator, back_insert_iterator, * front_insert_iterator, insert_iterator, __normal_iterator, and their * supporting functions and overloaded operators. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_threads.h &lt;/file&gt; &lt;text&gt; // Threading support -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_threads.h &lt;/file&gt; &lt;text&gt; // Copyright (C) 2001 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_threads.h &lt;/file&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_threads.h &lt;/file&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_threads.h &lt;/file&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_threads.h &lt;/file&gt; &lt;text&gt; /* * Copyright (c) 1997-1999 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_threads.h &lt;/file&gt; &lt;text&gt; /** @file stl_threads.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_threads.h &lt;/file&gt; &lt;text&gt; // The only supported threading model is GCC's own gthr.h abstraction layer. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_construct.h &lt;/file&gt; &lt;text&gt; // nonstandard construct and destroy functions -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_construct.h &lt;/file&gt; &lt;text&gt; // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_construct.h &lt;/file&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_construct.h &lt;/file&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_construct.h &lt;/file&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_construct.h &lt;/file&gt; &lt;text&gt; /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_construct.h &lt;/file&gt; &lt;text&gt; /** @file stl_construct.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_uninitialized.h &lt;/file&gt; &lt;text&gt; // Raw memory manipulators -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_uninitialized.h &lt;/file&gt; &lt;text&gt; // Copyright (C) 2001 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_uninitialized.h &lt;/file&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_uninitialized.h &lt;/file&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_uninitialized.h &lt;/file&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_uninitialized.h &lt;/file&gt; &lt;text&gt; /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_uninitialized.h &lt;/file&gt; &lt;text&gt; /** @file stl_uninitialized.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_bvector.h &lt;/file&gt; &lt;text&gt; // bit_vector and vector&amp;lt;bool&amp;gt; specialization -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_bvector.h &lt;/file&gt; &lt;text&gt; // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_bvector.h &lt;/file&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_bvector.h &lt;/file&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_bvector.h &lt;/file&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_bvector.h &lt;/file&gt; &lt;text&gt; /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. * * * Copyright (c) 1996-1999 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_bvector.h &lt;/file&gt; &lt;text&gt; /** @file stl_bvector.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_bvector.h &lt;/file&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_bvector.h &lt;/file&gt; &lt;text&gt; // Declare a partial specialization of vector&amp;lt;T, Alloc&amp;gt;. &lt;/text&gt; &lt;/instance&gt; &lt;/comments&gt; &lt;/instance&gt; &lt;instance accessibility="0" class="Synopsis.AST.Module" file="/usr/include/c++/3.2.2/bits/stl_iterator.h" language="C++" line="0" name="__gnu_cxx" type="namespace"&gt; &lt;comments&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/exception &lt;/file&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="0"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/type_traits.h &lt;/file&gt; &lt;text&gt; // Forward declaration hack, should really include this from somewhere. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" line="0" suspect="1"&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_iterator.h &lt;/file&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; &lt;/comments&gt; &lt;/instance&gt; &lt;instance accessibility="0" class="Synopsis.AST.Module" file="Parsers/Cxx/input/std.cc" language="C++" line="0" name="Foo" type="namespace"&gt; &lt;declarations&gt; &lt;instance accessibility="0" class="Synopsis.AST.Function" file="Parsers/Cxx/input/std.cc" language="C++" line="5" name="Foo.func(std::vector&amp;lt;int&amp;gt;)" realname="func" type="function"&gt; &lt;parameters&gt; &lt;instance class="Synopsis.AST.Parameter" identifier="array" value=""&gt; &lt;type&gt; &lt;instance class="Synopsis.Type.Parametrized" language="C++"&gt; &lt;parameters&gt; &lt;instance class="Synopsis.Type.Base" language="C++" name="int"/&gt; &lt;/parameters&gt; &lt;template&gt; &lt;instance class="Synopsis.Type.Unknown" language="C++" name="std.vector"&gt; &lt;link&gt; std vector &lt;/link&gt; &lt;/instance&gt; &lt;/template&gt; &lt;/instance&gt; &lt;/type&gt; &lt;/instance&gt; &lt;/parameters&gt; &lt;returnType&gt; &lt;instance class="Synopsis.Type.Base" language="C++" name="void"/&gt; &lt;/returnType&gt; &lt;/instance&gt; &lt;instance accessibility="0" class="Synopsis.AST.Builtin" file="Parsers/Cxx/input/std.cc" language="C++" line="5" name="EOS" type="EOS"/&gt; &lt;/declarations&gt; &lt;/instance&gt; &lt;/declarations&gt; &lt;types&gt; &lt;instance class="Synopsis.Type.Unknown" language="C++" name="__gnu_cxx"&gt; &lt;link&gt; __gnu_cxx &lt;/link&gt; &lt;/instance&gt; &lt;instance class="Synopsis.Type.Unknown" language="C++" name="std"&gt; &lt;link&gt; std &lt;/link&gt; &lt;/instance&gt; &lt;instance class="Synopsis.Type.Declared" language="C++" name="EOS"&gt; &lt;declaration/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.Type.Declared" language="C++" name="Foo"&gt; &lt;declaration/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.Type.Declared" language="C++" name="Foo.func(std::vector&amp;lt;int&amp;gt;)"&gt; &lt;declaration/&gt; &lt;/instance&gt; &lt;/types&gt; &lt;files&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_iterator_base_funcs.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/i386-redhat-linux/bits/c++config.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/cstddef &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/fpos.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_alloc.h &lt;/file&gt; &lt;file&gt; /usr/include/bits/sigthread.h &lt;/file&gt; &lt;file&gt; /usr/include/xlocale.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_bvector.h &lt;/file&gt; &lt;file&gt; /usr/include/bits/sigset.h &lt;/file&gt; &lt;file&gt; /usr/include/bits/xopen_lim.h &lt;/file&gt; &lt;file&gt; /usr/include/bits/local_lim.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/exception &lt;/file&gt; &lt;file&gt; /usr/include/sys/sysmacros.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/iosfwd &lt;/file&gt; &lt;file&gt; /usr/include/_G_config.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_threads.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_construct.h &lt;/file&gt; &lt;file&gt; /usr/include/signal.h &lt;/file&gt; &lt;file&gt; /usr/include/sys/cdefs.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/i386-redhat-linux/bits/gthr-default.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_uninitialized.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/new &lt;/file&gt; &lt;file&gt; /usr/include/bits/posix2_lim.h &lt;/file&gt; &lt;file&gt; /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stddef.h &lt;/file&gt; &lt;file&gt; /usr/include/string.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/i386-redhat-linux/bits/atomicity.h &lt;/file&gt; &lt;file&gt; /usr/include/stdlib.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/cstdlib &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/i386-redhat-linux/bits/c++io.h &lt;/file&gt; &lt;file&gt; /usr/include/gnu/stubs.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/functexcept.h &lt;/file&gt; &lt;file&gt; /usr/include/bits/waitflags.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/i386-redhat-linux/bits/gthr.h &lt;/file&gt; &lt;file&gt; /usr/include/bits/waitstatus.h &lt;/file&gt; &lt;file&gt; /usr/include/bits/endian.h &lt;/file&gt; &lt;file&gt; /usr/include/limits.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_vector.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stringfwd.h &lt;/file&gt; &lt;file&gt; /usr/include/bits/posix1_lim.h &lt;/file&gt; &lt;file&gt; /usr/include/bits/typesizes.h &lt;/file&gt; &lt;file&gt; /usr/include/bits/sched.h &lt;/file&gt; &lt;file&gt; /usr/include/pthread.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_iterator.h &lt;/file&gt; &lt;file&gt; /usr/include/wchar.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/climits &lt;/file&gt; &lt;file&gt; /usr/include/libio.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_algobase.h &lt;/file&gt; &lt;file&gt; /usr/include/bits/wchar.h &lt;/file&gt; &lt;file&gt; /usr/include/features.h &lt;/file&gt; &lt;file&gt; /usr/include/bits/sys_errlist.h &lt;/file&gt; &lt;file&gt; /usr/include/bits/pthreadtypes.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/exception_defines.h &lt;/file&gt; &lt;file&gt; /usr/include/bits/select.h &lt;/file&gt; &lt;file&gt; /usr/include/alloca.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/ctime &lt;/file&gt; &lt;file&gt; /usr/include/bits/types.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/cwchar &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/cassert &lt;/file&gt; &lt;file&gt; /usr/include/bits/stdio_lim.h &lt;/file&gt; &lt;file&gt; /usr/include/bits/initspin.h &lt;/file&gt; &lt;file&gt; /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stdarg.h &lt;/file&gt; &lt;file&gt; Parsers/Cxx/input/std.cc &lt;/file&gt; &lt;file&gt; /usr/include/bits/time.h &lt;/file&gt; &lt;file&gt; /usr/include/time.h &lt;/file&gt; &lt;file&gt; /usr/include/linux/limits.h &lt;/file&gt; &lt;file&gt; /usr/include/assert.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/i386-redhat-linux/bits/os_defines.h &lt;/file&gt; &lt;file&gt; /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/limits.h &lt;/file&gt; &lt;file&gt; /usr/include/gconv.h &lt;/file&gt; &lt;file&gt; /usr/include/sys/types.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/type_traits.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/concept_check.h &lt;/file&gt; &lt;file&gt; /usr/include/endian.h &lt;/file&gt; &lt;file&gt; /usr/include/sched.h &lt;/file&gt; &lt;file&gt; /usr/include/bits/wordsize.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/vector &lt;/file&gt; &lt;file&gt; /usr/include/sys/select.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/cstdio &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/bits/stl_pair.h &lt;/file&gt; &lt;file&gt; /usr/include/c++/3.2.2/cstring &lt;/file&gt; &lt;file&gt; /usr/include/stdio.h &lt;/file&gt; &lt;file&gt; /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/syslimits.h &lt;/file&gt; &lt;/files&gt; &lt;/ast&gt; </pre>" "<pre>&lt;?xml version='1.0' encoding='ISO-8859-1'?&gt; &lt;ast&gt; &lt;declarations&gt; &lt;instance accessibility="0" class="Synopsis.AST.Module" file="/group/fresco/local/include/c++/3.3/bits/vector.tcc" language="C++" line="0" name="std" type="namespace"&gt; &lt;comments&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/vector" line="1" suspect="1"&gt; &lt;text&gt; // &amp;lt;vector&amp;gt; -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/vector" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/vector" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/vector" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/vector" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/vector" line="30" suspect="1"&gt; &lt;text&gt; /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. * * * Copyright (c) 1996 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/vector" line="56" suspect="1"&gt; &lt;text&gt; /** @file vector * This is a Standard C++ Library header. You should @c #include this header * in your programs, rather than any of the &amp;quot;st[dl]_*.h&amp;quot; implementation files. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="1" suspect="1"&gt; &lt;text&gt; // Function-Based Exception Support -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="30" suspect="1"&gt; &lt;text&gt; // // ISO C++ 14882: 19.1 Exception classes // &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="1" suspect="1"&gt; &lt;text&gt; // -fno-exceptions Support -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="30" suspect="1"&gt; &lt;text&gt; // // ISO C++ 14882: 19.1 Exception classes // &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="40" suspect="1"&gt; &lt;text&gt; // Else proceed normally. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stddef.h" line="239" suspect="1"&gt; &lt;text&gt; /* Wide character type. Locale-writers should change this as necessary to be big enough to hold unique values not between 0 and 127, and not (wchar_t) -1, for each defined multibyte character. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stddef.h" line="244" suspect="1"&gt; &lt;text&gt; /* Define this type if we are doing the whole job, or if we want this type in particular. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stddef.h" line="280" suspect="1"&gt; &lt;text&gt; /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_ instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other symbols in the _FOO_T_ family, stays defined even after its corresponding type is defined). If we define wchar_t, then we must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if we undef _WCHAR_T_, then we must also define rune_t, since headers like runetype.h assume that if machine/ansi.h is included, and _BSD_WCHAR_T_ is not defined, then rune_t is available. machine/ansi.h says, &amp;quot;Note that _WCHAR_T_ and _RUNE_T_ must be of the same type.&amp;quot; */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stddef.h" line="307" suspect="1"&gt; &lt;text&gt; /* FreeBSD 5 can't be handled well using &amp;quot;traditional&amp;quot; logic above since it no longer defines _BSD_RUNE_T_ yet still desires to export rune_t in some cases... */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stddef.h" line="359" suspect="1"&gt; &lt;text&gt; /* In 4.3bsd-net2, leave these undefined to indicate that size_t, etc. are already defined. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stddef.h" line="361" suspect="1"&gt; &lt;text&gt; /* BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stddef.h" line="394" suspect="1"&gt; &lt;text&gt; /* A null pointer constant. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stddef.h" line="412" suspect="1"&gt; &lt;text&gt; /* Offset of member MEMBER in a struct of type TYPE. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cstring" line="53" suspect="1"&gt; &lt;text&gt; // Get rid of those macros defined in &amp;lt;string.h&amp;gt; in lieu of real functions. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cstdlib" line="54" suspect="1"&gt; &lt;text&gt; // Get rid of those macros defined in &amp;lt;stdlib.h&amp;gt; in lieu of real functions. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/new" line="1" suspect="1"&gt; &lt;text&gt; // The -*- C++ -*- dynamic memory management header. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/new" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 1994, 1996, 1997, 1998, 2000, 2001, 2002 // Free Software Foundation &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/new" line="6" suspect="1"&gt; &lt;text&gt; // This file is part of GNU CC. // // GNU CC is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) // any later version. // // GNU CC is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with GNU CC; see the file COPYING. If not, write to // the Free Software Foundation, 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/new" line="23" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/new" line="32" suspect="1"&gt; &lt;text&gt; /** @file new * The header @c new defines several functions to manage dynamic memory and * handling memory allocation errors; see * http://gcc.gnu.org/onlinedocs/libstdc++/18_support/howto.html#4 for more. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception" line="1" suspect="1"&gt; &lt;text&gt; // Exception Handling support header for -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002 // Free Software Foundation // // This file is part of GNU CC. // // GNU CC is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) // any later version. // // GNU CC is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with GNU CC; see the file COPYING. If not, write to // the Free Software Foundation, 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception" line="23" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception" line="32" suspect="1"&gt; &lt;text&gt; /** @file exception * This header defines several types and functions relating to the * handling of exceptions in a C++ program. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception" line="116" suspect="1"&gt; &lt;text&gt; // extern &amp;quot;C++&amp;quot; &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/clocale" line="51" suspect="1"&gt; &lt;text&gt; // Get rid of those macros defined in &amp;lt;locale.h&amp;gt; in lieu of real functions. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cctype" line="51" suspect="1"&gt; &lt;text&gt; // Get rid of those macros defined in &amp;lt;ctype.h&amp;gt; in lieu of real functions. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stringfwd.h" line="1" suspect="1"&gt; &lt;text&gt; // String support -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stringfwd.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stringfwd.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stringfwd.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stringfwd.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stringfwd.h" line="30" suspect="1"&gt; &lt;text&gt; // // ISO C++ 14882: 21 Strings library // &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stringfwd.h" line="34" suspect="1"&gt; &lt;text&gt; /** @file stringfwd.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cstdio" line="54" suspect="1"&gt; &lt;text&gt; // Get rid of those macros defined in &amp;lt;stdio.h&amp;gt; in lieu of real functions. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/i686-pc-linux-gnu/bits/gthr.h" line="100" suspect="1"&gt; &lt;text&gt; /* Fallback to single thread definitions. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cwchar" line="1" suspect="1"&gt; &lt;text&gt; // -*- C++ -*- forwarding header. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cwchar" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cwchar" line="12" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cwchar" line="17" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cwchar" line="22" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cwchar" line="31" suspect="1"&gt; &lt;text&gt; // // ISO C++ 14882: 21.4 // &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cwchar" line="35" suspect="1"&gt; &lt;text&gt; /** @file cwchar * This is a Standard C++ Library file. You should @c #include this file * in your programs, rather than any of the &amp;quot;*.h&amp;quot; implementation files. * * This is the C++ version of the Standard C Library header @c wchar.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/ctime" line="1" suspect="1"&gt; &lt;text&gt; // -*- C++ -*- forwarding header. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/ctime" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/ctime" line="12" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/ctime" line="17" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/ctime" line="22" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/ctime" line="31" suspect="1"&gt; &lt;text&gt; // // ISO C++ 14882: 20.5 Date and time // &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/ctime" line="35" suspect="1"&gt; &lt;text&gt; /** @file ctime * This is a Standard C++ Library file. You should @c #include this file * in your programs, rather than any of the &amp;quot;*.h&amp;quot; implementation files. * * This is the C++ version of the Standard C Library header @c time.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/ctime" line="53" suspect="1"&gt; &lt;text&gt; // Get rid of those macros defined in &amp;lt;time.h&amp;gt; in lieu of real functions. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cwchar" line="57" suspect="1"&gt; &lt;text&gt; // Need to do a bit of trickery here with mbstate_t as char_traits // assumes it is in wchar.h, regardless of wchar_t specializations. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/cwchar" line="74" suspect="1"&gt; &lt;text&gt; // Get rid of those macros defined in &amp;lt;wchar.h&amp;gt; in lieu of real functions. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/fpos.h" line="125" suspect="1"&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="1" suspect="1"&gt; &lt;text&gt; // Function-Based Exception Support -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="30" suspect="1"&gt; &lt;text&gt; // // ISO C++ 14882: 19.1 Exception classes // &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="1" suspect="1"&gt; &lt;text&gt; // -fno-exceptions Support -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="30" suspect="1"&gt; &lt;text&gt; // // ISO C++ 14882: 19.1 Exception classes // &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="40" suspect="1"&gt; &lt;text&gt; // Else proceed normally. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="84" suspect="1"&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/iosfwd" line="166" suspect="1"&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_pair.h" line="1" suspect="1"&gt; &lt;text&gt; // Pair implementation -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_pair.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_pair.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_pair.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_pair.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_pair.h" line="30" suspect="1"&gt; &lt;text&gt; /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_pair.h" line="56" suspect="1"&gt; &lt;text&gt; /** @file stl_pair.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/type_traits.h" line="337" suspect="0"&gt; &lt;text&gt; // Local Variables: // mode:C++ // End: &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_types.h" line="1" suspect="1"&gt; &lt;text&gt; // Types used in iterator implementation -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_types.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_types.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_types.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_types.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_types.h" line="30" suspect="1"&gt; &lt;text&gt; /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. * * * Copyright (c) 1996-1998 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_types.h" line="56" suspect="1"&gt; &lt;text&gt; /** @file stl_iterator_base_types.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. * * This file contains all of the general iterator-related utility types, * such as iterator_traits and struct iterator. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_types.h" line="162" suspect="1"&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_funcs.h" line="1" suspect="1"&gt; &lt;text&gt; // Functions used by iterators -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_funcs.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_funcs.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_funcs.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_funcs.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_funcs.h" line="30" suspect="1"&gt; &lt;text&gt; /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. * * * Copyright (c) 1996-1998 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_funcs.h" line="56" suspect="1"&gt; &lt;text&gt; /** @file stl_iterator_base_funcs.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. * * This file contains all of the general iterator-related utility * functions, such as distance() and advance(). */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/concept_check.h" line="1" suspect="1"&gt; &lt;text&gt; // Concept-checking control -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/concept_check.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/concept_check.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/concept_check.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/concept_check.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/concept_check.h" line="30" suspect="1"&gt; &lt;text&gt; /** @file concept_check.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/concept_check.h" line="42" suspect="1"&gt; &lt;text&gt; // All places in libstdc++-v3 where these are used, or /might/ be used, or // don't need to be used, or perhaps /should/ be used, are commented with // &amp;quot;concept requirements&amp;quot; (and maybe some more text). So grep like crazy // if you're looking for additional places to use these. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/concept_check.h" line="47" suspect="1"&gt; &lt;text&gt; // Concept-checking code is off by default unless users turn it on via // configure options or editing c++config.h. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_funcs.h" line="169" suspect="1"&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" line="1" suspect="1"&gt; &lt;text&gt; // Iterators -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" line="30" suspect="1"&gt; &lt;text&gt; /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. * * * Copyright (c) 1996-1998 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" line="56" suspect="1"&gt; &lt;text&gt; /** @file stl_iterator.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. * * This file implements reverse_iterator, back_insert_iterator, * front_insert_iterator, insert_iterator, __normal_iterator, and their * supporting functions and overloaded operators. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" line="739" suspect="1"&gt; &lt;text&gt; // namespace __gnu_cxx &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" line="743" suspect="0"&gt; &lt;text&gt; // Local Variables: // mode:C++ // End: &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_algobase.h" line="814" suspect="1"&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_algobase.h" line="818" suspect="0"&gt; &lt;text&gt; // Local Variables: // mode:C++ // End: &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_alloc.h" line="1" suspect="1"&gt; &lt;text&gt; // Allocators -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_alloc.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_alloc.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_alloc.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_alloc.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_alloc.h" line="30" suspect="1"&gt; &lt;text&gt; /* * Copyright (c) 1996-1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_alloc.h" line="43" suspect="1"&gt; &lt;text&gt; /** @file stl_alloc.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_alloc.h" line="51" suspect="1"&gt; &lt;text&gt; /** * @defgroup Allocators Memory Allocators * @if maint * stl_alloc.h implements some node allocators. These are NOT the same as * allocators in the C++ standard, nor in the original H-P STL. They do not * encapsulate different pointer types; we assume that there is only one * pointer type. The C++ standard allocators are intended to allocate * individual objects, not pools or arenas. * * In this file allocators are of two different styles: &amp;quot;standard&amp;quot; and * &amp;quot;SGI&amp;quot; (quotes included). &amp;quot;Standard&amp;quot; allocators conform to 20.4. &amp;quot;SGI&amp;quot; * allocators differ in AT LEAST the following ways (add to this list as you * discover them): * * - &amp;quot;Standard&amp;quot; allocate() takes two parameters (n_count,hint=0) but &amp;quot;SGI&amp;quot; * allocate() takes one paramter (n_size). * - Likewise, &amp;quot;standard&amp;quot; deallocate()'s argument is a count, but in &amp;quot;SGI&amp;quot; * is a byte size. * - max_size(), construct(), and destroy() are missing in &amp;quot;SGI&amp;quot; allocators. * - reallocate(p,oldsz,newsz) is added in &amp;quot;SGI&amp;quot;, and behaves as * if p=realloc(p,newsz). * * &amp;quot;SGI&amp;quot; allocators may be wrapped in __allocator to convert the interface * into a &amp;quot;standard&amp;quot; one. * @endif * * @note The @c reallocate member functions have been deprecated for 3.2 * and will be removed in 3.4. You must define @c _GLIBCPP_DEPRECATED * to make this visible in 3.2; see c++config.h. * * The canonical description of these classes is in docs/html/ext/howto.html * or online at http://gcc.gnu.org/onlinedocs/libstdc++/ext/howto.html#3 */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="1" suspect="1"&gt; &lt;text&gt; // Function-Based Exception Support -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="30" suspect="1"&gt; &lt;text&gt; // // ISO C++ 14882: 19.1 Exception classes // &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="1" suspect="1"&gt; &lt;text&gt; // -fno-exceptions Support -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="30" suspect="1"&gt; &lt;text&gt; // // ISO C++ 14882: 19.1 Exception classes // &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="40" suspect="1"&gt; &lt;text&gt; // Else proceed normally. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="84" suspect="1"&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="1" suspect="1"&gt; &lt;text&gt; // Threading support -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="30" suspect="1"&gt; &lt;text&gt; /* * Copyright (c) 1997-1999 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="43" suspect="1"&gt; &lt;text&gt; /** @file stl_threads.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="51" suspect="1"&gt; &lt;text&gt; // The only supported threading model is GCC's own gthr.h abstraction layer. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="129" suspect="1"&gt; &lt;text&gt; //namespace std &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="131" suspect="1"&gt; &lt;text&gt; // Locking class. Note that this class *does not have a // constructor*. It must be initialized either statically, with // __STL_MUTEX_INITIALIZER, or dynamically, by explicitly calling // the _M_initialize member function. (This is similar to the ways // that a pthreads mutex can be initialized.) There are explicit // member functions for acquiring and releasing the lock. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" line="138" suspect="1"&gt; &lt;text&gt; // There is no constructor because static initialization is // essential for some uses, and only a class aggregate (see section // 8.5.1 of the C++ standard) can be initialized that way. That // means we must have no constructors, no base classes, no virtual // functions, and no private or protected members. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_alloc.h" line="972" suspect="1"&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_construct.h" line="1" suspect="1"&gt; &lt;text&gt; // nonstandard construct and destroy functions -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_construct.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_construct.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_construct.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_construct.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_construct.h" line="30" suspect="1"&gt; &lt;text&gt; /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_construct.h" line="56" suspect="1"&gt; &lt;text&gt; /** @file stl_construct.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_construct.h" line="145" suspect="1"&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_uninitialized.h" line="1" suspect="1"&gt; &lt;text&gt; // Raw memory manipulators -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_uninitialized.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_uninitialized.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_uninitialized.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_uninitialized.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_uninitialized.h" line="30" suspect="1"&gt; &lt;text&gt; /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_uninitialized.h" line="56" suspect="1"&gt; &lt;text&gt; /** @file stl_uninitialized.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_uninitialized.h" line="284" suspect="1"&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_uninitialized.h" line="288" suspect="0"&gt; &lt;text&gt; // Local Variables: // mode:C++ // End: &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_vector.h" line="1" suspect="1"&gt; &lt;text&gt; // Vector implementation -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_vector.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_vector.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_vector.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_vector.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_vector.h" line="30" suspect="1"&gt; &lt;text&gt; /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. * * * Copyright (c) 1996 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_vector.h" line="56" suspect="1"&gt; &lt;text&gt; /** @file stl_vector.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="1" suspect="1"&gt; &lt;text&gt; // Function-Based Exception Support -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="30" suspect="1"&gt; &lt;text&gt; // // ISO C++ 14882: 19.1 Exception classes // &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="1" suspect="1"&gt; &lt;text&gt; // -fno-exceptions Support -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="30" suspect="1"&gt; &lt;text&gt; // // ISO C++ 14882: 19.1 Exception classes // &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception_defines.h" line="40" suspect="1"&gt; &lt;text&gt; // Else proceed normally. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/functexcept.h" line="84" suspect="1"&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_vector.h" line="990" suspect="1"&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="1" suspect="1"&gt; &lt;text&gt; // bit_vector and vector&amp;lt;bool&amp;gt; specialization -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="30" suspect="1"&gt; &lt;text&gt; /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. * * * Copyright (c) 1996-1999 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="56" suspect="1"&gt; &lt;text&gt; /** @file stl_bvector.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="337" suspect="1"&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="339" suspect="1"&gt; &lt;text&gt; // Declare a partial specialization of vector&amp;lt;T, Alloc&amp;gt;. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="723" suspect="1"&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" line="727" suspect="0"&gt; &lt;text&gt; // Local Variables: // mode:C++ // End: &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/vector.tcc" line="1" suspect="1"&gt; &lt;text&gt; // Vector implementation (out of line) -*- C++ -*- &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/vector.tcc" line="3" suspect="1"&gt; &lt;text&gt; // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/vector.tcc" line="11" suspect="1"&gt; &lt;text&gt; // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/vector.tcc" line="16" suspect="1"&gt; &lt;text&gt; // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/vector.tcc" line="21" suspect="1"&gt; &lt;text&gt; // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/vector.tcc" line="30" suspect="1"&gt; &lt;text&gt; /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. * * * Copyright (c) 1996 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided &amp;quot;as is&amp;quot; without express or implied warranty. */ &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/vector.tcc" line="56" suspect="1"&gt; &lt;text&gt; /** @file vector.tcc * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ &lt;/text&gt; &lt;/instance&gt; &lt;/comments&gt; &lt;/instance&gt; &lt;instance accessibility="0" class="Synopsis.AST.Module" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" language="C++" line="0" name="__gnu_cxx" type="namespace"&gt; &lt;comments&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/exception" line="101" suspect="1"&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/type_traits.h" line="324" suspect="0"&gt; &lt;text&gt; // Forward declaration hack, should really include this from somewhere. &lt;/text&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" line="557" suspect="1"&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; &lt;/comments&gt; &lt;/instance&gt; &lt;instance accessibility="0" class="Synopsis.AST.Module" file="Parsers/Cxx/input/std.cc" language="C++" line="0" name="Foo" type="namespace"&gt; &lt;comments&gt; &lt;instance class="Synopsis.AST.Comment" file="/group/fresco/local/include/c++/3.3/bits/vector.tcc" line="435" suspect="1"&gt; &lt;text&gt; // namespace std &lt;/text&gt; &lt;/instance&gt; &lt;/comments&gt; &lt;declarations&gt; &lt;instance accessibility="0" class="Synopsis.AST.Function" file="Parsers/Cxx/input/std.cc" language="C++" line="5" name="Foo.func(std::vector&amp;lt;int&amp;gt;)" realname="func" type="function"&gt; &lt;parameters&gt; &lt;instance class="Synopsis.AST.Parameter" identifier="array" value=""&gt; &lt;type&gt; &lt;instance class="Synopsis.Type.Parametrized" language="C++"&gt; &lt;parameters&gt; &lt;instance class="Synopsis.Type.Base" language="C++" name="int"/&gt; &lt;/parameters&gt; &lt;template&gt; &lt;instance class="Synopsis.Type.Unknown" language="C++" name="std.vector"&gt; &lt;link&gt; std vector &lt;/link&gt; &lt;/instance&gt; &lt;/template&gt; &lt;/instance&gt; &lt;/type&gt; &lt;/instance&gt; &lt;/parameters&gt; &lt;returnType&gt; &lt;instance class="Synopsis.Type.Base" language="C++" name="void"/&gt; &lt;/returnType&gt; &lt;/instance&gt; &lt;instance accessibility="0" class="Synopsis.AST.Builtin" file="Parsers/Cxx/input/std.cc" language="C++" line="5" name="EOS" type="EOS"/&gt; &lt;/declarations&gt; &lt;/instance&gt; &lt;/declarations&gt; &lt;types&gt; &lt;instance class="Synopsis.Type.Unknown" language="C++" name="__gnu_cxx"&gt; &lt;link&gt; __gnu_cxx &lt;/link&gt; &lt;/instance&gt; &lt;instance class="Synopsis.Type.Unknown" language="C++" name="std"&gt; &lt;link&gt; std &lt;/link&gt; &lt;/instance&gt; &lt;instance class="Synopsis.Type.Declared" language="C++" name="EOS"&gt; &lt;declaration/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.Type.Declared" language="C++" name="Foo"&gt; &lt;declaration/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.Type.Declared" language="C++" name="Foo.func(std::vector&amp;lt;int&amp;gt;)"&gt; &lt;declaration/&gt; &lt;/instance&gt; &lt;/types&gt; &lt;files&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/locale.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_iterator.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/unistd.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/sys/sysmacros.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/locale.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/_G_config.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/posix2_lim.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/stdlib.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/gnu/stubs.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/gconv.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_construct.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/iosfwd" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/exception_defines.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/bits/sigthread.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/concept_check.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stdio.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/vector" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/endian.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/cwchar" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/environments.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stringfwd.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/sys/types.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/wordsize.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/functexcept.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stdarg.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/i686-pc-linux-gnu/bits/atomicity.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/clocale" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/i686-pc-linux-gnu/bits/c++io.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/xopen_lim.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_vector.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_uninitialized.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/wchar.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/new" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_alloc.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/limits.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/waitstatus.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/posix1_lim.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/typesizes.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/sched.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/posix_opt.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/features.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/confname.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/exception" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/cstdio" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/libio.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_threads.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/local_lim.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/cstddef" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/signal.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/i686-pc-linux-gnu/bits/c++config.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/xlocale.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/ctype.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/i686-pc-linux-gnu/bits/gthr.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/fpos.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/cstring" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_pair.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/sys/cdefs.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/cstdlib" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/pthreadtypes.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/time.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/select.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/alloca.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/stdio_lim.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="Parsers/Cxx/input/std.cc" is_main="1" language="C++"&gt; &lt;declarations/&gt; &lt;includes&gt; &lt;instance class="Synopsis.AST.Include" is_macro="0" is_next="0" name="&amp;lt;vector&amp;gt;"&gt; &lt;target/&gt; &lt;/instance&gt; &lt;/includes&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_algobase.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_bvector.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/i686-pc-linux-gnu/bits/c++locale.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/pthread.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/i686-pc-linux-gnu/bits/gthr-default.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/syslimits.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/ctime" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/sigset.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/i686-pc-linux-gnu/bits/os_defines.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/sched.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/waitflags.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/string.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/limits.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/climits" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_types.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/stddef.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/wchar.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/type_traits.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/sys/select.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/vector.tcc" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/types.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/getopt.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/bits/time.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/bits/stl_iterator_base_funcs.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/group/fresco/local/include/c++/3.3/cctype" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;instance class="Synopsis.AST.SourceFile" filename="/usr/include/endian.h" is_main="0" language="C++"&gt; &lt;macro_calls/&gt; &lt;/instance&gt; &lt;/files&gt; &lt;/ast&gt; </pre>" "error reading expected output" "2005-06-22T19:33:01Z" "2005-06-22T19:33:01Z" "local" "No such file or directory" "2005-06-22T19:33:02Z" "2005-06-22T19:33:01Z" "local" "2005-06-22T19:33:02Z" "2005-06-22T19:33:02Z" "local" "2005-06-22T19:33:02Z" "2005-06-22T19:33:02Z" "local" "2005-06-22T19:33:02Z" "2005-06-22T19:33:02Z" "local" "2005-06-22T19:33:03Z" "2005-06-22T19:33:02Z" "local" "2005-06-22T19:33:03Z" "2005-06-22T19:33:03Z" "local" "2005-06-22T19:33:03Z" "2005-06-22T19:33:03Z" "local" "2005-06-22T19:33:03Z" "2005-06-22T19:33:03Z" "local" "2005-06-22T19:33:04Z" "2005-06-22T19:33:03Z" "local" "unable to run" "2005-06-22T19:33:04Z" "2005-06-22T19:33:04Z" "local" "<pre>python Parsers/IDL/synopsis.py parse --output=Parsers/IDL/output/CosNaming.xml /group/synopsis/workspace/Synopsis/tests/Parsers/IDL/input/CosNaming.idl</pre>" "<pre>Traceback (most recent call last): File "Parsers/IDL/synopsis.py", line 7, in ? stylesheet = None))) File "/group/synopsis/workspace/Synopsis/Synopsis/process.py", line 71, in process commands[command].process(ast, **props) File "/group/synopsis/workspace/Synopsis/Synopsis/Processor.py", line 180, in process ast = self.processors[-1].process(ast, **my_kwds) File "/group/synopsis/workspace/Synopsis/Synopsis/Formatters/Dump.py", line 55, in process self.write_declarations(self.ast.declarations()) File "/group/synopsis/workspace/Synopsis/Synopsis/Formatters/Dump.py", line 181, in write_declarations for d in declarations: self.visit(d) File "/group/synopsis/workspace/Synopsis/Synopsis/Formatters/Dump.py", line 90, in visit self.handlers[t](obj) File "/group/synopsis/workspace/Synopsis/Synopsis/Formatters/Dump.py", line 174, in visit_instance self.visit(value) File "/group/synopsis/workspace/Synopsis/Synopsis/Formatters/Dump.py", line 90, in visit self.handlers[t](obj) File "/group/synopsis/workspace/Synopsis/Synopsis/Formatters/Dump.py", line 111, in visit_list self.visit(i) File "/group/synopsis/workspace/Synopsis/Synopsis/Formatters/Dump.py", line 90, in visit self.handlers[t](obj) File "/group/synopsis/workspace/Synopsis/Synopsis/Formatters/Dump.py", line 155, in visit_instance self.node.setAttribute('file', value.filename()) AttributeError: 'str' object has no attribute 'filename' </pre>" "2005-06-22T19:33:04Z" "2005-06-22T19:33:04Z" "local" "2005-06-22T19:33:05Z" "2005-06-22T19:33:04Z" "local" "2005-06-22T19:33:05Z" "2005-06-22T19:33:05Z" "local" "2005-06-22T19:33:05Z" "2005-06-22T19:33:05Z" "local" "2005-06-22T19:33:06Z" "2005-06-22T19:33:05Z" "local" "2005-06-22T19:33:06Z" "2005-06-22T19:33:06Z" "local" "local" "local" "local" "local" "local" --- STATISTICS --------------------------------------------------------------- 110 tests total 47 ( 43%) tests FAIL 63 ( 57%) tests PASS --- TESTS THAT DID NOT PASS -------------------------------------------------- Cxx.SymbolLookup.definitions-3a : FAIL error reading expected output Cxx.SymbolLookup.definitions-3b : FAIL error reading expected output Cxx.SymbolLookup.definitions-4a : FAIL error reading expected output Cxx.SymbolLookup.definitions-4b : FAIL error reading expected output Cxx.SymbolLookup.initialization-2-2 : FAIL error reading expected output Cxx.SymbolLookup.lifetime-5a : FAIL error reading expected output Cxx.SymbolLookup.lifetime-5b : FAIL error reading expected output Cxx.SymbolLookup.lifetime-5c : FAIL error reading expected output Cxx.SymbolLookup.lifetime-7 : FAIL error reading expected output Cxx.SymbolLookup.lifetime-8 : FAIL error reading expected output Cxx.SymbolLookup.lifetime-9a : FAIL error reading expected output Cxx.SymbolLookup.lifetime-9b : FAIL error reading expected output Cxx.SymbolLookup.linkage-6 : FAIL error reading expected output Cxx.SymbolLookup.linkage-7a : FAIL error reading expected output Cxx.SymbolLookup.linkage-7b : FAIL error reading expected output Cxx.SymbolLookup.linkage-7c : FAIL error reading expected output Cxx.SymbolLookup.qualified-3a : FAIL error reading expected output Cxx.SymbolLookup.qualified-3b : FAIL error reading expected output Cxx.SymbolLookup.qualified-5 : FAIL error reading expected output Cxx.SymbolLookup.scope-0-2 : FAIL error reading expected output Cxx.SymbolLookup.scope-1 : FAIL error reading expected output Cxx.SymbolLookup.scope-2 : FAIL error reading expected output Cxx.SymbolLookup.scope-3 : FAIL error reading expected output Cxx.SymbolLookup.scope-4 : FAIL error reading expected output Cxx.SymbolLookup.scope-class-1-5a : FAIL error reading expected output Cxx.SymbolLookup.scope-namespace-1a : FAIL error reading expected output Cxx.SymbolLookup.scope-namespace-1b : FAIL error reading expected output Cxx.SymbolLookup.scope-namespace-1c : FAIL error reading expected output Cxx.SymbolLookup.storage-auto-1 : FAIL error reading expected output Cxx.SymbolLookup.types-2 : FAIL error reading expected output Cxx.SymbolLookup.types-3 : FAIL error reading expected output Cxx.SymbolLookup.types-7 : FAIL error reading expected output Cxx.SymbolLookup.unqualified-10 : FAIL error reading expected output Cxx.SymbolLookup.unqualified-7a : FAIL error reading expected output Cxx.SymbolLookup.unqualified-7b : FAIL error reading expected output Cxx.SymbolLookup.unqualified-7c : FAIL error reading expected output Cxx.SymbolLookup.unqualified-7d : FAIL error reading expected output Cxx.SymbolLookup.unqualified-7e : FAIL error reading expected output Cxx.SymbolLookup.unqualified-7f : FAIL error reading expected output Cxx.SymbolLookup.using-directive-1a : FAIL error reading expected output Cxx.SymbolLookup.using-directive-2a : FAIL error reading expected output Cxx.TypeAnalysis.simple : FAIL error reading expected output Parsers.C.simple : FAIL error reading expected output Parsers.Cpp.include : FAIL incorrect output Parsers.Cxx.std : FAIL incorrect output Parsers.Cxx.stdarg : FAIL error reading expected output Parsers.IDL.CosNaming : FAIL unable to run synopsis-0.12/tests/Cxx-API/0000775000076400007640000000000011172123232015164 5ustar stefanstefansynopsis-0.12/tests/Cxx-API/Synopsis/0000775000076400007640000000000011172123232017013 5ustar stefanstefansynopsis-0.12/tests/Cxx-API/Synopsis/AST/0000775000076400007640000000000011172123232017442 5ustar stefanstefansynopsis-0.12/tests/Cxx-API/Synopsis/AST/src/0000775000076400007640000000000011172123233020232 5ustar stefanstefansynopsis-0.12/tests/Cxx-API/Synopsis/AST/src/Declaration.cc0000664000076400007640000000322711104703266022777 0ustar stefanstefan#include #include #include "Guard.hh" #include #include using namespace Synopsis; void test1() { AST::ASTKit kit = AST::ASTKit(); AST::TypeKit types = AST::TypeKit(); AST::SourceFile sf = kit.create_source_file("filename", "/long/filename", "C++"); AST::Declaration d = kit.create_declaration(sf, 2, "C--", "foo", Python::Tuple("bar")); std::cout << d.attr("__class__") << std::endl; std::cout << "file='" << d.file().attr("__class__") << "\'\n" << "line='" << d.line() << "\'\n" << "language='" << d.language() << "\'\n" << "type='" << d.type() << "\'\n" << "name='" << d.name() << "\'\n" << "comments='" << d.comments() << '\'' << std::endl; std::cout << kit.create_builtin(sf, 3, "C--", "eos", Python::Tuple("eos")).attr("__class__") << std::endl; std::cout << kit.create_macro(sf, 4, "C--", Python::Tuple("ZAP"), Python::List(), "").attr("__class__") << std::endl; std::cout << kit.create_forward(sf, 5, "C--", "forward", Python::Tuple("flip")).attr("__class__") << std::endl; std::cout << kit.create_module(sf, 6, "C--", "namespace", Python::Tuple("flop")).attr("__class__") << std::endl; AST::Class c = kit.create_class(sf, 7, "C--", "class", Python::Tuple("faz")); std::cout << c.attr("__class__") << std::endl; AST::Type t = types.create_declared("C--", Python::Tuple("faz"), c); std::cout << kit.create_typedef(sf, 7, "C--", "class", Python::Tuple("faz"), t, false).attr("__class__") << std::endl; } int main(int, char **) { try { test1(); } catch (const std::exception &e) { std::cout << "Error : " << e.what() << std::endl; } } synopsis-0.12/tests/Cxx-API/Synopsis/AST/src/SourceFile.cc0000664000076400007640000000151311104703266022606 0ustar stefanstefan#include #include #include "Guard.hh" #include #include using namespace Synopsis; void test1() { AST::ASTKit kit = AST::ASTKit(); AST::SourceFile sf = kit.create_source_file("filename", "/long/filename", "C++"); sf.is_main(true); std::cout << "created source file " << sf.name() << ' ' << sf.long_name() << ' ' << sf.is_main() << std::endl; AST::MacroCall mc = kit.create_macro_call("FOO", 1, 2, 3); Python::Dict mmap = sf.macro_calls(); Python::List line = mmap.get(0, Python::List()); line.append(mc); mmap.set(0, line); std::cout << sf.macro_calls().type() << std::endl; } int main(int, char **) { try { test1(); } catch (const std::exception &e) { std::cout << "Error : " << e.what() << std::endl; } } synopsis-0.12/tests/Cxx-API/Synopsis/AST/src/Type.cc0000664000076400007640000000141511104703266021470 0ustar stefanstefan#include #include "Guard.hh" #include #include using namespace Synopsis; void test1() { AST::TypeKit kit = AST::TypeKit(); std::cout << kit.create_type("C--").attr("__class__") << std::endl; std::cout << kit.create_named("C--", Python::Tuple("Foo")).attr("__class__") << std::endl; std::cout << kit.create_base("C--", Python::Tuple("integer")).attr("__class__") << std::endl; std::cout << kit.create_dependent("C--", Python::Tuple("dep")).attr("__class__") << std::endl; std::cout << kit.create_unknown("C--", Python::Tuple("FooBar")).attr("__class__") << std::endl; } int main(int, char **) { try { test1(); } catch (const std::exception &e) { std::cout << "Error : " << e.what() << std::endl; } } synopsis-0.12/tests/Cxx-API/Synopsis/AST/src/Makefile0000664000076400007640000000160211104703266021676 0ustar stefanstefan# $Id: Makefile,v 1.2 2004/01/13 07:43:08 stefan Exp $ # # Copyright (C) 2003 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # SHELL := /bin/sh python := python PYPREFIX:=$(shell $(python) -c "import sys; print sys.prefix") PYVERSION:=$(shell $(python) -c "from distutils import sysconfig; print sysconfig.get_config_var('VERSION')") PYINC :=$(shell $(python) -c "from distutils import sysconfig; print sysconfig.get_python_inc()") PYLIBS :=-L $(PYPREFIX)/lib/python$(PYVERSION)/config -lpython$(PYVERSION) -ldl -lutil -lpthread CPPFLAGS:= -I ../../../../../include -I $(PYINC) LDFLAGS := -rdynamic LIBS := $(PYLIBS) TESTS := SourceFile all: $(TESTS) %.o: %.cc $(CXX) $(CPPFLAGS) -ggdb $(CXXFLAGS) -c -o $@ $< $(TESTS): %: %.o $(CXX) -ggdb $(LDFLAGS) -o $@ $^ $(LIBS) clean: rm -rf *.o $(TESTS) synopsis-0.12/tests/Cxx-API/Synopsis/AST/src/Guard.hh0000664000076400007640000000023511104703266021622 0ustar stefanstefan#ifndef _Guard_hh #define _Guard_hh #include struct Guard { Guard() { Py_Initialize();} ~Guard() { Py_Finalize();} }; Guard guard; #endif synopsis-0.12/tests/Cxx-API/Synopsis/AST/scripts/0000775000076400007640000000000011172123233021132 5ustar stefanstefansynopsis-0.12/tests/Cxx-API/Synopsis/AST/scripts/SourceFile.py0000664000076400007640000000004411104703266023547 0ustar stefanstefanfrom Synopsis.AST import SourceFile synopsis-0.12/tests/Cxx-API/Synopsis/AST/expected/0000775000076400007640000000000011172123233021244 5ustar stefanstefansynopsis-0.12/tests/Cxx-API/Synopsis/AST/expected/Type.out0000664000076400007640000000015011104703266022717 0ustar stefanstefanSynopsis.Type.Type Synopsis.Type.Named Synopsis.Type.Base Synopsis.Type.Dependent Synopsis.Type.Unknown synopsis-0.12/tests/Cxx-API/Synopsis/AST/expected/SourceFile.out0000664000076400007640000000007411104703266024043 0ustar stefanstefancreated source file filename /long/filename 1 synopsis-0.12/tests/Cxx-API/Synopsis/AST/expected/Declaration.out0000664000076400007640000000036111104703266024227 0ustar stefanstefanSynopsis.AST.Declaration file='Synopsis.AST.SourceFile' line='2' language='C--' type='foo' name='['bar']' comments='[]' Synopsis.AST.Builtin Synopsis.AST.Macro Synopsis.AST.Forward Synopsis.AST.Module Synopsis.AST.Class Synopsis.AST.Typedef synopsis-0.12/tests/Cxx-API/Misc/0000775000076400007640000000000011172123232016057 5ustar stefanstefansynopsis-0.12/tests/Cxx-API/Misc/src/0000775000076400007640000000000011172123233016647 5ustar stefanstefansynopsis-0.12/tests/Cxx-API/Misc/src/Path.cc0000664000076400007640000000134111104703266020056 0ustar stefanstefan#include #include #include using namespace Synopsis; void test1() { std::string cwd = Path::cwd(); Path path(__FILE__); // this file... std::string file = path.basename(); // ...without any directory components... std::cout << file << std::endl; Path abs = Path(file).abs(); // ...the absolute path... // std::cout << abs.str() << std::endl;// ...which isn't usable for testing... path = abs; path.strip(cwd + Path::SEPARATOR); // ...without removing the prefix std::cout << path.str() << std::endl; } int main(int, char **) { try { test1(); } catch (const std::exception &e) { std::cout << "Error : " << e.what() << std::endl; } } synopsis-0.12/tests/Cxx-API/Misc/expected/0000775000076400007640000000000011172123233017661 5ustar stefanstefansynopsis-0.12/tests/Cxx-API/Misc/expected/Path.out0000664000076400007640000000002011104703266021303 0ustar stefanstefanPath.cc Path.cc synopsis-0.12/tests/Cxx-API/Python/0000775000076400007640000000000011172123232016445 5ustar stefanstefansynopsis-0.12/tests/Cxx-API/Python/src/0000775000076400007640000000000011172123233017235 5ustar stefanstefansynopsis-0.12/tests/Cxx-API/Python/src/Tuple.cc0000664000076400007640000000154111104703266020643 0ustar stefanstefan#include #include "Guard.hh" #include #include using namespace Synopsis::Python; void test1() { List list; list.append('a'); list.append(1); list.append("hello"); list.append("world"); Tuple tuple = list.tuple(); std::cout << Object::narrow(tuple.str()) << std::endl; Object object(tuple); tuple = Object::narrow(object); std::cout << Object::narrow(tuple.str()) << std::endl; } void test2() { Tuple t1('1', '2', '3'); std::cout << Object::narrow(t1.str()) << std::endl; Tuple t2("hello", "world", 42); std::cout << Object::narrow(t2.str()) << std::endl; } int main(int, char **) { try { test1(); test2(); } catch (const std::exception &e) { std::cout << "Error : " << e.what() << std::endl; } } synopsis-0.12/tests/Cxx-API/Python/src/greeting.py0000664000076400007640000000002411104703266021414 0ustar stefanstefanprint 'hello world' synopsis-0.12/tests/Cxx-API/Python/src/List.cc0000664000076400007640000000221111104703266020460 0ustar stefanstefan#include #include "Guard.hh" #include #include using namespace Synopsis::Python; void test1() { List list; list.append('a'); list.append(1); list.append("hello"); list.append("world"); std::cout << Object::narrow(list.str()) << std::endl; list.sort(); std::cout << Object::narrow(list.str()) << std::endl; list.reverse(); std::cout << Object::narrow(list.str()) << std::endl; Object o = list.get(0); std::cout << Object::narrow(o.str()) << std::endl; for (List::iterator i = list.begin(); i != list.end(); ++i) std::cout << Object::narrow(i->str()) << std::endl; for (List::reverse_iterator i = list.rbegin(); i != list.rend(); ++i) std::cout << Object::narrow(i->str()) << std::endl; std::cout << *(list.begin() + 1) << ' ' << *(list.end() - 1) << std::endl; std::cout << *(list.rbegin() + 1) << ' ' << *(list.rend() - 1) << std::endl; } int main(int, char **) { try { test1(); } catch (const std::exception &e) { std::cout << "Error : " << e.what() << std::endl; } } synopsis-0.12/tests/Cxx-API/Python/src/Dict.cc0000664000076400007640000000210411104703266020431 0ustar stefanstefan#include #include "Guard.hh" #include #include using namespace Synopsis::Python; void test1() { Dict dict; dict.set('a', 'A'); dict.set(1, 2); dict.set("hello", "world"); std::cout << Object::narrow(dict.str()) << std::endl; std::cout << Object::narrow(dict.keys().str()) << std::endl; std::cout << Object::narrow(dict.values().str()) << std::endl; std::cout << Object::narrow(dict.items().str()) << std::endl; } void test2() { Dict dict; dict.set('a', 'A'); std::cout << Object::narrow(dict.get('a').str()) << std::endl; std::cout << Object::narrow(dict.get('b').str()) << std::endl; dict.set(1, 2); dict.set("hello", "world"); for (Dict::iterator i = dict.begin(); i != dict.end(); ++i) std::cout << Object::narrow((*i).str()) << std::endl; } int main(int, char **) { try { test1(); test2(); } catch (const std::exception &e) { std::cout << "Error : " << e.what() << std::endl; } } synopsis-0.12/tests/Cxx-API/Python/src/Command.py0000664000076400007640000000023311104703266021170 0ustar stefanstefanclass Command: def __init__(self, *args, **kwds): print args print kwds def execute(self): print 'hello world' synopsis-0.12/tests/Cxx-API/Python/src/Interpreter.cc0000664000076400007640000000442211104703266022056 0ustar stefanstefan#include #include #include #include #include #include #include "Guard.hh" using namespace Synopsis::Python; void print(Dict &d) { List keys = d.keys(); for (int i = 0; i != keys.size(); ++i) { Object key = keys.get(i); std::cout << Object::narrow(key) << ' ' << Object::narrow(d.get(key).str()) << std::endl; } } void test1() { std::cout << "=== test1 ===" << std::endl; Interpreter interp; Module module = Module::import("__main__"); Dict global = module.dict(); Dict local; Object retn = interp.run_string("print 'hello world'", Interpreter::FILE, global, local); } void test2() { std::cout << "=== test2 ===" << std::endl; Interpreter interp; Module path = Module::import("os.path"); std::string dir = Object::narrow(path.attr("dirname")(Tuple(__FILE__))); std::string script = Object::narrow(path.attr("join")(Tuple(dir, "greeting.py"))); Module module = Module::import("__main__"); Dict global = module.dict(); Dict local; Object retn = interp.run_file(script, Interpreter::FILE, global, local); } void test3() { std::cout << "=== test3 ===" << std::endl; Interpreter interp; Module path = Module::import("os.path"); std::string dir = Object::narrow(path.attr("dirname")(Tuple(__FILE__))); std::string script = Object::narrow(path.attr("join")(Tuple(dir, "Command.py"))); Module module = Module::import("__main__"); Dict global = module.dict(); Dict local; Object retn = interp.run_file(script, Interpreter::FILE, global, local); Object type = local.get("Command"); Tuple args("first", "second", "third"); Dict kwds; kwds.set("input", "foo.h"); kwds.set("output", "foo.i"); retn = type(); retn = type(args); retn = type(args, kwds); Object method = retn.attr("execute"); method(); } int main(int, char **) { try { test1(); test2(); test3(); } catch (const Interpreter::Exception &) { PyErr_Print(); } catch (const std::exception &e) { std::cout << "Error : " << e.what() << std::endl; } } synopsis-0.12/tests/Cxx-API/Python/src/Object.cc0000664000076400007640000000164611104703266020766 0ustar stefanstefan#include #include "Guard.hh" #include #include using namespace Synopsis::Python; void test1() { Object object; Object character('q'); std::cout << Object::narrow(character) << std::endl; std::cout << Object::narrow(character.str()) << std::endl; Object string("hello world"); std::cout << Object::narrow(string) << std::endl; std::cout << Object::narrow(string.str()) << std::endl; Object integer(42); std::cout << Object::narrow(integer) << std::endl; std::cout << Object::narrow(integer.str()) << std::endl; try { std::cout << Object::narrow(string) << std::endl;} catch (Object::TypeError &e) { std::cout << e.what() << std::endl;} } int main(int, char **) { try { test1(); } catch (const std::exception &e) { std::cout << "Error : " << e.what() << std::endl; } } synopsis-0.12/tests/Cxx-API/Python/src/Guard.hh0000664000076400007640000000023511104703266020625 0ustar stefanstefan#ifndef _Guard_hh #define _Guard_hh #include struct Guard { Guard() { Py_Initialize();} ~Guard() { Py_Finalize();} }; Guard guard; #endif synopsis-0.12/tests/Cxx-API/Python/expected/0000775000076400007640000000000011172123233020247 5ustar stefanstefansynopsis-0.12/tests/Cxx-API/Python/expected/Interpreter.out0000664000076400007640000000026711104703266023315 0ustar stefanstefan=== test1 === hello world === test2 === hello world === test3 === () {} ('first', 'second', 'third') {} ('first', 'second', 'third') {'input': 'foo.h', 'output': 'foo.i'} hello world synopsis-0.12/tests/Cxx-API/Python/expected/Object.out0000664000076400007640000000007011104703266022210 0ustar stefanstefanq q hello world hello world 42 42 object not an integer synopsis-0.12/tests/Cxx-API/Python/expected/Dict.out0000664000076400007640000000023411104703266021667 0ustar stefanstefan{'a': 'A', 1: 2, 'hello': 'world'} ['a', 1, 'hello'] ['A', 2, 'world'] [('a', 'A'), (1, 2), ('hello', 'world')] A None ('a', 'A') (1, 2) ('hello', 'world') synopsis-0.12/tests/Cxx-API/Python/expected/Tuple.out0000664000076400007640000000013511104703266022075 0ustar stefanstefan('a', 1, 'hello', 'world') ('a', 1, 'hello', 'world') ('1', '2', '3') ('hello', 'world', 42) synopsis-0.12/tests/Cxx-API/Python/expected/List.out0000664000076400007640000000020711104703266021717 0ustar stefanstefan['a', 1, 'hello', 'world'] [1, 'a', 'hello', 'world'] ['world', 'hello', 'a', 1] world world hello a 1 1 a hello world hello 1 a world synopsis-0.12/tests/Processors/0000775000076400007640000000000011172123233016156 5ustar stefanstefansynopsis-0.12/tests/Processors/Comments/0000775000076400007640000000000011172123232017742 5ustar stefanstefansynopsis-0.12/tests/Processors/Comments/input/0000775000076400007640000000000011172123233021102 5ustar stefanstefansynopsis-0.12/tests/Processors/Comments/input/groups.cc0000664000076400007640000000070311104703271022731 0ustar stefanstefan// -*- Comments.SSFilter -*- // -*- Comments.Grouper -*- // group documentation // @group first group { // some comment // extending over multiple lines // another comment struct foo { }; int test1; int test2; // } int bar; // another group // @group tests { int test3; int test4; // } // @group outer { // @group inner { int f; // @group xxx { not a group int test5; // } and not a group end // } // and not a group either int test6; // } // } synopsis-0.12/tests/Processors/Comments/input/previous2.cc0000664000076400007640000000027411104703271023353 0ustar stefanstefan// -*- Comments.SSFilter -*- // -*- Comments.Previous -*- class Foo { public: int first; //< first comment int second; //< second comment private: int third; //< third comment }; synopsis-0.12/tests/Processors/Comments/input/previous.cc0000664000076400007640000000040611104703271023266 0ustar stefanstefan// -*- Comments.SSFilter -*- // -*- Comments.Previous -*- struct Foo { int first; //< first comment int second; //< second comment int third; //< third comment }; enum Enum { ONE, //< ONE comment TWO, //< TWO comment THREE //< THREE comment }; synopsis-0.12/tests/Processors/Comments/expected/0000775000076400007640000000000011172123233021544 5ustar stefanstefansynopsis-0.12/tests/Processors/Comments/expected/groups.xml0000664000076400007640000001520111104703271023605 0ustar stefanstefan comments comments some comment extending over multiple lines another comment comments comments comments -*- Comments.SSFilter -*- -*- Comments.Grouper -*- group documentation comments comments comments comments another group comments comments @group xxx { not a group comments } and not a group end } and not a group either comments comments comments synopsis-0.12/tests/Processors/Comments/expected/previous2.xml0000664000076400007640000000612211104703271024226 0ustar stefanstefan comments comments second comment comments < second comment comments comments < third comment comments -*- Comments.SSFilter -*- -*- Comments.Previous -*- synopsis-0.12/tests/Processors/Comments/expected/previous.xml0000664000076400007640000001146711104703271024154 0ustar stefanstefan comments comments second comment comments third comment comments < third comment comments -*- Comments.SSFilter -*- -*- Comments.Previous -*- comments comments TWO comment comments THREE comment comments comments < THREE comment synopsis-0.12/tests/Processors/Linker/0000775000076400007640000000000011172123232017401 5ustar stefanstefansynopsis-0.12/tests/Processors/Linker/first/0000775000076400007640000000000011172123233020531 5ustar stefanstefansynopsis-0.12/tests/Processors/Linker/first/input/0000775000076400007640000000000011172123233021670 5ustar stefanstefansynopsis-0.12/tests/Processors/Linker/first/input/forward.h0000664000076400007640000000001411104703271023501 0ustar stefanstefanclass Foo; synopsis-0.12/tests/Processors/Linker/first/input/definition.h0000664000076400007640000000001611104703271024167 0ustar stefanstefanclass Foo {}; synopsis-0.12/tests/Processors/Linker/first/synopsis.py.in0000664000076400007640000000064511104703271023405 0ustar stefanstefanfrom Synopsis.process import process from Synopsis.Processor import Composite from Synopsis.Parsers import Cxx from Synopsis.Processors import Linker from Synopsis.Formatters import Dump import os process(parse = Composite(Cxx.Parser(base_path = '@abs_top_srcdir@' + os.sep), Linker(remove_empty_modules = False), Dump.Formatter(show_ids = False, stylesheet = None))) synopsis-0.12/tests/Processors/Linker/first/expected.xml0000664000076400007640000000245111104703271023057 0ustar stefanstefan comments comments synopsis-0.12/tests/Processors/Linker/second/0000775000076400007640000000000011172123233020655 5ustar stefanstefansynopsis-0.12/tests/Processors/Linker/second/input/0000775000076400007640000000000011172123233022014 5ustar stefanstefansynopsis-0.12/tests/Processors/Linker/second/input/forward.h0000664000076400007640000000001411104703271023625 0ustar stefanstefanclass Foo; synopsis-0.12/tests/Processors/Linker/second/input/definition.h0000664000076400007640000000001611104703270024312 0ustar stefanstefanclass Foo {}; synopsis-0.12/tests/Processors/Linker/second/synopsis.py.in0000664000076400007640000000061111104703271023522 0ustar stefanstefanfrom Synopsis.process import process from Synopsis.Processor import Composite from Synopsis.Parsers import Cxx from Synopsis.Processors import Linker from Synopsis.Formatters import Dump import os process(parse = Composite(Cxx.Parser(base_path = '@abs_top_srcdir@' + os.sep), Linker(), Dump.Formatter(show_ids = False, stylesheet = None))) synopsis-0.12/tests/Processors/Linker/second/expected.xml0000664000076400007640000000245511104703271023207 0ustar stefanstefan comments comments synopsis-0.12/tests/Processors/synopsis.py.in0000664000076400007640000000146611104703271021034 0ustar stefanstefanfrom Synopsis.process import process from Synopsis.Processor import Composite from Synopsis.Parsers import Cxx from Synopsis.Processors.Comments import SSFilter, Previous from Synopsis.Formatters import Dump from Synopsis.import_processor import import_processor import os, sys, re # Figure out the comment processor(s) from processing instructions in the input. src = sys.argv[-1] content = open(src, 'r+').read() processors = [i.strip() for i in re.findall('-\*-(.*?)-\*-', content)] processors = [import_processor('Synopsis.Processors.%s'%p)() for p in processors] processors.insert(0, Cxx.Parser(base_path = '/home/stefan/projects/Synopsis-repository/branches/Synopsis_0_8/tests' + os.sep)) processors.append(Dump.Formatter(show_ids = False, stylesheet = None)) process(parse = Composite(*processors)) synopsis-0.12/tests/configure0000775000076400007640000027165311122276547015755 0ustar stefanstefan#! /bin/sh # From configure.ac Revision: 1.1 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for tests 1.0. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='tests' PACKAGE_TARNAME='tests' PACKAGE_VERSION='1.0' PACKAGE_STRING='tests 1.0' PACKAGE_BUGREPORT='synopsis-devel@fresco.org' ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT PYTHON LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CXX CXXFLAGS LDFLAGS LIBS CPPFLAGS CCC' # 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. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_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 ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_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'` 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 ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_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'` 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; }; } 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 directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $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 test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures tests 1.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/tests] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of tests 1.0:";; esac cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-python=PATH specify the Python interpreter --with-syn-cxx=PATH specify the Synopsis C++ library prefix 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 LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF tests configure 1.0 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by tests $as_me 1.0, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file 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 $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { 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 # Check whether --with-python was given. if test "${with_python+set}" = set; then withval=$with_python; PYTHON="$with_python" else PYTHON="python" fi # Check whether --with-syn-cxx was given. if test "${with_syn_cxx+set}" = set; then withval=$with_syn_cxx; SYN_CXX="$with_syn_cxx" else SYN_CXX="/usr/local" fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { 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 g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { 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 if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then 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 # Check that 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' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 that 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 { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { 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 { 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 ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { 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 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 SYN_CPP="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --cflags synopsis-uninstalled`" SYN_LIBS="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --libs synopsis-uninstalled`" CPPFLAGS="$CPPFLAGS $SYN_CPP" LIBS="$LIBS $SYN_LIBS" if test -n "$PYTHON" -a "$PYTHON" != yes; then # Extract the first word of "$PYTHON", so it can be a program name with args. set dummy $PYTHON; 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_PYTHON+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$PYTHON"; then ac_cv_prog_PYTHON="$PYTHON" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PYTHON="{ { echo "$as_me:$LINENO: error: Cannot find Python interpreter" >&5 echo "$as_me: error: Cannot find Python interpreter" >&2;} { (exit 1); exit 1; }; }" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PYTHON=$ac_cv_prog_PYTHON if test -n "$PYTHON"; then { echo "$as_me:$LINENO: result: $PYTHON" >&5 echo "${ECHO_T}$PYTHON" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi else # Extract the first word of "python2 python", so it can be a program name with args. set dummy python2 python; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_PYTHON+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $PYTHON in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_PYTHON" && ac_cv_path_PYTHON="python" ;; esac fi PYTHON=$ac_cv_path_PYTHON if test -n "$PYTHON"; then { echo "$as_me:$LINENO: result: $PYTHON" >&5 echo "${ECHO_T}$PYTHON" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"` PYTHON_INCLUDE=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_inc()"` PYTHON_VERSION=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_config_var('VERSION')"` PYTHON_LIBS="-L $PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION" PYTHON_DEP_LIBS=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_config_var('LIBS') or ''"` case `uname -s` in CYGWIN*) if test `$PYTHON -c "import os; print os.name"` = posix; then PYTHON_DEP_LIBS=`$PYTHON -c "from distutils import sysconfig; import re; print re.sub(r'\\s*-lutil', '', sysconfig.get_config_var('LIBS') or '')"` else if test "$CXX" = "g++"; then CXXFLAGS="-mno-cygwin $CXXFLAGS" LDFLAGS="-mno-cygwin $LDFLAGS" fi PYTHON_INCLUDE=`cygpath -a $PYTHON_INCLUDE` PYTHON_DEP_LIBS=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_config_var('LIBS') or ''"` fi CXXFLAGS="-D_REENTRANT $CXXFLAGS" LDFLAGS="-rdynamic $LDFLAGS" ;; *) LDFLAGS="-rdynamic $LDFLAGS" ;; esac CPPFLAGS="-I $PYTHON_INCLUDE $CPPFLAGS" LIBS="$LIBS $PYTHON_LIBS $PYTHON_DEP_LIBS" templates=`find $srcdir -name '*.in' -print | sed -e "s,^$srcdir/,,g" -e "s,\.in$,,g"` ac_config_files="$ac_config_files $templates" mkdir -p Cxx/src mkdir -p Cxx/bin cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${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 more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by tests $as_me 1.0, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" _ACEOF 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 and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ tests config.status 1.0 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' _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 ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "$templates") CONFIG_FILES="$CONFIG_FILES $templates" ;; *) { { 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 fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for 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 _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CXX!$ac_ct_CXX$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim PYTHON!$PYTHON$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 47; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF 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&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; esac done # for ac_tag { (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 synopsis-0.12/tests/Cxx/0000775000076400007640000000000011172123233014556 5ustar stefanstefansynopsis-0.12/tests/Cxx/ext.cc0000664000076400007640000000020011122771123015657 0ustar stefanstefan// int foo() // { // return __extension__ (__m128){ 0.0f, 0.0f, 0.0f, 0.0f }; // } void foo(struct S i); void foo(enum A i); synopsis-0.12/tests/Cxx/SymbolLookup/0000775000076400007640000000000011172123233017215 5ustar stefanstefansynopsis-0.12/tests/Cxx/SymbolLookup/README0000664000076400007640000000052711104703270020101 0ustar stefanstefanThis test suite covers clause 3 of the C++ ISO 14882 standard. It is based on a test suite described in "Testing C++ Compilers for ISO Language Conformance" (Brian A. Malloy, Scott A. Linde, Edward B.Duffy, James F. Power), which is available at http://www.cs.clemson.edu/~malloy/projects/ddj/ together with the original testing framework. synopsis-0.12/tests/Cxx/SymbolLookup/input/0000775000076400007640000000000011172123233020354 5ustar stefanstefansynopsis-0.12/tests/Cxx/SymbolLookup/input/unqualified-7e.cc0000664000076400007640000000070711104703270023506 0ustar stefanstefannamespace M { class B {}; } const int i = 5; namespace N { class Y : public M::B { class X { int a[i]; }; }; } // The following scopes are searched for a declaration of i: // 1) scope of class N::Y::X, before the use of i // 2) scope of class N::Y, before the definition of N::Y::X // 3) scope of N::Y's base class M::B // 4) scope of namespace N, before the definition of N::Y // 5) global scope, before the definition of N synopsis-0.12/tests/Cxx/SymbolLookup/input/unqualified-6a.cc0000664000076400007640000000051211104703270023473 0ustar stefanstefannamespace A { namespace N { void f(); } } void A::N::f() { int i; i = 5; // The following scopes are searched for a declaration of i: // 1) outermost block scope of A::N::f, before the use of i // 2) scope of namespace N // 3) scope of namespace A // 4) global scope, before the definition of A::N::f } synopsis-0.12/tests/Cxx/SymbolLookup/input/types-2.cc0000664000076400007640000000074711104703270022176 0ustar stefanstefan #if defined(BORLAND55) #include #else #include #endif struct T { int a; }; // start of test case: #define N sizeof(T) int main () { char buf[N]; T obj; // obj initialized to its original value obj.a = 1138; memcpy(buf, &obj, N); // between these two calls to memcpy, // obj might be modified memcpy(&obj, buf, N); // at this point, each subobject of obj of scalar type // holds its original value if (1138 != obj.a) return 1; return 0; } synopsis-0.12/tests/Cxx/SymbolLookup/input/lifetime-9b.cc0000664000076400007640000000015611104703270022773 0ustar stefanstefanstruct B { B(){} ~B(){} }; const B b; void h() { b.~B(); new (&b) const B; // undefined behavior } synopsis-0.12/tests/Cxx/SymbolLookup/input/unqualified-8b.cc0000664000076400007640000000070711104703270023504 0ustar stefanstefanclass B {}; namespace M { namespace N { class X : public B { void f(); int i; }; } } void M::N::X::f() { i = 16; } // The following scopes are searched for a declaration of i: // 1) outermost block scope of M::N::X::f, before the use of i // 2) scope of class M::N::X // 3) scope of M::N::X's base class B // 4) scope of namespace M::N // 5) scope of namespace M // 6) global scope, before the definition of M::N::X::f synopsis-0.12/tests/Cxx/SymbolLookup/input/unqualified-6d.cc0000664000076400007640000000051411104703270023500 0ustar stefanstefannamespace A { namespace N { void f(); } } int i; void A::N::f() { i = 5; // The following scopes are searched for a declaration of i: // 1) outermost block scope of A::N::f, before the use of i // 2) scope of namespace N // 3) scope of namespace A // 4) global scope, before the definition of A::N::f } synopsis-0.12/tests/Cxx/SymbolLookup/input/scope-2.cc0000664000076400007640000000036511104703270022137 0ustar stefanstefan///////////////////////////////////////////////////////////// // Code segment must be in a scope to test. // ///////////////////////////////////////////////////////////// void foo () { const int i = 2; { int i[i]; } } synopsis-0.12/tests/Cxx/SymbolLookup/input/storage-auto-1.cc0000664000076400007640000000020111104703270023424 0ustar stefanstefan bool ok = true; struct T { ~T() { ok = false; } }; int main() { { static T t; } if (!ok) return 1; return 0; } synopsis-0.12/tests/Cxx/SymbolLookup/input/qualified-namespace-2b.cc0000664000076400007640000000303111104703270025056 0ustar stefanstefanint x; namespace Y { void f(float); void h(int); } namespace Z { void h(double); } namespace A { using namespace Y; void f(int); void g(int); int i; } namespace B { using namespace Z; void f(char); int i; } namespace AB { using namespace A; using namespace B; void g(); } void h() { AB::g(); // g is declared directly in AB, // therefore S is { AB::g() } and AB::g() is chos en AB::f(1); // f is not declared directly in AB so the rules are // applied recursively to A and B; // namespace Y is not searched and Y::f(float) // is not considered; // S is { A::f(int), B::f(char) } and overload // resolution chooses A::f(int) AB::f('c'); // as above but resolution chooses B::f(char) AB::x++; // x is not declared directly in AB, and // is not declared in A or B, so the rules are // applied recursively to Y and Z, // S is { } so the program is ill-formed // AB::i++; // i is not declared directly in AB so the rules are // applied recursively to A and B, // S is { A::i, B::i } so the use is ambiguous // and the program is ill-formed AB::h(16.8); // h is not declared directly in AB and // not declared directly in A or B so the rules are // applied recursively to Y and Z, // S is { Y::h(int), Z::h(double) } and overload // resolution chooses Z::h(double) } synopsis-0.12/tests/Cxx/SymbolLookup/input/qualified-3a.cc0000664000076400007640000000037611104703270023135 0ustar stefanstefanclass X {}; class C { class X {}; static const int number = 50; static X arr[number]; }; // X C::arr[number]; // ill-formed // equivalent to: ::X C::arr[C::number]; // not to C::X C::arr[C::number]; synopsis-0.12/tests/Cxx/SymbolLookup/input/scope-namespace-1b.cc0000664000076400007640000000113511104703270024226 0ustar stefanstefanchar k; namespace N { int i; int g(int a) { return a; } int j(); void q(); } namespace { int l=1; } // the potential scope of l is from its point of declaration // to the end of the translation unit namespace N { int g(char a) // overloads N::g(int) { return k+a; // k is from unnamed namespace } int i; // error: duplicate definition int j(); // ok: duplicate function declaration int j() // ok: definition of N::j() { return g(i); // calls N::g(int) } // int q(); // error: different return type } synopsis-0.12/tests/Cxx/SymbolLookup/input/unqualified-8e.cc0000664000076400007640000000070311104703270023503 0ustar stefanstefanclass B {}; namespace M { int i; namespace N { class X : public B { void f(); }; } } void M::N::X::f() { i = 16; } // The following scopes are searched for a declaration of i: // 1) outermost block scope of M::N::X::f, before the use of i // 2) scope of class M::N::X // 3) scope of M::N::X's base class B // 4) scope of namespace M::N // 5) scope of namespace M // 6) global scope, before the definition of M::N::X::f synopsis-0.12/tests/Cxx/SymbolLookup/input/declaration-4.cc0000664000076400007640000000003711104703270023311 0ustar stefanstefanstruct X; struct X* x1; X* x2; synopsis-0.12/tests/Cxx/SymbolLookup/input/qualified-namespace-2a.cc0000664000076400007640000000304511104703270025062 0ustar stefanstefanint x; namespace Y { void f(float) {} void h(int) {} } namespace Z { void h(double) {} } namespace A { using namespace Y; void f(int) {} void g(int) {} int i; } namespace B { using namespace Z; void f(char) {} int i; } namespace AB { using namespace A; using namespace B; void g() {} } void h() { AB::g(); // g is declared directly in AB, // therefore S is { AB::g() } and AB::g() is chos en AB::f(1); // f is not declared directly in AB so the rules are // applied recursively to A and B; // namespace Y is not searched and Y::f(float) // is not considered; // S is { A::f(int), B::f(char) } and overload // resolution chooses A::f(int) AB::f('c'); // as above but resolution chooses B::f(char) // AB::x++; // x is not declared directly in AB, and // is not declared in A or B, so the rules are // applied recursively to Y and Z, // S is { } so the program is ill-formed // AB::i++; // i is not declared directly in AB so the rules are // applied recursively to A and B, // S is { A::i, B::i } so the use is ambiguous // and the program is ill-formed AB::h(16.8); // h is not declared directly in AB and // not declared directly in A or B so the rules are // applied recursively to Y and Z, // S is { Y::h(int), Z::h(double) } and overload // resolution chooses Z::h(double) } synopsis-0.12/tests/Cxx/SymbolLookup/input/unqualified-8f.cc0000664000076400007640000000070311104703270023504 0ustar stefanstefanclass B {}; namespace M { namespace N { class X : public B { void f(); }; } } int i; void M::N::X::f() { i = 16; } // The following scopes are searched for a declaration of i: // 1) outermost block scope of M::N::X::f, before the use of i // 2) scope of class M::N::X // 3) scope of M::N::X's base class B // 4) scope of namespace M::N // 5) scope of namespace M // 6) global scope, before the definition of M::N::X::f synopsis-0.12/tests/Cxx/SymbolLookup/input/template-parameters-3.cc0000664000076400007640000000026011104703270024775 0ustar stefanstefanclass T { /* ... */ }; int i; template void f(T t) { T t1 = i; // template-parameters T and i ::T t2 = ::i; // global namespace members T and i } synopsis-0.12/tests/Cxx/SymbolLookup/input/scope-0-2.cc0000664000076400007640000000020411104703270022264 0ustar stefanstefanint j = 24; int main() { int i = j, j; j = 42; if (42 == j && i == ::j) { return 0; } else { return 1; } } synopsis-0.12/tests/Cxx/SymbolLookup/input/lifetime-5c.cc0000664000076400007640000000153011104703270022765 0ustar stefanstefanvoid* malloc(int) { return 0; } ///////////////////////////////////////////////////////////////////////////// // Code above is both sufficient and necessary for proper compilation. // ///////////////////////////////////////////////////////////////////////////// struct B { virtual void f() {} void mutate(); virtual ~B() {} }; struct D1 : B { void f() {} }; struct D2 : B { void f() {} }; void B::mutate() { new (this) D2; // reuses storage - ends the lifetime of '*this' // f(); // undefined behavior // ... = this; // ok, 'this' points to valid memory } void g() { void* p = malloc(sizeof(D1) + sizeof(D2)); B* pb = new (p) D1; pb->mutate(); &pb; // ok: pb points to valid memory void* q = pb; // ok: pb points to valid memory pb->f(); // undefined behavior, lifetime of *pb has ended } synopsis-0.12/tests/Cxx/SymbolLookup/input/unqualified-7d.cc0000664000076400007640000000071111104703270023500 0ustar stefanstefannamespace M { class B {}; } namespace N { const int i = 5; class Y : public M::B { class X { int a[i]; }; }; } // The following scopes are searched for a declaration of i: // 1) scope of class N::Y::X, before the use of i // 2) scope of class N::Y, before the definition of N::Y::X // 3) scope of N::Y's base class M::B // 4) scope of namespace N, before the definition of N::Y // 5) global scope, before the definition of N synopsis-0.12/tests/Cxx/SymbolLookup/input/qualified-3b.cc0000664000076400007640000000027711104703270023136 0ustar stefanstefanclass X {}; class C { class X {}; static const int number = 50; static X arr[number]; }; X C::arr[number]; // ill-formed // equivalent to: ::X C::arr[C::number]; synopsis-0.12/tests/Cxx/SymbolLookup/input/qualified-namespace-2c.cc0000664000076400007640000000302711104703270025064 0ustar stefanstefanint x; namespace Y { void f(float); void h(int); } namespace Z { void h(double); } namespace A { using namespace Y; void f(int); void g(int); int i; } namespace B { using namespace Z; void f(char); int i; } namespace AB { using namespace A; using namespace B; void g(); } void h() { AB::g(); // g is declared directly in AB, // therefore S is { AB::g() } and AB::g() is chos en AB::f(1); // f is not declared directly in AB so the rules are // applied recursively to A and B; // namespace Y is not searched and Y::f(float) // is not considered; // S is { A::f(int), B::f(char) } and overload // resolution chooses A::f(int) AB::f('c'); // as above but resolution chooses B::f(char) // AB::x++; // x is not declared directly in AB, and // is not declared in A or B, so the rules are // applied recursively to Y and Z, // S is { } so the program is ill-formed AB::i++; // i is not declared directly in AB so the rules are // applied recursively to A and B, // S is { A::i, B::i } so the use is ambiguous // and the program is ill-formed AB::h(16.8); // h is not declared directly in AB and // not declared directly in A or B so the rules are // applied recursively to Y and Z, // S is { Y::h(int), Z::h(double) } and overload // resolution chooses Z::h(double) } synopsis-0.12/tests/Cxx/SymbolLookup/input/lifetime-5b.cc0000664000076400007640000000153011104703270022764 0ustar stefanstefanvoid* malloc(int) { return 0; } ///////////////////////////////////////////////////////////////////////////// // Code above is both sufficient and necessary for proper compilation. // ///////////////////////////////////////////////////////////////////////////// struct B { virtual void f() {} void mutate(); virtual ~B() {} }; struct D1 : B { void f() {} }; struct D2 : B { void f() {} }; void B::mutate() { new (this) D2; // reuses storage - ends the lifetime of '*this' f(); // undefined behavior // ... = this; // ok, 'this' points to valid memory } void g() { void* p = malloc(sizeof(D1) + sizeof(D2)); B* pb = new (p) D1; pb->mutate(); &pb; // ok: pb points to valid memory void* q = pb; // ok: pb points to valid memory // pb->f(); // undefined behavior, lifetime of *pb has ended } synopsis-0.12/tests/Cxx/SymbolLookup/input/scope-class-1-5a.cc0000664000076400007640000000070211104703270023537 0ustar stefanstefantypedef int c; enum { i = 1 }; class X { // char v[i]; // error: 'i' refers to ::i // but when reevaluated is X::i int f() { return sizeof(c); } // okay: X::c char c; enum { i = 2 }; }; typedef char* T; struct Y { // T a; // error: 'T' refers to ::T // but when reevaluated is Y::T typedef long T; T b; }; typedef int I; class D { //typedef I I; // error: even tho no reordering involved }; synopsis-0.12/tests/Cxx/SymbolLookup/input/unqualified-10.cc0000664000076400007640000000023411104703270023406 0ustar stefanstefanstruct A { typedef int AT; void f1(AT) {} void f2(float) {} }; struct B { typedef float BT; friend void A::f1(AT); friend void A::f2(BT); }; synopsis-0.12/tests/Cxx/SymbolLookup/input/types-7.cc0000664000076400007640000000144411104703270022176 0ustar stefanstefanclass X; // X is an incomplete type extern X* xp; // xp is a pointer to an incomplete type extern int arr[]; // the type of arr is incomplete typedef int UNKA[]; // UNKA is an incomplete type UNKA* arrp; // arrp is a pointer to an incomplete type UNKA** arrpp; void foo() { xp++; // ill-formed: X is incomplete arrp++; // ill-formed: incomplete type arrpp++; // okay: sizeof UNKA* is known } struct X { int i; }; // now X is a complete type int arr[10]; // now the type of arr is complete X x; void bar() { xp = &x; // okay; type is ``pointer to X'' arrp = &arr; // ill-formed: different types xp++; // okay: X is complete arrp++; // ill-formed: UNKA can't be completed } synopsis-0.12/tests/Cxx/SymbolLookup/input/lifetime-5a.cc0000664000076400007640000000173011104703270022765 0ustar stefanstefan//#include typedef unsigned int size_t; void *malloc(size_t size); ///////////////////////////////////////////////////////////////////////////// // Code above is both sufficient and necessary for proper compilation. // ///////////////////////////////////////////////////////////////////////////// struct B { virtual void f() {} void mutate(); virtual ~B() {} void * operator new(unsigned int, B*); void * operator new(unsigned int, void*); }; struct D1 : B { void f() {} }; struct D2 : B { void f() {} }; void B::mutate() { new (this) D2; // reuses storage - ends the lifetime of '*this' // f(); // undefined behavior // ... = this; // ok, 'this' points to valid memory } void g() { void* p = malloc(sizeof(D1) + sizeof(D2)); B* pb = new (p) D1; pb->mutate(); &pb; // ok: pb points to valid memory void* q = pb; // ok: pb points to valid memory // pb->f(); // undefined behavior, lifetime of *pb has ended } synopsis-0.12/tests/Cxx/SymbolLookup/input/lifetime-8.cc0000664000076400007640000000015311104703270022625 0ustar stefanstefanclass T { }; struct B { ~B(); }; void h() { B b; new (&b) T; } // undefined behavior at block exit synopsis-0.12/tests/Cxx/SymbolLookup/input/unqualified-7b.cc0000664000076400007640000000073411104703270023503 0ustar stefanstefannamespace M { class B {}; } namespace N { class Y : public M::B { public: static const int i = 5; class X { int a[i]; }; }; } // The following scopes are searched for a declaration of i: // 1) scope of class N::Y::X, before the use of i // 2) scope of class N::Y, before the definition of N::Y::X // 3) scope of N::Y's base class M::B // 4) scope of namespace N, before the definition of N::Y // 5) global scope, before the definition of N synopsis-0.12/tests/Cxx/SymbolLookup/input/linkage-6.cc0000664000076400007640000000032611104703270022441 0ustar stefanstefanstatic void f(); static int i = 0; //1 void g() { extern void f(); // internal linkage int i; //2: 'i' has no linkage { extern void f(); // internal linkage extern int i; //3: external linkage } } synopsis-0.12/tests/Cxx/SymbolLookup/input/template-parameters-2.cc0000664000076400007640000000026711104703270025003 0ustar stefanstefantemplate class myarray { /* ... */ }; template func() {} template class C = myarray> class Map { C key; C value; }; synopsis-0.12/tests/Cxx/SymbolLookup/input/unqualified-6c.cc0000664000076400007640000000051411104703270023477 0ustar stefanstefannamespace A { int i; namespace N { void f(); } } void A::N::f() { i = 5; // The following scopes are searched for a declaration of i: // 1) outermost block scope of A::N::f, before the use of i // 2) scope of namespace N // 3) scope of namespace A // 4) global scope, before the definition of A::N::f } synopsis-0.12/tests/Cxx/SymbolLookup/input/definitions-3a.cc0000664000076400007640000000123211104703270023475 0ustar stefanstefanint a; // defines a extern const int c = 1; // defines c int f(int x) { return x+a; } // defines f and defines x struct S { int a; int b; }; // defines S, S::a, and S::b struct X // defines X { int x; // defines nonstatic data member x static int y; // declares static data member y X(): x(0) { } // defines a constructor of X }; int X::y = 1; // defines X::y enum { up, down }; // defines up and down namespace N { int d; } // defines N and N::d namespace N1 = N; // defines N1 X anX; // defines anX synopsis-0.12/tests/Cxx/SymbolLookup/input/scope-3.cc0000664000076400007640000000041411104703270022133 0ustar stefanstefan///////////////////////////////////////////////////////////// // Code segment must be in a scope to test. // ///////////////////////////////////////////////////////////// void foo () { const int x = 12; { enum { x = x }; } } synopsis-0.12/tests/Cxx/SymbolLookup/input/qualified-namespace-6a.cc0000664000076400007640000000021211104703270025057 0ustar stefanstefannamespace A { namespace B { void f1(int); } using namespace B; } void A::f1(int){} // ill-formed, f1 is not a member of A synopsis-0.12/tests/Cxx/SymbolLookup/input/types-3.cc0000664000076400007640000000073511104703270022174 0ustar stefanstefan #if defined(BORLAND55) #include #else #include #endif struct T { T(int x):a(x){ } int a; }; int main() { T* t1p; T* t2p; T a(1138); T b(327); t1p = &a; t2p = &b; // provided that t2p points to an initialized object ... memcpy(t1p, t2p, sizeof(T)); // at this point, every subobject of POD type in *t1p // contains the same value as the corresponding subobject in // *t2p if (a.a != b.a) return 1; return 0; } synopsis-0.12/tests/Cxx/SymbolLookup/input/unqualified-7c.cc0000664000076400007640000000074211104703270023503 0ustar stefanstefannamespace M { class B { public: static const int i = 5; }; } namespace N { class Y : public M::B { class X { int a[i]; }; }; } // The following scopes are searched for a declaration of i: // 1) scope of class N::Y::X, before the use of i // 2) scope of class N::Y, before the definition of N::Y::X // 3) scope of N::Y's base class M::B // 4) scope of namespace N, before the definition of N::Y // 5) global scope, before the definition of N synopsis-0.12/tests/Cxx/SymbolLookup/input/unqualified-8d.cc0000664000076400007640000000070511104703270023504 0ustar stefanstefanclass B {}; namespace M { namespace N { int i; class X : public B { void f(); }; } } void M::N::X::f() { i = 16; } // The following scopes are searched for a declaration of i: // 1) outermost block scope of M::N::X::f, before the use of i // 2) scope of class M::N::X // 3) scope of M::N::X's base class B // 4) scope of namespace M::N // 5) scope of namespace M // 6) global scope, before the definition of M::N::X::f synopsis-0.12/tests/Cxx/SymbolLookup/input/initialization-2-2.cc0000664000076400007640000000040311104703270024205 0ustar stefanstefaninline double fd() { return 1.0; } extern double d1; double d2 = d1; // unspecified: // may be statically initialized to 0.0 or // dynamically initialized to 1.0 double d1 = fd(); // may be initialized statically to 1.0 synopsis-0.12/tests/Cxx/SymbolLookup/input/unqualified-8c.cc0000664000076400007640000000071511104703270023504 0ustar stefanstefanclass B { public: int i; }; namespace M { namespace N { class X : public B { void f(); }; } } void M::N::X::f() { i = 16; } // The following scopes are searched for a declaration of i: // 1) outermost block scope of M::N::X::f, before the use of i // 2) scope of class M::N::X // 3) scope of M::N::X's base class B // 4) scope of namespace M::N // 5) scope of namespace M // 6) global scope, before the definition of M::N::X::f synopsis-0.12/tests/Cxx/SymbolLookup/input/unqualified-7a.cc0000664000076400007640000000072411104703270023501 0ustar stefanstefannamespace M { class B {}; } namespace N { class Y : public M::B { class X { static const int i = 5; int a[i]; }; }; } // The following scopes are searched for a declaration of i: // 1) scope of class N::Y::X, before the use of i // 2) scope of class N::Y, before the definition of N::Y::X // 3) scope of N::Y's base class M::B // 4) scope of namespace N, before the definition of N::Y // 5) global scope, before the definition of N synopsis-0.12/tests/Cxx/SymbolLookup/input/scope-namespace-1c.cc0000664000076400007640000000113611104703270024230 0ustar stefanstefanchar k; namespace N { int i; int g(int a) { return a; } int j(); void q(); } namespace { int l=1; } // the potential scope of l is from its point of declaration // to the end of the translation unit namespace N { int g(char a) // overloads N::g(int) { return k+a; // k is from unnamed namespace } // int i; // error: duplicate definition int j(); // ok: duplicate function declaration int j() // ok: definition of N::j() { return g(i); // calls N::g(int) } int q(); // error: different return type } synopsis-0.12/tests/Cxx/SymbolLookup/input/qualified-namespace-5b.cc0000664000076400007640000000034611104703270025067 0ustar stefanstefannamespace A { struct x { }; int x; int y; } namespace B { struct y {}; } namespace C { using namespace A; using namespace B; int i = C::x; // ok, A::x (of type 'int') int j = C::y; // ambiguous, A::y or B::y } synopsis-0.12/tests/Cxx/SymbolLookup/input/unqualified-7f.cc0000664000076400007640000000067111104703270023507 0ustar stefanstefannamespace M { class B { }; } namespace N { class Y : public M::B { class X { int a[i]; }; }; } // The following scopes are searched for a declaration of i: // 1) scope of class N::Y::X, before the use of i // 2) scope of class N::Y, before the definition of N::Y::X // 3) scope of N::Y's base class M::B // 4) scope of namespace N, before the definition of N::Y // 5) global scope, before the definition of N synopsis-0.12/tests/Cxx/SymbolLookup/input/unqualified-6b.cc0000664000076400007640000000051611104703270023500 0ustar stefanstefannamespace A { namespace N { int i; void f(); } } void A::N::f() { i = 5; // The following scopes are searched for a declaration of i: // 1) outermost block scope of A::N::f, before the use of i // 2) scope of namespace N // 3) scope of namespace A // 4) global scope, before the definition of A::N::f } synopsis-0.12/tests/Cxx/SymbolLookup/input/definitions-4a.cc0000664000076400007640000000043611104703270023503 0ustar stefanstefan int x = 0; struct T { T() { x++; } T(const T& t) { x++; } T& operator=(const T& t) { x++; return *this; } }; struct C { T t; }; int main() { C a; if (x != 1) return 1; C b = a; if (x != 2) return 1; b = a; if (x != 3) return 1; return 0; } synopsis-0.12/tests/Cxx/SymbolLookup/input/using-directive-2a.cc0000664000076400007640000000057511104703270024273 0ustar stefanstefan// 7.3.4/2 namespace A { int i; } namespace B { int i; int j; namespace C { namespace D { using namespace A; int j; int k; int a = i; // B::i hides A::i } using namespace D; int k = 89; // no problem yet int l = k; // ambiguous C::k or D::k int m = i; // B::i hides A::i int n = j; // D::j hides B::j } } synopsis-0.12/tests/Cxx/SymbolLookup/input/linkage-7a.cc0000664000076400007640000000050611104703270022603 0ustar stefanstefannamespace X { void p() { // q(); // error: q not yet declared extern void q(); // q is a member of namespace X } void middle() { // q(); // error: q not yet declared } void q() { /* ... */ } // definition of X::q } void q() { /* ... */ } // some other, unrelated q synopsis-0.12/tests/Cxx/SymbolLookup/input/scope-1.cc0000664000076400007640000000043111104703270022130 0ustar stefanstefan///////////////////////////////////////////////////////////// // Code segment must be in a scope to test. // ///////////////////////////////////////////////////////////// int main() { int x = 999; { int x = x; if (x == 999) return 1; } return 0; } synopsis-0.12/tests/Cxx/SymbolLookup/input/linkage-7c.cc0000664000076400007640000000050511104703270022604 0ustar stefanstefannamespace X { void p() { // q(); // error: q not yet declared extern void q(); // q is a member of namespace X } void middle() { q(); // error: q not yet declared } void q() { /* ... */ } // definition of X::q } void q() { /* ... */ } // some other, unrelated q synopsis-0.12/tests/Cxx/SymbolLookup/input/unqualified-8a.cc0000664000076400007640000000070311104703270023477 0ustar stefanstefanclass B {}; namespace M { namespace N { class X : public B { void f(); }; } } void M::N::X::f() { int i; i = 16; } // The following scopes are searched for a declaration of i: // 1) outermost block scope of M::N::X::f, before the use of i // 2) scope of class M::N::X // 3) scope of M::N::X's base class B // 4) scope of namespace M::N // 5) scope of namespace M // 6) global scope, before the definition of M::N::X::f synopsis-0.12/tests/Cxx/SymbolLookup/input/qualified-namespace-3.cc0000664000076400007640000000054611104703270024725 0ustar stefanstefannamespace A { int a; } namespace B { using namespace A; } namespace C { using namespace A; } namespace BC { using namespace B; using namespace C; } void f() { BC::a++; // ok: S is { A::a, A::a } } namespace D { using A::a; } namespace BD { using namespace B; using namespace D; } void g() { BD::a++; // ok: S is { A::a, A::a } } synopsis-0.12/tests/Cxx/SymbolLookup/input/qualified-namespace-5a.cc0000664000076400007640000000035111104703270025062 0ustar stefanstefannamespace A { struct x { }; int x; int y; } namespace B { struct y {}; } namespace C { using namespace A; using namespace B; int i = C::x; // ok, A::x (of type 'int') //int j = C::y; // ambiguous, A::y or B::y } synopsis-0.12/tests/Cxx/SymbolLookup/input/qualified-namespace-6b.cc0000664000076400007640000000031711104703270025066 0ustar stefanstefannamespace A { namespace B { void f1(int); } } namespace C { namespace D { void f1(int); } } using namespace A; using namespace C::D; void B::f1(int){} // okay, defines A::B::f1(int) synopsis-0.12/tests/Cxx/SymbolLookup/input/using-directive-1a.cc0000664000076400007640000000067611104703270024274 0ustar stefanstefan// 7.3.4/1 namespace A { int i; namespace B { namespace C { int i; } using namespace A::B::C; void f1() { i = 1;} // OK, C::i visible in B and hides A::i } namespace D { using namespace B; using namespace C; // void f2() { i = 2;} // ambiguous, B::C::i or A::i ? } void f3() { i = 3;} // uses A::i } //void f4() { i = 4;} // ill-formed; neither i is visible synopsis-0.12/tests/Cxx/SymbolLookup/input/scope-namespace-1a.cc0000664000076400007640000000114011104703270024221 0ustar stefanstefanchar k; namespace N { int i; int g(int a) { return a; } int j(); void q(); } namespace { int l=1; } // the potential scope of l is from its point of declaration // to the end of the translation unit namespace N { int g(char a) // overloads N::g(int) { return k+a; // k is from unnamed namespace } // int i; // error: duplicate definition int j(); // ok: duplicate function declaration int j() // ok: definition of N::j() { return g(i); // calls N::g(int) } // int q(); // error: different return type } synopsis-0.12/tests/Cxx/SymbolLookup/input/definitions-3b.cc0000664000076400007640000000152711104703270023505 0ustar stefanstefanstruct X // defines X { int x; // defines nonstatic data member x static int y; // declares static data member y X(): x(0) { } // defines a constructor of X }; namespace N { int d; } // defines N and N::d /************************************************************************ Definitons above from 3.1.2-1 are necessary and sufficient for the proper compilation of code below. ************************************************************************/ extern int a; // declares a extern const int c; // declares c int f(int); // declares f struct S; // declares S typedef int Int; // declares Int extern X anotherX; // declares anotherX using N::d; // declares N::d synopsis-0.12/tests/Cxx/SymbolLookup/input/qualified-1b.cc0000664000076400007640000000024311104703270023125 0ustar stefanstefanclass A { public: static int n; }; int main() { int A; A::n = 42; // OK A b; // ill-formed: A does not name a type return 0; } synopsis-0.12/tests/Cxx/SymbolLookup/input/lifetime-7.cc0000664000076400007640000000074011104703270022626 0ustar stefanstefanstruct C { int i; void f(); const C& operator=( const C& ); void * operator new(unsigned int, C*); }; const C& C::operator=( const C& other) { if ( this != &other ) { this->~C(); // lifetime of '*this' ends new (this) C(other); // new object of type C created f(); // well-defined } return *this; } void f() { C c1; C c2; c1 = c2; // well-defined c1.f(); // well-defined; c1 refers to a new object of type C } synopsis-0.12/tests/Cxx/SymbolLookup/input/qualified-5.cc0000664000076400007640000000054111104703270022770 0ustar stefanstefanstruct C { typedef int I; }; typedef int I1, I2; int* p; int* q; struct A { ~A() {} }; typedef A AB; int main() { AB *ab; ab->AB::~AB(); // explicitly calls the destructor for A p->C::I::~I(); // I is looked up in the scope of A q->I1::~I2(); // I2 is looked up in the scope of // the postfix-expression return 0; } synopsis-0.12/tests/Cxx/SymbolLookup/input/string0000664000076400007640000000017511104703270021610 0ustar stefanstefanclass string { public: string() {} string(const string &) {} string & operator=(const string &) { return * this; } }; synopsis-0.12/tests/Cxx/SymbolLookup/input/definitions-4b.cc0000664000076400007640000000041711104703270023503 0ustar stefanstefan class string { public: string() {} string(const string &) {} string & operator=(const string &) { return *this; } }; struct C { string s; C(): s() { } C(const C& x): s(x.s) { } C& operator=(const C& x) { s = x.s; return *this; } ~C() { } }; synopsis-0.12/tests/Cxx/SymbolLookup/input/qualified-namespace-4.cc0000664000076400007640000000055411104703270024725 0ustar stefanstefannamespace B { int b; } namespace A { using namespace B; int a; } namespace B { using namespace A; } void f() { A::a++; // ok: a declared directly in A, S is { A::a } B::a++; // ok: both A and B searched (once), S is { A::a } A::b++; // ok: both A and B searched (once), S is { B::b } B::b++; // ok: b declared directly in B, S is { B::b } } synopsis-0.12/tests/Cxx/SymbolLookup/input/linkage-7b.cc0000664000076400007640000000050511104703270022603 0ustar stefanstefannamespace X { void p() { q(); // error: q not yet declared extern void q(); // q is a member of namespace X } void middle() { // q(); // error: q not yet declared } void q() { /* ... */ } // definition of X::q } void q() { /* ... */ } // some other, unrelated q synopsis-0.12/tests/Cxx/SymbolLookup/input/unqualified-8g.cc0000664000076400007640000000067611104703270023516 0ustar stefanstefanclass B {}; namespace M { namespace N { class X : public B { void f(); }; } } void M::N::X::f() { i = 16; } // The following scopes are searched for a declaration of i: // 1) outermost block scope of M::N::X::f, before the use of i // 2) scope of class M::N::X // 3) scope of M::N::X's base class B // 4) scope of namespace M::N // 5) scope of namespace M // 6) global scope, before the definition of M::N::X::f synopsis-0.12/tests/Cxx/SymbolLookup/input/scope-4.cc0000664000076400007640000000007111104703270022133 0ustar stefanstefanstruct X { enum E { z = 16 }; int b[X::z]; //ok }; synopsis-0.12/tests/Cxx/SymbolLookup/input/lifetime-9a.cc0000664000076400007640000000016111104703270022766 0ustar stefanstefanstruct B { B(){} ~B(){} }; const B b; void h() { b.~B(); // new (&b) const B; // undefined behavior } synopsis-0.12/tests/Cxx/SymbolLookup/input/unqualified-6e.cc0000664000076400007640000000050211104703270023476 0ustar stefanstefannamespace A { namespace N { void f(); } } void A::N::f() { i = 5; // The following scopes are searched for a declaration of i: // 1) outermost block scope of A::N::f, before the use of i // 2) scope of namespace N // 3) scope of namespace A // 4) global scope, before the definition of A::N::f } synopsis-0.12/tests/Cxx/SymbolLookup/input/qualified-1a.cc0000664000076400007640000000025511104703270023127 0ustar stefanstefanclass A { public: static int n; }; int A::n; int main() { int A; A::n = 42; // OK // A b; // ill-formed: A does not name a type return 0; } synopsis-0.12/tests/Cxx/SymbolLookup/expected/0000775000076400007640000000000011172123233021016 5ustar stefanstefansynopsis-0.12/tests/Cxx/SymbolLookup/expected/unqualified-8g.out0000664000076400007640000000053711104703270024376 0ustar stefanstefanClassSpec : B declared at line 1 in Namespace : M declared at line 2 in Namespace : N declared at line 4 in ClassSpec : X declared at line 6 in Identifier : B declared at line 1 in Declarator : f declared at line 15 in Declarator : M::N::X::f declared at line 15 in Identifier : i undeclared ! synopsis-0.12/tests/Cxx/SymbolLookup/expected/unqualified-6c.out0000664000076400007640000000042211104703270024361 0ustar stefanstefanNamespace : A declared at line 1 in Declarator : i declared at line 3 in Namespace : N declared at line 4 in Declarator : f declared at line 9 in Declarator : A::N::f declared at line 9 in Identifier : i declared at line 3 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/unqualified-6a.out0000664000076400007640000000042411104703270024361 0ustar stefanstefanNamespace : A declared at line 1 in Namespace : N declared at line 3 in Declarator : f declared at line 8 in Declarator : A::N::f declared at line 8 in Declarator : i declared at line 10 in Identifier : i declared at line 10 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/unqualified-6b.out0000664000076400007640000000042211104703270024360 0ustar stefanstefanNamespace : A declared at line 1 in Namespace : N declared at line 3 in Declarator : i declared at line 5 in Declarator : f declared at line 9 in Declarator : A::N::f declared at line 9 in Identifier : i declared at line 5 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/qualified-1b.out0000664000076400007640000000051211104703270024010 0ustar stefanstefanClassSpec : A declared at line 1 in Declarator : n declared at line 4 in Declarator : main declared at line 7 in Declarator : A declared at line 9 in Name : A::n declared at line 4 in Type : A only non-types found declared at line 9 in Declarator : b declared at line 11 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/template-parameters-2.out0000664000076400007640000000133711104703270025666 0ustar stefanstefanIdentifier : T declared at line 1 in ClassSpec : myarray declared at line 1 in Identifier : T declared at line 2 in Declarator : func declared at line 2 in Identifier : K declared at line 3 in Identifier : V declared at line 3 in Identifier : T declared at line 3 in Identifier : C declared at line 3 in Name : myarray declared at line 1 in ClassSpec : Map declared at line 3 in Identifier : C declared at line 3 in Identifier : K declared at line 3 in Declarator : key declared at line 6 in Identifier : C declared at line 3 in Identifier : V declared at line 3 in Declarator : value declared at line 7 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/template-parameters-3.out0000664000076400007640000000102111104703270025655 0ustar stefanstefanClassSpec : T declared at line 1 in Declarator : i declared at line 2 in Identifier : T declared at line 4 in Identifier : T declared at line 4 in Declarator : i declared at line 4 in Declarator : f declared at line 4 in Type : T declared at line 4 in Declarator : t1 declared at line 6 in Identifier : i declared at line 4 in Identifier : T declared at line 4 in Declarator : t2 declared at line 7 in Name : i declared at line 2 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/unqualified-8d.out0000664000076400007640000000063411104703270024371 0ustar stefanstefanClassSpec : B declared at line 1 in Namespace : M declared at line 2 in Namespace : N declared at line 4 in Declarator : i declared at line 6 in ClassSpec : X declared at line 7 in Identifier : B declared at line 1 in Declarator : f declared at line 13 in Declarator : M::N::X::f declared at line 13 in Identifier : i declared at line 6 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/declaration-4.out0000664000076400007640000000033311104703270024174 0ustar stefanstefanClassSpec : X declared at line 1 in ClassSpec : X declared at line 1 in Declarator : x1 declared at line 2 in Type : X declared at line 1 in Declarator : x2 declared at line 3 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/qualified-namespace-5a.out0000664000076400007640000000074711104703270025757 0ustar stefanstefanNamespace : A declared at line 1 in ClassSpec : x declared at line 3 in Declarator : x declared at line 4 in Declarator : y declared at line 5 in Namespace : B declared at line 7 in ClassSpec : y declared at line 9 in Namespace : C declared at line 11 in Namespace : A declared at line 1 in Namespace : B declared at line 7 in Declarator : i declared at line 15 in Name : C::x declared at line 4 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/qualified-namespace-4.out0000664000076400007640000000101411104703270025601 0ustar stefanstefanNamespace : B declared at line 1 in Declarator : b declared at line 3 in Namespace : A declared at line 5 in Namespace : B declared at line 1 in Declarator : a declared at line 8 in Namespace : B declared at line 1 in Namespace : A declared at line 5 in Declarator : f declared at line 14 in Name : A::a declared at line 8 in Name : B::a declared at line 8 in Name : A::b declared at line 3 in Name : B::b declared at line 3 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/unqualified-8e.out0000664000076400007640000000063411104703270024372 0ustar stefanstefanClassSpec : B declared at line 1 in Namespace : M declared at line 2 in Declarator : i declared at line 4 in Namespace : N declared at line 5 in ClassSpec : X declared at line 7 in Identifier : B declared at line 1 in Declarator : f declared at line 13 in Declarator : M::N::X::f declared at line 13 in Identifier : i declared at line 4 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/unqualified-8a.out0000664000076400007640000000063611104703270024370 0ustar stefanstefanClassSpec : B declared at line 1 in Namespace : M declared at line 2 in Namespace : N declared at line 4 in ClassSpec : X declared at line 6 in Identifier : B declared at line 1 in Declarator : f declared at line 12 in Declarator : M::N::X::f declared at line 12 in Declarator : i declared at line 14 in Identifier : i declared at line 14 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/unqualified-8b.out0000664000076400007640000000063411104703270024367 0ustar stefanstefanClassSpec : B declared at line 1 in Namespace : M declared at line 2 in Namespace : N declared at line 4 in ClassSpec : X declared at line 6 in Identifier : B declared at line 1 in Declarator : f declared at line 13 in Declarator : i declared at line 9 in Declarator : M::N::X::f declared at line 13 in Identifier : i declared at line 9 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/qualified-namespace-2a.out0000664000076400007640000000224311104703270025745 0ustar stefanstefanDeclarator : x declared at line 1 in Namespace : Y declared at line 2 in Declarator : f declared at line 4 in Declarator : h declared at line 5 in Namespace : Z declared at line 7 in Declarator : h declared at line 9 in Namespace : A declared at line 11 in Namespace : Y declared at line 2 in Declarator : f declared at line 14 in Declarator : g declared at line 15 in Declarator : i declared at line 16 in Namespace : B declared at line 18 in Namespace : Z declared at line 7 in Declarator : f declared at line 21 in Declarator : i declared at line 22 in Namespace : AB declared at line 24 in Namespace : A declared at line 11 in Namespace : B declared at line 18 in Declarator : g declared at line 28 in Declarator : h declared at line 31 in Function : AB::g declared at line 28 in Function : AB::f declared at line 14 in declared at line 21 in Function : AB::f declared at line 14 in declared at line 21 in Function : AB::h declared at line 5 in declared at line 9 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/qualified-namespace-2b.out0000664000076400007640000000227611104703270025754 0ustar stefanstefanDeclarator : x declared at line 1 in Namespace : Y declared at line 2 in Declarator : f declared at line 4 in Declarator : h declared at line 5 in Namespace : Z declared at line 7 in Declarator : h declared at line 9 in Namespace : A declared at line 11 in Namespace : Y declared at line 2 in Declarator : f declared at line 14 in Declarator : g declared at line 15 in Declarator : i declared at line 16 in Namespace : B declared at line 18 in Namespace : Z declared at line 7 in Declarator : f declared at line 21 in Declarator : i declared at line 22 in Namespace : AB declared at line 24 in Namespace : A declared at line 11 in Namespace : B declared at line 18 in Declarator : g declared at line 28 in Declarator : h declared at line 31 in Function : AB::g declared at line 28 in Function : AB::f declared at line 14 in declared at line 21 in Function : AB::f declared at line 14 in declared at line 21 in Name : AB::x undeclared ! Function : AB::h declared at line 5 in declared at line 9 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/unqualified-6e.out0000664000076400007640000000032511104703270024365 0ustar stefanstefanNamespace : A declared at line 1 in Namespace : N declared at line 3 in Declarator : f declared at line 8 in Declarator : A::N::f declared at line 8 in Identifier : i undeclared ! synopsis-0.12/tests/Cxx/SymbolLookup/expected/qualified-namespace-6a.out0000664000076400007640000000011411104703270025744 0ustar stefanstefanUndefined symbol : A::f1 at :9 Undefined symbol : A::f1 at :9 synopsis-0.12/tests/Cxx/SymbolLookup/expected/qualified-namespace-3.out0000664000076400007640000000143711104703270025611 0ustar stefanstefanNamespace : A declared at line 1 in Declarator : a declared at line 3 in Namespace : B declared at line 5 in Namespace : A declared at line 1 in Namespace : C declared at line 9 in Namespace : A declared at line 1 in Namespace : BC declared at line 13 in Namespace : B declared at line 5 in Namespace : C declared at line 9 in Declarator : f declared at line 18 in Name : BC::a declared at line 3 in Namespace : D declared at line 22 in Name : A::a declared at line 3 in Namespace : BD declared at line 26 in Namespace : B declared at line 5 in Namespace : D declared at line 22 in Declarator : g declared at line 32 in Name : BD::a declared at line 3 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/qualified-namespace-2c.out0000664000076400007640000000235611104703270025754 0ustar stefanstefanDeclarator : x declared at line 1 in Namespace : Y declared at line 2 in Declarator : f declared at line 4 in Declarator : h declared at line 5 in Namespace : Z declared at line 7 in Declarator : h declared at line 9 in Namespace : A declared at line 11 in Namespace : Y declared at line 2 in Declarator : f declared at line 14 in Declarator : g declared at line 15 in Declarator : i declared at line 16 in Namespace : B declared at line 18 in Namespace : Z declared at line 7 in Declarator : f declared at line 21 in Declarator : i declared at line 22 in Namespace : AB declared at line 24 in Namespace : A declared at line 11 in Namespace : B declared at line 18 in Declarator : g declared at line 28 in Declarator : h declared at line 31 in Function : AB::g declared at line 28 in Function : AB::f declared at line 14 in declared at line 21 in Function : AB::f declared at line 14 in declared at line 21 in Name : AB::i declared at line 16 in declared at line 22 in Function : AB::h declared at line 5 in declared at line 9 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/unqualified-6d.out0000664000076400007640000000042411104703270024364 0ustar stefanstefanNamespace : A declared at line 1 in Namespace : N declared at line 3 in Declarator : f declared at line 11 in Declarator : i declared at line 9 in Declarator : A::N::f declared at line 11 in Identifier : i declared at line 9 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/qualified-namespace-5b.out0000664000076400007640000000113511104703270025750 0ustar stefanstefanNamespace : A declared at line 1 in ClassSpec : x declared at line 3 in Declarator : x declared at line 4 in Declarator : y declared at line 5 in Namespace : B declared at line 7 in ClassSpec : y declared at line 9 in Namespace : C declared at line 11 in Namespace : A declared at line 1 in Namespace : B declared at line 7 in Declarator : i declared at line 15 in Name : C::x declared at line 4 in Declarator : j declared at line 16 in Name : C::y declared at line 5 in declared at line 9 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/unqualified-8f.out0000664000076400007640000000063611104703270024375 0ustar stefanstefanClassSpec : B declared at line 1 in Namespace : M declared at line 2 in Namespace : N declared at line 4 in ClassSpec : X declared at line 6 in Identifier : B declared at line 1 in Declarator : f declared at line 15 in Declarator : i declared at line 13 in Declarator : M::N::X::f declared at line 15 in Identifier : i declared at line 13 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/qualified-1a.out0000664000076400007640000000042011104703270024005 0ustar stefanstefanClassSpec : A declared at line 1 in Declarator : n declared at line 6 in Declarator : A::n declared at line 6 in Declarator : main declared at line 7 in Declarator : A declared at line 9 in Name : A::n declared at line 6 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/unqualified-8c.out0000664000076400007640000000063511104703270024371 0ustar stefanstefanClassSpec : B declared at line 1 in Declarator : i declared at line 4 in Namespace : M declared at line 6 in Namespace : N declared at line 8 in ClassSpec : X declared at line 10 in Identifier : B declared at line 1 in Declarator : f declared at line 16 in Declarator : M::N::X::f declared at line 16 in Identifier : i declared at line 4 in synopsis-0.12/tests/Cxx/SymbolLookup/expected/qualified-namespace-6b.out0000664000076400007640000000063511104703270025755 0ustar stefanstefanNamespace : A declared at line 1 in Namespace : B declared at line 3 in Declarator : f1 declared at line 17 in Namespace : C declared at line 8 in Namespace : D declared at line 10 in Declarator : f1 declared at line 12 in Namespace : A declared at line 1 in Namespace : C::D declared at line 10 in Declarator : B::f1 declared at line 17 in synopsis-0.12/tests/Cxx/ConstEvaluator/0000775000076400007640000000000011172123232017526 5ustar stefanstefansynopsis-0.12/tests/Cxx/ConstEvaluator/input/0000775000076400007640000000000011172123233020666 5ustar stefanstefansynopsis-0.12/tests/Cxx/ConstEvaluator/input/enum.cc0000664000076400007640000000026611104703270022145 0ustar stefanstefanenum Color { RED = 0x01, GREEN = 0x02, BLUE = 0x04, WHITE = 0x01 | 0x02 | 0x04}; enum Number { ZERO, ONE, TWO, THREE}; enum Flag { NO = 0, YES, OFF = 0, ON, FALSE = OFF, TRUE = ON}; synopsis-0.12/tests/Cxx/ConstEvaluator/input/variables.cc0000664000076400007640000000055411104703270023151 0ustar stefanstefanconst int a = 1 + 2 - 3; const int b = 1 << 4; const int c = 8 | 4, d = 22; int e; int f = e; const int g = 1 > 2 ? 1 : 2; const int h = (24 >> 3); const int i = (-1); const int j = ~0; const bool k = true; const bool l = false; const unsigned int m = sizeof(int); const unsigned int n = sizeof(char[8])/sizeof(char); const unsigned int o = int(2 * sizeof(bool)); synopsis-0.12/tests/Cxx/ConstEvaluator/expected/0000775000076400007640000000000011172123233021330 5ustar stefanstefansynopsis-0.12/tests/Cxx/ConstEvaluator/expected/variables.out0000664000076400007640000000077311104703270024040 0ustar stefanstefaninitializer : 1 + 2 - 3 value : 0 initializer : 1 << 4 value : 16 initializer : 8 | 4 value : 12 initializer : 22 value : 22 initializer : e value : none initializer : 1 > 2 ? 1 : 2 value : 2 initializer : ( 24 >> 3 ) value : 3 initializer : ( - 1 ) value : -1 initializer : ~ 0 value : -1 initializer : true value : 1 initializer : false value : 0 initializer : sizeof ( int ) value : 4 initializer : sizeof ( char [ 8 ] ) / sizeof ( char ) value : 8 initializer : int ( 2 * sizeof ( bool ) ) value : 2 synopsis-0.12/tests/Cxx/ConstEvaluator/expected/enum.out0000664000076400007640000000062111104703270023024 0ustar stefanstefanenumerator : RED, value : 1 enumerator : GREEN, value : 2 enumerator : BLUE, value : 4 enumerator : WHITE, value : 7 enumerator : ZERO, value : 0 enumerator : ONE, value : 1 enumerator : TWO, value : 2 enumerator : THREE, value : 3 enumerator : NO, value : 0 enumerator : YES, value : 1 enumerator : OFF, value : 0 enumerator : ON, value : 1 enumerator : FALSE, value : 0 enumerator : TRUE, value : 1 synopsis-0.12/tests/Cxx/TypeAnalysis/0000775000076400007640000000000011172123232017202 5ustar stefanstefansynopsis-0.12/tests/Cxx/TypeAnalysis/input/0000775000076400007640000000000011172123233020342 5ustar stefanstefansynopsis-0.12/tests/Cxx/TypeAnalysis/input/simple.cc0000664000076400007640000000100011104703267022137 0ustar stefanstefanchar a = 'a'; wchar_t b = L'b'; char const *c = "hello world!"; wchar_t const *d = L"hello world!"; int e = 5; long f = 5l; long g = 5L; unsigned int h = 5u; unsigned int i = 5U; float j = .1; float k = 1.1; float l = 1e-3; double m = 1.1l; double n = 1.1L; char o = a + 5; wchar_t p = b + 5; char q = c + 5; wchar_t r = d + 5; long s = e + f; long t = e + h; synopsis-0.12/tests/Cxx/src/0000775000076400007640000000000011172123233015345 5ustar stefanstefansynopsis-0.12/tests/Cxx/src/SymbolLookup.cc0000664000076400007640000002071111104703267020322 0ustar stefanstefan#include #include #include #include #include #include #include #include #include #include #include using namespace Synopsis; using namespace SymbolLookup; class SymbolFinder : private Walker { public: SymbolFinder(Buffer const &buffer, Scope *scope, std::ostream &os) : Walker(scope), my_buffer(buffer), my_os(os), my_in_template_decl(false) {} void find(PTree::Node *node) { node->accept(this);} private: using Walker::visit; virtual void visit(PTree::Identifier *iden) { Trace trace("SymbolFinder::visit(Identifier)", Trace::SYMBOLLOOKUP); PTree::Encoding name = PTree::Encoding::simple_name(iden); my_os << "Identifier : " << name.unmangled() << std::endl; lookup(name); } virtual void visit(PTree::Block *node) { Trace trace("SymbolFinder::visit(Block)", Trace::SYMBOLLOOKUP); Walker::visit(node); } virtual void visit(PTree::Typedef *typed) { Trace trace("SymbolFinder::visit(Typedef)", Trace::SYMBOLLOOKUP); // We need to figure out how to reproduce the (encoded) name of // the type being aliased. my_os << "Type : " << "" << std::endl; // lookup(name); PTree::third(typed)->accept(this); } virtual void visit(PTree::TemplateDecl *tdecl) { Trace trace("SymbolFinder::visit(TemplateDecl)", Trace::SYMBOLLOOKUP); traverse_parameters(tdecl); bool saved_in_template_decl = my_in_template_decl; my_in_template_decl = true; PTree::Node *fourth = PTree::nth(tdecl, 4); if (!fourth->is_atom()) fourth->accept(this); // This is a declaration. else { // We are in a template template parameter. // Visit the identifier and the default type, if present. PTree::Node *fifth = PTree::nth(tdecl, 5); if (fifth) fifth->accept(this); // This is an identifier } my_in_template_decl = saved_in_template_decl; } virtual void visit(PTree::NamespaceSpec *node) { Trace trace("SymbolFinder::visit(NamespaceSpec)", Trace::SYMBOLLOOKUP); PTree::Node const *name = PTree::second(node); PTree::Encoding ename; if (name) ename.simple_name(name); else ename.append_with_length(""); my_os << "Namespace : " << ename.unmangled() << std::endl; lookup(ename); traverse_body(node); } virtual void visit(PTree::Declaration *node) { Trace trace("SymbolFinder::visit(Declaration)", Trace::SYMBOLLOOKUP); PTree::Node *type_spec = PTree::second(node); // FIXME: what about compound types ? if (type_spec && type_spec->is_atom()) { PTree::Atom const *name = static_cast(type_spec); PTree::Encoding type = PTree::Encoding::simple_name(name); my_os << "Type : " << type.unmangled() << std::endl; lookup(type, Scope::DEFAULT, true); PTree::third(node)->accept(this); } else Walker::visit(node); } virtual void visit(PTree::UsingDirective *udir) { PTree::Node *node = PTree::third(udir); PTree::Encoding name = node->encoded_name(); my_os << "Namespace : " << name.unmangled() << std::endl; lookup(name); } virtual void visit(PTree::UsingDeclaration *udecl) { visit(static_cast(udecl));} virtual void visit(PTree::NamespaceAlias *alias) { { PTree::Node *node = PTree::second(alias); PTree::Encoding name = PTree::Encoding::simple_name(static_cast(node)); my_os << "Namespace : " << name.unmangled() << std::endl; lookup(name); } { PTree::Node *node = PTree::nth(alias, 3); PTree::Encoding name = node->encoded_name(); my_os << "Namespace : " << name.unmangled() << std::endl; lookup(name); } } virtual void visit(PTree::FunctionDefinition *node) { Trace trace("SymbolFinder::visit(FunctionDefinition)", Trace::SYMBOLLOOKUP); PTree::Node *decl = PTree::third(node); visit(static_cast(decl)); // visit the declarator try { traverse_body(node);} catch (Undefined const &e) {} // just ignore } virtual void visit(PTree::Declarator *decl) { Trace trace("SymbolFinder::visit(Declarator)", Trace::SYMBOLLOOKUP); PTree::Encoding name = decl->encoded_name(); // FIXME: The parser currently parses type specifiers that contain a template_id // such that in contains declarators with empty names. // Ignore these until the parser is fixed. if (name.empty()) return; PTree::Encoding type = decl->encoded_type(); my_os << "Declarator : " << name.unmangled() << std::endl; lookup(name, Scope::DECLARATION); if (type.is_function()) return; if (PTree::Node *initializer = decl->initializer()) initializer->accept(this); } virtual void visit(PTree::Name *n) { Trace trace("SymbolFinder::visit(Name)", Trace::SYMBOLLOOKUP); PTree::Encoding name = n->encoded_name(); my_os << "Name : " << name.unmangled() << std::endl; lookup(name); } virtual void visit(PTree::ClassSpec *node) { Trace trace("SymbolFinder::visit(ClassSpec)", Trace::SYMBOLLOOKUP); PTree::Encoding name = node->encoded_name(); my_os << "ClassSpec : " << name.unmangled() << std::endl; // FIXME: A ClassSpec may correspond to a class template, in which case // we shouldn't do a elaborate lookup. The visit(TemplateDecl) // method above will thus deal with the lookup itself. if (my_in_template_decl) lookup(name); else lookup(name, Scope::ELABORATE); for (PTree::Node const *base_clause = node->base_clause(); base_clause; base_clause = PTree::rest(PTree::rest(base_clause))) { PTree::Node const *parent = PTree::last(PTree::second(base_clause))->car(); const_cast(parent)->accept(this); } traverse_body(node); } virtual void visit(PTree::FuncallExpr *node) { Trace trace("SymbolFinder::visit(FuncallExpr)", Trace::SYMBOLLOOKUP); PTree::Node *function = node->car(); PTree::Encoding name; if (function->is_atom()) name.simple_name(function); else name = function->encoded_name(); // function is a 'PTree::Name' my_os << "Function : " << name.unmangled() << std::endl; lookup(name); } void lookup(PTree::Encoding const &name, Scope::LookupContext c = Scope::DEFAULT, bool type = false) { Trace trace("SymbolFinder::lookup", Trace::SYMBOLLOOKUP); SymbolSet symbols = current_scope()->lookup(name, c); if (!symbols.empty()) { if (type) // Expect a single match that is a type-name. { TypeName const *type = dynamic_cast(*symbols.begin()); if (type) { std::string filename; unsigned long line_number = my_buffer.origin(type->ptree()->begin(), filename); my_os << "declared at line " << line_number << " in " << filename << std::endl; return; } else my_os << "only non-types found" << std::endl; } for (SymbolSet::iterator s = symbols.begin(); s != symbols.end(); ++s) { std::string filename; unsigned long line_number = my_buffer.origin((*s)->ptree()->begin(), filename); my_os << "declared at line " << line_number << " in " << filename << std::endl; } } else my_os << "undeclared ! " << std::endl; } Buffer const &my_buffer; std::ostream &my_os; bool my_in_template_decl; }; int main(int argc, char **argv) { if (argc < 3) { std::cerr << "Usage: " << argv[0] << " [-d] " << std::endl; exit(-1); } try { std::string output; std::string input; if (argv[1] == std::string("-d")) { Trace::enable(Trace::SYMBOLLOOKUP); output = argv[2]; input = argv[3]; } else { output = argv[1]; input = argv[2]; } std::ofstream ofs(output.c_str()); std::ifstream ifs(input.c_str()); Buffer buffer(ifs.rdbuf(), ""); Lexer lexer(&buffer); SymbolFactory symbols; Parser parser(lexer, symbols); PTree::Node *node = parser.parse(); const Parser::ErrorList &errors = parser.errors(); for (Parser::ErrorList::const_iterator i = errors.begin(); i != errors.end(); ++i) (*i)->write(ofs); if (errors.empty()) { SymbolFinder finder(buffer, symbols.current_scope(), ofs); finder.find(node); } } catch (std::exception const &e) { std::cerr << "Caught exception : " << e.what() << std::endl; } } synopsis-0.12/tests/Cxx/src/Parser.cc0000664000076400007640000000205511104703270017112 0ustar stefanstefan#include #include #include #include #include #include #include #include using namespace Synopsis; int main(int argc, char **argv) { if (argc < 3) { std::cerr << "Usage: " << argv[0] << " [-d] " << std::endl; exit(-1); } try { std::string output; std::string input; if (argv[1] == std::string("-d")) { Trace::enable(Trace::ALL); output = argv[2]; input = argv[3]; } else { output = argv[1]; input = argv[2]; } std::ofstream ofs(output.c_str()); std::ifstream ifs(input.c_str()); Buffer buffer(ifs.rdbuf(), input); Lexer lexer(&buffer); SymbolFactory symbols; Parser parser(lexer, symbols); PTree::Node *node = parser.parse(); PTree::display(node, ofs, true); } catch (std::exception const &e) { std::cerr << "Caught exception : " << e.what() << std::endl; } } synopsis-0.12/tests/Cxx/src/TypeAnalysis.cc0000664000076400007640000000547511104703267020322 0ustar stefanstefan#include #include #include #include #include #include #include #include #include #include #include #include using namespace Synopsis; //. Evaluating types of expressions may involve //. overload resolution, if the types of the subexpressions //. are user defined (enums, classes). //. As this is a unit test for type evaluation, not overload //. resolution, we restrict ourselfs to builtin types. //. //. Test input should be a set of declarations where //. the initializers are expressions which we look up //. the type for. class InitializerFinder : private SymbolLookup::Walker { public: InitializerFinder(SymbolLookup::Scope *scope, std::ostream &os) : SymbolLookup::Walker(scope), my_os(os) {} void find(PTree::Node *node) { node->accept(this);} private: virtual void visit(PTree::Declaration *node) { PTree::Node *type = PTree::second(node); type->accept(this); PTree::Node *rest = PTree::third(node); if (rest->is_atom()) return; // ';' for (; rest; rest = rest->cdr()) { PTree::Node *p = rest->car(); p->accept(this); } } virtual void visit(PTree::Declarator *decl) { size_t length = PTree::length(decl); if (length >= 2 && *PTree::nth(decl, length - 2) == '=') { PTree::Node *init = PTree::tail(decl, length - 1)->car(); // do the type evaluation here... std::cout << "Expression : " << PTree::reify(init) << std::endl; TypeAnalysis::Type const *type = TypeAnalysis::type_of(init, current_scope()); // std::cout << "Type : " << type << std::endl; // std::cout << "Type : " << type.is_const() << std::endl; // std::cout << "Type : " << type.is_builtin_type() << std::endl; // std::cout << "Type : " << type << std::endl; } } std::ostream &my_os; }; int main(int argc, char **argv) { if (argc < 3) { std::cerr << "Usage: " << argv[0] << " [-d] " << std::endl; exit(-1); } try { std::string output; std::string input; if (argv[1] == std::string("-d")) { Trace::enable(Trace::ALL); output = argv[2]; input = argv[3]; } else { output = argv[1]; input = argv[2]; } std::ofstream ofs(output.c_str()); std::ifstream ifs(input.c_str()); Buffer buffer(ifs.rdbuf(), input); Lexer lexer(&buffer); SymbolFactory symbols; Parser parser(lexer, symbols); PTree::Node *node = parser.parse(); InitializerFinder finder(symbols.current_scope(), ofs); finder.find(node); } catch (std::exception const &e) { std::cerr << "Caught exception : " << e.what() << std::endl; } } synopsis-0.12/tests/Cxx/src/Lexer.cc0000664000076400007640000000227211104703267016744 0ustar stefanstefan#include #include #include #include #include #include #include using namespace Synopsis; int main(int argc, char **argv) { if (argc < 3) { std::cerr << "Usage: " << argv[0] << " [-d] " << std::endl; exit(-1); } try { std::string output; std::string input; if (argv[1] == std::string("-d")) { Trace::enable(Trace::ALL); output = argv[2]; input = argv[3]; } else { output = argv[1]; input = argv[2]; } std::ofstream ofs(output.c_str()); std::ifstream ifs(input.c_str()); Buffer buffer(ifs.rdbuf(), input); Lexer lexer(&buffer); int i = 0; while(true) { Token token; int t = lexer.look_ahead(i++, token); if(!t) break; else { ofs << std::setw(3); if(t < 128) ofs << t << " '" << static_cast(t) << "': "; else ofs << t << " : "; ofs.put('"'); while(token.length-- > 0) ofs.put(*token.ptr++); ofs << "\"\n"; } } } catch (std::exception const &e) { std::cerr << "Caught exception : " << e.what() << std::endl; } } synopsis-0.12/tests/Cxx/src/ConstEvaluator.cc0000664000076400007640000000627111104703267020641 0ustar stefanstefan#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Synopsis; class InitializerFinder : private SymbolLookup::Walker { public: InitializerFinder(SymbolLookup::Scope *global, std::ostream &os) : SymbolLookup::Walker(global), my_os(os) {} void find(PTree::Node *node) { node->accept(this);} private: virtual void visit(PTree::List *node) { for (PTree::Node *n = node; n; n = n->cdr()) if (n->car()) n->car()->accept(this); } virtual void visit(PTree::EnumSpec *node) { PTree::Node *body = third(node); long value = -1; for (PTree::Node *e = PTree::second(body); e; e = PTree::rest(rest(e))) { PTree::Node *enumerator = e->car(); if (enumerator->is_atom()) ++value; else // [identifier = initializer] { PTree::Node *initializer = PTree::third(enumerator); enumerator = enumerator->car(); if (!TypeAnalysis::evaluate_const(current_scope(), initializer, value)) { std::cerr << "Error in evaluating enum initializer :\n" << "Expression doesn't evaluate to a constant integral value" << std::endl; } } assert(enumerator->is_atom()); std::string name(enumerator->position(), enumerator->length()); my_os << "enumerator : " << name << ", " << "value : " << value << std::endl; } } virtual void visit(PTree::Declaration *node) { PTree::Node *type = PTree::second(node); type->accept(this); PTree::Node *rest = PTree::third(node); if (rest->is_atom()) return; // ';' for (; rest; rest = rest->cdr()) { PTree::Node *p = rest->car(); p->accept(this); } } virtual void visit(PTree::Declarator *node) { if (PTree::length(node) == 3) { PTree::Node *initializer = PTree::third(node); my_os << "initializer : " << PTree::reify(initializer) << std::endl; long value; if (TypeAnalysis::evaluate_const(current_scope(), initializer, value)) my_os << "value : " << value << std::endl; else my_os << "value : none" << std::endl; } } std::ostream &my_os; }; int main(int argc, char **argv) { if (argc < 3) { std::cerr << "Usage: " << argv[0] << " [-d] " << std::endl; exit(-1); } try { std::string output; std::string input; if (argv[1] == std::string("-d")) { Trace::enable(Trace::ALL); output = argv[2]; input = argv[3]; } else { output = argv[1]; input = argv[2]; } std::ofstream ofs(output.c_str()); std::ifstream ifs(input.c_str()); Buffer buffer(ifs.rdbuf(), input); Lexer lexer(&buffer); SymbolFactory symbols; Parser parser(lexer, symbols); PTree::Node *node = parser.parse(); InitializerFinder finder(symbols.current_scope(), ofs); finder.find(node); } catch (std::exception const &e) { std::cerr << "Caught exception : " << e.what() << std::endl; } } synopsis-0.12/tests/Cxx/src/Encoding.cc0000664000076400007640000000743011104703270017406 0ustar stefanstefan#include #include #include #include #include #include #include #include #include #include using namespace Synopsis; class EncodingFinder : public PTree::Visitor { public: EncodingFinder(std::ostream &os) : my_os(os) {} void find(PTree::Node *node) { node->accept(this);} private: virtual void visit(PTree::List *node) { if (node->car()) node->car()->accept(this); if (node->cdr()) node->cdr()->accept(this); } // virtual void visit(PTree::Typedef *node) // { // my_os << "Typedef : " << std::endl; // my_os << "type specifier : " << PTree::reify(PTree::second(node)) << std::endl; // my_os << "typedef name : " << PTree::reify(PTree::third(node)) << std::endl; // } virtual void visit(PTree::Name *node) { PTree::Encoding name = node->encoded_name(); my_os << "Name : " << name << ' ' << name.unmangled() << std::endl; PTree::Node *name_node = name.make_ptree(0); my_os << PTree::reify(name_node) << std::endl; } virtual void visit(PTree::ClassSpec *node) { PTree::Encoding name = node->encoded_name(); my_os << "ClassSpec : " << name << ' ' << name.unmangled() << std::endl; PTree::Node *name_node = name.make_ptree(0); my_os << PTree::reify(name_node) << std::endl; // Visit the body, if there is one. if(PTree::length(node) == 4) PTree::nth(node, 3)->accept(this); } virtual void visit(PTree::EnumSpec *node) { PTree::Encoding name = node->encoded_name(); my_os << "EnumSpec : " << name << ' ' << name.unmangled() << std::endl; PTree::Node *name_node = name.make_ptree(0); my_os << PTree::reify(name_node) << std::endl; } virtual void visit(PTree::Declaration *node) { my_os << "Declaration : " << std::endl; my_os << PTree::reify(node) << std::endl; PTree::second(node)->accept(this); PTree::Node *rest = PTree::third(node); if (rest->is_atom()) return; // ';' else if(PTree::is_a(rest, Token::ntDeclarator)) rest->accept(this); else for (; rest; rest = rest->cdr()) { PTree::Node *p = rest->car(); p->accept(this); } } virtual void visit(PTree::TemplateDecl *node) { my_os << "TemplateDecl : " << std::endl; my_os << PTree::reify(node) << std::endl; PTree::Node *decl = PTree::nth(node, 4); decl->accept(this); } virtual void visit(PTree::Declarator *node) { PTree::Encoding name = node->encoded_name(); my_os << "Declarator : " << name << ' ' << name.unmangled() << std::endl; PTree::Node *name_node = name.make_ptree(0); my_os << PTree::reify(name_node) << std::endl; PTree::Encoding type = node->encoded_type(); my_os << "type : " << type << ' ' << type.unmangled() << std::endl; PTree::Node *type_node = type.make_ptree(0); my_os << PTree::reify(type_node) << std::endl; } std::ostream &my_os; }; int main(int argc, char **argv) { if (argc < 3) { std::cerr << "Usage: " << argv[0] << " [-d] " << std::endl; exit(-1); } try { std::string output; std::string input; if (argv[1] == std::string("-d")) { Trace::enable(Trace::ALL); output = argv[2]; input = argv[3]; } else { output = argv[1]; input = argv[2]; } std::ofstream ofs(output.c_str()); std::ifstream ifs(input.c_str()); Buffer buffer(ifs.rdbuf(), input); Lexer lexer(&buffer); SymbolFactory symbols; Parser parser(lexer, symbols); EncodingFinder finder(ofs); PTree::Node *node = parser.parse(); finder.find(node); } catch (std::exception const &e) { std::cerr << "Caught exception : " << e.what() << std::endl; } } synopsis-0.12/tests/Cxx/ext.c0000664000076400007640000000014111122741532015521 0ustar stefanstefanint foo(float x) { __extension__ union { float f; int i; } u = { .f = x }; return u.i < 0; } synopsis-0.12/tests/Cxx/Parser/0000775000076400007640000000000011172123232016011 5ustar stefanstefansynopsis-0.12/tests/Cxx/Parser/input/0000775000076400007640000000000011172123233017151 5ustar stefanstefansynopsis-0.12/tests/Cxx/Parser/input/simple.cc0000664000076400007640000000006311104703270020750 0ustar stefanstefanint a; double b; struct {} c; void d(int, double); synopsis-0.12/tests/Cxx/Parser/bugs/0000775000076400007640000000000011172123233016752 5ustar stefanstefansynopsis-0.12/tests/Cxx/Parser/bugs/throw-spec-0.cc0000664000076400007640000000014511104703270021511 0ustar stefanstefan// built-in types as exceptions // confuse the parser in throw specifications foo() throw (int) { } synopsis-0.12/tests/Cxx/Parser/expected/0000775000076400007640000000000011172123233017613 5ustar stefanstefansynopsis-0.12/tests/Cxx/Parser/expected/simple.out0000664000076400007640000000031011104703270021627 0ustar stefanstefan[[nil [int] [#i@[1]a[a]] ;] [nil [double] [#d@[1]b[b]] ;] [nil [struct [nil nil] [{ nil }]] [#[5]`0000@[1]c[c]] ;] [nil [void] [#Fid_v@[1]d[d ( [[nil [int] #i[nil]] , [nil [double] #d[nil]]] )]] ;]] synopsis-0.12/tests/Cxx/Makefile.in0000664000076400007640000000232611104703270016626 0ustar stefanstefan# # Copyright (C) 2005 Stefan Seefeld # All rights reserved. # Licensed to the public under the terms of the GNU LGPL (>= 2), # see the file COPYING for details. # SHELL := /bin/sh srcdir := @srcdir@ builddir:= @builddir@ CXX := @CXX@ MAKEDEP := $(CXX) -M CPPFLAGS:= @CPPFLAGS@ CPPFLAGS+= -I $(builddir)/../../src/ -I $(srcdir)/../../src/ CXXFLAGS:= @CXXFLAGS@ LDFLAGS := @LDFLAGS@ LIBS := -L$(builddir)/../../src/lib -lSynopsis @LIBS@ TESTS := Lexer Encoding Parser ConstEvaluator SymbolLookup TypeAnalysis SRC := $(patsubst %, src/%.cc, $(TESTS)) OBJ := $(patsubst %.cc, %.o, $(SRC)) DEP := $(patsubst %.cc, %.d, $(SRC)) TARGETS := $(patsubst src/%.cc, bin/%, $(SRC)) vpath %.cc $(srcdir) all: $(TARGETS) $(TESTS): %: bin/% $(TARGETS): bin/%: src/%.o $(CXX) $(LDFLAGS) -o $@ $^ $(LIBS) %.d: %.cc @echo generating dependencies for $(@D)/$( $@' %.o: %.cc @echo compiling $(@D)/$(@F) $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< Makefile: $(srcdir)/Makefile.in (cd .. && ./config.status --file OpenCxx/Makefile) clean : rm -f bin/* src/*.o src/*.d ifeq (,$(filter $(MAKECMDGOALS), depend clean distclean)) -include $(DEP) endif synopsis-0.12/tests/Cxx/Encoding/0000775000076400007640000000000011172123232016303 5ustar stefanstefansynopsis-0.12/tests/Cxx/Encoding/input/0000775000076400007640000000000011172123233017443 5ustar stefanstefansynopsis-0.12/tests/Cxx/Encoding/input/simple.cc0000664000076400007640000000010211104703270021234 0ustar stefanstefanint a; double b; struct {} c; void d(int, double); typedef int e; synopsis-0.12/tests/Cxx/Encoding/expected/0000775000076400007640000000000011172123233020105 5ustar stefanstefansynopsis-0.12/tests/Cxx/Encoding/expected/simple.out0000664000076400007640000000061511104703270022131 0ustar stefanstefanDeclaration : int a ; Declarator : [1]a a a type : i int Declaration : double b ; Declarator : [1]b b b type : d double Declaration : struct { } c ; ClassSpec : [5]`0000 `0000 `0000 Declarator : [1]c c c type : [5]`0000 `0000 `0000 Declaration : void d ( int , double ) ; Declarator : [1]d d d type : Fid_v void(*)(int,double) Declarator : [1]e e e type : i int synopsis-0.12/tests/Parsers/0000775000076400007640000000000011172123232015432 5ustar stefanstefansynopsis-0.12/tests/Parsers/C/0000775000076400007640000000000011172123233015615 5ustar stefanstefansynopsis-0.12/tests/Parsers/C/input/0000775000076400007640000000000011172123233016754 5ustar stefanstefansynopsis-0.12/tests/Parsers/C/input/simple.c0000664000076400007640000000005011104703267020412 0ustar stefanstefanvoid foo(); struct bar { int baz; }; synopsis-0.12/tests/Parsers/C/synopsis.py.in0000664000076400007640000000053411104703267020473 0ustar stefanstefanfrom Synopsis.process import process from Synopsis.Processor import Composite from Synopsis.Parsers import Cpp from Synopsis.Parsers import C from Synopsis.Formatters import Dump import os process(parse = Composite(C.Parser(base_path = '@abs_top_srcdir@' + os.sep), Dump.Formatter(show_ids = False, stylesheet = None))) synopsis-0.12/tests/Parsers/Cpp/0000775000076400007640000000000011172123233016155 5ustar stefanstefansynopsis-0.12/tests/Parsers/Cpp/input/0000775000076400007640000000000011172123233017314 5ustar stefanstefansynopsis-0.12/tests/Parsers/Cpp/input/include.cc0000664000076400007640000000004011104703267021246 0ustar stefanstefan#include "../include/header.hh" synopsis-0.12/tests/Parsers/Cpp/input/macros.cc0000664000076400007640000000036311104703267021117 0ustar stefanstefanint x; #define LONGER 12345678 #define SHORTER 1234 #define LINKINSIDE x #define ARGS(a, b, c) x int A = LONGER, A2 = x; int B = SHORTER, B2 = x; int C = LINKINSIDE, C2 = x; int D = ARGS(1, 2, 3), D2 = x; int D = ARGS(LONGER, 2, 3), D2 = x; synopsis-0.12/tests/Parsers/Cpp/synopsis.py.in0000664000076400007640000000066611104703267021041 0ustar stefanstefanfrom Synopsis.process import process from Synopsis.Processor import Composite from Synopsis.Parsers import Cpp from Synopsis.Formatters import Dump import os process(parse = Composite(Cpp.Parser(language = 'C++', base_path = '@abs_top_srcdir@' + os.sep, primary_file_only = False), Dump.Formatter(show_ids = False, stylesheet = None))) synopsis-0.12/tests/Parsers/Cpp/expected/0000775000076400007640000000000011172123233017756 5ustar stefanstefansynopsis-0.12/tests/Parsers/Cpp/expected/macros.xml0000664000076400007640000000462311104703267021777 0ustar stefanstefan a b c 8 9 10 11 12 synopsis-0.12/tests/Parsers/Cpp/expected/include.xml0000664000076400007640000000316111104703267022132 0ustar stefanstefan synopsis-0.12/tests/Parsers/Cpp/include/0000775000076400007640000000000011172123233017600 5ustar stefanstefansynopsis-0.12/tests/Parsers/Cpp/include/header2.hh0000664000076400007640000000010211104703267021432 0ustar stefanstefan#ifndef _header2_hh #define _header2_hh typedef int Int; #endif synopsis-0.12/tests/Parsers/Cpp/include/header.hh0000664000076400007640000000010511104703267021353 0ustar stefanstefan#ifndef _header_hh #define _header_hh #include "header2.hh" #endif synopsis-0.12/tests/Parsers/Cxx/0000775000076400007640000000000011172123233016175 5ustar stefanstefansynopsis-0.12/tests/Parsers/Cxx/input/0000775000076400007640000000000011172123233017334 5ustar stefanstefansynopsis-0.12/tests/Parsers/Cxx/input/groups.cc0000664000076400007640000000061111104703266021165 0ustar stefanstefan// group documentation // @group first group { // some comment // extending over multiple lines // another comment struct foo { }; int test1; int test2; // } int bar; // another group // @group tests { int test3; int test4; // } // @group outer { // @group inner { int f; // @group xxx { not a group int test5; // } and not a group end // } // and not a group either int test6; // } // } synopsis-0.12/tests/Parsers/Cxx/input/macro.cc0000664000076400007640000000031711104703266020752 0ustar stefanstefanint x; #define LONGER 12345678 #define SHORTER 1234 #define LINKINSIDE x #define ARGS(a, b, c) x int A = LONGER, A2 = x; int B = SHORTER, B2 = x; int C = LINKINSIDE, C2 = x; int D = ARGS(1, 2, 3), D2 = x; synopsis-0.12/tests/Parsers/Cxx/input/for.cc0000664000076400007640000000012611104703266020435 0ustar stefanstefanvoid func() { int x; for (int x = 3, y = 10; x < y; ++x) { cout << x; } } synopsis-0.12/tests/Parsers/Cxx/input/koenig.cc0000664000076400007640000000022511104703266021123 0ustar stefanstefannamespace NS { struct A {}; int operator +(A, A); }; void func(int); void func(NS::A) { NS::A x, y; func(x + y); // should call func(int) } synopsis-0.12/tests/Parsers/Cxx/input/template.cc0000664000076400007640000000077611104703266021475 0ustar stefanstefanstruct Object { float f; double func(); Object(); Object(const Object&); Object& operator = (const Object&); }; template class list { T* m_array; int m_size; public: list(); list(T*); T& operator [] (int index) { return m_array[index]; } int size() { return m_size; } void replace(int index, const T& with) { m_array[index] = with; } }; void main() { list a_list; a_list.replace(1, Object()); Object b(a_list[1]); a_list[2].func(); b = a_list[3]; } synopsis-0.12/tests/Parsers/Cxx/input/const.cc0000664000076400007640000000010411104703266020771 0ustar stefanstefanstruct Foo { void foo(int param); void foo(int param) const; }; synopsis-0.12/tests/Parsers/Cxx/input/using3.cc0000664000076400007640000000061711104703266021064 0ustar stefanstefan// From C++WD'96 7.4.3.3 Example 2 namespace A { int i; } namespace B { int i; int j; namespace C { namespace D { using namespace A; int j; int k; int a = i; // B::i hides A::i } using namespace D; int k = 89; // no problem yet int l = k; // ambiguous: C::k or D::k int m = i; // B::i hides A::i int n = j; // D::j hides B::j } } synopsis-0.12/tests/Parsers/Cxx/input/using.cc0000664000076400007640000000027611104703266021002 0ustar stefanstefannamespace Foo { int x; } void func() { using namespace Foo; x; } void func2() { namespace Bar = Foo; Bar::x; } void func3() { Foo::x; } void func4() { using Foo::x; x; } synopsis-0.12/tests/Parsers/Cxx/input/operator.cc0000664000076400007640000000036511104703266021507 0ustar stefanstefanstruct A {}; struct B {}; A operator +(const B&, const B&); int operator +(const A&, const A&); void func(A); void func(B); void func(int); void main() { B x, y; func( (x + y) + (x + y) ); // should call func(int), test func = "func(int)" } synopsis-0.12/tests/Parsers/Cxx/input/comment_proximity.cc0000664000076400007640000000063011104703266023435 0ustar stefanstefan// Comment at start int test1; // Test2: This should have a comment, unlike test1 // It should also have two lines int test2; /* A comment by itself * Over multiple lines. */ int test3; /* This comment should be ignored. */ /* Test4: Should have a comment * */ int test4; /* Test5: This should have a comment, unlike test 3 * Which had a gap. */ int test5; //< This should still be tail-appended! synopsis-0.12/tests/Parsers/Cxx/input/template_spec.cc0000664000076400007640000000035711104703266022502 0ustar stefanstefan// Test template specializations template class list { public: list(T*, int size); }; template <> class list { public: list(void*, int size) {} }; template <> class list { public: list(int*, int size) {} }; synopsis-0.12/tests/Parsers/Cxx/input/template_spec2.cc0000664000076400007640000000053611104703266022563 0ustar stefanstefan// Test template specializations #2 template class list { public: list(T*, int size); int size() { return I; } }; template class list { public: list(void*, int size) {} int size() { return 0; } }; template class list { public: list(int*, int size) {} int size() { return I; } }; synopsis-0.12/tests/Parsers/Cxx/input/condition.cc0000664000076400007640000000116311104703266021637 0ustar stefanstefan// Tests the ability to use a declaration in the condition of an if or switch struct X { operator bool() const {return true;} struct Y { operator bool() const {return true;} }; }; void foo() { int _i; X _x; X::Y _y; if (int i = 3) {} if (const int i = 3) {} if (const int* i = &_i) {} if (int* const i = &_i) {} if (X foo = _x) {} if (const X foo = _x) {} if (const X* foo = &_x) {} if (X* const foo = &_x) {} if (X::Y foo = _y) {} if (const X::Y foo = _y) {} if (const X::Y* foo = &_y) {} if (X::Y* const foo = &_y) {} switch (int i = 3) {} switch (const int i = 3) {} } synopsis-0.12/tests/Parsers/Cxx/input/func_template.cc0000664000076400007640000000073411104703266022502 0ustar stefanstefan// Test function templates // Test template arg template int func1(A a) { return 0; }; // Test template return template A func2(int i) { return 0; }; // Test template arg and return template A func2(A a) { return 0; }; // Test template arg and return w/ different types template B func2(A a) { return 0; }; // Test template arg and return w/ different types. Function declaration template B func2(A a); synopsis-0.12/tests/Parsers/Cxx/input/comments.cc0000664000076400007640000000030311104703266021471 0ustar stefanstefan// 1. Comments Test: One line cpp test // 2. Two line cpp test // Second line of test /* 3. One line c test */ /* 4. Another c test */ /* 5. Two on one */ /* 6. line */ /* 7. Multi * line */ synopsis-0.12/tests/Parsers/Cxx/input/std.cc0000664000076400007640000000011211104703266020434 0ustar stefanstefan#include namespace Foo { void func(std::vector array); } synopsis-0.12/tests/Parsers/Cxx/input/stdarg.cc0000664000076400007640000000022711104703266021135 0ustar stefanstefan#include void function(char *s, ...) { va_list args; va_start(args, s); for(;;) char *p = va_arg(args, char *); va_end(args); } synopsis-0.12/tests/Parsers/Cxx/input/forward_class.cc0000664000076400007640000000067011104703266022504 0ustar stefanstefanclass X { public: void f(int); int a; }; class Y; int X::* pmi = &X::a; void (X::* pmf)(int) = &X::f; double X::* pmd; char Y::* pmc; X obj; X* pobj; void foo() { obj.*pmi = 7; // assign 7 to an integer // member of obj (obj.*pmf)(7); // call a function member of obj // with the argument 7 pobj->*pmi = 7; // assign 7 to an integer (pobj->*pmf)(7); // call a function member of obj } synopsis-0.12/tests/Parsers/Cxx/input/groups2.cc0000664000076400007640000000114611104703266021253 0ustar stefanstefan// group documentation // @group first group { some comment // continued and // extending over multiple lines // another comment struct foo { private: // helper functions // blabla // // @group make_fn { // bla. // blabla int make_fn() {} // bla. // blabla int make_fn(int) {} // } // @group } is this lost ? }; int test1; int test2; // @group } int bar; // another group // @group tests { int test3; int test4; // @group } // @group outer { // @group inner { int f; // @group xxx { not a group int test5; // @group } this is accepted // @group } // and this too int test6; // @group } synopsis-0.12/tests/Parsers/Cxx/input/func_ptr.cc0000664000076400007640000000057411104703266021476 0ustar stefanstefan// Tests function pointers typedef void PyObject; // A function which takes a func ptr as a parameter void insert(void* (*convert)(PyObject*), bool yesno); // A function which takes a func ptr as a parameter void insert(void* (*convert)(PyObject*, int), bool yesno); // A function which returns a func ptr void* (*insert2(int))(PyObject*); int main() { (void)insert2(1); } synopsis-0.12/tests/Parsers/Cxx/input/using4.cc0000664000076400007640000000074311104703266021065 0ustar stefanstefan// From C++WD'96 7.4.3.6 Example namespace D { int d1; void f(char); } using namespace D; int d1; // ok, no conflict with D::d1 namespace E { int e; void f(int); } namespace D // namespace extension { int d2; using namespace E; void f(int); } void f() { d1++; // error: ambiguous: ::d1 or D::d1 ::d1++; // ok D::d1++; // ok d2++; // ok D::d2 e++; // ok E::e f(1); // error: ambiguous: D::f(int) or E::f(int) f('a'); // ok: D::f(char) } synopsis-0.12/tests/Parsers/Cxx/input/func.cc0000664000076400007640000000022111104703266020576 0ustar stefanstefanvoid func(char); void func(int); void func(double); void func(const char*); void test() { func('c'); func(123); func(1.2); func("s"); } synopsis-0.12/tests/Parsers/Cxx/input/typename.cc0000664000076400007640000000052411104703266021473 0ustar stefanstefantemplate ::fast TruncPoly> class crc_optimal { // Implementation type typedef detail::mask_uint_t masking_type; public: // Type typedef typename masking_type::fast value_type; // Constants for the template parameters static const std::size_t bit_count = Bits; }; synopsis-0.12/tests/Parsers/Cxx/input/func_template_arg.cc0000664000076400007640000000061311104703266023327 0ustar stefanstefan// Test function pointers as template arguments template struct function { }; // Test template class with function argument // (not really a template function) template struct function { }; // Test return type fptr template struct function { }; // Test return type fptr template struct function { }; synopsis-0.12/tests/Parsers/Cxx/input/using2.cc0000664000076400007640000000067611104703266021070 0ustar stefanstefan// From C++WD'96 7.4.3.2 Example namespace A { int i; namespace B { namespace C { int i; } using namespace A::B::C; void f1() { i = 5; // C::i hides A::i } } namespace D { using namespace B; using namespace C; void f2() { i = 5; // ambiguous, B::C::i or A::i } } void f3() { i = 5; // uses A::i } } void f4() { i = 5; // ill-formed, neither i visible } synopsis-0.12/tests/Parsers/Cxx/input/try.cc0000664000076400007640000000024011104703266020462 0ustar stefanstefanvoid func() { try { cout << bar; } catch (string foo) { cout << "Error: " << foo << endl; } catch (...) { cout << "Catchall"; } } synopsis-0.12/tests/Parsers/Cxx/input/cast.cc0000664000076400007640000000011011104703266020572 0ustar stefanstefantypedef int Foo; void func() { (Foo)1; (Foo*)1; (const Foo&)1; } synopsis-0.12/tests/Parsers/Cxx/input/if.cc0000664000076400007640000000050411104703266020245 0ustar stefanstefan// If test void func() { int x = 0; if (x) cout << "Hi"; // test x = "`func()::x" if (x == 2) cout << "hi"; // test x = "`func()::x" if (!x) cout << "foo"; // test x = "`func()::x" if (x) cout << "one"; else cout << "two"; if (x) {cout << "one"; cout << "two"; } else { cout<<"three"; } } synopsis-0.12/tests/Parsers/Cxx/synopsis.py.in0000664000076400007640000000047711104703266021060 0ustar stefanstefanfrom Synopsis.process import process from Synopsis.Processor import Composite from Synopsis.Parsers import Cxx from Synopsis.Formatters import Dump import os process(parse = Composite(Cxx.Parser(base_path = '@abs_top_srcdir@' + os.sep), Dump.Formatter(show_ids = False, stylesheet = None))) synopsis-0.12/tests/Parsers/Cxx/expected/0000775000076400007640000000000011172123233017776 5ustar stefanstefansynopsis-0.12/tests/Parsers/Cxx/expected/groups.xml0000664000076400007640000001312511104703267022047 0ustar stefanstefan // group documentation // @group first group { // some comment // extending over multiple lines // another comment // } // another group // @group tests { // } // @group outer { // @group inner { // @group xxx { not a group // } and not a group end // } // and not a group either // } // } synopsis-0.12/tests/Parsers/Cxx/expected/func_ptr.xml0000664000076400007640000001216011104703267022346 0ustar stefanstefan // Tests function pointers // A function which takes a func ptr as a parameter * * * // A function which takes a func ptr as a parameter * * * // A function which returns a func ptr * * * synopsis-0.12/tests/Parsers/Cxx/expected/koenig.xml0000664000076400007640000000561111104703267022005 0ustar stefanstefan synopsis-0.12/tests/Parsers/Cxx/expected/if.xml0000664000076400007640000000152611104703267021130 0ustar stefanstefan // If test synopsis-0.12/tests/Parsers/Cxx/expected/func_template_arg.xml0000664000076400007640000001237611104703267024216 0ustar stefanstefan // Test function pointers as template arguments // Test template class with function argument // (not really a template function) // Test return type fptr // Test return type fptr synopsis-0.12/tests/Parsers/Cxx/expected/try.xml0000664000076400007640000000124011104703267021341 0ustar stefanstefan synopsis-0.12/tests/Parsers/Cxx/expected/func.xml0000664000076400007640000000552411104703267021467 0ustar stefanstefan * const synopsis-0.12/tests/Parsers/Cxx/expected/forward_class.xml0000664000076400007640000001077311104703267023367 0ustar stefanstefan X::* X::* X::* Y::* * synopsis-0.12/tests/Parsers/Cxx/expected/for.xml0000664000076400007640000000124011104703267021311 0ustar stefanstefan synopsis-0.12/tests/Parsers/Cxx/expected/using.xml0000664000076400007640000000473311104703267021662 0ustar stefanstefan synopsis-0.12/tests/Parsers/Cxx/expected/comment_proximity.xml0000664000076400007640000000737211104703267024325 0ustar stefanstefan // Comment at start // Test2: This should have a comment, unlike test1 // It should also have two lines /* A comment by itself * Over multiple lines. */ /* This comment should be ignored. */ /* Test4: Should have a comment * */ /* Test5: This should have a comment, unlike test 3 * Which had a gap. */ //< This should still be tail-appended! synopsis-0.12/tests/Parsers/Cxx/expected/func_template.xml0000664000076400007640000001430711104703267023361 0ustar stefanstefan // Test function templates // Test template arg // Test template return // Test template arg and return // Test template arg and return w/ different types // Test template arg and return w/ different types. Function declaration synopsis-0.12/tests/Parsers/Cxx/expected/cast.xml0000664000076400007640000000232011104703267021455 0ustar stefanstefan comments comments synopsis-0.12/tests/Parsers/Cxx/expected/template_spec.xml0000664000076400007640000001214711104703267023360 0ustar stefanstefan // Test template specializations * * * synopsis-0.12/tests/Parsers/Cxx/expected/typename.xml0000664000076400007640000000761411104703267022360 0ustar stefanstefan // Implementation type detail mask_uint_t // Type masking_type fast // Constants for the template parameters std size_t const synopsis-0.12/tests/Parsers/Cxx/expected/template.xml0000664000076400007640000002067611104703267022354 0ustar stefanstefan & const & const & * * & & const synopsis-0.12/tests/Parsers/Cxx/expected/std.xml0000664000076400007640000013252611104703267021331 0ustar stefanstefan /usr/include/c++/3.2.2/cstring // Get rid of those macros defined in <string.h> in lieu of real functions. /usr/include/c++/3.2.2/cstdlib // Get rid of those macros defined in <stdlib.h> in lieu of real functions. /usr/include/c++/3.2.2/exception // Exception Handling support header for -*- C++ -*- /usr/include/c++/3.2.2/exception // Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002 // Free Software Foundation // // This file is part of GNU CC. // // GNU CC is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) // any later version. // // GNU CC is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with GNU CC; see the file COPYING. If not, write to // the Free Software Foundation, 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. /usr/include/c++/3.2.2/exception // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. /usr/include/c++/3.2.2/exception /** @file exception * This header defines several types and functions relating to the * handling of exceptions in a C++ program. */ /usr/include/c++/3.2.2/bits/stringfwd.h // String support -*- C++ -*- /usr/include/c++/3.2.2/bits/stringfwd.h // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. /usr/include/c++/3.2.2/bits/stringfwd.h // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. /usr/include/c++/3.2.2/bits/stringfwd.h // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. /usr/include/c++/3.2.2/bits/stringfwd.h // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. /usr/include/c++/3.2.2/bits/stringfwd.h // // ISO C++ 14882: 21 Strings library // /usr/include/c++/3.2.2/bits/stringfwd.h /** @file stringfwd.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ /usr/include/c++/3.2.2/cstdio // Get rid of those macros defined in <stdio.h> in lieu of real functions. /usr/include/c++/3.2.2/ctime // -*- C++ -*- forwarding header. /usr/include/c++/3.2.2/ctime // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. /usr/include/c++/3.2.2/ctime // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. /usr/include/c++/3.2.2/ctime // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. /usr/include/c++/3.2.2/ctime // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. /usr/include/c++/3.2.2/ctime // // ISO C++ 14882: 20.5 Date and time // /usr/include/c++/3.2.2/ctime /** @file ctime * This is a Standard C++ Library file. You should @c #include this file * in your programs, rather than any of the "*.h" implementation files. * * This is the C++ version of the Standard C Library header @c time.h, * and its contents are (mostly) the same as that header, but are all * contained in the namespace @c std. */ /usr/include/c++/3.2.2/ctime // Get rid of those macros defined in <time.h> in lieu of real functions. /usr/include/c++/3.2.2/cwchar // Need to do a bit of trickery here with mbstate_t as char_traits // assumes it is in wchar.h, regardless of wchar_t specializations. /usr/include/c++/3.2.2/cwchar // Get rid of those macros defined in <wchar.h> in lieu of real functions. /usr/include/c++/3.2.2/bits/stl_pair.h // Pair implementation -*- C++ -*- /usr/include/c++/3.2.2/bits/stl_pair.h // Copyright (C) 2001 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. /usr/include/c++/3.2.2/bits/stl_pair.h // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. /usr/include/c++/3.2.2/bits/stl_pair.h // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. /usr/include/c++/3.2.2/bits/stl_pair.h // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. /usr/include/c++/3.2.2/bits/stl_pair.h /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /usr/include/c++/3.2.2/bits/stl_pair.h /** @file stl_pair.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h // Types used in iterator implementation -*- C++ -*- /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996-1998 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h /** @file stl_iterator_base_types.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. * * This file contains all of the general iterator-related utility types, * such as iterator_traits and struct iterator. */ /usr/include/c++/3.2.2/bits/stl_iterator_base_funcs.h // Since this entire file is within namespace std, there's no reason to // waste two spaces along the left column. Thus the leading indentation is // slightly violated from here on. /usr/include/c++/3.2.2/bits/stl_iterator.h // Iterators -*- C++ -*- /usr/include/c++/3.2.2/bits/stl_iterator.h // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. /usr/include/c++/3.2.2/bits/stl_iterator.h // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. /usr/include/c++/3.2.2/bits/stl_iterator.h // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. /usr/include/c++/3.2.2/bits/stl_iterator.h // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. /usr/include/c++/3.2.2/bits/stl_iterator.h /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996-1998 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /usr/include/c++/3.2.2/bits/stl_iterator.h /** @file stl_iterator.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. * * This file implements reverse_iterator, back_insert_iterator, * front_insert_iterator, insert_iterator, __normal_iterator, and their * supporting functions and overloaded operators. */ /usr/include/c++/3.2.2/bits/stl_threads.h // Threading support -*- C++ -*- /usr/include/c++/3.2.2/bits/stl_threads.h // Copyright (C) 2001 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. /usr/include/c++/3.2.2/bits/stl_threads.h // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. /usr/include/c++/3.2.2/bits/stl_threads.h // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. /usr/include/c++/3.2.2/bits/stl_threads.h // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. /usr/include/c++/3.2.2/bits/stl_threads.h /* * Copyright (c) 1997-1999 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /usr/include/c++/3.2.2/bits/stl_threads.h /** @file stl_threads.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ /usr/include/c++/3.2.2/bits/stl_threads.h // The only supported threading model is GCC's own gthr.h abstraction layer. /usr/include/c++/3.2.2/bits/stl_construct.h // nonstandard construct and destroy functions -*- C++ -*- /usr/include/c++/3.2.2/bits/stl_construct.h // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. /usr/include/c++/3.2.2/bits/stl_construct.h // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. /usr/include/c++/3.2.2/bits/stl_construct.h // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. /usr/include/c++/3.2.2/bits/stl_construct.h // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. /usr/include/c++/3.2.2/bits/stl_construct.h /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /usr/include/c++/3.2.2/bits/stl_construct.h /** @file stl_construct.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ /usr/include/c++/3.2.2/bits/stl_uninitialized.h // Raw memory manipulators -*- C++ -*- /usr/include/c++/3.2.2/bits/stl_uninitialized.h // Copyright (C) 2001 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. /usr/include/c++/3.2.2/bits/stl_uninitialized.h // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. /usr/include/c++/3.2.2/bits/stl_uninitialized.h // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. /usr/include/c++/3.2.2/bits/stl_uninitialized.h // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. /usr/include/c++/3.2.2/bits/stl_uninitialized.h /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996,1997 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /usr/include/c++/3.2.2/bits/stl_uninitialized.h /** @file stl_uninitialized.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ /usr/include/c++/3.2.2/bits/stl_bvector.h // bit_vector and vector<bool> specialization -*- C++ -*- /usr/include/c++/3.2.2/bits/stl_bvector.h // Copyright (C) 2001, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute 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. /usr/include/c++/3.2.2/bits/stl_bvector.h // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. /usr/include/c++/3.2.2/bits/stl_bvector.h // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. /usr/include/c++/3.2.2/bits/stl_bvector.h // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. /usr/include/c++/3.2.2/bits/stl_bvector.h /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996-1999 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /usr/include/c++/3.2.2/bits/stl_bvector.h /** @file stl_bvector.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ /usr/include/c++/3.2.2/bits/stl_bvector.h // namespace std /usr/include/c++/3.2.2/bits/stl_bvector.h // Declare a partial specialization of vector<T, Alloc>. /usr/include/c++/3.2.2/exception // namespace std /usr/include/c++/3.2.2/bits/type_traits.h // Forward declaration hack, should really include this from somewhere. /usr/include/c++/3.2.2/bits/stl_iterator.h // namespace std __gnu_cxx std /usr/include/c++/3.2.2/bits/stl_iterator_base_funcs.h /usr/include/c++/3.2.2/i386-redhat-linux/bits/c++config.h /usr/include/c++/3.2.2/cstddef /usr/include/c++/3.2.2/bits/fpos.h /usr/include/c++/3.2.2/bits/stl_alloc.h /usr/include/bits/sigthread.h /usr/include/xlocale.h /usr/include/c++/3.2.2/bits/stl_bvector.h /usr/include/bits/sigset.h /usr/include/bits/xopen_lim.h /usr/include/bits/local_lim.h /usr/include/c++/3.2.2/exception /usr/include/sys/sysmacros.h /usr/include/c++/3.2.2/iosfwd /usr/include/_G_config.h /usr/include/c++/3.2.2/bits/stl_threads.h /usr/include/c++/3.2.2/bits/stl_construct.h /usr/include/signal.h /usr/include/sys/cdefs.h /usr/include/c++/3.2.2/i386-redhat-linux/bits/gthr-default.h /usr/include/c++/3.2.2/bits/stl_uninitialized.h /usr/include/c++/3.2.2/new /usr/include/bits/posix2_lim.h /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stddef.h /usr/include/string.h /usr/include/c++/3.2.2/i386-redhat-linux/bits/atomicity.h /usr/include/stdlib.h /usr/include/c++/3.2.2/cstdlib /usr/include/c++/3.2.2/i386-redhat-linux/bits/c++io.h /usr/include/gnu/stubs.h /usr/include/c++/3.2.2/bits/functexcept.h /usr/include/bits/waitflags.h /usr/include/c++/3.2.2/i386-redhat-linux/bits/gthr.h /usr/include/bits/waitstatus.h /usr/include/bits/endian.h /usr/include/limits.h /usr/include/c++/3.2.2/bits/stl_vector.h /usr/include/c++/3.2.2/bits/stringfwd.h /usr/include/bits/posix1_lim.h /usr/include/bits/typesizes.h /usr/include/bits/sched.h /usr/include/pthread.h /usr/include/c++/3.2.2/bits/stl_iterator.h /usr/include/wchar.h /usr/include/c++/3.2.2/climits /usr/include/libio.h /usr/include/c++/3.2.2/bits/stl_algobase.h /usr/include/bits/wchar.h /usr/include/features.h /usr/include/bits/sys_errlist.h /usr/include/bits/pthreadtypes.h /usr/include/c++/3.2.2/exception_defines.h /usr/include/bits/select.h /usr/include/alloca.h /usr/include/c++/3.2.2/ctime /usr/include/bits/types.h /usr/include/c++/3.2.2/cwchar /usr/include/c++/3.2.2/cassert /usr/include/bits/stdio_lim.h /usr/include/bits/initspin.h /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stdarg.h Parsers/Cxx/input/std.cc /usr/include/bits/time.h /usr/include/time.h /usr/include/linux/limits.h /usr/include/assert.h /usr/include/c++/3.2.2/i386-redhat-linux/bits/os_defines.h /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/limits.h /usr/include/gconv.h /usr/include/sys/types.h /usr/include/c++/3.2.2/bits/type_traits.h /usr/include/c++/3.2.2/bits/concept_check.h /usr/include/endian.h /usr/include/sched.h /usr/include/bits/wordsize.h /usr/include/c++/3.2.2/vector /usr/include/sys/select.h /usr/include/c++/3.2.2/cstdio /usr/include/c++/3.2.2/bits/stl_iterator_base_types.h /usr/include/c++/3.2.2/bits/stl_pair.h /usr/include/c++/3.2.2/cstring /usr/include/stdio.h /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/syslimits.h synopsis-0.12/tests/Parsers/Cxx/expected/condition.xml0000664000076400007640000000523411104703267022520 0ustar stefanstefan // Tests the ability to use a declaration in the condition of an if or switch synopsis-0.12/tests/Parsers/Cxx/expected/groups2.xml0000664000076400007640000001650611104703267022137 0ustar stefanstefan // group documentation // @group first group { some comment // continued and // extending over multiple lines // another comment // helper functions // blabla // // @group make_fn { // bla. // blabla // bla. // blabla // } // @group } is this lost ? // @group } // another group // @group tests { // @group } // @group outer { // @group inner { // @group xxx { not a group // @group } this is accepted // @group } // and this too // @group } synopsis-0.12/tests/Parsers/Cxx/expected/using2.xml0000664000076400007640000001055111104703267021737 0ustar stefanstefan // From C++WD'96 7.4.3.2 Example synopsis-0.12/tests/Parsers/Cxx/expected/using3.xml0000664000076400007640000001521711104703267021744 0ustar stefanstefan // From C++WD'96 7.4.3.3 Example 2 // B::i hides A::i // no problem yet // ambiguous: C::k or D::k // B::i hides A::i // D::j hides B::j synopsis-0.12/tests/Parsers/Cxx/expected/macro.xml0000664000076400007640000001111111104703267021622 0ustar stefanstefan a b c 8 9 10 11 synopsis-0.12/tests/Parsers/Cxx/expected/operator.xml0000664000076400007640000001201511104703267022360 0ustar stefanstefan & const & const & const & const synopsis-0.12/tests/Parsers/Cxx/expected/comments.xml0000664000076400007640000000343711104703267022362 0ustar stefanstefan // 1. Comments Test: One line cpp test // 2. Two line cpp test // Second line of test /* 3. One line c test */ /* 4. Another c test */ /* 5. Two on one */ /* 6. line */ /* 7. Multi * line */ synopsis-0.12/tests/Parsers/Cxx/expected/template_spec2.xml0000664000076400007640000001526111104703267023442 0ustar stefanstefan // Test template specializations #2 * * * synopsis-0.12/tests/Parsers/Cxx/expected/using4.xml0000664000076400007640000001177611104703267021753 0ustar stefanstefan // From C++WD'96 7.4.3.6 Example // namespace extension // ok, no conflict with D::d1 synopsis-0.12/tests/Parsers/Cxx/expected/const.xml0000664000076400007640000000373411104703267021663 0ustar stefanstefan const synopsis-0.12/tests/Parsers/Python/0000775000076400007640000000000011172123233016714 5ustar stefanstefansynopsis-0.12/tests/Parsers/Python/input/0000775000076400007640000000000011172123233020053 5ustar stefanstefansynopsis-0.12/tests/Parsers/Python/input/class.py0000664000076400007640000000023311104703267021536 0ustar stefanstefan"""module documentation""" class Class(object): """class documentation""" def method(self): """method documentation""" pass synopsis-0.12/tests/Parsers/Python/synopsis.py.in0000664000076400007640000000050511104703267021570 0ustar stefanstefanfrom Synopsis.process import process from Synopsis.Processor import Composite from Synopsis.Parsers import Python from Synopsis.Formatters import Dump import os process(parse = Composite(Python.Parser(base_path = '@abs_top_srcdir@' + os.sep), Dump.Formatter(show_ids = False, stylesheet = None))) synopsis-0.12/tests/Parsers/Python/expected/0000775000076400007640000000000011172123233020515 5ustar stefanstefansynopsis-0.12/tests/Parsers/Python/expected/class.xml0000664000076400007640000000743711104703267022365 0ustar stefanstefan module documentation Parsers Python input class object class documentation method documentation synopsis-0.12/tests/Parsers/IDL/0000775000076400007640000000000011172123233016043 5ustar stefanstefansynopsis-0.12/tests/Parsers/IDL/input/0000775000076400007640000000000011172123233017202 5ustar stefanstefansynopsis-0.12/tests/Parsers/IDL/input/CosLifeCycle.idl0000664000076400007640000000257111104703266022212 0ustar stefanstefan#ifndef _COS_LIFE_CYCLE_IDL_ #define _COS_LIFE_CYCLE_IDL_ #include #pragma prefix "omg.org" module CosLifeCycle{ typedef CosNaming::Name Key; typedef Object _Factory; typedef sequence <_Factory> Factories; typedef struct NVP { CosNaming::Istring name; any value; } NameValuePair; typedef sequence Criteria; exception NoFactory { Key search_key; }; exception NotCopyable { string reason; }; exception NotMovable { string reason; }; exception NotRemovable { string reason; }; exception InvalidCriteria{ Criteria invalid_criteria; }; exception CannotMeetCriteria { Criteria unmet_criteria; }; interface FactoryFinder { Factories find_factories(in Key factory_key) raises(NoFactory); }; interface LifeCycleObject { LifeCycleObject copy(in FactoryFinder there, in Criteria the_criteria) raises(NoFactory, NotCopyable, InvalidCriteria, CannotMeetCriteria); void move(in FactoryFinder there, in Criteria the_criteria) raises(NoFactory, NotMovable, InvalidCriteria, CannotMeetCriteria); void remove() raises(NotRemovable); }; interface GenericFactory { boolean _supports(in Key k); Object create_object( in Key k, in Criteria the_criteria) raises (NoFactory, InvalidCriteria, CannotMeetCriteria); }; }; #endif /* ifndef _COS_LIFE_CYCLE_IDL_ */ synopsis-0.12/tests/Parsers/IDL/input/CosNaming.idl0000664000076400007640000000452611104703266021566 0ustar stefanstefan #ifndef _CosNaming_IDL_ #define _CosNaming_IDL_ #pragma prefix "omg.org" //. a CosNaming module module CosNaming { //. an Istring typedef typedef string Istring; //. a NameComponent struct. //. with a multi-line comment. struct NameComponent { //. an id member Istring id; //. a kind member Istring kind; }; //. a Name type. //. This is a sequence of NameComponents //. so it forms a scoped name of sorts typedef sequence Name; //. a BindingType enum enum BindingType { nobject, ncontext }; //. a Binding struct struct Binding { //. a binding_name member Name binding_name; //. a binding_type member BindingType binding_type; }; //. a BindingList type typedef sequence BindingList; interface BindingIterator; //. a NamingContext interface interface NamingContext { //. a NotFoundReason enum enum NotFoundReason { missing_node, not_context, not_object }; //. an exception exception NotFound { NotFoundReason why; Name rest_of_name; }; exception CannotProceed { NamingContext ctx; Name rest_of_name; }; exception InvalidName{}; exception AlreadyBound{}; exception NotEmpty{}; //. and the bind method... void bind(in Name n, in Object obj) raises(NotFound, CannotProceed, InvalidName, AlreadyBound); void rebind(in Name n, in Object obj) raises(NotFound, CannotProceed, InvalidName); void bind_context(in Name n, in NamingContext nc) raises(NotFound, CannotProceed, InvalidName, AlreadyBound); void rebind_context(in Name n, in NamingContext nc) raises(NotFound, CannotProceed, InvalidName); Object resolve(in Name n) raises(NotFound, CannotProceed, InvalidName); void unbind(in Name n) raises(NotFound, CannotProceed, InvalidName); NamingContext new_context(); NamingContext bind_new_context(in Name n) raises(NotFound, AlreadyBound, CannotProceed, InvalidName); void destroy() raises(NotEmpty); void list(in unsigned long how_many, out BindingList bl, out BindingIterator bi); }; interface BindingIterator { boolean next_one(out Binding b); boolean next_n(in unsigned long how_many, out BindingList bl); void destroy(); }; }; #endif /* !_CosNaming_IDL_ */ synopsis-0.12/tests/Parsers/IDL/synopsis.py.in0000664000076400007640000000060511104703266020717 0ustar stefanstefanfrom Synopsis.process import process from Synopsis.Processor import Composite from Synopsis.Parsers import IDL from Synopsis.Formatters import Dump import os process(parse = Composite(IDL.Parser(base_path = '@abs_top_srcdir@' + os.sep, cppflags = ['-I@srcdir@/input']), Dump.Formatter(show_ids = False, stylesheet = None))) synopsis-0.12/tests/Parsers/IDL/expected/0000775000076400007640000000000011172123233017644 5ustar stefanstefansynopsis-0.12/tests/Parsers/IDL/expected/CosNaming.xml0000664000076400007640000006527511104703266022270 0ustar stefanstefan comments //. an Istring typedef comments //. an id member comments //. a kind member comments //. a NameComponent struct. //. with a multi-line comment. comments //. a Name type. //. This is a sequence of NameComponents //. so it forms a scoped name of sorts comments //. a BindingType enum comments //. a binding_name member comments //. a binding_type member comments //. a Binding struct